diff --git a/eng/Versions.props b/eng/Versions.props index 2270f20a81b4..e1b02d46d6d1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -49,7 +49,7 @@ 9.0.0 9.0.0 - 35.0.7 + 35.0.24 18.0.9617 15.0.9617 diff --git a/src/Controls/src/Core/Layout/FlexLayout.cs b/src/Controls/src/Core/Layout/FlexLayout.cs index 1e43f5c0ee5a..acebf1f4b6bc 100644 --- a/src/Controls/src/Core/Layout/FlexLayout.cs +++ b/src/Controls/src/Core/Layout/FlexLayout.cs @@ -495,16 +495,16 @@ void AddFlexItem(int index, IView child) InitItemProperties(child, item); if (child is not FlexLayout) { - item.SelfSizing = (Flex.Item it, ref float w, ref float h) => + item.SelfSizing = (Flex.Item it, ref float w, ref float h, bool inMeasureMode) => { Size request; - if (InMeasureMode) + if (inMeasureMode) { var sizeConstraints = item.GetConstraints(); - sizeConstraints.Width = (InMeasureMode && sizeConstraints.Width == 0) ? double.PositiveInfinity : sizeConstraints.Width; - sizeConstraints.Height = (InMeasureMode && sizeConstraints.Height == 0) ? double.PositiveInfinity : sizeConstraints.Height; + sizeConstraints.Width = (inMeasureMode && sizeConstraints.Width == 0) ? double.PositiveInfinity : sizeConstraints.Width; + sizeConstraints.Height = (inMeasureMode && sizeConstraints.Height == 0) ? double.PositiveInfinity : sizeConstraints.Height; if (child is Image) { @@ -585,7 +585,7 @@ public void Layout(double width, double height) _root.Width = !double.IsPositiveInfinity((width)) ? (float)width : 0; _root.Height = !double.IsPositiveInfinity((height)) ? (float)height : 0; - _root.Layout(); + _root.Layout(InMeasureMode); if (useMeasureHack) { diff --git a/src/Controls/src/Core/LegacyLayouts/FlexLayout.cs b/src/Controls/src/Core/LegacyLayouts/FlexLayout.cs index 492669acea70..7bd95120333d 100644 --- a/src/Controls/src/Core/LegacyLayouts/FlexLayout.cs +++ b/src/Controls/src/Core/LegacyLayouts/FlexLayout.cs @@ -306,11 +306,11 @@ void AddChild(View view) InitItemProperties(view, item); if (!(view is FlexLayout)) { //inner layouts don't get measured - item.SelfSizing = (Flex.Item it, ref float w, ref float h) => + item.SelfSizing = (Flex.Item it, ref float w, ref float h, bool inMeasureMode) => { var sizeConstrains = item.GetConstraints(); - sizeConstrains.Width = (_measuring && sizeConstrains.Width == 0) ? double.PositiveInfinity : sizeConstrains.Width; - sizeConstrains.Height = (_measuring && sizeConstrains.Height == 0) ? double.PositiveInfinity : sizeConstrains.Height; + sizeConstrains.Width = (inMeasureMode && sizeConstrains.Width == 0) ? double.PositiveInfinity : sizeConstrains.Width; + sizeConstrains.Height = (inMeasureMode && sizeConstrains.Height == 0) ? double.PositiveInfinity : sizeConstrains.Height; var request = view.Measure(sizeConstrains.Width, sizeConstrains.Height, MeasureFlags.None).Request; w = (float)request.Width; h = (float)request.Height; @@ -489,7 +489,7 @@ void Layout(double width, double height) return; _root.Width = !double.IsPositiveInfinity((width)) ? (float)width : 0; _root.Height = !double.IsPositiveInfinity((height)) ? (float)height : 0; - _root.Layout(); + _root.Layout(_measuring); } } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ChildFlexLayoutContentShouldAppear.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ChildFlexLayoutContentShouldAppear.png new file mode 100644 index 000000000000..7a16ed1d2891 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ChildFlexLayoutContentShouldAppear.png differ diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla/Bugzilla32148.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla/Bugzilla32148.cs index 0bf907eefbd1..0fa65bd0d907 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla/Bugzilla32148.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla/Bugzilla32148.cs @@ -31,7 +31,9 @@ Layout CreateContent() ItemsSource = _listViewItemSource, IsPullToRefreshEnabled = true, IsGroupingEnabled = true, - GroupShortNameBinding = new Binding("Key"), + // While using this GroupShortNameBinding property it throws an exception on Windows + // for more information:https://github.com/dotnet/maui/issues/26534. For this test case we don't need this property. + // GroupShortNameBinding = new Binding("Key"), GroupHeaderTemplate = new DataTemplate(typeof(HeaderCell)), HasUnevenRows = true, ItemTemplate = new DataTemplate(typeof(ContactItemTemplate)) diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue23491.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue23491.cs new file mode 100644 index 000000000000..7772664c0ad1 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue23491.cs @@ -0,0 +1,49 @@ +using Microsoft.Maui.Layouts; + +namespace Maui.Controls.Sample.Issues +{ + [Issue(IssueTracker.Github, 23491, "BindableLayout.ItemsSource no longer works in 8.0.61", PlatformAffected.All)] + public class Issue23491 : ContentPage + { + Label headerLabel; + Label label1; + Label label2; + public Issue23491() + { + headerLabel = new Label { Text = "Below is the Content of the Child FlexLayout", + TextColor=Colors.Red }; + + headerLabel.AutomationId = "HeaderLabel"; + + // Child FlexLayout + label1 = new Label + { + Text = "First label inside the child flexlayout", + Padding =new Thickness(5) + }; + + label2 = new Label + { + Text = "Second label inside the child flexLayout", + Padding =new Thickness(5) + }; + + var childFlexLayout = new FlexLayout + { + Margin = new Thickness(10), + Wrap = FlexWrap.Wrap, + Children = { label1, label2 } + }; + + // Main FlexLayout + var mainLayout = new FlexLayout + { + Direction = FlexDirection.Column, + Children = { headerLabel, childFlexLayout } + }; + + // Set the content of the page + Content = mainLayout; + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla23942.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla23942.cs index 6da83afdd858..9f25b5c01115 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla23942.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla23942.cs @@ -15,11 +15,9 @@ public Bugzilla23942(TestDevice testDevice) : base(testDevice) [Test] [Category(UITestCategories.LifeCycle)] [Category(UITestCategories.Compatibility)] - [FailsOnIOSWhenRunningOnXamarinUITest] - [FailsOnMacWhenRunningOnXamarinUITest] public void Bugzilla23942Test() { - App.WaitForNoElement("success"); + App.WaitForElement("success"); } } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla25662.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla25662.cs index f319199de343..558ade52aa9b 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla25662.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla25662.cs @@ -1,6 +1,4 @@ -#if ANDROID using NUnit.Framework; -using OpenQA.Selenium.Appium; using UITest.Appium; using UITest.Core; @@ -16,8 +14,6 @@ public Bugzilla25662(TestDevice testDevice) : base(testDevice) [Test] [Category(UITestCategories.Cells)] - [FailsOnIOSWhenRunningOnXamarinUITest] - [FailsOnWindowsWhenRunningOnXamarinUITest] public void Bugzilla25662Test() { App.WaitForElement("One"); @@ -25,4 +21,4 @@ public void Bugzilla25662Test() App.WaitForNoElement("FAIL"); } } -#endif + diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla25979.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla25979.cs index f3b7f8b1c8e5..a8a49b3282ba 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla25979.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla25979.cs @@ -1,4 +1,3 @@ -#if TEST_FAILS_ON_IOS && TEST_FAILS_ON_CATALYST using NUnit.Framework; using UITest.Appium; using UITest.Core; @@ -18,26 +17,11 @@ public Bugzilla25979(TestDevice testDevice) : base(testDevice) public void Bugzilla25979Test() { App.WaitForElement("PageOneButtonId"); - App.Screenshot("At page one"); - App.Tap("PageOneButtonId"); -#if MACCATALYST - System.Threading.Thread.Sleep(2000); -#endif - - App.WaitForElement("PageTwoButtonId"); - App.Screenshot("At page two - I didn't crash"); - + App.WaitForElementTillPageNavigationSettled("PageTwoButtonId"); App.Tap("PageTwoButtonId"); -#if MACCATALYST - System.Threading.Thread.Sleep(2000); -#endif - - App.WaitForElement("PopButton"); - App.Screenshot("At page three - I didn't crash"); - + App.WaitForElementTillPageNavigationSettled("PopButton"); App.Tap("PopButton"); - App.WaitForNoElement("PopAttempted"); + App.WaitForElement("PopAttempted"); } } -#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla29363.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla29363.cs index a3e2607cf29f..6adb7b25a978 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla29363.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla29363.cs @@ -15,16 +15,11 @@ public Bugzilla29363(TestDevice testDevice) : base(testDevice) [Test] [Category(UITestCategories.Navigation)] [Category(UITestCategories.Compatibility)] - [FailsOnIOSWhenRunningOnXamarinUITest] - [FailsOnMacWhenRunningOnXamarinUITest] public void PushButton() { App.WaitForElement("ModalPushPopTest"); App.Tap("ModalPushPopTest"); - Thread.Sleep(2000); - - // if it didn't crash, yay - App.WaitForElement("ModalPushPopTest"); + App.WaitForElementTillPageNavigationSettled("ModalPushPopTest"); } } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla29453.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla29453.cs index e7700a70393d..10e309d23b57 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla29453.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla29453.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +#if TEST_FAILS_ON_WINDOWS //PressEnter Method not supported on Windows +using NUnit.Framework; using UITest.Appium; using UITest.Core; @@ -15,21 +16,16 @@ public Bugzilla29453(TestDevice testDevice) : base(testDevice) [Test] [Category(UITestCategories.Navigation)] [Category(UITestCategories.Compatibility)] - [FailsOnAllPlatformsWhenRunningOnXamarinUITest] public void Bugzilla29453Test() { - App.Screenshot("I am at Issue Bugzilla29453"); App.WaitForElement("Page1"); App.Tap("btnGotoPage2"); + App.WaitForElement("entryText"); App.Tap("entryText"); App.EnterText("entryText", "XF"); - - App.DismissKeyboard(); - App.Back(); - - // TODO: Implement PressEnter method. - //App.PressEnter(); - //App.WaitForElement("Page1"); + App.PressEnter(); + App.WaitForElement("Page1"); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31395.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31395.cs index 2fdcd6ccff01..411006099a98 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31395.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31395.cs @@ -1,5 +1,4 @@ -#if IOS -using NUnit.Framework; +using NUnit.Framework; using UITest.Appium; using UITest.Core; @@ -16,8 +15,6 @@ public Bugzilla31395(TestDevice testDevice) : base(testDevice) [Test] [Category(UITestCategories.Navigation)] [Category(UITestCategories.Compatibility)] - [FailsOnIOSWhenRunningOnXamarinUITest] - [FailsOnMacWhenRunningOnXamarinUITest] public void Bugzilla31395Test() { App.WaitForElement("SwitchMainPage"); @@ -25,8 +22,7 @@ public void Bugzilla31395Test() { App.Tap("SwitchMainPage"); }); - App.WaitForNoElement("Hello"); + App.WaitForElement("Hello"); } } } -#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31688.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31688.cs index a01685e75441..eb65a95df3a9 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31688.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31688.cs @@ -1,5 +1,4 @@ -#if IOS -using NUnit.Framework; +using NUnit.Framework; using UITest.Appium; using UITest.Core; @@ -11,18 +10,14 @@ public Bugzilla31688(TestDevice testDevice) : base(testDevice) { } - public override string Issue => "[Bug] Exception Ancestor must be provided for all pushes except first"; + public override string Issue => "'Navigation.InsertPageBefore()' does not work for more than two pages, \"throws java.lang.IndexOutOfBoundsException: index=3 count=2"; [Test] [Category(UITestCategories.Navigation)] [Category(UITestCategories.Compatibility)] - [FailsOnAndroidWhenRunningOnXamarinUITest] - [FailsOnIOSWhenRunningOnXamarinUITest] - [FailsOnMacWhenRunningOnXamarinUITest] public void Bugzilla31688Test() { - App.WaitForNoElement("Page3"); + App.WaitForElement("Page3"); } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32148.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32148.cs index 732b03774af8..3dfd806cf6ab 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32148.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32148.cs @@ -1,4 +1,3 @@ -#if TEST_FAILS_ON_CATALYST && TEST_FAILS_ON_WINDOWS using NUnit.Framework; using UITest.Appium; using UITest.Core; @@ -15,20 +14,10 @@ public Bugzilla32148(TestDevice testDevice) : base(testDevice) [Test] [Category(UITestCategories.ListView)] - [FailsOnIOSWhenRunningOnXamarinUITest] public void Bugzilla32148Test() { - if (App is not AppiumApp app2 || app2 is null || app2.Driver is null) - { - throw new InvalidOperationException("Cannot run test. Missing driver to run quick tap actions."); - } - - App.WaitForNoElement("Contact0 LastName"); - var searchButton = app2.Driver.FindElement(OpenQA.Selenium.By.XPath("//*[@text='" + "Search" + "']")); - searchButton.Click(); - - App.WaitForNoElement("Contact0 LastName"); - App.Screenshot("For manual review, verify that the first cell is visible"); + App.WaitForElement("Contact0 LastName"); + App.Tap("Search"); + App.WaitForElementTillPageNavigationSettled("Contact0 LastName"); } } -#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32206.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32206.cs index 58b2e4ab936b..9775e2a748b9 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32206.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32206.cs @@ -1,5 +1,4 @@ -#if IOS -using NUnit.Framework; +using NUnit.Framework; using UITest.Appium; using UITest.Core; @@ -14,34 +13,19 @@ public Bugzilla32206(TestDevice testDevice) : base(testDevice) public override string Issue => "ContextActions cause memory leak: Page is never destroyed"; [Test] - [Category(UITestCategories.Page)] - [Category(UITestCategories.Compatibility)] - [FailsOnIOSWhenRunningOnXamarinUITest] + [Category(UITestCategories.ContextActions)] public void Bugzilla32206Test() { - try + for (var n = 0; n < 10; n++) { - for (var n = 0; n < 10; n++) - { - App.WaitForElement("Push"); - App.Tap("Push"); - - App.WaitForElement("ListView"); - App.Back(); - } - - // At this point, the counter can be any value, but it's most likely not zero. - // Invoking GC once is enough to clean up all garbage data and set counter to zero - App.WaitForElement("GC"); - App.Tap("GC"); - - App.WaitForNoElement("Counter: 0"); - } - finally - { - App.Back(); + App.WaitForElement("Push"); + App.Tap("Push"); + App.WaitForElement("ListView"); + App.TapBackArrow(); } + App.WaitForElement("GC"); + App.Tap("GC"); + App.WaitForElement("Counter: 0"); } } } -#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32462.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32462.cs index 62e747a4a5ca..487d2db1c20f 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32462.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32462.cs @@ -1,4 +1,3 @@ -#if TEST_FAILS_ON_CATALYST && TEST_FAILS_ON_WINDOWS using NUnit.Framework; using UITest.Appium; using UITest.Core; @@ -15,14 +14,12 @@ public Bugzilla32462(TestDevice testDevice) : base(testDevice) [Test] [Category(UITestCategories.ListView)] - [FailsOnIOSWhenRunningOnXamarinUITest] public void Bugzilla36729Test() { App.WaitForElement("Click!"); App.Tap("Click!"); App.WaitForElement("listview"); App.WaitForElement("some text 35"); - App.Back(); + App.TapBackArrow(); } } -#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32615.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32615.cs index 835799d82420..dac9e794de2a 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32615.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32615.cs @@ -15,13 +15,11 @@ public Bugzilla32615(TestDevice testDevice) : base(testDevice) [Test] [Category(UITestCategories.Navigation)] [Category(UITestCategories.Compatibility)] - [FailsOnAllPlatformsWhenRunningOnXamarinUITest] - public async Task Bugzilla32615Test() + public void Bugzilla32615Test() { - App.Tap("btnModal"); - App.Tap("btnPop"); - await Task.Delay(1000); - App.WaitForNoElement("1"); + App.Tap("open"); + App.Tap("pop"); + App.WaitForElement("lblCount"); } } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23491.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23491.cs new file mode 100644 index 000000000000..4785757952a2 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23491.cs @@ -0,0 +1,21 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues +{ + public class Issue23491 : _IssuesUITest + { + public Issue23491(TestDevice device) : base(device) { } + + public override string Issue => "BindableLayout.ItemsSource no longer works in 8.0.61"; + + [Test] + [Category(UITestCategories.Label)] + public void ChildFlexLayoutContentShouldAppear() + { + App.WaitForElement("HeaderLabel"); + VerifyScreenshot(); + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ChildFlexLayoutContentShouldAppear.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ChildFlexLayoutContentShouldAppear.png new file mode 100644 index 000000000000..dfb1d6852e03 Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ChildFlexLayoutContentShouldAppear.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/ChildFlexLayoutContentShouldAppear.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/ChildFlexLayoutContentShouldAppear.png new file mode 100644 index 000000000000..ac7eb12b344a Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/ChildFlexLayoutContentShouldAppear.png differ diff --git a/src/Core/src/Layouts/Flex.cs b/src/Core/src/Layouts/Flex.cs index 12272000732e..2ecadeccf1af 100644 --- a/src/Core/src/Layouts/Flex.cs +++ b/src/Core/src/Layouts/Flex.cs @@ -426,7 +426,7 @@ public Item Root } } - public void Layout() + public void Layout(bool inMeasureMode) { if (Parent != null) throw new InvalidOperationException("Layout() must be called on a root item (that hasn't been added to another item)"); @@ -434,10 +434,10 @@ public void Layout() throw new InvalidOperationException("Layout() must be called on an item that has proper values for the Width and Height properties"); if (SelfSizing != null) throw new InvalidOperationException("Layout() cannot be called on an item that has the SelfSizing property set"); - layout_item(this, Width, Height); + layout_item(this, Width, Height, inMeasureMode); } - public delegate void SelfSizingDelegate(Item item, ref float width, ref float height); + public delegate void SelfSizingDelegate(Item item, ref float width, ref float height, bool inMeasureMode); public SelfSizingDelegate? SelfSizing { get; set; } @@ -449,7 +449,7 @@ void ValidateChild(Item child) throw new ArgumentException("child already has a parent"); } - static void layout_item(Item item, float width, float height) + static void layout_item(Item item, float width, float height, bool inMeasureMode) { if (item == null || item.Count == 0) return; @@ -476,7 +476,7 @@ static void layout_item(Item item, float width, float height) child.Frame[1] = absolute_pos(child.Top, child.Bottom, child.Frame[3], height); // Now that the item has a frame, we can layout its children. - layout_item(child, child.Frame[2], child.Frame[3]); + layout_item(child, child.Frame[2], child.Frame[3], inMeasureMode); continue; } @@ -507,7 +507,7 @@ static void layout_item(Item item, float width, float height) { float[] size = { child.Frame[2], child.Frame[3] }; - child.SelfSizing(child, ref size[0], ref size[1]); + child.SelfSizing(child, ref size[0], ref size[1], inMeasureMode); for (int j = 0; j < 2; j++) { @@ -540,7 +540,7 @@ static void layout_item(Item item, float width, float height) { // Not enough space for this child on this line, layout the // remaining items and move it to a new line. - layout_items(item, last_layout_child, i, relative_children_count, ref layout); + layout_items(item, last_layout_child, i, relative_children_count, ref layout, inMeasureMode); layout.reset(); last_layout_child = i; @@ -578,7 +578,7 @@ static void layout_item(Item item, float width, float height) } // Layout remaining items in wrap mode, or everything otherwise. - layout_items(item, last_layout_child, item.Count, relative_children_count, ref layout); + layout_items(item, last_layout_child, item.Count, relative_children_count, ref layout, inMeasureMode); // In wrap mode we may need to tweak the position of each line according to // the align_content property as well as the cross-axis size of items that @@ -729,7 +729,7 @@ static void layout_align(AlignContent align, float flex_dim, uint children_count } } - static void layout_items(Item item, int child_begin, int child_end, int children_count, ref flex_layout layout) + static void layout_items(Item item, int child_begin, int child_end, int children_count, ref flex_layout layout, bool inMeasureMode) { if (children_count > (child_end - child_begin)) throw new ArgumentException($"The {children_count} must not be smaller than the requested range between {child_begin} and {child_end}", nameof(children_count)); @@ -850,7 +850,7 @@ static void layout_items(Item item, int child_begin, int child_end, int children } // Now that the item has a frame, we can layout its children. - layout_item(child, child.Frame[2], child.Frame[3]); + layout_item(child, child.Frame[2], child.Frame[3], inMeasureMode); } if (layout.wrap && !layout.reverse2)