From 1a6f37c20c4def847b21ee22f4ffb9f2e79e7c52 Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Thu, 9 Feb 2017 17:01:41 +0000 Subject: [PATCH 1/4] [csharp] Add YogaDisplay to shared project --- csharp/Facebook.Yoga/Facebook.Yoga.Shared.projitems | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/csharp/Facebook.Yoga/Facebook.Yoga.Shared.projitems b/csharp/Facebook.Yoga/Facebook.Yoga.Shared.projitems index 1a641829..3b51cd94 100644 --- a/csharp/Facebook.Yoga/Facebook.Yoga.Shared.projitems +++ b/csharp/Facebook.Yoga/Facebook.Yoga.Shared.projitems @@ -18,6 +18,7 @@ + @@ -37,4 +38,4 @@ - + \ No newline at end of file -- 2.50.1.windows.1 From 20536923d6b7ec41ebf15295abfec754628f5af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20W=C3=B6hrl?= Date: Wed, 15 Feb 2017 13:35:24 -0800 Subject: [PATCH 2/4] flex-wrap: wrap-reverse support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: I couldn't resist to do this 😄 #394 This adds ```flex-wrap: wrap-reverse``` I think we hit a edge case here: https://stackoverflow.com/questions/33891709/when-flexbox-items-wrap-in-column-mode-container-does-not-grow-its-width as is differs here from chrome, but I think that yoga is here more correct. So I haven't added this test yet as this would fail against chrome, as chrome outputs a width of 30 for root, whereas yoga gets a width of 60 here, which I think is correct. Strangely the output of ```flex-wrap:wrap``` is in jsfiddle also only with a (visual) width of 30 on chrome, while the tests gets generated with 60. ```html
``` Looking forward what you think here emilsjolander Closes https://github.com/facebook/yoga/pull/398 Reviewed By: astreet Differential Revision: D4564711 Pulled By: emilsjolander fbshipit-source-id: 33dc055abd8444b2aa7796ef90bd7ec99e961bb8 --- csharp/Facebook.Yoga/YogaWrap.cs | 1 + csharp/tests/Facebook.Yoga/YGFlexWrapTest.cs | 598 +++++++++++++++++ enums.py | 1 + gentest/fixtures/YGFlexWrapTest.html | 49 ++ gentest/gentest-cpp.js | 1 + gentest/gentest-cs.js | 1 + gentest/gentest-java.js | 1 + gentest/gentest-javascript.js | 1 + gentest/gentest.js | 1 + java/com/facebook/yoga/YogaWrap.java | 4 +- .../com/facebook/yoga/YGFlexWrapTest.java | 592 +++++++++++++++++ javascript/sources/YGEnums.js | 3 +- .../tests/Facebook.Yoga/YGFlexWrapTest.js | 604 ++++++++++++++++++ tests/YGFlexWrapTest.cpp | 586 +++++++++++++++++ yoga/YGEnums.h | 3 +- yoga/Yoga.c | 26 +- 16 files changed, 2462 insertions(+), 10 deletions(-) diff --git a/csharp/Facebook.Yoga/YogaWrap.cs b/csharp/Facebook.Yoga/YogaWrap.cs index 3d88ad04..e9aea726 100644 --- a/csharp/Facebook.Yoga/YogaWrap.cs +++ b/csharp/Facebook.Yoga/YogaWrap.cs @@ -13,5 +13,6 @@ namespace Facebook.Yoga { NoWrap, Wrap, + WrapReverse, } } diff --git a/csharp/tests/Facebook.Yoga/YGFlexWrapTest.cs b/csharp/tests/Facebook.Yoga/YGFlexWrapTest.cs index 3dbcf8f2..eaf233e2 100644 --- a/csharp/tests/Facebook.Yoga/YGFlexWrapTest.cs +++ b/csharp/tests/Facebook.Yoga/YGFlexWrapTest.cs @@ -544,5 +544,603 @@ namespace Facebook.Yoga Assert.AreEqual(100f, root_child1.LayoutHeight); } + [Test] + public void Test_wrap_reverse_row_align_content_flex_start() + { + YogaNode root = new YogaNode(); + root.FlexDirection = YogaFlexDirection.Row; + root.Wrap = YogaWrap.WrapReverse; + root.Width = 100; + + YogaNode root_child0 = new YogaNode(); + root_child0.Width = 30; + root_child0.Height = 10; + root.Insert(0, root_child0); + + YogaNode root_child1 = new YogaNode(); + root_child1.Width = 30; + root_child1.Height = 20; + root.Insert(1, root_child1); + + YogaNode root_child2 = new YogaNode(); + root_child2.Width = 30; + root_child2.Height = 30; + root.Insert(2, root_child2); + + YogaNode root_child3 = new YogaNode(); + root_child3.Width = 30; + root_child3.Height = 40; + root.Insert(3, root_child3); + + YogaNode root_child4 = new YogaNode(); + root_child4.Width = 30; + root_child4.Height = 50; + root.Insert(4, root_child4); + root.StyleDirection = YogaDirection.LTR; + root.CalculateLayout(); + + Assert.AreEqual(0f, root.LayoutX); + Assert.AreEqual(0f, root.LayoutY); + Assert.AreEqual(100f, root.LayoutWidth); + Assert.AreEqual(80f, root.LayoutHeight); + + Assert.AreEqual(0f, root_child0.LayoutX); + Assert.AreEqual(70f, root_child0.LayoutY); + Assert.AreEqual(30f, root_child0.LayoutWidth); + Assert.AreEqual(10f, root_child0.LayoutHeight); + + Assert.AreEqual(30f, root_child1.LayoutX); + Assert.AreEqual(60f, root_child1.LayoutY); + Assert.AreEqual(30f, root_child1.LayoutWidth); + Assert.AreEqual(20f, root_child1.LayoutHeight); + + Assert.AreEqual(60f, root_child2.LayoutX); + Assert.AreEqual(50f, root_child2.LayoutY); + Assert.AreEqual(30f, root_child2.LayoutWidth); + Assert.AreEqual(30f, root_child2.LayoutHeight); + + Assert.AreEqual(0f, root_child3.LayoutX); + Assert.AreEqual(10f, root_child3.LayoutY); + Assert.AreEqual(30f, root_child3.LayoutWidth); + Assert.AreEqual(40f, root_child3.LayoutHeight); + + Assert.AreEqual(30f, root_child4.LayoutX); + Assert.AreEqual(0f, root_child4.LayoutY); + Assert.AreEqual(30f, root_child4.LayoutWidth); + Assert.AreEqual(50f, root_child4.LayoutHeight); + + root.StyleDirection = YogaDirection.RTL; + root.CalculateLayout(); + + Assert.AreEqual(0f, root.LayoutX); + Assert.AreEqual(0f, root.LayoutY); + Assert.AreEqual(100f, root.LayoutWidth); + Assert.AreEqual(80f, root.LayoutHeight); + + Assert.AreEqual(70f, root_child0.LayoutX); + Assert.AreEqual(70f, root_child0.LayoutY); + Assert.AreEqual(30f, root_child0.LayoutWidth); + Assert.AreEqual(10f, root_child0.LayoutHeight); + + Assert.AreEqual(40f, root_child1.LayoutX); + Assert.AreEqual(60f, root_child1.LayoutY); + Assert.AreEqual(30f, root_child1.LayoutWidth); + Assert.AreEqual(20f, root_child1.LayoutHeight); + + Assert.AreEqual(10f, root_child2.LayoutX); + Assert.AreEqual(50f, root_child2.LayoutY); + Assert.AreEqual(30f, root_child2.LayoutWidth); + Assert.AreEqual(30f, root_child2.LayoutHeight); + + Assert.AreEqual(70f, root_child3.LayoutX); + Assert.AreEqual(10f, root_child3.LayoutY); + Assert.AreEqual(30f, root_child3.LayoutWidth); + Assert.AreEqual(40f, root_child3.LayoutHeight); + + Assert.AreEqual(40f, root_child4.LayoutX); + Assert.AreEqual(0f, root_child4.LayoutY); + Assert.AreEqual(30f, root_child4.LayoutWidth); + Assert.AreEqual(50f, root_child4.LayoutHeight); + } + + [Test] + public void Test_wrap_reverse_row_align_content_center() + { + YogaNode root = new YogaNode(); + root.FlexDirection = YogaFlexDirection.Row; + root.AlignContent = YogaAlign.Center; + root.Wrap = YogaWrap.WrapReverse; + root.Width = 100; + + YogaNode root_child0 = new YogaNode(); + root_child0.Width = 30; + root_child0.Height = 10; + root.Insert(0, root_child0); + + YogaNode root_child1 = new YogaNode(); + root_child1.Width = 30; + root_child1.Height = 20; + root.Insert(1, root_child1); + + YogaNode root_child2 = new YogaNode(); + root_child2.Width = 30; + root_child2.Height = 30; + root.Insert(2, root_child2); + + YogaNode root_child3 = new YogaNode(); + root_child3.Width = 30; + root_child3.Height = 40; + root.Insert(3, root_child3); + + YogaNode root_child4 = new YogaNode(); + root_child4.Width = 30; + root_child4.Height = 50; + root.Insert(4, root_child4); + root.StyleDirection = YogaDirection.LTR; + root.CalculateLayout(); + + Assert.AreEqual(0f, root.LayoutX); + Assert.AreEqual(0f, root.LayoutY); + Assert.AreEqual(100f, root.LayoutWidth); + Assert.AreEqual(80f, root.LayoutHeight); + + Assert.AreEqual(0f, root_child0.LayoutX); + Assert.AreEqual(70f, root_child0.LayoutY); + Assert.AreEqual(30f, root_child0.LayoutWidth); + Assert.AreEqual(10f, root_child0.LayoutHeight); + + Assert.AreEqual(30f, root_child1.LayoutX); + Assert.AreEqual(60f, root_child1.LayoutY); + Assert.AreEqual(30f, root_child1.LayoutWidth); + Assert.AreEqual(20f, root_child1.LayoutHeight); + + Assert.AreEqual(60f, root_child2.LayoutX); + Assert.AreEqual(50f, root_child2.LayoutY); + Assert.AreEqual(30f, root_child2.LayoutWidth); + Assert.AreEqual(30f, root_child2.LayoutHeight); + + Assert.AreEqual(0f, root_child3.LayoutX); + Assert.AreEqual(10f, root_child3.LayoutY); + Assert.AreEqual(30f, root_child3.LayoutWidth); + Assert.AreEqual(40f, root_child3.LayoutHeight); + + Assert.AreEqual(30f, root_child4.LayoutX); + Assert.AreEqual(0f, root_child4.LayoutY); + Assert.AreEqual(30f, root_child4.LayoutWidth); + Assert.AreEqual(50f, root_child4.LayoutHeight); + + root.StyleDirection = YogaDirection.RTL; + root.CalculateLayout(); + + Assert.AreEqual(0f, root.LayoutX); + Assert.AreEqual(0f, root.LayoutY); + Assert.AreEqual(100f, root.LayoutWidth); + Assert.AreEqual(80f, root.LayoutHeight); + + Assert.AreEqual(70f, root_child0.LayoutX); + Assert.AreEqual(70f, root_child0.LayoutY); + Assert.AreEqual(30f, root_child0.LayoutWidth); + Assert.AreEqual(10f, root_child0.LayoutHeight); + + Assert.AreEqual(40f, root_child1.LayoutX); + Assert.AreEqual(60f, root_child1.LayoutY); + Assert.AreEqual(30f, root_child1.LayoutWidth); + Assert.AreEqual(20f, root_child1.LayoutHeight); + + Assert.AreEqual(10f, root_child2.LayoutX); + Assert.AreEqual(50f, root_child2.LayoutY); + Assert.AreEqual(30f, root_child2.LayoutWidth); + Assert.AreEqual(30f, root_child2.LayoutHeight); + + Assert.AreEqual(70f, root_child3.LayoutX); + Assert.AreEqual(10f, root_child3.LayoutY); + Assert.AreEqual(30f, root_child3.LayoutWidth); + Assert.AreEqual(40f, root_child3.LayoutHeight); + + Assert.AreEqual(40f, root_child4.LayoutX); + Assert.AreEqual(0f, root_child4.LayoutY); + Assert.AreEqual(30f, root_child4.LayoutWidth); + Assert.AreEqual(50f, root_child4.LayoutHeight); + } + + [Test] + public void Test_wrap_reverse_row_single_line_different_size() + { + YogaNode root = new YogaNode(); + root.FlexDirection = YogaFlexDirection.Row; + root.Wrap = YogaWrap.WrapReverse; + root.Width = 300; + + YogaNode root_child0 = new YogaNode(); + root_child0.Width = 30; + root_child0.Height = 10; + root.Insert(0, root_child0); + + YogaNode root_child1 = new YogaNode(); + root_child1.Width = 30; + root_child1.Height = 20; + root.Insert(1, root_child1); + + YogaNode root_child2 = new YogaNode(); + root_child2.Width = 30; + root_child2.Height = 30; + root.Insert(2, root_child2); + + YogaNode root_child3 = new YogaNode(); + root_child3.Width = 30; + root_child3.Height = 40; + root.Insert(3, root_child3); + + YogaNode root_child4 = new YogaNode(); + root_child4.Width = 30; + root_child4.Height = 50; + root.Insert(4, root_child4); + root.StyleDirection = YogaDirection.LTR; + root.CalculateLayout(); + + Assert.AreEqual(0f, root.LayoutX); + Assert.AreEqual(0f, root.LayoutY); + Assert.AreEqual(300f, root.LayoutWidth); + Assert.AreEqual(50f, root.LayoutHeight); + + Assert.AreEqual(0f, root_child0.LayoutX); + Assert.AreEqual(40f, root_child0.LayoutY); + Assert.AreEqual(30f, root_child0.LayoutWidth); + Assert.AreEqual(10f, root_child0.LayoutHeight); + + Assert.AreEqual(30f, root_child1.LayoutX); + Assert.AreEqual(30f, root_child1.LayoutY); + Assert.AreEqual(30f, root_child1.LayoutWidth); + Assert.AreEqual(20f, root_child1.LayoutHeight); + + Assert.AreEqual(60f, root_child2.LayoutX); + Assert.AreEqual(20f, root_child2.LayoutY); + Assert.AreEqual(30f, root_child2.LayoutWidth); + Assert.AreEqual(30f, root_child2.LayoutHeight); + + Assert.AreEqual(90f, root_child3.LayoutX); + Assert.AreEqual(10f, root_child3.LayoutY); + Assert.AreEqual(30f, root_child3.LayoutWidth); + Assert.AreEqual(40f, root_child3.LayoutHeight); + + Assert.AreEqual(120f, root_child4.LayoutX); + Assert.AreEqual(0f, root_child4.LayoutY); + Assert.AreEqual(30f, root_child4.LayoutWidth); + Assert.AreEqual(50f, root_child4.LayoutHeight); + + root.StyleDirection = YogaDirection.RTL; + root.CalculateLayout(); + + Assert.AreEqual(0f, root.LayoutX); + Assert.AreEqual(0f, root.LayoutY); + Assert.AreEqual(300f, root.LayoutWidth); + Assert.AreEqual(50f, root.LayoutHeight); + + Assert.AreEqual(270f, root_child0.LayoutX); + Assert.AreEqual(40f, root_child0.LayoutY); + Assert.AreEqual(30f, root_child0.LayoutWidth); + Assert.AreEqual(10f, root_child0.LayoutHeight); + + Assert.AreEqual(240f, root_child1.LayoutX); + Assert.AreEqual(30f, root_child1.LayoutY); + Assert.AreEqual(30f, root_child1.LayoutWidth); + Assert.AreEqual(20f, root_child1.LayoutHeight); + + Assert.AreEqual(210f, root_child2.LayoutX); + Assert.AreEqual(20f, root_child2.LayoutY); + Assert.AreEqual(30f, root_child2.LayoutWidth); + Assert.AreEqual(30f, root_child2.LayoutHeight); + + Assert.AreEqual(180f, root_child3.LayoutX); + Assert.AreEqual(10f, root_child3.LayoutY); + Assert.AreEqual(30f, root_child3.LayoutWidth); + Assert.AreEqual(40f, root_child3.LayoutHeight); + + Assert.AreEqual(150f, root_child4.LayoutX); + Assert.AreEqual(0f, root_child4.LayoutY); + Assert.AreEqual(30f, root_child4.LayoutWidth); + Assert.AreEqual(50f, root_child4.LayoutHeight); + } + + [Test] + public void Test_wrap_reverse_row_align_content_stretch() + { + YogaNode root = new YogaNode(); + root.FlexDirection = YogaFlexDirection.Row; + root.AlignContent = YogaAlign.Stretch; + root.Wrap = YogaWrap.WrapReverse; + root.Width = 100; + + YogaNode root_child0 = new YogaNode(); + root_child0.Width = 30; + root_child0.Height = 10; + root.Insert(0, root_child0); + + YogaNode root_child1 = new YogaNode(); + root_child1.Width = 30; + root_child1.Height = 20; + root.Insert(1, root_child1); + + YogaNode root_child2 = new YogaNode(); + root_child2.Width = 30; + root_child2.Height = 30; + root.Insert(2, root_child2); + + YogaNode root_child3 = new YogaNode(); + root_child3.Width = 30; + root_child3.Height = 40; + root.Insert(3, root_child3); + + YogaNode root_child4 = new YogaNode(); + root_child4.Width = 30; + root_child4.Height = 50; + root.Insert(4, root_child4); + root.StyleDirection = YogaDirection.LTR; + root.CalculateLayout(); + + Assert.AreEqual(0f, root.LayoutX); + Assert.AreEqual(0f, root.LayoutY); + Assert.AreEqual(100f, root.LayoutWidth); + Assert.AreEqual(80f, root.LayoutHeight); + + Assert.AreEqual(0f, root_child0.LayoutX); + Assert.AreEqual(70f, root_child0.LayoutY); + Assert.AreEqual(30f, root_child0.LayoutWidth); + Assert.AreEqual(10f, root_child0.LayoutHeight); + + Assert.AreEqual(30f, root_child1.LayoutX); + Assert.AreEqual(60f, root_child1.LayoutY); + Assert.AreEqual(30f, root_child1.LayoutWidth); + Assert.AreEqual(20f, root_child1.LayoutHeight); + + Assert.AreEqual(60f, root_child2.LayoutX); + Assert.AreEqual(50f, root_child2.LayoutY); + Assert.AreEqual(30f, root_child2.LayoutWidth); + Assert.AreEqual(30f, root_child2.LayoutHeight); + + Assert.AreEqual(0f, root_child3.LayoutX); + Assert.AreEqual(10f, root_child3.LayoutY); + Assert.AreEqual(30f, root_child3.LayoutWidth); + Assert.AreEqual(40f, root_child3.LayoutHeight); + + Assert.AreEqual(30f, root_child4.LayoutX); + Assert.AreEqual(0f, root_child4.LayoutY); + Assert.AreEqual(30f, root_child4.LayoutWidth); + Assert.AreEqual(50f, root_child4.LayoutHeight); + + root.StyleDirection = YogaDirection.RTL; + root.CalculateLayout(); + + Assert.AreEqual(0f, root.LayoutX); + Assert.AreEqual(0f, root.LayoutY); + Assert.AreEqual(100f, root.LayoutWidth); + Assert.AreEqual(80f, root.LayoutHeight); + + Assert.AreEqual(70f, root_child0.LayoutX); + Assert.AreEqual(70f, root_child0.LayoutY); + Assert.AreEqual(30f, root_child0.LayoutWidth); + Assert.AreEqual(10f, root_child0.LayoutHeight); + + Assert.AreEqual(40f, root_child1.LayoutX); + Assert.AreEqual(60f, root_child1.LayoutY); + Assert.AreEqual(30f, root_child1.LayoutWidth); + Assert.AreEqual(20f, root_child1.LayoutHeight); + + Assert.AreEqual(10f, root_child2.LayoutX); + Assert.AreEqual(50f, root_child2.LayoutY); + Assert.AreEqual(30f, root_child2.LayoutWidth); + Assert.AreEqual(30f, root_child2.LayoutHeight); + + Assert.AreEqual(70f, root_child3.LayoutX); + Assert.AreEqual(10f, root_child3.LayoutY); + Assert.AreEqual(30f, root_child3.LayoutWidth); + Assert.AreEqual(40f, root_child3.LayoutHeight); + + Assert.AreEqual(40f, root_child4.LayoutX); + Assert.AreEqual(0f, root_child4.LayoutY); + Assert.AreEqual(30f, root_child4.LayoutWidth); + Assert.AreEqual(50f, root_child4.LayoutHeight); + } + + [Test] + public void Test_wrap_reverse_row_align_content_space_around() + { + YogaNode root = new YogaNode(); + root.FlexDirection = YogaFlexDirection.Row; + root.AlignContent = YogaAlign.SpaceAround; + root.Wrap = YogaWrap.WrapReverse; + root.Width = 100; + + YogaNode root_child0 = new YogaNode(); + root_child0.Width = 30; + root_child0.Height = 10; + root.Insert(0, root_child0); + + YogaNode root_child1 = new YogaNode(); + root_child1.Width = 30; + root_child1.Height = 20; + root.Insert(1, root_child1); + + YogaNode root_child2 = new YogaNode(); + root_child2.Width = 30; + root_child2.Height = 30; + root.Insert(2, root_child2); + + YogaNode root_child3 = new YogaNode(); + root_child3.Width = 30; + root_child3.Height = 40; + root.Insert(3, root_child3); + + YogaNode root_child4 = new YogaNode(); + root_child4.Width = 30; + root_child4.Height = 50; + root.Insert(4, root_child4); + root.StyleDirection = YogaDirection.LTR; + root.CalculateLayout(); + + Assert.AreEqual(0f, root.LayoutX); + Assert.AreEqual(0f, root.LayoutY); + Assert.AreEqual(100f, root.LayoutWidth); + Assert.AreEqual(80f, root.LayoutHeight); + + Assert.AreEqual(0f, root_child0.LayoutX); + Assert.AreEqual(70f, root_child0.LayoutY); + Assert.AreEqual(30f, root_child0.LayoutWidth); + Assert.AreEqual(10f, root_child0.LayoutHeight); + + Assert.AreEqual(30f, root_child1.LayoutX); + Assert.AreEqual(60f, root_child1.LayoutY); + Assert.AreEqual(30f, root_child1.LayoutWidth); + Assert.AreEqual(20f, root_child1.LayoutHeight); + + Assert.AreEqual(60f, root_child2.LayoutX); + Assert.AreEqual(50f, root_child2.LayoutY); + Assert.AreEqual(30f, root_child2.LayoutWidth); + Assert.AreEqual(30f, root_child2.LayoutHeight); + + Assert.AreEqual(0f, root_child3.LayoutX); + Assert.AreEqual(10f, root_child3.LayoutY); + Assert.AreEqual(30f, root_child3.LayoutWidth); + Assert.AreEqual(40f, root_child3.LayoutHeight); + + Assert.AreEqual(30f, root_child4.LayoutX); + Assert.AreEqual(0f, root_child4.LayoutY); + Assert.AreEqual(30f, root_child4.LayoutWidth); + Assert.AreEqual(50f, root_child4.LayoutHeight); + + root.StyleDirection = YogaDirection.RTL; + root.CalculateLayout(); + + Assert.AreEqual(0f, root.LayoutX); + Assert.AreEqual(0f, root.LayoutY); + Assert.AreEqual(100f, root.LayoutWidth); + Assert.AreEqual(80f, root.LayoutHeight); + + Assert.AreEqual(70f, root_child0.LayoutX); + Assert.AreEqual(70f, root_child0.LayoutY); + Assert.AreEqual(30f, root_child0.LayoutWidth); + Assert.AreEqual(10f, root_child0.LayoutHeight); + + Assert.AreEqual(40f, root_child1.LayoutX); + Assert.AreEqual(60f, root_child1.LayoutY); + Assert.AreEqual(30f, root_child1.LayoutWidth); + Assert.AreEqual(20f, root_child1.LayoutHeight); + + Assert.AreEqual(10f, root_child2.LayoutX); + Assert.AreEqual(50f, root_child2.LayoutY); + Assert.AreEqual(30f, root_child2.LayoutWidth); + Assert.AreEqual(30f, root_child2.LayoutHeight); + + Assert.AreEqual(70f, root_child3.LayoutX); + Assert.AreEqual(10f, root_child3.LayoutY); + Assert.AreEqual(30f, root_child3.LayoutWidth); + Assert.AreEqual(40f, root_child3.LayoutHeight); + + Assert.AreEqual(40f, root_child4.LayoutX); + Assert.AreEqual(0f, root_child4.LayoutY); + Assert.AreEqual(30f, root_child4.LayoutWidth); + Assert.AreEqual(50f, root_child4.LayoutHeight); + } + + [Test] + public void Test_wrap_reverse_column_fixed_size() + { + YogaNode root = new YogaNode(); + root.AlignItems = YogaAlign.Center; + root.Wrap = YogaWrap.WrapReverse; + root.Width = 200; + root.Height = 100; + + YogaNode root_child0 = new YogaNode(); + root_child0.Width = 30; + root_child0.Height = 10; + root.Insert(0, root_child0); + + YogaNode root_child1 = new YogaNode(); + root_child1.Width = 30; + root_child1.Height = 20; + root.Insert(1, root_child1); + + YogaNode root_child2 = new YogaNode(); + root_child2.Width = 30; + root_child2.Height = 30; + root.Insert(2, root_child2); + + YogaNode root_child3 = new YogaNode(); + root_child3.Width = 30; + root_child3.Height = 40; + root.Insert(3, root_child3); + + YogaNode root_child4 = new YogaNode(); + root_child4.Width = 30; + root_child4.Height = 50; + root.Insert(4, root_child4); + root.StyleDirection = YogaDirection.LTR; + root.CalculateLayout(); + + Assert.AreEqual(0f, root.LayoutX); + Assert.AreEqual(0f, root.LayoutY); + Assert.AreEqual(200f, root.LayoutWidth); + Assert.AreEqual(100f, root.LayoutHeight); + + Assert.AreEqual(170f, root_child0.LayoutX); + Assert.AreEqual(0f, root_child0.LayoutY); + Assert.AreEqual(30f, root_child0.LayoutWidth); + Assert.AreEqual(10f, root_child0.LayoutHeight); + + Assert.AreEqual(170f, root_child1.LayoutX); + Assert.AreEqual(10f, root_child1.LayoutY); + Assert.AreEqual(30f, root_child1.LayoutWidth); + Assert.AreEqual(20f, root_child1.LayoutHeight); + + Assert.AreEqual(170f, root_child2.LayoutX); + Assert.AreEqual(30f, root_child2.LayoutY); + Assert.AreEqual(30f, root_child2.LayoutWidth); + Assert.AreEqual(30f, root_child2.LayoutHeight); + + Assert.AreEqual(170f, root_child3.LayoutX); + Assert.AreEqual(60f, root_child3.LayoutY); + Assert.AreEqual(30f, root_child3.LayoutWidth); + Assert.AreEqual(40f, root_child3.LayoutHeight); + + Assert.AreEqual(140f, root_child4.LayoutX); + Assert.AreEqual(0f, root_child4.LayoutY); + Assert.AreEqual(30f, root_child4.LayoutWidth); + Assert.AreEqual(50f, root_child4.LayoutHeight); + + root.StyleDirection = YogaDirection.RTL; + root.CalculateLayout(); + + Assert.AreEqual(0f, root.LayoutX); + Assert.AreEqual(0f, root.LayoutY); + Assert.AreEqual(200f, root.LayoutWidth); + Assert.AreEqual(100f, root.LayoutHeight); + + Assert.AreEqual(0f, root_child0.LayoutX); + Assert.AreEqual(0f, root_child0.LayoutY); + Assert.AreEqual(30f, root_child0.LayoutWidth); + Assert.AreEqual(10f, root_child0.LayoutHeight); + + Assert.AreEqual(0f, root_child1.LayoutX); + Assert.AreEqual(10f, root_child1.LayoutY); + Assert.AreEqual(30f, root_child1.LayoutWidth); + Assert.AreEqual(20f, root_child1.LayoutHeight); + + Assert.AreEqual(0f, root_child2.LayoutX); + Assert.AreEqual(30f, root_child2.LayoutY); + Assert.AreEqual(30f, root_child2.LayoutWidth); + Assert.AreEqual(30f, root_child2.LayoutHeight); + + Assert.AreEqual(0f, root_child3.LayoutX); + Assert.AreEqual(60f, root_child3.LayoutY); + Assert.AreEqual(30f, root_child3.LayoutWidth); + Assert.AreEqual(40f, root_child3.LayoutHeight); + + Assert.AreEqual(30f, root_child4.LayoutX); + Assert.AreEqual(0f, root_child4.LayoutY); + Assert.AreEqual(30f, root_child4.LayoutWidth); + Assert.AreEqual(50f, root_child4.LayoutHeight); + } + } } diff --git a/enums.py b/enums.py index c29d5d35..f09de262 100644 --- a/enums.py +++ b/enums.py @@ -62,6 +62,7 @@ ENUMS = { 'Wrap': [ 'NoWrap', 'Wrap', + 'WrapReverse', ], 'MeasureMode': [ 'Undefined', diff --git a/gentest/fixtures/YGFlexWrapTest.html b/gentest/fixtures/YGFlexWrapTest.html index 353805db..1db96200 100644 --- a/gentest/fixtures/YGFlexWrapTest.html +++ b/gentest/fixtures/YGFlexWrapTest.html @@ -44,3 +44,52 @@
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ diff --git a/gentest/gentest-cpp.js b/gentest/gentest-cpp.js index 1c50de6e..0622c8a4 100644 --- a/gentest/gentest-cpp.js +++ b/gentest/gentest-cpp.js @@ -118,6 +118,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, { YGWrapNoWrap:{value:'YGWrapNoWrap'}, YGWrapWrap:{value:'YGWrapWrap'}, + YGWrapWrapReverse:{value: 'YGWrapWrapReverse'}, YGUndefined:{value:'YGUndefined'}, diff --git a/gentest/gentest-cs.js b/gentest/gentest-cs.js index 42c6ff2c..57a20211 100644 --- a/gentest/gentest-cs.js +++ b/gentest/gentest-cs.js @@ -140,6 +140,7 @@ CSEmitter.prototype = Object.create(Emitter.prototype, { YGWrapNoWrap:{value:'YogaWrap.NoWrap'}, YGWrapWrap:{value:'YogaWrap.Wrap'}, + YGWrapWrapReverse:{value: 'YogaWrap.WrapReverse'}, YGNodeCalculateLayout:{value:function(node, dir) { this.push(node + '.StyleDirection = ' + dir + ';'); diff --git a/gentest/gentest-java.js b/gentest/gentest-java.js index 3d39764b..69fb7bb9 100644 --- a/gentest/gentest-java.js +++ b/gentest/gentest-java.js @@ -143,6 +143,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, { YGWrapNoWrap:{value:'YogaWrap.NO_WRAP'}, YGWrapWrap:{value:'YogaWrap.WRAP'}, + YGWrapWrapReverse:{value: 'YogaWrap.WRAP_REVERSE'}, YGNodeCalculateLayout:{value:function(node, dir) { this.push(node + '.setDirection(' + dir + ');'); diff --git a/gentest/gentest-javascript.js b/gentest/gentest-javascript.js index ea501722..c6bd1964 100644 --- a/gentest/gentest-javascript.js +++ b/gentest/gentest-javascript.js @@ -127,6 +127,7 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, { YGWrapNoWrap:{value:'Yoga.WRAP_NO_WRAP'}, YGWrapWrap:{value:'Yoga.WRAP_WRAP'}, + YGWrapWrapReverse:{value: 'Yoga.WRAP_WRAP_REVERSE'}, YGUndefined:{value:'Yoga.UNDEFINED'}, diff --git a/gentest/gentest.js b/gentest/gentest.js index 4649c00d..a26cd7cd 100755 --- a/gentest/gentest.js +++ b/gentest/gentest.js @@ -336,6 +336,7 @@ function overflowValue(e, value) { function wrapValue(e, value) { switch (value) { case 'wrap': return e.YGWrapWrap; + case 'wrap-reverse': return e.YGWrapWrapReverse; case 'nowrap': return e.YGWrapNoWrap; } } diff --git a/java/com/facebook/yoga/YogaWrap.java b/java/com/facebook/yoga/YogaWrap.java index 8109c56c..6e88ad72 100644 --- a/java/com/facebook/yoga/YogaWrap.java +++ b/java/com/facebook/yoga/YogaWrap.java @@ -14,7 +14,8 @@ import com.facebook.proguard.annotations.DoNotStrip; @DoNotStrip public enum YogaWrap { NO_WRAP(0), - WRAP(1); + WRAP(1), + WRAP_REVERSE(2); private int mIntValue; @@ -30,6 +31,7 @@ public enum YogaWrap { switch (value) { case 0: return NO_WRAP; case 1: return WRAP; + case 2: return WRAP_REVERSE; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } diff --git a/java/tests/com/facebook/yoga/YGFlexWrapTest.java b/java/tests/com/facebook/yoga/YGFlexWrapTest.java index 5ab76b1e..7743ec10 100644 --- a/java/tests/com/facebook/yoga/YGFlexWrapTest.java +++ b/java/tests/com/facebook/yoga/YGFlexWrapTest.java @@ -536,4 +536,596 @@ public class YGFlexWrapTest { assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); } + @Test + public void test_wrap_reverse_row_align_content_flex_start() { + final YogaNode root = new YogaNode(); + root.setFlexDirection(YogaFlexDirection.ROW); + root.setWrap(YogaWrap.WRAP_REVERSE); + root.setWidth(100f); + + final YogaNode root_child0 = new YogaNode(); + root_child0.setWidth(30f); + root_child0.setHeight(10f); + root.addChildAt(root_child0, 0); + + final YogaNode root_child1 = new YogaNode(); + root_child1.setWidth(30f); + root_child1.setHeight(20f); + root.addChildAt(root_child1, 1); + + final YogaNode root_child2 = new YogaNode(); + root_child2.setWidth(30f); + root_child2.setHeight(30f); + root.addChildAt(root_child2, 2); + + final YogaNode root_child3 = new YogaNode(); + root_child3.setWidth(30f); + root_child3.setHeight(40f); + root.addChildAt(root_child3, 3); + + final YogaNode root_child4 = new YogaNode(); + root_child4.setWidth(30f); + root_child4.setHeight(50f); + root.addChildAt(root_child4, 4); + root.setDirection(YogaDirection.LTR); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(100f, root.getLayoutWidth(), 0.0f); + assertEquals(80f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(70f, root_child0.getLayoutY(), 0.0f); + assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(30f, root_child1.getLayoutX(), 0.0f); + assertEquals(60f, root_child1.getLayoutY(), 0.0f); + assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); + + assertEquals(60f, root_child2.getLayoutX(), 0.0f); + assertEquals(50f, root_child2.getLayoutY(), 0.0f); + assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child3.getLayoutX(), 0.0f); + assertEquals(10f, root_child3.getLayoutY(), 0.0f); + assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); + assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); + + assertEquals(30f, root_child4.getLayoutX(), 0.0f); + assertEquals(0f, root_child4.getLayoutY(), 0.0f); + assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); + + root.setDirection(YogaDirection.RTL); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(100f, root.getLayoutWidth(), 0.0f); + assertEquals(80f, root.getLayoutHeight(), 0.0f); + + assertEquals(70f, root_child0.getLayoutX(), 0.0f); + assertEquals(70f, root_child0.getLayoutY(), 0.0f); + assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(40f, root_child1.getLayoutX(), 0.0f); + assertEquals(60f, root_child1.getLayoutY(), 0.0f); + assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); + + assertEquals(10f, root_child2.getLayoutX(), 0.0f); + assertEquals(50f, root_child2.getLayoutY(), 0.0f); + assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); + + assertEquals(70f, root_child3.getLayoutX(), 0.0f); + assertEquals(10f, root_child3.getLayoutY(), 0.0f); + assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); + assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); + + assertEquals(40f, root_child4.getLayoutX(), 0.0f); + assertEquals(0f, root_child4.getLayoutY(), 0.0f); + assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); + } + + @Test + public void test_wrap_reverse_row_align_content_center() { + final YogaNode root = new YogaNode(); + root.setFlexDirection(YogaFlexDirection.ROW); + root.setAlignContent(YogaAlign.CENTER); + root.setWrap(YogaWrap.WRAP_REVERSE); + root.setWidth(100f); + + final YogaNode root_child0 = new YogaNode(); + root_child0.setWidth(30f); + root_child0.setHeight(10f); + root.addChildAt(root_child0, 0); + + final YogaNode root_child1 = new YogaNode(); + root_child1.setWidth(30f); + root_child1.setHeight(20f); + root.addChildAt(root_child1, 1); + + final YogaNode root_child2 = new YogaNode(); + root_child2.setWidth(30f); + root_child2.setHeight(30f); + root.addChildAt(root_child2, 2); + + final YogaNode root_child3 = new YogaNode(); + root_child3.setWidth(30f); + root_child3.setHeight(40f); + root.addChildAt(root_child3, 3); + + final YogaNode root_child4 = new YogaNode(); + root_child4.setWidth(30f); + root_child4.setHeight(50f); + root.addChildAt(root_child4, 4); + root.setDirection(YogaDirection.LTR); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(100f, root.getLayoutWidth(), 0.0f); + assertEquals(80f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(70f, root_child0.getLayoutY(), 0.0f); + assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(30f, root_child1.getLayoutX(), 0.0f); + assertEquals(60f, root_child1.getLayoutY(), 0.0f); + assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); + + assertEquals(60f, root_child2.getLayoutX(), 0.0f); + assertEquals(50f, root_child2.getLayoutY(), 0.0f); + assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child3.getLayoutX(), 0.0f); + assertEquals(10f, root_child3.getLayoutY(), 0.0f); + assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); + assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); + + assertEquals(30f, root_child4.getLayoutX(), 0.0f); + assertEquals(0f, root_child4.getLayoutY(), 0.0f); + assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); + + root.setDirection(YogaDirection.RTL); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(100f, root.getLayoutWidth(), 0.0f); + assertEquals(80f, root.getLayoutHeight(), 0.0f); + + assertEquals(70f, root_child0.getLayoutX(), 0.0f); + assertEquals(70f, root_child0.getLayoutY(), 0.0f); + assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(40f, root_child1.getLayoutX(), 0.0f); + assertEquals(60f, root_child1.getLayoutY(), 0.0f); + assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); + + assertEquals(10f, root_child2.getLayoutX(), 0.0f); + assertEquals(50f, root_child2.getLayoutY(), 0.0f); + assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); + + assertEquals(70f, root_child3.getLayoutX(), 0.0f); + assertEquals(10f, root_child3.getLayoutY(), 0.0f); + assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); + assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); + + assertEquals(40f, root_child4.getLayoutX(), 0.0f); + assertEquals(0f, root_child4.getLayoutY(), 0.0f); + assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); + } + + @Test + public void test_wrap_reverse_row_single_line_different_size() { + final YogaNode root = new YogaNode(); + root.setFlexDirection(YogaFlexDirection.ROW); + root.setWrap(YogaWrap.WRAP_REVERSE); + root.setWidth(300f); + + final YogaNode root_child0 = new YogaNode(); + root_child0.setWidth(30f); + root_child0.setHeight(10f); + root.addChildAt(root_child0, 0); + + final YogaNode root_child1 = new YogaNode(); + root_child1.setWidth(30f); + root_child1.setHeight(20f); + root.addChildAt(root_child1, 1); + + final YogaNode root_child2 = new YogaNode(); + root_child2.setWidth(30f); + root_child2.setHeight(30f); + root.addChildAt(root_child2, 2); + + final YogaNode root_child3 = new YogaNode(); + root_child3.setWidth(30f); + root_child3.setHeight(40f); + root.addChildAt(root_child3, 3); + + final YogaNode root_child4 = new YogaNode(); + root_child4.setWidth(30f); + root_child4.setHeight(50f); + root.addChildAt(root_child4, 4); + root.setDirection(YogaDirection.LTR); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(300f, root.getLayoutWidth(), 0.0f); + assertEquals(50f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(40f, root_child0.getLayoutY(), 0.0f); + assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(30f, root_child1.getLayoutX(), 0.0f); + assertEquals(30f, root_child1.getLayoutY(), 0.0f); + assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); + + assertEquals(60f, root_child2.getLayoutX(), 0.0f); + assertEquals(20f, root_child2.getLayoutY(), 0.0f); + assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); + + assertEquals(90f, root_child3.getLayoutX(), 0.0f); + assertEquals(10f, root_child3.getLayoutY(), 0.0f); + assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); + assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); + + assertEquals(120f, root_child4.getLayoutX(), 0.0f); + assertEquals(0f, root_child4.getLayoutY(), 0.0f); + assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); + + root.setDirection(YogaDirection.RTL); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(300f, root.getLayoutWidth(), 0.0f); + assertEquals(50f, root.getLayoutHeight(), 0.0f); + + assertEquals(270f, root_child0.getLayoutX(), 0.0f); + assertEquals(40f, root_child0.getLayoutY(), 0.0f); + assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(240f, root_child1.getLayoutX(), 0.0f); + assertEquals(30f, root_child1.getLayoutY(), 0.0f); + assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); + + assertEquals(210f, root_child2.getLayoutX(), 0.0f); + assertEquals(20f, root_child2.getLayoutY(), 0.0f); + assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); + + assertEquals(180f, root_child3.getLayoutX(), 0.0f); + assertEquals(10f, root_child3.getLayoutY(), 0.0f); + assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); + assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); + + assertEquals(150f, root_child4.getLayoutX(), 0.0f); + assertEquals(0f, root_child4.getLayoutY(), 0.0f); + assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); + } + + @Test + public void test_wrap_reverse_row_align_content_stretch() { + final YogaNode root = new YogaNode(); + root.setFlexDirection(YogaFlexDirection.ROW); + root.setAlignContent(YogaAlign.STRETCH); + root.setWrap(YogaWrap.WRAP_REVERSE); + root.setWidth(100f); + + final YogaNode root_child0 = new YogaNode(); + root_child0.setWidth(30f); + root_child0.setHeight(10f); + root.addChildAt(root_child0, 0); + + final YogaNode root_child1 = new YogaNode(); + root_child1.setWidth(30f); + root_child1.setHeight(20f); + root.addChildAt(root_child1, 1); + + final YogaNode root_child2 = new YogaNode(); + root_child2.setWidth(30f); + root_child2.setHeight(30f); + root.addChildAt(root_child2, 2); + + final YogaNode root_child3 = new YogaNode(); + root_child3.setWidth(30f); + root_child3.setHeight(40f); + root.addChildAt(root_child3, 3); + + final YogaNode root_child4 = new YogaNode(); + root_child4.setWidth(30f); + root_child4.setHeight(50f); + root.addChildAt(root_child4, 4); + root.setDirection(YogaDirection.LTR); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(100f, root.getLayoutWidth(), 0.0f); + assertEquals(80f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(70f, root_child0.getLayoutY(), 0.0f); + assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(30f, root_child1.getLayoutX(), 0.0f); + assertEquals(60f, root_child1.getLayoutY(), 0.0f); + assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); + + assertEquals(60f, root_child2.getLayoutX(), 0.0f); + assertEquals(50f, root_child2.getLayoutY(), 0.0f); + assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child3.getLayoutX(), 0.0f); + assertEquals(10f, root_child3.getLayoutY(), 0.0f); + assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); + assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); + + assertEquals(30f, root_child4.getLayoutX(), 0.0f); + assertEquals(0f, root_child4.getLayoutY(), 0.0f); + assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); + + root.setDirection(YogaDirection.RTL); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(100f, root.getLayoutWidth(), 0.0f); + assertEquals(80f, root.getLayoutHeight(), 0.0f); + + assertEquals(70f, root_child0.getLayoutX(), 0.0f); + assertEquals(70f, root_child0.getLayoutY(), 0.0f); + assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(40f, root_child1.getLayoutX(), 0.0f); + assertEquals(60f, root_child1.getLayoutY(), 0.0f); + assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); + + assertEquals(10f, root_child2.getLayoutX(), 0.0f); + assertEquals(50f, root_child2.getLayoutY(), 0.0f); + assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); + + assertEquals(70f, root_child3.getLayoutX(), 0.0f); + assertEquals(10f, root_child3.getLayoutY(), 0.0f); + assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); + assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); + + assertEquals(40f, root_child4.getLayoutX(), 0.0f); + assertEquals(0f, root_child4.getLayoutY(), 0.0f); + assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); + } + + @Test + public void test_wrap_reverse_row_align_content_space_around() { + final YogaNode root = new YogaNode(); + root.setFlexDirection(YogaFlexDirection.ROW); + root.setAlignContent(YogaAlign.SPACE_AROUND); + root.setWrap(YogaWrap.WRAP_REVERSE); + root.setWidth(100f); + + final YogaNode root_child0 = new YogaNode(); + root_child0.setWidth(30f); + root_child0.setHeight(10f); + root.addChildAt(root_child0, 0); + + final YogaNode root_child1 = new YogaNode(); + root_child1.setWidth(30f); + root_child1.setHeight(20f); + root.addChildAt(root_child1, 1); + + final YogaNode root_child2 = new YogaNode(); + root_child2.setWidth(30f); + root_child2.setHeight(30f); + root.addChildAt(root_child2, 2); + + final YogaNode root_child3 = new YogaNode(); + root_child3.setWidth(30f); + root_child3.setHeight(40f); + root.addChildAt(root_child3, 3); + + final YogaNode root_child4 = new YogaNode(); + root_child4.setWidth(30f); + root_child4.setHeight(50f); + root.addChildAt(root_child4, 4); + root.setDirection(YogaDirection.LTR); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(100f, root.getLayoutWidth(), 0.0f); + assertEquals(80f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(70f, root_child0.getLayoutY(), 0.0f); + assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(30f, root_child1.getLayoutX(), 0.0f); + assertEquals(60f, root_child1.getLayoutY(), 0.0f); + assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); + + assertEquals(60f, root_child2.getLayoutX(), 0.0f); + assertEquals(50f, root_child2.getLayoutY(), 0.0f); + assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child3.getLayoutX(), 0.0f); + assertEquals(10f, root_child3.getLayoutY(), 0.0f); + assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); + assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); + + assertEquals(30f, root_child4.getLayoutX(), 0.0f); + assertEquals(0f, root_child4.getLayoutY(), 0.0f); + assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); + + root.setDirection(YogaDirection.RTL); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(100f, root.getLayoutWidth(), 0.0f); + assertEquals(80f, root.getLayoutHeight(), 0.0f); + + assertEquals(70f, root_child0.getLayoutX(), 0.0f); + assertEquals(70f, root_child0.getLayoutY(), 0.0f); + assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(40f, root_child1.getLayoutX(), 0.0f); + assertEquals(60f, root_child1.getLayoutY(), 0.0f); + assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); + + assertEquals(10f, root_child2.getLayoutX(), 0.0f); + assertEquals(50f, root_child2.getLayoutY(), 0.0f); + assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); + + assertEquals(70f, root_child3.getLayoutX(), 0.0f); + assertEquals(10f, root_child3.getLayoutY(), 0.0f); + assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); + assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); + + assertEquals(40f, root_child4.getLayoutX(), 0.0f); + assertEquals(0f, root_child4.getLayoutY(), 0.0f); + assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); + } + + @Test + public void test_wrap_reverse_column_fixed_size() { + final YogaNode root = new YogaNode(); + root.setAlignItems(YogaAlign.CENTER); + root.setWrap(YogaWrap.WRAP_REVERSE); + root.setWidth(200f); + root.setHeight(100f); + + final YogaNode root_child0 = new YogaNode(); + root_child0.setWidth(30f); + root_child0.setHeight(10f); + root.addChildAt(root_child0, 0); + + final YogaNode root_child1 = new YogaNode(); + root_child1.setWidth(30f); + root_child1.setHeight(20f); + root.addChildAt(root_child1, 1); + + final YogaNode root_child2 = new YogaNode(); + root_child2.setWidth(30f); + root_child2.setHeight(30f); + root.addChildAt(root_child2, 2); + + final YogaNode root_child3 = new YogaNode(); + root_child3.setWidth(30f); + root_child3.setHeight(40f); + root.addChildAt(root_child3, 3); + + final YogaNode root_child4 = new YogaNode(); + root_child4.setWidth(30f); + root_child4.setHeight(50f); + root.addChildAt(root_child4, 4); + root.setDirection(YogaDirection.LTR); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(100f, root.getLayoutHeight(), 0.0f); + + assertEquals(170f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(170f, root_child1.getLayoutX(), 0.0f); + assertEquals(10f, root_child1.getLayoutY(), 0.0f); + assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); + + assertEquals(170f, root_child2.getLayoutX(), 0.0f); + assertEquals(30f, root_child2.getLayoutY(), 0.0f); + assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); + + assertEquals(170f, root_child3.getLayoutX(), 0.0f); + assertEquals(60f, root_child3.getLayoutY(), 0.0f); + assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); + assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); + + assertEquals(140f, root_child4.getLayoutX(), 0.0f); + assertEquals(0f, root_child4.getLayoutY(), 0.0f); + assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); + + root.setDirection(YogaDirection.RTL); + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); + + assertEquals(0f, root.getLayoutX(), 0.0f); + assertEquals(0f, root.getLayoutY(), 0.0f); + assertEquals(200f, root.getLayoutWidth(), 0.0f); + assertEquals(100f, root.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child0.getLayoutX(), 0.0f); + assertEquals(0f, root_child0.getLayoutY(), 0.0f); + assertEquals(30f, root_child0.getLayoutWidth(), 0.0f); + assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child1.getLayoutX(), 0.0f); + assertEquals(10f, root_child1.getLayoutY(), 0.0f); + assertEquals(30f, root_child1.getLayoutWidth(), 0.0f); + assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child2.getLayoutX(), 0.0f); + assertEquals(30f, root_child2.getLayoutY(), 0.0f); + assertEquals(30f, root_child2.getLayoutWidth(), 0.0f); + assertEquals(30f, root_child2.getLayoutHeight(), 0.0f); + + assertEquals(0f, root_child3.getLayoutX(), 0.0f); + assertEquals(60f, root_child3.getLayoutY(), 0.0f); + assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); + assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); + + assertEquals(30f, root_child4.getLayoutX(), 0.0f); + assertEquals(0f, root_child4.getLayoutY(), 0.0f); + assertEquals(30f, root_child4.getLayoutWidth(), 0.0f); + assertEquals(50f, root_child4.getLayoutHeight(), 0.0f); + } + } diff --git a/javascript/sources/YGEnums.js b/javascript/sources/YGEnums.js index af39cf39..91db6a3b 100644 --- a/javascript/sources/YGEnums.js +++ b/javascript/sources/YGEnums.js @@ -92,8 +92,9 @@ module.exports = { UNIT_PERCENT: 2, UNIT_AUTO: 3, - WRAP_COUNT: 2, + WRAP_COUNT: 3, WRAP_NO_WRAP: 0, WRAP_WRAP: 1, + WRAP_WRAP_REVERSE: 2, }; diff --git a/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js b/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js index 7048dbf8..8327bd8c 100644 --- a/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js +++ b/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js @@ -545,3 +545,607 @@ it("flex_wrap_align_stretch_fits_one_row", function () { (typeof gc !== "undefined") && gc(); console.assert(0 === Yoga.getInstanceCount(), "0 === Yoga.getInstanceCount() (" + Yoga.getInstanceCount() + ")"); }); +it("wrap_reverse_row_align_content_flex_start", function () { + var root = Yoga.Node.create(); + root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); + root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE); + root.setWidth(100); + + var root_child0 = Yoga.Node.create(); + root_child0.setWidth(30); + root_child0.setHeight(10); + root.insertChild(root_child0, 0); + + var root_child1 = Yoga.Node.create(); + root_child1.setWidth(30); + root_child1.setHeight(20); + root.insertChild(root_child1, 1); + + var root_child2 = Yoga.Node.create(); + root_child2.setWidth(30); + root_child2.setHeight(30); + root.insertChild(root_child2, 2); + + var root_child3 = Yoga.Node.create(); + root_child3.setWidth(30); + root_child3.setHeight(40); + root.insertChild(root_child3, 3); + + var root_child4 = Yoga.Node.create(); + root_child4.setWidth(30); + root_child4.setHeight(50); + root.insertChild(root_child4, 4); + root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); + + console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); + console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); + console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); + console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + + console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); + console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); + console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); + console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + + console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); + console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); + console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); + console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + + console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); + console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); + console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); + console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + + console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); + console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); + console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); + console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + + console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); + console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); + console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); + console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + + root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); + + console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); + console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); + console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); + console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + + console.assert(70 === root_child0.getComputedLeft(), "70 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); + console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); + console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); + console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + + console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); + console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); + console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); + console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + + console.assert(10 === root_child2.getComputedLeft(), "10 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); + console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); + console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); + console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + + console.assert(70 === root_child3.getComputedLeft(), "70 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); + console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); + console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); + console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + + console.assert(40 === root_child4.getComputedLeft(), "40 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); + console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); + console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); + console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + + if (typeof root !== "undefined") + root.freeRecursive(); + + (typeof gc !== "undefined") && gc(); + console.assert(0 === Yoga.getInstanceCount(), "0 === Yoga.getInstanceCount() (" + Yoga.getInstanceCount() + ")"); +}); +it("wrap_reverse_row_align_content_center", function () { + var root = Yoga.Node.create(); + root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); + root.setAlignContent(Yoga.ALIGN_CENTER); + root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE); + root.setWidth(100); + + var root_child0 = Yoga.Node.create(); + root_child0.setWidth(30); + root_child0.setHeight(10); + root.insertChild(root_child0, 0); + + var root_child1 = Yoga.Node.create(); + root_child1.setWidth(30); + root_child1.setHeight(20); + root.insertChild(root_child1, 1); + + var root_child2 = Yoga.Node.create(); + root_child2.setWidth(30); + root_child2.setHeight(30); + root.insertChild(root_child2, 2); + + var root_child3 = Yoga.Node.create(); + root_child3.setWidth(30); + root_child3.setHeight(40); + root.insertChild(root_child3, 3); + + var root_child4 = Yoga.Node.create(); + root_child4.setWidth(30); + root_child4.setHeight(50); + root.insertChild(root_child4, 4); + root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); + + console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); + console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); + console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); + console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + + console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); + console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); + console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); + console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + + console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); + console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); + console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); + console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + + console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); + console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); + console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); + console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + + console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); + console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); + console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); + console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + + console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); + console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); + console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); + console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + + root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); + + console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); + console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); + console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); + console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + + console.assert(70 === root_child0.getComputedLeft(), "70 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); + console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); + console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); + console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + + console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); + console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); + console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); + console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + + console.assert(10 === root_child2.getComputedLeft(), "10 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); + console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); + console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); + console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + + console.assert(70 === root_child3.getComputedLeft(), "70 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); + console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); + console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); + console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + + console.assert(40 === root_child4.getComputedLeft(), "40 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); + console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); + console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); + console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + + if (typeof root !== "undefined") + root.freeRecursive(); + + (typeof gc !== "undefined") && gc(); + console.assert(0 === Yoga.getInstanceCount(), "0 === Yoga.getInstanceCount() (" + Yoga.getInstanceCount() + ")"); +}); +it("wrap_reverse_row_single_line_different_size", function () { + var root = Yoga.Node.create(); + root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); + root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE); + root.setWidth(300); + + var root_child0 = Yoga.Node.create(); + root_child0.setWidth(30); + root_child0.setHeight(10); + root.insertChild(root_child0, 0); + + var root_child1 = Yoga.Node.create(); + root_child1.setWidth(30); + root_child1.setHeight(20); + root.insertChild(root_child1, 1); + + var root_child2 = Yoga.Node.create(); + root_child2.setWidth(30); + root_child2.setHeight(30); + root.insertChild(root_child2, 2); + + var root_child3 = Yoga.Node.create(); + root_child3.setWidth(30); + root_child3.setHeight(40); + root.insertChild(root_child3, 3); + + var root_child4 = Yoga.Node.create(); + root_child4.setWidth(30); + root_child4.setHeight(50); + root.insertChild(root_child4, 4); + root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); + + console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); + console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); + console.assert(300 === root.getComputedWidth(), "300 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); + console.assert(50 === root.getComputedHeight(), "50 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + + console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); + console.assert(40 === root_child0.getComputedTop(), "40 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); + console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); + console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + + console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); + console.assert(30 === root_child1.getComputedTop(), "30 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); + console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); + console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + + console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); + console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); + console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); + console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + + console.assert(90 === root_child3.getComputedLeft(), "90 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); + console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); + console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); + console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + + console.assert(120 === root_child4.getComputedLeft(), "120 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); + console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); + console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); + console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + + root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); + + console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); + console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); + console.assert(300 === root.getComputedWidth(), "300 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); + console.assert(50 === root.getComputedHeight(), "50 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + + console.assert(270 === root_child0.getComputedLeft(), "270 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); + console.assert(40 === root_child0.getComputedTop(), "40 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); + console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); + console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + + console.assert(240 === root_child1.getComputedLeft(), "240 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); + console.assert(30 === root_child1.getComputedTop(), "30 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); + console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); + console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + + console.assert(210 === root_child2.getComputedLeft(), "210 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); + console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); + console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); + console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + + console.assert(180 === root_child3.getComputedLeft(), "180 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); + console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); + console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); + console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + + console.assert(150 === root_child4.getComputedLeft(), "150 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); + console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); + console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); + console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + + if (typeof root !== "undefined") + root.freeRecursive(); + + (typeof gc !== "undefined") && gc(); + console.assert(0 === Yoga.getInstanceCount(), "0 === Yoga.getInstanceCount() (" + Yoga.getInstanceCount() + ")"); +}); +it("wrap_reverse_row_align_content_stretch", function () { + var root = Yoga.Node.create(); + root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); + root.setAlignContent(Yoga.ALIGN_STRETCH); + root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE); + root.setWidth(100); + + var root_child0 = Yoga.Node.create(); + root_child0.setWidth(30); + root_child0.setHeight(10); + root.insertChild(root_child0, 0); + + var root_child1 = Yoga.Node.create(); + root_child1.setWidth(30); + root_child1.setHeight(20); + root.insertChild(root_child1, 1); + + var root_child2 = Yoga.Node.create(); + root_child2.setWidth(30); + root_child2.setHeight(30); + root.insertChild(root_child2, 2); + + var root_child3 = Yoga.Node.create(); + root_child3.setWidth(30); + root_child3.setHeight(40); + root.insertChild(root_child3, 3); + + var root_child4 = Yoga.Node.create(); + root_child4.setWidth(30); + root_child4.setHeight(50); + root.insertChild(root_child4, 4); + root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); + + console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); + console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); + console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); + console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + + console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); + console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); + console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); + console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + + console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); + console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); + console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); + console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + + console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); + console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); + console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); + console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + + console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); + console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); + console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); + console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + + console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); + console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); + console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); + console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + + root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); + + console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); + console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); + console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); + console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + + console.assert(70 === root_child0.getComputedLeft(), "70 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); + console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); + console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); + console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + + console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); + console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); + console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); + console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + + console.assert(10 === root_child2.getComputedLeft(), "10 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); + console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); + console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); + console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + + console.assert(70 === root_child3.getComputedLeft(), "70 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); + console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); + console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); + console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + + console.assert(40 === root_child4.getComputedLeft(), "40 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); + console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); + console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); + console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + + if (typeof root !== "undefined") + root.freeRecursive(); + + (typeof gc !== "undefined") && gc(); + console.assert(0 === Yoga.getInstanceCount(), "0 === Yoga.getInstanceCount() (" + Yoga.getInstanceCount() + ")"); +}); +it("wrap_reverse_row_align_content_space_around", function () { + var root = Yoga.Node.create(); + root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); + root.setAlignContent(Yoga.ALIGN_SPACE_AROUND); + root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE); + root.setWidth(100); + + var root_child0 = Yoga.Node.create(); + root_child0.setWidth(30); + root_child0.setHeight(10); + root.insertChild(root_child0, 0); + + var root_child1 = Yoga.Node.create(); + root_child1.setWidth(30); + root_child1.setHeight(20); + root.insertChild(root_child1, 1); + + var root_child2 = Yoga.Node.create(); + root_child2.setWidth(30); + root_child2.setHeight(30); + root.insertChild(root_child2, 2); + + var root_child3 = Yoga.Node.create(); + root_child3.setWidth(30); + root_child3.setHeight(40); + root.insertChild(root_child3, 3); + + var root_child4 = Yoga.Node.create(); + root_child4.setWidth(30); + root_child4.setHeight(50); + root.insertChild(root_child4, 4); + root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); + + console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); + console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); + console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); + console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + + console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); + console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); + console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); + console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + + console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); + console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); + console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); + console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + + console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); + console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); + console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); + console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + + console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); + console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); + console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); + console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + + console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); + console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); + console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); + console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + + root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); + + console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); + console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); + console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); + console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + + console.assert(70 === root_child0.getComputedLeft(), "70 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); + console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); + console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); + console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + + console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); + console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); + console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); + console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + + console.assert(10 === root_child2.getComputedLeft(), "10 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); + console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); + console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); + console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + + console.assert(70 === root_child3.getComputedLeft(), "70 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); + console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); + console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); + console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + + console.assert(40 === root_child4.getComputedLeft(), "40 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); + console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); + console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); + console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + + if (typeof root !== "undefined") + root.freeRecursive(); + + (typeof gc !== "undefined") && gc(); + console.assert(0 === Yoga.getInstanceCount(), "0 === Yoga.getInstanceCount() (" + Yoga.getInstanceCount() + ")"); +}); +it("wrap_reverse_column_fixed_size", function () { + var root = Yoga.Node.create(); + root.setAlignItems(Yoga.ALIGN_CENTER); + root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE); + root.setWidth(200); + root.setHeight(100); + + var root_child0 = Yoga.Node.create(); + root_child0.setWidth(30); + root_child0.setHeight(10); + root.insertChild(root_child0, 0); + + var root_child1 = Yoga.Node.create(); + root_child1.setWidth(30); + root_child1.setHeight(20); + root.insertChild(root_child1, 1); + + var root_child2 = Yoga.Node.create(); + root_child2.setWidth(30); + root_child2.setHeight(30); + root.insertChild(root_child2, 2); + + var root_child3 = Yoga.Node.create(); + root_child3.setWidth(30); + root_child3.setHeight(40); + root.insertChild(root_child3, 3); + + var root_child4 = Yoga.Node.create(); + root_child4.setWidth(30); + root_child4.setHeight(50); + root.insertChild(root_child4, 4); + root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); + + console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); + console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); + console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); + console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + + console.assert(170 === root_child0.getComputedLeft(), "170 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); + console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); + console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); + console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + + console.assert(170 === root_child1.getComputedLeft(), "170 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); + console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); + console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); + console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + + console.assert(170 === root_child2.getComputedLeft(), "170 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); + console.assert(30 === root_child2.getComputedTop(), "30 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); + console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); + console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + + console.assert(170 === root_child3.getComputedLeft(), "170 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); + console.assert(60 === root_child3.getComputedTop(), "60 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); + console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); + console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + + console.assert(140 === root_child4.getComputedLeft(), "140 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); + console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); + console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); + console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + + root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); + + console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); + console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); + console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); + console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + + console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); + console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); + console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); + console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + + console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); + console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); + console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); + console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + + console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); + console.assert(30 === root_child2.getComputedTop(), "30 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); + console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); + console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + + console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); + console.assert(60 === root_child3.getComputedTop(), "60 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); + console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); + console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + + console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); + console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); + console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); + console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + + if (typeof root !== "undefined") + root.freeRecursive(); + + (typeof gc !== "undefined") && gc(); + console.assert(0 === Yoga.getInstanceCount(), "0 === Yoga.getInstanceCount() (" + Yoga.getInstanceCount() + ")"); +}); diff --git a/tests/YGFlexWrapTest.cpp b/tests/YGFlexWrapTest.cpp index 03799b0e..2d732da7 100644 --- a/tests/YGFlexWrapTest.cpp +++ b/tests/YGFlexWrapTest.cpp @@ -524,3 +524,589 @@ TEST(YogaTest, flex_wrap_align_stretch_fits_one_row) { YGNodeFreeRecursive(root); } + +TEST(YogaTest, wrap_reverse_row_align_content_flex_start) { + const YGNodeRef root = YGNodeNew(); + YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); + YGNodeStyleSetFlexWrap(root, YGWrapWrapReverse); + YGNodeStyleSetWidth(root, 100); + + const YGNodeRef root_child0 = YGNodeNew(); + YGNodeStyleSetWidth(root_child0, 30); + YGNodeStyleSetHeight(root_child0, 10); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child1 = YGNodeNew(); + YGNodeStyleSetWidth(root_child1, 30); + YGNodeStyleSetHeight(root_child1, 20); + YGNodeInsertChild(root, root_child1, 1); + + const YGNodeRef root_child2 = YGNodeNew(); + YGNodeStyleSetWidth(root_child2, 30); + YGNodeStyleSetHeight(root_child2, 30); + YGNodeInsertChild(root, root_child2, 2); + + const YGNodeRef root_child3 = YGNodeNew(); + YGNodeStyleSetWidth(root_child3, 30); + YGNodeStyleSetHeight(root_child3, 40); + YGNodeInsertChild(root, root_child3, 3); + + const YGNodeRef root_child4 = YGNodeNew(); + YGNodeStyleSetWidth(root_child4, 30); + YGNodeStyleSetHeight(root_child4, 50); + YGNodeInsertChild(root, root_child4, 4); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(70, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1)); + + ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child2)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child3)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child3)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child3)); + + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child4)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child4)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(70, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1)); + + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child2)); + + ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child3)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child3)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child3)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child3)); + + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child4)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child4)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4)); + + YGNodeFreeRecursive(root); +} + +TEST(YogaTest, wrap_reverse_row_align_content_center) { + const YGNodeRef root = YGNodeNew(); + YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); + YGNodeStyleSetAlignContent(root, YGAlignCenter); + YGNodeStyleSetFlexWrap(root, YGWrapWrapReverse); + YGNodeStyleSetWidth(root, 100); + + const YGNodeRef root_child0 = YGNodeNew(); + YGNodeStyleSetWidth(root_child0, 30); + YGNodeStyleSetHeight(root_child0, 10); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child1 = YGNodeNew(); + YGNodeStyleSetWidth(root_child1, 30); + YGNodeStyleSetHeight(root_child1, 20); + YGNodeInsertChild(root, root_child1, 1); + + const YGNodeRef root_child2 = YGNodeNew(); + YGNodeStyleSetWidth(root_child2, 30); + YGNodeStyleSetHeight(root_child2, 30); + YGNodeInsertChild(root, root_child2, 2); + + const YGNodeRef root_child3 = YGNodeNew(); + YGNodeStyleSetWidth(root_child3, 30); + YGNodeStyleSetHeight(root_child3, 40); + YGNodeInsertChild(root, root_child3, 3); + + const YGNodeRef root_child4 = YGNodeNew(); + YGNodeStyleSetWidth(root_child4, 30); + YGNodeStyleSetHeight(root_child4, 50); + YGNodeInsertChild(root, root_child4, 4); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(70, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1)); + + ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child2)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child3)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child3)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child3)); + + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child4)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child4)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(70, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1)); + + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child2)); + + ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child3)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child3)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child3)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child3)); + + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child4)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child4)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4)); + + YGNodeFreeRecursive(root); +} + +TEST(YogaTest, wrap_reverse_row_single_line_different_size) { + const YGNodeRef root = YGNodeNew(); + YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); + YGNodeStyleSetFlexWrap(root, YGWrapWrapReverse); + YGNodeStyleSetWidth(root, 300); + + const YGNodeRef root_child0 = YGNodeNew(); + YGNodeStyleSetWidth(root_child0, 30); + YGNodeStyleSetHeight(root_child0, 10); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child1 = YGNodeNew(); + YGNodeStyleSetWidth(root_child1, 30); + YGNodeStyleSetHeight(root_child1, 20); + YGNodeInsertChild(root, root_child1, 1); + + const YGNodeRef root_child2 = YGNodeNew(); + YGNodeStyleSetWidth(root_child2, 30); + YGNodeStyleSetHeight(root_child2, 30); + YGNodeInsertChild(root, root_child2, 2); + + const YGNodeRef root_child3 = YGNodeNew(); + YGNodeStyleSetWidth(root_child3, 30); + YGNodeStyleSetHeight(root_child3, 40); + YGNodeInsertChild(root, root_child3, 3); + + const YGNodeRef root_child4 = YGNodeNew(); + YGNodeStyleSetWidth(root_child4, 30); + YGNodeStyleSetHeight(root_child4, 50); + YGNodeInsertChild(root, root_child4, 4); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(300, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1)); + + ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child2)); + + ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child3)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child3)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child3)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child3)); + + ASSERT_FLOAT_EQ(120, YGNodeLayoutGetLeft(root_child4)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child4)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(300, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(270, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(240, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1)); + + ASSERT_FLOAT_EQ(210, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child2)); + + ASSERT_FLOAT_EQ(180, YGNodeLayoutGetLeft(root_child3)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child3)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child3)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child3)); + + ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child4)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child4)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4)); + + YGNodeFreeRecursive(root); +} + +TEST(YogaTest, wrap_reverse_row_align_content_stretch) { + const YGNodeRef root = YGNodeNew(); + YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); + YGNodeStyleSetAlignContent(root, YGAlignStretch); + YGNodeStyleSetFlexWrap(root, YGWrapWrapReverse); + YGNodeStyleSetWidth(root, 100); + + const YGNodeRef root_child0 = YGNodeNew(); + YGNodeStyleSetWidth(root_child0, 30); + YGNodeStyleSetHeight(root_child0, 10); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child1 = YGNodeNew(); + YGNodeStyleSetWidth(root_child1, 30); + YGNodeStyleSetHeight(root_child1, 20); + YGNodeInsertChild(root, root_child1, 1); + + const YGNodeRef root_child2 = YGNodeNew(); + YGNodeStyleSetWidth(root_child2, 30); + YGNodeStyleSetHeight(root_child2, 30); + YGNodeInsertChild(root, root_child2, 2); + + const YGNodeRef root_child3 = YGNodeNew(); + YGNodeStyleSetWidth(root_child3, 30); + YGNodeStyleSetHeight(root_child3, 40); + YGNodeInsertChild(root, root_child3, 3); + + const YGNodeRef root_child4 = YGNodeNew(); + YGNodeStyleSetWidth(root_child4, 30); + YGNodeStyleSetHeight(root_child4, 50); + YGNodeInsertChild(root, root_child4, 4); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(70, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1)); + + ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child2)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child3)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child3)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child3)); + + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child4)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child4)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(70, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1)); + + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child2)); + + ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child3)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child3)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child3)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child3)); + + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child4)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child4)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4)); + + YGNodeFreeRecursive(root); +} + +TEST(YogaTest, wrap_reverse_row_align_content_space_around) { + const YGNodeRef root = YGNodeNew(); + YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); + YGNodeStyleSetAlignContent(root, YGAlignSpaceAround); + YGNodeStyleSetFlexWrap(root, YGWrapWrapReverse); + YGNodeStyleSetWidth(root, 100); + + const YGNodeRef root_child0 = YGNodeNew(); + YGNodeStyleSetWidth(root_child0, 30); + YGNodeStyleSetHeight(root_child0, 10); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child1 = YGNodeNew(); + YGNodeStyleSetWidth(root_child1, 30); + YGNodeStyleSetHeight(root_child1, 20); + YGNodeInsertChild(root, root_child1, 1); + + const YGNodeRef root_child2 = YGNodeNew(); + YGNodeStyleSetWidth(root_child2, 30); + YGNodeStyleSetHeight(root_child2, 30); + YGNodeInsertChild(root, root_child2, 2); + + const YGNodeRef root_child3 = YGNodeNew(); + YGNodeStyleSetWidth(root_child3, 30); + YGNodeStyleSetHeight(root_child3, 40); + YGNodeInsertChild(root, root_child3, 3); + + const YGNodeRef root_child4 = YGNodeNew(); + YGNodeStyleSetWidth(root_child4, 30); + YGNodeStyleSetHeight(root_child4, 50); + YGNodeInsertChild(root, root_child4, 4); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(70, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1)); + + ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child2)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child3)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child3)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child3)); + + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child4)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child4)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(70, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1)); + + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child2)); + + ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child3)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child3)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child3)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child3)); + + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child4)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child4)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4)); + + YGNodeFreeRecursive(root); +} + +TEST(YogaTest, wrap_reverse_column_fixed_size) { + const YGNodeRef root = YGNodeNew(); + YGNodeStyleSetAlignItems(root, YGAlignCenter); + YGNodeStyleSetFlexWrap(root, YGWrapWrapReverse); + YGNodeStyleSetWidth(root, 200); + YGNodeStyleSetHeight(root, 100); + + const YGNodeRef root_child0 = YGNodeNew(); + YGNodeStyleSetWidth(root_child0, 30); + YGNodeStyleSetHeight(root_child0, 10); + YGNodeInsertChild(root, root_child0, 0); + + const YGNodeRef root_child1 = YGNodeNew(); + YGNodeStyleSetWidth(root_child1, 30); + YGNodeStyleSetHeight(root_child1, 20); + YGNodeInsertChild(root, root_child1, 1); + + const YGNodeRef root_child2 = YGNodeNew(); + YGNodeStyleSetWidth(root_child2, 30); + YGNodeStyleSetHeight(root_child2, 30); + YGNodeInsertChild(root, root_child2, 2); + + const YGNodeRef root_child3 = YGNodeNew(); + YGNodeStyleSetWidth(root_child3, 30); + YGNodeStyleSetHeight(root_child3, 40); + YGNodeInsertChild(root, root_child3, 3); + + const YGNodeRef root_child4 = YGNodeNew(); + YGNodeStyleSetWidth(root_child4, 30); + YGNodeStyleSetHeight(root_child4, 50); + YGNodeInsertChild(root, root_child4, 4); + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(170, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(170, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1)); + + ASSERT_FLOAT_EQ(170, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child2)); + + ASSERT_FLOAT_EQ(170, YGNodeLayoutGetLeft(root_child3)); + ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child3)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child3)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child3)); + + ASSERT_FLOAT_EQ(140, YGNodeLayoutGetLeft(root_child4)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child4)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4)); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root)); + ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root)); + ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child0)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1)); + ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child1)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1)); + ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child2)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child2)); + + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child3)); + ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child3)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child3)); + ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child3)); + + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child4)); + ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child4)); + ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child4)); + ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child4)); + + YGNodeFreeRecursive(root); +} diff --git a/yoga/YGEnums.h b/yoga/YGEnums.h index f2534334..e466ad7b 100644 --- a/yoga/YGEnums.h +++ b/yoga/YGEnums.h @@ -124,10 +124,11 @@ typedef YG_ENUM_BEGIN(YGUnit) { YGUnitAuto, } YG_ENUM_END(YGUnit); -#define YGWrapCount 2 +#define YGWrapCount 3 typedef YG_ENUM_BEGIN(YGWrap) { YGWrapNoWrap, YGWrapWrap, + YGWrapWrapReverse, } YG_ENUM_END(YGWrap); YG_EXTERN_C_END diff --git a/yoga/Yoga.c b/yoga/Yoga.c index f799a617..ccb947d5 100644 --- a/yoga/Yoga.c +++ b/yoga/Yoga.c @@ -1072,7 +1072,8 @@ static float YGBaseline(const YGNodeRef node) { } YGNodeRef baselineChild = NULL; - for (uint32_t i = 0; i < YGNodeGetChildCount(node); i++) { + const uint32_t childCount = YGNodeGetChildCount(node); + for (uint32_t i = 0; i < childCount; i++) { const YGNodeRef child = YGNodeGetChild(node, i); if (child->lineIndex > 0) { break; @@ -1130,7 +1131,8 @@ static bool YGIsBaselineLayout(const YGNodeRef node) { if (node->style.alignItems == YGAlignBaseline) { return true; } - for (uint32_t i = 0; i < YGNodeGetChildCount(node); i++) { + const uint32_t childCount = YGNodeGetChildCount(node); + for (uint32_t i = 0; i < childCount; i++) { const YGNodeRef child = YGNodeGetChild(node, i); if (child->style.positionType == YGPositionTypeRelative && child->style.alignSelf == YGAlignBaseline) { @@ -1735,7 +1737,8 @@ static void YGZeroOutLayoutRecursivly(const YGNodeRef node) { node->layout.position[YGEdgeBottom] = 0; node->layout.position[YGEdgeLeft] = 0; node->layout.position[YGEdgeRight] = 0; - for (uint32_t i = 0; i < YGNodeGetChildCount(node); i++) { + const uint32_t childCount = YGNodeGetChildCount(node); + for (uint32_t i = 0; i < childCount; i++) { const YGNodeRef child = YGNodeListGet(node->children, i); YGZeroOutLayoutRecursivly(child); } @@ -1759,9 +1762,6 @@ static void YGZeroOutLayoutRecursivly(const YGNodeRef node) { // * The 'visibility' property is always assumed to be 'visible'. Values of // 'collapse' // and 'hidden' are not supported. -// * The 'wrap' property supports only 'nowrap' (which is the default) or -// 'wrap'. The -// rarely-used 'wrap-reverse' is not supported. // * There is no support for forced breaks. // * It does not support vertical inline directions (top-to-bottom or // bottom-to-top text). @@ -1911,7 +1911,7 @@ static void YGNodelayoutImpl(const YGNodeRef node, const YGFlexDirection crossAxis = YGFlexDirectionCross(mainAxis, direction); const bool isMainAxisRow = YGFlexDirectionIsRow(mainAxis); const YGJustify justifyContent = node->style.justifyContent; - const bool isNodeFlexWrap = node->style.flexWrap == YGWrapWrap; + const bool isNodeFlexWrap = node->style.flexWrap != YGWrapNoWrap; const float mainAxisParentSize = isMainAxisRow ? parentWidth : parentHeight; const float crossAxisParentSize = isMainAxisRow ? parentHeight : parentWidth; @@ -2929,6 +2929,18 @@ static void YGNodelayoutImpl(const YGNodeRef node, paddingAndBorderAxisCross); } + // As we only wrapped in normal direction yet, we need to reverse the positions on wrap-reverse. + if (performLayout && node->style.flexWrap == YGWrapWrapReverse) { + for (uint32_t i = 0; i < childCount; i++) { + const YGNodeRef child = YGNodeGetChild(node, i); + if (child->style.positionType == YGPositionTypeRelative) { + child->layout.position[pos[crossAxis]] = node->layout.measuredDimensions[dim[crossAxis]] - + child->layout.position[pos[crossAxis]] - + child->layout.measuredDimensions[dim[crossAxis]]; + } + } + } + if (performLayout) { // STEP 10: SIZING AND POSITIONING ABSOLUTE CHILDREN for (currentAbsoluteChild = firstAbsoluteChild; currentAbsoluteChild != NULL; -- 2.50.1.windows.1 From 59704f15088c2b67469156413a604c3f9d0f1388 Mon Sep 17 00:00:00 2001 From: Dustin Shahidehpour Date: Wed, 15 Feb 2017 14:13:39 -0800 Subject: [PATCH 3/4] Backed out changeset 762168ced81e Summary: Acting weird with Xcode 8.2.1 Differential Revision: D4567880 fbshipit-source-id: e5a200b59780ac3dd8f75b6152054778b9fc786c --- YogaKit/Podfile | 10 - YogaKit/Podfile.lock | 16 - YogaKit/Source/Info.plist | 24 - YogaKit/YogaKit.xcodeproj/project.pbxproj | 545 ------------------ .../contents.xcworkspacedata | 7 - .../contents.xcworkspacedata | 10 - 6 files changed, 612 deletions(-) delete mode 100644 YogaKit/Podfile delete mode 100644 YogaKit/Podfile.lock delete mode 100644 YogaKit/Source/Info.plist delete mode 100644 YogaKit/YogaKit.xcodeproj/project.pbxproj delete mode 100644 YogaKit/YogaKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 YogaKit/YogaKit.xcworkspace/contents.xcworkspacedata diff --git a/YogaKit/Podfile b/YogaKit/Podfile deleted file mode 100644 index aa58da67..00000000 --- a/YogaKit/Podfile +++ /dev/null @@ -1,10 +0,0 @@ -use_frameworks! - -workspace 'YogaKit' - -target 'YogaKit' do - pod 'Yoga', :path => '../Yoga.podspec' -end - -target 'YogaKitTests' do -end diff --git a/YogaKit/Podfile.lock b/YogaKit/Podfile.lock deleted file mode 100644 index 334928c1..00000000 --- a/YogaKit/Podfile.lock +++ /dev/null @@ -1,16 +0,0 @@ -PODS: - - Yoga (1.1.0) - -DEPENDENCIES: - - Yoga (from `../Yoga.podspec`) - -EXTERNAL SOURCES: - Yoga: - :path: ../Yoga.podspec - -SPEC CHECKSUMS: - Yoga: 0bf083b7c485b20598020dbedcea869cbe53071e - -PODFILE CHECKSUM: 975217fee19235295816a081e809454b2ab831b5 - -COCOAPODS: 1.2.0 diff --git a/YogaKit/Source/Info.plist b/YogaKit/Source/Info.plist deleted file mode 100644 index d63d2901..00000000 --- a/YogaKit/Source/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.1 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/YogaKit/YogaKit.xcodeproj/project.pbxproj b/YogaKit/YogaKit.xcodeproj/project.pbxproj deleted file mode 100644 index 73ad1ec0..00000000 --- a/YogaKit/YogaKit.xcodeproj/project.pbxproj +++ /dev/null @@ -1,545 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 40CA64DD1E52A44B00D4D561 /* YogaKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 40CA64D31E52A44B00D4D561 /* YogaKit.framework */; }; - 40CA64F61E52A4D600D4D561 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 40CA64EF1E52A4D600D4D561 /* Info.plist */; }; - 40CA64F71E52A4D600D4D561 /* UIView+Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = 40CA64F01E52A4D600D4D561 /* UIView+Yoga.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 40CA64F81E52A4D600D4D561 /* UIView+Yoga.m in Sources */ = {isa = PBXBuildFile; fileRef = 40CA64F11E52A4D600D4D561 /* UIView+Yoga.m */; }; - 40CA64F91E52A4D600D4D561 /* YGLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 40CA64F21E52A4D600D4D561 /* YGLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 40CA64FA1E52A4D600D4D561 /* YGLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 40CA64F31E52A4D600D4D561 /* YGLayout.m */; }; - 40CA64FB1E52A4D700D4D561 /* YGLayout+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 40CA64F41E52A4D600D4D561 /* YGLayout+Private.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 40CA65061E52A7DE00D4D561 /* YogaKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 40CA65031E52A77A00D4D561 /* YogaKitTests.m */; }; - 40CA65081E52A7EC00D4D561 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 40CA65071E52A7EC00D4D561 /* XCTest.framework */; }; - A68EA845309FAAA9D97D9C67 /* Pods_YogaKitTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C744E7D07F17F21245D4032 /* Pods_YogaKitTests.framework */; }; - AD6227DE33ED68DB8AA0DC66 /* Pods_YogaKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3128B1933190022D35CDF27 /* Pods_YogaKit.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 40CA64DE1E52A44B00D4D561 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 40CA64CA1E52A44B00D4D561 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 40CA64D21E52A44B00D4D561; - remoteInfo = YogaKit; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 40CA64D31E52A44B00D4D561 /* YogaKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = YogaKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 40CA64DC1E52A44B00D4D561 /* YogaKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = YogaKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 40CA64EF1E52A4D600D4D561 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Source/Info.plist; sourceTree = ""; }; - 40CA64F01E52A4D600D4D561 /* UIView+Yoga.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIView+Yoga.h"; path = "Source/UIView+Yoga.h"; sourceTree = ""; }; - 40CA64F11E52A4D600D4D561 /* UIView+Yoga.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIView+Yoga.m"; path = "Source/UIView+Yoga.m"; sourceTree = ""; }; - 40CA64F21E52A4D600D4D561 /* YGLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = YGLayout.h; path = Source/YGLayout.h; sourceTree = ""; }; - 40CA64F31E52A4D600D4D561 /* YGLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = YGLayout.m; path = Source/YGLayout.m; sourceTree = ""; }; - 40CA64F41E52A4D600D4D561 /* YGLayout+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "YGLayout+Private.h"; path = "Source/YGLayout+Private.h"; sourceTree = ""; }; - 40CA65021E52A77A00D4D561 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Tests/Info.plist; sourceTree = ""; }; - 40CA65031E52A77A00D4D561 /* YogaKitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = YogaKitTests.m; path = Tests/YogaKitTests.m; sourceTree = ""; }; - 40CA65071E52A7EC00D4D561 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; - 4A1C054B258A44DD6FCC2A0C /* Pods-YogaKit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKit.release.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKit/Pods-YogaKit.release.xcconfig"; sourceTree = ""; }; - 88A03BE254575BA580440C33 /* Pods-YogaKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKit.debug.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKit/Pods-YogaKit.debug.xcconfig"; sourceTree = ""; }; - 8C744E7D07F17F21245D4032 /* Pods_YogaKitTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_YogaKitTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - B3128B1933190022D35CDF27 /* Pods_YogaKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_YogaKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - BBC1269AE6773174B034240E /* Pods-YogaKitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitTests/Pods-YogaKitTests.release.xcconfig"; sourceTree = ""; }; - EC740EE390ABE29C24EA2C36 /* Pods-YogaKitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitTests/Pods-YogaKitTests.debug.xcconfig"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 40CA64CF1E52A44B00D4D561 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - AD6227DE33ED68DB8AA0DC66 /* Pods_YogaKit.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 40CA64D91E52A44B00D4D561 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 40CA65081E52A7EC00D4D561 /* XCTest.framework in Frameworks */, - 40CA64DD1E52A44B00D4D561 /* YogaKit.framework in Frameworks */, - A68EA845309FAAA9D97D9C67 /* Pods_YogaKitTests.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 1F50995265E7A8DB75D2FDAE /* Pods */ = { - isa = PBXGroup; - children = ( - 88A03BE254575BA580440C33 /* Pods-YogaKit.debug.xcconfig */, - 4A1C054B258A44DD6FCC2A0C /* Pods-YogaKit.release.xcconfig */, - EC740EE390ABE29C24EA2C36 /* Pods-YogaKitTests.debug.xcconfig */, - BBC1269AE6773174B034240E /* Pods-YogaKitTests.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; - 20F24819CF52E3DDF16C73C2 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 40CA65071E52A7EC00D4D561 /* XCTest.framework */, - B3128B1933190022D35CDF27 /* Pods_YogaKit.framework */, - 8C744E7D07F17F21245D4032 /* Pods_YogaKitTests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 40CA64C91E52A44B00D4D561 = { - isa = PBXGroup; - children = ( - 40CA65011E52A76A00D4D561 /* Tests */, - 40CA64ED1E52A4C400D4D561 /* Source */, - 40CA64D41E52A44B00D4D561 /* Products */, - 1F50995265E7A8DB75D2FDAE /* Pods */, - 20F24819CF52E3DDF16C73C2 /* Frameworks */, - ); - sourceTree = ""; - }; - 40CA64D41E52A44B00D4D561 /* Products */ = { - isa = PBXGroup; - children = ( - 40CA64D31E52A44B00D4D561 /* YogaKit.framework */, - 40CA64DC1E52A44B00D4D561 /* YogaKitTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 40CA64ED1E52A4C400D4D561 /* Source */ = { - isa = PBXGroup; - children = ( - 40CA64EF1E52A4D600D4D561 /* Info.plist */, - 40CA64F01E52A4D600D4D561 /* UIView+Yoga.h */, - 40CA64F11E52A4D600D4D561 /* UIView+Yoga.m */, - 40CA64F21E52A4D600D4D561 /* YGLayout.h */, - 40CA64F31E52A4D600D4D561 /* YGLayout.m */, - 40CA64F41E52A4D600D4D561 /* YGLayout+Private.h */, - ); - name = Source; - sourceTree = ""; - }; - 40CA65011E52A76A00D4D561 /* Tests */ = { - isa = PBXGroup; - children = ( - 40CA65021E52A77A00D4D561 /* Info.plist */, - 40CA65031E52A77A00D4D561 /* YogaKitTests.m */, - ); - name = Tests; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 40CA64D01E52A44B00D4D561 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 40CA64F91E52A4D600D4D561 /* YGLayout.h in Headers */, - 40CA64F71E52A4D600D4D561 /* UIView+Yoga.h in Headers */, - 40CA64FB1E52A4D700D4D561 /* YGLayout+Private.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 40CA64D21E52A44B00D4D561 /* YogaKit */ = { - isa = PBXNativeTarget; - buildConfigurationList = 40CA64E71E52A44B00D4D561 /* Build configuration list for PBXNativeTarget "YogaKit" */; - buildPhases = ( - 774EA486C1FE628A02A37751 /* [CP] Check Pods Manifest.lock */, - 40CA64CE1E52A44B00D4D561 /* Sources */, - 40CA64CF1E52A44B00D4D561 /* Frameworks */, - 40CA64D01E52A44B00D4D561 /* Headers */, - 40CA64D11E52A44B00D4D561 /* Resources */, - 0CF84C4C17073518BAD7E7C9 /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = YogaKit; - productName = YogaKit; - productReference = 40CA64D31E52A44B00D4D561 /* YogaKit.framework */; - productType = "com.apple.product-type.framework"; - }; - 40CA64DB1E52A44B00D4D561 /* YogaKitTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 40CA64EA1E52A44B00D4D561 /* Build configuration list for PBXNativeTarget "YogaKitTests" */; - buildPhases = ( - 8AD9D4417D768DFCC0AC73C4 /* [CP] Check Pods Manifest.lock */, - 40CA64D81E52A44B00D4D561 /* Sources */, - 40CA64D91E52A44B00D4D561 /* Frameworks */, - 40CA64DA1E52A44B00D4D561 /* Resources */, - 1C8267EDF21A390122D5377F /* [CP] Embed Pods Frameworks */, - 4FBCFB313146694C1C2FB402 /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - 40CA64DF1E52A44B00D4D561 /* PBXTargetDependency */, - ); - name = YogaKitTests; - productName = YogaKitTests; - productReference = 40CA64DC1E52A44B00D4D561 /* YogaKitTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 40CA64CA1E52A44B00D4D561 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0820; - TargetAttributes = { - 40CA64D21E52A44B00D4D561 = { - CreatedOnToolsVersion = 8.2.1; - ProvisioningStyle = Automatic; - }; - 40CA64DB1E52A44B00D4D561 = { - CreatedOnToolsVersion = 8.2.1; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 40CA64CD1E52A44B00D4D561 /* Build configuration list for PBXProject "YogaKit" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 40CA64C91E52A44B00D4D561; - productRefGroup = 40CA64D41E52A44B00D4D561 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 40CA64D21E52A44B00D4D561 /* YogaKit */, - 40CA64DB1E52A44B00D4D561 /* YogaKitTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 40CA64D11E52A44B00D4D561 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 40CA64F61E52A4D600D4D561 /* Info.plist in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 40CA64DA1E52A44B00D4D561 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 0CF84C4C17073518BAD7E7C9 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-YogaKit/Pods-YogaKit-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 1C8267EDF21A390122D5377F /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-YogaKitTests/Pods-YogaKitTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 4FBCFB313146694C1C2FB402 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-YogaKitTests/Pods-YogaKitTests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 774EA486C1FE628A02A37751 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - 8AD9D4417D768DFCC0AC73C4 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 40CA64CE1E52A44B00D4D561 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 40CA64F81E52A4D600D4D561 /* UIView+Yoga.m in Sources */, - 40CA64FA1E52A4D600D4D561 /* YGLayout.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 40CA64D81E52A44B00D4D561 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 40CA65061E52A7DE00D4D561 /* YogaKitTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 40CA64DF1E52A44B00D4D561 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 40CA64D21E52A44B00D4D561 /* YogaKit */; - targetProxy = 40CA64DE1E52A44B00D4D561 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 40CA64E51E52A44B00D4D561 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 40CA64E61E52A44B00D4D561 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 40CA64E81E52A44B00D4D561 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 88A03BE254575BA580440C33 /* Pods-YogaKit.debug.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Source/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.Facebook.YogaKit; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 40CA64E91E52A44B00D4D561 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 4A1C054B258A44DD6FCC2A0C /* Pods-YogaKit.release.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Source/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.Facebook.YogaKit; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Release; - }; - 40CA64EB1E52A44B00D4D561 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = EC740EE390ABE29C24EA2C36 /* Pods-YogaKitTests.debug.xcconfig */; - buildSettings = { - INFOPLIST_FILE = Tests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.Facebook.YogaKitTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 40CA64EC1E52A44B00D4D561 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BBC1269AE6773174B034240E /* Pods-YogaKitTests.release.xcconfig */; - buildSettings = { - INFOPLIST_FILE = Tests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.Facebook.YogaKitTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 40CA64CD1E52A44B00D4D561 /* Build configuration list for PBXProject "YogaKit" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 40CA64E51E52A44B00D4D561 /* Debug */, - 40CA64E61E52A44B00D4D561 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 40CA64E71E52A44B00D4D561 /* Build configuration list for PBXNativeTarget "YogaKit" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 40CA64E81E52A44B00D4D561 /* Debug */, - 40CA64E91E52A44B00D4D561 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 40CA64EA1E52A44B00D4D561 /* Build configuration list for PBXNativeTarget "YogaKitTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 40CA64EB1E52A44B00D4D561 /* Debug */, - 40CA64EC1E52A44B00D4D561 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 40CA64CA1E52A44B00D4D561 /* Project object */; -} diff --git a/YogaKit/YogaKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/YogaKit/YogaKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 98dd3194..00000000 --- a/YogaKit/YogaKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/YogaKit/YogaKit.xcworkspace/contents.xcworkspacedata b/YogaKit/YogaKit.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 8845ada7..00000000 --- a/YogaKit/YogaKit.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - -- 2.50.1.windows.1 From 5524c8dedd5557c9fc83cc519d7ea9a60e2475fe Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Wed, 15 Feb 2017 23:02:18 +0000 Subject: [PATCH 4/4] [csharp] Fix tests --- .../Facebook.Yoga/YogaNodeSpacingTest.cs | 48 +++++++++---------- csharp/tests/Facebook.Yoga/YogaNodeTest.cs | 14 +++--- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/csharp/tests/Facebook.Yoga/YogaNodeSpacingTest.cs b/csharp/tests/Facebook.Yoga/YogaNodeSpacingTest.cs index d29b19e2..525dacc2 100644 --- a/csharp/tests/Facebook.Yoga/YogaNodeSpacingTest.cs +++ b/csharp/tests/Facebook.Yoga/YogaNodeSpacingTest.cs @@ -44,20 +44,20 @@ namespace Facebook.Yoga BorderRightWidth = 16, }; - Assert.AreEqual(1.Px(), node.Top); - Assert.AreEqual(2.Px(), node.Bottom); - Assert.AreEqual(3.Px(), node.Left); - Assert.AreEqual(4.Px(), node.Right); + Assert.AreEqual(1.Pt(), node.Top); + Assert.AreEqual(2.Pt(), node.Bottom); + Assert.AreEqual(3.Pt(), node.Left); + Assert.AreEqual(4.Pt(), node.Right); - Assert.AreEqual(5.Px(), node.MarginTop); - Assert.AreEqual(6.Px(), node.MarginBottom); - Assert.AreEqual(7.Px(), node.MarginLeft); - Assert.AreEqual(8.Px(), node.MarginRight); + Assert.AreEqual(5.Pt(), node.MarginTop); + Assert.AreEqual(6.Pt(), node.MarginBottom); + Assert.AreEqual(7.Pt(), node.MarginLeft); + Assert.AreEqual(8.Pt(), node.MarginRight); - Assert.AreEqual(9.Px(), node.PaddingTop); - Assert.AreEqual(10.Px(), node.PaddingBottom); - Assert.AreEqual(11.Px(), node.PaddingLeft); - Assert.AreEqual(12.Px(), node.PaddingRight); + Assert.AreEqual(9.Pt(), node.PaddingTop); + Assert.AreEqual(10.Pt(), node.PaddingBottom); + Assert.AreEqual(11.Pt(), node.PaddingLeft); + Assert.AreEqual(12.Pt(), node.PaddingRight); Assert.AreEqual(13, node.BorderTopWidth); Assert.AreEqual(14, node.BorderBottomWidth); @@ -90,20 +90,20 @@ namespace Facebook.Yoga node.BorderLeftWidth = 15; node.BorderRightWidth = 16; - Assert.AreEqual(1.Px(), node.Top); - Assert.AreEqual(2.Px(), node.Bottom); - Assert.AreEqual(3.Px(), node.Left); - Assert.AreEqual(4.Px(), node.Right); + Assert.AreEqual(1.Pt(), node.Top); + Assert.AreEqual(2.Pt(), node.Bottom); + Assert.AreEqual(3.Pt(), node.Left); + Assert.AreEqual(4.Pt(), node.Right); - Assert.AreEqual(5.Px(), node.MarginTop); - Assert.AreEqual(6.Px(), node.MarginBottom); - Assert.AreEqual(7.Px(), node.MarginLeft); - Assert.AreEqual(8.Px(), node.MarginRight); + Assert.AreEqual(5.Pt(), node.MarginTop); + Assert.AreEqual(6.Pt(), node.MarginBottom); + Assert.AreEqual(7.Pt(), node.MarginLeft); + Assert.AreEqual(8.Pt(), node.MarginRight); - Assert.AreEqual(9.Px(), node.PaddingTop); - Assert.AreEqual(10.Px(), node.PaddingBottom); - Assert.AreEqual(11.Px(), node.PaddingLeft); - Assert.AreEqual(12.Px(), node.PaddingRight); + Assert.AreEqual(9.Pt(), node.PaddingTop); + Assert.AreEqual(10.Pt(), node.PaddingBottom); + Assert.AreEqual(11.Pt(), node.PaddingLeft); + Assert.AreEqual(12.Pt(), node.PaddingRight); Assert.AreEqual(13, node.BorderTopWidth); Assert.AreEqual(14, node.BorderBottomWidth); diff --git a/csharp/tests/Facebook.Yoga/YogaNodeTest.cs b/csharp/tests/Facebook.Yoga/YogaNodeTest.cs index 291fb4af..ebffaf23 100644 --- a/csharp/tests/Facebook.Yoga/YogaNodeTest.cs +++ b/csharp/tests/Facebook.Yoga/YogaNodeTest.cs @@ -273,7 +273,7 @@ namespace Facebook.Yoga node1.MaxHeight = 100; node0.CopyStyle(node1); - Assert.AreEqual(100.Px(), node0.MaxHeight); + Assert.AreEqual(100.Pt(), node0.MaxHeight); } [Test] @@ -283,27 +283,27 @@ namespace Facebook.Yoga node0.MaxWidth = 80; YogaNode node1 = new YogaNode(node0); - Assert.AreEqual(80.Px(), node1.MaxWidth); + Assert.AreEqual(80.Pt(), node1.MaxWidth); YogaNode node2 = new YogaNode(node1) { MaxHeight = 90, }; - Assert.AreEqual(80.Px(), node2.MaxWidth); - Assert.AreEqual(90.Px(), node2.MaxHeight); + Assert.AreEqual(80.Pt(), node2.MaxWidth); + Assert.AreEqual(90.Pt(), node2.MaxHeight); YogaNode node3 = new YogaNode(node0) { MaxWidth = 100, }; - Assert.AreEqual(100.Px(), node3.MaxWidth); + Assert.AreEqual(100.Pt(), node3.MaxWidth); YogaNode node4 = new YogaNode(node2) { MaxWidth = 100, }; - Assert.AreEqual(100.Px(), node4.MaxWidth); - Assert.AreEqual(90.Px(), node4.MaxHeight); + Assert.AreEqual(100.Pt(), node4.MaxWidth); + Assert.AreEqual(90.Pt(), node4.MaxHeight); } private void ForceGC() -- 2.50.1.windows.1