🐛 Fix vertical positioning.

This commit is contained in:
Andrey Antukh 2020-06-15 14:02:58 +02:00 committed by Andrés Moya
parent 65c9c46a22
commit 1dfc604cf0
4 changed files with 39 additions and 171 deletions

View file

@ -165,115 +165,6 @@
res (cp/process-changes data [chg])]
(t/is (= 0 (count (:objects res))))))
(t/deftest process-change-mod-obj-abs-order
(let [id1 (uuid/next)
id2 (uuid/next)
id3 (uuid/next)
data (-> cp/default-page-data
(assoc-in [:objects uuid/zero :shapes] [id1 id2 id3]))]
(t/testing "abs order 1"
(let [chg {:type :mod-obj
:id uuid/zero
:operations [{:type :abs-order
:id id3
:index 0}]}
res (cp/process-changes data [chg])]
;; (clojure.pprint/pprint data)
;; (clojure.pprint/pprint res)
(t/is (= [id3 id1 id2] (get-in res [:objects uuid/zero :shapes])))))
(t/testing "abs order 2"
(let [chg {:type :mod-obj
:id uuid/zero
:operations [{:type :abs-order
:id id1
:index 100}]}
res (cp/process-changes data [chg])]
;; (clojure.pprint/pprint data)
;; (clojure.pprint/pprint res)
(t/is (= [id2 id3 id1] (get-in res [:objects uuid/zero :shapes])))))
(t/testing "abs order 3"
(let [chg {:type :mod-obj
:id uuid/zero
:operations [{:type :abs-order
:id id3
:index 1}]}
res (cp/process-changes data [chg])]
;; (clojure.pprint/pprint data)
;; (clojure.pprint/pprint res)
(t/is (= [id1 id3 id2] (get-in res [:objects uuid/zero :shapes])))))
))
(t/deftest process-change-mod-obj-rel-order
(let [id1 (uuid/next)
id2 (uuid/next)
id3 (uuid/next)
data (-> cp/default-page-data
(assoc-in [:objects uuid/zero :shapes] [id1 id2 id3]))]
(t/testing "rel order 1"
(let [chg {:type :mod-obj
:id uuid/zero
:operations [{:type :rel-order
:id id3
:loc :down}]}
res (cp/process-changes data [chg])]
;; (clojure.pprint/pprint data)
;; (clojure.pprint/pprint res)
(t/is (= [id1 id3 id2] (get-in res [:objects uuid/zero :shapes])))))
(t/testing "rel order 2"
(let [chg {:type :mod-obj
:id uuid/zero
:operations [{:type :rel-order
:id id1
:loc :top}]}
res (cp/process-changes data [chg])]
;; (clojure.pprint/pprint data)
;; (clojure.pprint/pprint res)
(t/is (= [id2 id3 id1] (get-in res [:objects uuid/zero :shapes])))))
(t/testing "rel order 3"
(let [chg {:type :mod-obj
:id uuid/zero
:operations [{:type :rel-order
:id id2
:loc :up}]}
res (cp/process-changes data [chg])]
;; (clojure.pprint/pprint data)
;; (clojure.pprint/pprint res)
(t/is (= [id1 id3 id2] (get-in res [:objects uuid/zero :shapes])))))
(t/testing "rel order 4"
(let [chg {:type :mod-obj
:id uuid/zero
:operations [{:type :rel-order
:id id3
:loc :bottom}]}
res (cp/process-changes data [chg])]
;; (clojure.pprint/pprint data)
;; (clojure.pprint/pprint res)
(t/is (= [id3 id1 id2] (get-in res [:objects uuid/zero :shapes])))))
))
(t/deftest process-change-move-objects
(let [frame-a-id (uuid/custom 1)
frame-b-id (uuid/custom 2)