|
11 | 11 | :cy "0"
|
12 | 12 | :r "50"}}]
|
13 | 13 |
|
14 |
| - (is (= (hierarchy/translate circle-el [50 50]) |
15 |
| - {:type :element |
16 |
| - :tag :circle |
17 |
| - :attrs {:cx "50" |
18 |
| - :cy "50" |
19 |
| - :r "50"}})) |
20 |
| - |
21 |
| - (is (= (hierarchy/scale circle-el [2 2] [50 50]) |
22 |
| - {:type :element |
23 |
| - :tag :circle |
24 |
| - :attrs {:cx "0" |
25 |
| - :cy "0" |
26 |
| - :r "100"}})) |
27 |
| - |
28 |
| - (is (= (hierarchy/scale circle-el [2 2] [0 0]) |
29 |
| - {:type :element |
30 |
| - :tag :circle |
31 |
| - :attrs {:cx "50" |
32 |
| - :cy "50" |
33 |
| - :r "100"}})) |
| 14 | + (is (= (:attrs (hierarchy/translate circle-el [50 50])) |
| 15 | + {:cx "50" |
| 16 | + :cy "50" |
| 17 | + :r "50"})) |
| 18 | + |
| 19 | + (is (= (:attrs (hierarchy/scale circle-el [2 2] [50 50])) |
| 20 | + {:cx "0" |
| 21 | + :cy "0" |
| 22 | + :r "100"})) |
| 23 | + |
| 24 | + (is (= (:attrs (hierarchy/scale circle-el [2 2] [0 0])) |
| 25 | + {:cx "50" |
| 26 | + :cy "50" |
| 27 | + :r "100"})) |
34 | 28 |
|
35 | 29 | (is (= (hierarchy/bounds circle-el)
|
36 | 30 | [-50 -50 50 50]))
|
|
46 | 40 | :width "50"
|
47 | 41 | :height "50"}}]
|
48 | 42 |
|
49 |
| - (is (= (hierarchy/translate rect-el [50 50]) |
50 |
| - {:type :element |
51 |
| - :tag :rect |
52 |
| - :attrs {:x "50" |
53 |
| - :y "50" |
54 |
| - :width "50" |
55 |
| - :height "50"}})) |
56 |
| - |
57 |
| - (is (= (hierarchy/scale rect-el [2 2] [25 25]) |
58 |
| - {:type :element |
59 |
| - :tag :rect |
60 |
| - :attrs {:x "-25" |
61 |
| - :y "-25" |
62 |
| - :width "100" |
63 |
| - :height "100"}})) |
64 |
| - |
65 |
| - (is (= (hierarchy/scale rect-el [2 2] [0 0]) |
66 |
| - {:type :element |
67 |
| - :tag :rect |
68 |
| - :attrs {:x "0" |
69 |
| - :y "0" |
70 |
| - :width "100" |
71 |
| - :height "100"}})) |
| 43 | + (is (= (:attrs (hierarchy/translate rect-el [50 50])) |
| 44 | + {:x "50" |
| 45 | + :y "50" |
| 46 | + :width "50" |
| 47 | + :height "50"})) |
| 48 | + |
| 49 | + (is (= (:attrs (hierarchy/scale rect-el [2 2] [25 25])) |
| 50 | + {:x "-25" |
| 51 | + :y "-25" |
| 52 | + :width "100" |
| 53 | + :height "100"})) |
| 54 | + |
| 55 | + (is (= (:attrs (hierarchy/scale rect-el [2 2] [0 0])) |
| 56 | + {:x "0" |
| 57 | + :y "0" |
| 58 | + :width "100" |
| 59 | + :height "100"})) |
72 | 60 |
|
73 | 61 | (is (= (hierarchy/bounds rect-el)
|
74 | 62 | [0 0 50 50]))
|
|
84 | 72 | :rx "50"
|
85 | 73 | :ry "50"}}]
|
86 | 74 |
|
87 |
| - (is (= (hierarchy/translate ellipse-el [50 50]) |
88 |
| - {:type :element |
89 |
| - :tag :ellipse |
90 |
| - :attrs {:cx "50" |
91 |
| - :cy "50" |
92 |
| - :rx "50" |
93 |
| - :ry "50"}})) |
94 |
| - |
95 |
| - (is (= (hierarchy/scale ellipse-el [2 2] [25 25]) |
96 |
| - {:type :element |
97 |
| - :tag :ellipse |
98 |
| - :attrs {:cx "25" |
99 |
| - :cy "25" |
100 |
| - :rx "100" |
101 |
| - :ry "100"}})) |
102 |
| - |
103 |
| - (is (= (hierarchy/scale ellipse-el [2 2] [0 0]) |
104 |
| - {:type :element |
105 |
| - :tag :ellipse |
106 |
| - :attrs {:cx "50" |
107 |
| - :cy "50" |
108 |
| - :rx "100" |
109 |
| - :ry "100"}})) |
| 75 | + (is (= (:attrs (hierarchy/translate ellipse-el [50 50])) |
| 76 | + {:cx "50" |
| 77 | + :cy "50" |
| 78 | + :rx "50" |
| 79 | + :ry "50"})) |
| 80 | + |
| 81 | + (is (= (:attrs (hierarchy/scale ellipse-el [2 2] [25 25])) |
| 82 | + {:cx "25" |
| 83 | + :cy "25" |
| 84 | + :rx "100" |
| 85 | + :ry "100"})) |
| 86 | + |
| 87 | + (is (= (:attrs (hierarchy/scale ellipse-el [2 2] [0 0])) |
| 88 | + {:cx "50" |
| 89 | + :cy "50" |
| 90 | + :rx "100" |
| 91 | + :ry "100"})) |
110 | 92 |
|
111 | 93 | (is (= (hierarchy/bounds ellipse-el)
|
112 | 94 | [-50 -50 50 50]))
|
|
122 | 104 | :x2 "50"
|
123 | 105 | :y2 "50"}}]
|
124 | 106 |
|
125 |
| - (is (= (hierarchy/translate line-el [50 50]) |
126 |
| - {:type :element |
127 |
| - :tag :line |
128 |
| - :attrs {:x1 "50" |
129 |
| - :y1 "50" |
130 |
| - :x2 "100" |
131 |
| - :y2 "100"}})) |
132 |
| - |
133 |
| - (is (= (hierarchy/scale line-el [2 2] [25 25]) |
134 |
| - {:type :element |
135 |
| - :tag :line |
136 |
| - :attrs {:x1 "-25" |
137 |
| - :y1 "-25" |
138 |
| - :x2 "75" |
139 |
| - :y2 "75"}})) |
140 |
| - |
141 |
| - (is (= (hierarchy/scale line-el [2 2] [0 0]) |
142 |
| - {:type :element |
143 |
| - :tag :line |
144 |
| - :attrs {:x1 "0" |
145 |
| - :y1 "0" |
146 |
| - :x2 "100" |
147 |
| - :y2 "100"}})) |
| 107 | + (is (= (:attrs (hierarchy/translate line-el [50 50])) |
| 108 | + {:x1 "50" |
| 109 | + :y1 "50" |
| 110 | + :x2 "100" |
| 111 | + :y2 "100"})) |
| 112 | + |
| 113 | + (is (= (:attrs (hierarchy/scale line-el [2 2] [25 25])) |
| 114 | + {:x1 "-25" |
| 115 | + :y1 "-25" |
| 116 | + :x2 "75" |
| 117 | + :y2 "75"})) |
| 118 | + |
| 119 | + (is (= (:attrs (hierarchy/scale line-el [2 2] [0 0])) |
| 120 | + {:x1 "0" |
| 121 | + :y1 "0" |
| 122 | + :x2 "100" |
| 123 | + :y2 "100"})) |
148 | 124 |
|
149 | 125 | (is (= (hierarchy/bounds line-el)
|
150 | 126 | [0 0 50 50]))
|
|
157 | 133 | :tag :polygon
|
158 | 134 | :attrs {:points "528 -305 718 -370 941 -208"}}]
|
159 | 135 |
|
160 |
| - (is (= (hierarchy/translate polygon-el [10 10]) |
161 |
| - {:type :element |
162 |
| - :tag :polygon |
163 |
| - :attrs {:points "538 -295 728 -360 951 -198"}})) |
| 136 | + (is (= (:attrs (hierarchy/translate polygon-el [10 10])) |
| 137 | + {:points "538 -295 728 -360 951 -198"})) |
164 | 138 |
|
165 |
| - (is (= (hierarchy/scale polygon-el [2 2] [25 25]) |
166 |
| - {:type :element |
167 |
| - :tag :polygon |
168 |
| - :attrs {:points "503 -265 883 -395 1329 -71"}})) |
| 139 | + (is (= (:attrs (hierarchy/scale polygon-el [2 2] [25 25])) |
| 140 | + {:points "503 -265 883 -395 1329 -71"})) |
169 | 141 |
|
170 |
| - (is (= (hierarchy/scale polygon-el [2 2] [0 0]) |
171 |
| - {:type :element |
172 |
| - :tag :polygon |
173 |
| - :attrs {:points "528 -240 908 -370 1354 -46"}})) |
| 142 | + (is (= (:attrs (hierarchy/scale polygon-el [2 2] [0 0])) |
| 143 | + {:points "528 -240 908 -370 1354 -46"})) |
174 | 144 |
|
175 | 145 | (is (= (hierarchy/bounds polygon-el)
|
176 | 146 | [528 -370 941 -208]))
|
|
186 | 156 | :tag :polyline
|
187 | 157 | :attrs {:points "528 -305 718 -370 941 -208"}}]
|
188 | 158 |
|
189 |
| - (is (= (hierarchy/translate polyline-el [10 10]) |
190 |
| - {:type :element |
191 |
| - :tag :polyline |
192 |
| - :attrs {:points "538 -295 728 -360 951 -198"}})) |
| 159 | + (is (= (:attrs (hierarchy/translate polyline-el [10 10])) |
| 160 | + {:points "538 -295 728 -360 951 -198"})) |
193 | 161 |
|
194 |
| - (is (= (hierarchy/scale polyline-el [2 2] [25 25]) |
195 |
| - {:type :element |
196 |
| - :tag :polyline |
197 |
| - :attrs {:points "503 -265 883 -395 1329 -71"}})) |
| 162 | + (is (= (:attrs (hierarchy/scale polyline-el [2 2] [25 25])) |
| 163 | + {:points "503 -265 883 -395 1329 -71"})) |
198 | 164 |
|
199 |
| - (is (= (hierarchy/scale polyline-el [2 2] [0 0]) |
200 |
| - {:type :element |
201 |
| - :tag :polyline |
202 |
| - :attrs {:points "528 -240 908 -370 1354 -46"}})) |
| 165 | + (is (= (:attrs (hierarchy/scale polyline-el [2 2] [0 0])) |
| 166 | + {:points "528 -240 908 -370 1354 -46"})) |
203 | 167 |
|
204 | 168 | (is (= (hierarchy/bounds polyline-el)
|
205 | 169 | [528 -370 941 -208]))
|
|
215 | 179 | :tag :path
|
216 | 180 | :attrs {:d "M528 -305 718 -371 941 -208 663 -174 664 -261z"}}]
|
217 | 181 |
|
218 |
| - (is (= (hierarchy/translate path-el [10 10]) |
219 |
| - {:type :element |
220 |
| - :tag :path |
221 |
| - :attrs {:d "M538-295L728-361 951-198 673-164 674-251z"}})) |
| 182 | + (is (= (:attrs (hierarchy/translate path-el [10 10])) |
| 183 | + {:d "M538-295L728-361 951-198 673-164 674-251z"})) |
222 | 184 |
|
223 |
| - (is (= (hierarchy/scale path-el [2 2] [25 25]) |
224 |
| - {:type :element |
225 |
| - :tag :path |
226 |
| - :attrs {:d "M503-264L883-396 1329-70 773-2 775-176z"}})) |
| 185 | + (is (= (:attrs (hierarchy/scale path-el [2 2] [25 25])) |
| 186 | + {:d "M503-264L883-396 1329-70 773-2 775-176z"})) |
227 | 187 |
|
228 |
| - (is (= (hierarchy/scale path-el [2 2] [0 0]) |
229 |
| - {:type :element |
230 |
| - :tag :path |
231 |
| - :attrs {:d "M528-239L908-371 1354-45 798 23 800-151z"}})) |
| 188 | + (is (= (:attrs (hierarchy/scale path-el [2 2] [0 0])) |
| 189 | + {:d "M528-239L908-371 1354-45 798 23 800-151z"})) |
232 | 190 |
|
233 | 191 | (is (= (hierarchy/bounds path-el)
|
234 | 192 | [528 -371 941 -174]))
|
|
243 | 201 | :width "50"
|
244 | 202 | :height "50"}}]
|
245 | 203 |
|
246 |
| - (is (= (hierarchy/translate svg-el [50 50]) |
247 |
| - {:type :element |
248 |
| - :tag :svg |
249 |
| - :attrs {:x "50" |
250 |
| - :y "50" |
251 |
| - :width "50" |
252 |
| - :height "50"}})) |
253 |
| - |
254 |
| - (is (= (hierarchy/scale svg-el [2 2] [25 25]) |
255 |
| - {:type :element |
256 |
| - :tag :svg |
257 |
| - :attrs {:x "-25" |
258 |
| - :y "-25" |
259 |
| - :width "100" |
260 |
| - :height "100"}})) |
261 |
| - |
262 |
| - (is (= (hierarchy/scale svg-el [2 2] [0 0]) |
263 |
| - {:type :element |
264 |
| - :tag :svg |
265 |
| - :attrs {:x "0" |
266 |
| - :y "0" |
267 |
| - :width "100" |
268 |
| - :height "100"}})) |
| 204 | + (is (= (:attrs (hierarchy/translate svg-el [50 50])) |
| 205 | + {:x "50" |
| 206 | + :y "50" |
| 207 | + :width "50" |
| 208 | + :height "50"})) |
| 209 | + |
| 210 | + (is (= (:attrs (hierarchy/scale svg-el [2 2] [25 25])) |
| 211 | + {:x "-25" |
| 212 | + :y "-25" |
| 213 | + :width "100" |
| 214 | + :height "100"})) |
| 215 | + |
| 216 | + (is (= (:attrs (hierarchy/scale svg-el [2 2] [0 0])) |
| 217 | + {:x "0" |
| 218 | + :y "0" |
| 219 | + :width "100" |
| 220 | + :height "100"})) |
269 | 221 |
|
270 | 222 | (is (= (hierarchy/bounds svg-el)
|
271 | 223 | [0 0 50 50]))
|
|
281 | 233 | :width "50"
|
282 | 234 | :height "50"}}]
|
283 | 235 |
|
284 |
| - (is (= (hierarchy/translate text-el [50 50]) |
285 |
| - {:type :element |
286 |
| - :tag :text |
287 |
| - :content "My text" |
288 |
| - :attrs {:x "50" |
289 |
| - :y "50" |
290 |
| - :width "50" |
291 |
| - :height "50"}})))) |
| 236 | + (is (= (:attrs (hierarchy/translate text-el [50 50])) |
| 237 | + {:x "50" |
| 238 | + :y "50" |
| 239 | + :width "50" |
| 240 | + :height "50"})))) |
0 commit comments