diff --git a/samples/IntegrationTestApp/IntegrationTestApp.csproj b/samples/IntegrationTestApp/IntegrationTestApp.csproj index 82a9d87b0a..0de7812fde 100644 --- a/samples/IntegrationTestApp/IntegrationTestApp.csproj +++ b/samples/IntegrationTestApp/IntegrationTestApp.csproj @@ -4,6 +4,7 @@ $(AvsCurrentTargetFramework) enable $(NoWarn);AVP1012 + true @@ -25,13 +26,12 @@ - - - + + diff --git a/samples/IntegrationTestApp/MainWindow.axaml b/samples/IntegrationTestApp/MainWindow.axaml index 3f6d507866..f8913e0e1e 100644 --- a/samples/IntegrationTestApp/MainWindow.axaml +++ b/samples/IntegrationTestApp/MainWindow.axaml @@ -5,7 +5,6 @@ xmlns:vm="using:IntegrationTestApp.ViewModels" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="IntegrationTestApp.MainWindow" - Name="MainWindow" Icon="/Assets/icon.ico" Title="IntegrationTestApp" x:DataType="vm:MainWindowViewModel"> diff --git a/samples/IntegrationTestApp/MainWindow.axaml.cs b/samples/IntegrationTestApp/MainWindow.axaml.cs index 62ef970aa1..f281a0038f 100644 --- a/samples/IntegrationTestApp/MainWindow.axaml.cs +++ b/samples/IntegrationTestApp/MainWindow.axaml.cs @@ -6,7 +6,7 @@ using IntegrationTestApp.ViewModels; namespace IntegrationTestApp { - public class MainWindow : Window + public partial class MainWindow : Window { public MainWindow() { @@ -23,7 +23,6 @@ namespace IntegrationTestApp private void InitializeViewMenu(IEnumerable pages) { - var mainTabs = this.Get("MainTabs"); var viewMenu = (NativeMenuItem?)NativeMenu.GetMenu(this)?.Items[1]; foreach (var page in pages) @@ -64,9 +63,7 @@ namespace IntegrationTestApp new("Gestures", () => new GesturesPage()), new("ListBox", () => new ListBoxPage()), new("Menu", () => new MenuPage()), - new("Pointer", () => new PointerPage()), new("RadioButton", () => new RadioButtonPage()), - new("Screens", () => new ScreensPage()), new("ScrollBar", () => new ScrollBarPage()), new("Slider", () => new SliderPage()), new("Window Decorations", () => new WindowDecorationsPage()), diff --git a/samples/IntegrationTestApp/Pages/PointerPage.axaml b/samples/IntegrationTestApp/Pages/PointerPage.axaml deleted file mode 100644 index ba6016c9b5..0000000000 --- a/samples/IntegrationTestApp/Pages/PointerPage.axaml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - Show Dialog - - - - diff --git a/samples/IntegrationTestApp/Pages/PointerPage.axaml.cs b/samples/IntegrationTestApp/Pages/PointerPage.axaml.cs deleted file mode 100644 index b34798be10..0000000000 --- a/samples/IntegrationTestApp/Pages/PointerPage.axaml.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Avalonia; -using Avalonia.Controls; -using Avalonia.Input; - -namespace IntegrationTestApp.Pages; - -public partial class PointerPage : UserControl -{ - public PointerPage() - { - InitializeComponent(); - } - - private void PointerPageShowDialog_PointerPressed(object? sender, PointerPressedEventArgs e) - { - void CaptureLost(object? sender, PointerCaptureLostEventArgs e) - { - PointerCaptureStatus.Text = "None"; - ((Control)sender!).PointerCaptureLost -= CaptureLost; - } - - var window = TopLevel.GetTopLevel(this) as Window ?? - throw new AvaloniaInternalException("PointerPage is not attached to a Window."); - var captured = e.Pointer.Captured as Control; - - if (captured is not null) - { - captured.PointerCaptureLost += CaptureLost; - } - - PointerCaptureStatus.Text = captured?.ToString() ?? "None"; - - var dialog = new Window - { - Width = 200, - Height = 200, - }; - - dialog.Content = new Button - { - Content = "Close", - Command = new DelegateCommand(() => dialog.Close()), - }; - - dialog.ShowDialog(window); - } -} diff --git a/samples/IntegrationTestApp/Pages/ScreensPage.axaml b/samples/IntegrationTestApp/Pages/ScreensPage.axaml deleted file mode 100644 index 2d95c4719a..0000000000 --- a/samples/IntegrationTestApp/Pages/ScreensPage.axaml +++ /dev/null @@ -1,19 +0,0 @@ - - - - diff --git a/samples/IntegrationTestApp/Pages/WindowPage.axaml.cs b/samples/IntegrationTestApp/Pages/WindowPage.axaml.cs index 5549e537d3..9cf1260629 100644 --- a/samples/IntegrationTestApp/Pages/WindowPage.axaml.cs +++ b/samples/IntegrationTestApp/Pages/WindowPage.axaml.cs @@ -179,21 +179,4 @@ public partial class WindowPage : UserControl window.WindowState = WindowState.Normal; } } - - private void ShowTopmostWindow_Click(object? sender, RoutedEventArgs e) - { - var mainWindow = new TopmostWindowTest("OwnerWindow") - { - Topmost = true, - Title = "Owner Window" - }; - var ownedWindow = new TopmostWindowTest("OwnedWindow") - { - WindowStartupLocation = WindowStartupLocation.CenterOwner, - Title = "Owned Window" - }; - - mainWindow.Show(); - ownedWindow.Show(mainWindow); - } } diff --git a/samples/IntegrationTestApp/ShowWindowTest.axaml.cs b/samples/IntegrationTestApp/ShowWindowTest.axaml.cs index 0c5774bf53..ad4aec7940 100644 --- a/samples/IntegrationTestApp/ShowWindowTest.axaml.cs +++ b/samples/IntegrationTestApp/ShowWindowTest.axaml.cs @@ -25,7 +25,7 @@ namespace IntegrationTestApp } } - public class ShowWindowTest : Window + public partial class ShowWindowTest : Window { private readonly DispatcherTimer? _timer; private readonly TextBox? _orderTextBox; @@ -44,11 +44,6 @@ namespace IntegrationTestApp _timer.Start(); } } - - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } protected override void OnOpened(EventArgs e) { diff --git a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs index 67ac84b2a6..1e2913ae12 100644 --- a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs +++ b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs @@ -262,7 +262,7 @@ namespace Avalonia.IntegrationTests.Appium { using (OpenWindow(null, mode, WindowStartupLocation.Manual, canResize: false, extendClientArea: extendClientArea)) { - var secondaryWindow = Session.GetWindowById("SecondaryWindow"); + var secondaryWindow = GetWindow("SecondaryWindow"); AppiumWebElement? maximizeButton; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) @@ -413,12 +413,12 @@ namespace Avalonia.IntegrationTests.Appium { // The Avalonia a11y tree currently exposes two nested Window elements, this is a bug and should be fixed // but in the meantime use the `parent::' selector to return the parent "real" window. - return _session.FindElementByXPath( + return Session.FindElementByXPath( $"XCUIElementTypeWindow//*[@identifier='{identifier}']/parent::XCUIElementTypeWindow"); } else { - return _session.FindElementByXPath($"//Window[@AutomationId='{identifier}']"); + return Session.FindElementByXPath($"//Window[@AutomationId='{identifier}']"); } } diff --git a/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs b/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs index ed57f9bed1..25bacc3336 100644 --- a/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs +++ b/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs @@ -423,7 +423,7 @@ namespace Avalonia.IntegrationTests.Appium private AppiumWebElement GetWindow(string identifier) { - return Session.GetWindowById(identifier); + return GetWindow(identifier); } private int GetWindowOrder(string identifier)