Skip to content

Commit

Permalink
chore: Address few build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Jan 9, 2025
1 parent fc9c1fa commit 3c4198b
Show file tree
Hide file tree
Showing 18 changed files with 59 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ namespace Uno.UI.RuntimeTests.Tests.Microsoft_UI_Windowing;

[TestClass]
[RunsOnUIThread]
#if !__SKIA__ && !WINDOWS
[Ignore]
#endif
public class Given_AppWindow
{
#if __SKIA__ || WINDOWS
[TestMethod]
public async Task When_Resize()
{
Expand Down Expand Up @@ -173,6 +175,5 @@ private bool IsGtk()

return false;
}
#endif
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Uno.UI.RuntimeTests.Tests.Windows_Storage
{
#pragma warning disable MSTEST0016 // Test class should have at least one test method - https://github.com/microsoft/testfx/issues/4543
[TestClass]
public class Given_FileIO_Native : Given_FileIO_Native_Base
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Uno.UI.RuntimeTests.Tests.Windows_Storage
{
#pragma warning disable MSTEST0016 // Test class should have at least one test method - https://github.com/microsoft/testfx/issues/4543
[TestClass]
public class Given_FileIO_Native : Given_FileIO_Native_Base
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Uno.UI.RuntimeTests.Tests.Windows_Storage
{
#pragma warning disable MSTEST0016 // Test class should have at least one test method - https://github.com/microsoft/testfx/issues/4543
[TestClass]
public class Given_StorageFile_Native : Given_StorageFile_Native_Base
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Uno.UI.RuntimeTests.Tests.Windows_Storage
{
#pragma warning disable MSTEST0016 // Test class should have at least one test method - https://github.com/microsoft/testfx/issues/4543
[TestClass]
public class Given_StorageFile_Native : Given_StorageFile_Native_Base
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace Uno.UI.RuntimeTests.Tests.Windows_Storage
{
#pragma warning disable MSTEST0016 // Test class should have at least one test method - https://github.com/microsoft/testfx/issues/4543
[TestClass]
public class Given_StorageFolder_Native : Given_StorageFolder_Native_Base
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Uno.UI.RuntimeTests.Tests.Windows_Storage
{
#pragma warning disable MSTEST0016 // Test class should have at least one test method - https://github.com/microsoft/testfx/issues/4543
[TestClass]
public class Given_StorageFolder_Native : Given_StorageFolder_Native_Base
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Hosting;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Media.Imaging;

namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Composition;

[TestClass]
public class Given_CompositionVisualSurface
{
#if __SKIA__
#if !__SKIA__
[Ignore]
#endif
[TestMethod]
[RunsOnUIThread]
public async Task When_SourceVisual_Changes()
Expand All @@ -28,7 +31,7 @@ public async Task When_SourceVisual_Changes()
Width = 200,
Height = 200,
Stretch = Stretch.UniformToFill,
Source = ImageSource.TryCreateUriFromString("https://uno-assets.platform.uno/logos/uno.png")
Source = new BitmapImage(new Uri("https://uno-assets.platform.uno/logos/uno.png"))
};
var sut = new ContentControl
{
Expand Down Expand Up @@ -68,5 +71,4 @@ await UITestHelper.Load(new Grid

return (await UITestHelper.ScreenShot(expected), await UITestHelper.ScreenShot(sut));
}
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Composition;

#if __SKIA__
[TestClass]
public class Given_ContainerVisual
{
#if __SKIA__
[TestMethod]
[RunsOnUIThread]
public void When_Children_Change()
Expand Down Expand Up @@ -40,5 +40,5 @@ public void When_Children_Change()
Assert.IsFalse(containerVisual.IsChildrenRenderOrderDirty);
Assert.AreEqual(1, children.Count());
}
#endif
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Composition;
[TestClass]
public class Given_RedirectVisual
{
#if __SKIA__
[TestMethod]
[RunsOnUIThread]
[Ignore("Disabled because of https://github.com/unoplatform/uno-private/issues/307")]
Expand Down Expand Up @@ -65,5 +64,4 @@ await UITestHelper.Load(new Grid

return (await UITestHelper.ScreenShot(expected), await UITestHelper.ScreenShot(sut));
}
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Hosting;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Media.Imaging;
using Private.Infrastructure;
using Uno.UI.RuntimeTests.Helpers;

Expand All @@ -14,7 +15,9 @@ namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Composition;
[RunsOnUIThread]
public class Given_ShapeVisual
{
#if __SKIA__
#if !__SKIA__
[Ignore]
#endif
[RequiresFullWindow]
[TestMethod]
public async Task When_ShapeVisual_ViewBox_Shape_Combinations()
Expand Down Expand Up @@ -73,7 +76,7 @@ public async Task When_ShapeVisual_ViewBox_Shape_Combinations()
{
Width = 500,
Height = 500,
Source = new Uri($"ms-appx:/Assets/When_ShapeVisual_ViewBox_Shape_Combinations/{filename}")
Source = new BitmapImage(new Uri($"ms-appx:/Assets/When_ShapeVisual_ViewBox_Shape_Combinations/{filename}"))
};

var imageOpened = false;
Expand All @@ -96,5 +99,4 @@ public async Task When_ShapeVisual_ViewBox_Shape_Combinations()
}
}
}
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public class Given_ApplicationView

public static string StartupTitle { get; set; }

#if __SKIA__
#if !__SKIA__
[Ignore]
#endif
[TestMethod]
public void When_StartupTitle_Is_Defined()
{
Expand All @@ -30,14 +32,14 @@ public void When_StartupTitle_Is_Defined()

Assert.AreEqual(Windows.ApplicationModel.Package.Current.DisplayName, StartupTitle);
}
#endif

#if __ANDROID__
#if !__ANDROID__
[Ignore]
#endif
[TestMethod]
public void When_StartupVisibleBounds_Has_Value()
{
Assert.IsFalse(RectHelper.GetIsEmpty(StartupVisibleBounds), $"VisibleBounds should not be empty");
}
#endif
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml;
[RunsOnUIThread]
public class Given_BackgroundTransition
{
#if __SKIA__
#if !__SKIA__
[Ignore]
#endif
[TestMethod]
[DataRow(typeof(Grid))]
[DataRow(typeof(StackPanel))]
Expand Down Expand Up @@ -64,9 +66,12 @@ public async Task When_Has_Brush_Transition(Type type)

var bitmap = await UITestHelper.ScreenShot(control);

ImageAssert.HasColorAt(bitmap, new Point(100, 100), new Color(255, 127, 0, 127), tolerance: 30);
ImageAssert.HasColorAt(bitmap, new Point(100, 100), Color.FromArgb(255, 127, 0, 127), tolerance: 30);
}

#if !__SKIA__
[Ignore]
#endif
[TestMethod]
public async Task When_Animation_With_Brush_Transition()
{
Expand Down Expand Up @@ -128,7 +133,6 @@ public async Task When_Animation_With_Brush_Transition()
await Task.Delay(1000);

bitmap = await UITestHelper.ScreenShot(SUT);
ImageAssert.HasColorAt(bitmap, new Point(bitmap.Width / 2, bitmap.Height / 2), new Color(255, 127, 0, 127), tolerance: 20);
ImageAssert.HasColorAt(bitmap, new Point(bitmap.Width / 2, bitmap.Height / 2), Color.FromArgb(255, 127, 0, 127), tolerance: 20);
}
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml_Controls

public class Given_FrameworkElement_Opacity
{
#if __SKIA__
#if !__SKIA__
[Ignore]
#endif
[TestMethod]
public async Task When_Opacity()
{
Expand Down Expand Up @@ -61,6 +63,9 @@ public async Task When_Opacity()
ImageAssert.HasColorAtChild(si, SUT.ImageOpacity0_5, width / 2, height / 2, "#FFFEF3C2");
}

#if !__SKIA__
[Ignore]
#endif
[TestMethod]
public async Task When_Opacity_Inner()
{
Expand Down Expand Up @@ -94,6 +99,5 @@ public async Task When_Opacity_Inner()
height = SUT.ImageInner0_5.ActualHeight;
ImageAssert.HasColorAtChild(si, SUT.ImageInner0_5, width / 2, height / 2, "#FFFEF9E1", tolerance: 1);
}
#endif
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@

namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml_Controls;

#if !WINAPPSDK
[TestClass]
[RunsOnUIThread]
public class Given_CalendarDatePicker
{
#if !WINAPPSDK && !__MACOS__ // test is failling in macOS for some reason.
#if __MACOS__
[Ignore("test is failling in macOS for some reason.")]
#endif
[TestMethod]
public async Task TestCalendarPanelSize()
{
Expand All @@ -36,9 +39,10 @@ public async Task TestCalendarPanelSize()

flyout.Close();
}
#endif

#if !WINAPPSDK && !__MACOS__
#if __MACOS__
[Ignore]
#endif
[TestMethod]
public async Task When_Theme_Changes()
{
Expand Down Expand Up @@ -125,5 +129,5 @@ public async Task When_Theme_Changes()
}
}
}
#endif
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml_Media;

#if __SKIA__
[TestClass]
public class Given_AcrylicBrush
{
#if __SKIA__ && HAS_UNO
[TestMethod]
[RunsOnUIThread]
public async Task When_Drawn()
Expand Down Expand Up @@ -109,5 +109,5 @@ public async Task When_Drawn()

return (expectedImg, actualImg);
}
#endif
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml_Media
{
//Web Assembly does not have a helper that take screenshots yet
//MacOs interprets colors differently
#if !__WASM__ && !__MACOS__
[Ignore]
#endif
[TestClass]
[RunsOnUIThread]
public class Basics_AutomatedTransformation
{

//Web Assembly does not have a helper that take screenshots yet
//MacOs interprets colors differently
#if !__WASM__ && !__MACOS__

private const string White = "#FFFFFF";
private const float PixelIncertitude = 2;

Expand Down Expand Up @@ -219,7 +219,6 @@ private void Assert(FrameworkElement SUT, RawBitmap result, float x, float y, st

ImageAssert.HasColorAt(result, x, y, color, tolerance: 25);
}
#endif
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml_Media;
[TestClass]
public class Given_XamlCompositionBrushBase
{
#if __SKIA__
#if !__SKIA__
[Ignore]
#endif
[TestMethod]
[RunsOnUIThread]
public async Task When_CompositionBrush_Changes()
Expand Down Expand Up @@ -83,5 +85,4 @@ private class TestBrush : Microsoft.UI.Xaml.Media.XamlCompositionBrushBase

return (ss1, ss2);
}
#endif
}

0 comments on commit 3c4198b

Please sign in to comment.