Skip to content

Commit

Permalink
Merge branch 'dotnet:main' into enable-xamarinuitest-55
Browse files Browse the repository at this point in the history
  • Loading branch information
anandhan-rajagopal authored Dec 19, 2024
2 parents f924a31 + 552b9eb commit 38d65c0
Show file tree
Hide file tree
Showing 21 changed files with 130 additions and 130 deletions.
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<MicrosoftExtensionsLoggingDebugVersion>9.0.0</MicrosoftExtensionsLoggingDebugVersion>
<MicrosoftExtensionsPrimitivesVersion>9.0.0</MicrosoftExtensionsPrimitivesVersion>
<!-- xamarin/xamarin-android -->
<MicrosoftAndroidSdkWindowsPackageVersion>35.0.7</MicrosoftAndroidSdkWindowsPackageVersion>
<MicrosoftAndroidSdkWindowsPackageVersion>35.0.24</MicrosoftAndroidSdkWindowsPackageVersion>
<!-- xamarin/xamarin-macios -->
<MicrosoftMacCatalystSdknet90_180PackageVersion>18.0.9617</MicrosoftMacCatalystSdknet90_180PackageVersion>
<MicrosoftmacOSSdknet90_150PackageVersion>15.0.9617</MicrosoftmacOSSdknet90_150PackageVersion>
Expand Down
10 changes: 5 additions & 5 deletions src/Controls/src/Core/Layout/FlexLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Controls/src/Core/LegacyLayouts/FlexLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
49 changes: 49 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue23491.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#if ANDROID
using NUnit.Framework;
using OpenQA.Selenium.Appium;
using UITest.Appium;
using UITest.Core;

Expand All @@ -16,13 +14,11 @@ public Bugzilla25662(TestDevice testDevice) : base(testDevice)

[Test]
[Category(UITestCategories.Cells)]
[FailsOnIOSWhenRunningOnXamarinUITest]
[FailsOnWindowsWhenRunningOnXamarinUITest]
public void Bugzilla25662Test()
{
App.WaitForElement("One");
App.Tap("One");
App.WaitForNoElement("FAIL");
}
}
#endif

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if TEST_FAILS_ON_IOS && TEST_FAILS_ON_CATALYST
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
}
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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");
}
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if IOS
using NUnit.Framework;
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

Expand All @@ -16,17 +15,14 @@ public Bugzilla31395(TestDevice testDevice) : base(testDevice)
[Test]
[Category(UITestCategories.Navigation)]
[Category(UITestCategories.Compatibility)]
[FailsOnIOSWhenRunningOnXamarinUITest]
[FailsOnMacWhenRunningOnXamarinUITest]
public void Bugzilla31395Test()
{
App.WaitForElement("SwitchMainPage");
Assert.DoesNotThrow(() =>
{
App.Tap("SwitchMainPage");
});
App.WaitForNoElement("Hello");
App.WaitForElement("Hello");
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if IOS
using NUnit.Framework;
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

Expand All @@ -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
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if TEST_FAILS_ON_CATALYST && TEST_FAILS_ON_WINDOWS
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if IOS
using NUnit.Framework;
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

Expand All @@ -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
Loading

0 comments on commit 38d65c0

Please sign in to comment.