Skip to content

Commit

Permalink
Bump the windowsappsdk group with 3 updates (dotnet#20460)
Browse files Browse the repository at this point in the history
* Bump the windowsappsdk group with 3 updates

* Cache the current pane display mode change in shell for flyout behavior to fix test crash

* - fixed restart logic on winui

* Update Versions.props

---------

Co-authored-by: Mike Corsaro <[email protected]>
  • Loading branch information
PureWeen and Mike Corsaro authored Mar 1, 2024
1 parent dabab46 commit d77b18f
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

<!-- Until we get a new enough dotnet -->
<ItemGroup Condition="'$(_MauiTargetPlatformIsWindows)' == 'True'">
<FrameworkReference Update="Microsoft.Windows.SDK.NET.Ref" RuntimeFrameworkVersion="10.0.19041.27" TargetingPackVersion="10.0.19041.27" />
<FrameworkReference Update="Microsoft.Windows.SDK.NET.Ref" RuntimeFrameworkVersion="10.0.19041.31" TargetingPackVersion="10.0.19041.31" />
</ItemGroup>

<!--
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<!-- emsdk -->
<MicrosoftNETWorkloadEmscriptenPackageVersion>8.0.0</MicrosoftNETWorkloadEmscriptenPackageVersion>
<!-- wasdk -->
<MicrosoftWindowsAppSDKPackageVersion>1.3.230724000</MicrosoftWindowsAppSDKPackageVersion>
<MicrosoftWindowsAppSDKPackageVersion>1.5.240227000</MicrosoftWindowsAppSDKPackageVersion>
<MicrosoftWindowsSDKBuildToolsPackageVersion>10.0.22621.756</MicrosoftWindowsSDKBuildToolsPackageVersion>
<MicrosoftGraphicsWin2DPackageVersion>1.0.5.1</MicrosoftGraphicsWin2DPackageVersion>
<!-- Everything else -->
Expand Down
1 change: 1 addition & 0 deletions src/Controls/tests/UITests/Tests/Issues/Issue17490.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public Issue17490(TestDevice device) : base(device)
public override string Issue => "Crash using Pinvoke.SetParent to create Window as Child";

[Test]
[Ignore("This broke with WinAPPSDK 1.4 and we currently don't have an alternative https://github.com/dotnet/maui/issues/20253")]
[Category(UITestCategories.Window)]
public void AppDoesntCrashWhenOpeningWinUIWindowParentedToCurrentWindow()
{
Expand Down
31 changes: 31 additions & 0 deletions src/Core/src/Platform/Windows/MauiNavigationView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ namespace Microsoft.Maui.Platform
[Microsoft.UI.Xaml.Data.Bindable]
public partial class MauiNavigationView : NavigationView
{
private int _currentFlyoutBehavior = -1;

internal StackPanel? TopNavArea { get; private set; }
internal ItemsRepeater? TopNavMenuItemsHost { get; private set; }
internal Grid? PaneContentGrid { get; private set; }
Expand Down Expand Up @@ -159,6 +161,35 @@ private protected virtual void OnApplyTemplateCore()
{
}

internal void UpdatePaneDisplayModeFromFlyoutBehavior(FlyoutBehavior flyoutBehavior)
{
if (_currentFlyoutBehavior == (int)flyoutBehavior)
{
return;
}

_currentFlyoutBehavior = (int)flyoutBehavior;
switch (flyoutBehavior)
{
case FlyoutBehavior.Flyout:
IsPaneToggleButtonVisible = true;
// Workaround for
// https://github.com/microsoft/microsoft-ui-xaml/issues/6493
PaneDisplayMode = NavigationViewPaneDisplayMode.LeftCompact;
PaneDisplayMode = NavigationViewPaneDisplayMode.LeftMinimal;
break;
case FlyoutBehavior.Locked:
PaneDisplayMode = NavigationViewPaneDisplayMode.Left;
IsPaneToggleButtonVisible = false;
break;
case FlyoutBehavior.Disabled:
PaneDisplayMode = NavigationViewPaneDisplayMode.LeftMinimal;
IsPaneToggleButtonVisible = false;
IsPaneOpen = false;
break;
}
}

#region Toolbar
internal static readonly DependencyProperty ToolbarProperty
= DependencyProperty.Register(nameof(Toolbar), typeof(UIElement), typeof(MauiNavigationView),
Expand Down
20 changes: 1 addition & 19 deletions src/Core/src/Platform/Windows/NavigationViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,25 +243,7 @@ public static void UpdateFlyoutVerticalScrollMode(this MauiNavigationView naviga

public static void UpdateFlyoutBehavior(this MauiNavigationView navigationView, IFlyoutView flyoutView)
{
switch (flyoutView.FlyoutBehavior)
{
case FlyoutBehavior.Flyout:
navigationView.IsPaneToggleButtonVisible = true;
// Workaround for
// https://github.com/microsoft/microsoft-ui-xaml/issues/6493
navigationView.PaneDisplayMode = NavigationViewPaneDisplayMode.LeftCompact;
navigationView.PaneDisplayMode = NavigationViewPaneDisplayMode.LeftMinimal;
break;
case FlyoutBehavior.Locked:
navigationView.PaneDisplayMode = NavigationViewPaneDisplayMode.Left;
navigationView.IsPaneToggleButtonVisible = false;
break;
case FlyoutBehavior.Disabled:
navigationView.PaneDisplayMode = NavigationViewPaneDisplayMode.LeftMinimal;
navigationView.IsPaneToggleButtonVisible = false;
navigationView.IsPaneOpen = false;
break;
}
navigationView.UpdatePaneDisplayModeFromFlyoutBehavior(flyoutView.FlyoutBehavior);
}

public static void UpdateFlyoutWidth(this MauiNavigationView navigationView, IFlyoutView flyoutView)
Expand Down
13 changes: 11 additions & 2 deletions src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using OpenQA.Selenium.Appium.Android;
using OpenQA.Selenium.Appium.Windows;
using UITest.Core;

namespace UITest.Appium
Expand Down Expand Up @@ -63,7 +64,14 @@ CommandResponse ForegroundApp(IDictionary<string, object> parameters)
if (_app?.Driver is null)
return CommandResponse.FailedEmptyResponse;

_app.Driver.ActivateApp(_app.GetAppId());
if (_app.Driver is WindowsDriver wd)
{
wd.SwitchTo().Window(wd.WindowHandles.First());
}
else
{
_app.Driver.ActivateApp(_app.GetAppId());
}

return CommandResponse.SuccessEmptyResponse;
}
Expand Down Expand Up @@ -113,7 +121,8 @@ CommandResponse CloseApp(IDictionary<string, object> parameters)
if (_app?.Driver is null)
return CommandResponse.FailedEmptyResponse;

_app.Driver.CloseApp();
if(_app.AppState != ApplicationState.NotRunning)
_app.Driver.CloseApp();

return CommandResponse.SuccessEmptyResponse;
}
Expand Down
11 changes: 9 additions & 2 deletions src/TestUtils/src/UITest.NUnit/UITestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ public void OneTimeTearDown()
outcome.Site == ResultState.SetUpFailure.Site)
{
SaveDeviceDiagnosticInfo();
SaveUIDiagnosticInfo();

if (App.AppState != ApplicationState.NotRunning)
SaveUIDiagnosticInfo();
}

FixtureTeardown();
Expand All @@ -131,8 +133,11 @@ void SaveDeviceDiagnosticInfo([CallerMemberName] string? note = null)
}
}

protected void SaveUIDiagnosticInfo([CallerMemberName] string? note = null)
protected bool SaveUIDiagnosticInfo([CallerMemberName] string? note = null)
{
if (App.AppState == ApplicationState.NotRunning)
return false;

var screenshotPath = GetGeneratedFilePath("ScreenShot.png", note);
if (screenshotPath is not null)
{
Expand All @@ -148,6 +153,8 @@ protected void SaveUIDiagnosticInfo([CallerMemberName] string? note = null)

AddTestAttachment(pageSourcePath, Path.GetFileName(pageSourcePath));
}

return true;
}

string? GetGeneratedFilePath(string filename, string? note = null)
Expand Down

0 comments on commit d77b18f

Please sign in to comment.