From 9ed8648c91670cc1c851a2c47cc61cfc8b67e748 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 4 Jul 2022 17:51:30 +0100 Subject: [PATCH 01/17] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines-integrationtests.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 azure-pipelines-integrationtests.yml diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml new file mode 100644 index 0000000000..34ba412df0 --- /dev/null +++ b/azure-pipelines-integrationtests.yml @@ -0,0 +1,15 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +trigger: +- master + +pool: + vmImage: osx-latest + +steps: +- script: start-appium + appium + displayName: 'start appium' From e4203da346ea2baa3d32800f1adc3d5447df370d Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 4 Jul 2022 17:53:55 +0100 Subject: [PATCH 02/17] Update azure-pipelines-integrationtests.yml for Azure Pipelines --- azure-pipelines-integrationtests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index 34ba412df0..242a4e4463 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -7,7 +7,7 @@ trigger: - master pool: - vmImage: osx-latest + vmImage: macOS-10.15 steps: - script: start-appium From 9c8b7797479caf5280adfb156e27851f8cfa546b Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 4 Jul 2022 17:57:11 +0100 Subject: [PATCH 03/17] Update azure-pipelines-integrationtests.yml for Azure Pipelines --- azure-pipelines-integrationtests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index 242a4e4463..4c5026fa81 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -10,6 +10,5 @@ pool: vmImage: macOS-10.15 steps: -- script: start-appium - appium +- script: appium displayName: 'start appium' From d462d1147a31b1d5b4d4fb9397afcf9b85858173 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 4 Jul 2022 18:00:20 +0100 Subject: [PATCH 04/17] Update azure-pipelines-integrationtests.yml for Azure Pipelines --- azure-pipelines-integrationtests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index 4c5026fa81..d6a6580981 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -10,5 +10,9 @@ pool: vmImage: macOS-10.15 steps: +- script: npm install -g appium + displayName: 'install appium' + - script: appium displayName: 'start appium' + From 0f40cedfb9f5fbaad51af2f22f5d9cb797cd4281 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 4 Jul 2022 18:06:44 +0100 Subject: [PATCH 05/17] Update azure-pipelines-integrationtests.yml for Azure Pipelines --- azure-pipelines-integrationtests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index d6a6580981..f5938c85a3 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -13,6 +13,6 @@ steps: - script: npm install -g appium displayName: 'install appium' -- script: appium +- script: appium & displayName: 'start appium' From fb7998bf9d869ec16aff88a79e86101ce2cf8443 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 4 Jul 2022 18:26:34 +0100 Subject: [PATCH 06/17] Update azure-pipelines-integrationtests.yml for Azure Pipelines --- azure-pipelines-integrationtests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index f5938c85a3..476db51800 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -15,4 +15,7 @@ steps: - script: appium & displayName: 'start appium' + +- script: ./tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh + displayName: 'run integration tests' From d400353bfe2e30d76691cd5a85c21c261ec89f46 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 4 Jul 2022 18:30:08 +0100 Subject: [PATCH 07/17] install sdks. --- azure-pipelines-integrationtests.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index 476db51800..981f6f673c 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -10,6 +10,16 @@ pool: vmImage: macOS-10.15 steps: +- task: UseDotNet@2 + displayName: 'Use .NET Core SDK 3.1.418' + inputs: + version: 3.1.418 + +- task: UseDotNet@2 + displayName: 'Use .NET Core SDK 6.0.202' + inputs: + version: 6.0.202 + - script: npm install -g appium displayName: 'install appium' From fc19f1e1a001539cfd77ca6210664603c051ef1b Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 4 Jul 2022 18:31:12 +0100 Subject: [PATCH 08/17] fix yaml --- azure-pipelines-integrationtests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index 981f6f673c..f8a38673a9 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -11,9 +11,9 @@ pool: steps: - task: UseDotNet@2 - displayName: 'Use .NET Core SDK 3.1.418' - inputs: - version: 3.1.418 + displayName: 'Use .NET Core SDK 3.1.418' + inputs: + version: 3.1.418 - task: UseDotNet@2 displayName: 'Use .NET Core SDK 6.0.202' From 92bdf1cce528df34df076bef95809a175452c011 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 4 Jul 2022 18:50:34 +0100 Subject: [PATCH 09/17] install the integration sample app --- tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh b/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh index 30a4a79f4a..635c593f37 100755 --- a/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh +++ b/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh @@ -5,4 +5,5 @@ cd "$SCRIPT_DIR"/../.. || exit git clean -xdf ./build.sh CompileNative ./samples/IntegrationTestApp/bundle.sh +open -n ./samples/IntegrationTestApp/bin/Debug/net6.0/osx-arm64/publish/IntegrationTestApp.app dotnet test tests/Avalonia.IntegrationTests.Appium/ -l "console;verbosity=detailed" From 219a12fb745cd067250f83bba2dbe7a8703cd6e1 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 4 Jul 2022 19:01:22 +0100 Subject: [PATCH 10/17] use macos-12 for integration tests --- azure-pipelines-integrationtests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index f8a38673a9..0598e205ec 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -7,7 +7,7 @@ trigger: - master pool: - vmImage: macOS-10.15 + vmImage: macOS-12 steps: - task: UseDotNet@2 From 9679b1562cda7c51c7b05ff77fd061fe275aa246 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 5 Jul 2022 11:42:44 +0100 Subject: [PATCH 11/17] use self hosted mac agent. --- azure-pipelines-integrationtests.yml | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index 0598e205ec..a8c78aa8d0 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -7,22 +7,9 @@ trigger: - master pool: - vmImage: macOS-12 + name: 'AvaloniaMacPool' steps: -- task: UseDotNet@2 - displayName: 'Use .NET Core SDK 3.1.418' - inputs: - version: 3.1.418 - -- task: UseDotNet@2 - displayName: 'Use .NET Core SDK 6.0.202' - inputs: - version: 6.0.202 - -- script: npm install -g appium - displayName: 'install appium' - - script: appium & displayName: 'start appium' From f215bfadf08421a2eebf60d175d9d5a4627bf942 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 5 Jul 2022 11:54:16 +0100 Subject: [PATCH 12/17] dont start appium --- azure-pipelines-integrationtests.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index a8c78aa8d0..94a80eef44 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -10,9 +10,6 @@ pool: name: 'AvaloniaMacPool' steps: -- script: appium & - displayName: 'start appium' - - script: ./tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh displayName: 'run integration tests' From 407f761201a287e22bc34f086f7491d7632b42c4 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 6 Jul 2022 12:34:38 +0100 Subject: [PATCH 13/17] add windows task --- azure-pipelines-integrationtests.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index 94a80eef44..4f3ac57e73 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -6,10 +6,16 @@ trigger: - master -pool: - name: 'AvaloniaMacPool' -steps: -- script: ./tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh - displayName: 'run integration tests' +- job: Mac + pool: + name: 'AvaloniaMacPool' + steps: + - script: ./tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh + displayName: 'run integration tests' + + +- job: Windows + pool: + vmImage: 'windows-2022' From 03b0fcb4549af35d142dcf9cb408fc49b6032e7d Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 6 Jul 2022 12:40:42 +0100 Subject: [PATCH 14/17] add windows integration tests --- azure-pipelines-integrationtests.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index 4f3ac57e73..05872803b4 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -6,7 +6,7 @@ trigger: - master - +jobs: - job: Mac pool: name: 'AvaloniaMacPool' @@ -19,3 +19,20 @@ trigger: - job: Windows pool: vmImage: 'windows-2022' + + steps: + - task: Windows Application Driver@0 + inputs: + OperationType: 'Start' + AgentResolution: '1080p' + displayName: 'Start WinAppDriver' + + - task: DotNetCoreCLI@2 + inputs: + command: 'test' + projects: 'tests/Avalonia.IntegrationTests.Appium/' + + - task: Windows Application Driver@0 + inputs: + OperationType: 'Stop' + displayName: 'Stop WinAppDriver' From 7b12c76e1d79a8948bd1868018c1a829be1a5175 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 6 Jul 2022 13:21:48 +0100 Subject: [PATCH 15/17] build test app first. --- azure-pipelines-integrationtests.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index 05872803b4..941dd01249 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -21,16 +21,26 @@ jobs: vmImage: 'windows-2022' steps: + - task: UseDotNet@2 + displayName: 'Use .NET Core SDK 6.0.202' + inputs: + version: 6.0.202 + - task: Windows Application Driver@0 inputs: OperationType: 'Start' AgentResolution: '1080p' displayName: 'Start WinAppDriver' + + - task: DotNetCoreCLI@2 + inputs: + command: 'build' + projects: 'samples/IntegrationTestApp/IntegrationTestApp.csproj' - task: DotNetCoreCLI@2 inputs: command: 'test' - projects: 'tests/Avalonia.IntegrationTests.Appium/' + projects: 'tests/Avalonia.IntegrationTests.Appium/Avalonia.IntegrationTests.Appium.csproj' - task: Windows Application Driver@0 inputs: From 0bb62fa8092421d6bf2f72479041f6bc93fffe34 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 6 Jul 2022 13:39:03 +0100 Subject: [PATCH 16/17] use 4k res on windows tests --- azure-pipelines-integrationtests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index 941dd01249..c3f6292703 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -29,7 +29,7 @@ jobs: - task: Windows Application Driver@0 inputs: OperationType: 'Start' - AgentResolution: '1080p' + AgentResolution: '4K' displayName: 'Start WinAppDriver' - task: DotNetCoreCLI@2 From c034525d29dd2d6e4c95aebf17751ccfc6332c0e Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 6 Jul 2022 14:40:46 +0100 Subject: [PATCH 17/17] win32, keep window size at all scale settings when entering and exiting fs mode. --- src/Windows/Avalonia.Win32/WindowImpl.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index 82f1fa7a3e..259f5c996b 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -870,7 +870,14 @@ namespace Avalonia.Win32 if (fullscreen) { GetWindowRect(_hwnd, out var windowRect); - _savedWindowInfo.WindowRect = windowRect; + GetClientRect(_hwnd, out var clientRect); + + clientRect.left += windowRect.left; + clientRect.right += windowRect.left; + clientRect.top += windowRect.top; + clientRect.bottom += windowRect.top; + + _savedWindowInfo.WindowRect = clientRect; var current = GetStyle(); var currentEx = GetExtendedStyle(); @@ -907,10 +914,10 @@ namespace Avalonia.Win32 SetExtendedStyle(_savedWindowInfo.ExStyle, false); // On restore, resize to the previous saved rect size. - var new_rect = _savedWindowInfo.WindowRect.ToPixelRect(); + var newClientRect = _savedWindowInfo.WindowRect.ToPixelRect(); - SetWindowPos(_hwnd, IntPtr.Zero, new_rect.X, new_rect.Y, new_rect.Width, - new_rect.Height, + SetWindowPos(_hwnd, IntPtr.Zero, newClientRect.X, newClientRect.Y, newClientRect.Width, + newClientRect.Height, SetWindowPosFlags.SWP_NOZORDER | SetWindowPosFlags.SWP_NOACTIVATE | SetWindowPosFlags.SWP_FRAMECHANGED); UpdateWindowProperties(_windowProperties, true);