Browse Source

Added failing integration test.

pull/10265/head
Steven Kirk 4 years ago
parent
commit
571b7746ea
  1. 1
      samples/IntegrationTestApp/MainWindow.axaml
  2. 2
      samples/IntegrationTestApp/MainWindow.axaml.cs
  3. 24
      tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs

1
samples/IntegrationTestApp/MainWindow.axaml

@ -139,6 +139,7 @@
<ComboBoxItem Name="ShowWindowStateMaximized">Maximized</ComboBoxItem>
<ComboBoxItem Name="ShowWindowStateFullScreen">FullScreen</ComboBoxItem>
</ComboBox>
<CheckBox Name="ShowWindowCanResize" IsChecked="True">Can Resize</CheckBox>
<Button Name="ShowWindow">Show Window</Button>
<Button Name="SendToBack">Send to Back</Button>
<Button Name="EnterFullscreen">Enter Fullscreen</Button>

2
samples/IntegrationTestApp/MainWindow.axaml.cs

@ -66,11 +66,13 @@ namespace IntegrationTestApp
var locationComboBox = this.GetControl<ComboBox>("ShowWindowLocation");
var stateComboBox = this.GetControl<ComboBox>("ShowWindowState");
var size = !string.IsNullOrWhiteSpace(sizeTextBox.Text) ? Size.Parse(sizeTextBox.Text) : (Size?)null;
var canResizeCheckBox = this.GetControl<CheckBox>("ShowWindowCanResize");
var owner = (Window)this.GetVisualRoot()!;
var window = new ShowWindowTest
{
WindowStartupLocation = (WindowStartupLocation)locationComboBox.SelectedIndex,
CanResize = canResizeCheckBox.IsChecked.Value,
};
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime lifetime)

24
tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs

@ -323,11 +323,30 @@ namespace Avalonia.IntegrationTests.Appium
secondaryWindow.GetChromeButtons().close.Click();
}
private IDisposable OpenWindow(PixelSize? size, ShowWindowMode mode, WindowStartupLocation location)
[PlatformTheory(TestPlatforms.MacOS)]
[InlineData(ShowWindowMode.NonOwned)]
[InlineData(ShowWindowMode.Owned)]
[InlineData(ShowWindowMode.Modal)]
public void Window_Has_Disabled_Zoom_Button_When_CanResize_Is_False(ShowWindowMode mode)
{
using (OpenWindow(null, mode, WindowStartupLocation.Manual, canResize: false))
{
var secondaryWindow = GetWindow("SecondaryWindow");
var (_, _, zoomButton) = secondaryWindow.GetChromeButtons();
Assert.False(zoomButton.Enabled);
}
}
private IDisposable OpenWindow(
PixelSize? size,
ShowWindowMode mode,
WindowStartupLocation location,
bool canResize = true)
{
var sizeTextBox = _session.FindElementByAccessibilityId("ShowWindowSize");
var modeComboBox = _session.FindElementByAccessibilityId("ShowWindowMode");
var locationComboBox = _session.FindElementByAccessibilityId("ShowWindowLocation");
var canResizeCheckBox = _session.FindElementByAccessibilityId("ShowWindowCanResize");
var showButton = _session.FindElementByAccessibilityId("ShowWindow");
if (size.HasValue)
@ -338,6 +357,9 @@ namespace Avalonia.IntegrationTests.Appium
locationComboBox.Click();
_session.FindElementByName(location.ToString()).SendClick();
if (canResizeCheckBox.GetIsChecked() != canResize)
canResizeCheckBox.Click();
return showButton.OpenWindowWithClick();
}

Loading…
Cancel
Save