2 * Copyright (c) 2014, Facebook, Inc.
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree. An additional grant
7 * of patent rights can be found in the PATENTS file in the same directory.
10 #include "layout-test-utils.h"
17 /* define fmaxf & fminf if < VC12 */
19 inline float fmaxf(const float a, const float b) {
20 return (a > b) ? a : b;
22 inline float fminf(const float a, const float b) {
23 return (a < b) ? a : b;
28 /** START_GENERATED **/
29 #define SMALL_WIDTH 35
30 #define SMALL_HEIGHT 18
33 #define BIG_MIN_WIDTH 100
34 #define SMALL_TEXT "small"
35 #define LONG_TEXT "loooooooooong with space"
36 #define MEASURE_WITH_RATIO_2 "measureWithRatio2"
37 #define MEASURE_WITH_MATCH_PARENT "measureWithMatchParent"
40 typedef struct failed_test_t {
41 struct failed_test_t *next;
47 static failed_test_t *failed_test_head = NULL;
48 static failed_test_t *failed_test_tail = NULL;
49 static void add_failed_test(const char *name, css_node_t *style, css_node_t *expected) {
50 failed_test_t *failed_test = (failed_test_t *)malloc(sizeof(failed_test_t));
51 failed_test->next = NULL;
52 failed_test->name = name;
53 failed_test->style = style;
54 failed_test->expected = expected;
56 if (!failed_test_head) {
57 failed_test_head = failed_test;
58 failed_test_tail = failed_test;
60 failed_test_tail->next = failed_test;
61 failed_test_tail = failed_test;
65 static bool eq(float a, float b) {
66 return fabs(a - b) < 0.0001;
69 static bool are_layout_equal(css_node_t *a, css_node_t *b) {
70 if (!eq(a->layout.dimensions[CSS_WIDTH], b->layout.dimensions[CSS_WIDTH]) ||
71 !eq(a->layout.dimensions[CSS_HEIGHT], b->layout.dimensions[CSS_HEIGHT]) ||
72 !eq(a->layout.position[CSS_TOP], b->layout.position[CSS_TOP]) ||
73 !eq(a->layout.position[CSS_LEFT], b->layout.position[CSS_LEFT]) ||
74 !eq(a->children_count, b->children_count)) {
78 for (i = 0; i < a->children_count; ++i) {
79 if (!are_layout_equal(a->get_child(a->context, i), b->get_child(b->context, i))) {
86 css_dim_t measure(void *context, float width, css_measure_mode_t widthMode, float height, css_measure_mode_t heightMode) {
87 const char *text = (const char *)context;
89 if (strcmp(text, SMALL_TEXT) == 0) {
90 if (widthMode == CSS_MEASURE_MODE_UNDEFINED) {
93 dim.dimensions[CSS_WIDTH] = fminf(SMALL_WIDTH, width);
94 dim.dimensions[CSS_HEIGHT] = SMALL_HEIGHT;
97 if (strcmp(text, LONG_TEXT) == 0) {
98 if (widthMode == CSS_MEASURE_MODE_UNDEFINED) {
101 dim.dimensions[CSS_WIDTH] = width >= BIG_WIDTH ? BIG_WIDTH : fmaxf(BIG_MIN_WIDTH, width);
102 dim.dimensions[CSS_HEIGHT] = width >= BIG_WIDTH ? SMALL_HEIGHT : BIG_HEIGHT;
106 if (strcmp(text, MEASURE_WITH_RATIO_2) == 0) {
107 if (widthMode != CSS_MEASURE_MODE_UNDEFINED) {
108 dim.dimensions[CSS_WIDTH] = width;
109 dim.dimensions[CSS_HEIGHT] = width * 2;
110 } else if (heightMode != CSS_MEASURE_MODE_UNDEFINED) {
111 dim.dimensions[CSS_WIDTH] = height * 2;
112 dim.dimensions[CSS_HEIGHT] = height;
114 dim.dimensions[CSS_WIDTH] = 99999;
115 dim.dimensions[CSS_HEIGHT] = 99999;
120 if (strcmp(text, MEASURE_WITH_MATCH_PARENT) == 0) {
121 if (widthMode == CSS_MEASURE_MODE_UNDEFINED) {
124 if (heightMode == CSS_MEASURE_MODE_UNDEFINED) {
127 dim.dimensions[CSS_WIDTH] = width;
128 dim.dimensions[CSS_HEIGHT] = height;
132 // Should not go here
133 dim.dimensions[CSS_WIDTH] = CSS_UNDEFINED;
134 dim.dimensions[CSS_HEIGHT] = CSS_UNDEFINED;
138 static int test_ran_count = 0;
139 void test(const char *name, css_node_t *style, css_node_t *expected_layout) {
141 layoutNode(style, CSS_UNDEFINED, CSS_UNDEFINED, (css_direction_t)-1);
143 if (!are_layout_equal(style, expected_layout)) {
144 printf("%sF%s", "\x1B[31m", "\x1B[0m");
145 add_failed_test(name, style, expected_layout);
147 printf("%s.%s", "\x1B[32m", "\x1B[0m");
148 free_css_node(style);
149 free_css_node(expected_layout);
153 bool tests_finished() {
154 failed_test_t *failed_test = failed_test_head;
157 int tests_failed = 0;
158 while (failed_test) {
159 printf("%sFAIL%s %s\n", "\x1B[31m", "\x1B[0m", failed_test->name);
162 print_css_node(failed_test->style, (css_print_options_t)(CSS_PRINT_STYLE | CSS_PRINT_CHILDREN));
164 print_css_node(failed_test->style, (css_print_options_t)(CSS_PRINT_LAYOUT | CSS_PRINT_CHILDREN));
166 printf("Expected: ");
167 print_css_node(failed_test->expected, (css_print_options_t)(CSS_PRINT_LAYOUT | CSS_PRINT_CHILDREN));
169 free_css_node(failed_test->style);
170 free_css_node(failed_test->expected);
172 failed_test_t *next_failed_test = failed_test->next;
174 failed_test = next_failed_test;
180 if (tests_failed > 0) {
181 printf("TESTS FAILED: %d\n", tests_failed);
184 printf("ALL TESTS PASSED: %d tests ran.\n", test_ran_count);
189 static css_node_t* get_child(void *context, int i) {
190 css_node_t* children = (css_node_t*)context;
194 static bool is_dirty(void *context) {
195 (void)context; // remove unused warning
199 static void init_test_css_node(css_node_t *node) {
200 node->get_child = get_child;
201 node->is_dirty = is_dirty;
204 css_node_t *new_test_css_node(void) {
205 css_node_t *node = new_css_node();
206 init_test_css_node(node);
210 void init_css_node_children(css_node_t *node, int children_count) {
211 node->context = calloc((size_t)children_count, sizeof(css_node_t));
213 for (i = 0; i < children_count; ++i) {
214 init_css_node(node->get_child(node->context, i));
215 init_test_css_node(node->get_child(node->context, i));
217 node->children_count = children_count;
220 // @generated by transpile.html
222 bool perform_layout_test()
224 /** START_GENERATED **/
226 css_node_t *root_node = new_test_css_node();
228 css_node_t *node_0 = root_node;
229 node_0->style.dimensions[CSS_WIDTH] = 100;
230 node_0->style.dimensions[CSS_HEIGHT] = 200;
233 css_node_t *root_layout = new_test_css_node();
235 css_node_t *node_0 = root_layout;
236 node_0->layout.position[CSS_TOP] = 0;
237 node_0->layout.position[CSS_LEFT] = 0;
238 node_0->layout.dimensions[CSS_WIDTH] = 100;
239 node_0->layout.dimensions[CSS_HEIGHT] = 200;
242 test("should layout a single node with width and height", root_node, root_layout);
246 css_node_t *root_node = new_test_css_node();
248 css_node_t *node_0 = root_node;
249 node_0->style.dimensions[CSS_WIDTH] = 1000;
250 node_0->style.dimensions[CSS_HEIGHT] = 1000;
251 init_css_node_children(node_0, 3);
254 node_1 = node_0->get_child(node_0->context, 0);
255 node_1->style.dimensions[CSS_WIDTH] = 500;
256 node_1->style.dimensions[CSS_HEIGHT] = 500;
257 node_1 = node_0->get_child(node_0->context, 1);
258 node_1->style.dimensions[CSS_WIDTH] = 250;
259 node_1->style.dimensions[CSS_HEIGHT] = 250;
260 node_1 = node_0->get_child(node_0->context, 2);
261 node_1->style.dimensions[CSS_WIDTH] = 125;
262 node_1->style.dimensions[CSS_HEIGHT] = 125;
266 css_node_t *root_layout = new_test_css_node();
268 css_node_t *node_0 = root_layout;
269 node_0->layout.position[CSS_TOP] = 0;
270 node_0->layout.position[CSS_LEFT] = 0;
271 node_0->layout.dimensions[CSS_WIDTH] = 1000;
272 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
273 init_css_node_children(node_0, 3);
276 node_1 = node_0->get_child(node_0->context, 0);
277 node_1->layout.position[CSS_TOP] = 0;
278 node_1->layout.position[CSS_LEFT] = 0;
279 node_1->layout.dimensions[CSS_WIDTH] = 500;
280 node_1->layout.dimensions[CSS_HEIGHT] = 500;
281 node_1 = node_0->get_child(node_0->context, 1);
282 node_1->layout.position[CSS_TOP] = 500;
283 node_1->layout.position[CSS_LEFT] = 0;
284 node_1->layout.dimensions[CSS_WIDTH] = 250;
285 node_1->layout.dimensions[CSS_HEIGHT] = 250;
286 node_1 = node_0->get_child(node_0->context, 2);
287 node_1->layout.position[CSS_TOP] = 750;
288 node_1->layout.position[CSS_LEFT] = 0;
289 node_1->layout.dimensions[CSS_WIDTH] = 125;
290 node_1->layout.dimensions[CSS_HEIGHT] = 125;
294 test("should layout node with children", root_node, root_layout);
298 css_node_t *root_node = new_test_css_node();
300 css_node_t *node_0 = root_node;
301 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
302 node_0->style.dimensions[CSS_WIDTH] = 1000;
303 node_0->style.dimensions[CSS_HEIGHT] = 1000;
304 init_css_node_children(node_0, 3);
307 node_1 = node_0->get_child(node_0->context, 0);
308 node_1->style.dimensions[CSS_WIDTH] = 500;
309 node_1->style.dimensions[CSS_HEIGHT] = 500;
310 node_1 = node_0->get_child(node_0->context, 1);
311 node_1->style.dimensions[CSS_WIDTH] = 250;
312 node_1->style.dimensions[CSS_HEIGHT] = 250;
313 node_1 = node_0->get_child(node_0->context, 2);
314 node_1->style.dimensions[CSS_WIDTH] = 125;
315 node_1->style.dimensions[CSS_HEIGHT] = 125;
319 css_node_t *root_layout = new_test_css_node();
321 css_node_t *node_0 = root_layout;
322 node_0->layout.position[CSS_TOP] = 0;
323 node_0->layout.position[CSS_LEFT] = 0;
324 node_0->layout.dimensions[CSS_WIDTH] = 1000;
325 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
326 init_css_node_children(node_0, 3);
329 node_1 = node_0->get_child(node_0->context, 0);
330 node_1->layout.position[CSS_TOP] = 500;
331 node_1->layout.position[CSS_LEFT] = 0;
332 node_1->layout.dimensions[CSS_WIDTH] = 500;
333 node_1->layout.dimensions[CSS_HEIGHT] = 500;
334 node_1 = node_0->get_child(node_0->context, 1);
335 node_1->layout.position[CSS_TOP] = 250;
336 node_1->layout.position[CSS_LEFT] = 0;
337 node_1->layout.dimensions[CSS_WIDTH] = 250;
338 node_1->layout.dimensions[CSS_HEIGHT] = 250;
339 node_1 = node_0->get_child(node_0->context, 2);
340 node_1->layout.position[CSS_TOP] = 125;
341 node_1->layout.position[CSS_LEFT] = 0;
342 node_1->layout.dimensions[CSS_WIDTH] = 125;
343 node_1->layout.dimensions[CSS_HEIGHT] = 125;
347 test("should layout node with children in reverse", root_node, root_layout);
351 css_node_t *root_node = new_test_css_node();
353 css_node_t *node_0 = root_node;
354 node_0->style.dimensions[CSS_WIDTH] = 1000;
355 node_0->style.dimensions[CSS_HEIGHT] = 1000;
356 init_css_node_children(node_0, 2);
359 node_1 = node_0->get_child(node_0->context, 0);
360 node_1->style.dimensions[CSS_WIDTH] = 500;
361 node_1->style.dimensions[CSS_HEIGHT] = 500;
362 node_1 = node_0->get_child(node_0->context, 1);
363 node_1->style.dimensions[CSS_WIDTH] = 500;
364 node_1->style.dimensions[CSS_HEIGHT] = 500;
365 init_css_node_children(node_1, 2);
368 node_2 = node_1->get_child(node_1->context, 0);
369 node_2->style.dimensions[CSS_WIDTH] = 250;
370 node_2->style.dimensions[CSS_HEIGHT] = 250;
371 node_2 = node_1->get_child(node_1->context, 1);
372 node_2->style.dimensions[CSS_WIDTH] = 250;
373 node_2->style.dimensions[CSS_HEIGHT] = 250;
378 css_node_t *root_layout = new_test_css_node();
380 css_node_t *node_0 = root_layout;
381 node_0->layout.position[CSS_TOP] = 0;
382 node_0->layout.position[CSS_LEFT] = 0;
383 node_0->layout.dimensions[CSS_WIDTH] = 1000;
384 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
385 init_css_node_children(node_0, 2);
388 node_1 = node_0->get_child(node_0->context, 0);
389 node_1->layout.position[CSS_TOP] = 0;
390 node_1->layout.position[CSS_LEFT] = 0;
391 node_1->layout.dimensions[CSS_WIDTH] = 500;
392 node_1->layout.dimensions[CSS_HEIGHT] = 500;
393 node_1 = node_0->get_child(node_0->context, 1);
394 node_1->layout.position[CSS_TOP] = 500;
395 node_1->layout.position[CSS_LEFT] = 0;
396 node_1->layout.dimensions[CSS_WIDTH] = 500;
397 node_1->layout.dimensions[CSS_HEIGHT] = 500;
398 init_css_node_children(node_1, 2);
401 node_2 = node_1->get_child(node_1->context, 0);
402 node_2->layout.position[CSS_TOP] = 0;
403 node_2->layout.position[CSS_LEFT] = 0;
404 node_2->layout.dimensions[CSS_WIDTH] = 250;
405 node_2->layout.dimensions[CSS_HEIGHT] = 250;
406 node_2 = node_1->get_child(node_1->context, 1);
407 node_2->layout.position[CSS_TOP] = 250;
408 node_2->layout.position[CSS_LEFT] = 0;
409 node_2->layout.dimensions[CSS_WIDTH] = 250;
410 node_2->layout.dimensions[CSS_HEIGHT] = 250;
415 test("should layout node with nested children", root_node, root_layout);
419 css_node_t *root_node = new_test_css_node();
421 css_node_t *node_0 = root_node;
422 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
423 node_0->style.dimensions[CSS_WIDTH] = 1000;
424 node_0->style.dimensions[CSS_HEIGHT] = 1000;
425 init_css_node_children(node_0, 2);
428 node_1 = node_0->get_child(node_0->context, 0);
429 node_1->style.dimensions[CSS_WIDTH] = 500;
430 node_1->style.dimensions[CSS_HEIGHT] = 500;
431 node_1 = node_0->get_child(node_0->context, 1);
432 node_1->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
433 node_1->style.dimensions[CSS_WIDTH] = 500;
434 node_1->style.dimensions[CSS_HEIGHT] = 500;
435 init_css_node_children(node_1, 2);
438 node_2 = node_1->get_child(node_1->context, 0);
439 node_2->style.dimensions[CSS_WIDTH] = 250;
440 node_2->style.dimensions[CSS_HEIGHT] = 250;
441 node_2 = node_1->get_child(node_1->context, 1);
442 node_2->style.dimensions[CSS_WIDTH] = 250;
443 node_2->style.dimensions[CSS_HEIGHT] = 250;
448 css_node_t *root_layout = new_test_css_node();
450 css_node_t *node_0 = root_layout;
451 node_0->layout.position[CSS_TOP] = 0;
452 node_0->layout.position[CSS_LEFT] = 0;
453 node_0->layout.dimensions[CSS_WIDTH] = 1000;
454 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
455 init_css_node_children(node_0, 2);
458 node_1 = node_0->get_child(node_0->context, 0);
459 node_1->layout.position[CSS_TOP] = 500;
460 node_1->layout.position[CSS_LEFT] = 0;
461 node_1->layout.dimensions[CSS_WIDTH] = 500;
462 node_1->layout.dimensions[CSS_HEIGHT] = 500;
463 node_1 = node_0->get_child(node_0->context, 1);
464 node_1->layout.position[CSS_TOP] = 0;
465 node_1->layout.position[CSS_LEFT] = 0;
466 node_1->layout.dimensions[CSS_WIDTH] = 500;
467 node_1->layout.dimensions[CSS_HEIGHT] = 500;
468 init_css_node_children(node_1, 2);
471 node_2 = node_1->get_child(node_1->context, 0);
472 node_2->layout.position[CSS_TOP] = 250;
473 node_2->layout.position[CSS_LEFT] = 0;
474 node_2->layout.dimensions[CSS_WIDTH] = 250;
475 node_2->layout.dimensions[CSS_HEIGHT] = 250;
476 node_2 = node_1->get_child(node_1->context, 1);
477 node_2->layout.position[CSS_TOP] = 0;
478 node_2->layout.position[CSS_LEFT] = 0;
479 node_2->layout.dimensions[CSS_WIDTH] = 250;
480 node_2->layout.dimensions[CSS_HEIGHT] = 250;
485 test("should layout node with nested children in reverse", root_node, root_layout);
489 css_node_t *root_node = new_test_css_node();
491 css_node_t *node_0 = root_node;
492 node_0->style.dimensions[CSS_WIDTH] = 100;
493 node_0->style.dimensions[CSS_HEIGHT] = 200;
494 node_0->style.margin[CSS_LEFT] = 10;
495 node_0->style.margin[CSS_TOP] = 10;
496 node_0->style.margin[CSS_RIGHT] = 10;
497 node_0->style.margin[CSS_BOTTOM] = 10;
498 node_0->style.margin[CSS_START] = 10;
499 node_0->style.margin[CSS_END] = 10;
502 css_node_t *root_layout = new_test_css_node();
504 css_node_t *node_0 = root_layout;
505 node_0->layout.position[CSS_TOP] = 10;
506 node_0->layout.position[CSS_LEFT] = 10;
507 node_0->layout.dimensions[CSS_WIDTH] = 100;
508 node_0->layout.dimensions[CSS_HEIGHT] = 200;
511 test("should layout node with margin", root_node, root_layout);
515 css_node_t *root_node = new_test_css_node();
517 css_node_t *node_0 = root_node;
518 node_0->style.dimensions[CSS_WIDTH] = 1000;
519 node_0->style.dimensions[CSS_HEIGHT] = 1000;
520 node_0->style.margin[CSS_LEFT] = 10;
521 node_0->style.margin[CSS_TOP] = 10;
522 node_0->style.margin[CSS_RIGHT] = 10;
523 node_0->style.margin[CSS_BOTTOM] = 10;
524 node_0->style.margin[CSS_START] = 10;
525 node_0->style.margin[CSS_END] = 10;
526 init_css_node_children(node_0, 3);
529 node_1 = node_0->get_child(node_0->context, 0);
530 node_1->style.dimensions[CSS_WIDTH] = 100;
531 node_1->style.dimensions[CSS_HEIGHT] = 100;
532 node_1->style.margin[CSS_LEFT] = 50;
533 node_1->style.margin[CSS_TOP] = 50;
534 node_1->style.margin[CSS_RIGHT] = 50;
535 node_1->style.margin[CSS_BOTTOM] = 50;
536 node_1->style.margin[CSS_START] = 50;
537 node_1->style.margin[CSS_END] = 50;
538 node_1 = node_0->get_child(node_0->context, 1);
539 node_1->style.dimensions[CSS_WIDTH] = 100;
540 node_1->style.dimensions[CSS_HEIGHT] = 100;
541 node_1->style.margin[CSS_LEFT] = 25;
542 node_1->style.margin[CSS_TOP] = 25;
543 node_1->style.margin[CSS_RIGHT] = 25;
544 node_1->style.margin[CSS_BOTTOM] = 25;
545 node_1->style.margin[CSS_START] = 25;
546 node_1->style.margin[CSS_END] = 25;
547 node_1 = node_0->get_child(node_0->context, 2);
548 node_1->style.dimensions[CSS_WIDTH] = 100;
549 node_1->style.dimensions[CSS_HEIGHT] = 100;
550 node_1->style.margin[CSS_LEFT] = 10;
551 node_1->style.margin[CSS_TOP] = 10;
552 node_1->style.margin[CSS_RIGHT] = 10;
553 node_1->style.margin[CSS_BOTTOM] = 10;
554 node_1->style.margin[CSS_START] = 10;
555 node_1->style.margin[CSS_END] = 10;
559 css_node_t *root_layout = new_test_css_node();
561 css_node_t *node_0 = root_layout;
562 node_0->layout.position[CSS_TOP] = 10;
563 node_0->layout.position[CSS_LEFT] = 10;
564 node_0->layout.dimensions[CSS_WIDTH] = 1000;
565 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
566 init_css_node_children(node_0, 3);
569 node_1 = node_0->get_child(node_0->context, 0);
570 node_1->layout.position[CSS_TOP] = 50;
571 node_1->layout.position[CSS_LEFT] = 50;
572 node_1->layout.dimensions[CSS_WIDTH] = 100;
573 node_1->layout.dimensions[CSS_HEIGHT] = 100;
574 node_1 = node_0->get_child(node_0->context, 1);
575 node_1->layout.position[CSS_TOP] = 225;
576 node_1->layout.position[CSS_LEFT] = 25;
577 node_1->layout.dimensions[CSS_WIDTH] = 100;
578 node_1->layout.dimensions[CSS_HEIGHT] = 100;
579 node_1 = node_0->get_child(node_0->context, 2);
580 node_1->layout.position[CSS_TOP] = 360;
581 node_1->layout.position[CSS_LEFT] = 10;
582 node_1->layout.dimensions[CSS_WIDTH] = 100;
583 node_1->layout.dimensions[CSS_HEIGHT] = 100;
587 test("should layout node with several children", root_node, root_layout);
591 css_node_t *root_node = new_test_css_node();
593 css_node_t *node_0 = root_node;
594 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
595 node_0->style.dimensions[CSS_WIDTH] = 1000;
596 node_0->style.dimensions[CSS_HEIGHT] = 1000;
597 node_0->style.margin[CSS_LEFT] = 10;
598 node_0->style.margin[CSS_TOP] = 10;
599 node_0->style.margin[CSS_RIGHT] = 10;
600 node_0->style.margin[CSS_BOTTOM] = 10;
601 node_0->style.margin[CSS_START] = 10;
602 node_0->style.margin[CSS_END] = 10;
603 init_css_node_children(node_0, 3);
606 node_1 = node_0->get_child(node_0->context, 0);
607 node_1->style.dimensions[CSS_WIDTH] = 100;
608 node_1->style.dimensions[CSS_HEIGHT] = 100;
609 node_1->style.margin[CSS_LEFT] = 50;
610 node_1->style.margin[CSS_TOP] = 50;
611 node_1->style.margin[CSS_RIGHT] = 50;
612 node_1->style.margin[CSS_BOTTOM] = 50;
613 node_1->style.margin[CSS_START] = 50;
614 node_1->style.margin[CSS_END] = 50;
615 node_1 = node_0->get_child(node_0->context, 1);
616 node_1->style.dimensions[CSS_WIDTH] = 100;
617 node_1->style.dimensions[CSS_HEIGHT] = 100;
618 node_1->style.margin[CSS_LEFT] = 25;
619 node_1->style.margin[CSS_TOP] = 25;
620 node_1->style.margin[CSS_RIGHT] = 25;
621 node_1->style.margin[CSS_BOTTOM] = 25;
622 node_1->style.margin[CSS_START] = 25;
623 node_1->style.margin[CSS_END] = 25;
624 node_1 = node_0->get_child(node_0->context, 2);
625 node_1->style.dimensions[CSS_WIDTH] = 100;
626 node_1->style.dimensions[CSS_HEIGHT] = 100;
627 node_1->style.margin[CSS_LEFT] = 10;
628 node_1->style.margin[CSS_TOP] = 10;
629 node_1->style.margin[CSS_RIGHT] = 10;
630 node_1->style.margin[CSS_BOTTOM] = 10;
631 node_1->style.margin[CSS_START] = 10;
632 node_1->style.margin[CSS_END] = 10;
636 css_node_t *root_layout = new_test_css_node();
638 css_node_t *node_0 = root_layout;
639 node_0->layout.position[CSS_TOP] = 10;
640 node_0->layout.position[CSS_LEFT] = 10;
641 node_0->layout.dimensions[CSS_WIDTH] = 1000;
642 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
643 init_css_node_children(node_0, 3);
646 node_1 = node_0->get_child(node_0->context, 0);
647 node_1->layout.position[CSS_TOP] = 850;
648 node_1->layout.position[CSS_LEFT] = 50;
649 node_1->layout.dimensions[CSS_WIDTH] = 100;
650 node_1->layout.dimensions[CSS_HEIGHT] = 100;
651 node_1 = node_0->get_child(node_0->context, 1);
652 node_1->layout.position[CSS_TOP] = 675;
653 node_1->layout.position[CSS_LEFT] = 25;
654 node_1->layout.dimensions[CSS_WIDTH] = 100;
655 node_1->layout.dimensions[CSS_HEIGHT] = 100;
656 node_1 = node_0->get_child(node_0->context, 2);
657 node_1->layout.position[CSS_TOP] = 540;
658 node_1->layout.position[CSS_LEFT] = 10;
659 node_1->layout.dimensions[CSS_WIDTH] = 100;
660 node_1->layout.dimensions[CSS_HEIGHT] = 100;
664 test("should layout node with several children in reverse", root_node, root_layout);
668 css_node_t *root_node = new_test_css_node();
670 css_node_t *node_0 = root_node;
671 node_0->style.direction = CSS_DIRECTION_RTL;
672 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW_REVERSE;
673 node_0->style.dimensions[CSS_WIDTH] = 1000;
674 node_0->style.dimensions[CSS_HEIGHT] = 1000;
675 init_css_node_children(node_0, 2);
678 node_1 = node_0->get_child(node_0->context, 0);
679 node_1->style.dimensions[CSS_WIDTH] = 100;
680 node_1->style.dimensions[CSS_HEIGHT] = 200;
681 node_1 = node_0->get_child(node_0->context, 1);
682 node_1->style.dimensions[CSS_WIDTH] = 300;
683 node_1->style.dimensions[CSS_HEIGHT] = 150;
687 css_node_t *root_layout = new_test_css_node();
689 css_node_t *node_0 = root_layout;
690 node_0->layout.position[CSS_TOP] = 0;
691 node_0->layout.position[CSS_LEFT] = 0;
692 node_0->layout.dimensions[CSS_WIDTH] = 1000;
693 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
694 init_css_node_children(node_0, 2);
697 node_1 = node_0->get_child(node_0->context, 0);
698 node_1->layout.position[CSS_TOP] = 0;
699 node_1->layout.position[CSS_LEFT] = 0;
700 node_1->layout.dimensions[CSS_WIDTH] = 100;
701 node_1->layout.dimensions[CSS_HEIGHT] = 200;
702 node_1 = node_0->get_child(node_0->context, 1);
703 node_1->layout.position[CSS_TOP] = 0;
704 node_1->layout.position[CSS_LEFT] = 100;
705 node_1->layout.dimensions[CSS_WIDTH] = 300;
706 node_1->layout.dimensions[CSS_HEIGHT] = 150;
710 test("should layout rtl with reverse correctly", root_node, root_layout);
714 css_node_t *root_node = new_test_css_node();
716 css_node_t *node_0 = root_node;
717 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
718 node_0->style.dimensions[CSS_WIDTH] = 1000;
719 node_0->style.dimensions[CSS_HEIGHT] = 1000;
720 init_css_node_children(node_0, 2);
723 node_1 = node_0->get_child(node_0->context, 0);
724 node_1->style.dimensions[CSS_WIDTH] = 100;
725 node_1->style.dimensions[CSS_HEIGHT] = 200;
726 node_1 = node_0->get_child(node_0->context, 1);
727 node_1->style.dimensions[CSS_WIDTH] = 300;
728 node_1->style.dimensions[CSS_HEIGHT] = 150;
732 css_node_t *root_layout = new_test_css_node();
734 css_node_t *node_0 = root_layout;
735 node_0->layout.position[CSS_TOP] = 0;
736 node_0->layout.position[CSS_LEFT] = 0;
737 node_0->layout.dimensions[CSS_WIDTH] = 1000;
738 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
739 init_css_node_children(node_0, 2);
742 node_1 = node_0->get_child(node_0->context, 0);
743 node_1->layout.position[CSS_TOP] = 0;
744 node_1->layout.position[CSS_LEFT] = 0;
745 node_1->layout.dimensions[CSS_WIDTH] = 100;
746 node_1->layout.dimensions[CSS_HEIGHT] = 200;
747 node_1 = node_0->get_child(node_0->context, 1);
748 node_1->layout.position[CSS_TOP] = 0;
749 node_1->layout.position[CSS_LEFT] = 100;
750 node_1->layout.dimensions[CSS_WIDTH] = 300;
751 node_1->layout.dimensions[CSS_HEIGHT] = 150;
755 test("should layout node with row flex direction", root_node, root_layout);
759 css_node_t *root_node = new_test_css_node();
761 css_node_t *node_0 = root_node;
762 node_0->style.direction = CSS_DIRECTION_RTL;
763 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
764 node_0->style.dimensions[CSS_WIDTH] = 1000;
765 node_0->style.dimensions[CSS_HEIGHT] = 1000;
766 init_css_node_children(node_0, 2);
769 node_1 = node_0->get_child(node_0->context, 0);
770 node_1->style.dimensions[CSS_WIDTH] = 100;
771 node_1->style.dimensions[CSS_HEIGHT] = 200;
772 node_1 = node_0->get_child(node_0->context, 1);
773 node_1->style.dimensions[CSS_WIDTH] = 300;
774 node_1->style.dimensions[CSS_HEIGHT] = 150;
778 css_node_t *root_layout = new_test_css_node();
780 css_node_t *node_0 = root_layout;
781 node_0->layout.position[CSS_TOP] = 0;
782 node_0->layout.position[CSS_LEFT] = 0;
783 node_0->layout.dimensions[CSS_WIDTH] = 1000;
784 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
785 init_css_node_children(node_0, 2);
788 node_1 = node_0->get_child(node_0->context, 0);
789 node_1->layout.position[CSS_TOP] = 0;
790 node_1->layout.position[CSS_LEFT] = 900;
791 node_1->layout.dimensions[CSS_WIDTH] = 100;
792 node_1->layout.dimensions[CSS_HEIGHT] = 200;
793 node_1 = node_0->get_child(node_0->context, 1);
794 node_1->layout.position[CSS_TOP] = 0;
795 node_1->layout.position[CSS_LEFT] = 600;
796 node_1->layout.dimensions[CSS_WIDTH] = 300;
797 node_1->layout.dimensions[CSS_HEIGHT] = 150;
801 test("should layout node with row flex direction in rtl", root_node, root_layout);
805 css_node_t *root_node = new_test_css_node();
807 css_node_t *node_0 = root_node;
808 node_0->style.dimensions[CSS_WIDTH] = 300;
809 init_css_node_children(node_0, 2);
812 node_1 = node_0->get_child(node_0->context, 0);
813 node_1->style.dimensions[CSS_WIDTH] = 100;
814 node_1->style.dimensions[CSS_HEIGHT] = 200;
815 node_1 = node_0->get_child(node_0->context, 1);
816 node_1->style.dimensions[CSS_WIDTH] = 300;
817 node_1->style.dimensions[CSS_HEIGHT] = 150;
821 css_node_t *root_layout = new_test_css_node();
823 css_node_t *node_0 = root_layout;
824 node_0->layout.position[CSS_TOP] = 0;
825 node_0->layout.position[CSS_LEFT] = 0;
826 node_0->layout.dimensions[CSS_WIDTH] = 300;
827 node_0->layout.dimensions[CSS_HEIGHT] = 350;
828 init_css_node_children(node_0, 2);
831 node_1 = node_0->get_child(node_0->context, 0);
832 node_1->layout.position[CSS_TOP] = 0;
833 node_1->layout.position[CSS_LEFT] = 0;
834 node_1->layout.dimensions[CSS_WIDTH] = 100;
835 node_1->layout.dimensions[CSS_HEIGHT] = 200;
836 node_1 = node_0->get_child(node_0->context, 1);
837 node_1->layout.position[CSS_TOP] = 200;
838 node_1->layout.position[CSS_LEFT] = 0;
839 node_1->layout.dimensions[CSS_WIDTH] = 300;
840 node_1->layout.dimensions[CSS_HEIGHT] = 150;
844 test("should layout node based on children main dimensions", root_node, root_layout);
848 css_node_t *root_node = new_test_css_node();
850 css_node_t *node_0 = root_node;
851 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
852 node_0->style.dimensions[CSS_WIDTH] = 300;
853 init_css_node_children(node_0, 2);
856 node_1 = node_0->get_child(node_0->context, 0);
857 node_1->style.dimensions[CSS_WIDTH] = 100;
858 node_1->style.dimensions[CSS_HEIGHT] = 200;
859 node_1 = node_0->get_child(node_0->context, 1);
860 node_1->style.dimensions[CSS_WIDTH] = 300;
861 node_1->style.dimensions[CSS_HEIGHT] = 150;
865 css_node_t *root_layout = new_test_css_node();
867 css_node_t *node_0 = root_layout;
868 node_0->layout.position[CSS_TOP] = 0;
869 node_0->layout.position[CSS_LEFT] = 0;
870 node_0->layout.dimensions[CSS_WIDTH] = 300;
871 node_0->layout.dimensions[CSS_HEIGHT] = 350;
872 init_css_node_children(node_0, 2);
875 node_1 = node_0->get_child(node_0->context, 0);
876 node_1->layout.position[CSS_TOP] = 150;
877 node_1->layout.position[CSS_LEFT] = 0;
878 node_1->layout.dimensions[CSS_WIDTH] = 100;
879 node_1->layout.dimensions[CSS_HEIGHT] = 200;
880 node_1 = node_0->get_child(node_0->context, 1);
881 node_1->layout.position[CSS_TOP] = 0;
882 node_1->layout.position[CSS_LEFT] = 0;
883 node_1->layout.dimensions[CSS_WIDTH] = 300;
884 node_1->layout.dimensions[CSS_HEIGHT] = 150;
888 test("should layout node based on children main dimensions in reverse", root_node, root_layout);
892 css_node_t *root_node = new_test_css_node();
894 css_node_t *node_0 = root_node;
895 node_0->style.dimensions[CSS_WIDTH] = 1000;
896 node_0->style.dimensions[CSS_HEIGHT] = 1000;
897 init_css_node_children(node_0, 2);
900 node_1 = node_0->get_child(node_0->context, 0);
901 node_1->style.dimensions[CSS_WIDTH] = 100;
902 node_1->style.dimensions[CSS_HEIGHT] = 200;
903 node_1 = node_0->get_child(node_0->context, 1);
904 node_1->style.flex = 1;
905 node_1->style.dimensions[CSS_WIDTH] = 100;
909 css_node_t *root_layout = new_test_css_node();
911 css_node_t *node_0 = root_layout;
912 node_0->layout.position[CSS_TOP] = 0;
913 node_0->layout.position[CSS_LEFT] = 0;
914 node_0->layout.dimensions[CSS_WIDTH] = 1000;
915 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
916 init_css_node_children(node_0, 2);
919 node_1 = node_0->get_child(node_0->context, 0);
920 node_1->layout.position[CSS_TOP] = 0;
921 node_1->layout.position[CSS_LEFT] = 0;
922 node_1->layout.dimensions[CSS_WIDTH] = 100;
923 node_1->layout.dimensions[CSS_HEIGHT] = 200;
924 node_1 = node_0->get_child(node_0->context, 1);
925 node_1->layout.position[CSS_TOP] = 200;
926 node_1->layout.position[CSS_LEFT] = 0;
927 node_1->layout.dimensions[CSS_WIDTH] = 100;
928 node_1->layout.dimensions[CSS_HEIGHT] = 800;
932 test("should layout node with just flex", root_node, root_layout);
936 css_node_t *root_node = new_test_css_node();
938 css_node_t *node_0 = root_node;
939 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
940 node_0->style.dimensions[CSS_WIDTH] = 1000;
941 node_0->style.dimensions[CSS_HEIGHT] = 1000;
942 init_css_node_children(node_0, 2);
945 node_1 = node_0->get_child(node_0->context, 0);
946 node_1->style.dimensions[CSS_WIDTH] = 100;
947 node_1->style.dimensions[CSS_HEIGHT] = 200;
948 node_1 = node_0->get_child(node_0->context, 1);
949 node_1->style.flex = 1;
950 node_1->style.dimensions[CSS_WIDTH] = 100;
954 css_node_t *root_layout = new_test_css_node();
956 css_node_t *node_0 = root_layout;
957 node_0->layout.position[CSS_TOP] = 0;
958 node_0->layout.position[CSS_LEFT] = 0;
959 node_0->layout.dimensions[CSS_WIDTH] = 1000;
960 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
961 init_css_node_children(node_0, 2);
964 node_1 = node_0->get_child(node_0->context, 0);
965 node_1->layout.position[CSS_TOP] = 800;
966 node_1->layout.position[CSS_LEFT] = 0;
967 node_1->layout.dimensions[CSS_WIDTH] = 100;
968 node_1->layout.dimensions[CSS_HEIGHT] = 200;
969 node_1 = node_0->get_child(node_0->context, 1);
970 node_1->layout.position[CSS_TOP] = 0;
971 node_1->layout.position[CSS_LEFT] = 0;
972 node_1->layout.dimensions[CSS_WIDTH] = 100;
973 node_1->layout.dimensions[CSS_HEIGHT] = 800;
977 test("should layout node with just flex in reverse", root_node, root_layout);
981 css_node_t *root_node = new_test_css_node();
983 css_node_t *node_0 = root_node;
984 node_0->style.dimensions[CSS_WIDTH] = 1000;
985 node_0->style.dimensions[CSS_HEIGHT] = 1000;
986 init_css_node_children(node_0, 1);
989 node_1 = node_0->get_child(node_0->context, 0);
990 node_1->style.flex = 1;
991 node_1->style.dimensions[CSS_WIDTH] = 1000;
992 init_css_node_children(node_1, 1);
995 node_2 = node_1->get_child(node_1->context, 0);
996 node_2->style.flex = 1;
997 node_2->style.dimensions[CSS_WIDTH] = 1000;
998 init_css_node_children(node_2, 1);
1001 node_3 = node_2->get_child(node_2->context, 0);
1002 node_3->style.flex = 1;
1003 node_3->style.dimensions[CSS_WIDTH] = 1000;
1009 css_node_t *root_layout = new_test_css_node();
1011 css_node_t *node_0 = root_layout;
1012 node_0->layout.position[CSS_TOP] = 0;
1013 node_0->layout.position[CSS_LEFT] = 0;
1014 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1015 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1016 init_css_node_children(node_0, 1);
1019 node_1 = node_0->get_child(node_0->context, 0);
1020 node_1->layout.position[CSS_TOP] = 0;
1021 node_1->layout.position[CSS_LEFT] = 0;
1022 node_1->layout.dimensions[CSS_WIDTH] = 1000;
1023 node_1->layout.dimensions[CSS_HEIGHT] = 1000;
1024 init_css_node_children(node_1, 1);
1027 node_2 = node_1->get_child(node_1->context, 0);
1028 node_2->layout.position[CSS_TOP] = 0;
1029 node_2->layout.position[CSS_LEFT] = 0;
1030 node_2->layout.dimensions[CSS_WIDTH] = 1000;
1031 node_2->layout.dimensions[CSS_HEIGHT] = 1000;
1032 init_css_node_children(node_2, 1);
1035 node_3 = node_2->get_child(node_2->context, 0);
1036 node_3->layout.position[CSS_TOP] = 0;
1037 node_3->layout.position[CSS_LEFT] = 0;
1038 node_3->layout.dimensions[CSS_WIDTH] = 1000;
1039 node_3->layout.dimensions[CSS_HEIGHT] = 1000;
1045 test("should layout node with flex recursively", root_node, root_layout);
1049 css_node_t *root_node = new_test_css_node();
1051 css_node_t *node_0 = root_node;
1052 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
1053 node_0->style.dimensions[CSS_WIDTH] = 1000;
1054 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1055 init_css_node_children(node_0, 1);
1058 node_1 = node_0->get_child(node_0->context, 0);
1059 node_1->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
1060 node_1->style.flex = 1;
1061 node_1->style.dimensions[CSS_WIDTH] = 1000;
1062 init_css_node_children(node_1, 1);
1065 node_2 = node_1->get_child(node_1->context, 0);
1066 node_2->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
1067 node_2->style.flex = 1;
1068 node_2->style.dimensions[CSS_WIDTH] = 1000;
1069 init_css_node_children(node_2, 1);
1072 node_3 = node_2->get_child(node_2->context, 0);
1073 node_3->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
1074 node_3->style.flex = 1;
1075 node_3->style.dimensions[CSS_WIDTH] = 1000;
1081 css_node_t *root_layout = new_test_css_node();
1083 css_node_t *node_0 = root_layout;
1084 node_0->layout.position[CSS_TOP] = 0;
1085 node_0->layout.position[CSS_LEFT] = 0;
1086 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1087 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1088 init_css_node_children(node_0, 1);
1091 node_1 = node_0->get_child(node_0->context, 0);
1092 node_1->layout.position[CSS_TOP] = 0;
1093 node_1->layout.position[CSS_LEFT] = 0;
1094 node_1->layout.dimensions[CSS_WIDTH] = 1000;
1095 node_1->layout.dimensions[CSS_HEIGHT] = 1000;
1096 init_css_node_children(node_1, 1);
1099 node_2 = node_1->get_child(node_1->context, 0);
1100 node_2->layout.position[CSS_TOP] = 0;
1101 node_2->layout.position[CSS_LEFT] = 0;
1102 node_2->layout.dimensions[CSS_WIDTH] = 1000;
1103 node_2->layout.dimensions[CSS_HEIGHT] = 1000;
1104 init_css_node_children(node_2, 1);
1107 node_3 = node_2->get_child(node_2->context, 0);
1108 node_3->layout.position[CSS_TOP] = 0;
1109 node_3->layout.position[CSS_LEFT] = 0;
1110 node_3->layout.dimensions[CSS_WIDTH] = 1000;
1111 node_3->layout.dimensions[CSS_HEIGHT] = 1000;
1117 test("should layout node with flex recursively in reverse", root_node, root_layout);
1121 css_node_t *root_node = new_test_css_node();
1123 css_node_t *node_0 = root_node;
1124 node_0->style.dimensions[CSS_WIDTH] = 1000;
1125 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1126 node_0->style.margin[CSS_LEFT] = 5;
1127 node_0->style.margin[CSS_TOP] = 10;
1128 init_css_node_children(node_0, 2);
1131 node_1 = node_0->get_child(node_0->context, 0);
1132 node_1->style.dimensions[CSS_WIDTH] = 100;
1133 node_1->style.dimensions[CSS_HEIGHT] = 100;
1134 node_1->style.margin[CSS_LEFT] = 15;
1135 node_1->style.margin[CSS_TOP] = 50;
1136 node_1->style.margin[CSS_BOTTOM] = 20;
1137 node_1 = node_0->get_child(node_0->context, 1);
1138 node_1->style.dimensions[CSS_WIDTH] = 100;
1139 node_1->style.dimensions[CSS_HEIGHT] = 100;
1140 node_1->style.margin[CSS_LEFT] = 30;
1144 css_node_t *root_layout = new_test_css_node();
1146 css_node_t *node_0 = root_layout;
1147 node_0->layout.position[CSS_TOP] = 10;
1148 node_0->layout.position[CSS_LEFT] = 5;
1149 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1150 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1151 init_css_node_children(node_0, 2);
1154 node_1 = node_0->get_child(node_0->context, 0);
1155 node_1->layout.position[CSS_TOP] = 50;
1156 node_1->layout.position[CSS_LEFT] = 15;
1157 node_1->layout.dimensions[CSS_WIDTH] = 100;
1158 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1159 node_1 = node_0->get_child(node_0->context, 1);
1160 node_1->layout.position[CSS_TOP] = 170;
1161 node_1->layout.position[CSS_LEFT] = 30;
1162 node_1->layout.dimensions[CSS_WIDTH] = 100;
1163 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1167 test("should layout node with targeted margin", root_node, root_layout);
1171 css_node_t *root_node = new_test_css_node();
1173 css_node_t *node_0 = root_node;
1174 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
1175 node_0->style.dimensions[CSS_WIDTH] = 1000;
1176 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1177 node_0->style.margin[CSS_LEFT] = 5;
1178 node_0->style.margin[CSS_TOP] = 10;
1179 init_css_node_children(node_0, 2);
1182 node_1 = node_0->get_child(node_0->context, 0);
1183 node_1->style.dimensions[CSS_WIDTH] = 100;
1184 node_1->style.dimensions[CSS_HEIGHT] = 100;
1185 node_1->style.margin[CSS_LEFT] = 15;
1186 node_1->style.margin[CSS_TOP] = 50;
1187 node_1->style.margin[CSS_BOTTOM] = 20;
1188 node_1 = node_0->get_child(node_0->context, 1);
1189 node_1->style.dimensions[CSS_WIDTH] = 100;
1190 node_1->style.dimensions[CSS_HEIGHT] = 100;
1191 node_1->style.margin[CSS_LEFT] = 30;
1195 css_node_t *root_layout = new_test_css_node();
1197 css_node_t *node_0 = root_layout;
1198 node_0->layout.position[CSS_TOP] = 10;
1199 node_0->layout.position[CSS_LEFT] = 5;
1200 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1201 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1202 init_css_node_children(node_0, 2);
1205 node_1 = node_0->get_child(node_0->context, 0);
1206 node_1->layout.position[CSS_TOP] = 880;
1207 node_1->layout.position[CSS_LEFT] = 15;
1208 node_1->layout.dimensions[CSS_WIDTH] = 100;
1209 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1210 node_1 = node_0->get_child(node_0->context, 1);
1211 node_1->layout.position[CSS_TOP] = 730;
1212 node_1->layout.position[CSS_LEFT] = 30;
1213 node_1->layout.dimensions[CSS_WIDTH] = 100;
1214 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1218 test("should layout node with targeted margin in reverse", root_node, root_layout);
1222 css_node_t *root_node = new_test_css_node();
1224 css_node_t *node_0 = root_node;
1225 node_0->style.justify_content = CSS_JUSTIFY_FLEX_START;
1226 node_0->style.dimensions[CSS_WIDTH] = 1000;
1227 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1228 init_css_node_children(node_0, 2);
1231 node_1 = node_0->get_child(node_0->context, 0);
1232 node_1->style.dimensions[CSS_WIDTH] = 100;
1233 node_1->style.dimensions[CSS_HEIGHT] = 100;
1234 node_1 = node_0->get_child(node_0->context, 1);
1235 node_1->style.dimensions[CSS_WIDTH] = 100;
1236 node_1->style.dimensions[CSS_HEIGHT] = 100;
1240 css_node_t *root_layout = new_test_css_node();
1242 css_node_t *node_0 = root_layout;
1243 node_0->layout.position[CSS_TOP] = 0;
1244 node_0->layout.position[CSS_LEFT] = 0;
1245 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1246 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1247 init_css_node_children(node_0, 2);
1250 node_1 = node_0->get_child(node_0->context, 0);
1251 node_1->layout.position[CSS_TOP] = 0;
1252 node_1->layout.position[CSS_LEFT] = 0;
1253 node_1->layout.dimensions[CSS_WIDTH] = 100;
1254 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1255 node_1 = node_0->get_child(node_0->context, 1);
1256 node_1->layout.position[CSS_TOP] = 100;
1257 node_1->layout.position[CSS_LEFT] = 0;
1258 node_1->layout.dimensions[CSS_WIDTH] = 100;
1259 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1263 test("should layout node with justifyContent: flex-start", root_node, root_layout);
1267 css_node_t *root_node = new_test_css_node();
1269 css_node_t *node_0 = root_node;
1270 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
1271 node_0->style.justify_content = CSS_JUSTIFY_FLEX_START;
1272 node_0->style.dimensions[CSS_WIDTH] = 1000;
1273 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1274 init_css_node_children(node_0, 2);
1277 node_1 = node_0->get_child(node_0->context, 0);
1278 node_1->style.dimensions[CSS_WIDTH] = 100;
1279 node_1->style.dimensions[CSS_HEIGHT] = 100;
1280 node_1 = node_0->get_child(node_0->context, 1);
1281 node_1->style.dimensions[CSS_WIDTH] = 100;
1282 node_1->style.dimensions[CSS_HEIGHT] = 100;
1286 css_node_t *root_layout = new_test_css_node();
1288 css_node_t *node_0 = root_layout;
1289 node_0->layout.position[CSS_TOP] = 0;
1290 node_0->layout.position[CSS_LEFT] = 0;
1291 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1292 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1293 init_css_node_children(node_0, 2);
1296 node_1 = node_0->get_child(node_0->context, 0);
1297 node_1->layout.position[CSS_TOP] = 900;
1298 node_1->layout.position[CSS_LEFT] = 0;
1299 node_1->layout.dimensions[CSS_WIDTH] = 100;
1300 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1301 node_1 = node_0->get_child(node_0->context, 1);
1302 node_1->layout.position[CSS_TOP] = 800;
1303 node_1->layout.position[CSS_LEFT] = 0;
1304 node_1->layout.dimensions[CSS_WIDTH] = 100;
1305 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1309 test("should layout node with justifyContent: flex-start in reverse", root_node, root_layout);
1313 css_node_t *root_node = new_test_css_node();
1315 css_node_t *node_0 = root_node;
1316 node_0->style.justify_content = CSS_JUSTIFY_FLEX_END;
1317 node_0->style.dimensions[CSS_WIDTH] = 1000;
1318 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1319 init_css_node_children(node_0, 2);
1322 node_1 = node_0->get_child(node_0->context, 0);
1323 node_1->style.dimensions[CSS_WIDTH] = 100;
1324 node_1->style.dimensions[CSS_HEIGHT] = 100;
1325 node_1 = node_0->get_child(node_0->context, 1);
1326 node_1->style.dimensions[CSS_WIDTH] = 100;
1327 node_1->style.dimensions[CSS_HEIGHT] = 100;
1331 css_node_t *root_layout = new_test_css_node();
1333 css_node_t *node_0 = root_layout;
1334 node_0->layout.position[CSS_TOP] = 0;
1335 node_0->layout.position[CSS_LEFT] = 0;
1336 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1337 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1338 init_css_node_children(node_0, 2);
1341 node_1 = node_0->get_child(node_0->context, 0);
1342 node_1->layout.position[CSS_TOP] = 800;
1343 node_1->layout.position[CSS_LEFT] = 0;
1344 node_1->layout.dimensions[CSS_WIDTH] = 100;
1345 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1346 node_1 = node_0->get_child(node_0->context, 1);
1347 node_1->layout.position[CSS_TOP] = 900;
1348 node_1->layout.position[CSS_LEFT] = 0;
1349 node_1->layout.dimensions[CSS_WIDTH] = 100;
1350 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1354 test("should layout node with justifyContent: flex-end", root_node, root_layout);
1358 css_node_t *root_node = new_test_css_node();
1360 css_node_t *node_0 = root_node;
1361 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
1362 node_0->style.justify_content = CSS_JUSTIFY_FLEX_END;
1363 node_0->style.dimensions[CSS_WIDTH] = 1000;
1364 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1365 init_css_node_children(node_0, 2);
1368 node_1 = node_0->get_child(node_0->context, 0);
1369 node_1->style.dimensions[CSS_WIDTH] = 100;
1370 node_1->style.dimensions[CSS_HEIGHT] = 100;
1371 node_1 = node_0->get_child(node_0->context, 1);
1372 node_1->style.dimensions[CSS_WIDTH] = 100;
1373 node_1->style.dimensions[CSS_HEIGHT] = 100;
1377 css_node_t *root_layout = new_test_css_node();
1379 css_node_t *node_0 = root_layout;
1380 node_0->layout.position[CSS_TOP] = 0;
1381 node_0->layout.position[CSS_LEFT] = 0;
1382 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1383 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1384 init_css_node_children(node_0, 2);
1387 node_1 = node_0->get_child(node_0->context, 0);
1388 node_1->layout.position[CSS_TOP] = 100;
1389 node_1->layout.position[CSS_LEFT] = 0;
1390 node_1->layout.dimensions[CSS_WIDTH] = 100;
1391 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1392 node_1 = node_0->get_child(node_0->context, 1);
1393 node_1->layout.position[CSS_TOP] = 0;
1394 node_1->layout.position[CSS_LEFT] = 0;
1395 node_1->layout.dimensions[CSS_WIDTH] = 100;
1396 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1400 test("should layout node with justifyContent: flex-end in reverse", root_node, root_layout);
1404 css_node_t *root_node = new_test_css_node();
1406 css_node_t *node_0 = root_node;
1407 node_0->style.justify_content = CSS_JUSTIFY_SPACE_BETWEEN;
1408 node_0->style.dimensions[CSS_WIDTH] = 1000;
1409 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1410 init_css_node_children(node_0, 2);
1413 node_1 = node_0->get_child(node_0->context, 0);
1414 node_1->style.dimensions[CSS_WIDTH] = 100;
1415 node_1->style.dimensions[CSS_HEIGHT] = 100;
1416 node_1 = node_0->get_child(node_0->context, 1);
1417 node_1->style.dimensions[CSS_WIDTH] = 100;
1418 node_1->style.dimensions[CSS_HEIGHT] = 100;
1422 css_node_t *root_layout = new_test_css_node();
1424 css_node_t *node_0 = root_layout;
1425 node_0->layout.position[CSS_TOP] = 0;
1426 node_0->layout.position[CSS_LEFT] = 0;
1427 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1428 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1429 init_css_node_children(node_0, 2);
1432 node_1 = node_0->get_child(node_0->context, 0);
1433 node_1->layout.position[CSS_TOP] = 0;
1434 node_1->layout.position[CSS_LEFT] = 0;
1435 node_1->layout.dimensions[CSS_WIDTH] = 100;
1436 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1437 node_1 = node_0->get_child(node_0->context, 1);
1438 node_1->layout.position[CSS_TOP] = 900;
1439 node_1->layout.position[CSS_LEFT] = 0;
1440 node_1->layout.dimensions[CSS_WIDTH] = 100;
1441 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1445 test("should layout node with justifyContent: space-between", root_node, root_layout);
1449 css_node_t *root_node = new_test_css_node();
1451 css_node_t *node_0 = root_node;
1452 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
1453 node_0->style.justify_content = CSS_JUSTIFY_SPACE_BETWEEN;
1454 node_0->style.dimensions[CSS_WIDTH] = 1000;
1455 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1456 init_css_node_children(node_0, 2);
1459 node_1 = node_0->get_child(node_0->context, 0);
1460 node_1->style.dimensions[CSS_WIDTH] = 100;
1461 node_1->style.dimensions[CSS_HEIGHT] = 100;
1462 node_1 = node_0->get_child(node_0->context, 1);
1463 node_1->style.dimensions[CSS_WIDTH] = 100;
1464 node_1->style.dimensions[CSS_HEIGHT] = 100;
1468 css_node_t *root_layout = new_test_css_node();
1470 css_node_t *node_0 = root_layout;
1471 node_0->layout.position[CSS_TOP] = 0;
1472 node_0->layout.position[CSS_LEFT] = 0;
1473 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1474 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1475 init_css_node_children(node_0, 2);
1478 node_1 = node_0->get_child(node_0->context, 0);
1479 node_1->layout.position[CSS_TOP] = 900;
1480 node_1->layout.position[CSS_LEFT] = 0;
1481 node_1->layout.dimensions[CSS_WIDTH] = 100;
1482 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1483 node_1 = node_0->get_child(node_0->context, 1);
1484 node_1->layout.position[CSS_TOP] = 0;
1485 node_1->layout.position[CSS_LEFT] = 0;
1486 node_1->layout.dimensions[CSS_WIDTH] = 100;
1487 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1491 test("should layout node with justifyContent: space-between in reverse", root_node, root_layout);
1495 css_node_t *root_node = new_test_css_node();
1497 css_node_t *node_0 = root_node;
1498 node_0->style.justify_content = CSS_JUSTIFY_SPACE_AROUND;
1499 node_0->style.dimensions[CSS_WIDTH] = 1000;
1500 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1501 init_css_node_children(node_0, 2);
1504 node_1 = node_0->get_child(node_0->context, 0);
1505 node_1->style.dimensions[CSS_WIDTH] = 100;
1506 node_1->style.dimensions[CSS_HEIGHT] = 100;
1507 node_1 = node_0->get_child(node_0->context, 1);
1508 node_1->style.dimensions[CSS_WIDTH] = 100;
1509 node_1->style.dimensions[CSS_HEIGHT] = 100;
1513 css_node_t *root_layout = new_test_css_node();
1515 css_node_t *node_0 = root_layout;
1516 node_0->layout.position[CSS_TOP] = 0;
1517 node_0->layout.position[CSS_LEFT] = 0;
1518 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1519 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1520 init_css_node_children(node_0, 2);
1523 node_1 = node_0->get_child(node_0->context, 0);
1524 node_1->layout.position[CSS_TOP] = 200;
1525 node_1->layout.position[CSS_LEFT] = 0;
1526 node_1->layout.dimensions[CSS_WIDTH] = 100;
1527 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1528 node_1 = node_0->get_child(node_0->context, 1);
1529 node_1->layout.position[CSS_TOP] = 700;
1530 node_1->layout.position[CSS_LEFT] = 0;
1531 node_1->layout.dimensions[CSS_WIDTH] = 100;
1532 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1536 test("should layout node with justifyContent: space-around", root_node, root_layout);
1540 css_node_t *root_node = new_test_css_node();
1542 css_node_t *node_0 = root_node;
1543 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
1544 node_0->style.justify_content = CSS_JUSTIFY_SPACE_AROUND;
1545 node_0->style.dimensions[CSS_WIDTH] = 1000;
1546 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1547 init_css_node_children(node_0, 2);
1550 node_1 = node_0->get_child(node_0->context, 0);
1551 node_1->style.dimensions[CSS_WIDTH] = 100;
1552 node_1->style.dimensions[CSS_HEIGHT] = 100;
1553 node_1 = node_0->get_child(node_0->context, 1);
1554 node_1->style.dimensions[CSS_WIDTH] = 100;
1555 node_1->style.dimensions[CSS_HEIGHT] = 100;
1559 css_node_t *root_layout = new_test_css_node();
1561 css_node_t *node_0 = root_layout;
1562 node_0->layout.position[CSS_TOP] = 0;
1563 node_0->layout.position[CSS_LEFT] = 0;
1564 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1565 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1566 init_css_node_children(node_0, 2);
1569 node_1 = node_0->get_child(node_0->context, 0);
1570 node_1->layout.position[CSS_TOP] = 700;
1571 node_1->layout.position[CSS_LEFT] = 0;
1572 node_1->layout.dimensions[CSS_WIDTH] = 100;
1573 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1574 node_1 = node_0->get_child(node_0->context, 1);
1575 node_1->layout.position[CSS_TOP] = 200;
1576 node_1->layout.position[CSS_LEFT] = 0;
1577 node_1->layout.dimensions[CSS_WIDTH] = 100;
1578 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1582 test("should layout node with justifyContent: space-around in reverse", root_node, root_layout);
1586 css_node_t *root_node = new_test_css_node();
1588 css_node_t *node_0 = root_node;
1589 node_0->style.justify_content = CSS_JUSTIFY_CENTER;
1590 node_0->style.dimensions[CSS_WIDTH] = 1000;
1591 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1592 init_css_node_children(node_0, 2);
1595 node_1 = node_0->get_child(node_0->context, 0);
1596 node_1->style.dimensions[CSS_WIDTH] = 100;
1597 node_1->style.dimensions[CSS_HEIGHT] = 100;
1598 node_1 = node_0->get_child(node_0->context, 1);
1599 node_1->style.dimensions[CSS_WIDTH] = 100;
1600 node_1->style.dimensions[CSS_HEIGHT] = 100;
1604 css_node_t *root_layout = new_test_css_node();
1606 css_node_t *node_0 = root_layout;
1607 node_0->layout.position[CSS_TOP] = 0;
1608 node_0->layout.position[CSS_LEFT] = 0;
1609 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1610 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1611 init_css_node_children(node_0, 2);
1614 node_1 = node_0->get_child(node_0->context, 0);
1615 node_1->layout.position[CSS_TOP] = 400;
1616 node_1->layout.position[CSS_LEFT] = 0;
1617 node_1->layout.dimensions[CSS_WIDTH] = 100;
1618 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1619 node_1 = node_0->get_child(node_0->context, 1);
1620 node_1->layout.position[CSS_TOP] = 500;
1621 node_1->layout.position[CSS_LEFT] = 0;
1622 node_1->layout.dimensions[CSS_WIDTH] = 100;
1623 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1627 test("should layout node with justifyContent: center", root_node, root_layout);
1631 css_node_t *root_node = new_test_css_node();
1633 css_node_t *node_0 = root_node;
1634 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
1635 node_0->style.justify_content = CSS_JUSTIFY_CENTER;
1636 node_0->style.dimensions[CSS_WIDTH] = 1000;
1637 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1638 init_css_node_children(node_0, 2);
1641 node_1 = node_0->get_child(node_0->context, 0);
1642 node_1->style.dimensions[CSS_WIDTH] = 100;
1643 node_1->style.dimensions[CSS_HEIGHT] = 100;
1644 node_1 = node_0->get_child(node_0->context, 1);
1645 node_1->style.dimensions[CSS_WIDTH] = 100;
1646 node_1->style.dimensions[CSS_HEIGHT] = 100;
1650 css_node_t *root_layout = new_test_css_node();
1652 css_node_t *node_0 = root_layout;
1653 node_0->layout.position[CSS_TOP] = 0;
1654 node_0->layout.position[CSS_LEFT] = 0;
1655 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1656 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1657 init_css_node_children(node_0, 2);
1660 node_1 = node_0->get_child(node_0->context, 0);
1661 node_1->layout.position[CSS_TOP] = 500;
1662 node_1->layout.position[CSS_LEFT] = 0;
1663 node_1->layout.dimensions[CSS_WIDTH] = 100;
1664 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1665 node_1 = node_0->get_child(node_0->context, 1);
1666 node_1->layout.position[CSS_TOP] = 400;
1667 node_1->layout.position[CSS_LEFT] = 0;
1668 node_1->layout.dimensions[CSS_WIDTH] = 100;
1669 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1673 test("should layout node with justifyContent: center in reverse", root_node, root_layout);
1677 css_node_t *root_node = new_test_css_node();
1679 css_node_t *node_0 = root_node;
1680 node_0->style.dimensions[CSS_WIDTH] = 1000;
1681 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1682 init_css_node_children(node_0, 1);
1685 node_1 = node_0->get_child(node_0->context, 0);
1686 node_1->style.flex = 1;
1687 node_1->style.dimensions[CSS_WIDTH] = 100;
1688 node_1->style.dimensions[CSS_HEIGHT] = 100;
1692 css_node_t *root_layout = new_test_css_node();
1694 css_node_t *node_0 = root_layout;
1695 node_0->layout.position[CSS_TOP] = 0;
1696 node_0->layout.position[CSS_LEFT] = 0;
1697 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1698 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1699 init_css_node_children(node_0, 1);
1702 node_1 = node_0->get_child(node_0->context, 0);
1703 node_1->layout.position[CSS_TOP] = 0;
1704 node_1->layout.position[CSS_LEFT] = 0;
1705 node_1->layout.dimensions[CSS_WIDTH] = 100;
1706 node_1->layout.dimensions[CSS_HEIGHT] = 1000;
1710 test("should layout node with flex override height", root_node, root_layout);
1714 css_node_t *root_node = new_test_css_node();
1716 css_node_t *node_0 = root_node;
1717 node_0->style.align_items = CSS_ALIGN_FLEX_START;
1718 node_0->style.dimensions[CSS_WIDTH] = 1000;
1719 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1720 init_css_node_children(node_0, 2);
1723 node_1 = node_0->get_child(node_0->context, 0);
1724 node_1->style.dimensions[CSS_WIDTH] = 200;
1725 node_1->style.dimensions[CSS_HEIGHT] = 100;
1726 node_1 = node_0->get_child(node_0->context, 1);
1727 node_1->style.dimensions[CSS_WIDTH] = 100;
1728 node_1->style.dimensions[CSS_HEIGHT] = 100;
1732 css_node_t *root_layout = new_test_css_node();
1734 css_node_t *node_0 = root_layout;
1735 node_0->layout.position[CSS_TOP] = 0;
1736 node_0->layout.position[CSS_LEFT] = 0;
1737 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1738 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1739 init_css_node_children(node_0, 2);
1742 node_1 = node_0->get_child(node_0->context, 0);
1743 node_1->layout.position[CSS_TOP] = 0;
1744 node_1->layout.position[CSS_LEFT] = 0;
1745 node_1->layout.dimensions[CSS_WIDTH] = 200;
1746 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1747 node_1 = node_0->get_child(node_0->context, 1);
1748 node_1->layout.position[CSS_TOP] = 100;
1749 node_1->layout.position[CSS_LEFT] = 0;
1750 node_1->layout.dimensions[CSS_WIDTH] = 100;
1751 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1755 test("should layout node with alignItems: flex-start", root_node, root_layout);
1759 css_node_t *root_node = new_test_css_node();
1761 css_node_t *node_0 = root_node;
1762 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
1763 node_0->style.align_items = CSS_ALIGN_FLEX_START;
1764 node_0->style.dimensions[CSS_WIDTH] = 1000;
1765 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1766 init_css_node_children(node_0, 2);
1769 node_1 = node_0->get_child(node_0->context, 0);
1770 node_1->style.dimensions[CSS_WIDTH] = 200;
1771 node_1->style.dimensions[CSS_HEIGHT] = 100;
1772 node_1 = node_0->get_child(node_0->context, 1);
1773 node_1->style.dimensions[CSS_WIDTH] = 100;
1774 node_1->style.dimensions[CSS_HEIGHT] = 100;
1778 css_node_t *root_layout = new_test_css_node();
1780 css_node_t *node_0 = root_layout;
1781 node_0->layout.position[CSS_TOP] = 0;
1782 node_0->layout.position[CSS_LEFT] = 0;
1783 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1784 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1785 init_css_node_children(node_0, 2);
1788 node_1 = node_0->get_child(node_0->context, 0);
1789 node_1->layout.position[CSS_TOP] = 900;
1790 node_1->layout.position[CSS_LEFT] = 0;
1791 node_1->layout.dimensions[CSS_WIDTH] = 200;
1792 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1793 node_1 = node_0->get_child(node_0->context, 1);
1794 node_1->layout.position[CSS_TOP] = 800;
1795 node_1->layout.position[CSS_LEFT] = 0;
1796 node_1->layout.dimensions[CSS_WIDTH] = 100;
1797 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1801 test("should layout node with alignItems: flex-start in reverse", root_node, root_layout);
1805 css_node_t *root_node = new_test_css_node();
1807 css_node_t *node_0 = root_node;
1808 node_0->style.align_items = CSS_ALIGN_CENTER;
1809 node_0->style.dimensions[CSS_WIDTH] = 1000;
1810 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1811 init_css_node_children(node_0, 2);
1814 node_1 = node_0->get_child(node_0->context, 0);
1815 node_1->style.dimensions[CSS_WIDTH] = 200;
1816 node_1->style.dimensions[CSS_HEIGHT] = 100;
1817 node_1 = node_0->get_child(node_0->context, 1);
1818 node_1->style.dimensions[CSS_WIDTH] = 100;
1819 node_1->style.dimensions[CSS_HEIGHT] = 100;
1823 css_node_t *root_layout = new_test_css_node();
1825 css_node_t *node_0 = root_layout;
1826 node_0->layout.position[CSS_TOP] = 0;
1827 node_0->layout.position[CSS_LEFT] = 0;
1828 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1829 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1830 init_css_node_children(node_0, 2);
1833 node_1 = node_0->get_child(node_0->context, 0);
1834 node_1->layout.position[CSS_TOP] = 0;
1835 node_1->layout.position[CSS_LEFT] = 400;
1836 node_1->layout.dimensions[CSS_WIDTH] = 200;
1837 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1838 node_1 = node_0->get_child(node_0->context, 1);
1839 node_1->layout.position[CSS_TOP] = 100;
1840 node_1->layout.position[CSS_LEFT] = 450;
1841 node_1->layout.dimensions[CSS_WIDTH] = 100;
1842 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1846 test("should layout node with alignItems: center", root_node, root_layout);
1850 css_node_t *root_node = new_test_css_node();
1852 css_node_t *node_0 = root_node;
1853 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
1854 node_0->style.align_items = CSS_ALIGN_CENTER;
1855 node_0->style.dimensions[CSS_WIDTH] = 1000;
1856 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1857 init_css_node_children(node_0, 2);
1860 node_1 = node_0->get_child(node_0->context, 0);
1861 node_1->style.dimensions[CSS_WIDTH] = 200;
1862 node_1->style.dimensions[CSS_HEIGHT] = 100;
1863 node_1 = node_0->get_child(node_0->context, 1);
1864 node_1->style.dimensions[CSS_WIDTH] = 100;
1865 node_1->style.dimensions[CSS_HEIGHT] = 100;
1869 css_node_t *root_layout = new_test_css_node();
1871 css_node_t *node_0 = root_layout;
1872 node_0->layout.position[CSS_TOP] = 0;
1873 node_0->layout.position[CSS_LEFT] = 0;
1874 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1875 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1876 init_css_node_children(node_0, 2);
1879 node_1 = node_0->get_child(node_0->context, 0);
1880 node_1->layout.position[CSS_TOP] = 900;
1881 node_1->layout.position[CSS_LEFT] = 400;
1882 node_1->layout.dimensions[CSS_WIDTH] = 200;
1883 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1884 node_1 = node_0->get_child(node_0->context, 1);
1885 node_1->layout.position[CSS_TOP] = 800;
1886 node_1->layout.position[CSS_LEFT] = 450;
1887 node_1->layout.dimensions[CSS_WIDTH] = 100;
1888 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1892 test("should layout node with alignItems: center in reverse", root_node, root_layout);
1896 css_node_t *root_node = new_test_css_node();
1898 css_node_t *node_0 = root_node;
1899 node_0->style.align_items = CSS_ALIGN_FLEX_END;
1900 node_0->style.dimensions[CSS_WIDTH] = 1000;
1901 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1902 init_css_node_children(node_0, 2);
1905 node_1 = node_0->get_child(node_0->context, 0);
1906 node_1->style.dimensions[CSS_WIDTH] = 200;
1907 node_1->style.dimensions[CSS_HEIGHT] = 100;
1908 node_1 = node_0->get_child(node_0->context, 1);
1909 node_1->style.dimensions[CSS_WIDTH] = 100;
1910 node_1->style.dimensions[CSS_HEIGHT] = 100;
1914 css_node_t *root_layout = new_test_css_node();
1916 css_node_t *node_0 = root_layout;
1917 node_0->layout.position[CSS_TOP] = 0;
1918 node_0->layout.position[CSS_LEFT] = 0;
1919 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1920 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1921 init_css_node_children(node_0, 2);
1924 node_1 = node_0->get_child(node_0->context, 0);
1925 node_1->layout.position[CSS_TOP] = 0;
1926 node_1->layout.position[CSS_LEFT] = 800;
1927 node_1->layout.dimensions[CSS_WIDTH] = 200;
1928 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1929 node_1 = node_0->get_child(node_0->context, 1);
1930 node_1->layout.position[CSS_TOP] = 100;
1931 node_1->layout.position[CSS_LEFT] = 900;
1932 node_1->layout.dimensions[CSS_WIDTH] = 100;
1933 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1937 test("should layout node with alignItems: flex-end", root_node, root_layout);
1941 css_node_t *root_node = new_test_css_node();
1943 css_node_t *node_0 = root_node;
1944 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
1945 node_0->style.align_items = CSS_ALIGN_FLEX_END;
1946 node_0->style.dimensions[CSS_WIDTH] = 1000;
1947 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1948 init_css_node_children(node_0, 2);
1951 node_1 = node_0->get_child(node_0->context, 0);
1952 node_1->style.dimensions[CSS_WIDTH] = 200;
1953 node_1->style.dimensions[CSS_HEIGHT] = 100;
1954 node_1 = node_0->get_child(node_0->context, 1);
1955 node_1->style.dimensions[CSS_WIDTH] = 100;
1956 node_1->style.dimensions[CSS_HEIGHT] = 100;
1960 css_node_t *root_layout = new_test_css_node();
1962 css_node_t *node_0 = root_layout;
1963 node_0->layout.position[CSS_TOP] = 0;
1964 node_0->layout.position[CSS_LEFT] = 0;
1965 node_0->layout.dimensions[CSS_WIDTH] = 1000;
1966 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
1967 init_css_node_children(node_0, 2);
1970 node_1 = node_0->get_child(node_0->context, 0);
1971 node_1->layout.position[CSS_TOP] = 900;
1972 node_1->layout.position[CSS_LEFT] = 800;
1973 node_1->layout.dimensions[CSS_WIDTH] = 200;
1974 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1975 node_1 = node_0->get_child(node_0->context, 1);
1976 node_1->layout.position[CSS_TOP] = 800;
1977 node_1->layout.position[CSS_LEFT] = 900;
1978 node_1->layout.dimensions[CSS_WIDTH] = 100;
1979 node_1->layout.dimensions[CSS_HEIGHT] = 100;
1983 test("should layout node with alignItems: flex-end in reverse", root_node, root_layout);
1987 css_node_t *root_node = new_test_css_node();
1989 css_node_t *node_0 = root_node;
1990 node_0->style.align_items = CSS_ALIGN_FLEX_END;
1991 node_0->style.dimensions[CSS_WIDTH] = 1000;
1992 node_0->style.dimensions[CSS_HEIGHT] = 1000;
1993 init_css_node_children(node_0, 2);
1996 node_1 = node_0->get_child(node_0->context, 0);
1997 node_1->style.dimensions[CSS_WIDTH] = 200;
1998 node_1->style.dimensions[CSS_HEIGHT] = 100;
1999 node_1 = node_0->get_child(node_0->context, 1);
2000 node_1->style.align_self = CSS_ALIGN_CENTER;
2001 node_1->style.dimensions[CSS_WIDTH] = 100;
2002 node_1->style.dimensions[CSS_HEIGHT] = 100;
2006 css_node_t *root_layout = new_test_css_node();
2008 css_node_t *node_0 = root_layout;
2009 node_0->layout.position[CSS_TOP] = 0;
2010 node_0->layout.position[CSS_LEFT] = 0;
2011 node_0->layout.dimensions[CSS_WIDTH] = 1000;
2012 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
2013 init_css_node_children(node_0, 2);
2016 node_1 = node_0->get_child(node_0->context, 0);
2017 node_1->layout.position[CSS_TOP] = 0;
2018 node_1->layout.position[CSS_LEFT] = 800;
2019 node_1->layout.dimensions[CSS_WIDTH] = 200;
2020 node_1->layout.dimensions[CSS_HEIGHT] = 100;
2021 node_1 = node_0->get_child(node_0->context, 1);
2022 node_1->layout.position[CSS_TOP] = 100;
2023 node_1->layout.position[CSS_LEFT] = 450;
2024 node_1->layout.dimensions[CSS_WIDTH] = 100;
2025 node_1->layout.dimensions[CSS_HEIGHT] = 100;
2029 test("should layout node with alignSelf overrides alignItems", root_node, root_layout);
2033 css_node_t *root_node = new_test_css_node();
2035 css_node_t *node_0 = root_node;
2036 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
2037 node_0->style.align_items = CSS_ALIGN_FLEX_END;
2038 node_0->style.dimensions[CSS_WIDTH] = 1000;
2039 node_0->style.dimensions[CSS_HEIGHT] = 1000;
2040 init_css_node_children(node_0, 2);
2043 node_1 = node_0->get_child(node_0->context, 0);
2044 node_1->style.dimensions[CSS_WIDTH] = 200;
2045 node_1->style.dimensions[CSS_HEIGHT] = 100;
2046 node_1 = node_0->get_child(node_0->context, 1);
2047 node_1->style.align_self = CSS_ALIGN_CENTER;
2048 node_1->style.dimensions[CSS_WIDTH] = 100;
2049 node_1->style.dimensions[CSS_HEIGHT] = 100;
2053 css_node_t *root_layout = new_test_css_node();
2055 css_node_t *node_0 = root_layout;
2056 node_0->layout.position[CSS_TOP] = 0;
2057 node_0->layout.position[CSS_LEFT] = 0;
2058 node_0->layout.dimensions[CSS_WIDTH] = 1000;
2059 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
2060 init_css_node_children(node_0, 2);
2063 node_1 = node_0->get_child(node_0->context, 0);
2064 node_1->layout.position[CSS_TOP] = 900;
2065 node_1->layout.position[CSS_LEFT] = 800;
2066 node_1->layout.dimensions[CSS_WIDTH] = 200;
2067 node_1->layout.dimensions[CSS_HEIGHT] = 100;
2068 node_1 = node_0->get_child(node_0->context, 1);
2069 node_1->layout.position[CSS_TOP] = 800;
2070 node_1->layout.position[CSS_LEFT] = 450;
2071 node_1->layout.dimensions[CSS_WIDTH] = 100;
2072 node_1->layout.dimensions[CSS_HEIGHT] = 100;
2076 test("should layout node with alignSelf overrides alignItems in reverse", root_node, root_layout);
2080 css_node_t *root_node = new_test_css_node();
2082 css_node_t *node_0 = root_node;
2083 node_0->style.align_items = CSS_ALIGN_STRETCH;
2084 node_0->style.dimensions[CSS_WIDTH] = 1000;
2085 node_0->style.dimensions[CSS_HEIGHT] = 1000;
2086 init_css_node_children(node_0, 1);
2089 node_1 = node_0->get_child(node_0->context, 0);
2090 node_1->style.dimensions[CSS_HEIGHT] = 100;
2094 css_node_t *root_layout = new_test_css_node();
2096 css_node_t *node_0 = root_layout;
2097 node_0->layout.position[CSS_TOP] = 0;
2098 node_0->layout.position[CSS_LEFT] = 0;
2099 node_0->layout.dimensions[CSS_WIDTH] = 1000;
2100 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
2101 init_css_node_children(node_0, 1);
2104 node_1 = node_0->get_child(node_0->context, 0);
2105 node_1->layout.position[CSS_TOP] = 0;
2106 node_1->layout.position[CSS_LEFT] = 0;
2107 node_1->layout.dimensions[CSS_WIDTH] = 1000;
2108 node_1->layout.dimensions[CSS_HEIGHT] = 100;
2112 test("should layout node with alignItem: stretch", root_node, root_layout);
2116 css_node_t *root_node = new_test_css_node();
2118 css_node_t *node_0 = root_node;
2119 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
2120 node_0->style.align_items = CSS_ALIGN_STRETCH;
2121 node_0->style.dimensions[CSS_WIDTH] = 1000;
2122 node_0->style.dimensions[CSS_HEIGHT] = 1000;
2123 init_css_node_children(node_0, 1);
2126 node_1 = node_0->get_child(node_0->context, 0);
2127 node_1->style.dimensions[CSS_HEIGHT] = 100;
2131 css_node_t *root_layout = new_test_css_node();
2133 css_node_t *node_0 = root_layout;
2134 node_0->layout.position[CSS_TOP] = 0;
2135 node_0->layout.position[CSS_LEFT] = 0;
2136 node_0->layout.dimensions[CSS_WIDTH] = 1000;
2137 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
2138 init_css_node_children(node_0, 1);
2141 node_1 = node_0->get_child(node_0->context, 0);
2142 node_1->layout.position[CSS_TOP] = 900;
2143 node_1->layout.position[CSS_LEFT] = 0;
2144 node_1->layout.dimensions[CSS_WIDTH] = 1000;
2145 node_1->layout.dimensions[CSS_HEIGHT] = 100;
2149 test("should layout node with alignItem: stretch in reverse", root_node, root_layout);
2153 css_node_t *root_node = new_test_css_node();
2155 css_node_t *node_0 = root_node;
2156 init_css_node_children(node_0, 1);
2159 node_1 = node_0->get_child(node_0->context, 0);
2163 css_node_t *root_layout = new_test_css_node();
2165 css_node_t *node_0 = root_layout;
2166 node_0->layout.position[CSS_TOP] = 0;
2167 node_0->layout.position[CSS_LEFT] = 0;
2168 node_0->layout.dimensions[CSS_WIDTH] = 0;
2169 node_0->layout.dimensions[CSS_HEIGHT] = 0;
2170 init_css_node_children(node_0, 1);
2173 node_1 = node_0->get_child(node_0->context, 0);
2174 node_1->layout.position[CSS_TOP] = 0;
2175 node_1->layout.position[CSS_LEFT] = 0;
2176 node_1->layout.dimensions[CSS_WIDTH] = 0;
2177 node_1->layout.dimensions[CSS_HEIGHT] = 0;
2181 test("should layout empty node", root_node, root_layout);
2185 css_node_t *root_node = new_test_css_node();
2187 css_node_t *node_0 = root_node;
2188 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
2189 init_css_node_children(node_0, 1);
2192 node_1 = node_0->get_child(node_0->context, 0);
2196 css_node_t *root_layout = new_test_css_node();
2198 css_node_t *node_0 = root_layout;
2199 node_0->layout.position[CSS_TOP] = 0;
2200 node_0->layout.position[CSS_LEFT] = 0;
2201 node_0->layout.dimensions[CSS_WIDTH] = 0;
2202 node_0->layout.dimensions[CSS_HEIGHT] = 0;
2203 init_css_node_children(node_0, 1);
2206 node_1 = node_0->get_child(node_0->context, 0);
2207 node_1->layout.position[CSS_TOP] = 0;
2208 node_1->layout.position[CSS_LEFT] = 0;
2209 node_1->layout.dimensions[CSS_WIDTH] = 0;
2210 node_1->layout.dimensions[CSS_HEIGHT] = 0;
2214 test("should layout empty node in reverse", root_node, root_layout);
2218 css_node_t *root_node = new_test_css_node();
2220 css_node_t *node_0 = root_node;
2221 init_css_node_children(node_0, 1);
2224 node_1 = node_0->get_child(node_0->context, 0);
2225 node_1->style.margin[CSS_LEFT] = 5;
2226 node_1->style.margin[CSS_TOP] = 5;
2227 node_1->style.margin[CSS_RIGHT] = 5;
2228 node_1->style.margin[CSS_BOTTOM] = 5;
2229 node_1->style.margin[CSS_START] = 5;
2230 node_1->style.margin[CSS_END] = 5;
2234 css_node_t *root_layout = new_test_css_node();
2236 css_node_t *node_0 = root_layout;
2237 node_0->layout.position[CSS_TOP] = 0;
2238 node_0->layout.position[CSS_LEFT] = 0;
2239 node_0->layout.dimensions[CSS_WIDTH] = 10;
2240 node_0->layout.dimensions[CSS_HEIGHT] = 10;
2241 init_css_node_children(node_0, 1);
2244 node_1 = node_0->get_child(node_0->context, 0);
2245 node_1->layout.position[CSS_TOP] = 5;
2246 node_1->layout.position[CSS_LEFT] = 5;
2247 node_1->layout.dimensions[CSS_WIDTH] = 0;
2248 node_1->layout.dimensions[CSS_HEIGHT] = 0;
2252 test("should layout child with margin", root_node, root_layout);
2256 css_node_t *root_node = new_test_css_node();
2258 css_node_t *node_0 = root_node;
2259 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
2260 init_css_node_children(node_0, 1);
2263 node_1 = node_0->get_child(node_0->context, 0);
2264 node_1->style.margin[CSS_LEFT] = 5;
2265 node_1->style.margin[CSS_TOP] = 5;
2266 node_1->style.margin[CSS_RIGHT] = 5;
2267 node_1->style.margin[CSS_BOTTOM] = 5;
2268 node_1->style.margin[CSS_START] = 5;
2269 node_1->style.margin[CSS_END] = 5;
2273 css_node_t *root_layout = new_test_css_node();
2275 css_node_t *node_0 = root_layout;
2276 node_0->layout.position[CSS_TOP] = 0;
2277 node_0->layout.position[CSS_LEFT] = 0;
2278 node_0->layout.dimensions[CSS_WIDTH] = 10;
2279 node_0->layout.dimensions[CSS_HEIGHT] = 10;
2280 init_css_node_children(node_0, 1);
2283 node_1 = node_0->get_child(node_0->context, 0);
2284 node_1->layout.position[CSS_TOP] = 5;
2285 node_1->layout.position[CSS_LEFT] = 5;
2286 node_1->layout.dimensions[CSS_WIDTH] = 0;
2287 node_1->layout.dimensions[CSS_HEIGHT] = 0;
2291 test("should layout child with margin in reverse", root_node, root_layout);
2295 css_node_t *root_node = new_test_css_node();
2297 css_node_t *node_0 = root_node;
2298 node_0->style.dimensions[CSS_HEIGHT] = 100;
2299 init_css_node_children(node_0, 2);
2302 node_1 = node_0->get_child(node_0->context, 0);
2303 node_1->style.dimensions[CSS_HEIGHT] = 100;
2304 node_1 = node_0->get_child(node_0->context, 1);
2305 node_1->style.dimensions[CSS_HEIGHT] = 200;
2309 css_node_t *root_layout = new_test_css_node();
2311 css_node_t *node_0 = root_layout;
2312 node_0->layout.position[CSS_TOP] = 0;
2313 node_0->layout.position[CSS_LEFT] = 0;
2314 node_0->layout.dimensions[CSS_WIDTH] = 0;
2315 node_0->layout.dimensions[CSS_HEIGHT] = 100;
2316 init_css_node_children(node_0, 2);
2319 node_1 = node_0->get_child(node_0->context, 0);
2320 node_1->layout.position[CSS_TOP] = 0;
2321 node_1->layout.position[CSS_LEFT] = 0;
2322 node_1->layout.dimensions[CSS_WIDTH] = 0;
2323 node_1->layout.dimensions[CSS_HEIGHT] = 100;
2324 node_1 = node_0->get_child(node_0->context, 1);
2325 node_1->layout.position[CSS_TOP] = 100;
2326 node_1->layout.position[CSS_LEFT] = 0;
2327 node_1->layout.dimensions[CSS_WIDTH] = 0;
2328 node_1->layout.dimensions[CSS_HEIGHT] = 200;
2332 test("should not shrink children if not enough space", root_node, root_layout);
2336 css_node_t *root_node = new_test_css_node();
2338 css_node_t *node_0 = root_node;
2339 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
2340 node_0->style.dimensions[CSS_HEIGHT] = 100;
2341 init_css_node_children(node_0, 2);
2344 node_1 = node_0->get_child(node_0->context, 0);
2345 node_1->style.dimensions[CSS_HEIGHT] = 100;
2346 node_1 = node_0->get_child(node_0->context, 1);
2347 node_1->style.dimensions[CSS_HEIGHT] = 200;
2351 css_node_t *root_layout = new_test_css_node();
2353 css_node_t *node_0 = root_layout;
2354 node_0->layout.position[CSS_TOP] = 0;
2355 node_0->layout.position[CSS_LEFT] = 0;
2356 node_0->layout.dimensions[CSS_WIDTH] = 0;
2357 node_0->layout.dimensions[CSS_HEIGHT] = 100;
2358 init_css_node_children(node_0, 2);
2361 node_1 = node_0->get_child(node_0->context, 0);
2362 node_1->layout.position[CSS_TOP] = 0;
2363 node_1->layout.position[CSS_LEFT] = 0;
2364 node_1->layout.dimensions[CSS_WIDTH] = 0;
2365 node_1->layout.dimensions[CSS_HEIGHT] = 100;
2366 node_1 = node_0->get_child(node_0->context, 1);
2367 node_1->layout.position[CSS_TOP] = -200;
2368 node_1->layout.position[CSS_LEFT] = 0;
2369 node_1->layout.dimensions[CSS_WIDTH] = 0;
2370 node_1->layout.dimensions[CSS_HEIGHT] = 200;
2374 test("should not shrink children if not enough space in reverse", root_node, root_layout);
2378 css_node_t *root_node = new_test_css_node();
2380 css_node_t *node_0 = root_node;
2381 node_0->style.justify_content = CSS_JUSTIFY_CENTER;
2384 css_node_t *root_layout = new_test_css_node();
2386 css_node_t *node_0 = root_layout;
2387 node_0->layout.position[CSS_TOP] = 0;
2388 node_0->layout.position[CSS_LEFT] = 0;
2389 node_0->layout.dimensions[CSS_WIDTH] = 0;
2390 node_0->layout.dimensions[CSS_HEIGHT] = 0;
2393 test("should layout for center", root_node, root_layout);
2397 css_node_t *root_node = new_test_css_node();
2399 css_node_t *node_0 = root_node;
2400 node_0->style.justify_content = CSS_JUSTIFY_FLEX_END;
2401 node_0->style.dimensions[CSS_HEIGHT] = 100;
2402 init_css_node_children(node_0, 1);
2405 node_1 = node_0->get_child(node_0->context, 0);
2406 node_1->style.margin[CSS_TOP] = 10;
2410 css_node_t *root_layout = new_test_css_node();
2412 css_node_t *node_0 = root_layout;
2413 node_0->layout.position[CSS_TOP] = 0;
2414 node_0->layout.position[CSS_LEFT] = 0;
2415 node_0->layout.dimensions[CSS_WIDTH] = 0;
2416 node_0->layout.dimensions[CSS_HEIGHT] = 100;
2417 init_css_node_children(node_0, 1);
2420 node_1 = node_0->get_child(node_0->context, 0);
2421 node_1->layout.position[CSS_TOP] = 100;
2422 node_1->layout.position[CSS_LEFT] = 0;
2423 node_1->layout.dimensions[CSS_WIDTH] = 0;
2424 node_1->layout.dimensions[CSS_HEIGHT] = 0;
2428 test("should layout flex-end taking into account margin", root_node, root_layout);
2432 css_node_t *root_node = new_test_css_node();
2434 css_node_t *node_0 = root_node;
2435 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
2436 node_0->style.justify_content = CSS_JUSTIFY_FLEX_END;
2437 node_0->style.dimensions[CSS_HEIGHT] = 100;
2438 init_css_node_children(node_0, 1);
2441 node_1 = node_0->get_child(node_0->context, 0);
2442 node_1->style.margin[CSS_TOP] = 10;
2446 css_node_t *root_layout = new_test_css_node();
2448 css_node_t *node_0 = root_layout;
2449 node_0->layout.position[CSS_TOP] = 0;
2450 node_0->layout.position[CSS_LEFT] = 0;
2451 node_0->layout.dimensions[CSS_WIDTH] = 0;
2452 node_0->layout.dimensions[CSS_HEIGHT] = 100;
2453 init_css_node_children(node_0, 1);
2456 node_1 = node_0->get_child(node_0->context, 0);
2457 node_1->layout.position[CSS_TOP] = 10;
2458 node_1->layout.position[CSS_LEFT] = 0;
2459 node_1->layout.dimensions[CSS_WIDTH] = 0;
2460 node_1->layout.dimensions[CSS_HEIGHT] = 0;
2464 test("should layout flex-end taking into account margin in reverse", root_node, root_layout);
2468 css_node_t *root_node = new_test_css_node();
2470 css_node_t *node_0 = root_node;
2471 init_css_node_children(node_0, 1);
2474 node_1 = node_0->get_child(node_0->context, 0);
2475 node_1->style.align_items = CSS_ALIGN_FLEX_END;
2476 init_css_node_children(node_1, 2);
2479 node_2 = node_1->get_child(node_1->context, 0);
2480 node_2->style.margin[CSS_LEFT] = 10;
2481 node_2->style.margin[CSS_TOP] = 10;
2482 node_2->style.margin[CSS_RIGHT] = 10;
2483 node_2->style.margin[CSS_BOTTOM] = 10;
2484 node_2->style.margin[CSS_START] = 10;
2485 node_2->style.margin[CSS_END] = 10;
2486 node_2 = node_1->get_child(node_1->context, 1);
2487 node_2->style.dimensions[CSS_HEIGHT] = 100;
2492 css_node_t *root_layout = new_test_css_node();
2494 css_node_t *node_0 = root_layout;
2495 node_0->layout.position[CSS_TOP] = 0;
2496 node_0->layout.position[CSS_LEFT] = 0;
2497 node_0->layout.dimensions[CSS_WIDTH] = 20;
2498 node_0->layout.dimensions[CSS_HEIGHT] = 120;
2499 init_css_node_children(node_0, 1);
2502 node_1 = node_0->get_child(node_0->context, 0);
2503 node_1->layout.position[CSS_TOP] = 0;
2504 node_1->layout.position[CSS_LEFT] = 0;
2505 node_1->layout.dimensions[CSS_WIDTH] = 20;
2506 node_1->layout.dimensions[CSS_HEIGHT] = 120;
2507 init_css_node_children(node_1, 2);
2510 node_2 = node_1->get_child(node_1->context, 0);
2511 node_2->layout.position[CSS_TOP] = 10;
2512 node_2->layout.position[CSS_LEFT] = 10;
2513 node_2->layout.dimensions[CSS_WIDTH] = 0;
2514 node_2->layout.dimensions[CSS_HEIGHT] = 0;
2515 node_2 = node_1->get_child(node_1->context, 1);
2516 node_2->layout.position[CSS_TOP] = 20;
2517 node_2->layout.position[CSS_LEFT] = 20;
2518 node_2->layout.dimensions[CSS_WIDTH] = 0;
2519 node_2->layout.dimensions[CSS_HEIGHT] = 100;
2524 test("should layout alignItems with margin", root_node, root_layout);
2528 css_node_t *root_node = new_test_css_node();
2530 css_node_t *node_0 = root_node;
2531 init_css_node_children(node_0, 1);
2534 node_1 = node_0->get_child(node_0->context, 0);
2535 node_1->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
2536 node_1->style.align_items = CSS_ALIGN_FLEX_END;
2537 init_css_node_children(node_1, 2);
2540 node_2 = node_1->get_child(node_1->context, 0);
2541 node_2->style.margin[CSS_LEFT] = 10;
2542 node_2->style.margin[CSS_TOP] = 10;
2543 node_2->style.margin[CSS_RIGHT] = 10;
2544 node_2->style.margin[CSS_BOTTOM] = 10;
2545 node_2->style.margin[CSS_START] = 10;
2546 node_2->style.margin[CSS_END] = 10;
2547 node_2 = node_1->get_child(node_1->context, 1);
2548 node_2->style.dimensions[CSS_HEIGHT] = 100;
2553 css_node_t *root_layout = new_test_css_node();
2555 css_node_t *node_0 = root_layout;
2556 node_0->layout.position[CSS_TOP] = 0;
2557 node_0->layout.position[CSS_LEFT] = 0;
2558 node_0->layout.dimensions[CSS_WIDTH] = 20;
2559 node_0->layout.dimensions[CSS_HEIGHT] = 120;
2560 init_css_node_children(node_0, 1);
2563 node_1 = node_0->get_child(node_0->context, 0);
2564 node_1->layout.position[CSS_TOP] = 0;
2565 node_1->layout.position[CSS_LEFT] = 0;
2566 node_1->layout.dimensions[CSS_WIDTH] = 20;
2567 node_1->layout.dimensions[CSS_HEIGHT] = 120;
2568 init_css_node_children(node_1, 2);
2571 node_2 = node_1->get_child(node_1->context, 0);
2572 node_2->layout.position[CSS_TOP] = 110;
2573 node_2->layout.position[CSS_LEFT] = 10;
2574 node_2->layout.dimensions[CSS_WIDTH] = 0;
2575 node_2->layout.dimensions[CSS_HEIGHT] = 0;
2576 node_2 = node_1->get_child(node_1->context, 1);
2577 node_2->layout.position[CSS_TOP] = 0;
2578 node_2->layout.position[CSS_LEFT] = 20;
2579 node_2->layout.dimensions[CSS_WIDTH] = 0;
2580 node_2->layout.dimensions[CSS_HEIGHT] = 100;
2585 test("should layout alignItems with margin in reverse", root_node, root_layout);
2589 css_node_t *root_node = new_test_css_node();
2591 css_node_t *node_0 = root_node;
2592 init_css_node_children(node_0, 1);
2595 node_1 = node_0->get_child(node_0->context, 0);
2596 node_1->style.flex = 1;
2600 css_node_t *root_layout = new_test_css_node();
2602 css_node_t *node_0 = root_layout;
2603 node_0->layout.position[CSS_TOP] = 0;
2604 node_0->layout.position[CSS_LEFT] = 0;
2605 node_0->layout.dimensions[CSS_WIDTH] = 0;
2606 node_0->layout.dimensions[CSS_HEIGHT] = 0;
2607 init_css_node_children(node_0, 1);
2610 node_1 = node_0->get_child(node_0->context, 0);
2611 node_1->layout.position[CSS_TOP] = 0;
2612 node_1->layout.position[CSS_LEFT] = 0;
2613 node_1->layout.dimensions[CSS_WIDTH] = 0;
2614 node_1->layout.dimensions[CSS_HEIGHT] = 0;
2618 test("should layout flex inside of an empty element", root_node, root_layout);
2622 css_node_t *root_node = new_test_css_node();
2624 css_node_t *node_0 = root_node;
2625 node_0->style.align_items = CSS_ALIGN_STRETCH;
2626 init_css_node_children(node_0, 1);
2629 node_1 = node_0->get_child(node_0->context, 0);
2630 node_1->style.margin[CSS_LEFT] = 10;
2634 css_node_t *root_layout = new_test_css_node();
2636 css_node_t *node_0 = root_layout;
2637 node_0->layout.position[CSS_TOP] = 0;
2638 node_0->layout.position[CSS_LEFT] = 0;
2639 node_0->layout.dimensions[CSS_WIDTH] = 10;
2640 node_0->layout.dimensions[CSS_HEIGHT] = 0;
2641 init_css_node_children(node_0, 1);
2644 node_1 = node_0->get_child(node_0->context, 0);
2645 node_1->layout.position[CSS_TOP] = 0;
2646 node_1->layout.position[CSS_LEFT] = 10;
2647 node_1->layout.dimensions[CSS_WIDTH] = 0;
2648 node_1->layout.dimensions[CSS_HEIGHT] = 0;
2652 test("should layout alignItems stretch and margin", root_node, root_layout);
2656 css_node_t *root_node = new_test_css_node();
2658 css_node_t *node_0 = root_node;
2659 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
2660 node_0->style.align_items = CSS_ALIGN_STRETCH;
2661 init_css_node_children(node_0, 1);
2664 node_1 = node_0->get_child(node_0->context, 0);
2665 node_1->style.margin[CSS_LEFT] = 10;
2669 css_node_t *root_layout = new_test_css_node();
2671 css_node_t *node_0 = root_layout;
2672 node_0->layout.position[CSS_TOP] = 0;
2673 node_0->layout.position[CSS_LEFT] = 0;
2674 node_0->layout.dimensions[CSS_WIDTH] = 10;
2675 node_0->layout.dimensions[CSS_HEIGHT] = 0;
2676 init_css_node_children(node_0, 1);
2679 node_1 = node_0->get_child(node_0->context, 0);
2680 node_1->layout.position[CSS_TOP] = 0;
2681 node_1->layout.position[CSS_LEFT] = 10;
2682 node_1->layout.dimensions[CSS_WIDTH] = 0;
2683 node_1->layout.dimensions[CSS_HEIGHT] = 0;
2687 test("should layout alignItems stretch and margin in reverse", root_node, root_layout);
2691 css_node_t *root_node = new_test_css_node();
2693 css_node_t *node_0 = root_node;
2694 node_0->style.padding[CSS_LEFT] = 5;
2695 node_0->style.padding[CSS_TOP] = 5;
2696 node_0->style.padding[CSS_RIGHT] = 5;
2697 node_0->style.padding[CSS_BOTTOM] = 5;
2698 node_0->style.padding[CSS_START] = 5;
2699 node_0->style.padding[CSS_END] = 5;
2702 css_node_t *root_layout = new_test_css_node();
2704 css_node_t *node_0 = root_layout;
2705 node_0->layout.position[CSS_TOP] = 0;
2706 node_0->layout.position[CSS_LEFT] = 0;
2707 node_0->layout.dimensions[CSS_WIDTH] = 10;
2708 node_0->layout.dimensions[CSS_HEIGHT] = 10;
2711 test("should layout node with padding", root_node, root_layout);
2715 css_node_t *root_node = new_test_css_node();
2717 css_node_t *node_0 = root_node;
2718 node_0->style.padding[CSS_LEFT] = 5;
2719 node_0->style.padding[CSS_TOP] = 5;
2720 node_0->style.padding[CSS_RIGHT] = 5;
2721 node_0->style.padding[CSS_BOTTOM] = 5;
2722 node_0->style.padding[CSS_START] = 5;
2723 node_0->style.padding[CSS_END] = 5;
2724 init_css_node_children(node_0, 1);
2727 node_1 = node_0->get_child(node_0->context, 0);
2731 css_node_t *root_layout = new_test_css_node();
2733 css_node_t *node_0 = root_layout;
2734 node_0->layout.position[CSS_TOP] = 0;
2735 node_0->layout.position[CSS_LEFT] = 0;
2736 node_0->layout.dimensions[CSS_WIDTH] = 10;
2737 node_0->layout.dimensions[CSS_HEIGHT] = 10;
2738 init_css_node_children(node_0, 1);
2741 node_1 = node_0->get_child(node_0->context, 0);
2742 node_1->layout.position[CSS_TOP] = 5;
2743 node_1->layout.position[CSS_LEFT] = 5;
2744 node_1->layout.dimensions[CSS_WIDTH] = 0;
2745 node_1->layout.dimensions[CSS_HEIGHT] = 0;
2749 test("should layout node with padding and a child", root_node, root_layout);
2753 css_node_t *root_node = new_test_css_node();
2755 css_node_t *node_0 = root_node;
2756 node_0->style.padding[CSS_LEFT] = 5;
2757 node_0->style.padding[CSS_TOP] = 5;
2758 node_0->style.padding[CSS_RIGHT] = 5;
2759 node_0->style.padding[CSS_BOTTOM] = 5;
2760 node_0->style.padding[CSS_START] = 5;
2761 node_0->style.padding[CSS_END] = 5;
2762 init_css_node_children(node_0, 1);
2765 node_1 = node_0->get_child(node_0->context, 0);
2766 node_1->style.margin[CSS_LEFT] = 5;
2767 node_1->style.margin[CSS_TOP] = 5;
2768 node_1->style.margin[CSS_RIGHT] = 5;
2769 node_1->style.margin[CSS_BOTTOM] = 5;
2770 node_1->style.margin[CSS_START] = 5;
2771 node_1->style.margin[CSS_END] = 5;
2775 css_node_t *root_layout = new_test_css_node();
2777 css_node_t *node_0 = root_layout;
2778 node_0->layout.position[CSS_TOP] = 0;
2779 node_0->layout.position[CSS_LEFT] = 0;
2780 node_0->layout.dimensions[CSS_WIDTH] = 20;
2781 node_0->layout.dimensions[CSS_HEIGHT] = 20;
2782 init_css_node_children(node_0, 1);
2785 node_1 = node_0->get_child(node_0->context, 0);
2786 node_1->layout.position[CSS_TOP] = 10;
2787 node_1->layout.position[CSS_LEFT] = 10;
2788 node_1->layout.dimensions[CSS_WIDTH] = 0;
2789 node_1->layout.dimensions[CSS_HEIGHT] = 0;
2793 test("should layout node with padding and a child with margin", root_node, root_layout);
2797 css_node_t *root_node = new_test_css_node();
2799 css_node_t *node_0 = root_node;
2800 init_css_node_children(node_0, 1);
2803 node_1 = node_0->get_child(node_0->context, 0);
2804 node_1->style.align_self = CSS_ALIGN_STRETCH;
2805 node_1->style.padding[CSS_LEFT] = 10;
2806 node_1->style.padding[CSS_TOP] = 10;
2807 node_1->style.padding[CSS_RIGHT] = 10;
2808 node_1->style.padding[CSS_BOTTOM] = 10;
2809 node_1->style.padding[CSS_START] = 10;
2810 node_1->style.padding[CSS_END] = 10;
2814 css_node_t *root_layout = new_test_css_node();
2816 css_node_t *node_0 = root_layout;
2817 node_0->layout.position[CSS_TOP] = 0;
2818 node_0->layout.position[CSS_LEFT] = 0;
2819 node_0->layout.dimensions[CSS_WIDTH] = 20;
2820 node_0->layout.dimensions[CSS_HEIGHT] = 20;
2821 init_css_node_children(node_0, 1);
2824 node_1 = node_0->get_child(node_0->context, 0);
2825 node_1->layout.position[CSS_TOP] = 0;
2826 node_1->layout.position[CSS_LEFT] = 0;
2827 node_1->layout.dimensions[CSS_WIDTH] = 20;
2828 node_1->layout.dimensions[CSS_HEIGHT] = 20;
2832 test("should layout node with padding and stretch", root_node, root_layout);
2836 css_node_t *root_node = new_test_css_node();
2838 css_node_t *node_0 = root_node;
2839 node_0->style.padding[CSS_LEFT] = 50;
2840 node_0->style.padding[CSS_TOP] = 50;
2841 node_0->style.padding[CSS_RIGHT] = 50;
2842 node_0->style.padding[CSS_BOTTOM] = 50;
2843 node_0->style.padding[CSS_START] = 50;
2844 node_0->style.padding[CSS_END] = 50;
2845 init_css_node_children(node_0, 1);
2848 node_1 = node_0->get_child(node_0->context, 0);
2849 node_1->style.align_self = CSS_ALIGN_STRETCH;
2850 node_1->style.padding[CSS_LEFT] = 10;
2851 node_1->style.padding[CSS_TOP] = 10;
2852 node_1->style.padding[CSS_RIGHT] = 10;
2853 node_1->style.padding[CSS_BOTTOM] = 10;
2854 node_1->style.padding[CSS_START] = 10;
2855 node_1->style.padding[CSS_END] = 10;
2859 css_node_t *root_layout = new_test_css_node();
2861 css_node_t *node_0 = root_layout;
2862 node_0->layout.position[CSS_TOP] = 0;
2863 node_0->layout.position[CSS_LEFT] = 0;
2864 node_0->layout.dimensions[CSS_WIDTH] = 120;
2865 node_0->layout.dimensions[CSS_HEIGHT] = 120;
2866 init_css_node_children(node_0, 1);
2869 node_1 = node_0->get_child(node_0->context, 0);
2870 node_1->layout.position[CSS_TOP] = 50;
2871 node_1->layout.position[CSS_LEFT] = 50;
2872 node_1->layout.dimensions[CSS_WIDTH] = 20;
2873 node_1->layout.dimensions[CSS_HEIGHT] = 20;
2877 test("should layout node with inner & outer padding and stretch", root_node, root_layout);
2881 css_node_t *root_node = new_test_css_node();
2883 css_node_t *node_0 = root_node;
2884 init_css_node_children(node_0, 1);
2887 node_1 = node_0->get_child(node_0->context, 0);
2888 node_1->style.align_self = CSS_ALIGN_STRETCH;
2889 init_css_node_children(node_1, 1);
2892 node_2 = node_1->get_child(node_1->context, 0);
2893 node_2->style.margin[CSS_LEFT] = 16;
2894 node_2->style.margin[CSS_TOP] = 16;
2895 node_2->style.margin[CSS_RIGHT] = 16;
2896 node_2->style.margin[CSS_BOTTOM] = 16;
2897 node_2->style.margin[CSS_START] = 16;
2898 node_2->style.margin[CSS_END] = 16;
2903 css_node_t *root_layout = new_test_css_node();
2905 css_node_t *node_0 = root_layout;
2906 node_0->layout.position[CSS_TOP] = 0;
2907 node_0->layout.position[CSS_LEFT] = 0;
2908 node_0->layout.dimensions[CSS_WIDTH] = 32;
2909 node_0->layout.dimensions[CSS_HEIGHT] = 32;
2910 init_css_node_children(node_0, 1);
2913 node_1 = node_0->get_child(node_0->context, 0);
2914 node_1->layout.position[CSS_TOP] = 0;
2915 node_1->layout.position[CSS_LEFT] = 0;
2916 node_1->layout.dimensions[CSS_WIDTH] = 32;
2917 node_1->layout.dimensions[CSS_HEIGHT] = 32;
2918 init_css_node_children(node_1, 1);
2921 node_2 = node_1->get_child(node_1->context, 0);
2922 node_2->layout.position[CSS_TOP] = 16;
2923 node_2->layout.position[CSS_LEFT] = 16;
2924 node_2->layout.dimensions[CSS_WIDTH] = 0;
2925 node_2->layout.dimensions[CSS_HEIGHT] = 0;
2930 test("should layout node with stretch and child with margin", root_node, root_layout);
2934 css_node_t *root_node = new_test_css_node();
2936 css_node_t *node_0 = root_node;
2937 node_0->style.position[CSS_LEFT] = 5;
2938 node_0->style.position[CSS_TOP] = 5;
2941 css_node_t *root_layout = new_test_css_node();
2943 css_node_t *node_0 = root_layout;
2944 node_0->layout.position[CSS_TOP] = 5;
2945 node_0->layout.position[CSS_LEFT] = 5;
2946 node_0->layout.dimensions[CSS_WIDTH] = 0;
2947 node_0->layout.dimensions[CSS_HEIGHT] = 0;
2950 test("should layout node with top and left", root_node, root_layout);
2954 css_node_t *root_node = new_test_css_node();
2956 css_node_t *node_0 = root_node;
2957 node_0->style.justify_content = CSS_JUSTIFY_SPACE_AROUND;
2958 node_0->style.dimensions[CSS_HEIGHT] = 10;
2959 node_0->style.padding[CSS_TOP] = 5;
2960 init_css_node_children(node_0, 1);
2963 node_1 = node_0->get_child(node_0->context, 0);
2967 css_node_t *root_layout = new_test_css_node();
2969 css_node_t *node_0 = root_layout;
2970 node_0->layout.position[CSS_TOP] = 0;
2971 node_0->layout.position[CSS_LEFT] = 0;
2972 node_0->layout.dimensions[CSS_WIDTH] = 0;
2973 node_0->layout.dimensions[CSS_HEIGHT] = 10;
2974 init_css_node_children(node_0, 1);
2977 node_1 = node_0->get_child(node_0->context, 0);
2978 node_1->layout.position[CSS_TOP] = 7.5;
2979 node_1->layout.position[CSS_LEFT] = 0;
2980 node_1->layout.dimensions[CSS_WIDTH] = 0;
2981 node_1->layout.dimensions[CSS_HEIGHT] = 0;
2985 test("should layout node with height, padding and space-around", root_node, root_layout);
2989 css_node_t *root_node = new_test_css_node();
2991 css_node_t *node_0 = root_node;
2992 node_0->style.position[CSS_BOTTOM] = 5;
2995 css_node_t *root_layout = new_test_css_node();
2997 css_node_t *node_0 = root_layout;
2998 node_0->layout.position[CSS_TOP] = -5;
2999 node_0->layout.position[CSS_LEFT] = 0;
3000 node_0->layout.dimensions[CSS_WIDTH] = 0;
3001 node_0->layout.dimensions[CSS_HEIGHT] = 0;
3004 test("should layout node with bottom", root_node, root_layout);
3008 css_node_t *root_node = new_test_css_node();
3010 css_node_t *node_0 = root_node;
3011 node_0->style.position[CSS_TOP] = 10;
3012 node_0->style.position[CSS_BOTTOM] = 5;
3015 css_node_t *root_layout = new_test_css_node();
3017 css_node_t *node_0 = root_layout;
3018 node_0->layout.position[CSS_TOP] = 10;
3019 node_0->layout.position[CSS_LEFT] = 0;
3020 node_0->layout.dimensions[CSS_WIDTH] = 0;
3021 node_0->layout.dimensions[CSS_HEIGHT] = 0;
3024 test("should layout node with both top and bottom", root_node, root_layout);
3028 css_node_t *root_node = new_test_css_node();
3030 css_node_t *node_0 = root_node;
3031 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
3032 node_0->style.dimensions[CSS_WIDTH] = 500;
3033 init_css_node_children(node_0, 3);
3036 node_1 = node_0->get_child(node_0->context, 0);
3037 node_1->style.flex = 1;
3038 node_1 = node_0->get_child(node_0->context, 1);
3039 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
3040 node_1->style.dimensions[CSS_WIDTH] = 50;
3041 node_1 = node_0->get_child(node_0->context, 2);
3042 node_1->style.flex = 1;
3046 css_node_t *root_layout = new_test_css_node();
3048 css_node_t *node_0 = root_layout;
3049 node_0->layout.position[CSS_TOP] = 0;
3050 node_0->layout.position[CSS_LEFT] = 0;
3051 node_0->layout.dimensions[CSS_WIDTH] = 500;
3052 node_0->layout.dimensions[CSS_HEIGHT] = 0;
3053 init_css_node_children(node_0, 3);
3056 node_1 = node_0->get_child(node_0->context, 0);
3057 node_1->layout.position[CSS_TOP] = 0;
3058 node_1->layout.position[CSS_LEFT] = 0;
3059 node_1->layout.dimensions[CSS_WIDTH] = 250;
3060 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3061 node_1 = node_0->get_child(node_0->context, 1);
3062 node_1->layout.position[CSS_TOP] = 0;
3063 node_1->layout.position[CSS_LEFT] = 250;
3064 node_1->layout.dimensions[CSS_WIDTH] = 50;
3065 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3066 node_1 = node_0->get_child(node_0->context, 2);
3067 node_1->layout.position[CSS_TOP] = 0;
3068 node_1->layout.position[CSS_LEFT] = 250;
3069 node_1->layout.dimensions[CSS_WIDTH] = 250;
3070 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3074 test("should layout node with position: absolute", root_node, root_layout);
3078 css_node_t *root_node = new_test_css_node();
3080 css_node_t *node_0 = root_node;
3081 init_css_node_children(node_0, 1);
3084 node_1 = node_0->get_child(node_0->context, 0);
3085 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
3086 node_1->style.margin[CSS_RIGHT] = 15;
3090 css_node_t *root_layout = new_test_css_node();
3092 css_node_t *node_0 = root_layout;
3093 node_0->layout.position[CSS_TOP] = 0;
3094 node_0->layout.position[CSS_LEFT] = 0;
3095 node_0->layout.dimensions[CSS_WIDTH] = 0;
3096 node_0->layout.dimensions[CSS_HEIGHT] = 0;
3097 init_css_node_children(node_0, 1);
3100 node_1 = node_0->get_child(node_0->context, 0);
3101 node_1->layout.position[CSS_TOP] = 0;
3102 node_1->layout.position[CSS_LEFT] = 0;
3103 node_1->layout.dimensions[CSS_WIDTH] = 0;
3104 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3108 test("should layout node with child with position: absolute and margin", root_node, root_layout);
3112 css_node_t *root_node = new_test_css_node();
3114 css_node_t *node_0 = root_node;
3115 init_css_node_children(node_0, 1);
3118 node_1 = node_0->get_child(node_0->context, 0);
3119 node_1->style.align_self = CSS_ALIGN_CENTER;
3120 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
3121 node_1->style.padding[CSS_RIGHT] = 12;
3125 css_node_t *root_layout = new_test_css_node();
3127 css_node_t *node_0 = root_layout;
3128 node_0->layout.position[CSS_TOP] = 0;
3129 node_0->layout.position[CSS_LEFT] = 0;
3130 node_0->layout.dimensions[CSS_WIDTH] = 0;
3131 node_0->layout.dimensions[CSS_HEIGHT] = 0;
3132 init_css_node_children(node_0, 1);
3135 node_1 = node_0->get_child(node_0->context, 0);
3136 node_1->layout.position[CSS_TOP] = 0;
3137 node_1->layout.position[CSS_LEFT] = 0;
3138 node_1->layout.dimensions[CSS_WIDTH] = 12;
3139 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3143 test("should layout node with position: absolute, padding and alignSelf: center", root_node, root_layout);
3147 css_node_t *root_node = new_test_css_node();
3149 css_node_t *node_0 = root_node;
3150 node_0->style.dimensions[CSS_HEIGHT] = 5;
3151 node_0->style.padding[CSS_BOTTOM] = 20;
3154 css_node_t *root_layout = new_test_css_node();
3156 css_node_t *node_0 = root_layout;
3157 node_0->layout.position[CSS_TOP] = 0;
3158 node_0->layout.position[CSS_LEFT] = 0;
3159 node_0->layout.dimensions[CSS_WIDTH] = 0;
3160 node_0->layout.dimensions[CSS_HEIGHT] = 20;
3163 test("should work with height smaller than paddingBottom", root_node, root_layout);
3167 css_node_t *root_node = new_test_css_node();
3169 css_node_t *node_0 = root_node;
3170 node_0->style.dimensions[CSS_WIDTH] = 5;
3171 node_0->style.padding[CSS_LEFT] = 20;
3174 css_node_t *root_layout = new_test_css_node();
3176 css_node_t *node_0 = root_layout;
3177 node_0->layout.position[CSS_TOP] = 0;
3178 node_0->layout.position[CSS_LEFT] = 0;
3179 node_0->layout.dimensions[CSS_WIDTH] = 20;
3180 node_0->layout.dimensions[CSS_HEIGHT] = 0;
3183 test("should work with width smaller than paddingLeft", root_node, root_layout);
3187 css_node_t *root_node = new_test_css_node();
3189 css_node_t *node_0 = root_node;
3190 init_css_node_children(node_0, 2);
3193 node_1 = node_0->get_child(node_0->context, 0);
3194 init_css_node_children(node_1, 1);
3197 node_2 = node_1->get_child(node_1->context, 0);
3198 node_2->style.dimensions[CSS_WIDTH] = 400;
3200 node_1 = node_0->get_child(node_0->context, 1);
3201 node_1->style.align_self = CSS_ALIGN_STRETCH;
3202 node_1->style.dimensions[CSS_WIDTH] = 200;
3206 css_node_t *root_layout = new_test_css_node();
3208 css_node_t *node_0 = root_layout;
3209 node_0->layout.position[CSS_TOP] = 0;
3210 node_0->layout.position[CSS_LEFT] = 0;
3211 node_0->layout.dimensions[CSS_WIDTH] = 400;
3212 node_0->layout.dimensions[CSS_HEIGHT] = 0;
3213 init_css_node_children(node_0, 2);
3216 node_1 = node_0->get_child(node_0->context, 0);
3217 node_1->layout.position[CSS_TOP] = 0;
3218 node_1->layout.position[CSS_LEFT] = 0;
3219 node_1->layout.dimensions[CSS_WIDTH] = 400;
3220 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3221 init_css_node_children(node_1, 1);
3224 node_2 = node_1->get_child(node_1->context, 0);
3225 node_2->layout.position[CSS_TOP] = 0;
3226 node_2->layout.position[CSS_LEFT] = 0;
3227 node_2->layout.dimensions[CSS_WIDTH] = 400;
3228 node_2->layout.dimensions[CSS_HEIGHT] = 0;
3230 node_1 = node_0->get_child(node_0->context, 1);
3231 node_1->layout.position[CSS_TOP] = 0;
3232 node_1->layout.position[CSS_LEFT] = 0;
3233 node_1->layout.dimensions[CSS_WIDTH] = 200;
3234 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3238 test("should layout node with specified width and stretch", root_node, root_layout);
3242 css_node_t *root_node = new_test_css_node();
3244 css_node_t *node_0 = root_node;
3245 node_0->style.padding[CSS_LEFT] = 5;
3246 node_0->style.padding[CSS_TOP] = 5;
3247 node_0->style.padding[CSS_RIGHT] = 5;
3248 node_0->style.padding[CSS_BOTTOM] = 5;
3249 node_0->style.padding[CSS_START] = 5;
3250 node_0->style.padding[CSS_END] = 5;
3251 init_css_node_children(node_0, 1);
3254 node_1 = node_0->get_child(node_0->context, 0);
3255 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
3259 css_node_t *root_layout = new_test_css_node();
3261 css_node_t *node_0 = root_layout;
3262 node_0->layout.position[CSS_TOP] = 0;
3263 node_0->layout.position[CSS_LEFT] = 0;
3264 node_0->layout.dimensions[CSS_WIDTH] = 10;
3265 node_0->layout.dimensions[CSS_HEIGHT] = 10;
3266 init_css_node_children(node_0, 1);
3269 node_1 = node_0->get_child(node_0->context, 0);
3270 node_1->layout.position[CSS_TOP] = 5;
3271 node_1->layout.position[CSS_LEFT] = 5;
3272 node_1->layout.dimensions[CSS_WIDTH] = 0;
3273 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3277 test("should layout node with padding and child with position absolute", root_node, root_layout);
3281 css_node_t *root_node = new_test_css_node();
3283 css_node_t *node_0 = root_node;
3284 init_css_node_children(node_0, 2);
3287 node_1 = node_0->get_child(node_0->context, 0);
3288 node_1->style.dimensions[CSS_HEIGHT] = 100;
3289 node_1 = node_0->get_child(node_0->context, 1);
3290 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
3291 node_1->style.position[CSS_LEFT] = 10;
3292 node_1->style.position[CSS_TOP] = 10;
3296 css_node_t *root_layout = new_test_css_node();
3298 css_node_t *node_0 = root_layout;
3299 node_0->layout.position[CSS_TOP] = 0;
3300 node_0->layout.position[CSS_LEFT] = 0;
3301 node_0->layout.dimensions[CSS_WIDTH] = 0;
3302 node_0->layout.dimensions[CSS_HEIGHT] = 100;
3303 init_css_node_children(node_0, 2);
3306 node_1 = node_0->get_child(node_0->context, 0);
3307 node_1->layout.position[CSS_TOP] = 0;
3308 node_1->layout.position[CSS_LEFT] = 0;
3309 node_1->layout.dimensions[CSS_WIDTH] = 0;
3310 node_1->layout.dimensions[CSS_HEIGHT] = 100;
3311 node_1 = node_0->get_child(node_0->context, 1);
3312 node_1->layout.position[CSS_TOP] = 10;
3313 node_1->layout.position[CSS_LEFT] = 10;
3314 node_1->layout.dimensions[CSS_WIDTH] = 0;
3315 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3319 test("should layout node with position absolute, top and left", root_node, root_layout);
3323 css_node_t *root_node = new_test_css_node();
3325 css_node_t *node_0 = root_node;
3326 node_0->style.padding[CSS_LEFT] = 20;
3327 node_0->style.padding[CSS_TOP] = 20;
3328 node_0->style.padding[CSS_RIGHT] = 20;
3329 node_0->style.padding[CSS_BOTTOM] = 20;
3330 node_0->style.padding[CSS_START] = 20;
3331 node_0->style.padding[CSS_END] = 20;
3332 init_css_node_children(node_0, 1);
3335 node_1 = node_0->get_child(node_0->context, 0);
3336 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
3337 node_1->style.position[CSS_LEFT] = 5;
3341 css_node_t *root_layout = new_test_css_node();
3343 css_node_t *node_0 = root_layout;
3344 node_0->layout.position[CSS_TOP] = 0;
3345 node_0->layout.position[CSS_LEFT] = 0;
3346 node_0->layout.dimensions[CSS_WIDTH] = 40;
3347 node_0->layout.dimensions[CSS_HEIGHT] = 40;
3348 init_css_node_children(node_0, 1);
3351 node_1 = node_0->get_child(node_0->context, 0);
3352 node_1->layout.position[CSS_TOP] = 20;
3353 node_1->layout.position[CSS_LEFT] = 5;
3354 node_1->layout.dimensions[CSS_WIDTH] = 0;
3355 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3359 test("should layout node with padding and child position absolute, left", root_node, root_layout);
3363 css_node_t *root_node = new_test_css_node();
3365 css_node_t *node_0 = root_node;
3366 init_css_node_children(node_0, 1);
3369 node_1 = node_0->get_child(node_0->context, 0);
3370 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
3371 node_1->style.margin[CSS_TOP] = 5;
3372 node_1->style.position[CSS_TOP] = 5;
3376 css_node_t *root_layout = new_test_css_node();
3378 css_node_t *node_0 = root_layout;
3379 node_0->layout.position[CSS_TOP] = 0;
3380 node_0->layout.position[CSS_LEFT] = 0;
3381 node_0->layout.dimensions[CSS_WIDTH] = 0;
3382 node_0->layout.dimensions[CSS_HEIGHT] = 0;
3383 init_css_node_children(node_0, 1);
3386 node_1 = node_0->get_child(node_0->context, 0);
3387 node_1->layout.position[CSS_TOP] = 10;
3388 node_1->layout.position[CSS_LEFT] = 0;
3389 node_1->layout.dimensions[CSS_WIDTH] = 0;
3390 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3394 test("should layout node with position: absolute, top and marginTop", root_node, root_layout);
3398 css_node_t *root_node = new_test_css_node();
3400 css_node_t *node_0 = root_node;
3401 init_css_node_children(node_0, 1);
3404 node_1 = node_0->get_child(node_0->context, 0);
3405 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
3406 node_1->style.margin[CSS_LEFT] = 5;
3407 node_1->style.position[CSS_LEFT] = 5;
3411 css_node_t *root_layout = new_test_css_node();
3413 css_node_t *node_0 = root_layout;
3414 node_0->layout.position[CSS_TOP] = 0;
3415 node_0->layout.position[CSS_LEFT] = 0;
3416 node_0->layout.dimensions[CSS_WIDTH] = 0;
3417 node_0->layout.dimensions[CSS_HEIGHT] = 0;
3418 init_css_node_children(node_0, 1);
3421 node_1 = node_0->get_child(node_0->context, 0);
3422 node_1->layout.position[CSS_TOP] = 0;
3423 node_1->layout.position[CSS_LEFT] = 10;
3424 node_1->layout.dimensions[CSS_WIDTH] = 0;
3425 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3429 test("should layout node with position: absolute, left and marginLeft", root_node, root_layout);
3433 css_node_t *root_node = new_test_css_node();
3435 css_node_t *node_0 = root_node;
3436 node_0->style.justify_content = CSS_JUSTIFY_SPACE_AROUND;
3437 node_0->style.dimensions[CSS_HEIGHT] = 200;
3438 init_css_node_children(node_0, 2);
3441 node_1 = node_0->get_child(node_0->context, 0);
3442 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
3443 node_1 = node_0->get_child(node_0->context, 1);
3447 css_node_t *root_layout = new_test_css_node();
3449 css_node_t *node_0 = root_layout;
3450 node_0->layout.position[CSS_TOP] = 0;
3451 node_0->layout.position[CSS_LEFT] = 0;
3452 node_0->layout.dimensions[CSS_WIDTH] = 0;
3453 node_0->layout.dimensions[CSS_HEIGHT] = 200;
3454 init_css_node_children(node_0, 2);
3457 node_1 = node_0->get_child(node_0->context, 0);
3458 node_1->layout.position[CSS_TOP] = 100;
3459 node_1->layout.position[CSS_LEFT] = 0;
3460 node_1->layout.dimensions[CSS_WIDTH] = 0;
3461 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3462 node_1 = node_0->get_child(node_0->context, 1);
3463 node_1->layout.position[CSS_TOP] = 100;
3464 node_1->layout.position[CSS_LEFT] = 0;
3465 node_1->layout.dimensions[CSS_WIDTH] = 0;
3466 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3470 test("should layout node with space-around and child position absolute", root_node, root_layout);
3474 css_node_t *root_node = new_test_css_node();
3476 css_node_t *node_0 = root_node;
3477 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
3478 node_0->style.justify_content = CSS_JUSTIFY_SPACE_AROUND;
3479 node_0->style.dimensions[CSS_HEIGHT] = 200;
3480 init_css_node_children(node_0, 2);
3483 node_1 = node_0->get_child(node_0->context, 0);
3484 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
3485 node_1 = node_0->get_child(node_0->context, 1);
3489 css_node_t *root_layout = new_test_css_node();
3491 css_node_t *node_0 = root_layout;
3492 node_0->layout.position[CSS_TOP] = 0;
3493 node_0->layout.position[CSS_LEFT] = 0;
3494 node_0->layout.dimensions[CSS_WIDTH] = 0;
3495 node_0->layout.dimensions[CSS_HEIGHT] = 200;
3496 init_css_node_children(node_0, 2);
3499 node_1 = node_0->get_child(node_0->context, 0);
3500 node_1->layout.position[CSS_TOP] = 100;
3501 node_1->layout.position[CSS_LEFT] = 0;
3502 node_1->layout.dimensions[CSS_WIDTH] = 0;
3503 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3504 node_1 = node_0->get_child(node_0->context, 1);
3505 node_1->layout.position[CSS_TOP] = 100;
3506 node_1->layout.position[CSS_LEFT] = 0;
3507 node_1->layout.dimensions[CSS_WIDTH] = 0;
3508 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3512 test("should layout node with space-around and child position absolute in reverse", root_node, root_layout);
3516 css_node_t *root_node = new_test_css_node();
3518 css_node_t *node_0 = root_node;
3519 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
3520 node_0->style.dimensions[CSS_WIDTH] = 700;
3521 init_css_node_children(node_0, 1);
3524 node_1 = node_0->get_child(node_0->context, 0);
3525 node_1->style.flex = 1;
3526 node_1->style.margin[CSS_LEFT] = 5;
3530 css_node_t *root_layout = new_test_css_node();
3532 css_node_t *node_0 = root_layout;
3533 node_0->layout.position[CSS_TOP] = 0;
3534 node_0->layout.position[CSS_LEFT] = 0;
3535 node_0->layout.dimensions[CSS_WIDTH] = 700;
3536 node_0->layout.dimensions[CSS_HEIGHT] = 0;
3537 init_css_node_children(node_0, 1);
3540 node_1 = node_0->get_child(node_0->context, 0);
3541 node_1->layout.position[CSS_TOP] = 0;
3542 node_1->layout.position[CSS_LEFT] = 5;
3543 node_1->layout.dimensions[CSS_WIDTH] = 695;
3544 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3548 test("should layout node with flex and main margin", root_node, root_layout);
3552 css_node_t *root_node = new_test_css_node();
3554 css_node_t *node_0 = root_node;
3555 node_0->style.direction = CSS_DIRECTION_RTL;
3556 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
3557 node_0->style.dimensions[CSS_WIDTH] = 700;
3558 init_css_node_children(node_0, 1);
3561 node_1 = node_0->get_child(node_0->context, 0);
3562 node_1->style.flex = 1;
3563 node_1->style.margin[CSS_RIGHT] = 5;
3567 css_node_t *root_layout = new_test_css_node();
3569 css_node_t *node_0 = root_layout;
3570 node_0->layout.position[CSS_TOP] = 0;
3571 node_0->layout.position[CSS_LEFT] = 0;
3572 node_0->layout.dimensions[CSS_WIDTH] = 700;
3573 node_0->layout.dimensions[CSS_HEIGHT] = 0;
3574 init_css_node_children(node_0, 1);
3577 node_1 = node_0->get_child(node_0->context, 0);
3578 node_1->layout.position[CSS_TOP] = 0;
3579 node_1->layout.position[CSS_LEFT] = 0;
3580 node_1->layout.dimensions[CSS_WIDTH] = 695;
3581 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3585 test("should layout node with flex and main margin in rtl", root_node, root_layout);
3589 css_node_t *root_node = new_test_css_node();
3591 css_node_t *node_0 = root_node;
3592 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
3593 node_0->style.dimensions[CSS_WIDTH] = 700;
3594 init_css_node_children(node_0, 2);
3597 node_1 = node_0->get_child(node_0->context, 0);
3598 node_1->style.flex = 1;
3599 node_1 = node_0->get_child(node_0->context, 1);
3600 node_1->style.flex = 1;
3601 node_1->style.padding[CSS_RIGHT] = 5;
3605 css_node_t *root_layout = new_test_css_node();
3607 css_node_t *node_0 = root_layout;
3608 node_0->layout.position[CSS_TOP] = 0;
3609 node_0->layout.position[CSS_LEFT] = 0;
3610 node_0->layout.dimensions[CSS_WIDTH] = 700;
3611 node_0->layout.dimensions[CSS_HEIGHT] = 0;
3612 init_css_node_children(node_0, 2);
3615 node_1 = node_0->get_child(node_0->context, 0);
3616 node_1->layout.position[CSS_TOP] = 0;
3617 node_1->layout.position[CSS_LEFT] = 0;
3618 node_1->layout.dimensions[CSS_WIDTH] = 347.5;
3619 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3620 node_1 = node_0->get_child(node_0->context, 1);
3621 node_1->layout.position[CSS_TOP] = 0;
3622 node_1->layout.position[CSS_LEFT] = 347.5;
3623 node_1->layout.dimensions[CSS_WIDTH] = 352.5;
3624 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3628 test("should layout node with multiple flex and padding", root_node, root_layout);
3632 css_node_t *root_node = new_test_css_node();
3634 css_node_t *node_0 = root_node;
3635 node_0->style.direction = CSS_DIRECTION_RTL;
3636 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
3637 node_0->style.dimensions[CSS_WIDTH] = 700;
3638 init_css_node_children(node_0, 2);
3641 node_1 = node_0->get_child(node_0->context, 0);
3642 node_1->style.flex = 1;
3643 node_1 = node_0->get_child(node_0->context, 1);
3644 node_1->style.flex = 1;
3645 node_1->style.padding[CSS_LEFT] = 5;
3649 css_node_t *root_layout = new_test_css_node();
3651 css_node_t *node_0 = root_layout;
3652 node_0->layout.position[CSS_TOP] = 0;
3653 node_0->layout.position[CSS_LEFT] = 0;
3654 node_0->layout.dimensions[CSS_WIDTH] = 700;
3655 node_0->layout.dimensions[CSS_HEIGHT] = 0;
3656 init_css_node_children(node_0, 2);
3659 node_1 = node_0->get_child(node_0->context, 0);
3660 node_1->layout.position[CSS_TOP] = 0;
3661 node_1->layout.position[CSS_LEFT] = 352.5;
3662 node_1->layout.dimensions[CSS_WIDTH] = 347.5;
3663 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3664 node_1 = node_0->get_child(node_0->context, 1);
3665 node_1->layout.position[CSS_TOP] = 0;
3666 node_1->layout.position[CSS_LEFT] = 0;
3667 node_1->layout.dimensions[CSS_WIDTH] = 352.5;
3668 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3672 test("should layout node with multiple flex and padding in rtl", root_node, root_layout);
3676 css_node_t *root_node = new_test_css_node();
3678 css_node_t *node_0 = root_node;
3679 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
3680 node_0->style.dimensions[CSS_WIDTH] = 700;
3681 init_css_node_children(node_0, 2);
3684 node_1 = node_0->get_child(node_0->context, 0);
3685 node_1->style.flex = 1;
3686 node_1 = node_0->get_child(node_0->context, 1);
3687 node_1->style.flex = 1;
3688 node_1->style.margin[CSS_LEFT] = 5;
3692 css_node_t *root_layout = new_test_css_node();
3694 css_node_t *node_0 = root_layout;
3695 node_0->layout.position[CSS_TOP] = 0;
3696 node_0->layout.position[CSS_LEFT] = 0;
3697 node_0->layout.dimensions[CSS_WIDTH] = 700;
3698 node_0->layout.dimensions[CSS_HEIGHT] = 0;
3699 init_css_node_children(node_0, 2);
3702 node_1 = node_0->get_child(node_0->context, 0);
3703 node_1->layout.position[CSS_TOP] = 0;
3704 node_1->layout.position[CSS_LEFT] = 0;
3705 node_1->layout.dimensions[CSS_WIDTH] = 347.5;
3706 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3707 node_1 = node_0->get_child(node_0->context, 1);
3708 node_1->layout.position[CSS_TOP] = 0;
3709 node_1->layout.position[CSS_LEFT] = 352.5;
3710 node_1->layout.dimensions[CSS_WIDTH] = 347.5;
3711 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3715 test("should layout node with multiple flex and margin", root_node, root_layout);
3719 css_node_t *root_node = new_test_css_node();
3721 css_node_t *node_0 = root_node;
3722 node_0->style.direction = CSS_DIRECTION_RTL;
3723 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
3724 node_0->style.dimensions[CSS_WIDTH] = 700;
3725 init_css_node_children(node_0, 2);
3728 node_1 = node_0->get_child(node_0->context, 0);
3729 node_1->style.flex = 1;
3730 node_1 = node_0->get_child(node_0->context, 1);
3731 node_1->style.flex = 1;
3732 node_1->style.margin[CSS_RIGHT] = 5;
3736 css_node_t *root_layout = new_test_css_node();
3738 css_node_t *node_0 = root_layout;
3739 node_0->layout.position[CSS_TOP] = 0;
3740 node_0->layout.position[CSS_LEFT] = 0;
3741 node_0->layout.dimensions[CSS_WIDTH] = 700;
3742 node_0->layout.dimensions[CSS_HEIGHT] = 0;
3743 init_css_node_children(node_0, 2);
3746 node_1 = node_0->get_child(node_0->context, 0);
3747 node_1->layout.position[CSS_TOP] = 0;
3748 node_1->layout.position[CSS_LEFT] = 352.5;
3749 node_1->layout.dimensions[CSS_WIDTH] = 347.5;
3750 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3751 node_1 = node_0->get_child(node_0->context, 1);
3752 node_1->layout.position[CSS_TOP] = 0;
3753 node_1->layout.position[CSS_LEFT] = 0;
3754 node_1->layout.dimensions[CSS_WIDTH] = 347.5;
3755 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3759 test("should layout node with multiple flex and margin in rtl", root_node, root_layout);
3763 css_node_t *root_node = new_test_css_node();
3765 css_node_t *node_0 = root_node;
3766 node_0->style.dimensions[CSS_HEIGHT] = 300;
3767 init_css_node_children(node_0, 2);
3770 node_1 = node_0->get_child(node_0->context, 0);
3771 node_1->style.dimensions[CSS_HEIGHT] = 600;
3772 node_1 = node_0->get_child(node_0->context, 1);
3773 node_1->style.flex = 1;
3777 css_node_t *root_layout = new_test_css_node();
3779 css_node_t *node_0 = root_layout;
3780 node_0->layout.position[CSS_TOP] = 0;
3781 node_0->layout.position[CSS_LEFT] = 0;
3782 node_0->layout.dimensions[CSS_WIDTH] = 0;
3783 node_0->layout.dimensions[CSS_HEIGHT] = 300;
3784 init_css_node_children(node_0, 2);
3787 node_1 = node_0->get_child(node_0->context, 0);
3788 node_1->layout.position[CSS_TOP] = 0;
3789 node_1->layout.position[CSS_LEFT] = 0;
3790 node_1->layout.dimensions[CSS_WIDTH] = 0;
3791 node_1->layout.dimensions[CSS_HEIGHT] = 600;
3792 node_1 = node_0->get_child(node_0->context, 1);
3793 node_1->layout.position[CSS_TOP] = 600;
3794 node_1->layout.position[CSS_LEFT] = 0;
3795 node_1->layout.dimensions[CSS_WIDTH] = 0;
3796 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3800 test("should layout node with flex and overflow", root_node, root_layout);
3804 css_node_t *root_node = new_test_css_node();
3806 css_node_t *node_0 = root_node;
3807 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
3808 node_0->style.dimensions[CSS_WIDTH] = 600;
3809 init_css_node_children(node_0, 1);
3812 node_1 = node_0->get_child(node_0->context, 0);
3813 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
3814 node_1->style.flex = 1;
3818 css_node_t *root_layout = new_test_css_node();
3820 css_node_t *node_0 = root_layout;
3821 node_0->layout.position[CSS_TOP] = 0;
3822 node_0->layout.position[CSS_LEFT] = 0;
3823 node_0->layout.dimensions[CSS_WIDTH] = 600;
3824 node_0->layout.dimensions[CSS_HEIGHT] = 0;
3825 init_css_node_children(node_0, 1);
3828 node_1 = node_0->get_child(node_0->context, 0);
3829 node_1->layout.position[CSS_TOP] = 0;
3830 node_1->layout.position[CSS_LEFT] = 0;
3831 node_1->layout.dimensions[CSS_WIDTH] = 0;
3832 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3836 test("should layout node with flex and position absolute", root_node, root_layout);
3840 css_node_t *root_node = new_test_css_node();
3842 css_node_t *node_0 = root_node;
3843 node_0->style.direction = CSS_DIRECTION_RTL;
3844 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
3845 node_0->style.dimensions[CSS_WIDTH] = 600;
3846 init_css_node_children(node_0, 1);
3849 node_1 = node_0->get_child(node_0->context, 0);
3850 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
3851 node_1->style.flex = 1;
3855 css_node_t *root_layout = new_test_css_node();
3857 css_node_t *node_0 = root_layout;
3858 node_0->layout.position[CSS_TOP] = 0;
3859 node_0->layout.position[CSS_LEFT] = 0;
3860 node_0->layout.dimensions[CSS_WIDTH] = 600;
3861 node_0->layout.dimensions[CSS_HEIGHT] = 0;
3862 init_css_node_children(node_0, 1);
3865 node_1 = node_0->get_child(node_0->context, 0);
3866 node_1->layout.position[CSS_TOP] = 0;
3867 node_1->layout.position[CSS_LEFT] = 600;
3868 node_1->layout.dimensions[CSS_WIDTH] = 0;
3869 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3873 test("should layout node with flex and position absolute in rtl", root_node, root_layout);
3877 css_node_t *root_node = new_test_css_node();
3879 css_node_t *node_0 = root_node;
3880 node_0->style.dimensions[CSS_HEIGHT] = 500;
3881 init_css_node_children(node_0, 2);
3884 node_1 = node_0->get_child(node_0->context, 0);
3885 node_1->style.flex = 1;
3886 node_1 = node_0->get_child(node_0->context, 1);
3887 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
3888 node_1->style.flex = 1;
3892 css_node_t *root_layout = new_test_css_node();
3894 css_node_t *node_0 = root_layout;
3895 node_0->layout.position[CSS_TOP] = 0;
3896 node_0->layout.position[CSS_LEFT] = 0;
3897 node_0->layout.dimensions[CSS_WIDTH] = 0;
3898 node_0->layout.dimensions[CSS_HEIGHT] = 500;
3899 init_css_node_children(node_0, 2);
3902 node_1 = node_0->get_child(node_0->context, 0);
3903 node_1->layout.position[CSS_TOP] = 0;
3904 node_1->layout.position[CSS_LEFT] = 0;
3905 node_1->layout.dimensions[CSS_WIDTH] = 0;
3906 node_1->layout.dimensions[CSS_HEIGHT] = 500;
3907 node_1 = node_0->get_child(node_0->context, 1);
3908 node_1->layout.position[CSS_TOP] = 500;
3909 node_1->layout.position[CSS_LEFT] = 0;
3910 node_1->layout.dimensions[CSS_WIDTH] = 0;
3911 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3915 test("should layout node with double flex and position absolute", root_node, root_layout);
3919 css_node_t *root_node = new_test_css_node();
3921 css_node_t *node_0 = root_node;
3922 node_0->style.border[CSS_LEFT] = 5;
3923 node_0->style.border[CSS_TOP] = 5;
3924 node_0->style.border[CSS_RIGHT] = 5;
3925 node_0->style.border[CSS_BOTTOM] = 5;
3926 node_0->style.border[CSS_START] = 5;
3927 node_0->style.border[CSS_END] = 5;
3930 css_node_t *root_layout = new_test_css_node();
3932 css_node_t *node_0 = root_layout;
3933 node_0->layout.position[CSS_TOP] = 0;
3934 node_0->layout.position[CSS_LEFT] = 0;
3935 node_0->layout.dimensions[CSS_WIDTH] = 10;
3936 node_0->layout.dimensions[CSS_HEIGHT] = 10;
3939 test("should layout node with borderWidth", root_node, root_layout);
3943 css_node_t *root_node = new_test_css_node();
3945 css_node_t *node_0 = root_node;
3946 node_0->style.border[CSS_TOP] = 1;
3947 init_css_node_children(node_0, 1);
3950 node_1 = node_0->get_child(node_0->context, 0);
3951 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
3952 node_1->style.position[CSS_TOP] = -1;
3956 css_node_t *root_layout = new_test_css_node();
3958 css_node_t *node_0 = root_layout;
3959 node_0->layout.position[CSS_TOP] = 0;
3960 node_0->layout.position[CSS_LEFT] = 0;
3961 node_0->layout.dimensions[CSS_WIDTH] = 0;
3962 node_0->layout.dimensions[CSS_HEIGHT] = 1;
3963 init_css_node_children(node_0, 1);
3966 node_1 = node_0->get_child(node_0->context, 0);
3967 node_1->layout.position[CSS_TOP] = 0;
3968 node_1->layout.position[CSS_LEFT] = 0;
3969 node_1->layout.dimensions[CSS_WIDTH] = 0;
3970 node_1->layout.dimensions[CSS_HEIGHT] = 0;
3974 test("should layout node with borderWidth and position: absolute, top", root_node, root_layout);
3978 css_node_t *root_node = new_test_css_node();
3980 css_node_t *node_0 = root_node;
3981 node_0->style.border[CSS_LEFT] = 1;
3982 node_0->style.border[CSS_TOP] = 1;
3983 node_0->style.border[CSS_RIGHT] = 1;
3984 node_0->style.border[CSS_BOTTOM] = 1;
3985 node_0->style.border[CSS_START] = 1;
3986 node_0->style.border[CSS_END] = 1;
3987 init_css_node_children(node_0, 1);
3990 node_1 = node_0->get_child(node_0->context, 0);
3991 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
3992 node_1->style.position[CSS_LEFT] = 5;
3996 css_node_t *root_layout = new_test_css_node();
3998 css_node_t *node_0 = root_layout;
3999 node_0->layout.position[CSS_TOP] = 0;
4000 node_0->layout.position[CSS_LEFT] = 0;
4001 node_0->layout.dimensions[CSS_WIDTH] = 2;
4002 node_0->layout.dimensions[CSS_HEIGHT] = 2;
4003 init_css_node_children(node_0, 1);
4006 node_1 = node_0->get_child(node_0->context, 0);
4007 node_1->layout.position[CSS_TOP] = 1;
4008 node_1->layout.position[CSS_LEFT] = 6;
4009 node_1->layout.dimensions[CSS_WIDTH] = 0;
4010 node_1->layout.dimensions[CSS_HEIGHT] = 0;
4014 test("should layout node with borderWidth and position: absolute, top. cross axis", root_node, root_layout);
4018 css_node_t *root_node = new_test_css_node();
4020 css_node_t *node_0 = root_node;
4021 node_0->style.dimensions[CSS_WIDTH] = 50;
4022 init_css_node_children(node_0, 1);
4025 node_1 = node_0->get_child(node_0->context, 0);
4026 node_1->style.align_self = CSS_ALIGN_STRETCH;
4027 node_1->style.margin[CSS_LEFT] = 20;
4028 node_1->style.padding[CSS_LEFT] = 20;
4029 node_1->style.padding[CSS_TOP] = 20;
4030 node_1->style.padding[CSS_RIGHT] = 20;
4031 node_1->style.padding[CSS_BOTTOM] = 20;
4032 node_1->style.padding[CSS_START] = 20;
4033 node_1->style.padding[CSS_END] = 20;
4037 css_node_t *root_layout = new_test_css_node();
4039 css_node_t *node_0 = root_layout;
4040 node_0->layout.position[CSS_TOP] = 0;
4041 node_0->layout.position[CSS_LEFT] = 0;
4042 node_0->layout.dimensions[CSS_WIDTH] = 50;
4043 node_0->layout.dimensions[CSS_HEIGHT] = 40;
4044 init_css_node_children(node_0, 1);
4047 node_1 = node_0->get_child(node_0->context, 0);
4048 node_1->layout.position[CSS_TOP] = 0;
4049 node_1->layout.position[CSS_LEFT] = 20;
4050 node_1->layout.dimensions[CSS_WIDTH] = 40;
4051 node_1->layout.dimensions[CSS_HEIGHT] = 40;
4055 test("should correctly take into account min padding for stretch", root_node, root_layout);
4059 css_node_t *root_node = new_test_css_node();
4061 css_node_t *node_0 = root_node;
4062 node_0->style.dimensions[CSS_WIDTH] = -31;
4063 init_css_node_children(node_0, 1);
4066 node_1 = node_0->get_child(node_0->context, 0);
4067 node_1->style.border[CSS_RIGHT] = 5;
4071 css_node_t *root_layout = new_test_css_node();
4073 css_node_t *node_0 = root_layout;
4074 node_0->layout.position[CSS_TOP] = 0;
4075 node_0->layout.position[CSS_LEFT] = 0;
4076 node_0->layout.dimensions[CSS_WIDTH] = 5;
4077 node_0->layout.dimensions[CSS_HEIGHT] = 0;
4078 init_css_node_children(node_0, 1);
4081 node_1 = node_0->get_child(node_0->context, 0);
4082 node_1->layout.position[CSS_TOP] = 0;
4083 node_1->layout.position[CSS_LEFT] = 0;
4084 node_1->layout.dimensions[CSS_WIDTH] = 5;
4085 node_1->layout.dimensions[CSS_HEIGHT] = 0;
4089 test("should layout node with negative width", root_node, root_layout);
4093 css_node_t *root_node = new_test_css_node();
4095 css_node_t *node_0 = root_node;
4096 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
4097 node_0->style.border[CSS_RIGHT] = 1;
4098 init_css_node_children(node_0, 1);
4101 node_1 = node_0->get_child(node_0->context, 0);
4102 node_1->style.margin[CSS_RIGHT] = -8;
4106 css_node_t *root_layout = new_test_css_node();
4108 css_node_t *node_0 = root_layout;
4109 node_0->layout.position[CSS_TOP] = 0;
4110 node_0->layout.position[CSS_LEFT] = 0;
4111 node_0->layout.dimensions[CSS_WIDTH] = 1;
4112 node_0->layout.dimensions[CSS_HEIGHT] = 0;
4113 init_css_node_children(node_0, 1);
4116 node_1 = node_0->get_child(node_0->context, 0);
4117 node_1->layout.position[CSS_TOP] = 0;
4118 node_1->layout.position[CSS_LEFT] = 0;
4119 node_1->layout.dimensions[CSS_WIDTH] = 0;
4120 node_1->layout.dimensions[CSS_HEIGHT] = 0;
4124 test("should handle negative margin and min padding correctly", root_node, root_layout);
4128 css_node_t *root_node = new_test_css_node();
4130 css_node_t *node_0 = root_node;
4131 node_0->style.direction = CSS_DIRECTION_RTL;
4132 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
4133 node_0->style.border[CSS_LEFT] = 1;
4134 init_css_node_children(node_0, 1);
4137 node_1 = node_0->get_child(node_0->context, 0);
4138 node_1->style.margin[CSS_LEFT] = -8;
4142 css_node_t *root_layout = new_test_css_node();
4144 css_node_t *node_0 = root_layout;
4145 node_0->layout.position[CSS_TOP] = 0;
4146 node_0->layout.position[CSS_LEFT] = 0;
4147 node_0->layout.dimensions[CSS_WIDTH] = 1;
4148 node_0->layout.dimensions[CSS_HEIGHT] = 0;
4149 init_css_node_children(node_0, 1);
4152 node_1 = node_0->get_child(node_0->context, 0);
4153 node_1->layout.position[CSS_TOP] = 0;
4154 node_1->layout.position[CSS_LEFT] = 1;
4155 node_1->layout.dimensions[CSS_WIDTH] = 0;
4156 node_1->layout.dimensions[CSS_HEIGHT] = 0;
4160 test("should handle negative margin and min padding correctly in rtl", root_node, root_layout);
4164 css_node_t *root_node = new_test_css_node();
4166 css_node_t *node_0 = root_node;
4167 node_0->measure = measure;
4168 node_0->context = "small";
4171 css_node_t *root_layout = new_test_css_node();
4173 css_node_t *node_0 = root_layout;
4174 node_0->layout.position[CSS_TOP] = 0;
4175 node_0->layout.position[CSS_LEFT] = 0;
4176 node_0->layout.dimensions[CSS_WIDTH] = 35;
4177 node_0->layout.dimensions[CSS_HEIGHT] = 18;
4180 test("should layout node with just text", root_node, root_layout);
4184 css_node_t *root_node = new_test_css_node();
4186 css_node_t *node_0 = root_node;
4187 node_0->style.dimensions[CSS_WIDTH] = 100;
4188 node_0->measure = measure;
4189 node_0->context = "measureWithRatio2";
4192 css_node_t *root_layout = new_test_css_node();
4194 css_node_t *node_0 = root_layout;
4195 node_0->layout.position[CSS_TOP] = 0;
4196 node_0->layout.position[CSS_LEFT] = 0;
4197 node_0->layout.dimensions[CSS_WIDTH] = 100;
4198 node_0->layout.dimensions[CSS_HEIGHT] = 200;
4201 test("should layout node with fixed width and custom measure function", root_node, root_layout);
4205 css_node_t *root_node = new_test_css_node();
4207 css_node_t *node_0 = root_node;
4208 node_0->style.dimensions[CSS_HEIGHT] = 100;
4209 node_0->measure = measure;
4210 node_0->context = "measureWithRatio2";
4213 css_node_t *root_layout = new_test_css_node();
4215 css_node_t *node_0 = root_layout;
4216 node_0->layout.position[CSS_TOP] = 0;
4217 node_0->layout.position[CSS_LEFT] = 0;
4218 node_0->layout.dimensions[CSS_WIDTH] = 200;
4219 node_0->layout.dimensions[CSS_HEIGHT] = 100;
4222 test("should layout node with fixed height and custom measure function", root_node, root_layout);
4226 css_node_t *root_node = new_test_css_node();
4228 css_node_t *node_0 = root_node;
4229 node_0->style.dimensions[CSS_WIDTH] = 100;
4230 node_0->style.dimensions[CSS_HEIGHT] = 100;
4231 node_0->measure = measure;
4232 node_0->context = "measureWithRatio2";
4235 css_node_t *root_layout = new_test_css_node();
4237 css_node_t *node_0 = root_layout;
4238 node_0->layout.position[CSS_TOP] = 0;
4239 node_0->layout.position[CSS_LEFT] = 0;
4240 node_0->layout.dimensions[CSS_WIDTH] = 100;
4241 node_0->layout.dimensions[CSS_HEIGHT] = 100;
4244 test("should layout node with fixed height and fixed width, ignoring custom measure function", root_node, root_layout);
4248 css_node_t *root_node = new_test_css_node();
4250 css_node_t *node_0 = root_node;
4251 node_0->measure = measure;
4252 node_0->context = "measureWithRatio2";
4255 css_node_t *root_layout = new_test_css_node();
4257 css_node_t *node_0 = root_layout;
4258 node_0->layout.position[CSS_TOP] = 0;
4259 node_0->layout.position[CSS_LEFT] = 0;
4260 node_0->layout.dimensions[CSS_WIDTH] = 99999;
4261 node_0->layout.dimensions[CSS_HEIGHT] = 99999;
4264 test("should layout node with no fixed dimension and custom measure function", root_node, root_layout);
4268 css_node_t *root_node = new_test_css_node();
4270 css_node_t *node_0 = root_node;
4271 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN;
4272 node_0->style.dimensions[CSS_WIDTH] = 320;
4273 init_css_node_children(node_0, 2);
4276 node_1 = node_0->get_child(node_0->context, 0);
4277 node_1->measure = measure;
4278 node_1->context = "measureWithRatio2";
4279 node_1 = node_0->get_child(node_0->context, 1);
4280 node_1->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
4281 node_1->style.dimensions[CSS_HEIGHT] = 100;
4282 init_css_node_children(node_1, 2);
4285 node_2 = node_1->get_child(node_1->context, 0);
4286 node_2->measure = measure;
4287 node_2->context = "measureWithRatio2";
4288 node_2 = node_1->get_child(node_1->context, 1);
4289 node_2->measure = measure;
4290 node_2->context = "measureWithRatio2";
4295 css_node_t *root_layout = new_test_css_node();
4297 css_node_t *node_0 = root_layout;
4298 node_0->layout.position[CSS_TOP] = 0;
4299 node_0->layout.position[CSS_LEFT] = 0;
4300 node_0->layout.dimensions[CSS_WIDTH] = 320;
4301 node_0->layout.dimensions[CSS_HEIGHT] = 740;
4302 init_css_node_children(node_0, 2);
4305 node_1 = node_0->get_child(node_0->context, 0);
4306 node_1->layout.position[CSS_TOP] = 0;
4307 node_1->layout.position[CSS_LEFT] = 0;
4308 node_1->layout.dimensions[CSS_WIDTH] = 320;
4309 node_1->layout.dimensions[CSS_HEIGHT] = 640;
4310 node_1 = node_0->get_child(node_0->context, 1);
4311 node_1->layout.position[CSS_TOP] = 640;
4312 node_1->layout.position[CSS_LEFT] = 0;
4313 node_1->layout.dimensions[CSS_WIDTH] = 320;
4314 node_1->layout.dimensions[CSS_HEIGHT] = 100;
4315 init_css_node_children(node_1, 2);
4318 node_2 = node_1->get_child(node_1->context, 0);
4319 node_2->layout.position[CSS_TOP] = 0;
4320 node_2->layout.position[CSS_LEFT] = 0;
4321 node_2->layout.dimensions[CSS_WIDTH] = 200;
4322 node_2->layout.dimensions[CSS_HEIGHT] = 100;
4323 node_2 = node_1->get_child(node_1->context, 1);
4324 node_2->layout.position[CSS_TOP] = 0;
4325 node_2->layout.position[CSS_LEFT] = 200;
4326 node_2->layout.dimensions[CSS_WIDTH] = 200;
4327 node_2->layout.dimensions[CSS_HEIGHT] = 100;
4332 test("should layout node with nested stacks and custom measure function", root_node, root_layout);
4336 css_node_t *root_node = new_test_css_node();
4338 css_node_t *node_0 = root_node;
4339 node_0->style.dimensions[CSS_WIDTH] = 10;
4340 node_0->measure = measure;
4341 node_0->context = "small";
4344 css_node_t *root_layout = new_test_css_node();
4346 css_node_t *node_0 = root_layout;
4347 node_0->layout.position[CSS_TOP] = 0;
4348 node_0->layout.position[CSS_LEFT] = 0;
4349 node_0->layout.dimensions[CSS_WIDTH] = 10;
4350 node_0->layout.dimensions[CSS_HEIGHT] = 18;
4353 test("should layout node with text and width", root_node, root_layout);
4357 css_node_t *root_node = new_test_css_node();
4359 css_node_t *node_0 = root_node;
4360 node_0->measure = measure;
4361 node_0->context = "loooooooooong with space";
4364 css_node_t *root_layout = new_test_css_node();
4366 css_node_t *node_0 = root_layout;
4367 node_0->layout.position[CSS_TOP] = 0;
4368 node_0->layout.position[CSS_LEFT] = 0;
4369 node_0->layout.dimensions[CSS_WIDTH] = 172;
4370 node_0->layout.dimensions[CSS_HEIGHT] = 18;
4373 test("should layout node with text, padding and margin", root_node, root_layout);
4377 css_node_t *root_node = new_test_css_node();
4379 css_node_t *node_0 = root_node;
4380 node_0->style.dimensions[CSS_WIDTH] = 300;
4381 init_css_node_children(node_0, 1);
4384 node_1 = node_0->get_child(node_0->context, 0);
4385 node_1->style.align_self = CSS_ALIGN_STRETCH;
4386 init_css_node_children(node_1, 1);
4389 node_2 = node_1->get_child(node_1->context, 0);
4390 node_2->style.align_self = CSS_ALIGN_STRETCH;
4395 css_node_t *root_layout = new_test_css_node();
4397 css_node_t *node_0 = root_layout;
4398 node_0->layout.position[CSS_TOP] = 0;
4399 node_0->layout.position[CSS_LEFT] = 0;
4400 node_0->layout.dimensions[CSS_WIDTH] = 300;
4401 node_0->layout.dimensions[CSS_HEIGHT] = 0;
4402 init_css_node_children(node_0, 1);
4405 node_1 = node_0->get_child(node_0->context, 0);
4406 node_1->layout.position[CSS_TOP] = 0;
4407 node_1->layout.position[CSS_LEFT] = 0;
4408 node_1->layout.dimensions[CSS_WIDTH] = 300;
4409 node_1->layout.dimensions[CSS_HEIGHT] = 0;
4410 init_css_node_children(node_1, 1);
4413 node_2 = node_1->get_child(node_1->context, 0);
4414 node_2->layout.position[CSS_TOP] = 0;
4415 node_2->layout.position[CSS_LEFT] = 0;
4416 node_2->layout.dimensions[CSS_WIDTH] = 300;
4417 node_2->layout.dimensions[CSS_HEIGHT] = 0;
4422 test("should layout node with nested alignSelf: stretch", root_node, root_layout);
4426 css_node_t *root_node = new_test_css_node();
4428 css_node_t *node_0 = root_node;
4429 init_css_node_children(node_0, 1);
4432 node_1 = node_0->get_child(node_0->context, 0);
4433 node_1->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
4434 node_1->style.dimensions[CSS_WIDTH] = 500;
4435 init_css_node_children(node_1, 1);
4438 node_2 = node_1->get_child(node_1->context, 0);
4439 node_2->style.flex = 1;
4440 node_2->measure = measure;
4441 node_2->context = "loooooooooong with space";
4446 css_node_t *root_layout = new_test_css_node();
4448 css_node_t *node_0 = root_layout;
4449 node_0->layout.position[CSS_TOP] = 0;
4450 node_0->layout.position[CSS_LEFT] = 0;
4451 node_0->layout.dimensions[CSS_WIDTH] = 500;
4452 node_0->layout.dimensions[CSS_HEIGHT] = 18;
4453 init_css_node_children(node_0, 1);
4456 node_1 = node_0->get_child(node_0->context, 0);
4457 node_1->layout.position[CSS_TOP] = 0;
4458 node_1->layout.position[CSS_LEFT] = 0;
4459 node_1->layout.dimensions[CSS_WIDTH] = 500;
4460 node_1->layout.dimensions[CSS_HEIGHT] = 18;
4461 init_css_node_children(node_1, 1);
4464 node_2 = node_1->get_child(node_1->context, 0);
4465 node_2->layout.position[CSS_TOP] = 0;
4466 node_2->layout.position[CSS_LEFT] = 0;
4467 node_2->layout.dimensions[CSS_WIDTH] = 500;
4468 node_2->layout.dimensions[CSS_HEIGHT] = 18;
4473 test("should layout node with text and flex", root_node, root_layout);
4477 css_node_t *root_node = new_test_css_node();
4479 css_node_t *node_0 = root_node;
4480 init_css_node_children(node_0, 1);
4483 node_1 = node_0->get_child(node_0->context, 0);
4484 node_1->style.direction = CSS_DIRECTION_RTL;
4485 node_1->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
4486 node_1->style.dimensions[CSS_WIDTH] = 500;
4487 init_css_node_children(node_1, 1);
4490 node_2 = node_1->get_child(node_1->context, 0);
4491 node_2->style.flex = 1;
4492 node_2->measure = measure;
4493 node_2->context = "loooooooooong with space";
4498 css_node_t *root_layout = new_test_css_node();
4500 css_node_t *node_0 = root_layout;
4501 node_0->layout.position[CSS_TOP] = 0;
4502 node_0->layout.position[CSS_LEFT] = 0;
4503 node_0->layout.dimensions[CSS_WIDTH] = 500;
4504 node_0->layout.dimensions[CSS_HEIGHT] = 18;
4505 init_css_node_children(node_0, 1);
4508 node_1 = node_0->get_child(node_0->context, 0);
4509 node_1->layout.position[CSS_TOP] = 0;
4510 node_1->layout.position[CSS_LEFT] = 0;
4511 node_1->layout.dimensions[CSS_WIDTH] = 500;
4512 node_1->layout.dimensions[CSS_HEIGHT] = 18;
4513 init_css_node_children(node_1, 1);
4516 node_2 = node_1->get_child(node_1->context, 0);
4517 node_2->layout.position[CSS_TOP] = 0;
4518 node_2->layout.position[CSS_LEFT] = 0;
4519 node_2->layout.dimensions[CSS_WIDTH] = 500;
4520 node_2->layout.dimensions[CSS_HEIGHT] = 18;
4525 test("should layout node with text and flex in rtl", root_node, root_layout);
4529 css_node_t *root_node = new_test_css_node();
4531 css_node_t *node_0 = root_node;
4532 node_0->style.dimensions[CSS_WIDTH] = 130;
4533 init_css_node_children(node_0, 1);
4536 node_1 = node_0->get_child(node_0->context, 0);
4537 node_1->style.align_items = CSS_ALIGN_STRETCH;
4538 node_1->style.align_self = CSS_ALIGN_STRETCH;
4539 init_css_node_children(node_1, 1);
4542 node_2 = node_1->get_child(node_1->context, 0);
4543 node_2->measure = measure;
4544 node_2->context = "loooooooooong with space";
4549 css_node_t *root_layout = new_test_css_node();
4551 css_node_t *node_0 = root_layout;
4552 node_0->layout.position[CSS_TOP] = 0;
4553 node_0->layout.position[CSS_LEFT] = 0;
4554 node_0->layout.dimensions[CSS_WIDTH] = 130;
4555 node_0->layout.dimensions[CSS_HEIGHT] = 36;
4556 init_css_node_children(node_0, 1);
4559 node_1 = node_0->get_child(node_0->context, 0);
4560 node_1->layout.position[CSS_TOP] = 0;
4561 node_1->layout.position[CSS_LEFT] = 0;
4562 node_1->layout.dimensions[CSS_WIDTH] = 130;
4563 node_1->layout.dimensions[CSS_HEIGHT] = 36;
4564 init_css_node_children(node_1, 1);
4567 node_2 = node_1->get_child(node_1->context, 0);
4568 node_2->layout.position[CSS_TOP] = 0;
4569 node_2->layout.position[CSS_LEFT] = 0;
4570 node_2->layout.dimensions[CSS_WIDTH] = 130;
4571 node_2->layout.dimensions[CSS_HEIGHT] = 36;
4576 test("should layout node with text and stretch", root_node, root_layout);
4580 css_node_t *root_node = new_test_css_node();
4582 css_node_t *node_0 = root_node;
4583 node_0->style.dimensions[CSS_WIDTH] = 200;
4584 init_css_node_children(node_0, 1);
4587 node_1 = node_0->get_child(node_0->context, 0);
4588 node_1->style.align_items = CSS_ALIGN_STRETCH;
4589 node_1->style.align_self = CSS_ALIGN_STRETCH;
4590 init_css_node_children(node_1, 1);
4593 node_2 = node_1->get_child(node_1->context, 0);
4594 node_2->style.dimensions[CSS_WIDTH] = 130;
4595 node_2->measure = measure;
4596 node_2->context = "loooooooooong with space";
4601 css_node_t *root_layout = new_test_css_node();
4603 css_node_t *node_0 = root_layout;
4604 node_0->layout.position[CSS_TOP] = 0;
4605 node_0->layout.position[CSS_LEFT] = 0;
4606 node_0->layout.dimensions[CSS_WIDTH] = 200;
4607 node_0->layout.dimensions[CSS_HEIGHT] = 36;
4608 init_css_node_children(node_0, 1);
4611 node_1 = node_0->get_child(node_0->context, 0);
4612 node_1->layout.position[CSS_TOP] = 0;
4613 node_1->layout.position[CSS_LEFT] = 0;
4614 node_1->layout.dimensions[CSS_WIDTH] = 200;
4615 node_1->layout.dimensions[CSS_HEIGHT] = 36;
4616 init_css_node_children(node_1, 1);
4619 node_2 = node_1->get_child(node_1->context, 0);
4620 node_2->layout.position[CSS_TOP] = 0;
4621 node_2->layout.position[CSS_LEFT] = 0;
4622 node_2->layout.dimensions[CSS_WIDTH] = 130;
4623 node_2->layout.dimensions[CSS_HEIGHT] = 36;
4628 test("should layout node with text stretch and width", root_node, root_layout);
4632 css_node_t *root_node = new_test_css_node();
4634 css_node_t *node_0 = root_node;
4635 node_0->style.align_self = CSS_ALIGN_FLEX_START;
4636 node_0->style.dimensions[CSS_WIDTH] = 100;
4637 init_css_node_children(node_0, 1);
4640 node_1 = node_0->get_child(node_0->context, 0);
4641 node_1->style.align_self = CSS_ALIGN_FLEX_START;
4642 node_1->measure = measure;
4643 node_1->context = "loooooooooong with space";
4647 css_node_t *root_layout = new_test_css_node();
4649 css_node_t *node_0 = root_layout;
4650 node_0->layout.position[CSS_TOP] = 0;
4651 node_0->layout.position[CSS_LEFT] = 0;
4652 node_0->layout.dimensions[CSS_WIDTH] = 100;
4653 node_0->layout.dimensions[CSS_HEIGHT] = 36;
4654 init_css_node_children(node_0, 1);
4657 node_1 = node_0->get_child(node_0->context, 0);
4658 node_1->layout.position[CSS_TOP] = 0;
4659 node_1->layout.position[CSS_LEFT] = 0;
4660 node_1->layout.dimensions[CSS_WIDTH] = 100;
4661 node_1->layout.dimensions[CSS_HEIGHT] = 36;
4665 test("should layout node with text bounded by parent", root_node, root_layout);
4669 css_node_t *root_node = new_test_css_node();
4671 css_node_t *node_0 = root_node;
4672 node_0->style.align_self = CSS_ALIGN_FLEX_START;
4673 node_0->style.dimensions[CSS_WIDTH] = 100;
4674 node_0->style.padding[CSS_LEFT] = 10;
4675 node_0->style.padding[CSS_TOP] = 10;
4676 node_0->style.padding[CSS_RIGHT] = 10;
4677 node_0->style.padding[CSS_BOTTOM] = 10;
4678 node_0->style.padding[CSS_START] = 10;
4679 node_0->style.padding[CSS_END] = 10;
4680 init_css_node_children(node_0, 1);
4683 node_1 = node_0->get_child(node_0->context, 0);
4684 node_1->style.align_self = CSS_ALIGN_FLEX_START;
4685 node_1->style.margin[CSS_LEFT] = 10;
4686 node_1->style.margin[CSS_TOP] = 10;
4687 node_1->style.margin[CSS_RIGHT] = 10;
4688 node_1->style.margin[CSS_BOTTOM] = 10;
4689 node_1->style.margin[CSS_START] = 10;
4690 node_1->style.margin[CSS_END] = 10;
4691 init_css_node_children(node_1, 1);
4694 node_2 = node_1->get_child(node_1->context, 0);
4695 node_2->measure = measure;
4696 node_2->context = "loooooooooong with space";
4701 css_node_t *root_layout = new_test_css_node();
4703 css_node_t *node_0 = root_layout;
4704 node_0->layout.position[CSS_TOP] = 0;
4705 node_0->layout.position[CSS_LEFT] = 0;
4706 node_0->layout.dimensions[CSS_WIDTH] = 100;
4707 node_0->layout.dimensions[CSS_HEIGHT] = 76;
4708 init_css_node_children(node_0, 1);
4711 node_1 = node_0->get_child(node_0->context, 0);
4712 node_1->layout.position[CSS_TOP] = 20;
4713 node_1->layout.position[CSS_LEFT] = 20;
4714 node_1->layout.dimensions[CSS_WIDTH] = 100;
4715 node_1->layout.dimensions[CSS_HEIGHT] = 36;
4716 init_css_node_children(node_1, 1);
4719 node_2 = node_1->get_child(node_1->context, 0);
4720 node_2->layout.position[CSS_TOP] = 0;
4721 node_2->layout.position[CSS_LEFT] = 0;
4722 node_2->layout.dimensions[CSS_WIDTH] = 100;
4723 node_2->layout.dimensions[CSS_HEIGHT] = 36;
4728 test("should layout node with text bounded by grand-parent", root_node, root_layout);
4732 css_node_t *root_node = new_test_css_node();
4734 css_node_t *node_0 = root_node;
4735 node_0->style.justify_content = CSS_JUSTIFY_SPACE_BETWEEN;
4736 node_0->style.dimensions[CSS_HEIGHT] = 100;
4737 init_css_node_children(node_0, 2);
4740 node_1 = node_0->get_child(node_0->context, 0);
4741 node_1->style.dimensions[CSS_HEIGHT] = 900;
4742 node_1 = node_0->get_child(node_0->context, 1);
4746 css_node_t *root_layout = new_test_css_node();
4748 css_node_t *node_0 = root_layout;
4749 node_0->layout.position[CSS_TOP] = 0;
4750 node_0->layout.position[CSS_LEFT] = 0;
4751 node_0->layout.dimensions[CSS_WIDTH] = 0;
4752 node_0->layout.dimensions[CSS_HEIGHT] = 100;
4753 init_css_node_children(node_0, 2);
4756 node_1 = node_0->get_child(node_0->context, 0);
4757 node_1->layout.position[CSS_TOP] = 0;
4758 node_1->layout.position[CSS_LEFT] = 0;
4759 node_1->layout.dimensions[CSS_WIDTH] = 0;
4760 node_1->layout.dimensions[CSS_HEIGHT] = 900;
4761 node_1 = node_0->get_child(node_0->context, 1);
4762 node_1->layout.position[CSS_TOP] = 900;
4763 node_1->layout.position[CSS_LEFT] = 0;
4764 node_1->layout.dimensions[CSS_WIDTH] = 0;
4765 node_1->layout.dimensions[CSS_HEIGHT] = 0;
4769 test("should layout space-between when remaining space is negative", root_node, root_layout);
4773 css_node_t *root_node = new_test_css_node();
4775 css_node_t *node_0 = root_node;
4776 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
4777 node_0->style.justify_content = CSS_JUSTIFY_SPACE_BETWEEN;
4778 node_0->style.dimensions[CSS_HEIGHT] = 100;
4779 init_css_node_children(node_0, 2);
4782 node_1 = node_0->get_child(node_0->context, 0);
4783 node_1->style.dimensions[CSS_HEIGHT] = 900;
4784 node_1 = node_0->get_child(node_0->context, 1);
4788 css_node_t *root_layout = new_test_css_node();
4790 css_node_t *node_0 = root_layout;
4791 node_0->layout.position[CSS_TOP] = 0;
4792 node_0->layout.position[CSS_LEFT] = 0;
4793 node_0->layout.dimensions[CSS_WIDTH] = 0;
4794 node_0->layout.dimensions[CSS_HEIGHT] = 100;
4795 init_css_node_children(node_0, 2);
4798 node_1 = node_0->get_child(node_0->context, 0);
4799 node_1->layout.position[CSS_TOP] = -800;
4800 node_1->layout.position[CSS_LEFT] = 0;
4801 node_1->layout.dimensions[CSS_WIDTH] = 0;
4802 node_1->layout.dimensions[CSS_HEIGHT] = 900;
4803 node_1 = node_0->get_child(node_0->context, 1);
4804 node_1->layout.position[CSS_TOP] = -800;
4805 node_1->layout.position[CSS_LEFT] = 0;
4806 node_1->layout.dimensions[CSS_WIDTH] = 0;
4807 node_1->layout.dimensions[CSS_HEIGHT] = 0;
4811 test("should layout space-between when remaining space is negative in reverse", root_node, root_layout);
4815 css_node_t *root_node = new_test_css_node();
4817 css_node_t *node_0 = root_node;
4818 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
4819 node_0->style.justify_content = CSS_JUSTIFY_FLEX_END;
4820 node_0->style.dimensions[CSS_WIDTH] = 200;
4821 init_css_node_children(node_0, 1);
4824 node_1 = node_0->get_child(node_0->context, 0);
4825 node_1->style.dimensions[CSS_WIDTH] = 900;
4829 css_node_t *root_layout = new_test_css_node();
4831 css_node_t *node_0 = root_layout;
4832 node_0->layout.position[CSS_TOP] = 0;
4833 node_0->layout.position[CSS_LEFT] = 0;
4834 node_0->layout.dimensions[CSS_WIDTH] = 200;
4835 node_0->layout.dimensions[CSS_HEIGHT] = 0;
4836 init_css_node_children(node_0, 1);
4839 node_1 = node_0->get_child(node_0->context, 0);
4840 node_1->layout.position[CSS_TOP] = 0;
4841 node_1->layout.position[CSS_LEFT] = -700;
4842 node_1->layout.dimensions[CSS_WIDTH] = 900;
4843 node_1->layout.dimensions[CSS_HEIGHT] = 0;
4847 test("should layout flex-end when remaining space is negative", root_node, root_layout);
4851 css_node_t *root_node = new_test_css_node();
4853 css_node_t *node_0 = root_node;
4854 node_0->style.direction = CSS_DIRECTION_RTL;
4855 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
4856 node_0->style.justify_content = CSS_JUSTIFY_FLEX_END;
4857 node_0->style.dimensions[CSS_WIDTH] = 200;
4858 init_css_node_children(node_0, 1);
4861 node_1 = node_0->get_child(node_0->context, 0);
4862 node_1->style.dimensions[CSS_WIDTH] = 900;
4866 css_node_t *root_layout = new_test_css_node();
4868 css_node_t *node_0 = root_layout;
4869 node_0->layout.position[CSS_TOP] = 0;
4870 node_0->layout.position[CSS_LEFT] = 0;
4871 node_0->layout.dimensions[CSS_WIDTH] = 200;
4872 node_0->layout.dimensions[CSS_HEIGHT] = 0;
4873 init_css_node_children(node_0, 1);
4876 node_1 = node_0->get_child(node_0->context, 0);
4877 node_1->layout.position[CSS_TOP] = 0;
4878 node_1->layout.position[CSS_LEFT] = 0;
4879 node_1->layout.dimensions[CSS_WIDTH] = 900;
4880 node_1->layout.dimensions[CSS_HEIGHT] = 0;
4884 test("should layout flex-end when remaining space is negative in rtl", root_node, root_layout);
4888 css_node_t *root_node = new_test_css_node();
4890 css_node_t *node_0 = root_node;
4891 init_css_node_children(node_0, 1);
4894 node_1 = node_0->get_child(node_0->context, 0);
4895 node_1->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
4896 node_1->style.dimensions[CSS_WIDTH] = 200;
4897 init_css_node_children(node_1, 1);
4900 node_2 = node_1->get_child(node_1->context, 0);
4901 node_2->style.margin[CSS_LEFT] = 20;
4902 node_2->style.margin[CSS_TOP] = 20;
4903 node_2->style.margin[CSS_RIGHT] = 20;
4904 node_2->style.margin[CSS_BOTTOM] = 20;
4905 node_2->style.margin[CSS_START] = 20;
4906 node_2->style.margin[CSS_END] = 20;
4907 node_2->measure = measure;
4908 node_2->context = "loooooooooong with space";
4913 css_node_t *root_layout = new_test_css_node();
4915 css_node_t *node_0 = root_layout;
4916 node_0->layout.position[CSS_TOP] = 0;
4917 node_0->layout.position[CSS_LEFT] = 0;
4918 node_0->layout.dimensions[CSS_WIDTH] = 200;
4919 node_0->layout.dimensions[CSS_HEIGHT] = 58;
4920 init_css_node_children(node_0, 1);
4923 node_1 = node_0->get_child(node_0->context, 0);
4924 node_1->layout.position[CSS_TOP] = 0;
4925 node_1->layout.position[CSS_LEFT] = 0;
4926 node_1->layout.dimensions[CSS_WIDTH] = 200;
4927 node_1->layout.dimensions[CSS_HEIGHT] = 58;
4928 init_css_node_children(node_1, 1);
4931 node_2 = node_1->get_child(node_1->context, 0);
4932 node_2->layout.position[CSS_TOP] = 20;
4933 node_2->layout.position[CSS_LEFT] = 20;
4934 node_2->layout.dimensions[CSS_WIDTH] = 172;
4935 node_2->layout.dimensions[CSS_HEIGHT] = 18;
4940 test("should layout text with flexDirection row", root_node, root_layout);
4944 css_node_t *root_node = new_test_css_node();
4946 css_node_t *node_0 = root_node;
4947 node_0->style.direction = CSS_DIRECTION_RTL;
4948 init_css_node_children(node_0, 1);
4951 node_1 = node_0->get_child(node_0->context, 0);
4952 node_1->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
4953 node_1->style.dimensions[CSS_WIDTH] = 200;
4954 init_css_node_children(node_1, 1);
4957 node_2 = node_1->get_child(node_1->context, 0);
4958 node_2->style.margin[CSS_LEFT] = 20;
4959 node_2->style.margin[CSS_TOP] = 20;
4960 node_2->style.margin[CSS_RIGHT] = 20;
4961 node_2->style.margin[CSS_BOTTOM] = 20;
4962 node_2->style.margin[CSS_START] = 20;
4963 node_2->style.margin[CSS_END] = 20;
4964 node_2->measure = measure;
4965 node_2->context = "loooooooooong with space";
4970 css_node_t *root_layout = new_test_css_node();
4972 css_node_t *node_0 = root_layout;
4973 node_0->layout.position[CSS_TOP] = 0;
4974 node_0->layout.position[CSS_LEFT] = 0;
4975 node_0->layout.dimensions[CSS_WIDTH] = 200;
4976 node_0->layout.dimensions[CSS_HEIGHT] = 58;
4977 init_css_node_children(node_0, 1);
4980 node_1 = node_0->get_child(node_0->context, 0);
4981 node_1->layout.position[CSS_TOP] = 0;
4982 node_1->layout.position[CSS_LEFT] = 0;
4983 node_1->layout.dimensions[CSS_WIDTH] = 200;
4984 node_1->layout.dimensions[CSS_HEIGHT] = 58;
4985 init_css_node_children(node_1, 1);
4988 node_2 = node_1->get_child(node_1->context, 0);
4989 node_2->layout.position[CSS_TOP] = 20;
4990 node_2->layout.position[CSS_LEFT] = 8;
4991 node_2->layout.dimensions[CSS_WIDTH] = 172;
4992 node_2->layout.dimensions[CSS_HEIGHT] = 18;
4997 test("should layout text with flexDirection row in rtl", root_node, root_layout);
5001 css_node_t *root_node = new_test_css_node();
5003 css_node_t *node_0 = root_node;
5004 init_css_node_children(node_0, 1);
5007 node_1 = node_0->get_child(node_0->context, 0);
5008 node_1->style.dimensions[CSS_WIDTH] = 200;
5009 init_css_node_children(node_1, 1);
5012 node_2 = node_1->get_child(node_1->context, 0);
5013 node_2->style.margin[CSS_LEFT] = 20;
5014 node_2->style.margin[CSS_TOP] = 20;
5015 node_2->style.margin[CSS_RIGHT] = 20;
5016 node_2->style.margin[CSS_BOTTOM] = 20;
5017 node_2->style.margin[CSS_START] = 20;
5018 node_2->style.margin[CSS_END] = 20;
5019 node_2->measure = measure;
5020 node_2->context = "loooooooooong with space";
5025 css_node_t *root_layout = new_test_css_node();
5027 css_node_t *node_0 = root_layout;
5028 node_0->layout.position[CSS_TOP] = 0;
5029 node_0->layout.position[CSS_LEFT] = 0;
5030 node_0->layout.dimensions[CSS_WIDTH] = 200;
5031 node_0->layout.dimensions[CSS_HEIGHT] = 76;
5032 init_css_node_children(node_0, 1);
5035 node_1 = node_0->get_child(node_0->context, 0);
5036 node_1->layout.position[CSS_TOP] = 0;
5037 node_1->layout.position[CSS_LEFT] = 0;
5038 node_1->layout.dimensions[CSS_WIDTH] = 200;
5039 node_1->layout.dimensions[CSS_HEIGHT] = 76;
5040 init_css_node_children(node_1, 1);
5043 node_2 = node_1->get_child(node_1->context, 0);
5044 node_2->layout.position[CSS_TOP] = 20;
5045 node_2->layout.position[CSS_LEFT] = 20;
5046 node_2->layout.dimensions[CSS_WIDTH] = 160;
5047 node_2->layout.dimensions[CSS_HEIGHT] = 36;
5052 test("should layout with text and margin", root_node, root_layout);
5056 css_node_t *root_node = new_test_css_node();
5058 css_node_t *node_0 = root_node;
5059 node_0->style.dimensions[CSS_WIDTH] = 100;
5060 node_0->style.dimensions[CSS_HEIGHT] = 100;
5061 init_css_node_children(node_0, 1);
5064 node_1 = node_0->get_child(node_0->context, 0);
5065 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
5066 node_1->style.position[CSS_LEFT] = 0;
5067 node_1->style.position[CSS_TOP] = 0;
5068 node_1->style.position[CSS_RIGHT] = 0;
5069 node_1->style.position[CSS_BOTTOM] = 0;
5073 css_node_t *root_layout = new_test_css_node();
5075 css_node_t *node_0 = root_layout;
5076 node_0->layout.position[CSS_TOP] = 0;
5077 node_0->layout.position[CSS_LEFT] = 0;
5078 node_0->layout.dimensions[CSS_WIDTH] = 100;
5079 node_0->layout.dimensions[CSS_HEIGHT] = 100;
5080 init_css_node_children(node_0, 1);
5083 node_1 = node_0->get_child(node_0->context, 0);
5084 node_1->layout.position[CSS_TOP] = 0;
5085 node_1->layout.position[CSS_LEFT] = 0;
5086 node_1->layout.dimensions[CSS_WIDTH] = 100;
5087 node_1->layout.dimensions[CSS_HEIGHT] = 100;
5091 test("should layout with position absolute, top, left, bottom, right", root_node, root_layout);
5095 css_node_t *root_node = new_test_css_node();
5097 css_node_t *node_0 = root_node;
5098 node_0->style.align_self = CSS_ALIGN_FLEX_START;
5099 node_0->style.dimensions[CSS_WIDTH] = 100;
5100 node_0->style.dimensions[CSS_HEIGHT] = 100;
5101 init_css_node_children(node_0, 2);
5104 node_1 = node_0->get_child(node_0->context, 0);
5105 node_1->style.align_self = CSS_ALIGN_FLEX_START;
5106 node_1->style.flex = 2.5;
5107 node_1 = node_0->get_child(node_0->context, 1);
5108 node_1->style.align_self = CSS_ALIGN_FLEX_START;
5109 node_1->style.flex = 7.5;
5113 css_node_t *root_layout = new_test_css_node();
5115 css_node_t *node_0 = root_layout;
5116 node_0->layout.position[CSS_TOP] = 0;
5117 node_0->layout.position[CSS_LEFT] = 0;
5118 node_0->layout.dimensions[CSS_WIDTH] = 100;
5119 node_0->layout.dimensions[CSS_HEIGHT] = 100;
5120 init_css_node_children(node_0, 2);
5123 node_1 = node_0->get_child(node_0->context, 0);
5124 node_1->layout.position[CSS_TOP] = 0;
5125 node_1->layout.position[CSS_LEFT] = 0;
5126 node_1->layout.dimensions[CSS_WIDTH] = 0;
5127 node_1->layout.dimensions[CSS_HEIGHT] = 25;
5128 node_1 = node_0->get_child(node_0->context, 1);
5129 node_1->layout.position[CSS_TOP] = 25;
5130 node_1->layout.position[CSS_LEFT] = 0;
5131 node_1->layout.dimensions[CSS_WIDTH] = 0;
5132 node_1->layout.dimensions[CSS_HEIGHT] = 75;
5136 test("should layout with arbitrary flex", root_node, root_layout);
5140 css_node_t *root_node = new_test_css_node();
5142 css_node_t *node_0 = root_node;
5143 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
5144 node_0->style.align_self = CSS_ALIGN_FLEX_START;
5145 node_0->style.dimensions[CSS_WIDTH] = 100;
5146 node_0->style.dimensions[CSS_HEIGHT] = 100;
5147 init_css_node_children(node_0, 2);
5150 node_1 = node_0->get_child(node_0->context, 0);
5151 node_1->style.align_self = CSS_ALIGN_FLEX_START;
5152 node_1->style.flex = 2.5;
5153 node_1 = node_0->get_child(node_0->context, 1);
5154 node_1->style.align_self = CSS_ALIGN_FLEX_START;
5155 node_1->style.flex = 7.5;
5159 css_node_t *root_layout = new_test_css_node();
5161 css_node_t *node_0 = root_layout;
5162 node_0->layout.position[CSS_TOP] = 0;
5163 node_0->layout.position[CSS_LEFT] = 0;
5164 node_0->layout.dimensions[CSS_WIDTH] = 100;
5165 node_0->layout.dimensions[CSS_HEIGHT] = 100;
5166 init_css_node_children(node_0, 2);
5169 node_1 = node_0->get_child(node_0->context, 0);
5170 node_1->layout.position[CSS_TOP] = 75;
5171 node_1->layout.position[CSS_LEFT] = 0;
5172 node_1->layout.dimensions[CSS_WIDTH] = 0;
5173 node_1->layout.dimensions[CSS_HEIGHT] = 25;
5174 node_1 = node_0->get_child(node_0->context, 1);
5175 node_1->layout.position[CSS_TOP] = 0;
5176 node_1->layout.position[CSS_LEFT] = 0;
5177 node_1->layout.dimensions[CSS_WIDTH] = 0;
5178 node_1->layout.dimensions[CSS_HEIGHT] = 75;
5182 test("should layout with arbitrary flex in reverse", root_node, root_layout);
5186 css_node_t *root_node = new_test_css_node();
5188 css_node_t *node_0 = root_node;
5189 node_0->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN_REVERSE;
5190 node_0->style.align_self = CSS_ALIGN_FLEX_START;
5191 node_0->style.dimensions[CSS_WIDTH] = 100;
5192 node_0->style.dimensions[CSS_HEIGHT] = 100;
5193 init_css_node_children(node_0, 2);
5196 node_1 = node_0->get_child(node_0->context, 0);
5197 node_1->style.align_self = CSS_ALIGN_FLEX_START;
5198 node_1->style.flex = -2.5;
5199 node_1 = node_0->get_child(node_0->context, 1);
5200 node_1->style.align_self = CSS_ALIGN_FLEX_START;
5201 node_1->style.flex = 0;
5205 css_node_t *root_layout = new_test_css_node();
5207 css_node_t *node_0 = root_layout;
5208 node_0->layout.position[CSS_TOP] = 0;
5209 node_0->layout.position[CSS_LEFT] = 0;
5210 node_0->layout.dimensions[CSS_WIDTH] = 100;
5211 node_0->layout.dimensions[CSS_HEIGHT] = 100;
5212 init_css_node_children(node_0, 2);
5215 node_1 = node_0->get_child(node_0->context, 0);
5216 node_1->layout.position[CSS_TOP] = 100;
5217 node_1->layout.position[CSS_LEFT] = 0;
5218 node_1->layout.dimensions[CSS_WIDTH] = 0;
5219 node_1->layout.dimensions[CSS_HEIGHT] = 0;
5220 node_1 = node_0->get_child(node_0->context, 1);
5221 node_1->layout.position[CSS_TOP] = 100;
5222 node_1->layout.position[CSS_LEFT] = 0;
5223 node_1->layout.dimensions[CSS_WIDTH] = 0;
5224 node_1->layout.dimensions[CSS_HEIGHT] = 0;
5228 test("should layout with negative flex in reverse", root_node, root_layout);
5232 css_node_t *root_node = new_test_css_node();
5234 css_node_t *node_0 = root_node;
5235 init_css_node_children(node_0, 2);
5238 node_1 = node_0->get_child(node_0->context, 0);
5239 node_1->style.dimensions[CSS_WIDTH] = 50;
5240 node_1->style.dimensions[CSS_HEIGHT] = 100;
5241 node_1 = node_0->get_child(node_0->context, 1);
5242 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
5243 node_1->style.position[CSS_LEFT] = 0;
5244 node_1->style.position[CSS_RIGHT] = 0;
5248 css_node_t *root_layout = new_test_css_node();
5250 css_node_t *node_0 = root_layout;
5251 node_0->layout.position[CSS_TOP] = 0;
5252 node_0->layout.position[CSS_LEFT] = 0;
5253 node_0->layout.dimensions[CSS_WIDTH] = 50;
5254 node_0->layout.dimensions[CSS_HEIGHT] = 100;
5255 init_css_node_children(node_0, 2);
5258 node_1 = node_0->get_child(node_0->context, 0);
5259 node_1->layout.position[CSS_TOP] = 0;
5260 node_1->layout.position[CSS_LEFT] = 0;
5261 node_1->layout.dimensions[CSS_WIDTH] = 50;
5262 node_1->layout.dimensions[CSS_HEIGHT] = 100;
5263 node_1 = node_0->get_child(node_0->context, 1);
5264 node_1->layout.position[CSS_TOP] = 100;
5265 node_1->layout.position[CSS_LEFT] = 0;
5266 node_1->layout.dimensions[CSS_WIDTH] = 50;
5267 node_1->layout.dimensions[CSS_HEIGHT] = 0;
5271 test("should layout with position: absolute and another sibling", root_node, root_layout);
5275 css_node_t *root_node = new_test_css_node();
5277 css_node_t *node_0 = root_node;
5278 node_0->style.dimensions[CSS_HEIGHT] = 100;
5279 init_css_node_children(node_0, 1);
5282 node_1 = node_0->get_child(node_0->context, 0);
5283 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
5284 node_1->style.position[CSS_TOP] = 0;
5285 node_1->style.position[CSS_BOTTOM] = 20;
5289 css_node_t *root_layout = new_test_css_node();
5291 css_node_t *node_0 = root_layout;
5292 node_0->layout.position[CSS_TOP] = 0;
5293 node_0->layout.position[CSS_LEFT] = 0;
5294 node_0->layout.dimensions[CSS_WIDTH] = 0;
5295 node_0->layout.dimensions[CSS_HEIGHT] = 100;
5296 init_css_node_children(node_0, 1);
5299 node_1 = node_0->get_child(node_0->context, 0);
5300 node_1->layout.position[CSS_TOP] = 0;
5301 node_1->layout.position[CSS_LEFT] = 0;
5302 node_1->layout.dimensions[CSS_WIDTH] = 0;
5303 node_1->layout.dimensions[CSS_HEIGHT] = 80;
5307 test("should calculate height properly with position: absolute top and bottom", root_node, root_layout);
5311 css_node_t *root_node = new_test_css_node();
5313 css_node_t *node_0 = root_node;
5314 node_0->style.dimensions[CSS_WIDTH] = 200;
5315 node_0->style.dimensions[CSS_HEIGHT] = 200;
5316 init_css_node_children(node_0, 1);
5319 node_1 = node_0->get_child(node_0->context, 0);
5320 node_1->style.justify_content = CSS_JUSTIFY_CENTER;
5321 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
5322 node_1->style.position[CSS_LEFT] = 0;
5323 node_1->style.position[CSS_TOP] = 0;
5324 node_1->style.position[CSS_RIGHT] = 0;
5325 node_1->style.position[CSS_BOTTOM] = 0;
5326 init_css_node_children(node_1, 1);
5329 node_2 = node_1->get_child(node_1->context, 0);
5330 node_2->style.dimensions[CSS_WIDTH] = 100;
5331 node_2->style.dimensions[CSS_HEIGHT] = 100;
5336 css_node_t *root_layout = new_test_css_node();
5338 css_node_t *node_0 = root_layout;
5339 node_0->layout.position[CSS_TOP] = 0;
5340 node_0->layout.position[CSS_LEFT] = 0;
5341 node_0->layout.dimensions[CSS_WIDTH] = 200;
5342 node_0->layout.dimensions[CSS_HEIGHT] = 200;
5343 init_css_node_children(node_0, 1);
5346 node_1 = node_0->get_child(node_0->context, 0);
5347 node_1->layout.position[CSS_TOP] = 0;
5348 node_1->layout.position[CSS_LEFT] = 0;
5349 node_1->layout.dimensions[CSS_WIDTH] = 200;
5350 node_1->layout.dimensions[CSS_HEIGHT] = 200;
5351 init_css_node_children(node_1, 1);
5354 node_2 = node_1->get_child(node_1->context, 0);
5355 node_2->layout.position[CSS_TOP] = 50;
5356 node_2->layout.position[CSS_LEFT] = 0;
5357 node_2->layout.dimensions[CSS_WIDTH] = 100;
5358 node_2->layout.dimensions[CSS_HEIGHT] = 100;
5363 test("should layout with complicated position: absolute and justifyContent: center combo", root_node, root_layout);
5367 css_node_t *root_node = new_test_css_node();
5369 css_node_t *node_0 = root_node;
5370 node_0->style.dimensions[CSS_HEIGHT] = 100;
5371 init_css_node_children(node_0, 1);
5374 node_1 = node_0->get_child(node_0->context, 0);
5375 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
5376 node_1->style.position[CSS_BOTTOM] = 0;
5380 css_node_t *root_layout = new_test_css_node();
5382 css_node_t *node_0 = root_layout;
5383 node_0->layout.position[CSS_TOP] = 0;
5384 node_0->layout.position[CSS_LEFT] = 0;
5385 node_0->layout.dimensions[CSS_WIDTH] = 0;
5386 node_0->layout.dimensions[CSS_HEIGHT] = 100;
5387 init_css_node_children(node_0, 1);
5390 node_1 = node_0->get_child(node_0->context, 0);
5391 node_1->layout.position[CSS_TOP] = 100;
5392 node_1->layout.position[CSS_LEFT] = 0;
5393 node_1->layout.dimensions[CSS_WIDTH] = 0;
5394 node_1->layout.dimensions[CSS_HEIGHT] = 0;
5398 test("should calculate top properly with position: absolute bottom", root_node, root_layout);
5402 css_node_t *root_node = new_test_css_node();
5404 css_node_t *node_0 = root_node;
5405 node_0->style.dimensions[CSS_WIDTH] = 100;
5406 init_css_node_children(node_0, 1);
5409 node_1 = node_0->get_child(node_0->context, 0);
5410 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
5411 node_1->style.position[CSS_RIGHT] = 0;
5415 css_node_t *root_layout = new_test_css_node();
5417 css_node_t *node_0 = root_layout;
5418 node_0->layout.position[CSS_TOP] = 0;
5419 node_0->layout.position[CSS_LEFT] = 0;
5420 node_0->layout.dimensions[CSS_WIDTH] = 100;
5421 node_0->layout.dimensions[CSS_HEIGHT] = 0;
5422 init_css_node_children(node_0, 1);
5425 node_1 = node_0->get_child(node_0->context, 0);
5426 node_1->layout.position[CSS_TOP] = 0;
5427 node_1->layout.position[CSS_LEFT] = 100;
5428 node_1->layout.dimensions[CSS_WIDTH] = 0;
5429 node_1->layout.dimensions[CSS_HEIGHT] = 0;
5433 test("should calculate left properly with position: absolute right", root_node, root_layout);
5437 css_node_t *root_node = new_test_css_node();
5439 css_node_t *node_0 = root_node;
5440 node_0->style.dimensions[CSS_HEIGHT] = 100;
5441 init_css_node_children(node_0, 1);
5444 node_1 = node_0->get_child(node_0->context, 0);
5445 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
5446 node_1->style.dimensions[CSS_HEIGHT] = 10;
5447 node_1->style.position[CSS_BOTTOM] = 0;
5451 css_node_t *root_layout = new_test_css_node();
5453 css_node_t *node_0 = root_layout;
5454 node_0->layout.position[CSS_TOP] = 0;
5455 node_0->layout.position[CSS_LEFT] = 0;
5456 node_0->layout.dimensions[CSS_WIDTH] = 0;
5457 node_0->layout.dimensions[CSS_HEIGHT] = 100;
5458 init_css_node_children(node_0, 1);
5461 node_1 = node_0->get_child(node_0->context, 0);
5462 node_1->layout.position[CSS_TOP] = 90;
5463 node_1->layout.position[CSS_LEFT] = 0;
5464 node_1->layout.dimensions[CSS_WIDTH] = 0;
5465 node_1->layout.dimensions[CSS_HEIGHT] = 10;
5469 test("should calculate top properly with position: absolute bottom and height", root_node, root_layout);
5473 css_node_t *root_node = new_test_css_node();
5475 css_node_t *node_0 = root_node;
5476 node_0->style.dimensions[CSS_WIDTH] = 100;
5477 init_css_node_children(node_0, 1);
5480 node_1 = node_0->get_child(node_0->context, 0);
5481 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
5482 node_1->style.dimensions[CSS_WIDTH] = 10;
5483 node_1->style.position[CSS_RIGHT] = 0;
5487 css_node_t *root_layout = new_test_css_node();
5489 css_node_t *node_0 = root_layout;
5490 node_0->layout.position[CSS_TOP] = 0;
5491 node_0->layout.position[CSS_LEFT] = 0;
5492 node_0->layout.dimensions[CSS_WIDTH] = 100;
5493 node_0->layout.dimensions[CSS_HEIGHT] = 0;
5494 init_css_node_children(node_0, 1);
5497 node_1 = node_0->get_child(node_0->context, 0);
5498 node_1->layout.position[CSS_TOP] = 0;
5499 node_1->layout.position[CSS_LEFT] = 90;
5500 node_1->layout.dimensions[CSS_WIDTH] = 10;
5501 node_1->layout.dimensions[CSS_HEIGHT] = 0;
5505 test("should calculate left properly with position: absolute right and width", root_node, root_layout);
5509 css_node_t *root_node = new_test_css_node();
5511 css_node_t *node_0 = root_node;
5512 init_css_node_children(node_0, 1);
5515 node_1 = node_0->get_child(node_0->context, 0);
5516 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
5517 node_1->style.dimensions[CSS_HEIGHT] = 10;
5518 node_1->style.position[CSS_BOTTOM] = 0;
5522 css_node_t *root_layout = new_test_css_node();
5524 css_node_t *node_0 = root_layout;
5525 node_0->layout.position[CSS_TOP] = 0;
5526 node_0->layout.position[CSS_LEFT] = 0;
5527 node_0->layout.dimensions[CSS_WIDTH] = 0;
5528 node_0->layout.dimensions[CSS_HEIGHT] = 0;
5529 init_css_node_children(node_0, 1);
5532 node_1 = node_0->get_child(node_0->context, 0);
5533 node_1->layout.position[CSS_TOP] = -10;
5534 node_1->layout.position[CSS_LEFT] = 0;
5535 node_1->layout.dimensions[CSS_WIDTH] = 0;
5536 node_1->layout.dimensions[CSS_HEIGHT] = 10;
5540 test("should calculate top properly with position: absolute right, width, and no parent dimensions", root_node, root_layout);
5544 css_node_t *root_node = new_test_css_node();
5546 css_node_t *node_0 = root_node;
5547 init_css_node_children(node_0, 1);
5550 node_1 = node_0->get_child(node_0->context, 0);
5551 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
5552 node_1->style.dimensions[CSS_WIDTH] = 10;
5553 node_1->style.position[CSS_RIGHT] = 0;
5557 css_node_t *root_layout = new_test_css_node();
5559 css_node_t *node_0 = root_layout;
5560 node_0->layout.position[CSS_TOP] = 0;
5561 node_0->layout.position[CSS_LEFT] = 0;
5562 node_0->layout.dimensions[CSS_WIDTH] = 0;
5563 node_0->layout.dimensions[CSS_HEIGHT] = 0;
5564 init_css_node_children(node_0, 1);
5567 node_1 = node_0->get_child(node_0->context, 0);
5568 node_1->layout.position[CSS_TOP] = 0;
5569 node_1->layout.position[CSS_LEFT] = -10;
5570 node_1->layout.dimensions[CSS_WIDTH] = 10;
5571 node_1->layout.dimensions[CSS_HEIGHT] = 0;
5575 test("should calculate left properly with position: absolute right, width, and no parent dimensions", root_node, root_layout);
5579 css_node_t *root_node = new_test_css_node();
5581 css_node_t *node_0 = root_node;
5582 node_0->style.justify_content = CSS_JUSTIFY_SPACE_BETWEEN;
5583 init_css_node_children(node_0, 1);
5586 node_1 = node_0->get_child(node_0->context, 0);
5587 node_1->style.border[CSS_BOTTOM] = 1;
5591 css_node_t *root_layout = new_test_css_node();
5593 css_node_t *node_0 = root_layout;
5594 node_0->layout.position[CSS_TOP] = 0;
5595 node_0->layout.position[CSS_LEFT] = 0;
5596 node_0->layout.dimensions[CSS_WIDTH] = 0;
5597 node_0->layout.dimensions[CSS_HEIGHT] = 1;
5598 init_css_node_children(node_0, 1);
5601 node_1 = node_0->get_child(node_0->context, 0);
5602 node_1->layout.position[CSS_TOP] = 0;
5603 node_1->layout.position[CSS_LEFT] = 0;
5604 node_1->layout.dimensions[CSS_WIDTH] = 0;
5605 node_1->layout.dimensions[CSS_HEIGHT] = 1;
5609 test("should layout border bottom inside of justify content space between container", root_node, root_layout);
5613 css_node_t *root_node = new_test_css_node();
5615 css_node_t *node_0 = root_node;
5616 node_0->style.justify_content = CSS_JUSTIFY_CENTER;
5617 init_css_node_children(node_0, 1);
5620 node_1 = node_0->get_child(node_0->context, 0);
5621 node_1->style.margin[CSS_TOP] = -6;
5625 css_node_t *root_layout = new_test_css_node();
5627 css_node_t *node_0 = root_layout;
5628 node_0->layout.position[CSS_TOP] = 0;
5629 node_0->layout.position[CSS_LEFT] = 0;
5630 node_0->layout.dimensions[CSS_WIDTH] = 0;
5631 node_0->layout.dimensions[CSS_HEIGHT] = 0;
5632 init_css_node_children(node_0, 1);
5635 node_1 = node_0->get_child(node_0->context, 0);
5636 node_1->layout.position[CSS_TOP] = -3;
5637 node_1->layout.position[CSS_LEFT] = 0;
5638 node_1->layout.dimensions[CSS_WIDTH] = 0;
5639 node_1->layout.dimensions[CSS_HEIGHT] = 0;
5643 test("should layout negative margin top inside of justify content center container", root_node, root_layout);
5647 css_node_t *root_node = new_test_css_node();
5649 css_node_t *node_0 = root_node;
5650 node_0->style.justify_content = CSS_JUSTIFY_CENTER;
5651 init_css_node_children(node_0, 1);
5654 node_1 = node_0->get_child(node_0->context, 0);
5655 node_1->style.margin[CSS_TOP] = 20;
5659 css_node_t *root_layout = new_test_css_node();
5661 css_node_t *node_0 = root_layout;
5662 node_0->layout.position[CSS_TOP] = 0;
5663 node_0->layout.position[CSS_LEFT] = 0;
5664 node_0->layout.dimensions[CSS_WIDTH] = 0;
5665 node_0->layout.dimensions[CSS_HEIGHT] = 20;
5666 init_css_node_children(node_0, 1);
5669 node_1 = node_0->get_child(node_0->context, 0);
5670 node_1->layout.position[CSS_TOP] = 20;
5671 node_1->layout.position[CSS_LEFT] = 0;
5672 node_1->layout.dimensions[CSS_WIDTH] = 0;
5673 node_1->layout.dimensions[CSS_HEIGHT] = 0;
5677 test("should layout positive margin top inside of justify content center container", root_node, root_layout);
5681 css_node_t *root_node = new_test_css_node();
5683 css_node_t *node_0 = root_node;
5684 node_0->style.justify_content = CSS_JUSTIFY_FLEX_END;
5685 node_0->style.border[CSS_BOTTOM] = 5;
5686 init_css_node_children(node_0, 1);
5689 node_1 = node_0->get_child(node_0->context, 0);
5693 css_node_t *root_layout = new_test_css_node();
5695 css_node_t *node_0 = root_layout;
5696 node_0->layout.position[CSS_TOP] = 0;
5697 node_0->layout.position[CSS_LEFT] = 0;
5698 node_0->layout.dimensions[CSS_WIDTH] = 0;
5699 node_0->layout.dimensions[CSS_HEIGHT] = 5;
5700 init_css_node_children(node_0, 1);
5703 node_1 = node_0->get_child(node_0->context, 0);
5704 node_1->layout.position[CSS_TOP] = 0;
5705 node_1->layout.position[CSS_LEFT] = 0;
5706 node_1->layout.dimensions[CSS_WIDTH] = 0;
5707 node_1->layout.dimensions[CSS_HEIGHT] = 0;
5711 test("should layout border bottom and flex end with an empty child", root_node, root_layout);
5715 css_node_t *root_node = new_test_css_node();
5717 css_node_t *node_0 = root_node;
5718 node_0->style.dimensions[CSS_WIDTH] = 800;
5719 init_css_node_children(node_0, 1);
5722 node_1 = node_0->get_child(node_0->context, 0);
5723 node_1->style.position[CSS_LEFT] = 5;
5724 init_css_node_children(node_1, 1);
5727 node_2 = node_1->get_child(node_1->context, 0);
5732 css_node_t *root_layout = new_test_css_node();
5734 css_node_t *node_0 = root_layout;
5735 node_0->layout.position[CSS_TOP] = 0;
5736 node_0->layout.position[CSS_LEFT] = 0;
5737 node_0->layout.dimensions[CSS_WIDTH] = 800;
5738 node_0->layout.dimensions[CSS_HEIGHT] = 0;
5739 init_css_node_children(node_0, 1);
5742 node_1 = node_0->get_child(node_0->context, 0);
5743 node_1->layout.position[CSS_TOP] = 0;
5744 node_1->layout.position[CSS_LEFT] = 5;
5745 node_1->layout.dimensions[CSS_WIDTH] = 800;
5746 node_1->layout.dimensions[CSS_HEIGHT] = 0;
5747 init_css_node_children(node_1, 1);
5750 node_2 = node_1->get_child(node_1->context, 0);
5751 node_2->layout.position[CSS_TOP] = 0;
5752 node_2->layout.position[CSS_LEFT] = 0;
5753 node_2->layout.dimensions[CSS_WIDTH] = 800;
5754 node_2->layout.dimensions[CSS_HEIGHT] = 0;
5759 test("should layout with children of a contain with left", root_node, root_layout);
5763 css_node_t *root_node = new_test_css_node();
5765 css_node_t *node_0 = root_node;
5766 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
5767 node_0->style.flex_wrap = CSS_WRAP;
5768 node_0->style.dimensions[CSS_WIDTH] = 100;
5769 init_css_node_children(node_0, 3);
5772 node_1 = node_0->get_child(node_0->context, 0);
5773 node_1->style.dimensions[CSS_WIDTH] = 40;
5774 node_1->style.dimensions[CSS_HEIGHT] = 10;
5775 node_1 = node_0->get_child(node_0->context, 1);
5776 node_1->style.dimensions[CSS_WIDTH] = 40;
5777 node_1->style.dimensions[CSS_HEIGHT] = 10;
5778 node_1 = node_0->get_child(node_0->context, 2);
5779 node_1->style.dimensions[CSS_WIDTH] = 40;
5780 node_1->style.dimensions[CSS_HEIGHT] = 10;
5784 css_node_t *root_layout = new_test_css_node();
5786 css_node_t *node_0 = root_layout;
5787 node_0->layout.position[CSS_TOP] = 0;
5788 node_0->layout.position[CSS_LEFT] = 0;
5789 node_0->layout.dimensions[CSS_WIDTH] = 100;
5790 node_0->layout.dimensions[CSS_HEIGHT] = 20;
5791 init_css_node_children(node_0, 3);
5794 node_1 = node_0->get_child(node_0->context, 0);
5795 node_1->layout.position[CSS_TOP] = 0;
5796 node_1->layout.position[CSS_LEFT] = 0;
5797 node_1->layout.dimensions[CSS_WIDTH] = 40;
5798 node_1->layout.dimensions[CSS_HEIGHT] = 10;
5799 node_1 = node_0->get_child(node_0->context, 1);
5800 node_1->layout.position[CSS_TOP] = 0;
5801 node_1->layout.position[CSS_LEFT] = 40;
5802 node_1->layout.dimensions[CSS_WIDTH] = 40;
5803 node_1->layout.dimensions[CSS_HEIGHT] = 10;
5804 node_1 = node_0->get_child(node_0->context, 2);
5805 node_1->layout.position[CSS_TOP] = 10;
5806 node_1->layout.position[CSS_LEFT] = 0;
5807 node_1->layout.dimensions[CSS_WIDTH] = 40;
5808 node_1->layout.dimensions[CSS_HEIGHT] = 10;
5812 test("should layout flex-wrap", root_node, root_layout);
5816 css_node_t *root_node = new_test_css_node();
5818 css_node_t *node_0 = root_node;
5819 node_0->style.direction = CSS_DIRECTION_RTL;
5820 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
5821 node_0->style.flex_wrap = CSS_WRAP;
5822 node_0->style.dimensions[CSS_WIDTH] = 100;
5823 init_css_node_children(node_0, 3);
5826 node_1 = node_0->get_child(node_0->context, 0);
5827 node_1->style.dimensions[CSS_WIDTH] = 40;
5828 node_1->style.dimensions[CSS_HEIGHT] = 10;
5829 node_1 = node_0->get_child(node_0->context, 1);
5830 node_1->style.dimensions[CSS_WIDTH] = 40;
5831 node_1->style.dimensions[CSS_HEIGHT] = 10;
5832 node_1 = node_0->get_child(node_0->context, 2);
5833 node_1->style.dimensions[CSS_WIDTH] = 40;
5834 node_1->style.dimensions[CSS_HEIGHT] = 10;
5838 css_node_t *root_layout = new_test_css_node();
5840 css_node_t *node_0 = root_layout;
5841 node_0->layout.position[CSS_TOP] = 0;
5842 node_0->layout.position[CSS_LEFT] = 0;
5843 node_0->layout.dimensions[CSS_WIDTH] = 100;
5844 node_0->layout.dimensions[CSS_HEIGHT] = 20;
5845 init_css_node_children(node_0, 3);
5848 node_1 = node_0->get_child(node_0->context, 0);
5849 node_1->layout.position[CSS_TOP] = 0;
5850 node_1->layout.position[CSS_LEFT] = 60;
5851 node_1->layout.dimensions[CSS_WIDTH] = 40;
5852 node_1->layout.dimensions[CSS_HEIGHT] = 10;
5853 node_1 = node_0->get_child(node_0->context, 1);
5854 node_1->layout.position[CSS_TOP] = 0;
5855 node_1->layout.position[CSS_LEFT] = 20;
5856 node_1->layout.dimensions[CSS_WIDTH] = 40;
5857 node_1->layout.dimensions[CSS_HEIGHT] = 10;
5858 node_1 = node_0->get_child(node_0->context, 2);
5859 node_1->layout.position[CSS_TOP] = 10;
5860 node_1->layout.position[CSS_LEFT] = 60;
5861 node_1->layout.dimensions[CSS_WIDTH] = 40;
5862 node_1->layout.dimensions[CSS_HEIGHT] = 10;
5866 test("should layout flex-wrap in rtl", root_node, root_layout);
5870 css_node_t *root_node = new_test_css_node();
5872 css_node_t *node_0 = root_node;
5873 node_0->style.flex_wrap = CSS_WRAP;
5874 node_0->style.dimensions[CSS_HEIGHT] = 100;
5875 init_css_node_children(node_0, 2);
5878 node_1 = node_0->get_child(node_0->context, 0);
5879 node_1->style.dimensions[CSS_HEIGHT] = 100;
5880 node_1 = node_0->get_child(node_0->context, 1);
5881 node_1->style.dimensions[CSS_HEIGHT] = 200;
5885 css_node_t *root_layout = new_test_css_node();
5887 css_node_t *node_0 = root_layout;
5888 node_0->layout.position[CSS_TOP] = 0;
5889 node_0->layout.position[CSS_LEFT] = 0;
5890 node_0->layout.dimensions[CSS_WIDTH] = 0;
5891 node_0->layout.dimensions[CSS_HEIGHT] = 100;
5892 init_css_node_children(node_0, 2);
5895 node_1 = node_0->get_child(node_0->context, 0);
5896 node_1->layout.position[CSS_TOP] = 0;
5897 node_1->layout.position[CSS_LEFT] = 0;
5898 node_1->layout.dimensions[CSS_WIDTH] = 0;
5899 node_1->layout.dimensions[CSS_HEIGHT] = 100;
5900 node_1 = node_0->get_child(node_0->context, 1);
5901 node_1->layout.position[CSS_TOP] = 0;
5902 node_1->layout.position[CSS_LEFT] = 0;
5903 node_1->layout.dimensions[CSS_WIDTH] = 0;
5904 node_1->layout.dimensions[CSS_HEIGHT] = 200;
5908 test("should layout flex wrap with a line bigger than container", root_node, root_layout);
5912 css_node_t *root_node = new_test_css_node();
5914 css_node_t *node_0 = root_node;
5915 node_0->style.dimensions[CSS_WIDTH] = 100;
5916 node_0->style.dimensions[CSS_HEIGHT] = 200;
5917 node_0->style.maxDimensions[CSS_WIDTH] = 90;
5918 node_0->style.maxDimensions[CSS_HEIGHT] = 190;
5921 css_node_t *root_layout = new_test_css_node();
5923 css_node_t *node_0 = root_layout;
5924 node_0->layout.position[CSS_TOP] = 0;
5925 node_0->layout.position[CSS_LEFT] = 0;
5926 node_0->layout.dimensions[CSS_WIDTH] = 90;
5927 node_0->layout.dimensions[CSS_HEIGHT] = 190;
5930 test("should use max bounds", root_node, root_layout);
5934 css_node_t *root_node = new_test_css_node();
5936 css_node_t *node_0 = root_node;
5937 node_0->style.dimensions[CSS_WIDTH] = 100;
5938 node_0->style.dimensions[CSS_HEIGHT] = 200;
5939 node_0->style.minDimensions[CSS_WIDTH] = 110;
5940 node_0->style.minDimensions[CSS_HEIGHT] = 210;
5943 css_node_t *root_layout = new_test_css_node();
5945 css_node_t *node_0 = root_layout;
5946 node_0->layout.position[CSS_TOP] = 0;
5947 node_0->layout.position[CSS_LEFT] = 0;
5948 node_0->layout.dimensions[CSS_WIDTH] = 110;
5949 node_0->layout.dimensions[CSS_HEIGHT] = 210;
5952 test("should use min bounds", root_node, root_layout);
5956 css_node_t *root_node = new_test_css_node();
5958 css_node_t *node_0 = root_node;
5959 node_0->style.dimensions[CSS_WIDTH] = 100;
5960 node_0->style.dimensions[CSS_HEIGHT] = 200;
5961 node_0->style.maxDimensions[CSS_WIDTH] = 90;
5962 node_0->style.maxDimensions[CSS_HEIGHT] = 190;
5963 node_0->style.minDimensions[CSS_WIDTH] = 110;
5964 node_0->style.minDimensions[CSS_HEIGHT] = 210;
5967 css_node_t *root_layout = new_test_css_node();
5969 css_node_t *node_0 = root_layout;
5970 node_0->layout.position[CSS_TOP] = 0;
5971 node_0->layout.position[CSS_LEFT] = 0;
5972 node_0->layout.dimensions[CSS_WIDTH] = 110;
5973 node_0->layout.dimensions[CSS_HEIGHT] = 210;
5976 test("should use min bounds over max bounds", root_node, root_layout);
5980 css_node_t *root_node = new_test_css_node();
5982 css_node_t *node_0 = root_node;
5983 node_0->style.dimensions[CSS_WIDTH] = 100;
5984 node_0->style.dimensions[CSS_HEIGHT] = 200;
5985 node_0->style.maxDimensions[CSS_WIDTH] = 80;
5986 node_0->style.maxDimensions[CSS_HEIGHT] = 180;
5987 node_0->style.minDimensions[CSS_WIDTH] = 90;
5988 node_0->style.minDimensions[CSS_HEIGHT] = 190;
5991 css_node_t *root_layout = new_test_css_node();
5993 css_node_t *node_0 = root_layout;
5994 node_0->layout.position[CSS_TOP] = 0;
5995 node_0->layout.position[CSS_LEFT] = 0;
5996 node_0->layout.dimensions[CSS_WIDTH] = 90;
5997 node_0->layout.dimensions[CSS_HEIGHT] = 190;
6000 test("should use min bounds over max bounds and natural width", root_node, root_layout);
6004 css_node_t *root_node = new_test_css_node();
6006 css_node_t *node_0 = root_node;
6007 node_0->style.dimensions[CSS_WIDTH] = 100;
6008 node_0->style.dimensions[CSS_HEIGHT] = 200;
6009 node_0->style.minDimensions[CSS_WIDTH] = -10;
6010 node_0->style.minDimensions[CSS_HEIGHT] = -20;
6013 css_node_t *root_layout = new_test_css_node();
6015 css_node_t *node_0 = root_layout;
6016 node_0->layout.position[CSS_TOP] = 0;
6017 node_0->layout.position[CSS_LEFT] = 0;
6018 node_0->layout.dimensions[CSS_WIDTH] = 100;
6019 node_0->layout.dimensions[CSS_HEIGHT] = 200;
6022 test("should ignore negative min bounds", root_node, root_layout);
6026 css_node_t *root_node = new_test_css_node();
6028 css_node_t *node_0 = root_node;
6029 node_0->style.dimensions[CSS_WIDTH] = 100;
6030 node_0->style.dimensions[CSS_HEIGHT] = 200;
6031 node_0->style.maxDimensions[CSS_WIDTH] = -10;
6032 node_0->style.maxDimensions[CSS_HEIGHT] = -20;
6035 css_node_t *root_layout = new_test_css_node();
6037 css_node_t *node_0 = root_layout;
6038 node_0->layout.position[CSS_TOP] = 0;
6039 node_0->layout.position[CSS_LEFT] = 0;
6040 node_0->layout.dimensions[CSS_WIDTH] = 100;
6041 node_0->layout.dimensions[CSS_HEIGHT] = 200;
6044 test("should ignore negative max bounds", root_node, root_layout);
6048 css_node_t *root_node = new_test_css_node();
6050 css_node_t *node_0 = root_node;
6051 node_0->style.maxDimensions[CSS_WIDTH] = 30;
6052 node_0->style.maxDimensions[CSS_HEIGHT] = 10;
6053 node_0->style.padding[CSS_LEFT] = 20;
6054 node_0->style.padding[CSS_TOP] = 15;
6055 node_0->style.padding[CSS_RIGHT] = 20;
6056 node_0->style.padding[CSS_BOTTOM] = 15;
6059 css_node_t *root_layout = new_test_css_node();
6061 css_node_t *node_0 = root_layout;
6062 node_0->layout.position[CSS_TOP] = 0;
6063 node_0->layout.position[CSS_LEFT] = 0;
6064 node_0->layout.dimensions[CSS_WIDTH] = 40;
6065 node_0->layout.dimensions[CSS_HEIGHT] = 30;
6068 test("should use padded size over max bounds", root_node, root_layout);
6072 css_node_t *root_node = new_test_css_node();
6074 css_node_t *node_0 = root_node;
6075 node_0->style.minDimensions[CSS_WIDTH] = 50;
6076 node_0->style.minDimensions[CSS_HEIGHT] = 40;
6077 node_0->style.padding[CSS_LEFT] = 20;
6078 node_0->style.padding[CSS_TOP] = 15;
6079 node_0->style.padding[CSS_RIGHT] = 20;
6080 node_0->style.padding[CSS_BOTTOM] = 15;
6083 css_node_t *root_layout = new_test_css_node();
6085 css_node_t *node_0 = root_layout;
6086 node_0->layout.position[CSS_TOP] = 0;
6087 node_0->layout.position[CSS_LEFT] = 0;
6088 node_0->layout.dimensions[CSS_WIDTH] = 50;
6089 node_0->layout.dimensions[CSS_HEIGHT] = 40;
6092 test("should use min size over padded size", root_node, root_layout);
6096 css_node_t *root_node = new_test_css_node();
6098 css_node_t *node_0 = root_node;
6099 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
6100 node_0->style.dimensions[CSS_WIDTH] = 300;
6101 node_0->style.dimensions[CSS_HEIGHT] = 200;
6102 init_css_node_children(node_0, 3);
6105 node_1 = node_0->get_child(node_0->context, 0);
6106 node_1->style.flex = 1;
6107 node_1 = node_0->get_child(node_0->context, 1);
6108 node_1->style.flex = 1;
6109 node_1->style.minDimensions[CSS_WIDTH] = 200;
6110 node_1 = node_0->get_child(node_0->context, 2);
6111 node_1->style.flex = 1;
6115 css_node_t *root_layout = new_test_css_node();
6117 css_node_t *node_0 = root_layout;
6118 node_0->layout.position[CSS_TOP] = 0;
6119 node_0->layout.position[CSS_LEFT] = 0;
6120 node_0->layout.dimensions[CSS_WIDTH] = 300;
6121 node_0->layout.dimensions[CSS_HEIGHT] = 200;
6122 init_css_node_children(node_0, 3);
6125 node_1 = node_0->get_child(node_0->context, 0);
6126 node_1->layout.position[CSS_TOP] = 0;
6127 node_1->layout.position[CSS_LEFT] = 0;
6128 node_1->layout.dimensions[CSS_WIDTH] = 50;
6129 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6130 node_1 = node_0->get_child(node_0->context, 1);
6131 node_1->layout.position[CSS_TOP] = 0;
6132 node_1->layout.position[CSS_LEFT] = 50;
6133 node_1->layout.dimensions[CSS_WIDTH] = 200;
6134 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6135 node_1 = node_0->get_child(node_0->context, 2);
6136 node_1->layout.position[CSS_TOP] = 0;
6137 node_1->layout.position[CSS_LEFT] = 250;
6138 node_1->layout.dimensions[CSS_WIDTH] = 50;
6139 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6143 test("should override flex direction size with min bounds", root_node, root_layout);
6147 css_node_t *root_node = new_test_css_node();
6149 css_node_t *node_0 = root_node;
6150 node_0->style.direction = CSS_DIRECTION_RTL;
6151 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
6152 node_0->style.dimensions[CSS_WIDTH] = 300;
6153 node_0->style.dimensions[CSS_HEIGHT] = 200;
6154 init_css_node_children(node_0, 3);
6157 node_1 = node_0->get_child(node_0->context, 0);
6158 node_1->style.flex = 1;
6159 node_1 = node_0->get_child(node_0->context, 1);
6160 node_1->style.flex = 1;
6161 node_1->style.minDimensions[CSS_WIDTH] = 200;
6162 node_1 = node_0->get_child(node_0->context, 2);
6163 node_1->style.flex = 1;
6167 css_node_t *root_layout = new_test_css_node();
6169 css_node_t *node_0 = root_layout;
6170 node_0->layout.position[CSS_TOP] = 0;
6171 node_0->layout.position[CSS_LEFT] = 0;
6172 node_0->layout.dimensions[CSS_WIDTH] = 300;
6173 node_0->layout.dimensions[CSS_HEIGHT] = 200;
6174 init_css_node_children(node_0, 3);
6177 node_1 = node_0->get_child(node_0->context, 0);
6178 node_1->layout.position[CSS_TOP] = 0;
6179 node_1->layout.position[CSS_LEFT] = 250;
6180 node_1->layout.dimensions[CSS_WIDTH] = 50;
6181 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6182 node_1 = node_0->get_child(node_0->context, 1);
6183 node_1->layout.position[CSS_TOP] = 0;
6184 node_1->layout.position[CSS_LEFT] = 50;
6185 node_1->layout.dimensions[CSS_WIDTH] = 200;
6186 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6187 node_1 = node_0->get_child(node_0->context, 2);
6188 node_1->layout.position[CSS_TOP] = 0;
6189 node_1->layout.position[CSS_LEFT] = 0;
6190 node_1->layout.dimensions[CSS_WIDTH] = 50;
6191 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6195 test("should override flex direction size with min bounds in rtl", root_node, root_layout);
6199 css_node_t *root_node = new_test_css_node();
6201 css_node_t *node_0 = root_node;
6202 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
6203 node_0->style.dimensions[CSS_WIDTH] = 300;
6204 node_0->style.dimensions[CSS_HEIGHT] = 200;
6205 init_css_node_children(node_0, 3);
6208 node_1 = node_0->get_child(node_0->context, 0);
6209 node_1->style.flex = 1;
6210 node_1 = node_0->get_child(node_0->context, 1);
6211 node_1->style.flex = 1;
6212 node_1->style.maxDimensions[CSS_WIDTH] = 110;
6213 node_1->style.minDimensions[CSS_WIDTH] = 90;
6214 node_1 = node_0->get_child(node_0->context, 2);
6215 node_1->style.flex = 1;
6219 css_node_t *root_layout = new_test_css_node();
6221 css_node_t *node_0 = root_layout;
6222 node_0->layout.position[CSS_TOP] = 0;
6223 node_0->layout.position[CSS_LEFT] = 0;
6224 node_0->layout.dimensions[CSS_WIDTH] = 300;
6225 node_0->layout.dimensions[CSS_HEIGHT] = 200;
6226 init_css_node_children(node_0, 3);
6229 node_1 = node_0->get_child(node_0->context, 0);
6230 node_1->layout.position[CSS_TOP] = 0;
6231 node_1->layout.position[CSS_LEFT] = 0;
6232 node_1->layout.dimensions[CSS_WIDTH] = 100;
6233 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6234 node_1 = node_0->get_child(node_0->context, 1);
6235 node_1->layout.position[CSS_TOP] = 0;
6236 node_1->layout.position[CSS_LEFT] = 100;
6237 node_1->layout.dimensions[CSS_WIDTH] = 100;
6238 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6239 node_1 = node_0->get_child(node_0->context, 2);
6240 node_1->layout.position[CSS_TOP] = 0;
6241 node_1->layout.position[CSS_LEFT] = 200;
6242 node_1->layout.dimensions[CSS_WIDTH] = 100;
6243 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6247 test("should not override flex direction size within bounds", root_node, root_layout);
6251 css_node_t *root_node = new_test_css_node();
6253 css_node_t *node_0 = root_node;
6254 node_0->style.direction = CSS_DIRECTION_RTL;
6255 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
6256 node_0->style.dimensions[CSS_WIDTH] = 300;
6257 node_0->style.dimensions[CSS_HEIGHT] = 200;
6258 init_css_node_children(node_0, 3);
6261 node_1 = node_0->get_child(node_0->context, 0);
6262 node_1->style.flex = 1;
6263 node_1 = node_0->get_child(node_0->context, 1);
6264 node_1->style.flex = 1;
6265 node_1->style.maxDimensions[CSS_WIDTH] = 110;
6266 node_1->style.minDimensions[CSS_WIDTH] = 90;
6267 node_1 = node_0->get_child(node_0->context, 2);
6268 node_1->style.flex = 1;
6272 css_node_t *root_layout = new_test_css_node();
6274 css_node_t *node_0 = root_layout;
6275 node_0->layout.position[CSS_TOP] = 0;
6276 node_0->layout.position[CSS_LEFT] = 0;
6277 node_0->layout.dimensions[CSS_WIDTH] = 300;
6278 node_0->layout.dimensions[CSS_HEIGHT] = 200;
6279 init_css_node_children(node_0, 3);
6282 node_1 = node_0->get_child(node_0->context, 0);
6283 node_1->layout.position[CSS_TOP] = 0;
6284 node_1->layout.position[CSS_LEFT] = 200;
6285 node_1->layout.dimensions[CSS_WIDTH] = 100;
6286 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6287 node_1 = node_0->get_child(node_0->context, 1);
6288 node_1->layout.position[CSS_TOP] = 0;
6289 node_1->layout.position[CSS_LEFT] = 100;
6290 node_1->layout.dimensions[CSS_WIDTH] = 100;
6291 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6292 node_1 = node_0->get_child(node_0->context, 2);
6293 node_1->layout.position[CSS_TOP] = 0;
6294 node_1->layout.position[CSS_LEFT] = 0;
6295 node_1->layout.dimensions[CSS_WIDTH] = 100;
6296 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6300 test("should not override flex direction size within bounds in rtl", root_node, root_layout);
6304 css_node_t *root_node = new_test_css_node();
6306 css_node_t *node_0 = root_node;
6307 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
6308 node_0->style.dimensions[CSS_WIDTH] = 300;
6309 node_0->style.dimensions[CSS_HEIGHT] = 200;
6310 init_css_node_children(node_0, 3);
6313 node_1 = node_0->get_child(node_0->context, 0);
6314 node_1->style.flex = 1;
6315 node_1 = node_0->get_child(node_0->context, 1);
6316 node_1->style.flex = 1;
6317 node_1->style.maxDimensions[CSS_WIDTH] = 60;
6318 node_1 = node_0->get_child(node_0->context, 2);
6319 node_1->style.flex = 1;
6323 css_node_t *root_layout = new_test_css_node();
6325 css_node_t *node_0 = root_layout;
6326 node_0->layout.position[CSS_TOP] = 0;
6327 node_0->layout.position[CSS_LEFT] = 0;
6328 node_0->layout.dimensions[CSS_WIDTH] = 300;
6329 node_0->layout.dimensions[CSS_HEIGHT] = 200;
6330 init_css_node_children(node_0, 3);
6333 node_1 = node_0->get_child(node_0->context, 0);
6334 node_1->layout.position[CSS_TOP] = 0;
6335 node_1->layout.position[CSS_LEFT] = 0;
6336 node_1->layout.dimensions[CSS_WIDTH] = 120;
6337 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6338 node_1 = node_0->get_child(node_0->context, 1);
6339 node_1->layout.position[CSS_TOP] = 0;
6340 node_1->layout.position[CSS_LEFT] = 120;
6341 node_1->layout.dimensions[CSS_WIDTH] = 60;
6342 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6343 node_1 = node_0->get_child(node_0->context, 2);
6344 node_1->layout.position[CSS_TOP] = 0;
6345 node_1->layout.position[CSS_LEFT] = 180;
6346 node_1->layout.dimensions[CSS_WIDTH] = 120;
6347 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6351 test("should override flex direction size with max bounds", root_node, root_layout);
6355 css_node_t *root_node = new_test_css_node();
6357 css_node_t *node_0 = root_node;
6358 node_0->style.direction = CSS_DIRECTION_RTL;
6359 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
6360 node_0->style.dimensions[CSS_WIDTH] = 300;
6361 node_0->style.dimensions[CSS_HEIGHT] = 200;
6362 init_css_node_children(node_0, 3);
6365 node_1 = node_0->get_child(node_0->context, 0);
6366 node_1->style.flex = 1;
6367 node_1 = node_0->get_child(node_0->context, 1);
6368 node_1->style.flex = 1;
6369 node_1->style.maxDimensions[CSS_WIDTH] = 60;
6370 node_1 = node_0->get_child(node_0->context, 2);
6371 node_1->style.flex = 1;
6375 css_node_t *root_layout = new_test_css_node();
6377 css_node_t *node_0 = root_layout;
6378 node_0->layout.position[CSS_TOP] = 0;
6379 node_0->layout.position[CSS_LEFT] = 0;
6380 node_0->layout.dimensions[CSS_WIDTH] = 300;
6381 node_0->layout.dimensions[CSS_HEIGHT] = 200;
6382 init_css_node_children(node_0, 3);
6385 node_1 = node_0->get_child(node_0->context, 0);
6386 node_1->layout.position[CSS_TOP] = 0;
6387 node_1->layout.position[CSS_LEFT] = 180;
6388 node_1->layout.dimensions[CSS_WIDTH] = 120;
6389 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6390 node_1 = node_0->get_child(node_0->context, 1);
6391 node_1->layout.position[CSS_TOP] = 0;
6392 node_1->layout.position[CSS_LEFT] = 120;
6393 node_1->layout.dimensions[CSS_WIDTH] = 60;
6394 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6395 node_1 = node_0->get_child(node_0->context, 2);
6396 node_1->layout.position[CSS_TOP] = 0;
6397 node_1->layout.position[CSS_LEFT] = 0;
6398 node_1->layout.dimensions[CSS_WIDTH] = 120;
6399 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6403 test("should override flex direction size with max bounds in rtl", root_node, root_layout);
6407 css_node_t *root_node = new_test_css_node();
6409 css_node_t *node_0 = root_node;
6410 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
6411 node_0->style.dimensions[CSS_WIDTH] = 300;
6412 node_0->style.dimensions[CSS_HEIGHT] = 200;
6413 init_css_node_children(node_0, 3);
6416 node_1 = node_0->get_child(node_0->context, 0);
6417 node_1->style.flex = 1;
6418 node_1->style.maxDimensions[CSS_WIDTH] = 60;
6419 node_1 = node_0->get_child(node_0->context, 1);
6420 node_1->style.flex = 1;
6421 node_1->style.maxDimensions[CSS_WIDTH] = 60;
6422 node_1 = node_0->get_child(node_0->context, 2);
6423 node_1->style.flex = 1;
6424 node_1->style.maxDimensions[CSS_WIDTH] = 60;
6428 css_node_t *root_layout = new_test_css_node();
6430 css_node_t *node_0 = root_layout;
6431 node_0->layout.position[CSS_TOP] = 0;
6432 node_0->layout.position[CSS_LEFT] = 0;
6433 node_0->layout.dimensions[CSS_WIDTH] = 300;
6434 node_0->layout.dimensions[CSS_HEIGHT] = 200;
6435 init_css_node_children(node_0, 3);
6438 node_1 = node_0->get_child(node_0->context, 0);
6439 node_1->layout.position[CSS_TOP] = 0;
6440 node_1->layout.position[CSS_LEFT] = 0;
6441 node_1->layout.dimensions[CSS_WIDTH] = 60;
6442 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6443 node_1 = node_0->get_child(node_0->context, 1);
6444 node_1->layout.position[CSS_TOP] = 0;
6445 node_1->layout.position[CSS_LEFT] = 60;
6446 node_1->layout.dimensions[CSS_WIDTH] = 60;
6447 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6448 node_1 = node_0->get_child(node_0->context, 2);
6449 node_1->layout.position[CSS_TOP] = 0;
6450 node_1->layout.position[CSS_LEFT] = 120;
6451 node_1->layout.dimensions[CSS_WIDTH] = 60;
6452 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6456 test("should ignore flex size if fully max bound", root_node, root_layout);
6460 css_node_t *root_node = new_test_css_node();
6462 css_node_t *node_0 = root_node;
6463 node_0->style.direction = CSS_DIRECTION_RTL;
6464 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
6465 node_0->style.dimensions[CSS_WIDTH] = 300;
6466 node_0->style.dimensions[CSS_HEIGHT] = 200;
6467 init_css_node_children(node_0, 3);
6470 node_1 = node_0->get_child(node_0->context, 0);
6471 node_1->style.flex = 1;
6472 node_1->style.maxDimensions[CSS_WIDTH] = 60;
6473 node_1 = node_0->get_child(node_0->context, 1);
6474 node_1->style.flex = 1;
6475 node_1->style.maxDimensions[CSS_WIDTH] = 60;
6476 node_1 = node_0->get_child(node_0->context, 2);
6477 node_1->style.flex = 1;
6478 node_1->style.maxDimensions[CSS_WIDTH] = 60;
6482 css_node_t *root_layout = new_test_css_node();
6484 css_node_t *node_0 = root_layout;
6485 node_0->layout.position[CSS_TOP] = 0;
6486 node_0->layout.position[CSS_LEFT] = 0;
6487 node_0->layout.dimensions[CSS_WIDTH] = 300;
6488 node_0->layout.dimensions[CSS_HEIGHT] = 200;
6489 init_css_node_children(node_0, 3);
6492 node_1 = node_0->get_child(node_0->context, 0);
6493 node_1->layout.position[CSS_TOP] = 0;
6494 node_1->layout.position[CSS_LEFT] = 240;
6495 node_1->layout.dimensions[CSS_WIDTH] = 60;
6496 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6497 node_1 = node_0->get_child(node_0->context, 1);
6498 node_1->layout.position[CSS_TOP] = 0;
6499 node_1->layout.position[CSS_LEFT] = 180;
6500 node_1->layout.dimensions[CSS_WIDTH] = 60;
6501 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6502 node_1 = node_0->get_child(node_0->context, 2);
6503 node_1->layout.position[CSS_TOP] = 0;
6504 node_1->layout.position[CSS_LEFT] = 120;
6505 node_1->layout.dimensions[CSS_WIDTH] = 60;
6506 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6510 test("should ignore flex size if fully max bound in rtl", root_node, root_layout);
6514 css_node_t *root_node = new_test_css_node();
6516 css_node_t *node_0 = root_node;
6517 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
6518 node_0->style.dimensions[CSS_WIDTH] = 300;
6519 node_0->style.dimensions[CSS_HEIGHT] = 200;
6520 init_css_node_children(node_0, 3);
6523 node_1 = node_0->get_child(node_0->context, 0);
6524 node_1->style.flex = 1;
6525 node_1->style.minDimensions[CSS_WIDTH] = 120;
6526 node_1 = node_0->get_child(node_0->context, 1);
6527 node_1->style.flex = 1;
6528 node_1->style.minDimensions[CSS_WIDTH] = 120;
6529 node_1 = node_0->get_child(node_0->context, 2);
6530 node_1->style.flex = 1;
6531 node_1->style.minDimensions[CSS_WIDTH] = 120;
6535 css_node_t *root_layout = new_test_css_node();
6537 css_node_t *node_0 = root_layout;
6538 node_0->layout.position[CSS_TOP] = 0;
6539 node_0->layout.position[CSS_LEFT] = 0;
6540 node_0->layout.dimensions[CSS_WIDTH] = 300;
6541 node_0->layout.dimensions[CSS_HEIGHT] = 200;
6542 init_css_node_children(node_0, 3);
6545 node_1 = node_0->get_child(node_0->context, 0);
6546 node_1->layout.position[CSS_TOP] = 0;
6547 node_1->layout.position[CSS_LEFT] = 0;
6548 node_1->layout.dimensions[CSS_WIDTH] = 120;
6549 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6550 node_1 = node_0->get_child(node_0->context, 1);
6551 node_1->layout.position[CSS_TOP] = 0;
6552 node_1->layout.position[CSS_LEFT] = 120;
6553 node_1->layout.dimensions[CSS_WIDTH] = 120;
6554 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6555 node_1 = node_0->get_child(node_0->context, 2);
6556 node_1->layout.position[CSS_TOP] = 0;
6557 node_1->layout.position[CSS_LEFT] = 240;
6558 node_1->layout.dimensions[CSS_WIDTH] = 120;
6559 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6563 test("should ignore flex size if fully min bound", root_node, root_layout);
6567 css_node_t *root_node = new_test_css_node();
6569 css_node_t *node_0 = root_node;
6570 node_0->style.direction = CSS_DIRECTION_RTL;
6571 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
6572 node_0->style.dimensions[CSS_WIDTH] = 300;
6573 node_0->style.dimensions[CSS_HEIGHT] = 200;
6574 init_css_node_children(node_0, 3);
6577 node_1 = node_0->get_child(node_0->context, 0);
6578 node_1->style.flex = 1;
6579 node_1->style.minDimensions[CSS_WIDTH] = 120;
6580 node_1 = node_0->get_child(node_0->context, 1);
6581 node_1->style.flex = 1;
6582 node_1->style.minDimensions[CSS_WIDTH] = 120;
6583 node_1 = node_0->get_child(node_0->context, 2);
6584 node_1->style.flex = 1;
6585 node_1->style.minDimensions[CSS_WIDTH] = 120;
6589 css_node_t *root_layout = new_test_css_node();
6591 css_node_t *node_0 = root_layout;
6592 node_0->layout.position[CSS_TOP] = 0;
6593 node_0->layout.position[CSS_LEFT] = 0;
6594 node_0->layout.dimensions[CSS_WIDTH] = 300;
6595 node_0->layout.dimensions[CSS_HEIGHT] = 200;
6596 init_css_node_children(node_0, 3);
6599 node_1 = node_0->get_child(node_0->context, 0);
6600 node_1->layout.position[CSS_TOP] = 0;
6601 node_1->layout.position[CSS_LEFT] = 180;
6602 node_1->layout.dimensions[CSS_WIDTH] = 120;
6603 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6604 node_1 = node_0->get_child(node_0->context, 1);
6605 node_1->layout.position[CSS_TOP] = 0;
6606 node_1->layout.position[CSS_LEFT] = 60;
6607 node_1->layout.dimensions[CSS_WIDTH] = 120;
6608 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6609 node_1 = node_0->get_child(node_0->context, 2);
6610 node_1->layout.position[CSS_TOP] = 0;
6611 node_1->layout.position[CSS_LEFT] = -60;
6612 node_1->layout.dimensions[CSS_WIDTH] = 120;
6613 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6617 test("should ignore flex size if fully min bound in rtl", root_node, root_layout);
6621 css_node_t *root_node = new_test_css_node();
6623 css_node_t *node_0 = root_node;
6624 node_0->style.dimensions[CSS_WIDTH] = 300;
6625 node_0->style.dimensions[CSS_HEIGHT] = 200;
6626 init_css_node_children(node_0, 1);
6629 node_1 = node_0->get_child(node_0->context, 0);
6630 node_1->style.flex = 1;
6631 node_1->style.maxDimensions[CSS_WIDTH] = 310;
6632 node_1->style.minDimensions[CSS_WIDTH] = 290;
6636 css_node_t *root_layout = new_test_css_node();
6638 css_node_t *node_0 = root_layout;
6639 node_0->layout.position[CSS_TOP] = 0;
6640 node_0->layout.position[CSS_LEFT] = 0;
6641 node_0->layout.dimensions[CSS_WIDTH] = 300;
6642 node_0->layout.dimensions[CSS_HEIGHT] = 200;
6643 init_css_node_children(node_0, 1);
6646 node_1 = node_0->get_child(node_0->context, 0);
6647 node_1->layout.position[CSS_TOP] = 0;
6648 node_1->layout.position[CSS_LEFT] = 0;
6649 node_1->layout.dimensions[CSS_WIDTH] = 300;
6650 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6654 test("should pre-fill child size within bounds", root_node, root_layout);
6658 css_node_t *root_node = new_test_css_node();
6660 css_node_t *node_0 = root_node;
6661 node_0->style.dimensions[CSS_WIDTH] = 300;
6662 node_0->style.dimensions[CSS_HEIGHT] = 200;
6663 init_css_node_children(node_0, 1);
6666 node_1 = node_0->get_child(node_0->context, 0);
6667 node_1->style.flex = 1;
6668 node_1->style.maxDimensions[CSS_WIDTH] = 290;
6672 css_node_t *root_layout = new_test_css_node();
6674 css_node_t *node_0 = root_layout;
6675 node_0->layout.position[CSS_TOP] = 0;
6676 node_0->layout.position[CSS_LEFT] = 0;
6677 node_0->layout.dimensions[CSS_WIDTH] = 300;
6678 node_0->layout.dimensions[CSS_HEIGHT] = 200;
6679 init_css_node_children(node_0, 1);
6682 node_1 = node_0->get_child(node_0->context, 0);
6683 node_1->layout.position[CSS_TOP] = 0;
6684 node_1->layout.position[CSS_LEFT] = 0;
6685 node_1->layout.dimensions[CSS_WIDTH] = 290;
6686 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6690 test("should pre-fill child size within max bound", root_node, root_layout);
6694 css_node_t *root_node = new_test_css_node();
6696 css_node_t *node_0 = root_node;
6697 node_0->style.dimensions[CSS_WIDTH] = 300;
6698 node_0->style.dimensions[CSS_HEIGHT] = 200;
6699 init_css_node_children(node_0, 1);
6702 node_1 = node_0->get_child(node_0->context, 0);
6703 node_1->style.flex = 1;
6704 node_1->style.minDimensions[CSS_WIDTH] = 310;
6708 css_node_t *root_layout = new_test_css_node();
6710 css_node_t *node_0 = root_layout;
6711 node_0->layout.position[CSS_TOP] = 0;
6712 node_0->layout.position[CSS_LEFT] = 0;
6713 node_0->layout.dimensions[CSS_WIDTH] = 300;
6714 node_0->layout.dimensions[CSS_HEIGHT] = 200;
6715 init_css_node_children(node_0, 1);
6718 node_1 = node_0->get_child(node_0->context, 0);
6719 node_1->layout.position[CSS_TOP] = 0;
6720 node_1->layout.position[CSS_LEFT] = 0;
6721 node_1->layout.dimensions[CSS_WIDTH] = 310;
6722 node_1->layout.dimensions[CSS_HEIGHT] = 200;
6726 test("should pre-fill child size within min bounds", root_node, root_layout);
6730 css_node_t *root_node = new_test_css_node();
6732 css_node_t *node_0 = root_node;
6733 node_0->style.maxDimensions[CSS_WIDTH] = 300;
6734 node_0->style.maxDimensions[CSS_HEIGHT] = 700;
6735 node_0->style.minDimensions[CSS_WIDTH] = 100;
6736 node_0->style.minDimensions[CSS_HEIGHT] = 500;
6737 init_css_node_children(node_0, 2);
6740 node_1 = node_0->get_child(node_0->context, 0);
6741 node_1->style.dimensions[CSS_WIDTH] = 200;
6742 node_1->style.dimensions[CSS_HEIGHT] = 300;
6743 node_1 = node_0->get_child(node_0->context, 1);
6744 node_1->style.dimensions[CSS_WIDTH] = 200;
6745 node_1->style.dimensions[CSS_HEIGHT] = 300;
6749 css_node_t *root_layout = new_test_css_node();
6751 css_node_t *node_0 = root_layout;
6752 node_0->layout.position[CSS_TOP] = 0;
6753 node_0->layout.position[CSS_LEFT] = 0;
6754 node_0->layout.dimensions[CSS_WIDTH] = 200;
6755 node_0->layout.dimensions[CSS_HEIGHT] = 600;
6756 init_css_node_children(node_0, 2);
6759 node_1 = node_0->get_child(node_0->context, 0);
6760 node_1->layout.position[CSS_TOP] = 0;
6761 node_1->layout.position[CSS_LEFT] = 0;
6762 node_1->layout.dimensions[CSS_WIDTH] = 200;
6763 node_1->layout.dimensions[CSS_HEIGHT] = 300;
6764 node_1 = node_0->get_child(node_0->context, 1);
6765 node_1->layout.position[CSS_TOP] = 300;
6766 node_1->layout.position[CSS_LEFT] = 0;
6767 node_1->layout.dimensions[CSS_WIDTH] = 200;
6768 node_1->layout.dimensions[CSS_HEIGHT] = 300;
6772 test("should set parents size based on bounded children", root_node, root_layout);
6776 css_node_t *root_node = new_test_css_node();
6778 css_node_t *node_0 = root_node;
6779 node_0->style.maxDimensions[CSS_WIDTH] = 100;
6780 node_0->style.maxDimensions[CSS_HEIGHT] = 500;
6781 init_css_node_children(node_0, 2);
6784 node_1 = node_0->get_child(node_0->context, 0);
6785 node_1->style.dimensions[CSS_WIDTH] = 200;
6786 node_1->style.dimensions[CSS_HEIGHT] = 300;
6787 node_1 = node_0->get_child(node_0->context, 1);
6788 node_1->style.dimensions[CSS_WIDTH] = 200;
6789 node_1->style.dimensions[CSS_HEIGHT] = 300;
6793 css_node_t *root_layout = new_test_css_node();
6795 css_node_t *node_0 = root_layout;
6796 node_0->layout.position[CSS_TOP] = 0;
6797 node_0->layout.position[CSS_LEFT] = 0;
6798 node_0->layout.dimensions[CSS_WIDTH] = 100;
6799 node_0->layout.dimensions[CSS_HEIGHT] = 500;
6800 init_css_node_children(node_0, 2);
6803 node_1 = node_0->get_child(node_0->context, 0);
6804 node_1->layout.position[CSS_TOP] = 0;
6805 node_1->layout.position[CSS_LEFT] = 0;
6806 node_1->layout.dimensions[CSS_WIDTH] = 200;
6807 node_1->layout.dimensions[CSS_HEIGHT] = 300;
6808 node_1 = node_0->get_child(node_0->context, 1);
6809 node_1->layout.position[CSS_TOP] = 300;
6810 node_1->layout.position[CSS_LEFT] = 0;
6811 node_1->layout.dimensions[CSS_WIDTH] = 200;
6812 node_1->layout.dimensions[CSS_HEIGHT] = 300;
6816 test("should set parents size based on max bounded children", root_node, root_layout);
6820 css_node_t *root_node = new_test_css_node();
6822 css_node_t *node_0 = root_node;
6823 node_0->style.minDimensions[CSS_WIDTH] = 300;
6824 node_0->style.minDimensions[CSS_HEIGHT] = 700;
6825 init_css_node_children(node_0, 2);
6828 node_1 = node_0->get_child(node_0->context, 0);
6829 node_1->style.dimensions[CSS_WIDTH] = 200;
6830 node_1->style.dimensions[CSS_HEIGHT] = 300;
6831 node_1 = node_0->get_child(node_0->context, 1);
6832 node_1->style.dimensions[CSS_WIDTH] = 200;
6833 node_1->style.dimensions[CSS_HEIGHT] = 300;
6837 css_node_t *root_layout = new_test_css_node();
6839 css_node_t *node_0 = root_layout;
6840 node_0->layout.position[CSS_TOP] = 0;
6841 node_0->layout.position[CSS_LEFT] = 0;
6842 node_0->layout.dimensions[CSS_WIDTH] = 300;
6843 node_0->layout.dimensions[CSS_HEIGHT] = 700;
6844 init_css_node_children(node_0, 2);
6847 node_1 = node_0->get_child(node_0->context, 0);
6848 node_1->layout.position[CSS_TOP] = 0;
6849 node_1->layout.position[CSS_LEFT] = 0;
6850 node_1->layout.dimensions[CSS_WIDTH] = 200;
6851 node_1->layout.dimensions[CSS_HEIGHT] = 300;
6852 node_1 = node_0->get_child(node_0->context, 1);
6853 node_1->layout.position[CSS_TOP] = 300;
6854 node_1->layout.position[CSS_LEFT] = 0;
6855 node_1->layout.dimensions[CSS_WIDTH] = 200;
6856 node_1->layout.dimensions[CSS_HEIGHT] = 300;
6860 test("should set parents size based on min bounded children", root_node, root_layout);
6864 css_node_t *root_node = new_test_css_node();
6866 css_node_t *node_0 = root_node;
6867 node_0->style.align_items = CSS_ALIGN_STRETCH;
6868 node_0->style.dimensions[CSS_WIDTH] = 1000;
6869 init_css_node_children(node_0, 1);
6872 node_1 = node_0->get_child(node_0->context, 0);
6873 node_1->style.dimensions[CSS_HEIGHT] = 100;
6874 node_1->style.maxDimensions[CSS_WIDTH] = 1100;
6875 node_1->style.maxDimensions[CSS_HEIGHT] = 110;
6876 node_1->style.minDimensions[CSS_WIDTH] = 900;
6877 node_1->style.minDimensions[CSS_HEIGHT] = 90;
6881 css_node_t *root_layout = new_test_css_node();
6883 css_node_t *node_0 = root_layout;
6884 node_0->layout.position[CSS_TOP] = 0;
6885 node_0->layout.position[CSS_LEFT] = 0;
6886 node_0->layout.dimensions[CSS_WIDTH] = 1000;
6887 node_0->layout.dimensions[CSS_HEIGHT] = 100;
6888 init_css_node_children(node_0, 1);
6891 node_1 = node_0->get_child(node_0->context, 0);
6892 node_1->layout.position[CSS_TOP] = 0;
6893 node_1->layout.position[CSS_LEFT] = 0;
6894 node_1->layout.dimensions[CSS_WIDTH] = 1000;
6895 node_1->layout.dimensions[CSS_HEIGHT] = 100;
6899 test("should keep stretched size within bounds", root_node, root_layout);
6903 css_node_t *root_node = new_test_css_node();
6905 css_node_t *node_0 = root_node;
6906 node_0->style.align_items = CSS_ALIGN_STRETCH;
6907 node_0->style.dimensions[CSS_WIDTH] = 1000;
6908 init_css_node_children(node_0, 1);
6911 node_1 = node_0->get_child(node_0->context, 0);
6912 node_1->style.dimensions[CSS_HEIGHT] = 100;
6913 node_1->style.maxDimensions[CSS_WIDTH] = 900;
6914 node_1->style.maxDimensions[CSS_HEIGHT] = 90;
6918 css_node_t *root_layout = new_test_css_node();
6920 css_node_t *node_0 = root_layout;
6921 node_0->layout.position[CSS_TOP] = 0;
6922 node_0->layout.position[CSS_LEFT] = 0;
6923 node_0->layout.dimensions[CSS_WIDTH] = 1000;
6924 node_0->layout.dimensions[CSS_HEIGHT] = 90;
6925 init_css_node_children(node_0, 1);
6928 node_1 = node_0->get_child(node_0->context, 0);
6929 node_1->layout.position[CSS_TOP] = 0;
6930 node_1->layout.position[CSS_LEFT] = 0;
6931 node_1->layout.dimensions[CSS_WIDTH] = 900;
6932 node_1->layout.dimensions[CSS_HEIGHT] = 90;
6936 test("should keep stretched size within max bounds", root_node, root_layout);
6940 css_node_t *root_node = new_test_css_node();
6942 css_node_t *node_0 = root_node;
6943 node_0->style.align_items = CSS_ALIGN_STRETCH;
6944 node_0->style.dimensions[CSS_WIDTH] = 1000;
6945 init_css_node_children(node_0, 1);
6948 node_1 = node_0->get_child(node_0->context, 0);
6949 node_1->style.dimensions[CSS_HEIGHT] = 100;
6950 node_1->style.minDimensions[CSS_WIDTH] = 1100;
6951 node_1->style.minDimensions[CSS_HEIGHT] = 110;
6955 css_node_t *root_layout = new_test_css_node();
6957 css_node_t *node_0 = root_layout;
6958 node_0->layout.position[CSS_TOP] = 0;
6959 node_0->layout.position[CSS_LEFT] = 0;
6960 node_0->layout.dimensions[CSS_WIDTH] = 1000;
6961 node_0->layout.dimensions[CSS_HEIGHT] = 110;
6962 init_css_node_children(node_0, 1);
6965 node_1 = node_0->get_child(node_0->context, 0);
6966 node_1->layout.position[CSS_TOP] = 0;
6967 node_1->layout.position[CSS_LEFT] = 0;
6968 node_1->layout.dimensions[CSS_WIDTH] = 1100;
6969 node_1->layout.dimensions[CSS_HEIGHT] = 110;
6973 test("should keep stretched size within min bounds", root_node, root_layout);
6977 css_node_t *root_node = new_test_css_node();
6979 css_node_t *node_0 = root_node;
6980 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
6981 node_0->style.dimensions[CSS_WIDTH] = 1000;
6982 init_css_node_children(node_0, 1);
6985 node_1 = node_0->get_child(node_0->context, 0);
6986 node_1->style.dimensions[CSS_HEIGHT] = 100;
6987 node_1->style.minDimensions[CSS_WIDTH] = 100;
6988 node_1->style.minDimensions[CSS_HEIGHT] = 110;
6992 css_node_t *root_layout = new_test_css_node();
6994 css_node_t *node_0 = root_layout;
6995 node_0->layout.position[CSS_TOP] = 0;
6996 node_0->layout.position[CSS_LEFT] = 0;
6997 node_0->layout.dimensions[CSS_WIDTH] = 1000;
6998 node_0->layout.dimensions[CSS_HEIGHT] = 110;
6999 init_css_node_children(node_0, 1);
7002 node_1 = node_0->get_child(node_0->context, 0);
7003 node_1->layout.position[CSS_TOP] = 0;
7004 node_1->layout.position[CSS_LEFT] = 0;
7005 node_1->layout.dimensions[CSS_WIDTH] = 100;
7006 node_1->layout.dimensions[CSS_HEIGHT] = 110;
7010 test("should keep cross axis size within min bounds", root_node, root_layout);
7014 css_node_t *root_node = new_test_css_node();
7016 css_node_t *node_0 = root_node;
7017 node_0->style.direction = CSS_DIRECTION_RTL;
7018 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
7019 node_0->style.dimensions[CSS_WIDTH] = 1000;
7020 init_css_node_children(node_0, 1);
7023 node_1 = node_0->get_child(node_0->context, 0);
7024 node_1->style.dimensions[CSS_HEIGHT] = 100;
7025 node_1->style.minDimensions[CSS_WIDTH] = 100;
7026 node_1->style.minDimensions[CSS_HEIGHT] = 110;
7030 css_node_t *root_layout = new_test_css_node();
7032 css_node_t *node_0 = root_layout;
7033 node_0->layout.position[CSS_TOP] = 0;
7034 node_0->layout.position[CSS_LEFT] = 0;
7035 node_0->layout.dimensions[CSS_WIDTH] = 1000;
7036 node_0->layout.dimensions[CSS_HEIGHT] = 110;
7037 init_css_node_children(node_0, 1);
7040 node_1 = node_0->get_child(node_0->context, 0);
7041 node_1->layout.position[CSS_TOP] = 0;
7042 node_1->layout.position[CSS_LEFT] = 900;
7043 node_1->layout.dimensions[CSS_WIDTH] = 100;
7044 node_1->layout.dimensions[CSS_HEIGHT] = 110;
7048 test("should keep cross axis size within min bounds in rtl", root_node, root_layout);
7052 css_node_t *root_node = new_test_css_node();
7054 css_node_t *node_0 = root_node;
7055 node_0->style.dimensions[CSS_WIDTH] = 1000;
7056 node_0->style.dimensions[CSS_HEIGHT] = 1000;
7057 init_css_node_children(node_0, 1);
7060 node_1 = node_0->get_child(node_0->context, 0);
7061 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
7062 node_1->style.maxDimensions[CSS_WIDTH] = 500;
7063 node_1->style.maxDimensions[CSS_HEIGHT] = 600;
7064 node_1->style.position[CSS_LEFT] = 100;
7065 node_1->style.position[CSS_TOP] = 100;
7066 node_1->style.position[CSS_RIGHT] = 100;
7067 node_1->style.position[CSS_BOTTOM] = 100;
7071 css_node_t *root_layout = new_test_css_node();
7073 css_node_t *node_0 = root_layout;
7074 node_0->layout.position[CSS_TOP] = 0;
7075 node_0->layout.position[CSS_LEFT] = 0;
7076 node_0->layout.dimensions[CSS_WIDTH] = 1000;
7077 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
7078 init_css_node_children(node_0, 1);
7081 node_1 = node_0->get_child(node_0->context, 0);
7082 node_1->layout.position[CSS_TOP] = 100;
7083 node_1->layout.position[CSS_LEFT] = 100;
7084 node_1->layout.dimensions[CSS_WIDTH] = 500;
7085 node_1->layout.dimensions[CSS_HEIGHT] = 600;
7089 test("should layout node with position absolute, top and left and max bounds", root_node, root_layout);
7093 css_node_t *root_node = new_test_css_node();
7095 css_node_t *node_0 = root_node;
7096 node_0->style.dimensions[CSS_WIDTH] = 1000;
7097 node_0->style.dimensions[CSS_HEIGHT] = 1000;
7098 init_css_node_children(node_0, 1);
7101 node_1 = node_0->get_child(node_0->context, 0);
7102 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
7103 node_1->style.minDimensions[CSS_WIDTH] = 900;
7104 node_1->style.minDimensions[CSS_HEIGHT] = 1000;
7105 node_1->style.position[CSS_LEFT] = 100;
7106 node_1->style.position[CSS_TOP] = 100;
7107 node_1->style.position[CSS_RIGHT] = 100;
7108 node_1->style.position[CSS_BOTTOM] = 100;
7112 css_node_t *root_layout = new_test_css_node();
7114 css_node_t *node_0 = root_layout;
7115 node_0->layout.position[CSS_TOP] = 0;
7116 node_0->layout.position[CSS_LEFT] = 0;
7117 node_0->layout.dimensions[CSS_WIDTH] = 1000;
7118 node_0->layout.dimensions[CSS_HEIGHT] = 1000;
7119 init_css_node_children(node_0, 1);
7122 node_1 = node_0->get_child(node_0->context, 0);
7123 node_1->layout.position[CSS_TOP] = 100;
7124 node_1->layout.position[CSS_LEFT] = 100;
7125 node_1->layout.dimensions[CSS_WIDTH] = 900;
7126 node_1->layout.dimensions[CSS_HEIGHT] = 1000;
7130 test("should layout node with position absolute, top and left and min bounds", root_node, root_layout);
7134 css_node_t *root_node = new_test_css_node();
7136 css_node_t *node_0 = root_node;
7137 node_0->style.dimensions[CSS_WIDTH] = 400;
7138 node_0->style.dimensions[CSS_HEIGHT] = 400;
7139 init_css_node_children(node_0, 1);
7142 node_1 = node_0->get_child(node_0->context, 0);
7143 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
7144 node_1->style.padding[CSS_LEFT] = 10;
7145 node_1->style.padding[CSS_TOP] = 10;
7146 node_1->style.padding[CSS_RIGHT] = 10;
7147 node_1->style.padding[CSS_BOTTOM] = 10;
7148 node_1->style.padding[CSS_START] = 10;
7149 node_1->style.padding[CSS_END] = 10;
7150 node_1->style.position[CSS_LEFT] = 100;
7151 node_1->style.position[CSS_TOP] = 100;
7152 node_1->style.position[CSS_RIGHT] = 100;
7153 node_1->style.position[CSS_BOTTOM] = 100;
7154 init_css_node_children(node_1, 1);
7157 node_2 = node_1->get_child(node_1->context, 0);
7158 node_2->style.position_type = CSS_POSITION_ABSOLUTE;
7159 node_2->style.position[CSS_LEFT] = 10;
7160 node_2->style.position[CSS_TOP] = 10;
7161 node_2->style.position[CSS_RIGHT] = 10;
7162 node_2->style.position[CSS_BOTTOM] = 10;
7167 css_node_t *root_layout = new_test_css_node();
7169 css_node_t *node_0 = root_layout;
7170 node_0->layout.position[CSS_TOP] = 0;
7171 node_0->layout.position[CSS_LEFT] = 0;
7172 node_0->layout.dimensions[CSS_WIDTH] = 400;
7173 node_0->layout.dimensions[CSS_HEIGHT] = 400;
7174 init_css_node_children(node_0, 1);
7177 node_1 = node_0->get_child(node_0->context, 0);
7178 node_1->layout.position[CSS_TOP] = 100;
7179 node_1->layout.position[CSS_LEFT] = 100;
7180 node_1->layout.dimensions[CSS_WIDTH] = 200;
7181 node_1->layout.dimensions[CSS_HEIGHT] = 200;
7182 init_css_node_children(node_1, 1);
7185 node_2 = node_1->get_child(node_1->context, 0);
7186 node_2->layout.position[CSS_TOP] = 10;
7187 node_2->layout.position[CSS_LEFT] = 10;
7188 node_2->layout.dimensions[CSS_WIDTH] = 180;
7189 node_2->layout.dimensions[CSS_HEIGHT] = 180;
7194 test("should layout absolutely positioned node with absolutely positioned padded parent", root_node, root_layout);
7198 css_node_t *root_node = new_test_css_node();
7200 css_node_t *node_0 = root_node;
7201 node_0->style.dimensions[CSS_WIDTH] = 400;
7202 node_0->style.dimensions[CSS_HEIGHT] = 400;
7203 init_css_node_children(node_0, 1);
7206 node_1 = node_0->get_child(node_0->context, 0);
7207 node_1->style.position_type = CSS_POSITION_ABSOLUTE;
7208 node_1->style.padding[CSS_LEFT] = 10;
7209 node_1->style.padding[CSS_TOP] = 10;
7210 node_1->style.padding[CSS_RIGHT] = 10;
7211 node_1->style.padding[CSS_BOTTOM] = 10;
7212 node_1->style.padding[CSS_START] = 10;
7213 node_1->style.padding[CSS_END] = 10;
7214 node_1->style.border[CSS_LEFT] = 1;
7215 node_1->style.border[CSS_TOP] = 1;
7216 node_1->style.border[CSS_RIGHT] = 1;
7217 node_1->style.border[CSS_BOTTOM] = 1;
7218 node_1->style.border[CSS_START] = 1;
7219 node_1->style.border[CSS_END] = 1;
7220 node_1->style.position[CSS_LEFT] = 100;
7221 node_1->style.position[CSS_TOP] = 100;
7222 node_1->style.position[CSS_RIGHT] = 100;
7223 node_1->style.position[CSS_BOTTOM] = 100;
7224 init_css_node_children(node_1, 1);
7227 node_2 = node_1->get_child(node_1->context, 0);
7228 node_2->style.position_type = CSS_POSITION_ABSOLUTE;
7229 node_2->style.position[CSS_LEFT] = 10;
7230 node_2->style.position[CSS_TOP] = 10;
7231 node_2->style.position[CSS_RIGHT] = 10;
7232 node_2->style.position[CSS_BOTTOM] = 10;
7237 css_node_t *root_layout = new_test_css_node();
7239 css_node_t *node_0 = root_layout;
7240 node_0->layout.position[CSS_TOP] = 0;
7241 node_0->layout.position[CSS_LEFT] = 0;
7242 node_0->layout.dimensions[CSS_WIDTH] = 400;
7243 node_0->layout.dimensions[CSS_HEIGHT] = 400;
7244 init_css_node_children(node_0, 1);
7247 node_1 = node_0->get_child(node_0->context, 0);
7248 node_1->layout.position[CSS_TOP] = 100;
7249 node_1->layout.position[CSS_LEFT] = 100;
7250 node_1->layout.dimensions[CSS_WIDTH] = 200;
7251 node_1->layout.dimensions[CSS_HEIGHT] = 200;
7252 init_css_node_children(node_1, 1);
7255 node_2 = node_1->get_child(node_1->context, 0);
7256 node_2->layout.position[CSS_TOP] = 11;
7257 node_2->layout.position[CSS_LEFT] = 11;
7258 node_2->layout.dimensions[CSS_WIDTH] = 178;
7259 node_2->layout.dimensions[CSS_HEIGHT] = 178;
7264 test("should layout absolutely positioned node with absolutely positioned padded and bordered parent", root_node, root_layout);
7268 css_node_t *root_node = new_test_css_node();
7270 css_node_t *node_0 = root_node;
7271 node_0->style.dimensions[CSS_WIDTH] = 400;
7272 node_0->style.dimensions[CSS_HEIGHT] = 400;
7273 init_css_node_children(node_0, 1);
7276 node_1 = node_0->get_child(node_0->context, 0);
7277 node_1->style.flex = 1;
7278 node_1->style.padding[CSS_LEFT] = 10;
7279 node_1->style.padding[CSS_TOP] = 10;
7280 node_1->style.padding[CSS_RIGHT] = 10;
7281 node_1->style.padding[CSS_BOTTOM] = 10;
7282 node_1->style.padding[CSS_START] = 10;
7283 node_1->style.padding[CSS_END] = 10;
7284 init_css_node_children(node_1, 1);
7287 node_2 = node_1->get_child(node_1->context, 0);
7288 node_2->style.position_type = CSS_POSITION_ABSOLUTE;
7289 node_2->style.position[CSS_LEFT] = 10;
7290 node_2->style.position[CSS_TOP] = 10;
7291 node_2->style.position[CSS_RIGHT] = 10;
7292 node_2->style.position[CSS_BOTTOM] = 10;
7297 css_node_t *root_layout = new_test_css_node();
7299 css_node_t *node_0 = root_layout;
7300 node_0->layout.position[CSS_TOP] = 0;
7301 node_0->layout.position[CSS_LEFT] = 0;
7302 node_0->layout.dimensions[CSS_WIDTH] = 400;
7303 node_0->layout.dimensions[CSS_HEIGHT] = 400;
7304 init_css_node_children(node_0, 1);
7307 node_1 = node_0->get_child(node_0->context, 0);
7308 node_1->layout.position[CSS_TOP] = 0;
7309 node_1->layout.position[CSS_LEFT] = 0;
7310 node_1->layout.dimensions[CSS_WIDTH] = 400;
7311 node_1->layout.dimensions[CSS_HEIGHT] = 400;
7312 init_css_node_children(node_1, 1);
7315 node_2 = node_1->get_child(node_1->context, 0);
7316 node_2->layout.position[CSS_TOP] = 10;
7317 node_2->layout.position[CSS_LEFT] = 10;
7318 node_2->layout.dimensions[CSS_WIDTH] = 380;
7319 node_2->layout.dimensions[CSS_HEIGHT] = 380;
7324 test("should layout absolutely positioned node with padded flex 1 parent", root_node, root_layout);
7328 css_node_t *root_node = new_test_css_node();
7330 css_node_t *node_0 = root_node;
7331 node_0->style.direction = CSS_DIRECTION_RTL;
7332 node_0->style.dimensions[CSS_WIDTH] = 200;
7333 node_0->style.dimensions[CSS_HEIGHT] = 200;
7334 init_css_node_children(node_0, 2);
7337 node_1 = node_0->get_child(node_0->context, 0);
7338 node_1->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
7339 init_css_node_children(node_1, 2);
7342 node_2 = node_1->get_child(node_1->context, 0);
7343 node_2->style.dimensions[CSS_WIDTH] = 50;
7344 node_2->style.dimensions[CSS_HEIGHT] = 50;
7345 node_2 = node_1->get_child(node_1->context, 1);
7346 node_2->style.dimensions[CSS_WIDTH] = 50;
7347 node_2->style.dimensions[CSS_HEIGHT] = 50;
7349 node_1 = node_0->get_child(node_0->context, 1);
7350 node_1->style.direction = CSS_DIRECTION_LTR;
7351 node_1->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
7352 init_css_node_children(node_1, 2);
7355 node_2 = node_1->get_child(node_1->context, 0);
7356 node_2->style.dimensions[CSS_WIDTH] = 50;
7357 node_2->style.dimensions[CSS_HEIGHT] = 50;
7358 node_2 = node_1->get_child(node_1->context, 1);
7359 node_2->style.dimensions[CSS_WIDTH] = 50;
7360 node_2->style.dimensions[CSS_HEIGHT] = 50;
7365 css_node_t *root_layout = new_test_css_node();
7367 css_node_t *node_0 = root_layout;
7368 node_0->layout.position[CSS_TOP] = 0;
7369 node_0->layout.position[CSS_LEFT] = 0;
7370 node_0->layout.dimensions[CSS_WIDTH] = 200;
7371 node_0->layout.dimensions[CSS_HEIGHT] = 200;
7372 init_css_node_children(node_0, 2);
7375 node_1 = node_0->get_child(node_0->context, 0);
7376 node_1->layout.position[CSS_TOP] = 0;
7377 node_1->layout.position[CSS_LEFT] = 0;
7378 node_1->layout.dimensions[CSS_WIDTH] = 200;
7379 node_1->layout.dimensions[CSS_HEIGHT] = 50;
7380 init_css_node_children(node_1, 2);
7383 node_2 = node_1->get_child(node_1->context, 0);
7384 node_2->layout.position[CSS_TOP] = 0;
7385 node_2->layout.position[CSS_LEFT] = 150;
7386 node_2->layout.dimensions[CSS_WIDTH] = 50;
7387 node_2->layout.dimensions[CSS_HEIGHT] = 50;
7388 node_2 = node_1->get_child(node_1->context, 1);
7389 node_2->layout.position[CSS_TOP] = 0;
7390 node_2->layout.position[CSS_LEFT] = 100;
7391 node_2->layout.dimensions[CSS_WIDTH] = 50;
7392 node_2->layout.dimensions[CSS_HEIGHT] = 50;
7394 node_1 = node_0->get_child(node_0->context, 1);
7395 node_1->layout.position[CSS_TOP] = 50;
7396 node_1->layout.position[CSS_LEFT] = 0;
7397 node_1->layout.dimensions[CSS_WIDTH] = 200;
7398 node_1->layout.dimensions[CSS_HEIGHT] = 50;
7399 init_css_node_children(node_1, 2);
7402 node_2 = node_1->get_child(node_1->context, 0);
7403 node_2->layout.position[CSS_TOP] = 0;
7404 node_2->layout.position[CSS_LEFT] = 0;
7405 node_2->layout.dimensions[CSS_WIDTH] = 50;
7406 node_2->layout.dimensions[CSS_HEIGHT] = 50;
7407 node_2 = node_1->get_child(node_1->context, 1);
7408 node_2->layout.position[CSS_TOP] = 0;
7409 node_2->layout.position[CSS_LEFT] = 50;
7410 node_2->layout.dimensions[CSS_WIDTH] = 50;
7411 node_2->layout.dimensions[CSS_HEIGHT] = 50;
7416 test("should layout nested nodes with mixed directions", root_node, root_layout);
7420 css_node_t *root_node = new_test_css_node();
7422 css_node_t *node_0 = root_node;
7423 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
7424 node_0->style.justify_content = CSS_JUSTIFY_SPACE_BETWEEN;
7425 node_0->style.flex_wrap = CSS_WRAP;
7426 node_0->style.dimensions[CSS_WIDTH] = 320;
7427 node_0->style.dimensions[CSS_HEIGHT] = 200;
7428 init_css_node_children(node_0, 6);
7431 node_1 = node_0->get_child(node_0->context, 0);
7432 node_1->style.dimensions[CSS_WIDTH] = 100;
7433 node_1->style.dimensions[CSS_HEIGHT] = 100;
7434 node_1 = node_0->get_child(node_0->context, 1);
7435 node_1->style.dimensions[CSS_WIDTH] = 100;
7436 node_1->style.dimensions[CSS_HEIGHT] = 100;
7437 node_1 = node_0->get_child(node_0->context, 2);
7438 node_1->style.dimensions[CSS_WIDTH] = 100;
7439 node_1->style.dimensions[CSS_HEIGHT] = 100;
7440 node_1 = node_0->get_child(node_0->context, 3);
7441 node_1->style.dimensions[CSS_WIDTH] = 100;
7442 node_1->style.dimensions[CSS_HEIGHT] = 100;
7443 node_1 = node_0->get_child(node_0->context, 4);
7444 node_1->style.dimensions[CSS_WIDTH] = 100;
7445 node_1->style.dimensions[CSS_HEIGHT] = 100;
7446 node_1 = node_0->get_child(node_0->context, 5);
7447 node_1->style.dimensions[CSS_WIDTH] = 100;
7448 node_1->style.dimensions[CSS_HEIGHT] = 100;
7452 css_node_t *root_layout = new_test_css_node();
7454 css_node_t *node_0 = root_layout;
7455 node_0->layout.position[CSS_TOP] = 0;
7456 node_0->layout.position[CSS_LEFT] = 0;
7457 node_0->layout.dimensions[CSS_WIDTH] = 320;
7458 node_0->layout.dimensions[CSS_HEIGHT] = 200;
7459 init_css_node_children(node_0, 6);
7462 node_1 = node_0->get_child(node_0->context, 0);
7463 node_1->layout.position[CSS_TOP] = 0;
7464 node_1->layout.position[CSS_LEFT] = 0;
7465 node_1->layout.dimensions[CSS_WIDTH] = 100;
7466 node_1->layout.dimensions[CSS_HEIGHT] = 100;
7467 node_1 = node_0->get_child(node_0->context, 1);
7468 node_1->layout.position[CSS_TOP] = 0;
7469 node_1->layout.position[CSS_LEFT] = 110;
7470 node_1->layout.dimensions[CSS_WIDTH] = 100;
7471 node_1->layout.dimensions[CSS_HEIGHT] = 100;
7472 node_1 = node_0->get_child(node_0->context, 2);
7473 node_1->layout.position[CSS_TOP] = 0;
7474 node_1->layout.position[CSS_LEFT] = 220;
7475 node_1->layout.dimensions[CSS_WIDTH] = 100;
7476 node_1->layout.dimensions[CSS_HEIGHT] = 100;
7477 node_1 = node_0->get_child(node_0->context, 3);
7478 node_1->layout.position[CSS_TOP] = 100;
7479 node_1->layout.position[CSS_LEFT] = 0;
7480 node_1->layout.dimensions[CSS_WIDTH] = 100;
7481 node_1->layout.dimensions[CSS_HEIGHT] = 100;
7482 node_1 = node_0->get_child(node_0->context, 4);
7483 node_1->layout.position[CSS_TOP] = 100;
7484 node_1->layout.position[CSS_LEFT] = 110;
7485 node_1->layout.dimensions[CSS_WIDTH] = 100;
7486 node_1->layout.dimensions[CSS_HEIGHT] = 100;
7487 node_1 = node_0->get_child(node_0->context, 5);
7488 node_1->layout.position[CSS_TOP] = 100;
7489 node_1->layout.position[CSS_LEFT] = 220;
7490 node_1->layout.dimensions[CSS_WIDTH] = 100;
7491 node_1->layout.dimensions[CSS_HEIGHT] = 100;
7495 test("should correctly space wrapped nodes", root_node, root_layout);
7499 css_node_t *root_node = new_test_css_node();
7501 css_node_t *node_0 = root_node;
7502 node_0->style.dimensions[CSS_WIDTH] = 200;
7503 node_0->style.padding[CSS_LEFT] = 5;
7504 node_0->style.padding[CSS_RIGHT] = 5;
7505 node_0->style.padding[CSS_START] = 15;
7506 node_0->style.padding[CSS_END] = 15;
7507 init_css_node_children(node_0, 1);
7510 node_1 = node_0->get_child(node_0->context, 0);
7511 node_1->style.dimensions[CSS_HEIGHT] = 50;
7515 css_node_t *root_layout = new_test_css_node();
7517 css_node_t *node_0 = root_layout;
7518 node_0->layout.position[CSS_TOP] = 0;
7519 node_0->layout.position[CSS_LEFT] = 0;
7520 node_0->layout.dimensions[CSS_WIDTH] = 200;
7521 node_0->layout.dimensions[CSS_HEIGHT] = 50;
7522 init_css_node_children(node_0, 1);
7525 node_1 = node_0->get_child(node_0->context, 0);
7526 node_1->layout.position[CSS_TOP] = 0;
7527 node_1->layout.position[CSS_LEFT] = 15;
7528 node_1->layout.dimensions[CSS_WIDTH] = 170;
7529 node_1->layout.dimensions[CSS_HEIGHT] = 50;
7533 test("should give start/end padding precedence over left/right padding", root_node, root_layout);
7537 css_node_t *root_node = new_test_css_node();
7539 css_node_t *node_0 = root_node;
7540 node_0->style.dimensions[CSS_WIDTH] = 200;
7541 init_css_node_children(node_0, 1);
7544 node_1 = node_0->get_child(node_0->context, 0);
7545 node_1->style.dimensions[CSS_HEIGHT] = 50;
7546 node_1->style.margin[CSS_LEFT] = 5;
7547 node_1->style.margin[CSS_RIGHT] = 5;
7548 node_1->style.margin[CSS_START] = 15;
7549 node_1->style.margin[CSS_END] = 15;
7553 css_node_t *root_layout = new_test_css_node();
7555 css_node_t *node_0 = root_layout;
7556 node_0->layout.position[CSS_TOP] = 0;
7557 node_0->layout.position[CSS_LEFT] = 0;
7558 node_0->layout.dimensions[CSS_WIDTH] = 200;
7559 node_0->layout.dimensions[CSS_HEIGHT] = 50;
7560 init_css_node_children(node_0, 1);
7563 node_1 = node_0->get_child(node_0->context, 0);
7564 node_1->layout.position[CSS_TOP] = 0;
7565 node_1->layout.position[CSS_LEFT] = 15;
7566 node_1->layout.dimensions[CSS_WIDTH] = 170;
7567 node_1->layout.dimensions[CSS_HEIGHT] = 50;
7571 test("should give start/end margin precedence over left/right margin", root_node, root_layout);
7575 css_node_t *root_node = new_test_css_node();
7577 css_node_t *node_0 = root_node;
7578 node_0->style.dimensions[CSS_WIDTH] = 200;
7579 node_0->style.border[CSS_LEFT] = 5;
7580 node_0->style.border[CSS_RIGHT] = 5;
7581 node_0->style.border[CSS_START] = 15;
7582 node_0->style.border[CSS_END] = 15;
7583 init_css_node_children(node_0, 1);
7586 node_1 = node_0->get_child(node_0->context, 0);
7587 node_1->style.dimensions[CSS_HEIGHT] = 50;
7591 css_node_t *root_layout = new_test_css_node();
7593 css_node_t *node_0 = root_layout;
7594 node_0->layout.position[CSS_TOP] = 0;
7595 node_0->layout.position[CSS_LEFT] = 0;
7596 node_0->layout.dimensions[CSS_WIDTH] = 200;
7597 node_0->layout.dimensions[CSS_HEIGHT] = 50;
7598 init_css_node_children(node_0, 1);
7601 node_1 = node_0->get_child(node_0->context, 0);
7602 node_1->layout.position[CSS_TOP] = 0;
7603 node_1->layout.position[CSS_LEFT] = 15;
7604 node_1->layout.dimensions[CSS_WIDTH] = 170;
7605 node_1->layout.dimensions[CSS_HEIGHT] = 50;
7609 test("should give start/end border precedence over left/right border", root_node, root_layout);
7613 css_node_t *root_node = new_test_css_node();
7615 css_node_t *node_0 = root_node;
7616 node_0->style.dimensions[CSS_WIDTH] = 200;
7617 node_0->style.padding[CSS_START] = 15;
7618 node_0->style.padding[CSS_END] = 5;
7619 init_css_node_children(node_0, 1);
7622 node_1 = node_0->get_child(node_0->context, 0);
7623 node_1->style.dimensions[CSS_HEIGHT] = 50;
7627 css_node_t *root_layout = new_test_css_node();
7629 css_node_t *node_0 = root_layout;
7630 node_0->layout.position[CSS_TOP] = 0;
7631 node_0->layout.position[CSS_LEFT] = 0;
7632 node_0->layout.dimensions[CSS_WIDTH] = 200;
7633 node_0->layout.dimensions[CSS_HEIGHT] = 50;
7634 init_css_node_children(node_0, 1);
7637 node_1 = node_0->get_child(node_0->context, 0);
7638 node_1->layout.position[CSS_TOP] = 0;
7639 node_1->layout.position[CSS_LEFT] = 15;
7640 node_1->layout.dimensions[CSS_WIDTH] = 180;
7641 node_1->layout.dimensions[CSS_HEIGHT] = 50;
7645 test("should layout node with correct start/end padding", root_node, root_layout);
7649 css_node_t *root_node = new_test_css_node();
7651 css_node_t *node_0 = root_node;
7652 node_0->style.direction = CSS_DIRECTION_RTL;
7653 node_0->style.dimensions[CSS_WIDTH] = 200;
7654 node_0->style.padding[CSS_START] = 15;
7655 node_0->style.padding[CSS_END] = 5;
7656 init_css_node_children(node_0, 1);
7659 node_1 = node_0->get_child(node_0->context, 0);
7660 node_1->style.dimensions[CSS_HEIGHT] = 50;
7664 css_node_t *root_layout = new_test_css_node();
7666 css_node_t *node_0 = root_layout;
7667 node_0->layout.position[CSS_TOP] = 0;
7668 node_0->layout.position[CSS_LEFT] = 0;
7669 node_0->layout.dimensions[CSS_WIDTH] = 200;
7670 node_0->layout.dimensions[CSS_HEIGHT] = 50;
7671 init_css_node_children(node_0, 1);
7674 node_1 = node_0->get_child(node_0->context, 0);
7675 node_1->layout.position[CSS_TOP] = 0;
7676 node_1->layout.position[CSS_LEFT] = 5;
7677 node_1->layout.dimensions[CSS_WIDTH] = 180;
7678 node_1->layout.dimensions[CSS_HEIGHT] = 50;
7682 test("should layout node with correct start/end padding in rtl", root_node, root_layout);
7686 css_node_t *root_node = new_test_css_node();
7688 css_node_t *node_0 = root_node;
7689 node_0->style.dimensions[CSS_WIDTH] = 200;
7690 init_css_node_children(node_0, 1);
7693 node_1 = node_0->get_child(node_0->context, 0);
7694 node_1->style.dimensions[CSS_HEIGHT] = 50;
7695 node_1->style.margin[CSS_START] = 15;
7696 node_1->style.margin[CSS_END] = 5;
7700 css_node_t *root_layout = new_test_css_node();
7702 css_node_t *node_0 = root_layout;
7703 node_0->layout.position[CSS_TOP] = 0;
7704 node_0->layout.position[CSS_LEFT] = 0;
7705 node_0->layout.dimensions[CSS_WIDTH] = 200;
7706 node_0->layout.dimensions[CSS_HEIGHT] = 50;
7707 init_css_node_children(node_0, 1);
7710 node_1 = node_0->get_child(node_0->context, 0);
7711 node_1->layout.position[CSS_TOP] = 0;
7712 node_1->layout.position[CSS_LEFT] = 15;
7713 node_1->layout.dimensions[CSS_WIDTH] = 180;
7714 node_1->layout.dimensions[CSS_HEIGHT] = 50;
7718 test("should layout node with correct start/end margin", root_node, root_layout);
7722 css_node_t *root_node = new_test_css_node();
7724 css_node_t *node_0 = root_node;
7725 node_0->style.dimensions[CSS_WIDTH] = 200;
7726 init_css_node_children(node_0, 1);
7729 node_1 = node_0->get_child(node_0->context, 0);
7730 node_1->style.direction = CSS_DIRECTION_RTL;
7731 node_1->style.dimensions[CSS_HEIGHT] = 50;
7732 node_1->style.margin[CSS_START] = 15;
7733 node_1->style.margin[CSS_END] = 5;
7737 css_node_t *root_layout = new_test_css_node();
7739 css_node_t *node_0 = root_layout;
7740 node_0->layout.position[CSS_TOP] = 0;
7741 node_0->layout.position[CSS_LEFT] = 0;
7742 node_0->layout.dimensions[CSS_WIDTH] = 200;
7743 node_0->layout.dimensions[CSS_HEIGHT] = 50;
7744 init_css_node_children(node_0, 1);
7747 node_1 = node_0->get_child(node_0->context, 0);
7748 node_1->layout.position[CSS_TOP] = 0;
7749 node_1->layout.position[CSS_LEFT] = 5;
7750 node_1->layout.dimensions[CSS_WIDTH] = 180;
7751 node_1->layout.dimensions[CSS_HEIGHT] = 50;
7755 test("should layout node with correct start/end margin in rtl", root_node, root_layout);
7759 css_node_t *root_node = new_test_css_node();
7761 css_node_t *node_0 = root_node;
7762 node_0->style.dimensions[CSS_WIDTH] = 200;
7763 node_0->style.border[CSS_START] = 15;
7764 node_0->style.border[CSS_END] = 5;
7765 init_css_node_children(node_0, 1);
7768 node_1 = node_0->get_child(node_0->context, 0);
7769 node_1->style.dimensions[CSS_HEIGHT] = 50;
7773 css_node_t *root_layout = new_test_css_node();
7775 css_node_t *node_0 = root_layout;
7776 node_0->layout.position[CSS_TOP] = 0;
7777 node_0->layout.position[CSS_LEFT] = 0;
7778 node_0->layout.dimensions[CSS_WIDTH] = 200;
7779 node_0->layout.dimensions[CSS_HEIGHT] = 50;
7780 init_css_node_children(node_0, 1);
7783 node_1 = node_0->get_child(node_0->context, 0);
7784 node_1->layout.position[CSS_TOP] = 0;
7785 node_1->layout.position[CSS_LEFT] = 15;
7786 node_1->layout.dimensions[CSS_WIDTH] = 180;
7787 node_1->layout.dimensions[CSS_HEIGHT] = 50;
7791 test("should layout node with correct start/end border", root_node, root_layout);
7795 css_node_t *root_node = new_test_css_node();
7797 css_node_t *node_0 = root_node;
7798 node_0->style.direction = CSS_DIRECTION_RTL;
7799 node_0->style.dimensions[CSS_WIDTH] = 200;
7800 node_0->style.border[CSS_START] = 15;
7801 node_0->style.border[CSS_END] = 5;
7802 init_css_node_children(node_0, 1);
7805 node_1 = node_0->get_child(node_0->context, 0);
7806 node_1->style.dimensions[CSS_HEIGHT] = 50;
7810 css_node_t *root_layout = new_test_css_node();
7812 css_node_t *node_0 = root_layout;
7813 node_0->layout.position[CSS_TOP] = 0;
7814 node_0->layout.position[CSS_LEFT] = 0;
7815 node_0->layout.dimensions[CSS_WIDTH] = 200;
7816 node_0->layout.dimensions[CSS_HEIGHT] = 50;
7817 init_css_node_children(node_0, 1);
7820 node_1 = node_0->get_child(node_0->context, 0);
7821 node_1->layout.position[CSS_TOP] = 0;
7822 node_1->layout.position[CSS_LEFT] = 5;
7823 node_1->layout.dimensions[CSS_WIDTH] = 180;
7824 node_1->layout.dimensions[CSS_HEIGHT] = 50;
7828 test("should layout node with correct start/end border in rtl", root_node, root_layout);
7832 css_node_t *root_node = new_test_css_node();
7834 css_node_t *node_0 = root_node;
7835 node_0->style.dimensions[CSS_WIDTH] = 200;
7836 init_css_node_children(node_0, 1);
7839 node_1 = node_0->get_child(node_0->context, 0);
7840 node_1->style.dimensions[CSS_WIDTH] = 0;
7844 css_node_t *root_layout = new_test_css_node();
7846 css_node_t *node_0 = root_layout;
7847 node_0->layout.position[CSS_TOP] = 0;
7848 node_0->layout.position[CSS_LEFT] = 0;
7849 node_0->layout.dimensions[CSS_WIDTH] = 200;
7850 node_0->layout.dimensions[CSS_HEIGHT] = 0;
7851 init_css_node_children(node_0, 1);
7854 node_1 = node_0->get_child(node_0->context, 0);
7855 node_1->layout.position[CSS_TOP] = 0;
7856 node_1->layout.position[CSS_LEFT] = 0;
7857 node_1->layout.dimensions[CSS_WIDTH] = 0;
7858 node_1->layout.dimensions[CSS_HEIGHT] = 0;
7862 test("should layout node with a 0 width", root_node, root_layout);
7866 css_node_t *root_node = new_test_css_node();
7868 css_node_t *node_0 = root_node;
7869 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
7870 node_0->style.align_items = CSS_ALIGN_FLEX_START;
7871 node_0->style.dimensions[CSS_WIDTH] = 100;
7872 node_0->style.dimensions[CSS_HEIGHT] = 10;
7873 init_css_node_children(node_0, 2);
7876 node_1 = node_0->get_child(node_0->context, 0);
7877 node_1->style.dimensions[CSS_WIDTH] = 50;
7878 node_1->style.dimensions[CSS_HEIGHT] = 10;
7879 node_1 = node_0->get_child(node_0->context, 1);
7880 node_1->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN;
7881 node_1->style.align_items = CSS_ALIGN_FLEX_START;
7882 node_1->style.flex = 1;
7883 node_1->style.dimensions[CSS_HEIGHT] = 10;
7884 init_css_node_children(node_1, 1);
7887 node_2 = node_1->get_child(node_1->context, 0);
7888 node_2->style.flex = 1;
7889 node_2->style.dimensions[CSS_HEIGHT] = 10;
7890 node_2->measure = measure;
7891 node_2->context = "measureWithMatchParent";
7896 css_node_t *root_layout = new_test_css_node();
7898 css_node_t *node_0 = root_layout;
7899 node_0->layout.position[CSS_TOP] = 0;
7900 node_0->layout.position[CSS_LEFT] = 0;
7901 node_0->layout.dimensions[CSS_WIDTH] = 100;
7902 node_0->layout.dimensions[CSS_HEIGHT] = 10;
7903 init_css_node_children(node_0, 2);
7906 node_1 = node_0->get_child(node_0->context, 0);
7907 node_1->layout.position[CSS_TOP] = 0;
7908 node_1->layout.position[CSS_LEFT] = 0;
7909 node_1->layout.dimensions[CSS_WIDTH] = 50;
7910 node_1->layout.dimensions[CSS_HEIGHT] = 10;
7911 node_1 = node_0->get_child(node_0->context, 1);
7912 node_1->layout.position[CSS_TOP] = 0;
7913 node_1->layout.position[CSS_LEFT] = 50;
7914 node_1->layout.dimensions[CSS_WIDTH] = 50;
7915 node_1->layout.dimensions[CSS_HEIGHT] = 10;
7916 init_css_node_children(node_1, 1);
7919 node_2 = node_1->get_child(node_1->context, 0);
7920 node_2->layout.position[CSS_TOP] = 0;
7921 node_2->layout.position[CSS_LEFT] = 0;
7922 node_2->layout.dimensions[CSS_WIDTH] = 50;
7923 node_2->layout.dimensions[CSS_HEIGHT] = 10;
7928 test("should correctly progagate size contraints from flexible parents", root_node, root_layout);
7932 css_node_t *root_node = new_test_css_node();
7934 css_node_t *node_0 = root_node;
7935 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
7936 node_0->style.align_items = CSS_ALIGN_STRETCH;
7937 node_0->style.dimensions[CSS_WIDTH] = 150;
7938 init_css_node_children(node_0, 2);
7941 node_1 = node_0->get_child(node_0->context, 0);
7942 node_1->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
7943 node_1->style.margin[CSS_LEFT] = 10;
7944 node_1->style.margin[CSS_TOP] = 10;
7945 init_css_node_children(node_1, 1);
7948 node_2 = node_1->get_child(node_1->context, 0);
7949 node_2->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
7950 init_css_node_children(node_2, 1);
7953 node_3 = node_2->get_child(node_2->context, 0);
7954 node_3->style.align_self = CSS_ALIGN_CENTER;
7957 node_1 = node_0->get_child(node_0->context, 1);
7958 node_1->style.dimensions[CSS_HEIGHT] = 150;
7962 css_node_t *root_layout = new_test_css_node();
7964 css_node_t *node_0 = root_layout;
7965 node_0->layout.position[CSS_TOP] = 0;
7966 node_0->layout.position[CSS_LEFT] = 0;
7967 node_0->layout.dimensions[CSS_WIDTH] = 150;
7968 node_0->layout.dimensions[CSS_HEIGHT] = 150;
7969 init_css_node_children(node_0, 2);
7972 node_1 = node_0->get_child(node_0->context, 0);
7973 node_1->layout.position[CSS_TOP] = 10;
7974 node_1->layout.position[CSS_LEFT] = 10;
7975 node_1->layout.dimensions[CSS_WIDTH] = 0;
7976 node_1->layout.dimensions[CSS_HEIGHT] = 140;
7977 init_css_node_children(node_1, 1);
7980 node_2 = node_1->get_child(node_1->context, 0);
7981 node_2->layout.position[CSS_TOP] = 0;
7982 node_2->layout.position[CSS_LEFT] = 0;
7983 node_2->layout.dimensions[CSS_WIDTH] = 0;
7984 node_2->layout.dimensions[CSS_HEIGHT] = 140;
7985 init_css_node_children(node_2, 1);
7988 node_3 = node_2->get_child(node_2->context, 0);
7989 node_3->layout.position[CSS_TOP] = 70;
7990 node_3->layout.position[CSS_LEFT] = 0;
7991 node_3->layout.dimensions[CSS_WIDTH] = 0;
7992 node_3->layout.dimensions[CSS_HEIGHT] = 0;
7995 node_1 = node_0->get_child(node_0->context, 1);
7996 node_1->layout.position[CSS_TOP] = 0;
7997 node_1->layout.position[CSS_LEFT] = 10;
7998 node_1->layout.dimensions[CSS_WIDTH] = 0;
7999 node_1->layout.dimensions[CSS_HEIGHT] = 150;
8003 test("should layout content of an item which is stretched late", root_node, root_layout);
8007 css_node_t *root_node = new_test_css_node();
8009 css_node_t *node_0 = root_node;
8010 init_css_node_children(node_0, 2);
8013 node_1 = node_0->get_child(node_0->context, 0);
8014 init_css_node_children(node_1, 1);
8017 node_2 = node_1->get_child(node_1->context, 0);
8018 node_2->style.dimensions[CSS_WIDTH] = 200;
8019 node_2->style.dimensions[CSS_HEIGHT] = 200;
8021 node_1 = node_0->get_child(node_0->context, 1);
8022 node_1->style.margin[CSS_LEFT] = 10;
8023 node_1->style.margin[CSS_TOP] = 10;
8024 init_css_node_children(node_1, 1);
8027 node_2 = node_1->get_child(node_1->context, 0);
8032 css_node_t *root_layout = new_test_css_node();
8034 css_node_t *node_0 = root_layout;
8035 node_0->layout.position[CSS_TOP] = 0;
8036 node_0->layout.position[CSS_LEFT] = 0;
8037 node_0->layout.dimensions[CSS_WIDTH] = 200;
8038 node_0->layout.dimensions[CSS_HEIGHT] = 210;
8039 init_css_node_children(node_0, 2);
8042 node_1 = node_0->get_child(node_0->context, 0);
8043 node_1->layout.position[CSS_TOP] = 0;
8044 node_1->layout.position[CSS_LEFT] = 0;
8045 node_1->layout.dimensions[CSS_WIDTH] = 200;
8046 node_1->layout.dimensions[CSS_HEIGHT] = 200;
8047 init_css_node_children(node_1, 1);
8050 node_2 = node_1->get_child(node_1->context, 0);
8051 node_2->layout.position[CSS_TOP] = 0;
8052 node_2->layout.position[CSS_LEFT] = 0;
8053 node_2->layout.dimensions[CSS_WIDTH] = 200;
8054 node_2->layout.dimensions[CSS_HEIGHT] = 200;
8056 node_1 = node_0->get_child(node_0->context, 1);
8057 node_1->layout.position[CSS_TOP] = 210;
8058 node_1->layout.position[CSS_LEFT] = 10;
8059 node_1->layout.dimensions[CSS_WIDTH] = 190;
8060 node_1->layout.dimensions[CSS_HEIGHT] = 0;
8061 init_css_node_children(node_1, 1);
8064 node_2 = node_1->get_child(node_1->context, 0);
8065 node_2->layout.position[CSS_TOP] = 0;
8066 node_2->layout.position[CSS_LEFT] = 0;
8067 node_2->layout.dimensions[CSS_WIDTH] = 190;
8068 node_2->layout.dimensions[CSS_HEIGHT] = 0;
8073 test("should layout items whose positioning is determined by sibling tree branches", root_node, root_layout);
8077 css_node_t *root_node = new_test_css_node();
8079 css_node_t *node_0 = root_node;
8080 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
8081 init_css_node_children(node_0, 3);
8084 node_1 = node_0->get_child(node_0->context, 0);
8085 node_1->style.align_self = CSS_ALIGN_FLEX_START;
8086 node_1->style.margin[CSS_LEFT] = 10;
8087 node_1->style.margin[CSS_TOP] = 10;
8088 node_1 = node_0->get_child(node_0->context, 1);
8089 node_1->style.align_self = CSS_ALIGN_STRETCH;
8090 node_1->style.dimensions[CSS_WIDTH] = 1;
8091 node_1 = node_0->get_child(node_0->context, 2);
8092 node_1->style.dimensions[CSS_HEIGHT] = 150;
8096 css_node_t *root_layout = new_test_css_node();
8098 css_node_t *node_0 = root_layout;
8099 node_0->layout.position[CSS_TOP] = 0;
8100 node_0->layout.position[CSS_LEFT] = 0;
8101 node_0->layout.dimensions[CSS_WIDTH] = 11;
8102 node_0->layout.dimensions[CSS_HEIGHT] = 150;
8103 init_css_node_children(node_0, 3);
8106 node_1 = node_0->get_child(node_0->context, 0);
8107 node_1->layout.position[CSS_TOP] = 10;
8108 node_1->layout.position[CSS_LEFT] = 10;
8109 node_1->layout.dimensions[CSS_WIDTH] = 0;
8110 node_1->layout.dimensions[CSS_HEIGHT] = 0;
8111 node_1 = node_0->get_child(node_0->context, 1);
8112 node_1->layout.position[CSS_TOP] = 0;
8113 node_1->layout.position[CSS_LEFT] = 10;
8114 node_1->layout.dimensions[CSS_WIDTH] = 1;
8115 node_1->layout.dimensions[CSS_HEIGHT] = 150;
8116 node_1 = node_0->get_child(node_0->context, 2);
8117 node_1->layout.position[CSS_TOP] = 0;
8118 node_1->layout.position[CSS_LEFT] = 11;
8119 node_1->layout.dimensions[CSS_WIDTH] = 0;
8120 node_1->layout.dimensions[CSS_HEIGHT] = 150;
8124 test("should layout child whose cross axis is undefined and whose alignSelf is stretch", root_node, root_layout);
8128 css_node_t *root_node = new_test_css_node();
8130 css_node_t *node_0 = root_node;
8131 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
8132 init_css_node_children(node_0, 2);
8135 node_1 = node_0->get_child(node_0->context, 0);
8136 init_css_node_children(node_1, 1);
8139 node_2 = node_1->get_child(node_1->context, 0);
8140 node_2->style.dimensions[CSS_WIDTH] = 100;
8141 node_2->style.dimensions[CSS_HEIGHT] = 100;
8143 node_1 = node_0->get_child(node_0->context, 1);
8144 node_1->style.dimensions[CSS_WIDTH] = 100;
8145 init_css_node_children(node_1, 1);
8148 node_2 = node_1->get_child(node_1->context, 0);
8149 node_2->style.flex_direction = CSS_FLEX_DIRECTION_COLUMN;
8150 node_2->style.align_items = CSS_ALIGN_CENTER;
8151 init_css_node_children(node_2, 1);
8154 node_3 = node_2->get_child(node_2->context, 0);
8155 node_3->style.dimensions[CSS_WIDTH] = 50;
8156 node_3->style.dimensions[CSS_HEIGHT] = 50;
8162 css_node_t *root_layout = new_test_css_node();
8164 css_node_t *node_0 = root_layout;
8165 node_0->layout.position[CSS_TOP] = 0;
8166 node_0->layout.position[CSS_LEFT] = 0;
8167 node_0->layout.dimensions[CSS_WIDTH] = 200;
8168 node_0->layout.dimensions[CSS_HEIGHT] = 100;
8169 init_css_node_children(node_0, 2);
8172 node_1 = node_0->get_child(node_0->context, 0);
8173 node_1->layout.position[CSS_TOP] = 0;
8174 node_1->layout.position[CSS_LEFT] = 0;
8175 node_1->layout.dimensions[CSS_WIDTH] = 100;
8176 node_1->layout.dimensions[CSS_HEIGHT] = 100;
8177 init_css_node_children(node_1, 1);
8180 node_2 = node_1->get_child(node_1->context, 0);
8181 node_2->layout.position[CSS_TOP] = 0;
8182 node_2->layout.position[CSS_LEFT] = 0;
8183 node_2->layout.dimensions[CSS_WIDTH] = 100;
8184 node_2->layout.dimensions[CSS_HEIGHT] = 100;
8186 node_1 = node_0->get_child(node_0->context, 1);
8187 node_1->layout.position[CSS_TOP] = 0;
8188 node_1->layout.position[CSS_LEFT] = 100;
8189 node_1->layout.dimensions[CSS_WIDTH] = 100;
8190 node_1->layout.dimensions[CSS_HEIGHT] = 100;
8191 init_css_node_children(node_1, 1);
8194 node_2 = node_1->get_child(node_1->context, 0);
8195 node_2->layout.position[CSS_TOP] = 0;
8196 node_2->layout.position[CSS_LEFT] = 0;
8197 node_2->layout.dimensions[CSS_WIDTH] = 100;
8198 node_2->layout.dimensions[CSS_HEIGHT] = 50;
8199 init_css_node_children(node_2, 1);
8202 node_3 = node_2->get_child(node_2->context, 0);
8203 node_3->layout.position[CSS_TOP] = 0;
8204 node_3->layout.position[CSS_LEFT] = 25;
8205 node_3->layout.dimensions[CSS_WIDTH] = 50;
8206 node_3->layout.dimensions[CSS_HEIGHT] = 50;
8212 test("should center items correctly inside a stretched layout", root_node, root_layout);
8216 css_node_t *root_node = new_test_css_node();
8218 css_node_t *node_0 = root_node;
8219 node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
8220 node_0->style.align_content = CSS_ALIGN_STRETCH;
8221 node_0->style.align_items = CSS_ALIGN_FLEX_START;
8222 node_0->style.flex_wrap = CSS_WRAP;
8223 node_0->style.dimensions[CSS_WIDTH] = 300;
8224 node_0->style.dimensions[CSS_HEIGHT] = 380;
8225 init_css_node_children(node_0, 15);
8228 node_1 = node_0->get_child(node_0->context, 0);
8229 node_1->style.dimensions[CSS_WIDTH] = 50;
8230 node_1->style.dimensions[CSS_HEIGHT] = 50;
8231 node_1->style.margin[CSS_LEFT] = 10;
8232 node_1->style.margin[CSS_TOP] = 10;
8233 node_1->style.margin[CSS_RIGHT] = 10;
8234 node_1->style.margin[CSS_BOTTOM] = 10;
8235 node_1->style.margin[CSS_START] = 10;
8236 node_1->style.margin[CSS_END] = 10;
8237 node_1 = node_0->get_child(node_0->context, 1);
8238 node_1->style.dimensions[CSS_WIDTH] = 50;
8239 node_1->style.dimensions[CSS_HEIGHT] = 50;
8240 node_1->style.margin[CSS_LEFT] = 10;
8241 node_1->style.margin[CSS_TOP] = 10;
8242 node_1->style.margin[CSS_RIGHT] = 10;
8243 node_1->style.margin[CSS_BOTTOM] = 10;
8244 node_1->style.margin[CSS_START] = 10;
8245 node_1->style.margin[CSS_END] = 10;
8246 node_1 = node_0->get_child(node_0->context, 2);
8247 node_1->style.dimensions[CSS_WIDTH] = 50;
8248 node_1->style.dimensions[CSS_HEIGHT] = 50;
8249 node_1->style.margin[CSS_LEFT] = 10;
8250 node_1->style.margin[CSS_TOP] = 10;
8251 node_1->style.margin[CSS_RIGHT] = 10;
8252 node_1->style.margin[CSS_BOTTOM] = 10;
8253 node_1->style.margin[CSS_START] = 10;
8254 node_1->style.margin[CSS_END] = 10;
8255 node_1 = node_0->get_child(node_0->context, 3);
8256 node_1->style.dimensions[CSS_WIDTH] = 50;
8257 node_1->style.dimensions[CSS_HEIGHT] = 50;
8258 node_1->style.margin[CSS_LEFT] = 10;
8259 node_1->style.margin[CSS_TOP] = 10;
8260 node_1->style.margin[CSS_RIGHT] = 10;
8261 node_1->style.margin[CSS_BOTTOM] = 10;
8262 node_1->style.margin[CSS_START] = 10;
8263 node_1->style.margin[CSS_END] = 10;
8264 node_1 = node_0->get_child(node_0->context, 4);
8265 node_1->style.dimensions[CSS_WIDTH] = 50;
8266 node_1->style.dimensions[CSS_HEIGHT] = 100;
8267 node_1->style.margin[CSS_LEFT] = 10;
8268 node_1->style.margin[CSS_TOP] = 10;
8269 node_1->style.margin[CSS_RIGHT] = 10;
8270 node_1->style.margin[CSS_BOTTOM] = 10;
8271 node_1->style.margin[CSS_START] = 10;
8272 node_1->style.margin[CSS_END] = 10;
8273 node_1 = node_0->get_child(node_0->context, 5);
8274 node_1->style.align_self = CSS_ALIGN_FLEX_START;
8275 node_1->style.dimensions[CSS_WIDTH] = 50;
8276 node_1->style.dimensions[CSS_HEIGHT] = 50;
8277 node_1->style.margin[CSS_LEFT] = 10;
8278 node_1->style.margin[CSS_TOP] = 10;
8279 node_1->style.margin[CSS_RIGHT] = 10;
8280 node_1->style.margin[CSS_BOTTOM] = 10;
8281 node_1->style.margin[CSS_START] = 10;
8282 node_1->style.margin[CSS_END] = 10;
8283 node_1 = node_0->get_child(node_0->context, 6);
8284 node_1->style.dimensions[CSS_WIDTH] = 50;
8285 node_1->style.dimensions[CSS_HEIGHT] = 50;
8286 node_1->style.margin[CSS_LEFT] = 10;
8287 node_1->style.margin[CSS_TOP] = 10;
8288 node_1->style.margin[CSS_RIGHT] = 10;
8289 node_1->style.margin[CSS_BOTTOM] = 10;
8290 node_1->style.margin[CSS_START] = 10;
8291 node_1->style.margin[CSS_END] = 10;
8292 node_1 = node_0->get_child(node_0->context, 7);
8293 node_1->style.dimensions[CSS_WIDTH] = 50;
8294 node_1->style.dimensions[CSS_HEIGHT] = 100;
8295 node_1->style.margin[CSS_LEFT] = 10;
8296 node_1->style.margin[CSS_TOP] = 10;
8297 node_1->style.margin[CSS_RIGHT] = 10;
8298 node_1->style.margin[CSS_BOTTOM] = 10;
8299 node_1->style.margin[CSS_START] = 10;
8300 node_1->style.margin[CSS_END] = 10;
8301 node_1 = node_0->get_child(node_0->context, 8);
8302 node_1->style.dimensions[CSS_WIDTH] = 50;
8303 node_1->style.dimensions[CSS_HEIGHT] = 50;
8304 node_1->style.margin[CSS_LEFT] = 10;
8305 node_1->style.margin[CSS_TOP] = 10;
8306 node_1->style.margin[CSS_RIGHT] = 10;
8307 node_1->style.margin[CSS_BOTTOM] = 10;
8308 node_1->style.margin[CSS_START] = 10;
8309 node_1->style.margin[CSS_END] = 10;
8310 node_1 = node_0->get_child(node_0->context, 9);
8311 node_1->style.dimensions[CSS_WIDTH] = 50;
8312 node_1->style.dimensions[CSS_HEIGHT] = 50;
8313 node_1->style.margin[CSS_LEFT] = 10;
8314 node_1->style.margin[CSS_TOP] = 10;
8315 node_1->style.margin[CSS_RIGHT] = 10;
8316 node_1->style.margin[CSS_BOTTOM] = 10;
8317 node_1->style.margin[CSS_START] = 10;
8318 node_1->style.margin[CSS_END] = 10;
8319 node_1 = node_0->get_child(node_0->context, 10);
8320 node_1->style.align_self = CSS_ALIGN_FLEX_START;
8321 node_1->style.dimensions[CSS_WIDTH] = 50;
8322 node_1->style.dimensions[CSS_HEIGHT] = 50;
8323 node_1->style.margin[CSS_LEFT] = 10;
8324 node_1->style.margin[CSS_TOP] = 10;
8325 node_1->style.margin[CSS_RIGHT] = 10;
8326 node_1->style.margin[CSS_BOTTOM] = 10;
8327 node_1->style.margin[CSS_START] = 10;
8328 node_1->style.margin[CSS_END] = 10;
8329 node_1 = node_0->get_child(node_0->context, 11);
8330 node_1->style.dimensions[CSS_WIDTH] = 50;
8331 node_1->style.dimensions[CSS_HEIGHT] = 50;
8332 node_1->style.margin[CSS_LEFT] = 10;
8333 node_1->style.margin[CSS_TOP] = 10;
8334 node_1->style.margin[CSS_RIGHT] = 10;
8335 node_1->style.margin[CSS_BOTTOM] = 10;
8336 node_1->style.margin[CSS_START] = 10;
8337 node_1->style.margin[CSS_END] = 10;
8338 node_1 = node_0->get_child(node_0->context, 12);
8339 node_1->style.dimensions[CSS_WIDTH] = 50;
8340 node_1->style.dimensions[CSS_HEIGHT] = 50;
8341 node_1->style.margin[CSS_LEFT] = 10;
8342 node_1->style.margin[CSS_TOP] = 10;
8343 node_1->style.margin[CSS_RIGHT] = 10;
8344 node_1->style.margin[CSS_BOTTOM] = 10;
8345 node_1->style.margin[CSS_START] = 10;
8346 node_1->style.margin[CSS_END] = 10;
8347 node_1 = node_0->get_child(node_0->context, 13);
8348 node_1->style.align_self = CSS_ALIGN_FLEX_START;
8349 node_1->style.dimensions[CSS_WIDTH] = 50;
8350 node_1->style.dimensions[CSS_HEIGHT] = 50;
8351 node_1->style.margin[CSS_LEFT] = 10;
8352 node_1->style.margin[CSS_TOP] = 10;
8353 node_1->style.margin[CSS_RIGHT] = 10;
8354 node_1->style.margin[CSS_BOTTOM] = 10;
8355 node_1->style.margin[CSS_START] = 10;
8356 node_1->style.margin[CSS_END] = 10;
8357 node_1 = node_0->get_child(node_0->context, 14);
8358 node_1->style.dimensions[CSS_WIDTH] = 50;
8359 node_1->style.dimensions[CSS_HEIGHT] = 50;
8360 node_1->style.margin[CSS_LEFT] = 10;
8361 node_1->style.margin[CSS_TOP] = 10;
8362 node_1->style.margin[CSS_RIGHT] = 10;
8363 node_1->style.margin[CSS_BOTTOM] = 10;
8364 node_1->style.margin[CSS_START] = 10;
8365 node_1->style.margin[CSS_END] = 10;
8369 css_node_t *root_layout = new_test_css_node();
8371 css_node_t *node_0 = root_layout;
8372 node_0->layout.position[CSS_TOP] = 0;
8373 node_0->layout.position[CSS_LEFT] = 0;
8374 node_0->layout.dimensions[CSS_WIDTH] = 300;
8375 node_0->layout.dimensions[CSS_HEIGHT] = 380;
8376 init_css_node_children(node_0, 15);
8379 node_1 = node_0->get_child(node_0->context, 0);
8380 node_1->layout.position[CSS_TOP] = 10;
8381 node_1->layout.position[CSS_LEFT] = 10;
8382 node_1->layout.dimensions[CSS_WIDTH] = 50;
8383 node_1->layout.dimensions[CSS_HEIGHT] = 50;
8384 node_1 = node_0->get_child(node_0->context, 1);
8385 node_1->layout.position[CSS_TOP] = 10;
8386 node_1->layout.position[CSS_LEFT] = 80;
8387 node_1->layout.dimensions[CSS_WIDTH] = 50;
8388 node_1->layout.dimensions[CSS_HEIGHT] = 50;
8389 node_1 = node_0->get_child(node_0->context, 2);
8390 node_1->layout.position[CSS_TOP] = 10;
8391 node_1->layout.position[CSS_LEFT] = 150;
8392 node_1->layout.dimensions[CSS_WIDTH] = 50;
8393 node_1->layout.dimensions[CSS_HEIGHT] = 50;
8394 node_1 = node_0->get_child(node_0->context, 3);
8395 node_1->layout.position[CSS_TOP] = 10;
8396 node_1->layout.position[CSS_LEFT] = 220;
8397 node_1->layout.dimensions[CSS_WIDTH] = 50;
8398 node_1->layout.dimensions[CSS_HEIGHT] = 50;
8399 node_1 = node_0->get_child(node_0->context, 4);
8400 node_1->layout.position[CSS_TOP] = 92.5;
8401 node_1->layout.position[CSS_LEFT] = 10;
8402 node_1->layout.dimensions[CSS_WIDTH] = 50;
8403 node_1->layout.dimensions[CSS_HEIGHT] = 100;
8404 node_1 = node_0->get_child(node_0->context, 5);
8405 node_1->layout.position[CSS_TOP] = 92.5;
8406 node_1->layout.position[CSS_LEFT] = 80;
8407 node_1->layout.dimensions[CSS_WIDTH] = 50;
8408 node_1->layout.dimensions[CSS_HEIGHT] = 50;
8409 node_1 = node_0->get_child(node_0->context, 6);
8410 node_1->layout.position[CSS_TOP] = 92.5;
8411 node_1->layout.position[CSS_LEFT] = 150;
8412 node_1->layout.dimensions[CSS_WIDTH] = 50;
8413 node_1->layout.dimensions[CSS_HEIGHT] = 50;
8414 node_1 = node_0->get_child(node_0->context, 7);
8415 node_1->layout.position[CSS_TOP] = 92.5;
8416 node_1->layout.position[CSS_LEFT] = 220;
8417 node_1->layout.dimensions[CSS_WIDTH] = 50;
8418 node_1->layout.dimensions[CSS_HEIGHT] = 100;
8419 node_1 = node_0->get_child(node_0->context, 8);
8420 node_1->layout.position[CSS_TOP] = 225;
8421 node_1->layout.position[CSS_LEFT] = 10;
8422 node_1->layout.dimensions[CSS_WIDTH] = 50;
8423 node_1->layout.dimensions[CSS_HEIGHT] = 50;
8424 node_1 = node_0->get_child(node_0->context, 9);
8425 node_1->layout.position[CSS_TOP] = 225;
8426 node_1->layout.position[CSS_LEFT] = 80;
8427 node_1->layout.dimensions[CSS_WIDTH] = 50;
8428 node_1->layout.dimensions[CSS_HEIGHT] = 50;
8429 node_1 = node_0->get_child(node_0->context, 10);
8430 node_1->layout.position[CSS_TOP] = 225;
8431 node_1->layout.position[CSS_LEFT] = 150;
8432 node_1->layout.dimensions[CSS_WIDTH] = 50;
8433 node_1->layout.dimensions[CSS_HEIGHT] = 50;
8434 node_1 = node_0->get_child(node_0->context, 11);
8435 node_1->layout.position[CSS_TOP] = 225;
8436 node_1->layout.position[CSS_LEFT] = 220;
8437 node_1->layout.dimensions[CSS_WIDTH] = 50;
8438 node_1->layout.dimensions[CSS_HEIGHT] = 50;
8439 node_1 = node_0->get_child(node_0->context, 12);
8440 node_1->layout.position[CSS_TOP] = 307.5;
8441 node_1->layout.position[CSS_LEFT] = 10;
8442 node_1->layout.dimensions[CSS_WIDTH] = 50;
8443 node_1->layout.dimensions[CSS_HEIGHT] = 50;
8444 node_1 = node_0->get_child(node_0->context, 13);
8445 node_1->layout.position[CSS_TOP] = 307.5;
8446 node_1->layout.position[CSS_LEFT] = 80;
8447 node_1->layout.dimensions[CSS_WIDTH] = 50;
8448 node_1->layout.dimensions[CSS_HEIGHT] = 50;
8449 node_1 = node_0->get_child(node_0->context, 14);
8450 node_1->layout.position[CSS_TOP] = 307.5;
8451 node_1->layout.position[CSS_LEFT] = 150;
8452 node_1->layout.dimensions[CSS_WIDTH] = 50;
8453 node_1->layout.dimensions[CSS_HEIGHT] = 50;
8457 test("should layout with alignContent: stretch, and alignItems: flex-start", root_node, root_layout);
8459 /** END_GENERATED **/
8460 return tests_finished();