Skip to content

Commit

Permalink
chore: Fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Jan 18, 2025
1 parent f8f9828 commit ba8ef84
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
10 changes: 9 additions & 1 deletion src/SamplesApp/UnoIslandsSamplesApp.Skia.Wpf/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using Microsoft.UI.Xaml;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnoIslandsSamplesApp.Skia.Wpf
Expand All @@ -9,13 +10,20 @@ public MainWindow()
{
this.InitializeComponent();
xamlHost.Loaded += XamlHost_Loaded;
xamlHost.Loaded += XamlHost_LoadedAsync;
}

private async void XamlHost_Loaded(object sender, RoutedEventArgs e)
private void XamlHost_Loaded(object sender, RoutedEventArgs e)
{
#if HAS_UNO
// Assertion should NOT be in async void.
// DON'T move this to XamlHost_LoadedAsync.
Assert.IsNotNull(xamlHost.Child.XamlRoot?.VisualTree.ContentRoot.CompositionContent, "ContentIsland of the ContentRoot should have been set by now.");
#endif
}

private async void XamlHost_LoadedAsync(object sender, RoutedEventArgs e)
{
await SamplesApp.App.HandleRuntimeTests(string.Join(";", System.Environment.GetCommandLineArgs()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public async Task When_LoadFromStreamAsync_With_Valid_Password()
Assert.IsNotNull(stream, "Not valid stream");

#if __ANDROID__
await Assert.ThrowsAsync<NotImplementedException>(() => await PdfDocument.LoadFromStreamAsync(stream, PdfDocument_Password_Valid));
await Assert.ThrowsAsync<NotImplementedException>(async () => await PdfDocument.LoadFromStreamAsync(stream, PdfDocument_Password_Valid));
#else
var pdfDocument = await PdfDocument.LoadFromStreamAsync(stream, PdfDocument_Password_Valid);
await CheckDocumentAsync(pdfDocument, ReferencePageImage_ProtectedUri, hasPassword: true);
Expand All @@ -141,9 +141,9 @@ public async Task When_LoadFromStreamAsync_With_Wrong_Password()
Assert.IsNotNull(stream, "Not valid stream");

#if __ANDROID__
await Assert.ThrowsAsync<NotImplementedException>(() => await PdfDocument.LoadFromStreamAsync(stream, PdfDocument_Password_Invalid));
await Assert.ThrowsAsync<NotImplementedException>(async () => await PdfDocument.LoadFromStreamAsync(stream, PdfDocument_Password_Invalid));
#elif !HAS_UNO
await Assert.ThrowsAsync<Exception>(() => await PdfDocument.LoadFromStreamAsync(stream, PdfDocument_Password_Invalid));
await Assert.ThrowsAsync<Exception>(async () => await PdfDocument.LoadFromStreamAsync(stream, PdfDocument_Password_Invalid));
#else
var pdfDocument = await PdfDocument.LoadFromStreamAsync(stream, PdfDocument_Password_Valid);
await CheckDocumentAsync(pdfDocument, ReferencePageImage_ProtectedUri, hasPassword: true);
Expand Down Expand Up @@ -181,7 +181,7 @@ public async Task When_LoadFromFileAsync_Valid_Password()
}

#if __ANDROID__
await Assert.ThrowsAsync<NotImplementedException>(() => await PdfDocument.LoadFromStreamAsync(stream, PdfDocument_Password_Valid));
await Assert.ThrowsAsync<NotImplementedException>(async () => await PdfDocument.LoadFromStreamAsync(stream, PdfDocument_Password_Valid));
#else
var pdfDocument = await PdfDocument.LoadFromFileAsync(file, PdfDocument_Password_Valid);
await CheckDocumentAsync(pdfDocument, ReferencePageImage_ProtectedUri, hasPassword: true);
Expand All @@ -202,9 +202,9 @@ public async Task When_LoadFromFileAsync_Wrong_Password()
}

#if __ANDROID__
await Assert.ThrowsAsync<NotImplementedException>(() => await PdfDocument.LoadFromFileAsync(file, PdfDocument_Password_Invalid));
await Assert.ThrowsAsync<NotImplementedException>(async () => await PdfDocument.LoadFromFileAsync(file, PdfDocument_Password_Invalid));
#elif !HAS_UNO
await Assert.ThrowsAsync<Exception>(() => await PdfDocument.LoadFromFileAsync(file, PdfDocument_Password_Invalid));
await Assert.ThrowsAsync<Exception>(async () => await PdfDocument.LoadFromFileAsync(file, PdfDocument_Password_Invalid));
#else
var pdfDocument = await PdfDocument.LoadFromFileAsync(file, PdfDocument_Password_Invalid);
await CheckDocumentAsync(pdfDocument, ReferencePageImage_ProtectedUri, hasPassword: true);
Expand Down

0 comments on commit ba8ef84

Please sign in to comment.