2014-10-29 08:01:22 -07:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2014, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
2014-04-18 16:35:37 -07:00
|
|
|
#include "../Layout.h"
|
2014-04-28 12:36:36 -07:00
|
|
|
#include "../Layout-test-utils.h"
|
2014-04-18 17:15:03 -07:00
|
|
|
|
2014-06-11 21:00:57 -07:00
|
|
|
// @generated by transpile.html
|
|
|
|
|
2014-04-18 16:35:37 -07:00
|
|
|
int main()
|
|
|
|
{
|
2014-09-26 16:22:44 -07:00
|
|
|
/** START_GENERATED **/
|
2014-04-18 17:15:03 -07:00
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 200;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 200;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout a single node with width and height", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 3);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 500;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 500;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 250;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 250;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 2);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 125;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 125;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 3);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 500;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 500;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 500;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 250;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 250;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 2);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 750;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 125;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 125;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with children", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-18 17:15:03 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 500;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 500;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 500;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 500;
|
|
|
|
init_css_node_children(node_1, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_2->style.dimensions[CSS_WIDTH] = 250;
|
|
|
|
node_2->style.dimensions[CSS_HEIGHT] = 250;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_2->style.dimensions[CSS_WIDTH] = 250;
|
|
|
|
node_2->style.dimensions[CSS_HEIGHT] = 250;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-18 17:15:03 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 500;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 500;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 500;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 500;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 500;
|
|
|
|
init_css_node_children(node_1, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_2->layout.position[CSS_TOP] = 0;
|
|
|
|
node_2->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_2->layout.dimensions[CSS_WIDTH] = 250;
|
|
|
|
node_2->layout.dimensions[CSS_HEIGHT] = 250;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_2->layout.position[CSS_TOP] = 250;
|
|
|
|
node_2->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_2->layout.dimensions[CSS_WIDTH] = 250;
|
|
|
|
node_2->layout.dimensions[CSS_HEIGHT] = 250;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with nested children", root_node, root_layout);
|
2014-04-18 17:15:03 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
|
2014-04-18 16:35:37 -07:00
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 200;
|
|
|
|
node_0->style.margin[CSS_LEFT] = 10;
|
|
|
|
node_0->style.margin[CSS_TOP] = 10;
|
|
|
|
node_0->style.margin[CSS_RIGHT] = 10;
|
|
|
|
node_0->style.margin[CSS_BOTTOM] = 10;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 10;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 10;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 200;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with margin", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-18 16:35:37 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
node_0->style.margin[CSS_LEFT] = 10;
|
|
|
|
node_0->style.margin[CSS_TOP] = 10;
|
|
|
|
node_0->style.margin[CSS_RIGHT] = 10;
|
|
|
|
node_0->style.margin[CSS_BOTTOM] = 10;
|
|
|
|
init_css_node_children(node_0, 3);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
node_1->style.margin[CSS_LEFT] = 50;
|
|
|
|
node_1->style.margin[CSS_TOP] = 50;
|
|
|
|
node_1->style.margin[CSS_RIGHT] = 50;
|
|
|
|
node_1->style.margin[CSS_BOTTOM] = 50;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
node_1->style.margin[CSS_LEFT] = 25;
|
|
|
|
node_1->style.margin[CSS_TOP] = 25;
|
|
|
|
node_1->style.margin[CSS_RIGHT] = 25;
|
|
|
|
node_1->style.margin[CSS_BOTTOM] = 25;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 2);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
node_1->style.margin[CSS_LEFT] = 10;
|
|
|
|
node_1->style.margin[CSS_TOP] = 10;
|
|
|
|
node_1->style.margin[CSS_RIGHT] = 10;
|
|
|
|
node_1->style.margin[CSS_BOTTOM] = 10;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 10;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 10;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 3);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 50;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 50;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 225;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 25;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 2);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 360;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 10;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with several children", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 200;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 300;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 150;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 200;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 300;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 150;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with row flex direction", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 300;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 200;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 300;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 150;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 300;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 350;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 200;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 200;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 300;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 150;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node based on children main dimensions", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 200;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
|
|
|
node_1->style.flex = 1;
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 200;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 200;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 800;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
2015-02-04 07:50:15 -08:00
|
|
|
test("should layout node with just flex", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-18 17:15:03 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.flex = 1;
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
init_css_node_children(node_1, 1);
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
|
|
|
node_2->style.flex = 1;
|
2014-05-16 18:04:24 -07:00
|
|
|
node_2->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
init_css_node_children(node_2, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_3;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_3 = node_2->get_child(node_2->context, 0);
|
|
|
|
node_3->style.flex = 1;
|
2014-05-16 18:04:24 -07:00
|
|
|
node_3->style.dimensions[CSS_WIDTH] = 1000;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-18 17:15:03 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_1, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_2->layout.position[CSS_TOP] = 0;
|
|
|
|
node_2->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_2->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_2->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_2, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_3;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_3 = node_2->get_child(node_2->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_3->layout.position[CSS_TOP] = 0;
|
|
|
|
node_3->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_3->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_3->layout.dimensions[CSS_HEIGHT] = 1000;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with flex recursively", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
node_0->style.margin[CSS_LEFT] = 5;
|
|
|
|
node_0->style.margin[CSS_TOP] = 10;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
node_1->style.margin[CSS_LEFT] = 15;
|
|
|
|
node_1->style.margin[CSS_TOP] = 50;
|
|
|
|
node_1->style.margin[CSS_BOTTOM] = 20;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
node_1->style.margin[CSS_LEFT] = 30;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 10;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 5;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 50;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 15;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 170;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 30;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with targeted margin", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.justify_content = CSS_JUSTIFY_FLEX_START;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 100;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with justifyContent: flex-start", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.justify_content = CSS_JUSTIFY_FLEX_END;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 800;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 900;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with justifyContent: flex-end", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.justify_content = CSS_JUSTIFY_SPACE_BETWEEN;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 900;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with justifyContent: space-between", root_node, root_layout);
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.justify_content = CSS_JUSTIFY_SPACE_AROUND;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 200;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 700;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with justifyContent: space-around", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.justify_content = CSS_JUSTIFY_CENTER;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 400;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 500;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with justifyContent: center", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-18 17:15:03 -07:00
|
|
|
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.flex = 1;
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-18 16:35:37 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 1000;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with flex override height", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-18 16:35:37 -07:00
|
|
|
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.align_items = CSS_ALIGN_FLEX_START;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 100;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with alignItems: flex-start", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.align_items = CSS_ALIGN_CENTER;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 400;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 100;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 450;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with alignItems: center", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.align_items = CSS_ALIGN_FLEX_END;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 800;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 100;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 900;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with alignItems: flex-end", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.align_items = CSS_ALIGN_FLEX_END;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.align_self = CSS_ALIGN_CENTER;
|
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 800;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 100;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 450;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with alignSelf overrides alignItems", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.align_items = CSS_ALIGN_STRETCH;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1000;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 1000;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with alignItem: stretch", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout empty node", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.margin[CSS_LEFT] = 5;
|
|
|
|
node_1->style.margin[CSS_TOP] = 5;
|
|
|
|
node_1->style.margin[CSS_RIGHT] = 5;
|
|
|
|
node_1->style.margin[CSS_BOTTOM] = 5;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 10;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 10;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 5;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 5;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout child with margin", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 200;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 100;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 200;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should not shrink children if not enough space", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.justify_content = CSS_JUSTIFY_CENTER;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout for center", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.justify_content = CSS_JUSTIFY_FLEX_END;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.margin[CSS_TOP] = 10;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 100;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout flex-end taking into account margin", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.align_items = CSS_ALIGN_FLEX_END;
|
|
|
|
init_css_node_children(node_1, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_2->style.margin[CSS_LEFT] = 10;
|
|
|
|
node_2->style.margin[CSS_TOP] = 10;
|
|
|
|
node_2->style.margin[CSS_RIGHT] = 10;
|
|
|
|
node_2->style.margin[CSS_BOTTOM] = 10;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_2->style.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 20;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 120;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 20;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 120;
|
|
|
|
init_css_node_children(node_1, 2);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_2->layout.position[CSS_TOP] = 10;
|
|
|
|
node_2->layout.position[CSS_LEFT] = 10;
|
|
|
|
node_2->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_2->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_2->layout.position[CSS_TOP] = 20;
|
|
|
|
node_2->layout.position[CSS_LEFT] = 20;
|
|
|
|
node_2->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_2->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout alignItems with margin", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.flex = 1;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout flex inside of an empty element", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.align_items = CSS_ALIGN_STRETCH;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.margin[CSS_LEFT] = 10;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 10;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 10;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout alignItems stretch and margin", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.padding[CSS_LEFT] = 5;
|
|
|
|
node_0->style.padding[CSS_TOP] = 5;
|
|
|
|
node_0->style.padding[CSS_RIGHT] = 5;
|
|
|
|
node_0->style.padding[CSS_BOTTOM] = 5;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 10;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 10;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with padding", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.padding[CSS_LEFT] = 5;
|
|
|
|
node_0->style.padding[CSS_TOP] = 5;
|
|
|
|
node_0->style.padding[CSS_RIGHT] = 5;
|
|
|
|
node_0->style.padding[CSS_BOTTOM] = 5;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 10;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 10;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 5;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 5;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with padding and a child", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.padding[CSS_LEFT] = 5;
|
|
|
|
node_0->style.padding[CSS_TOP] = 5;
|
|
|
|
node_0->style.padding[CSS_RIGHT] = 5;
|
|
|
|
node_0->style.padding[CSS_BOTTOM] = 5;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.margin[CSS_LEFT] = 5;
|
|
|
|
node_1->style.margin[CSS_TOP] = 5;
|
|
|
|
node_1->style.margin[CSS_RIGHT] = 5;
|
|
|
|
node_1->style.margin[CSS_BOTTOM] = 5;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 20;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 20;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 10;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 10;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with padding and a child with margin", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.align_self = CSS_ALIGN_STRETCH;
|
|
|
|
node_1->style.padding[CSS_LEFT] = 10;
|
|
|
|
node_1->style.padding[CSS_TOP] = 10;
|
|
|
|
node_1->style.padding[CSS_RIGHT] = 10;
|
|
|
|
node_1->style.padding[CSS_BOTTOM] = 10;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 20;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 20;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 20;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 20;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with padding and stretch", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.padding[CSS_LEFT] = 50;
|
|
|
|
node_0->style.padding[CSS_TOP] = 50;
|
|
|
|
node_0->style.padding[CSS_RIGHT] = 50;
|
|
|
|
node_0->style.padding[CSS_BOTTOM] = 50;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.align_self = CSS_ALIGN_STRETCH;
|
|
|
|
node_1->style.padding[CSS_LEFT] = 10;
|
|
|
|
node_1->style.padding[CSS_TOP] = 10;
|
|
|
|
node_1->style.padding[CSS_RIGHT] = 10;
|
|
|
|
node_1->style.padding[CSS_BOTTOM] = 10;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 120;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 120;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 50;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 50;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 20;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 20;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with inner & outer padding and stretch", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.align_self = CSS_ALIGN_STRETCH;
|
|
|
|
init_css_node_children(node_1, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_2->style.margin[CSS_LEFT] = 16;
|
|
|
|
node_2->style.margin[CSS_TOP] = 16;
|
|
|
|
node_2->style.margin[CSS_RIGHT] = 16;
|
|
|
|
node_2->style.margin[CSS_BOTTOM] = 16;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 32;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 32;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 32;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 32;
|
|
|
|
init_css_node_children(node_1, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_2->layout.position[CSS_TOP] = 16;
|
|
|
|
node_2->layout.position[CSS_LEFT] = 16;
|
|
|
|
node_2->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_2->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with stretch and child with margin", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.position[CSS_LEFT] = 5;
|
|
|
|
node_0->style.position[CSS_TOP] = 5;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 5;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 5;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with top and left", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 12:11:45 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.justify_content = CSS_JUSTIFY_SPACE_AROUND;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 10;
|
|
|
|
node_0->style.padding[CSS_TOP] = 5;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
2014-04-19 14:26:19 -07:00
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 10;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 7.5;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with height, padding and space-around", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.position[CSS_BOTTOM] = 5;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = -5;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with bottom", root_node, root_layout);
|
2014-04-19 12:11:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.position[CSS_TOP] = 10;
|
|
|
|
node_0->style.position[CSS_BOTTOM] = 5;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 14:26:19 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 10;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 14:26:19 -07:00
|
|
|
}
|
2014-04-19 14:35:54 -07:00
|
|
|
|
|
|
|
test("should layout node with both top and bottom", root_node, root_layout);
|
2014-04-18 17:15:03 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 500;
|
|
|
|
init_css_node_children(node_0, 3);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.flex = 1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 50;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 2);
|
|
|
|
node_1->style.flex = 1;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 500;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 3);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 250;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 250;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 50;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 2);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 250;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 250;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with position: absolute", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.margin[CSS_RIGHT] = 15;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with child with position: absolute and margin", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.align_self = CSS_ALIGN_CENTER;
|
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.padding[CSS_RIGHT] = 12;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 12;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with position: absolute, padding and alignSelf: center", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 5;
|
|
|
|
node_0->style.padding[CSS_BOTTOM] = 20;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 20;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should work with height smaller than paddingBottom", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 5;
|
|
|
|
node_0->style.padding[CSS_LEFT] = 20;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 20;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should work with width smaller than paddingLeft", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
init_css_node_children(node_1, 1);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_2->style.dimensions[CSS_WIDTH] = 400;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.align_self = CSS_ALIGN_STRETCH;
|
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 200;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 400;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 400;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_1, 1);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_2->layout.position[CSS_TOP] = 0;
|
|
|
|
node_2->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_2->layout.dimensions[CSS_WIDTH] = 400;
|
|
|
|
node_2->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with specified width and stretch", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.padding[CSS_LEFT] = 5;
|
|
|
|
node_0->style.padding[CSS_TOP] = 5;
|
|
|
|
node_0->style.padding[CSS_RIGHT] = 5;
|
|
|
|
node_0->style.padding[CSS_BOTTOM] = 5;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 10;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 10;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 5;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 5;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with padding and child with position absolute", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.position[CSS_LEFT] = 10;
|
|
|
|
node_1->style.position[CSS_TOP] = 10;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 10;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 10;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with position absolute, top and left", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.padding[CSS_LEFT] = 20;
|
|
|
|
node_0->style.padding[CSS_TOP] = 20;
|
|
|
|
node_0->style.padding[CSS_RIGHT] = 20;
|
|
|
|
node_0->style.padding[CSS_BOTTOM] = 20;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.position[CSS_LEFT] = 5;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 40;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 40;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 20;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 5;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with padding and child position absolute, left", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.margin[CSS_TOP] = 5;
|
|
|
|
node_1->style.position[CSS_TOP] = 5;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 10;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with position: absolute, top and marginTop", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.margin[CSS_LEFT] = 5;
|
|
|
|
node_1->style.position[CSS_LEFT] = 5;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 10;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with position: absolute, left and marginLeft", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.justify_content = CSS_JUSTIFY_SPACE_AROUND;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 200;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 200;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 100;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 100;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with space-around and child position absolute", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 700;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.flex = 1;
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.margin[CSS_LEFT] = 5;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 700;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 5;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 695;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with flex and main margin", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 700;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.flex = 1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
|
|
|
node_1->style.flex = 1;
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.padding[CSS_RIGHT] = 5;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 700;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 347.5;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 347.5;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 352.5;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with multiple flex and padding", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 700;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.flex = 1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
|
|
|
node_1->style.flex = 1;
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.margin[CSS_LEFT] = 5;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 700;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 347.5;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 352.5;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 347.5;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with multiple flex and margin", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 300;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 600;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
|
|
|
node_1->style.flex = 1;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 300;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 600;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 600;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with flex and overflow", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 600;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1->style.flex = 1;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 600;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with flex and position absolute", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 500;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.flex = 1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1->style.flex = 1;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 500;
|
|
|
|
init_css_node_children(node_0, 2);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 500;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 500;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with double flex and position absolute", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.border[CSS_LEFT] = 5;
|
|
|
|
node_0->style.border[CSS_TOP] = 5;
|
|
|
|
node_0->style.border[CSS_RIGHT] = 5;
|
|
|
|
node_0->style.border[CSS_BOTTOM] = 5;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 10;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 10;
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with borderWidth", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.border[CSS_TOP] = 1;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.position[CSS_TOP] = -1;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with borderWidth and position: absolute, top", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.border[CSS_LEFT] = 1;
|
|
|
|
node_0->style.border[CSS_TOP] = 1;
|
|
|
|
node_0->style.border[CSS_RIGHT] = 1;
|
|
|
|
node_0->style.border[CSS_BOTTOM] = 1;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.position[CSS_LEFT] = 5;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-19 22:08:10 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 2;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 2;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-22 13:18:05 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 1;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 6;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-22 13:18:05 -07:00
|
|
|
}
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
|
|
|
|
2014-04-22 13:18:05 -07:00
|
|
|
test("should layout node with borderWidth and position: absolute, top. cross axis", root_node, root_layout);
|
2014-04-19 22:08:10 -07:00
|
|
|
}
|
2014-04-22 14:59:59 -07:00
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 50;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.align_self = CSS_ALIGN_STRETCH;
|
|
|
|
node_1->style.margin[CSS_LEFT] = 20;
|
|
|
|
node_1->style.padding[CSS_LEFT] = 20;
|
|
|
|
node_1->style.padding[CSS_TOP] = 20;
|
|
|
|
node_1->style.padding[CSS_RIGHT] = 20;
|
|
|
|
node_1->style.padding[CSS_BOTTOM] = 20;
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 50;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 40;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 20;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 40;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 40;
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should correctly take into account min padding for stretch", root_node, root_layout);
|
|
|
|
}
|
|
|
|
|
2014-04-22 17:37:55 -07:00
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-22 17:37:55 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-22 17:37:55 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.border[CSS_RIGHT] = 5;
|
2014-04-22 17:37:55 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-22 17:37:55 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 5;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-22 17:37:55 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 5;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-22 17:37:55 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should layout node with negative width", root_node, root_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-22 17:37:55 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
|
|
|
|
node_0->style.border[CSS_RIGHT] = 1;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-22 17:37:55 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->style.margin[CSS_RIGHT] = -8;
|
2014-04-22 17:37:55 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-22 17:37:55 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 1;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-22 17:37:55 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
2014-04-22 17:37:55 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should handle negative margin and min padding correctly", root_node, root_layout);
|
|
|
|
}
|
|
|
|
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
2014-06-11 21:00:57 -07:00
|
|
|
node_0->measure = measure;
|
|
|
|
node_0->context = "small";
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
2014-09-25 16:05:01 -07:00
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 34.671875;
|
2014-05-16 18:04:24 -07:00
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 18;
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-04-28 12:34:04 -07:00
|
|
|
test("should layout node with just text", root_node, root_layout);
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 10;
|
2014-06-11 21:00:57 -07:00
|
|
|
node_0->measure = measure;
|
|
|
|
node_0->context = "small";
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 10;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 18;
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-04-28 12:34:04 -07:00
|
|
|
test("should layout node with text and width", root_node, root_layout);
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
2014-06-11 21:00:57 -07:00
|
|
|
node_0->measure = measure;
|
|
|
|
node_0->context = "loooooooooong with space";
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
2014-09-25 16:05:01 -07:00
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 172.421875;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 18;
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-04-28 12:34:04 -07:00
|
|
|
test("should layout node with text, padding and margin", root_node, root_layout);
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 300;
|
2014-05-16 18:04:24 -07:00
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-28 12:34:04 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->style.align_self = CSS_ALIGN_STRETCH;
|
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_2->style.align_self = CSS_ALIGN_STRETCH;
|
|
|
|
}
|
2014-04-28 12:34:04 -07:00
|
|
|
}
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 300;
|
2014-05-16 18:04:24 -07:00
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
2014-04-28 12:34:04 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-16 18:04:24 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 300;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_2->layout.position[CSS_TOP] = 0;
|
|
|
|
node_2->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_2->layout.dimensions[CSS_WIDTH] = 300;
|
|
|
|
node_2->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
}
|
2014-04-28 12:34:04 -07:00
|
|
|
}
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-06-04 10:51:23 -07:00
|
|
|
test("should layout node with nested alignSelf: stretch", root_node, root_layout);
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-05-19 12:39:27 -07:00
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-05-19 12:39:27 -07:00
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
|
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 500;
|
2014-05-19 12:39:27 -07:00
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
|
|
|
node_2->style.flex = 1;
|
2014-06-11 21:00:57 -07:00
|
|
|
node_2->measure = measure;
|
|
|
|
node_2->context = "loooooooooong with space";
|
2014-05-19 12:39:27 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-05-19 12:39:27 -07:00
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 500;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 18;
|
2014-05-19 12:39:27 -07:00
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-05-19 12:39:27 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 500;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 18;
|
2014-05-19 12:39:27 -07:00
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-05-19 12:39:27 -07:00
|
|
|
node_2->layout.position[CSS_TOP] = 0;
|
|
|
|
node_2->layout.position[CSS_LEFT] = 0;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_2->layout.dimensions[CSS_WIDTH] = 500;
|
|
|
|
node_2->layout.dimensions[CSS_HEIGHT] = 18;
|
2014-05-19 12:39:27 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-04 10:51:23 -07:00
|
|
|
test("should layout node with text and flex", root_node, root_layout);
|
2014-05-19 12:39:27 -07:00
|
|
|
}
|
|
|
|
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-06-04 10:51:23 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 130;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->style.align_items = CSS_ALIGN_STRETCH;
|
|
|
|
node_1->style.align_self = CSS_ALIGN_STRETCH;
|
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-06-11 21:00:57 -07:00
|
|
|
node_2->measure = measure;
|
|
|
|
node_2->context = "loooooooooong with space";
|
2014-06-04 10:51:23 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 130;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 36;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 130;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 36;
|
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_2->layout.position[CSS_TOP] = 0;
|
|
|
|
node_2->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_2->layout.dimensions[CSS_WIDTH] = 130;
|
|
|
|
node_2->layout.dimensions[CSS_HEIGHT] = 36;
|
|
|
|
}
|
|
|
|
}
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-06-04 10:51:23 -07:00
|
|
|
test("should layout node with text and stretch", root_node, root_layout);
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 200;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->style.align_items = CSS_ALIGN_STRETCH;
|
|
|
|
node_1->style.align_self = CSS_ALIGN_STRETCH;
|
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_2->style.dimensions[CSS_WIDTH] = 130;
|
2014-06-11 21:00:57 -07:00
|
|
|
node_2->measure = measure;
|
|
|
|
node_2->context = "loooooooooong with space";
|
2014-06-04 10:51:23 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 36;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 36;
|
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_2->layout.position[CSS_TOP] = 0;
|
|
|
|
node_2->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_2->layout.dimensions[CSS_WIDTH] = 130;
|
|
|
|
node_2->layout.dimensions[CSS_HEIGHT] = 36;
|
|
|
|
}
|
|
|
|
}
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-06-04 10:51:23 -07:00
|
|
|
test("should layout node with text stretch and width", root_node, root_layout);
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
2014-10-08 09:35:44 -07:00
|
|
|
node_0->style.align_self = CSS_ALIGN_FLEX_START;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-10-08 09:35:44 -07:00
|
|
|
node_1->style.align_self = CSS_ALIGN_FLEX_START;
|
2014-06-11 21:00:57 -07:00
|
|
|
node_1->measure = measure;
|
|
|
|
node_1->context = "loooooooooong with space";
|
2014-06-04 10:51:23 -07:00
|
|
|
}
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 36;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
2014-09-25 16:05:01 -07:00
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100.453125;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 36;
|
|
|
|
}
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-06-04 10:51:23 -07:00
|
|
|
test("should layout node with text bounded by parent", root_node, root_layout);
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
2014-10-08 09:35:44 -07:00
|
|
|
node_0->style.align_self = CSS_ALIGN_FLEX_START;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_0->style.padding[CSS_LEFT] = 10;
|
|
|
|
node_0->style.padding[CSS_TOP] = 10;
|
|
|
|
node_0->style.padding[CSS_RIGHT] = 10;
|
|
|
|
node_0->style.padding[CSS_BOTTOM] = 10;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-10-08 09:35:44 -07:00
|
|
|
node_1->style.align_self = CSS_ALIGN_FLEX_START;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->style.margin[CSS_LEFT] = 10;
|
|
|
|
node_1->style.margin[CSS_TOP] = 10;
|
|
|
|
node_1->style.margin[CSS_RIGHT] = 10;
|
|
|
|
node_1->style.margin[CSS_BOTTOM] = 10;
|
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-06-11 21:00:57 -07:00
|
|
|
node_2->measure = measure;
|
|
|
|
node_2->context = "loooooooooong with space";
|
2014-06-04 10:51:23 -07:00
|
|
|
}
|
|
|
|
}
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
2014-05-16 18:04:24 -07:00
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 76;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 20;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 20;
|
2014-09-25 16:05:01 -07:00
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100.453125;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 36;
|
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_2->layout.position[CSS_TOP] = 0;
|
|
|
|
node_2->layout.position[CSS_LEFT] = 0;
|
2014-09-25 16:05:01 -07:00
|
|
|
node_2->layout.dimensions[CSS_WIDTH] = 100.453125;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_2->layout.dimensions[CSS_HEIGHT] = 36;
|
|
|
|
}
|
|
|
|
}
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-06-04 10:51:23 -07:00
|
|
|
test("should layout node with text bounded by grand-parent", root_node, root_layout);
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_0->style.justify_content = CSS_JUSTIFY_SPACE_BETWEEN;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 2);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 900;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-06-04 10:51:23 -07:00
|
|
|
}
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_layout;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 2);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 900;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 900;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
}
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-06-04 10:51:23 -07:00
|
|
|
test("should layout space-between when remaining space is negative", root_node, root_layout);
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-04-22 14:59:59 -07:00
|
|
|
{
|
2014-05-16 18:04:24 -07:00
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_0->style.justify_content = CSS_JUSTIFY_FLEX_END;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 200;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 900;
|
|
|
|
}
|
2014-04-22 14:59:59 -07:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-06-04 10:51:23 -07:00
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = -700;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 900;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should layout flex-end when remaining space is negative", root_node, root_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-06-04 10:51:23 -07:00
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
|
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 200;
|
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_2->style.margin[CSS_LEFT] = 20;
|
|
|
|
node_2->style.margin[CSS_TOP] = 20;
|
|
|
|
node_2->style.margin[CSS_RIGHT] = 20;
|
|
|
|
node_2->style.margin[CSS_BOTTOM] = 20;
|
2014-06-11 21:00:57 -07:00
|
|
|
node_2->measure = measure;
|
|
|
|
node_2->context = "loooooooooong with space";
|
2014-06-04 10:51:23 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-06-04 10:51:23 -07:00
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 58;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 58;
|
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_2->layout.position[CSS_TOP] = 20;
|
|
|
|
node_2->layout.position[CSS_LEFT] = 20;
|
2014-09-25 16:05:01 -07:00
|
|
|
node_2->layout.dimensions[CSS_WIDTH] = 172.421875;
|
2014-06-04 10:51:23 -07:00
|
|
|
node_2->layout.dimensions[CSS_HEIGHT] = 18;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should layout text with flexDirection row", root_node, root_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
2014-06-04 10:51:23 -07:00
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 200;
|
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_2->style.margin[CSS_LEFT] = 20;
|
|
|
|
node_2->style.margin[CSS_TOP] = 20;
|
|
|
|
node_2->style.margin[CSS_RIGHT] = 20;
|
|
|
|
node_2->style.margin[CSS_BOTTOM] = 20;
|
2014-06-11 21:00:57 -07:00
|
|
|
node_2->measure = measure;
|
|
|
|
node_2->context = "loooooooooong with space";
|
2014-06-04 10:51:23 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_layout = new_test_css_node();
|
2014-06-04 10:51:23 -07:00
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 76;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 76;
|
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
2014-06-04 10:51:23 -07:00
|
|
|
node_2->layout.position[CSS_TOP] = 20;
|
|
|
|
node_2->layout.position[CSS_LEFT] = 20;
|
|
|
|
node_2->layout.dimensions[CSS_WIDTH] = 160;
|
|
|
|
node_2->layout.dimensions[CSS_HEIGHT] = 36;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should layout with text and margin", root_node, root_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-09-11 09:23:30 -07:00
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.position[CSS_LEFT] = 0;
|
|
|
|
node_1->style.position[CSS_TOP] = 0;
|
|
|
|
node_1->style.position[CSS_RIGHT] = 0;
|
|
|
|
node_1->style.position[CSS_BOTTOM] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should layout with position absolute, top, left, bottom, right", root_node, root_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
2014-10-08 09:35:44 -07:00
|
|
|
node_0->style.align_self = CSS_ALIGN_FLEX_START;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 2);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-10-08 09:35:44 -07:00
|
|
|
node_1->style.align_self = CSS_ALIGN_FLEX_START;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1->style.flex = 2.5;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-10-08 09:35:44 -07:00
|
|
|
node_1->style.align_self = CSS_ALIGN_FLEX_START;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1->style.flex = 7.5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 2);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 25;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
|
|
|
node_1->layout.position[CSS_TOP] = 25;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 75;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should layout with arbitrary flex", root_node, root_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
2014-10-08 09:35:44 -07:00
|
|
|
node_0->style.align_self = CSS_ALIGN_FLEX_START;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 2);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
2014-10-08 09:35:44 -07:00
|
|
|
node_1->style.align_self = CSS_ALIGN_FLEX_START;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
2014-10-08 09:35:44 -07:00
|
|
|
node_1->style.align_self = CSS_ALIGN_FLEX_START;
|
2014-09-11 09:23:30 -07:00
|
|
|
node_1->style.flex = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 2);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should layout with negative flex", root_node, root_layout);
|
|
|
|
}
|
|
|
|
|
2014-09-25 16:05:01 -07:00
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 2);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 50;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.position[CSS_LEFT] = 0;
|
|
|
|
node_1->style.position[CSS_RIGHT] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 50;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 2);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 50;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
|
|
|
node_1->layout.position[CSS_TOP] = 100;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 50;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-29 14:07:47 -07:00
|
|
|
test("should layout with position: absolute and another sibling", root_node, root_layout);
|
2014-09-25 16:05:01 -07:00
|
|
|
}
|
2014-09-30 13:11:32 -07:00
|
|
|
|
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.position[CSS_TOP] = 0;
|
|
|
|
node_1->style.position[CSS_BOTTOM] = 20;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
2014-09-30 15:24:42 -07:00
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
2014-09-30 13:11:32 -07:00
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 80;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-30 15:24:42 -07:00
|
|
|
test("should calculate height properly with position: absolute top and bottom", root_node, root_layout);
|
2014-09-30 13:11:32 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 200;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.justify_content = CSS_JUSTIFY_CENTER;
|
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.position[CSS_LEFT] = 0;
|
|
|
|
node_1->style.position[CSS_TOP] = 0;
|
|
|
|
node_1->style.position[CSS_RIGHT] = 0;
|
|
|
|
node_1->style.position[CSS_BOTTOM] = 0;
|
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
|
|
|
node_2->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_2->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 200;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 200;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 200;
|
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
|
|
|
node_2->layout.position[CSS_TOP] = 50;
|
|
|
|
node_2->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_2->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_2->layout.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should layout with complicated position: absolute and justifyContent: center combo", root_node, root_layout);
|
|
|
|
}
|
2014-09-30 15:24:42 -07:00
|
|
|
|
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.position[CSS_BOTTOM] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = 100;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should calculate top properly with position: absolute bottom", root_node, root_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.position[CSS_RIGHT] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 100;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-11 20:23:53 +00:00
|
|
|
test("should calculate left properly with position: absolute right", root_node, root_layout);
|
2014-09-30 15:24:42 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 10;
|
|
|
|
node_1->style.position[CSS_BOTTOM] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = 90;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should calculate top properly with position: absolute bottom and height", root_node, root_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 10;
|
|
|
|
node_1->style.position[CSS_RIGHT] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 90;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 10;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-11 20:23:53 +00:00
|
|
|
test("should calculate left properly with position: absolute right and width", root_node, root_layout);
|
2014-09-30 15:24:42 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 10;
|
|
|
|
node_1->style.position[CSS_BOTTOM] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = -10;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-11 20:23:53 +00:00
|
|
|
test("should calculate top properly with position: absolute right, width, and no parent dimensions", root_node, root_layout);
|
2014-09-30 15:24:42 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.position_type = CSS_POSITION_ABSOLUTE;
|
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 10;
|
|
|
|
node_1->style.position[CSS_RIGHT] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = -10;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 10;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-11 20:23:53 +00:00
|
|
|
test("should calculate left properly with position: absolute right, width, and no parent dimensions", root_node, root_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.justify_content = CSS_JUSTIFY_SPACE_BETWEEN;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.border[CSS_BOTTOM] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 1;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should layout border bottom inside of justify content space between container", root_node, root_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.justify_content = CSS_JUSTIFY_CENTER;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.margin[CSS_TOP] = -6;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = -3;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should layout negative margin top inside of justify content center container", root_node, root_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.justify_content = CSS_JUSTIFY_CENTER;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.margin[CSS_TOP] = 20;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 20;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = 20;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should layout positive margin top inside of justify content center container", root_node, root_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.justify_content = CSS_JUSTIFY_FLEX_END;
|
|
|
|
node_0->style.border[CSS_BOTTOM] = 5;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 5;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should layout border bottom and flex end with an empty child", root_node, root_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 800;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.position[CSS_LEFT] = 5;
|
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 800;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_0, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 5;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 800;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
init_css_node_children(node_1, 1);
|
|
|
|
{
|
|
|
|
css_node_t *node_2;
|
|
|
|
node_2 = node_1->get_child(node_1->context, 0);
|
|
|
|
node_2->layout.position[CSS_TOP] = 0;
|
|
|
|
node_2->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_2->layout.dimensions[CSS_WIDTH] = 800;
|
|
|
|
node_2->layout.dimensions[CSS_HEIGHT] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should layout with children of a contain with left", root_node, root_layout);
|
2014-09-30 15:24:42 -07:00
|
|
|
}
|
2014-12-12 12:03:31 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
|
|
|
|
node_0->style.flex_wrap = CSS_WRAP;
|
|
|
|
node_0->style.dimensions[CSS_WIDTH] = 100;
|
|
|
|
init_css_node_children(node_0, 3);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 40;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 10;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 40;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 10;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 2);
|
|
|
|
node_1->style.dimensions[CSS_WIDTH] = 40;
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 100;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 20;
|
|
|
|
init_css_node_children(node_0, 3);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 40;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 10;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 40;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 40;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 10;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 2);
|
|
|
|
node_1->layout.position[CSS_TOP] = 10;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 40;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should layout flex-wrap", root_node, root_layout);
|
|
|
|
}
|
2015-02-04 07:50:15 -08:00
|
|
|
|
|
|
|
{
|
|
|
|
css_node_t *root_node = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_node;
|
|
|
|
node_0->style.flex_wrap = CSS_WRAP;
|
|
|
|
node_0->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 2);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
|
|
|
node_1->style.dimensions[CSS_HEIGHT] = 200;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
css_node_t *root_layout = new_test_css_node();
|
|
|
|
{
|
|
|
|
css_node_t *node_0 = root_layout;
|
|
|
|
node_0->layout.position[CSS_TOP] = 0;
|
|
|
|
node_0->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_0->layout.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
init_css_node_children(node_0, 2);
|
|
|
|
{
|
|
|
|
css_node_t *node_1;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 0);
|
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
|
|
|
node_1 = node_0->get_child(node_0->context, 1);
|
|
|
|
node_1->layout.position[CSS_TOP] = 0;
|
|
|
|
node_1->layout.position[CSS_LEFT] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_WIDTH] = 0;
|
|
|
|
node_1->layout.dimensions[CSS_HEIGHT] = 200;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should layout flex wrap with a line bigger than container", root_node, root_layout);
|
|
|
|
}
|
2014-09-26 16:22:44 -07:00
|
|
|
/** END_GENERATED **/
|
2014-09-26 20:08:37 -07:00
|
|
|
return tests_finished();
|
2014-04-18 16:35:37 -07:00
|
|
|
}
|