Skip to content

Commit

Permalink
test: added a method to control the test flow
Browse files Browse the repository at this point in the history
  • Loading branch information
pictos committed Aug 18, 2023
1 parent 7f94375 commit fdc85f4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ public class Given_ShadowContainer : TestBase
[TestCase(10, -10, false)]
public void When_Shadows(int xOffset, int yOffset, bool inner)
{
var xamlFlavorBuild = Environment.GetEnvironmentVariable("XAML_FLAVOR_BUILD");
//if (Environment.GetEnvironmentVariable("XAML_FLAVOR_BUILD") == "WinUI")
//{
Assert.Inconclusive($"###banana####: {xamlFlavorBuild}");
Console.WriteLine($"###banana####: {xamlFlavorBuild}");
//}

const string Red = "#FF0000";
const string Blue = "#0000FF";
const string Green = "#008000";
Expand Down Expand Up @@ -123,6 +116,14 @@ void AssertExpectations((Point TestPoint, string Color)[] expectations)
}
}

protected override void CheckCanRun()
{
if (Environment.GetEnvironmentVariable("XAML_FLAVOR_BUILD") == "WinUI")
{
Assert.Inconclusive("Disabled because Skia.Sharp doesn't support Xamarin+WinUI.");
}
}

private Rectangle GetRectangle(string marked)
{
var rect = App.Marked(marked).FirstResult()?.Rect;
Expand Down
11 changes: 11 additions & 0 deletions src/Uno.Toolkit.UITest/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,20 @@ public virtual void SetUpTest()
Helpers.App = _app;

_app.WaitForElementWithMessage("AppShell");
CheckCanRun();
NavigateToSample(SampleName);
}

/// <summary>
/// This method should be used for tests that we want to skip but can't do using the
/// Ignore attribute. An sample of impelmentation:
/// if (Environment.GetEnvironmentVariable("XAML_FLAVOR_BUILD") == "WinUI")
/// {
/// Assert.Inconclusive("Why this should be ignored.");
/// }
/// </summary>
protected virtual void CheckCanRun() { }

[TearDown]
public void TearDownTest()
{
Expand Down

0 comments on commit fdc85f4

Please sign in to comment.