passing height to the measure function
This diff: * adds height as another parameter passed to the measure function, computed the same way width is * adds tests for this extension, which has involved adding a new measure function to all of js, c, java and c# tests
This commit is contained in:
@@ -3972,6 +3972,158 @@ int main()
|
||||
test("should layout node with just text", 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;
|
||||
node_0->measure = measure;
|
||||
node_0->context = "measureWithRatio2";
|
||||
}
|
||||
|
||||
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] = 200;
|
||||
}
|
||||
|
||||
test("should layout node with fixed width and custom measure function", 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_HEIGHT] = 100;
|
||||
node_0->measure = measure;
|
||||
node_0->context = "measureWithRatio2";
|
||||
}
|
||||
|
||||
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] = 100;
|
||||
}
|
||||
|
||||
test("should layout node with fixed height and custom measure function", 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;
|
||||
node_0->style.dimensions[CSS_HEIGHT] = 100;
|
||||
node_0->measure = measure;
|
||||
node_0->context = "measureWithRatio2";
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
test("should layout node with fixed height and fixed width, ignoring custom measure function", root_node, root_layout);
|
||||
}
|
||||
|
||||
{
|
||||
css_node_t *root_node = new_test_css_node();
|
||||
{
|
||||
css_node_t *node_0 = root_node;
|
||||
node_0->measure = measure;
|
||||
node_0->context = "measureWithRatio2";
|
||||
}
|
||||
|
||||
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] = 99999;
|
||||
node_0->layout.dimensions[CSS_HEIGHT] = 99999;
|
||||
}
|
||||
|
||||
test("should layout node with no fixed dimension and custom measure function", 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_COLUMN;
|
||||
node_0->style.dimensions[CSS_WIDTH] = 320;
|
||||
init_css_node_children(node_0, 2);
|
||||
{
|
||||
css_node_t *node_1;
|
||||
node_1 = node_0->get_child(node_0->context, 0);
|
||||
node_1->measure = measure;
|
||||
node_1->context = "measureWithRatio2";
|
||||
node_1 = node_0->get_child(node_0->context, 1);
|
||||
node_1->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
|
||||
node_1->style.dimensions[CSS_HEIGHT] = 100;
|
||||
init_css_node_children(node_1, 2);
|
||||
{
|
||||
css_node_t *node_2;
|
||||
node_2 = node_1->get_child(node_1->context, 0);
|
||||
node_2->measure = measure;
|
||||
node_2->context = "measureWithRatio2";
|
||||
node_2 = node_1->get_child(node_1->context, 1);
|
||||
node_2->measure = measure;
|
||||
node_2->context = "measureWithRatio2";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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] = 320;
|
||||
node_0->layout.dimensions[CSS_HEIGHT] = 740;
|
||||
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] = 320;
|
||||
node_1->layout.dimensions[CSS_HEIGHT] = 640;
|
||||
node_1 = node_0->get_child(node_0->context, 1);
|
||||
node_1->layout.position[CSS_TOP] = 640;
|
||||
node_1->layout.position[CSS_LEFT] = 0;
|
||||
node_1->layout.dimensions[CSS_WIDTH] = 320;
|
||||
node_1->layout.dimensions[CSS_HEIGHT] = 100;
|
||||
init_css_node_children(node_1, 2);
|
||||
{
|
||||
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] = 200;
|
||||
node_2->layout.dimensions[CSS_HEIGHT] = 100;
|
||||
node_2 = node_1->get_child(node_1->context, 1);
|
||||
node_2->layout.position[CSS_TOP] = 0;
|
||||
node_2->layout.position[CSS_LEFT] = 200;
|
||||
node_2->layout.dimensions[CSS_WIDTH] = 200;
|
||||
node_2->layout.dimensions[CSS_HEIGHT] = 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test("should layout node with nested stacks and custom measure function", root_node, root_layout);
|
||||
}
|
||||
|
||||
{
|
||||
css_node_t *root_node = new_test_css_node();
|
||||
{
|
||||
|
Reference in New Issue
Block a user