Skip to content

Commit

Permalink
WASDK 1.6: Fix build and tests (#16276)
Browse files Browse the repository at this point in the history
Co-authored-by: 0x5BFA <[email protected]>
  • Loading branch information
hez2010 and 0x5bfa authored Sep 29, 2024
1 parent 168eeca commit 730cf5b
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/Files.App (Package)/Files.Package.wapproj
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240829007" IncludeAssets="build" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" IncludeAssets="build" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" IncludeAssets="build" />
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
<Target Name="RemoveOutOfProcWinMD" BeforeTargets="_GenerateCurrentProjectAppxManifest">
Expand Down
3 changes: 1 addition & 2 deletions src/Files.App.Controls/Files.App.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.WinUI.UI" Version="7.1.2" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240829007" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.1.3" />
</ItemGroup>

Expand Down
30 changes: 27 additions & 3 deletions src/Files.App.Controls/ThemedIcon/ThemedIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Markup;
using Microsoft.UI.Xaml.Shapes;
using CommunityToolkit.WinUI.UI;
using Microsoft.UI.Xaml.Controls.Primitives;
using System.Linq;
using System.Collections.Generic;
using System.Reflection.Emit;
using System;

namespace Files.App.Controls
{
Expand Down Expand Up @@ -371,6 +371,30 @@ private void UpdateIconColorTypeStates()
layer.IconColorType = IconColorType;
}
}
}
}
}

private T? FindAscendant<T>() where T : notnull, DependencyObject
{
T val;
DependencyObject element = this;
while (true)
{
DependencyObject parent = VisualTreeHelper.GetParent(element);
if (parent is null)
{
return null;
}

if (parent is T target)
{
val = target;
break;
}

element = parent;
}

return val;
}
}
}
14 changes: 7 additions & 7 deletions src/Files.App.Launcher/Files.App.Launcher.vcxproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2024 Files Community. Licensed under the MIT License. See the LICENSE. -->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|arm64">
<Configuration>Debug</Configuration>
Expand Down Expand Up @@ -329,15 +329,15 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.240122.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.240122.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references a NuGet package that is not on this computer. To download those packages, use Restore NuGet Packages. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.240122.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.240122.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
</Target>
</Project>
</Project>
4 changes: 2 additions & 2 deletions src/Files.App.Launcher/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.240122.1" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.240803.1" targetFramework="native" />
</packages>
16 changes: 8 additions & 8 deletions src/Files.App/Files.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,29 +67,29 @@

<ItemGroup>
<PackageReference Include="ByteSize" Version="2.1.2" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
<PackageReference Include="DiscUtils.Udf" Version="0.16.13" />
<PackageReference Include="FluentFTP" Version="43.0.1" />
<PackageReference Include="LibGit2Sharp" Version="0.30.0" />
<PackageReference Include="MessageFormat" Version="7.1.0" />
<PackageReference Include="MessageFormat" Version="7.1.1" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="8.0.8" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2739.15" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" />
<PackageReference Include="Sentry" Version="4.10.2" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2792.45" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
<PackageReference Include="Sentry" Version="4.11.0" />
<PackageReference Include="SevenZipSharp" Version="1.0.2" />
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.8" />
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.10" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240829007" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.2.0" />
<PackageReference Include="CommunityToolkit.WinUI.UI.Behaviors" Version="7.1.2" />
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
<PackageReference Include="TagLibSharp" Version="2.3.0" />
<PackageReference Include="Tulpep.ActiveDirectoryObjectPicker" Version="3.0.11" />
<PackageReference Include="WinUIEx" Version="2.3.4" />
<PackageReference Include="Vanara.Windows.Extensions" Version="4.0.1" />
<PackageReference Include="Vanara.Windows.Shell" Version="4.0.1" />
<PackageReference Include="Vanara.Windows.Extensions" Version="4.0.4" />
<PackageReference Include="Vanara.Windows.Shell" Version="4.0.4" />
<PackageReference Include="Microsoft.Management.Infrastructure" Version="3.0.0" />
<PackageReference Include="Microsoft.Management.Infrastructure.Runtime.Win" Version="3.0.0" />
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.1.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public static Task SetClipboard(string[] filesToCopy, DataPackageOperation opera
{
using var shi = new ShellItem(fileToDeletePath[i]);
using var file = SafetyExtensions.IgnoreExceptions(() => GetFirstFile(shi)) ?? shi;
if ((uint?)file.Properties.GetValueOrDefault(PKEY_FilePlaceholderStatus) == PS_CLOUDFILE_PLACEHOLDER)
if (file.Properties.TryGetValue(PKEY_FilePlaceholderStatus, out var value) && (uint?)value == PS_CLOUDFILE_PLACEHOLDER)
{
// Online only files cannot be tried for deletion, so they are treated as to be permanently deleted.
shellOperationResult.Items.Add(new ShellOperationItemResult()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using Vanara.Extensions;
using Vanara.PInvoke;
using Vanara.Windows.Shell;
using Windows.ApplicationModel.DataTransfer;
Expand Down
1 change: 1 addition & 0 deletions src/Files.App/Views/Layouts/BaseLayoutPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices.ComTypes;
using Vanara.Extensions;
using Vanara.PInvoke;
using Windows.ApplicationModel.DataTransfer;
using Windows.ApplicationModel.DataTransfer.DragDrop;
Expand Down
2 changes: 1 addition & 1 deletion tests/Files.App.UITests/Files.App.UITests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240829007" />
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.1.3" />
<Manifest Include="$(ApplicationManifest)" />
Expand Down
6 changes: 3 additions & 3 deletions tests/Files.InteractionTests/Files.InteractionTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

<ItemGroup>
<PackageReference Include="Appium.WebDriver" Version="4.4.5" />
<PackageReference Include="Axe.Windows" Version="2.4.0" />
<PackageReference Include="Axe.Windows" Version="2.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="MSTest.TestAdapter" Version="3.5.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.5.2" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.0" />
</ItemGroup>

</Project>
3 changes: 2 additions & 1 deletion tests/Files.InteractionTests/Helper/AxeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ internal static void InitializeAxe()

public static void AssertNoAccessibilityErrors()
{
var testResult = AccessibilityScanner.Scan(null).WindowScanOutputs.SelectMany(output => output.Errors).Where(error => error.Rule.ID != RuleId.BoundingRectangleNotNull);
var testResult = AccessibilityScanner.Scan(null).WindowScanOutputs.SelectMany(output => output.Errors)
.Where(error => !(error.Rule.ID is RuleId.BoundingRectangleNotNull or RuleId.SiblingUniqueAndFocusable));
if (testResult.Count() != 0)
{
var mappedResult = testResult.Select(result => "Element " + result.Element.Properties["ControlType"] + " violated rule '" + result.Rule.Description + "'.");
Expand Down
4 changes: 4 additions & 0 deletions tests/Files.InteractionTests/Tests/FolderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using OpenQA.Selenium;
using OpenQA.Selenium.Interactions;
using System.Linq;
using System.Threading;

namespace Files.InteractionTests.Tests
Expand Down Expand Up @@ -65,6 +66,8 @@ private void CreateFolderTest()
// Check for accessibility issues in the new folder prompt
AxeHelper.AssertNoAccessibilityErrors();

SessionManager.Session.FindElementsByClassName("TextBox").Last().Click();

// Type the folder name
var action = new Actions(SessionManager.Session);
action.SendKeys("New Folder").Perform();
Expand Down Expand Up @@ -137,6 +140,7 @@ private void DeleteFolderTest()
var action = new Actions(SessionManager.Session);
action.SendKeys(Keys.Enter).Perform();

Thread.Sleep(3000);

// Select the "Renamed Folder - Copy" folder and clicks the "delete" button on the toolbar
TestHelper.InvokeButtonByName("Renamed Folder - Copy");
Expand Down

0 comments on commit 730cf5b

Please sign in to comment.