Skip to content

Commit

Permalink
Add additional failing integration tests.
Browse files Browse the repository at this point in the history
For problems introduced in #10153.
  • Loading branch information
grokys committed Feb 4, 2023
1 parent 571b774 commit 2951b80
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tests/Avalonia.IntegrationTests.Appium/WindowTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public WindowTests(TestAppFixture fixture)

[Theory]
[MemberData(nameof(StartupLocationData))]
public void StartupLocation(Size? size, ShowWindowMode mode, WindowStartupLocation location)
public void StartupLocation(Size? size, ShowWindowMode mode, WindowStartupLocation location, bool canResize)
{
using var window = OpenWindow(size, mode, location);
using var window = OpenWindow(size, mode, location, canResize: canResize);
var info = GetWindowInfo();

if (size.HasValue)
Expand Down Expand Up @@ -230,10 +230,10 @@ public void TransparentPopup()
Assert.Equal(new Rgba32(255, 0, 0), centerColor);
}

public static TheoryData<Size?, ShowWindowMode, WindowStartupLocation> StartupLocationData()
public static TheoryData<Size?, ShowWindowMode, WindowStartupLocation, bool> StartupLocationData()
{
var sizes = new Size?[] { null, new Size(400, 300) };
var data = new TheoryData<Size?, ShowWindowMode, WindowStartupLocation>();
var data = new TheoryData<Size?, ShowWindowMode, WindowStartupLocation, bool>();

foreach (var size in sizes)
{
Expand All @@ -243,7 +243,8 @@ public void TransparentPopup()
{
if (!(location == WindowStartupLocation.CenterOwner && mode == ShowWindowMode.NonOwned))
{
data.Add(size, mode, location);
data.Add(size, mode, location, true);
data.Add(size, mode, location, false);
}
}
}
Expand Down Expand Up @@ -311,14 +312,16 @@ private static void AssertCloseEnough(PixelPoint expected, PixelPoint actual)
Size? size,
ShowWindowMode mode,
WindowStartupLocation location = WindowStartupLocation.Manual,
WindowState state = Controls.WindowState.Normal)
WindowState state = Controls.WindowState.Normal,
bool canResize = true)
{
var sizeTextBox = _session.FindElementByAccessibilityId("ShowWindowSize");
var modeComboBox = _session.FindElementByAccessibilityId("ShowWindowMode");
var locationComboBox = _session.FindElementByAccessibilityId("ShowWindowLocation");
var stateComboBox = _session.FindElementByAccessibilityId("ShowWindowState");
var canResizeCheckBox = _session.FindElementByAccessibilityId("ShowWindowCanResize");
var showButton = _session.FindElementByAccessibilityId("ShowWindow");

if (size.HasValue)
sizeTextBox.SendKeys($"{size.Value.Width}, {size.Value.Height}");

Expand All @@ -331,6 +334,9 @@ private static void AssertCloseEnough(PixelPoint expected, PixelPoint actual)
stateComboBox.Click();
_session.FindElementByAccessibilityId($"ShowWindowState{state}").SendClick();

if (canResizeCheckBox.GetIsChecked() != canResize)
canResizeCheckBox.Click();

return showButton.OpenWindowWithClick();
}

Expand Down

0 comments on commit 2951b80

Please sign in to comment.