|
|
|
@ -1,27 +1,34 @@ |
|
|
|
#nullable enable |
|
|
|
using System; |
|
|
|
using System.Linq; |
|
|
|
using System.Runtime.InteropServices; |
|
|
|
using Xunit; |
|
|
|
|
|
|
|
namespace Avalonia.IntegrationTests.Appium |
|
|
|
namespace Avalonia |
|
|
|
{ |
|
|
|
[Flags] |
|
|
|
internal enum TestPlatforms |
|
|
|
{ |
|
|
|
Windows = 0x01, |
|
|
|
MacOS = 0x02, |
|
|
|
All = Windows | MacOS, |
|
|
|
Linux = 0x04, |
|
|
|
All = Windows | MacOS | Linux, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
internal class PlatformFactAttribute : FactAttribute |
|
|
|
{ |
|
|
|
public PlatformFactAttribute(TestPlatforms platforms = TestPlatforms.All) => Platforms = platforms; |
|
|
|
|
|
|
|
private readonly string? _reason; |
|
|
|
|
|
|
|
public PlatformFactAttribute(TestPlatforms platforms, string? reason = null) |
|
|
|
{ |
|
|
|
_reason = reason; |
|
|
|
Platforms = platforms; |
|
|
|
} |
|
|
|
|
|
|
|
public TestPlatforms Platforms { get; } |
|
|
|
|
|
|
|
|
|
|
|
public override string? Skip |
|
|
|
{ |
|
|
|
get => IsSupported() ? null : $"Ignored on {RuntimeInformation.OSDescription}"; |
|
|
|
get => IsSupported() ? null : $"Ignored on {RuntimeInformation.OSDescription}" + (_reason is not null ? $" reason: \"{_reason}\"" : ""); |
|
|
|
set => throw new NotSupportedException(); |
|
|
|
} |
|
|
|
|
|
|
|
@ -31,6 +38,8 @@ namespace Avalonia.IntegrationTests.Appium |
|
|
|
return Platforms.HasAnyFlag(TestPlatforms.Windows); |
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) |
|
|
|
return Platforms.HasAnyFlag(TestPlatforms.MacOS); |
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) |
|
|
|
return Platforms.HasAnyFlag(TestPlatforms.Linux); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|