Made relevant JS tests transpile to C ; [src/Layout.c]: print_css_node_rec(): print alignContent ; [src/Layout-test-utils.c]: add_failed_test(): Sets failed_test->next to NULL, otherwise the test crashes if there's one and only one failure ; Added type casts so that it can be compiled as C++ by MSVC on Windows ; [Makefile]: Added c_test_msvc target when running in Windows so that the test executable can be built and debugged with Visual Studio on Windows ;

This commit is contained in:
Pierre Renaux
2015-05-09 13:03:21 +08:00
parent c7fbf44474
commit 14e264f5be
9 changed files with 513 additions and 34 deletions

View File

@@ -5194,5 +5194,222 @@ public class LayoutEngineTest {
test("should layout absolutely positioned node with padded flex 1 parent", root_node, root_layout);
}
@Test
public void testCase123()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.flexDirection = CSSFlexDirection.ROW;
node_0.style.alignContent = CSSAlign.STRETCH;
node_0.style.alignItems = CSSAlign.FLEX_START;
node_0.style.flexWrap = CSSWrap.WRAP;
node_0.style.width = 300;
node_0.style.height = 380;
addChildren(node_0, 15);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.style.width = 50;
node_1.style.height = 50;
node_1.style.margin[Spacing.LEFT] = 10;
node_1.style.margin[Spacing.TOP] = 10;
node_1.style.margin[Spacing.RIGHT] = 10;
node_1.style.margin[Spacing.BOTTOM] = 10;
node_1 = node_0.getChildAt(1);
node_1.style.width = 50;
node_1.style.height = 50;
node_1.style.margin[Spacing.LEFT] = 10;
node_1.style.margin[Spacing.TOP] = 10;
node_1.style.margin[Spacing.RIGHT] = 10;
node_1.style.margin[Spacing.BOTTOM] = 10;
node_1 = node_0.getChildAt(2);
node_1.style.width = 50;
node_1.style.height = 50;
node_1.style.margin[Spacing.LEFT] = 10;
node_1.style.margin[Spacing.TOP] = 10;
node_1.style.margin[Spacing.RIGHT] = 10;
node_1.style.margin[Spacing.BOTTOM] = 10;
node_1 = node_0.getChildAt(3);
node_1.style.width = 50;
node_1.style.height = 50;
node_1.style.margin[Spacing.LEFT] = 10;
node_1.style.margin[Spacing.TOP] = 10;
node_1.style.margin[Spacing.RIGHT] = 10;
node_1.style.margin[Spacing.BOTTOM] = 10;
node_1 = node_0.getChildAt(4);
node_1.style.width = 50;
node_1.style.height = 100;
node_1.style.margin[Spacing.LEFT] = 10;
node_1.style.margin[Spacing.TOP] = 10;
node_1.style.margin[Spacing.RIGHT] = 10;
node_1.style.margin[Spacing.BOTTOM] = 10;
node_1 = node_0.getChildAt(5);
node_1.style.alignSelf = CSSAlign.FLEX_START;
node_1.style.width = 50;
node_1.style.height = 50;
node_1.style.margin[Spacing.LEFT] = 10;
node_1.style.margin[Spacing.TOP] = 10;
node_1.style.margin[Spacing.RIGHT] = 10;
node_1.style.margin[Spacing.BOTTOM] = 10;
node_1 = node_0.getChildAt(6);
node_1.style.width = 50;
node_1.style.height = 50;
node_1.style.margin[Spacing.LEFT] = 10;
node_1.style.margin[Spacing.TOP] = 10;
node_1.style.margin[Spacing.RIGHT] = 10;
node_1.style.margin[Spacing.BOTTOM] = 10;
node_1 = node_0.getChildAt(7);
node_1.style.width = 50;
node_1.style.height = 100;
node_1.style.margin[Spacing.LEFT] = 10;
node_1.style.margin[Spacing.TOP] = 10;
node_1.style.margin[Spacing.RIGHT] = 10;
node_1.style.margin[Spacing.BOTTOM] = 10;
node_1 = node_0.getChildAt(8);
node_1.style.width = 50;
node_1.style.height = 50;
node_1.style.margin[Spacing.LEFT] = 10;
node_1.style.margin[Spacing.TOP] = 10;
node_1.style.margin[Spacing.RIGHT] = 10;
node_1.style.margin[Spacing.BOTTOM] = 10;
node_1 = node_0.getChildAt(9);
node_1.style.width = 50;
node_1.style.height = 50;
node_1.style.margin[Spacing.LEFT] = 10;
node_1.style.margin[Spacing.TOP] = 10;
node_1.style.margin[Spacing.RIGHT] = 10;
node_1.style.margin[Spacing.BOTTOM] = 10;
node_1 = node_0.getChildAt(10);
node_1.style.alignSelf = CSSAlign.FLEX_START;
node_1.style.width = 50;
node_1.style.height = 50;
node_1.style.margin[Spacing.LEFT] = 10;
node_1.style.margin[Spacing.TOP] = 10;
node_1.style.margin[Spacing.RIGHT] = 10;
node_1.style.margin[Spacing.BOTTOM] = 10;
node_1 = node_0.getChildAt(11);
node_1.style.width = 50;
node_1.style.height = 50;
node_1.style.margin[Spacing.LEFT] = 10;
node_1.style.margin[Spacing.TOP] = 10;
node_1.style.margin[Spacing.RIGHT] = 10;
node_1.style.margin[Spacing.BOTTOM] = 10;
node_1 = node_0.getChildAt(12);
node_1.style.width = 50;
node_1.style.height = 50;
node_1.style.margin[Spacing.LEFT] = 10;
node_1.style.margin[Spacing.TOP] = 10;
node_1.style.margin[Spacing.RIGHT] = 10;
node_1.style.margin[Spacing.BOTTOM] = 10;
node_1 = node_0.getChildAt(13);
node_1.style.alignSelf = CSSAlign.FLEX_START;
node_1.style.width = 50;
node_1.style.height = 50;
node_1.style.margin[Spacing.LEFT] = 10;
node_1.style.margin[Spacing.TOP] = 10;
node_1.style.margin[Spacing.RIGHT] = 10;
node_1.style.margin[Spacing.BOTTOM] = 10;
node_1 = node_0.getChildAt(14);
node_1.style.width = 50;
node_1.style.height = 50;
node_1.style.margin[Spacing.LEFT] = 10;
node_1.style.margin[Spacing.TOP] = 10;
node_1.style.margin[Spacing.RIGHT] = 10;
node_1.style.margin[Spacing.BOTTOM] = 10;
}
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 300;
node_0.layout.height = 380;
addChildren(node_0, 15);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.layout.y = 10;
node_1.layout.x = 10;
node_1.layout.width = 50;
node_1.layout.height = 50;
node_1 = node_0.getChildAt(1);
node_1.layout.y = 10;
node_1.layout.x = 80;
node_1.layout.width = 50;
node_1.layout.height = 50;
node_1 = node_0.getChildAt(2);
node_1.layout.y = 10;
node_1.layout.x = 150;
node_1.layout.width = 50;
node_1.layout.height = 50;
node_1 = node_0.getChildAt(3);
node_1.layout.y = 10;
node_1.layout.x = 220;
node_1.layout.width = 50;
node_1.layout.height = 50;
node_1 = node_0.getChildAt(4);
node_1.layout.y = 92.5f;
node_1.layout.x = 10;
node_1.layout.width = 50;
node_1.layout.height = 100;
node_1 = node_0.getChildAt(5);
node_1.layout.y = 92.5f;
node_1.layout.x = 80;
node_1.layout.width = 50;
node_1.layout.height = 50;
node_1 = node_0.getChildAt(6);
node_1.layout.y = 92.5f;
node_1.layout.x = 150;
node_1.layout.width = 50;
node_1.layout.height = 50;
node_1 = node_0.getChildAt(7);
node_1.layout.y = 92.5f;
node_1.layout.x = 220;
node_1.layout.width = 50;
node_1.layout.height = 100;
node_1 = node_0.getChildAt(8);
node_1.layout.y = 225;
node_1.layout.x = 10;
node_1.layout.width = 50;
node_1.layout.height = 50;
node_1 = node_0.getChildAt(9);
node_1.layout.y = 225;
node_1.layout.x = 80;
node_1.layout.width = 50;
node_1.layout.height = 50;
node_1 = node_0.getChildAt(10);
node_1.layout.y = 225;
node_1.layout.x = 150;
node_1.layout.width = 50;
node_1.layout.height = 50;
node_1 = node_0.getChildAt(11);
node_1.layout.y = 225;
node_1.layout.x = 220;
node_1.layout.width = 50;
node_1.layout.height = 50;
node_1 = node_0.getChildAt(12);
node_1.layout.y = 307.5f;
node_1.layout.x = 10;
node_1.layout.width = 50;
node_1.layout.height = 50;
node_1 = node_0.getChildAt(13);
node_1.layout.y = 307.5f;
node_1.layout.x = 80;
node_1.layout.width = 50;
node_1.layout.height = 50;
node_1 = node_0.getChildAt(14);
node_1.layout.y = 307.5f;
node_1.layout.x = 150;
node_1.layout.width = 50;
node_1.layout.height = 50;
}
}
test("should layout with alignContent: stretch, and alignItems: flex-start", root_node, root_layout);
}
/** END_GENERATED **/
}