Added extra test to check for potential division by zero.
This commit is contained in:
@@ -4107,6 +4107,112 @@ int main()
|
||||
test("should override flex direction size with max bounds", root_node, root_layout);
|
||||
}
|
||||
|
||||
{
|
||||
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.dimensions[CSS_WIDTH] = 300;
|
||||
node_0->style.dimensions[CSS_HEIGHT] = 200;
|
||||
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.flex = 1;
|
||||
node_1->style.maxDimensions[CSS_WIDTH] = 60;
|
||||
node_1 = node_0->get_child(node_0->context, 1);
|
||||
node_1->style.flex = 1;
|
||||
node_1->style.maxDimensions[CSS_WIDTH] = 60;
|
||||
node_1 = node_0->get_child(node_0->context, 2);
|
||||
node_1->style.flex = 1;
|
||||
node_1->style.maxDimensions[CSS_WIDTH] = 60;
|
||||
}
|
||||
}
|
||||
|
||||
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] = 300;
|
||||
node_0->layout.dimensions[CSS_HEIGHT] = 200;
|
||||
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] = 60;
|
||||
node_1->layout.dimensions[CSS_HEIGHT] = 200;
|
||||
node_1 = node_0->get_child(node_0->context, 1);
|
||||
node_1->layout.position[CSS_TOP] = 0;
|
||||
node_1->layout.position[CSS_LEFT] = 60;
|
||||
node_1->layout.dimensions[CSS_WIDTH] = 60;
|
||||
node_1->layout.dimensions[CSS_HEIGHT] = 200;
|
||||
node_1 = node_0->get_child(node_0->context, 2);
|
||||
node_1->layout.position[CSS_TOP] = 0;
|
||||
node_1->layout.position[CSS_LEFT] = 120;
|
||||
node_1->layout.dimensions[CSS_WIDTH] = 60;
|
||||
node_1->layout.dimensions[CSS_HEIGHT] = 200;
|
||||
}
|
||||
}
|
||||
|
||||
test("should ignore flex size if fully max bound", root_node, root_layout);
|
||||
}
|
||||
|
||||
{
|
||||
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.dimensions[CSS_WIDTH] = 300;
|
||||
node_0->style.dimensions[CSS_HEIGHT] = 200;
|
||||
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.flex = 1;
|
||||
node_1->style.minDimensions[CSS_WIDTH] = 120;
|
||||
node_1 = node_0->get_child(node_0->context, 1);
|
||||
node_1->style.flex = 1;
|
||||
node_1->style.minDimensions[CSS_WIDTH] = 120;
|
||||
node_1 = node_0->get_child(node_0->context, 2);
|
||||
node_1->style.flex = 1;
|
||||
node_1->style.minDimensions[CSS_WIDTH] = 120;
|
||||
}
|
||||
}
|
||||
|
||||
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] = 300;
|
||||
node_0->layout.dimensions[CSS_HEIGHT] = 200;
|
||||
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] = 120;
|
||||
node_1->layout.dimensions[CSS_HEIGHT] = 200;
|
||||
node_1 = node_0->get_child(node_0->context, 1);
|
||||
node_1->layout.position[CSS_TOP] = 0;
|
||||
node_1->layout.position[CSS_LEFT] = 120;
|
||||
node_1->layout.dimensions[CSS_WIDTH] = 120;
|
||||
node_1->layout.dimensions[CSS_HEIGHT] = 200;
|
||||
node_1 = node_0->get_child(node_0->context, 2);
|
||||
node_1->layout.position[CSS_TOP] = 0;
|
||||
node_1->layout.position[CSS_LEFT] = 240;
|
||||
node_1->layout.dimensions[CSS_WIDTH] = 120;
|
||||
node_1->layout.dimensions[CSS_HEIGHT] = 200;
|
||||
}
|
||||
}
|
||||
|
||||
test("should ignore flex size if fully min bound", root_node, root_layout);
|
||||
}
|
||||
|
||||
{
|
||||
css_node_t *root_node = new_test_css_node();
|
||||
{
|
||||
|
Reference in New Issue
Block a user