Use tagged pointer to represent size/length values (#769)
1#[test]
2#[allow(non_snake_case)]
3fn absolute_resolved_insets__border_box() {
4 #[allow(unused_imports)]
5 use taffy::{prelude::*, Layout};
6 let mut taffy = crate::new_test_tree();
7 let node00 = taffy
8 .new_leaf(taffy::style::Style {
9 position: taffy::style::Position::Absolute,
10 inset: taffy::geometry::Rect {
11 left: taffy::style::LengthPercentageAuto::AUTO,
12 right: auto(),
13 top: taffy::style::LengthPercentageAuto::AUTO,
14 bottom: auto(),
15 },
16 ..Default::default()
17 })
18 .unwrap();
19 let node01 = taffy
20 .new_leaf(taffy::style::Style {
21 position: taffy::style::Position::Absolute,
22 inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() },
23 ..Default::default()
24 })
25 .unwrap();
26 let node02 = taffy
27 .new_leaf(taffy::style::Style {
28 position: taffy::style::Position::Absolute,
29 inset: taffy::geometry::Rect { left: percent(1f32), right: auto(), top: percent(1f32), bottom: auto() },
30 ..Default::default()
31 })
32 .unwrap();
33 let node03 = taffy
34 .new_leaf(taffy::style::Style {
35 position: taffy::style::Position::Absolute,
36 inset: taffy::geometry::Rect { left: auto(), right: percent(1f32), top: auto(), bottom: percent(1f32) },
37 ..Default::default()
38 })
39 .unwrap();
40 let node04 = taffy
41 .new_leaf(taffy::style::Style {
42 position: taffy::style::Position::Absolute,
43 inset: taffy::geometry::Rect { left: length(30f32), right: auto(), top: length(30f32), bottom: auto() },
44 ..Default::default()
45 })
46 .unwrap();
47 let node05 = taffy
48 .new_leaf(taffy::style::Style {
49 position: taffy::style::Position::Absolute,
50 size: taffy::geometry::Size {
51 width: taffy::style::Dimension::from_percent(1f32),
52 height: taffy::style::Dimension::from_percent(1f32),
53 },
54 inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() },
55 ..Default::default()
56 })
57 .unwrap();
58 let node0 = taffy
59 .new_with_children(
60 taffy::style::Style {
61 display: taffy::style::Display::Flex,
62 size: taffy::geometry::Size {
63 width: taffy::style::Dimension::from_length(200f32),
64 height: taffy::style::Dimension::from_length(200f32),
65 },
66 padding: taffy::geometry::Rect {
67 left: length(15f32),
68 right: length(15f32),
69 top: length(15f32),
70 bottom: length(15f32),
71 },
72 border: taffy::geometry::Rect {
73 left: length(20f32),
74 right: length(20f32),
75 top: length(20f32),
76 bottom: length(20f32),
77 },
78 ..Default::default()
79 },
80 &[node00, node01, node02, node03, node04, node05],
81 )
82 .unwrap();
83 let node10 = taffy
84 .new_leaf(taffy::style::Style {
85 position: taffy::style::Position::Absolute,
86 inset: taffy::geometry::Rect {
87 left: taffy::style::LengthPercentageAuto::AUTO,
88 right: auto(),
89 top: taffy::style::LengthPercentageAuto::AUTO,
90 bottom: auto(),
91 },
92 ..Default::default()
93 })
94 .unwrap();
95 let node11 = taffy
96 .new_leaf(taffy::style::Style {
97 position: taffy::style::Position::Absolute,
98 inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() },
99 ..Default::default()
100 })
101 .unwrap();
102 let node12 = taffy
103 .new_leaf(taffy::style::Style {
104 position: taffy::style::Position::Absolute,
105 inset: taffy::geometry::Rect { left: percent(1f32), right: auto(), top: percent(1f32), bottom: auto() },
106 ..Default::default()
107 })
108 .unwrap();
109 let node13 = taffy
110 .new_leaf(taffy::style::Style {
111 position: taffy::style::Position::Absolute,
112 inset: taffy::geometry::Rect { left: auto(), right: percent(1f32), top: auto(), bottom: percent(1f32) },
113 ..Default::default()
114 })
115 .unwrap();
116 let node14 = taffy
117 .new_leaf(taffy::style::Style {
118 position: taffy::style::Position::Absolute,
119 inset: taffy::geometry::Rect { left: length(30f32), right: auto(), top: length(30f32), bottom: auto() },
120 ..Default::default()
121 })
122 .unwrap();
123 let node15 = taffy
124 .new_leaf(taffy::style::Style {
125 position: taffy::style::Position::Absolute,
126 size: taffy::geometry::Size {
127 width: taffy::style::Dimension::from_percent(1f32),
128 height: taffy::style::Dimension::from_percent(1f32),
129 },
130 inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() },
131 ..Default::default()
132 })
133 .unwrap();
134 let node1 = taffy
135 .new_with_children(
136 taffy::style::Style {
137 display: taffy::style::Display::Flex,
138 overflow: taffy::geometry::Point {
139 x: taffy::style::Overflow::Scroll,
140 y: taffy::style::Overflow::Scroll,
141 },
142 scrollbar_width: 15f32,
143 size: taffy::geometry::Size {
144 width: taffy::style::Dimension::from_length(200f32),
145 height: taffy::style::Dimension::from_length(200f32),
146 },
147 padding: taffy::geometry::Rect {
148 left: length(15f32),
149 right: length(15f32),
150 top: length(15f32),
151 bottom: length(15f32),
152 },
153 border: taffy::geometry::Rect {
154 left: length(20f32),
155 right: length(20f32),
156 top: length(20f32),
157 bottom: length(20f32),
158 },
159 ..Default::default()
160 },
161 &[node10, node11, node12, node13, node14, node15],
162 )
163 .unwrap();
164 let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0, node1]).unwrap();
165 taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap();
166 println!("\nComputed tree:");
167 taffy.print_tree(node);
168 println!();
169 let layout = taffy.layout(node).unwrap();
170 let Layout { size, location, .. } = layout;
171 assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width);
172 assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height);
173 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
174 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
175 let layout = taffy.layout(node0).unwrap();
176 let Layout { size, location, .. } = layout;
177 assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width);
178 assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height);
179 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x);
180 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
181 let layout = taffy.layout(node00).unwrap();
182 let Layout { size, location, .. } = layout;
183 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width);
184 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height);
185 assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node00, 35f32, location.x);
186 assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node00, 35f32, location.y);
187 let layout = taffy.layout(node01).unwrap();
188 let Layout { size, location, .. } = layout;
189 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node01, 0f32, size.width);
190 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node01, 0f32, size.height);
191 assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x);
192 assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y);
193 let layout = taffy.layout(node02).unwrap();
194 let Layout { size, location, .. } = layout;
195 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node02, 0f32, size.width);
196 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node02, 0f32, size.height);
197 assert_eq!(location.x, 180f32, "x of node {:?}. Expected {}. Actual {}", node02, 180f32, location.x);
198 assert_eq!(location.y, 180f32, "y of node {:?}. Expected {}. Actual {}", node02, 180f32, location.y);
199 let layout = taffy.layout(node03).unwrap();
200 let Layout { size, location, .. } = layout;
201 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node03, 0f32, size.width);
202 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node03, 0f32, size.height);
203 assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x);
204 assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node03, 20f32, location.y);
205 let layout = taffy.layout(node04).unwrap();
206 let Layout { size, location, .. } = layout;
207 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node04, 0f32, size.width);
208 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node04, 0f32, size.height);
209 assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x);
210 assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y);
211 let layout = taffy.layout(node05).unwrap();
212 let Layout { size, location, .. } = layout;
213 assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node05, 160f32, size.width);
214 assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node05, 160f32, size.height);
215 assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node05, 20f32, location.x);
216 assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node05, 20f32, location.y);
217 let layout = taffy.layout(node1).unwrap();
218 let Layout { size, location, .. } = layout;
219 assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width);
220 assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node1, 200f32, size.height);
221 assert_eq!(location.x, 200f32, "x of node {:?}. Expected {}. Actual {}", node1, 200f32, location.x);
222 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y);
223 #[cfg(feature = "content_size")]
224 assert_eq!(
225 layout.scroll_width(),
226 0f32,
227 "scroll_width of node {:?}. Expected {}. Actual {}",
228 node1,
229 0f32,
230 layout.scroll_width()
231 );
232 #[cfg(feature = "content_size")]
233 assert_eq!(
234 layout.scroll_height(),
235 0f32,
236 "scroll_height of node {:?}. Expected {}. Actual {}",
237 node1,
238 0f32,
239 layout.scroll_height()
240 );
241 let layout = taffy.layout(node10).unwrap();
242 let Layout { size, location, .. } = layout;
243 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width);
244 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node10, 0f32, size.height);
245 assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node10, 35f32, location.x);
246 assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node10, 35f32, location.y);
247 let layout = taffy.layout(node11).unwrap();
248 let Layout { size, location, .. } = layout;
249 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node11, 0f32, size.width);
250 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node11, 0f32, size.height);
251 assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node11, 20f32, location.x);
252 assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node11, 20f32, location.y);
253 let layout = taffy.layout(node12).unwrap();
254 let Layout { size, location, .. } = layout;
255 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node12, 0f32, size.width);
256 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node12, 0f32, size.height);
257 assert_eq!(location.x, 165f32, "x of node {:?}. Expected {}. Actual {}", node12, 165f32, location.x);
258 assert_eq!(location.y, 165f32, "y of node {:?}. Expected {}. Actual {}", node12, 165f32, location.y);
259 let layout = taffy.layout(node13).unwrap();
260 let Layout { size, location, .. } = layout;
261 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node13, 0f32, size.width);
262 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node13, 0f32, size.height);
263 assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node13, 20f32, location.x);
264 assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y);
265 let layout = taffy.layout(node14).unwrap();
266 let Layout { size, location, .. } = layout;
267 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node14, 0f32, size.width);
268 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node14, 0f32, size.height);
269 assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node14, 50f32, location.x);
270 assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node14, 50f32, location.y);
271 let layout = taffy.layout(node15).unwrap();
272 let Layout { size, location, .. } = layout;
273 assert_eq!(size.width, 145f32, "width of node {:?}. Expected {}. Actual {}", node15, 145f32, size.width);
274 assert_eq!(size.height, 145f32, "height of node {:?}. Expected {}. Actual {}", node15, 145f32, size.height);
275 assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node15, 20f32, location.x);
276 assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node15, 20f32, location.y);
277}
278
279#[test]
280#[allow(non_snake_case)]
281fn absolute_resolved_insets__content_box() {
282 #[allow(unused_imports)]
283 use taffy::{prelude::*, Layout};
284 let mut taffy = crate::new_test_tree();
285 let node00 = taffy
286 .new_leaf(taffy::style::Style {
287 box_sizing: taffy::style::BoxSizing::ContentBox,
288 position: taffy::style::Position::Absolute,
289 inset: taffy::geometry::Rect {
290 left: taffy::style::LengthPercentageAuto::AUTO,
291 right: auto(),
292 top: taffy::style::LengthPercentageAuto::AUTO,
293 bottom: auto(),
294 },
295 ..Default::default()
296 })
297 .unwrap();
298 let node01 = taffy
299 .new_leaf(taffy::style::Style {
300 box_sizing: taffy::style::BoxSizing::ContentBox,
301 position: taffy::style::Position::Absolute,
302 inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() },
303 ..Default::default()
304 })
305 .unwrap();
306 let node02 = taffy
307 .new_leaf(taffy::style::Style {
308 box_sizing: taffy::style::BoxSizing::ContentBox,
309 position: taffy::style::Position::Absolute,
310 inset: taffy::geometry::Rect { left: percent(1f32), right: auto(), top: percent(1f32), bottom: auto() },
311 ..Default::default()
312 })
313 .unwrap();
314 let node03 = taffy
315 .new_leaf(taffy::style::Style {
316 box_sizing: taffy::style::BoxSizing::ContentBox,
317 position: taffy::style::Position::Absolute,
318 inset: taffy::geometry::Rect { left: auto(), right: percent(1f32), top: auto(), bottom: percent(1f32) },
319 ..Default::default()
320 })
321 .unwrap();
322 let node04 = taffy
323 .new_leaf(taffy::style::Style {
324 box_sizing: taffy::style::BoxSizing::ContentBox,
325 position: taffy::style::Position::Absolute,
326 inset: taffy::geometry::Rect { left: length(30f32), right: auto(), top: length(30f32), bottom: auto() },
327 ..Default::default()
328 })
329 .unwrap();
330 let node05 = taffy
331 .new_leaf(taffy::style::Style {
332 box_sizing: taffy::style::BoxSizing::ContentBox,
333 position: taffy::style::Position::Absolute,
334 size: taffy::geometry::Size {
335 width: taffy::style::Dimension::from_percent(1f32),
336 height: taffy::style::Dimension::from_percent(1f32),
337 },
338 inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() },
339 ..Default::default()
340 })
341 .unwrap();
342 let node0 = taffy
343 .new_with_children(
344 taffy::style::Style {
345 display: taffy::style::Display::Flex,
346 box_sizing: taffy::style::BoxSizing::ContentBox,
347 size: taffy::geometry::Size {
348 width: taffy::style::Dimension::from_length(200f32),
349 height: taffy::style::Dimension::from_length(200f32),
350 },
351 padding: taffy::geometry::Rect {
352 left: length(15f32),
353 right: length(15f32),
354 top: length(15f32),
355 bottom: length(15f32),
356 },
357 border: taffy::geometry::Rect {
358 left: length(20f32),
359 right: length(20f32),
360 top: length(20f32),
361 bottom: length(20f32),
362 },
363 ..Default::default()
364 },
365 &[node00, node01, node02, node03, node04, node05],
366 )
367 .unwrap();
368 let node10 = taffy
369 .new_leaf(taffy::style::Style {
370 box_sizing: taffy::style::BoxSizing::ContentBox,
371 position: taffy::style::Position::Absolute,
372 inset: taffy::geometry::Rect {
373 left: taffy::style::LengthPercentageAuto::AUTO,
374 right: auto(),
375 top: taffy::style::LengthPercentageAuto::AUTO,
376 bottom: auto(),
377 },
378 ..Default::default()
379 })
380 .unwrap();
381 let node11 = taffy
382 .new_leaf(taffy::style::Style {
383 box_sizing: taffy::style::BoxSizing::ContentBox,
384 position: taffy::style::Position::Absolute,
385 inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() },
386 ..Default::default()
387 })
388 .unwrap();
389 let node12 = taffy
390 .new_leaf(taffy::style::Style {
391 box_sizing: taffy::style::BoxSizing::ContentBox,
392 position: taffy::style::Position::Absolute,
393 inset: taffy::geometry::Rect { left: percent(1f32), right: auto(), top: percent(1f32), bottom: auto() },
394 ..Default::default()
395 })
396 .unwrap();
397 let node13 = taffy
398 .new_leaf(taffy::style::Style {
399 box_sizing: taffy::style::BoxSizing::ContentBox,
400 position: taffy::style::Position::Absolute,
401 inset: taffy::geometry::Rect { left: auto(), right: percent(1f32), top: auto(), bottom: percent(1f32) },
402 ..Default::default()
403 })
404 .unwrap();
405 let node14 = taffy
406 .new_leaf(taffy::style::Style {
407 box_sizing: taffy::style::BoxSizing::ContentBox,
408 position: taffy::style::Position::Absolute,
409 inset: taffy::geometry::Rect { left: length(30f32), right: auto(), top: length(30f32), bottom: auto() },
410 ..Default::default()
411 })
412 .unwrap();
413 let node15 = taffy
414 .new_leaf(taffy::style::Style {
415 box_sizing: taffy::style::BoxSizing::ContentBox,
416 position: taffy::style::Position::Absolute,
417 size: taffy::geometry::Size {
418 width: taffy::style::Dimension::from_percent(1f32),
419 height: taffy::style::Dimension::from_percent(1f32),
420 },
421 inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() },
422 ..Default::default()
423 })
424 .unwrap();
425 let node1 = taffy
426 .new_with_children(
427 taffy::style::Style {
428 display: taffy::style::Display::Flex,
429 box_sizing: taffy::style::BoxSizing::ContentBox,
430 overflow: taffy::geometry::Point {
431 x: taffy::style::Overflow::Scroll,
432 y: taffy::style::Overflow::Scroll,
433 },
434 scrollbar_width: 15f32,
435 size: taffy::geometry::Size {
436 width: taffy::style::Dimension::from_length(200f32),
437 height: taffy::style::Dimension::from_length(200f32),
438 },
439 padding: taffy::geometry::Rect {
440 left: length(15f32),
441 right: length(15f32),
442 top: length(15f32),
443 bottom: length(15f32),
444 },
445 border: taffy::geometry::Rect {
446 left: length(20f32),
447 right: length(20f32),
448 top: length(20f32),
449 bottom: length(20f32),
450 },
451 ..Default::default()
452 },
453 &[node10, node11, node12, node13, node14, node15],
454 )
455 .unwrap();
456 let node = taffy
457 .new_with_children(
458 taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() },
459 &[node0, node1],
460 )
461 .unwrap();
462 taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap();
463 println!("\nComputed tree:");
464 taffy.print_tree(node);
465 println!();
466 let layout = taffy.layout(node).unwrap();
467 let Layout { size, location, .. } = layout;
468 assert_eq!(size.width, 540f32, "width of node {:?}. Expected {}. Actual {}", node, 540f32, size.width);
469 assert_eq!(size.height, 270f32, "height of node {:?}. Expected {}. Actual {}", node, 270f32, size.height);
470 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
471 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
472 let layout = taffy.layout(node0).unwrap();
473 let Layout { size, location, .. } = layout;
474 assert_eq!(size.width, 270f32, "width of node {:?}. Expected {}. Actual {}", node0, 270f32, size.width);
475 assert_eq!(size.height, 270f32, "height of node {:?}. Expected {}. Actual {}", node0, 270f32, size.height);
476 assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x);
477 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
478 let layout = taffy.layout(node00).unwrap();
479 let Layout { size, location, .. } = layout;
480 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width);
481 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height);
482 assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node00, 35f32, location.x);
483 assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node00, 35f32, location.y);
484 let layout = taffy.layout(node01).unwrap();
485 let Layout { size, location, .. } = layout;
486 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node01, 0f32, size.width);
487 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node01, 0f32, size.height);
488 assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x);
489 assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y);
490 let layout = taffy.layout(node02).unwrap();
491 let Layout { size, location, .. } = layout;
492 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node02, 0f32, size.width);
493 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node02, 0f32, size.height);
494 assert_eq!(location.x, 250f32, "x of node {:?}. Expected {}. Actual {}", node02, 250f32, location.x);
495 assert_eq!(location.y, 250f32, "y of node {:?}. Expected {}. Actual {}", node02, 250f32, location.y);
496 let layout = taffy.layout(node03).unwrap();
497 let Layout { size, location, .. } = layout;
498 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node03, 0f32, size.width);
499 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node03, 0f32, size.height);
500 assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x);
501 assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node03, 20f32, location.y);
502 let layout = taffy.layout(node04).unwrap();
503 let Layout { size, location, .. } = layout;
504 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node04, 0f32, size.width);
505 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node04, 0f32, size.height);
506 assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x);
507 assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y);
508 let layout = taffy.layout(node05).unwrap();
509 let Layout { size, location, .. } = layout;
510 assert_eq!(size.width, 230f32, "width of node {:?}. Expected {}. Actual {}", node05, 230f32, size.width);
511 assert_eq!(size.height, 230f32, "height of node {:?}. Expected {}. Actual {}", node05, 230f32, size.height);
512 assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node05, 20f32, location.x);
513 assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node05, 20f32, location.y);
514 let layout = taffy.layout(node1).unwrap();
515 let Layout { size, location, .. } = layout;
516 assert_eq!(size.width, 270f32, "width of node {:?}. Expected {}. Actual {}", node1, 270f32, size.width);
517 assert_eq!(size.height, 270f32, "height of node {:?}. Expected {}. Actual {}", node1, 270f32, size.height);
518 assert_eq!(location.x, 270f32, "x of node {:?}. Expected {}. Actual {}", node1, 270f32, location.x);
519 assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y);
520 #[cfg(feature = "content_size")]
521 assert_eq!(
522 layout.scroll_width(),
523 0f32,
524 "scroll_width of node {:?}. Expected {}. Actual {}",
525 node1,
526 0f32,
527 layout.scroll_width()
528 );
529 #[cfg(feature = "content_size")]
530 assert_eq!(
531 layout.scroll_height(),
532 0f32,
533 "scroll_height of node {:?}. Expected {}. Actual {}",
534 node1,
535 0f32,
536 layout.scroll_height()
537 );
538 let layout = taffy.layout(node10).unwrap();
539 let Layout { size, location, .. } = layout;
540 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width);
541 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node10, 0f32, size.height);
542 assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node10, 35f32, location.x);
543 assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node10, 35f32, location.y);
544 let layout = taffy.layout(node11).unwrap();
545 let Layout { size, location, .. } = layout;
546 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node11, 0f32, size.width);
547 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node11, 0f32, size.height);
548 assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node11, 20f32, location.x);
549 assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node11, 20f32, location.y);
550 let layout = taffy.layout(node12).unwrap();
551 let Layout { size, location, .. } = layout;
552 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node12, 0f32, size.width);
553 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node12, 0f32, size.height);
554 assert_eq!(location.x, 235f32, "x of node {:?}. Expected {}. Actual {}", node12, 235f32, location.x);
555 assert_eq!(location.y, 235f32, "y of node {:?}. Expected {}. Actual {}", node12, 235f32, location.y);
556 let layout = taffy.layout(node13).unwrap();
557 let Layout { size, location, .. } = layout;
558 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node13, 0f32, size.width);
559 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node13, 0f32, size.height);
560 assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node13, 20f32, location.x);
561 assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y);
562 let layout = taffy.layout(node14).unwrap();
563 let Layout { size, location, .. } = layout;
564 assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node14, 0f32, size.width);
565 assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node14, 0f32, size.height);
566 assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node14, 50f32, location.x);
567 assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node14, 50f32, location.y);
568 let layout = taffy.layout(node15).unwrap();
569 let Layout { size, location, .. } = layout;
570 assert_eq!(size.width, 215f32, "width of node {:?}. Expected {}. Actual {}", node15, 215f32, size.width);
571 assert_eq!(size.height, 215f32, "height of node {:?}. Expected {}. Actual {}", node15, 215f32, size.height);
572 assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node15, 20f32, location.x);
573 assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node15, 20f32, location.y);
574}