public void TestThatLayoutIsCorrectWhenWeSwapViewOrder() { var containerSize = new SizeF(300, 50); var container = new NativeView(new CGRect(0, 0, containerSize.Width, containerSize.Height)); container.Yoga().IsEnabled = true; container.Yoga().FlexDirection = YogaFlexDirection.Row; var subview1 = new NativeView(); subview1.Yoga().IsEnabled = true; subview1.Yoga().FlexGrow = 1; container.AddSubview(subview1); var subview2 = new NativeView(); subview2.Yoga().IsEnabled = true; subview2.Yoga().FlexGrow = 1; container.AddSubview(subview2); var subview3 = new NativeView(); subview3.Yoga().IsEnabled = true; subview3.Yoga().FlexGrow = 1; container.AddSubview(subview3); container.Yoga().ApplyLayout(); Assert.True(subview1.Frame == new CGRect(0, 0, 100, 50)); Assert.True(subview2.Frame == new CGRect(100, 0, 100, 50), $"It's actually {subview2.Frame}"); Assert.True(subview3.Frame == new CGRect(200, 0, 100, 50)); container.ExchangeSubview(2, 0); subview2.Yoga().IsIncludeInLayout = false; container.Yoga().ApplyLayout(); Assert.True(subview3.Frame == new CGRect(0, 0, 150, 50)); Assert.True(subview1.Frame == new CGRect(150, 0, 150, 50)); //// this frame shouldn't have been modified since last time. Assert.True(subview2.Frame == new CGRect(100, 0, 100, 50)); }