Update to xunit.v3 (#20331)
* Update to xunit.v3 * Little more progress * More fixes * Keep VSTest supported * Adjust Nuke * Few fixes * Fix for xunit 2 * Fix GetData override * Adjust * Use MTP for xunit 2 * Fix test * Better fix * --no-progress * Few more fixes * no progress * Fix test * Better fix * TRX * Move to Directory.Build.props * Unify on MTP v2 * Update * Update to stable * 1.0.1 * 1.0.2 * Fix some warnings * Fix more warnings * Fix more warnings
This commit is contained in:
@@ -43,7 +43,7 @@ jobs:
|
|||||||
inputs:
|
inputs:
|
||||||
command: 'test'
|
command: 'test'
|
||||||
projects: 'tests/Avalonia.IntegrationTests.Appium/Avalonia.IntegrationTests.Appium.csproj'
|
projects: 'tests/Avalonia.IntegrationTests.Appium/Avalonia.IntegrationTests.Appium.csproj'
|
||||||
arguments: '-l "console;verbosity=detailed"'
|
arguments: '--no-progress'
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
pkill IntegrationTestApp
|
pkill IntegrationTestApp
|
||||||
@@ -94,6 +94,7 @@ jobs:
|
|||||||
inputs:
|
inputs:
|
||||||
command: 'run'
|
command: 'run'
|
||||||
projects: 'tests/Avalonia.IntegrationTests.Win32/Avalonia.IntegrationTests.Win32.csproj'
|
projects: 'tests/Avalonia.IntegrationTests.Win32/Avalonia.IntegrationTests.Win32.csproj'
|
||||||
|
arguments: '--no-progress'
|
||||||
|
|
||||||
- task: VSTest@2
|
- task: VSTest@2
|
||||||
displayName: 'Run Appium Integration Tests'
|
displayName: 'Run Appium Integration Tests'
|
||||||
|
|||||||
+5
-9
@@ -1,14 +1,10 @@
|
|||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
<ItemGroup Condition="'$(IsXUnit2)'!='true'">
|
||||||
|
<PackageReference Include="xunit.v3.mtp-v2" Version="3.2.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup Condition="'$(IsXUnit2)'=='true'">
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.assert" Version="2.9.3" />
|
<PackageReference Include="YTest.MTP.XUnit2" Version="1.0.2" />
|
||||||
<PackageReference Include="xunit.core" Version="2.9.3" />
|
|
||||||
<PackageReference Include="xunit.extensibility.core" Version="2.9.3" />
|
|
||||||
<PackageReference Include="xunit.extensibility.execution" Version="2.9.3" />
|
|
||||||
<PackageReference Include="xunit.runner.console" Version="2.9.3" />
|
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" Condition="'$(TargetFramework)' != 'netstandard2.0'" />
|
|
||||||
<PackageReference Include="Xunit.SkippableFact" Version="1.5.23" />
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)\avalonia.snk</AssemblyOriginatorKeyFile>
|
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)\avalonia.snk</AssemblyOriginatorKeyFile>
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
"version": "10.0.101",
|
"version": "10.0.101",
|
||||||
"rollForward": "latestFeature"
|
"rollForward": "latestFeature"
|
||||||
},
|
},
|
||||||
|
"test": {
|
||||||
|
"runner": "Microsoft.Testing.Platform"
|
||||||
|
},
|
||||||
"msbuild-sdks": {
|
"msbuild-sdks": {
|
||||||
"Microsoft.Build.Traversal": "4.1.0"
|
"Microsoft.Build.Traversal": "4.1.0"
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-4
@@ -111,6 +111,9 @@ partial class Build : NukeBuild
|
|||||||
DotNetTestSettings ApplySetting(DotNetTestSettings c, Configure<DotNetTestSettings> configurator = null) =>
|
DotNetTestSettings ApplySetting(DotNetTestSettings c, Configure<DotNetTestSettings> configurator = null) =>
|
||||||
ApplySettingCore(c).Test.Apply(configurator);
|
ApplySettingCore(c).Test.Apply(configurator);
|
||||||
|
|
||||||
|
DotNetRunSettings ApplySetting(DotNetRunSettings c, Configure<DotNetRunSettings> configurator = null) =>
|
||||||
|
ApplySettingCore(c).Run.Apply(configurator);
|
||||||
|
|
||||||
Target Clean => _ => _.Executes(() =>
|
Target Clean => _ => _.Executes(() =>
|
||||||
{
|
{
|
||||||
foreach (var buildDir in Parameters.BuildDirs)
|
foreach (var buildDir in Parameters.BuildDirs)
|
||||||
@@ -182,7 +185,10 @@ partial class Build : NukeBuild
|
|||||||
{
|
{
|
||||||
RunCoreTest(projectName, (project, tfm) =>
|
RunCoreTest(projectName, (project, tfm) =>
|
||||||
{
|
{
|
||||||
DotNetTest(c => ApplySetting(c, project,tfm));
|
// NOTE: Nuke DotNetTest doesn't support Microsoft.Testing.Platform yet.
|
||||||
|
// Issue: https://github.com/nuke-build/nuke/issues/1584.
|
||||||
|
// However, we can easily use DotNetRun instead since MTP projects are executables.
|
||||||
|
DotNetRun(c => ApplySetting(c, project, tfm));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,15 +242,17 @@ partial class Build : NukeBuild
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DotNetTestSettings ApplySetting(DotNetTestSettings settings, string project, string tfm) =>
|
DotNetRunSettings ApplySetting(DotNetRunSettings settings, string project, string tfm) =>
|
||||||
ApplySetting(settings)
|
ApplySetting(settings)
|
||||||
.SetProjectFile(project)
|
.SetProjectFile(project)
|
||||||
.SetFramework(tfm)
|
.SetFramework(tfm)
|
||||||
.EnableNoBuild()
|
.EnableNoBuild()
|
||||||
.EnableNoRestore()
|
.EnableNoRestore()
|
||||||
|
// Disable progress output (works like terminal logger which isn't so nice in CI).
|
||||||
|
// See https://github.com/microsoft/testfx/issues/7056
|
||||||
|
.AddApplicationArguments("--no-progress")
|
||||||
.When(_ => Parameters.PublishTestResults, _ => _
|
.When(_ => Parameters.PublishTestResults, _ => _
|
||||||
.SetLoggers("trx")
|
.AddApplicationArguments("--report-trx", "--results-directory", Parameters.TestResultsRoot));
|
||||||
.SetResultsDirectory(Parameters.TestResultsRoot));
|
|
||||||
|
|
||||||
Target RunHtmlPreviewerTests => _ => _
|
Target RunHtmlPreviewerTests => _ => _
|
||||||
.OnlyWhenStatic(() => !(Parameters.SkipTests))
|
.OnlyWhenStatic(() => !(Parameters.SkipTests))
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ public class DotNetConfigHelper
|
|||||||
public DotNetBuildSettings Build;
|
public DotNetBuildSettings Build;
|
||||||
public DotNetPackSettings Pack;
|
public DotNetPackSettings Pack;
|
||||||
public DotNetTestSettings Test;
|
public DotNetTestSettings Test;
|
||||||
|
public DotNetRunSettings Run;
|
||||||
|
|
||||||
public DotNetConfigHelper(DotNetBuildSettings s)
|
public DotNetConfigHelper(DotNetBuildSettings s)
|
||||||
{
|
{
|
||||||
@@ -23,6 +24,11 @@ public class DotNetConfigHelper
|
|||||||
Test = s;
|
Test = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DotNetConfigHelper(DotNetRunSettings s)
|
||||||
|
{
|
||||||
|
Run = s;
|
||||||
|
}
|
||||||
|
|
||||||
public DotNetConfigHelper AddProperty(string key, bool value) =>
|
public DotNetConfigHelper AddProperty(string key, bool value) =>
|
||||||
AddProperty(key, value.ToString(CultureInfo.InvariantCulture).ToLowerInvariant());
|
AddProperty(key, value.ToString(CultureInfo.InvariantCulture).ToLowerInvariant());
|
||||||
public DotNetConfigHelper AddProperty(string key, string value)
|
public DotNetConfigHelper AddProperty(string key, string value)
|
||||||
@@ -30,6 +36,7 @@ public class DotNetConfigHelper
|
|||||||
Build = Build?.AddProperty(key, value);
|
Build = Build?.AddProperty(key, value);
|
||||||
Pack = Pack?.AddProperty(key, value);
|
Pack = Pack?.AddProperty(key, value);
|
||||||
Test = Test?.AddProperty(key, value);
|
Test = Test?.AddProperty(key, value);
|
||||||
|
Run = Run?.AddProperty(key, value);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -39,6 +46,7 @@ public class DotNetConfigHelper
|
|||||||
Build = Build?.SetConfiguration(configuration);
|
Build = Build?.SetConfiguration(configuration);
|
||||||
Pack = Pack?.SetConfiguration(configuration);
|
Pack = Pack?.SetConfiguration(configuration);
|
||||||
Test = Test?.SetConfiguration(configuration);
|
Test = Test?.SetConfiguration(configuration);
|
||||||
|
Run = Run?.SetConfiguration(configuration);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,10 +55,12 @@ public class DotNetConfigHelper
|
|||||||
Build = Build?.SetVerbosity(verbosity);
|
Build = Build?.SetVerbosity(verbosity);
|
||||||
Pack = Pack?.SetVerbosity(verbosity);
|
Pack = Pack?.SetVerbosity(verbosity);
|
||||||
Test = Test?.SetVerbosity(verbosity);
|
Test = Test?.SetVerbosity(verbosity);
|
||||||
|
Run = Run?.SetVerbosity(verbosity);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator DotNetConfigHelper(DotNetBuildSettings s) => new DotNetConfigHelper(s);
|
public static implicit operator DotNetConfigHelper(DotNetBuildSettings s) => new DotNetConfigHelper(s);
|
||||||
public static implicit operator DotNetConfigHelper(DotNetPackSettings s) => new DotNetConfigHelper(s);
|
public static implicit operator DotNetConfigHelper(DotNetPackSettings s) => new DotNetConfigHelper(s);
|
||||||
public static implicit operator DotNetConfigHelper(DotNetTestSettings s) => new DotNetConfigHelper(s);
|
public static implicit operator DotNetConfigHelper(DotNetTestSettings s) => new DotNetConfigHelper(s);
|
||||||
|
public static implicit operator DotNetConfigHelper(DotNetRunSettings s) => new DotNetConfigHelper(s);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ namespace Avalonia.Base.UnitTests.Animation
|
|||||||
var rect = new Rectangle() { Width = 11, };
|
var rect = new Rectangle() { Width = 11, };
|
||||||
|
|
||||||
var clock = new TestClock();
|
var clock = new TestClock();
|
||||||
animation.RunAsync(rect, clock);
|
animation.RunAsync(rect, clock, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
clock.Step(TimeSpan.Zero);
|
clock.Step(TimeSpan.Zero);
|
||||||
Assert.Equal(1, rect.Width);
|
Assert.Equal(1, rect.Width);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Avalonia.Base.UnitTests.Animation
|
|||||||
|
|
||||||
var clock = new TestClock();
|
var clock = new TestClock();
|
||||||
|
|
||||||
animation.RunAsync(border, clock);
|
animation.RunAsync(border, clock, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
clock.Step(TimeSpan.Zero);
|
clock.Step(TimeSpan.Zero);
|
||||||
Assert.Equal(border.Width, 0d);
|
Assert.Equal(border.Width, 0d);
|
||||||
@@ -69,7 +69,7 @@ namespace Avalonia.Base.UnitTests.Animation
|
|||||||
var border = new Border() { Height = 100d, Width = 100d };
|
var border = new Border() { Height = 100d, Width = 100d };
|
||||||
|
|
||||||
var clock = new TestClock();
|
var clock = new TestClock();
|
||||||
var animationRun = animation.RunAsync(border, clock);
|
var animationRun = animation.RunAsync(border, clock, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
border.Measure(Size.Infinity);
|
border.Measure(Size.Infinity);
|
||||||
border.Arrange(new Rect(border.DesiredSize));
|
border.Arrange(new Rect(border.DesiredSize));
|
||||||
@@ -118,7 +118,7 @@ namespace Avalonia.Base.UnitTests.Animation
|
|||||||
|
|
||||||
var clock = new TestClock();
|
var clock = new TestClock();
|
||||||
|
|
||||||
animation.RunAsync(border, clock);
|
animation.RunAsync(border, clock, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
clock.Step(TimeSpan.FromSeconds(0d));
|
clock.Step(TimeSpan.FromSeconds(0d));
|
||||||
Assert.Equal(border.Width, 0d);
|
Assert.Equal(border.Width, 0d);
|
||||||
@@ -167,7 +167,7 @@ namespace Avalonia.Base.UnitTests.Animation
|
|||||||
|
|
||||||
var clock = new TestClock();
|
var clock = new TestClock();
|
||||||
|
|
||||||
animation.RunAsync(border, clock);
|
animation.RunAsync(border, clock, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
clock.Step(TimeSpan.Zero);
|
clock.Step(TimeSpan.Zero);
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ namespace Avalonia.Base.UnitTests.Animation
|
|||||||
|
|
||||||
var clock = new TestClock();
|
var clock = new TestClock();
|
||||||
|
|
||||||
animation.RunAsync(border, clock);
|
animation.RunAsync(border, clock, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
clock.Step(TimeSpan.FromSeconds(0));
|
clock.Step(TimeSpan.FromSeconds(0));
|
||||||
clock.Step(TimeSpan.FromSeconds(20));
|
clock.Step(TimeSpan.FromSeconds(20));
|
||||||
@@ -495,7 +495,7 @@ namespace Avalonia.Base.UnitTests.Animation
|
|||||||
};
|
};
|
||||||
|
|
||||||
var clock = new TestClock();
|
var clock = new TestClock();
|
||||||
var animationRun = animation.RunAsync(border, clock);
|
var animationRun = animation.RunAsync(border, clock, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
clock.Step(TimeSpan.Zero);
|
clock.Step(TimeSpan.Zero);
|
||||||
Assert.Equal(1, animator.CallCount);
|
Assert.Equal(1, animator.CallCount);
|
||||||
@@ -556,7 +556,7 @@ namespace Avalonia.Base.UnitTests.Animation
|
|||||||
};
|
};
|
||||||
|
|
||||||
var clock = new TestClock();
|
var clock = new TestClock();
|
||||||
animation.RunAsync(border, clock);
|
animation.RunAsync(border, clock, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
clock.Step(TimeSpan.Zero);
|
clock.Step(TimeSpan.Zero);
|
||||||
Assert.Equal(100.0, border.Width);
|
Assert.Equal(100.0, border.Width);
|
||||||
@@ -597,7 +597,7 @@ namespace Avalonia.Base.UnitTests.Animation
|
|||||||
};
|
};
|
||||||
|
|
||||||
var clock = new TestClock();
|
var clock = new TestClock();
|
||||||
animation.RunAsync(border, clock);
|
animation.RunAsync(border, clock, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
clock.Step(TimeSpan.Zero);
|
clock.Step(TimeSpan.Zero);
|
||||||
clock.Step(TimeSpan.FromSeconds(cue));
|
clock.Step(TimeSpan.FromSeconds(cue));
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ namespace Avalonia.Base.UnitTests.Animation
|
|||||||
|
|
||||||
var clock = new TestClock();
|
var clock = new TestClock();
|
||||||
|
|
||||||
animation.RunAsync(rect, clock);
|
animation.RunAsync(rect, clock, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
// position is what you'd expect at end and beginning
|
// position is what you'd expect at end and beginning
|
||||||
clock.Step(TimeSpan.Zero);
|
clock.Step(TimeSpan.Zero);
|
||||||
@@ -185,7 +185,7 @@ namespace Avalonia.Base.UnitTests.Animation
|
|||||||
|
|
||||||
var clock = new TestClock();
|
var clock = new TestClock();
|
||||||
|
|
||||||
animation.RunAsync(rect, clock);
|
animation.RunAsync(rect, clock, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
// position is what you'd expect at end and beginning
|
// position is what you'd expect at end and beginning
|
||||||
clock.Step(TimeSpan.Zero);
|
clock.Step(TimeSpan.Zero);
|
||||||
@@ -250,7 +250,7 @@ namespace Avalonia.Base.UnitTests.Animation
|
|||||||
|
|
||||||
var clock = new TestClock();
|
var clock = new TestClock();
|
||||||
|
|
||||||
animation.RunAsync(rect, clock);
|
animation.RunAsync(rect, clock, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
clock.Step(TimeSpan.Zero);
|
clock.Step(TimeSpan.Zero);
|
||||||
Assert.Equal(10.0, transform.Y, 0.0001);
|
Assert.Equal(10.0, transform.Y, 0.0001);
|
||||||
@@ -299,7 +299,7 @@ namespace Avalonia.Base.UnitTests.Animation
|
|||||||
|
|
||||||
var clock = new TestClock();
|
var clock = new TestClock();
|
||||||
|
|
||||||
animation.RunAsync(rect, clock);
|
animation.RunAsync(rect, clock, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
clock.Step(TimeSpan.Zero);
|
clock.Step(TimeSpan.Zero);
|
||||||
Assert.Equal(50.0, transform.Y, 0.0001);
|
Assert.Equal(50.0, transform.Y, 0.0001);
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class SpringTests
|
|||||||
var rect = new Rectangle() { RenderTransform = rotateTransform };
|
var rect = new Rectangle() { RenderTransform = rotateTransform };
|
||||||
|
|
||||||
var clock = new TestClock();
|
var clock = new TestClock();
|
||||||
animation.RunAsync(rect, clock);
|
animation.RunAsync(rect, clock, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
clock.Step(TimeSpan.Zero);
|
clock.Step(TimeSpan.Zero);
|
||||||
Assert.Equal(-2.5, rotateTransform.Angle);
|
Assert.Equal(-2.5, rotateTransform.Angle);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<IsTestProject>true</IsTestProject>
|
<IsTestProject>true</IsTestProject>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -985,7 +985,7 @@ namespace Avalonia.Base.UnitTests
|
|||||||
{
|
{
|
||||||
target.Bind(Class1.QuxProperty, source);
|
target.Bind(Class1.QuxProperty, source);
|
||||||
|
|
||||||
await Task.Run(() => source.OnNext(6.7));
|
await Task.Run(() => source.OnNext(6.7), TestContext.Current.CancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reactive.Linq;
|
using System.Reactive.Linq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
|
||||||
|
|
||||||
namespace Avalonia.Base.UnitTests
|
namespace Avalonia.Base.UnitTests
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Avalonia.Animation.Easings;
|
using Avalonia.Animation.Easings;
|
||||||
using Avalonia.Base.UnitTests.Rendering;
|
using Avalonia.Base.UnitTests.Rendering;
|
||||||
using Avalonia.Rendering;
|
using Avalonia.Rendering;
|
||||||
@@ -12,6 +13,7 @@ using Avalonia.Threading;
|
|||||||
using Avalonia.UnitTests;
|
using Avalonia.UnitTests;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Sdk;
|
using Xunit.Sdk;
|
||||||
|
using Xunit.v3;
|
||||||
|
|
||||||
namespace Avalonia.Base.UnitTests.Composition;
|
namespace Avalonia.Base.UnitTests.Composition;
|
||||||
|
|
||||||
@@ -54,13 +56,19 @@ public class CompositionAnimationTests : ScopedTestBase
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public override IEnumerable<object[]> GetData(MethodInfo testMethod)
|
public override ValueTask<IReadOnlyCollection<ITheoryDataRow>> GetData(MethodInfo testMethod, DisposalTracker disposalTracker)
|
||||||
{
|
{
|
||||||
|
var list = new List<ITheoryDataRow>();
|
||||||
foreach (var ani in Generate())
|
foreach (var ani in Generate())
|
||||||
{
|
{
|
||||||
yield return new Object[] { ani };
|
list.Add(new TheoryDataRow<AnimationData>(ani));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ValueTask.FromResult<IReadOnlyCollection<ITheoryDataRow>>(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool SupportsDiscoveryEnumeration()
|
||||||
|
=> true;
|
||||||
}
|
}
|
||||||
|
|
||||||
class DummyDispatcher : IDispatcher
|
class DummyDispatcher : IDispatcher
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ public partial class BindingExpressionTests
|
|||||||
data.Foo["foo"] = "bar2";
|
data.Foo["foo"] = "bar2";
|
||||||
|
|
||||||
// Forces WeakEvent compact
|
// Forces WeakEvent compact
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal("bar2", target.String);
|
Assert.Equal("bar2", target.String);
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace Avalonia.Base.UnitTests.Data.Core.Plugins
|
|||||||
Assert.Equal(1, data.ErrorsChangedSubscriptionCount);
|
Assert.Equal(1, data.ErrorsChangedSubscriptionCount);
|
||||||
validator.Unsubscribe();
|
validator.Unsubscribe();
|
||||||
// Forces WeakEvent compact
|
// Forces WeakEvent compact
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
Assert.Equal(0, data.ErrorsChangedSubscriptionCount);
|
Assert.Equal(0, data.ErrorsChangedSubscriptionCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public partial class DispatcherTests
|
|||||||
disp.Post(() => ThrowAnException());
|
disp.Post(() => ThrowAnException());
|
||||||
disp.Post(() => executed = true);
|
disp.Post(() => executed = true);
|
||||||
|
|
||||||
disp.RunJobs();
|
disp.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.True(handled);
|
Assert.True(handled);
|
||||||
Assert.True(executed);
|
Assert.True(executed);
|
||||||
@@ -62,7 +62,7 @@ public partial class DispatcherTests
|
|||||||
syncContext.Post(_ => ThrowAnException(), null);
|
syncContext.Post(_ => ThrowAnException(), null);
|
||||||
syncContext.Post(_ => executed = true, null);
|
syncContext.Post(_ => executed = true, null);
|
||||||
|
|
||||||
disp.RunJobs();
|
disp.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.True(handled);
|
Assert.True(handled);
|
||||||
Assert.True(executed);
|
Assert.True(executed);
|
||||||
@@ -88,7 +88,7 @@ public partial class DispatcherTests
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
dispatcher.Post(ThrowAnException, DispatcherPriority.Normal);
|
dispatcher.Post(ThrowAnException, DispatcherPriority.Normal);
|
||||||
dispatcher.RunJobs();
|
dispatcher.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -115,7 +115,7 @@ public partial class DispatcherTests
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
dispatcher.Post(ThrowAnException, DispatcherPriority.Normal);
|
dispatcher.Post(ThrowAnException, DispatcherPriority.Normal);
|
||||||
dispatcher.RunJobs();
|
dispatcher.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@@ -143,8 +143,8 @@ public partial class DispatcherTests
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Since both Invoke and InvokeAsync can throw exception, there is no need to pass them to the UnhandledException.
|
// Since both Invoke and InvokeAsync can throw exception, there is no need to pass them to the UnhandledException.
|
||||||
dispatcher.Invoke(ThrowAnException, DispatcherPriority.Normal);
|
dispatcher.Invoke(ThrowAnException, DispatcherPriority.Normal, TestContext.Current.CancellationToken);
|
||||||
dispatcher.RunJobs();
|
dispatcher.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -172,9 +172,9 @@ public partial class DispatcherTests
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Since both Invoke and InvokeAsync can throw exception, there is no need to pass them to the UnhandledException.
|
// Since both Invoke and InvokeAsync can throw exception, there is no need to pass them to the UnhandledException.
|
||||||
var op = dispatcher.InvokeAsync(ThrowAnException, DispatcherPriority.Normal);
|
var op = dispatcher.InvokeAsync(ThrowAnException, DispatcherPriority.Normal, TestContext.Current.CancellationToken);
|
||||||
op.Wait();
|
op.Wait();
|
||||||
dispatcher.RunJobs();
|
dispatcher.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -202,7 +202,7 @@ public partial class DispatcherTests
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
dispatcher.Post(ThrowAnException, DispatcherPriority.Normal);
|
dispatcher.Post(ThrowAnException, DispatcherPriority.Normal);
|
||||||
dispatcher.RunJobs();
|
dispatcher.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -233,7 +233,7 @@ public partial class DispatcherTests
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
dispatcher.Post(ThrowAnException, DispatcherPriority.Normal);
|
dispatcher.Post(ThrowAnException, DispatcherPriority.Normal);
|
||||||
dispatcher.RunJobs();
|
dispatcher.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -263,7 +263,7 @@ public partial class DispatcherTests
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
dispatcher.Post(ThrowAnException, DispatcherPriority.Normal);
|
dispatcher.Post(ThrowAnException, DispatcherPriority.Normal);
|
||||||
dispatcher.RunJobs();
|
dispatcher.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@@ -291,7 +291,7 @@ public partial class DispatcherTests
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
dispatcher.Post(ThrowAnException, DispatcherPriority.Normal);
|
dispatcher.Post(ThrowAnException, DispatcherPriority.Normal);
|
||||||
dispatcher.RunJobs();
|
dispatcher.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -137,8 +137,8 @@ public partial class DispatcherTests
|
|||||||
var impl = new SimpleDispatcherImpl();
|
var impl = new SimpleDispatcherImpl();
|
||||||
var disp = new Dispatcher(impl);
|
var disp = new Dispatcher(impl);
|
||||||
var actions = new List<string>();
|
var actions = new List<string>();
|
||||||
var toPromote = disp.InvokeAsync(()=>actions.Add("PromotedRender"), DispatcherPriority.Background);
|
var toPromote = disp.InvokeAsync(()=>actions.Add("PromotedRender"), DispatcherPriority.Background, TestContext.Current.CancellationToken);
|
||||||
var toPromote2 = disp.InvokeAsync(()=>actions.Add("PromotedRender2"), DispatcherPriority.Input);
|
var toPromote2 = disp.InvokeAsync(()=>actions.Add("PromotedRender2"), DispatcherPriority.Input, TestContext.Current.CancellationToken);
|
||||||
disp.Post(() => actions.Add("Render"), DispatcherPriority.Render);
|
disp.Post(() => actions.Add("Render"), DispatcherPriority.Render);
|
||||||
|
|
||||||
toPromote.Priority = DispatcherPriority.Render;
|
toPromote.Priority = DispatcherPriority.Render;
|
||||||
@@ -444,7 +444,7 @@ public partial class DispatcherTests
|
|||||||
}, DispatcherPriority.Background);
|
}, DispatcherPriority.Background);
|
||||||
disp.MainLoop(CancellationToken.None);
|
disp.MainLoop(CancellationToken.None);
|
||||||
|
|
||||||
disp.Invoke(DumpCurrentPriority, DispatcherPriority.Send);
|
disp.Invoke(DumpCurrentPriority, DispatcherPriority.Send, TestContext.Current.CancellationToken);
|
||||||
disp.Invoke(() =>
|
disp.Invoke(() =>
|
||||||
{
|
{
|
||||||
DumpCurrentPriority();
|
DumpCurrentPriority();
|
||||||
@@ -500,7 +500,7 @@ public partial class DispatcherTests
|
|||||||
{
|
{
|
||||||
var t = Test();
|
var t = Test();
|
||||||
var cts = new CancellationTokenSource();
|
var cts = new CancellationTokenSource();
|
||||||
Task.Delay(3000).ContinueWith(_ => cts.Cancel());
|
Task.Delay(3000, TestContext.Current.CancellationToken).ContinueWith(_ => cts.Cancel(), TestContext.Current.CancellationToken);
|
||||||
Dispatcher.UIThread.MainLoop(cts.Token);
|
Dispatcher.UIThread.MainLoop(cts.Token);
|
||||||
Assert.True(t.IsCompletedSuccessfully);
|
Assert.True(t.IsCompletedSuccessfully);
|
||||||
t.GetAwaiter().GetResult();
|
t.GetAwaiter().GetResult();
|
||||||
@@ -657,7 +657,7 @@ public partial class DispatcherTests
|
|||||||
tokenSource.Cancel();
|
tokenSource.Cancel();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
}, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Dispatcher.UIThread.MainLoop(tokenSource.Token);
|
Dispatcher.UIThread.MainLoop(tokenSource.Token);
|
||||||
await Task.WhenAll(task);
|
await Task.WhenAll(task);
|
||||||
@@ -699,7 +699,7 @@ public partial class DispatcherTests
|
|||||||
{
|
{
|
||||||
tokenSource.Cancel();
|
tokenSource.Cancel();
|
||||||
});
|
});
|
||||||
});
|
}, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Dispatcher.UIThread.MainLoop(tokenSource.Token);
|
Dispatcher.UIThread.MainLoop(tokenSource.Token);
|
||||||
await Task.WhenAll(task);
|
await Task.WhenAll(task);
|
||||||
@@ -753,7 +753,7 @@ public partial class DispatcherTests
|
|||||||
await Task.WhenAll(task1);
|
await Task.WhenAll(task1);
|
||||||
tokenSource.Cancel();
|
tokenSource.Cancel();
|
||||||
});
|
});
|
||||||
});
|
}, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1311,7 +1311,7 @@ namespace Avalonia.Base.UnitTests.Input
|
|||||||
|
|
||||||
top.ApplyTemplate();
|
top.ApplyTemplate();
|
||||||
|
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
var result = KeyboardNavigationHandler.GetNext(current, NavigationDirection.Next) as Button;
|
var result = KeyboardNavigationHandler.GetNext(current, NavigationDirection.Next) as Button;
|
||||||
|
|
||||||
|
|||||||
@@ -474,7 +474,7 @@ namespace Avalonia.Base.UnitTests.Layout
|
|||||||
root.LayoutManager.InvalidateArrange(control);
|
root.LayoutManager.InvalidateArrange(control);
|
||||||
root.LayoutManager.ExecuteInitialLayoutPass();
|
root.LayoutManager.ExecuteInitialLayoutPass();
|
||||||
|
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.Render);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.Render, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal(1, layoutCount);
|
Assert.Equal(1, layoutCount);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using Avalonia.Media.TextFormatting.Unicode;
|
using Avalonia.Media.TextFormatting.Unicode;
|
||||||
using Avalonia.Utilities;
|
using Avalonia.Utilities;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
|
||||||
|
|
||||||
namespace Avalonia.Visuals.UnitTests.Media.TextFormatting
|
namespace Avalonia.Visuals.UnitTests.Media.TextFormatting
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using System.Runtime.InteropServices;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Avalonia.Media.TextFormatting.Unicode;
|
using Avalonia.Media.TextFormatting.Unicode;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
|
||||||
|
|
||||||
namespace Avalonia.Visuals.UnitTests.Media.TextFormatting
|
namespace Avalonia.Visuals.UnitTests.Media.TextFormatting
|
||||||
{
|
{
|
||||||
|
|||||||
-1
@@ -2,7 +2,6 @@
|
|||||||
using Avalonia.Media.TextFormatting.Unicode;
|
using Avalonia.Media.TextFormatting.Unicode;
|
||||||
using Avalonia.Visuals.UnitTests.Media.TextFormatting;
|
using Avalonia.Visuals.UnitTests.Media.TextFormatting;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
|
||||||
|
|
||||||
namespace Avalonia.Base.UnitTests.Media.TextFormatting
|
namespace Avalonia.Base.UnitTests.Media.TextFormatting
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ using System.Linq;
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using Avalonia.Media.TextFormatting.Unicode;
|
using Avalonia.Media.TextFormatting.Unicode;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
|
||||||
using static Avalonia.Media.TextFormatting.Unicode.LineBreakEnumerator;
|
using static Avalonia.Media.TextFormatting.Unicode.LineBreakEnumerator;
|
||||||
|
|
||||||
namespace Avalonia.Base.UnitTests.Media.TextFormatting
|
namespace Avalonia.Base.UnitTests.Media.TextFormatting
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
<XunitAutoGeneratedEntryPoint>false</XunitAutoGeneratedEntryPoint>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="..\..\build\SharedVersion.props" />
|
<Import Project="..\..\build\SharedVersion.props" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>$(AvsCurrentTargetFramework);net481</TargetFrameworks>
|
<TargetFrameworks>$(AvsCurrentTargetFramework);net481</TargetFrameworks>
|
||||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
|
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<IsTestProject>true</IsTestProject>
|
<IsTestProject>true</IsTestProject>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
};
|
};
|
||||||
var root = new TestRoot { Child = target };
|
var root = new TestRoot { Child = target };
|
||||||
|
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.True(target.IsEnabled);
|
Assert.True(target.IsEnabled);
|
||||||
Assert.False(target.IsEffectivelyEnabled);
|
Assert.False(target.IsEffectivelyEnabled);
|
||||||
@@ -341,7 +341,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
target.Presenter!.UpdateChild();
|
target.Presenter!.UpdateChild();
|
||||||
kd.SetFocusedElement(target, NavigationMethod.Unspecified, KeyModifiers.None);
|
kd.SetFocusedElement(target, NavigationMethod.Unspecified, KeyModifiers.None);
|
||||||
|
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
var accessKey = Key.A;
|
var accessKey = Key.A;
|
||||||
target.CommandParameter = true;
|
target.CommandParameter = true;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
};
|
};
|
||||||
DateTime value = new DateTime(2000, 10, 10);
|
DateTime value = new DateTime(2000, 10, 10);
|
||||||
datePicker.SelectedDate = value;
|
datePicker.SelectedDate = value;
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
Assert.True(handled);
|
Assert.True(handled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
};
|
};
|
||||||
DateTimeOffset value = new DateTimeOffset(2000, 10, 10, 0, 0, 0, TimeSpan.Zero);
|
DateTimeOffset value = new DateTimeOffset(2000, 10, 10, 0, 0, 0, TimeSpan.Zero);
|
||||||
datePicker.SelectedDate = value;
|
datePicker.SelectedDate = value;
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
Assert.True(handled);
|
Assert.True(handled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
DayVisible = false
|
DayVisible = false
|
||||||
};
|
};
|
||||||
datePicker.ApplyTemplate();
|
datePicker.ApplyTemplate();
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
var desc = datePicker.GetVisualDescendants();
|
var desc = datePicker.GetVisualDescendants();
|
||||||
Assert.True(desc.Count() > 1);//Should be layoutroot grid & button
|
Assert.True(desc.Count() > 1);//Should be layoutroot grid & button
|
||||||
@@ -81,7 +81,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
MonthVisible = false
|
MonthVisible = false
|
||||||
};
|
};
|
||||||
datePicker.ApplyTemplate();
|
datePicker.ApplyTemplate();
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
var desc = datePicker.GetVisualDescendants();
|
var desc = datePicker.GetVisualDescendants();
|
||||||
Assert.True(desc.Count() > 1);//Should be layoutroot grid & button
|
Assert.True(desc.Count() > 1);//Should be layoutroot grid & button
|
||||||
@@ -116,7 +116,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
YearVisible = false
|
YearVisible = false
|
||||||
};
|
};
|
||||||
datePicker.ApplyTemplate();
|
datePicker.ApplyTemplate();
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
var desc = datePicker.GetVisualDescendants();
|
var desc = datePicker.GetVisualDescendants();
|
||||||
Assert.True(desc.Count() > 1);//Should be layoutroot grid & button
|
Assert.True(desc.Count() > 1);//Should be layoutroot grid & button
|
||||||
@@ -151,7 +151,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
YearVisible = false
|
YearVisible = false
|
||||||
};
|
};
|
||||||
datePicker.ApplyTemplate();
|
datePicker.ApplyTemplate();
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
var desc = datePicker.GetVisualDescendants();
|
var desc = datePicker.GetVisualDescendants();
|
||||||
Assert.True(desc.Count() > 1);//Should be layoutroot grid & button
|
Assert.True(desc.Count() > 1);//Should be layoutroot grid & button
|
||||||
@@ -232,7 +232,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
|
|
||||||
Assert.True(DataValidationErrors.GetHasErrors(datePicker));
|
Assert.True(DataValidationErrors.GetHasErrors(datePicker));
|
||||||
|
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
datePicker.SelectedDate = new DateTimeOffset(2005, 5, 10, 11, 12, 13, TimeSpan.Zero);
|
datePicker.SelectedDate = new DateTimeOffset(2005, 5, 10, 11, 12, 13, TimeSpan.Zero);
|
||||||
Assert.True(handled);
|
Assert.True(handled);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
{
|
{
|
||||||
CultureInfo.CurrentCulture = culture;
|
CultureInfo.CurrentCulture = culture;
|
||||||
Assert.Equal(result, length.ToString());
|
Assert.Equal(result, length.ToString());
|
||||||
});
|
}, TestContext.Current.CancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Avalonia.UnitTests;
|
using Avalonia.UnitTests;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
|
||||||
|
|
||||||
namespace Avalonia.Controls.UnitTests
|
namespace Avalonia.Controls.UnitTests
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -435,7 +435,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
items.Remove("1");
|
items.Remove("1");
|
||||||
lm.ExecuteLayoutPass();
|
lm.ExecuteLayoutPass();
|
||||||
|
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal("30", target.ContainerFromIndex(items.Count - 1)!.DataContext);
|
Assert.Equal("30", target.ContainerFromIndex(items.Count - 1)!.DataContext);
|
||||||
Assert.Equal("29", target.ContainerFromIndex(items.Count - 2)!.DataContext);
|
Assert.Equal("29", target.ContainerFromIndex(items.Count - 2)!.DataContext);
|
||||||
@@ -462,12 +462,12 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
|
|
||||||
Prepare(target);
|
Prepare(target);
|
||||||
|
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
// First an item that is not index 0 must be selected.
|
// First an item that is not index 0 must be selected.
|
||||||
_mouse.Click(target.Presenter!.Panel!.Children[1]);
|
_mouse.Click(target.Presenter!.Panel!.Children[1]);
|
||||||
|
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal(1, target.Selection.AnchorIndex);
|
Assert.Equal(1, target.Selection.AnchorIndex);
|
||||||
|
|
||||||
@@ -489,7 +489,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
// Click item 9.
|
// Click item 9.
|
||||||
_mouse.Click(item);
|
_mouse.Click(item);
|
||||||
|
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal(1, raised);
|
Assert.Equal(1, raised);
|
||||||
}
|
}
|
||||||
@@ -732,7 +732,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
items.Reverse();
|
items.Reverse();
|
||||||
Layout(target);
|
Layout(target);
|
||||||
|
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
realized = target.GetRealizedContainers()
|
realized = target.GetRealizedContainers()
|
||||||
.Cast<ListBoxItem>()
|
.Cast<ListBoxItem>()
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class LoadedTests : ScopedTestBase
|
|||||||
Assert.Equal(0, unloadedCount);
|
Assert.Equal(0, unloadedCount);
|
||||||
|
|
||||||
target.Show();
|
target.Show();
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded, TestContext.Current.CancellationToken);
|
||||||
Assert.True(target.IsLoaded);
|
Assert.True(target.IsLoaded);
|
||||||
|
|
||||||
Assert.Equal(1, loadedCount);
|
Assert.Equal(1, loadedCount);
|
||||||
@@ -59,7 +59,7 @@ public class LoadedTests : ScopedTestBase
|
|||||||
Assert.Equal(0, unloadedCount);
|
Assert.Equal(0, unloadedCount);
|
||||||
|
|
||||||
window.Content = target;
|
window.Content = target;
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded, TestContext.Current.CancellationToken);
|
||||||
Assert.True(target.IsLoaded);
|
Assert.True(target.IsLoaded);
|
||||||
|
|
||||||
Assert.Equal(1, loadedCount);
|
Assert.Equal(1, loadedCount);
|
||||||
@@ -98,7 +98,7 @@ public class LoadedTests : ScopedTestBase
|
|||||||
// Attach to another logical parent (this can actually happen outside tests with overlay popups)
|
// Attach to another logical parent (this can actually happen outside tests with overlay popups)
|
||||||
((ISetLogicalParent) target).SetParent(new Window());
|
((ISetLogicalParent) target).SetParent(new Window());
|
||||||
|
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
// At this point, the control shouldn't have been loaded at all.
|
// At this point, the control shouldn't have been loaded at all.
|
||||||
Assert.Null(target.VisualParent);
|
Assert.Null(target.VisualParent);
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
};
|
};
|
||||||
var root = new TestRoot { Child = target };
|
var root = new TestRoot { Child = target };
|
||||||
|
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.True(target.IsEnabled);
|
Assert.True(target.IsEnabled);
|
||||||
Assert.False(target.IsEffectivelyEnabled);
|
Assert.False(target.IsEffectivelyEnabled);
|
||||||
@@ -213,7 +213,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
var target = new MenuItem { Command = command };
|
var target = new MenuItem { Command = command };
|
||||||
var root = new TestRoot { Child = target };
|
var root = new TestRoot { Child = target };
|
||||||
|
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
target.CommandParameter = true;
|
target.CommandParameter = true;
|
||||||
Assert.True(target.IsEffectivelyEnabled);
|
Assert.True(target.IsEffectivelyEnabled);
|
||||||
@@ -239,7 +239,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
window.ApplyStyling();
|
window.ApplyStyling();
|
||||||
window.ApplyTemplate();
|
window.ApplyTemplate();
|
||||||
window.Presenter!.ApplyTemplate();
|
window.Presenter!.ApplyTemplate();
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.True(target.IsEffectivelyEnabled);
|
Assert.True(target.IsEffectivelyEnabled);
|
||||||
target.Command = command;
|
target.Command = command;
|
||||||
@@ -252,7 +252,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Assert.Equal(0, canExecuteCallCount);
|
Assert.Equal(0, canExecuteCallCount);
|
||||||
|
|
||||||
contextMenu.Open();
|
contextMenu.Open();
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded, TestContext.Current.CancellationToken);
|
||||||
Assert.Equal(3, canExecuteCallCount);// 3 because popup is changing logical child and moreover we need to invalidate again after the item is attached to the visual tree
|
Assert.Equal(3, canExecuteCallCount);// 3 because popup is changing logical child and moreover we need to invalidate again after the item is attached to the visual tree
|
||||||
|
|
||||||
command.RaiseCanExecuteChanged();
|
command.RaiseCanExecuteChanged();
|
||||||
@@ -281,7 +281,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
window.ApplyStyling();
|
window.ApplyStyling();
|
||||||
window.ApplyTemplate();
|
window.ApplyTemplate();
|
||||||
window.Presenter!.ApplyTemplate();
|
window.Presenter!.ApplyTemplate();
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded, TestContext.Current.CancellationToken);
|
||||||
Assert.True(target.IsEffectivelyEnabled);
|
Assert.True(target.IsEffectivelyEnabled);
|
||||||
target.Command = command;
|
target.Command = command;
|
||||||
Assert.Equal(0, canExecuteCallCount);
|
Assert.Equal(0, canExecuteCallCount);
|
||||||
@@ -293,7 +293,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Assert.Equal(0, canExecuteCallCount);
|
Assert.Equal(0, canExecuteCallCount);
|
||||||
|
|
||||||
flyout.ShowAt(button);
|
flyout.ShowAt(button);
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded, TestContext.Current.CancellationToken);
|
||||||
Assert.Equal(2, canExecuteCallCount); // 2 because we need to invalidate after the item is attached to the visual tree
|
Assert.Equal(2, canExecuteCallCount); // 2 because we need to invalidate after the item is attached to the visual tree
|
||||||
|
|
||||||
command.RaiseCanExecuteChanged();
|
command.RaiseCanExecuteChanged();
|
||||||
@@ -324,7 +324,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
window.Presenter!.ApplyTemplate();
|
window.Presenter!.ApplyTemplate();
|
||||||
contextMenu.Open();
|
contextMenu.Open();
|
||||||
|
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.Loaded, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.True(target.IsEffectivelyEnabled);
|
Assert.True(target.IsEffectivelyEnabled);
|
||||||
target.Command = command;
|
target.Command = command;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class ScreensTests : ScopedTestBase
|
|||||||
|
|
||||||
// Push 2 screens.
|
// Push 2 screens.
|
||||||
screens.PushNewScreens([1, 2]);
|
screens.PushNewScreens([1, 2]);
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal(2, screens.ScreenCount);
|
Assert.Equal(2, screens.ScreenCount);
|
||||||
totalScreens.Add(Assert.IsType<TestScreen>(screens.GetScreen(1)));
|
totalScreens.Add(Assert.IsType<TestScreen>(screens.GetScreen(1)));
|
||||||
@@ -33,7 +33,7 @@ public class ScreensTests : ScopedTestBase
|
|||||||
|
|
||||||
// Push 3 screens, while removing one old.
|
// Push 3 screens, while removing one old.
|
||||||
screens.PushNewScreens([2, 3, 4]);
|
screens.PushNewScreens([2, 3, 4]);
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal(3, screens.ScreenCount);
|
Assert.Equal(3, screens.ScreenCount);
|
||||||
Assert.Null(screens.GetScreen(1));
|
Assert.Null(screens.GetScreen(1));
|
||||||
@@ -64,7 +64,7 @@ public class ScreensTests : ScopedTestBase
|
|||||||
Assert.Empty(screens.AllScreens);
|
Assert.Empty(screens.AllScreens);
|
||||||
|
|
||||||
screens.PushNewScreens([1]);
|
screens.PushNewScreens([1]);
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
var screen = screens.GetScreen(1);
|
var screen = screens.GetScreen(1);
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ public class ScreensTests : ScopedTestBase
|
|||||||
Assert.Equal(new IntPtr(1), screen.TryGetPlatformHandle()!.Handle);
|
Assert.Equal(new IntPtr(1), screen.TryGetPlatformHandle()!.Handle);
|
||||||
|
|
||||||
screens.PushNewScreens([1]);
|
screens.PushNewScreens([1]);
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal(2, screen.Generation);
|
Assert.Equal(2, screen.Generation);
|
||||||
Assert.Equal(new IntPtr(1), screen.TryGetPlatformHandle()!.Handle);
|
Assert.Equal(new IntPtr(1), screen.TryGetPlatformHandle()!.Handle);
|
||||||
@@ -94,7 +94,7 @@ public class ScreensTests : ScopedTestBase
|
|||||||
|
|
||||||
screens.PushNewScreens([1, 2]);
|
screens.PushNewScreens([1, 2]);
|
||||||
screens.PushNewScreens([1, 2]); // OnChanged can be triggered multiple times by different events
|
screens.PushNewScreens([1, 2]); // OnChanged can be triggered multiple times by different events
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal(2, screens.ScreenCount);
|
Assert.Equal(2, screens.ScreenCount);
|
||||||
Assert.NotEmpty(screens.AllScreens);
|
Assert.NotEmpty(screens.AllScreens);
|
||||||
@@ -118,7 +118,7 @@ public class ScreensTests : ScopedTestBase
|
|||||||
};
|
};
|
||||||
|
|
||||||
ThreadRunHelper.RunOnDedicatedThread(() => screens.PushNewScreens([1, 2])).GetAwaiter().GetResult();
|
ThreadRunHelper.RunOnDedicatedThread(() => screens.PushNewScreens([1, 2])).GetAwaiter().GetResult();
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal(1, hasChangedTimes);
|
Assert.Equal(1, hasChangedTimes);
|
||||||
}
|
}
|
||||||
@@ -131,7 +131,7 @@ public class ScreensTests : ScopedTestBase
|
|||||||
|
|
||||||
var screens = new TestScreens();
|
var screens = new TestScreens();
|
||||||
screens.PushNewScreens([1, 2]);
|
screens.PushNewScreens([1, 2]);
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
var hasChangedTimes = 0;
|
var hasChangedTimes = 0;
|
||||||
var screen = screens.GetScreen(2);
|
var screen = screens.GetScreen(2);
|
||||||
@@ -144,7 +144,7 @@ public class ScreensTests : ScopedTestBase
|
|||||||
};
|
};
|
||||||
|
|
||||||
screens.PushNewScreens([1]);
|
screens.PushNewScreens([1]);
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal(1, hasChangedTimes);
|
Assert.Equal(1, hasChangedTimes);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -814,7 +814,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|||||||
var window = PreparedWindow(popup);
|
var window = PreparedWindow(popup);
|
||||||
window.Show();
|
window.Show();
|
||||||
popup.Open();
|
popup.Open();
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.AfterRender);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.AfterRender, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
var raised = false;
|
var raised = false;
|
||||||
if (popup.Host is PopupRoot popupRoot)
|
if (popup.Host is PopupRoot popupRoot)
|
||||||
@@ -837,7 +837,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
window.Position = new PixelPoint(10, 10);
|
window.Position = new PixelPoint(10, 10);
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.AfterRender);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.AfterRender, TestContext.Current.CancellationToken);
|
||||||
Assert.False(raised);
|
Assert.False(raised);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -867,7 +867,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|||||||
var window = PreparedWindow(placementTarget);
|
var window = PreparedWindow(placementTarget);
|
||||||
window.Show();
|
window.Show();
|
||||||
popup.Open();
|
popup.Open();
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.AfterRender);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.AfterRender, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
// The target's initial placement is (395,295) which is a 10x10 panel centered in a 800x600 window
|
// The target's initial placement is (395,295) which is a 10x10 panel centered in a 800x600 window
|
||||||
Assert.Equal(placementTarget.Bounds, new Rect(395D, 295D, 10, 10));
|
Assert.Equal(placementTarget.Bounds, new Rect(395D, 295D, 10, 10));
|
||||||
@@ -898,7 +898,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
window.PlatformImpl?.Resize(new Size(700D, 500D), WindowResizeReason.Unspecified);
|
window.PlatformImpl?.Resize(new Size(700D, 500D), WindowResizeReason.Unspecified);
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.AfterRender);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.AfterRender, TestContext.Current.CancellationToken);
|
||||||
Assert.True(raised);
|
Assert.True(raised);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -928,7 +928,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|||||||
var window = PreparedWindow(placementTarget);
|
var window = PreparedWindow(placementTarget);
|
||||||
window.Show();
|
window.Show();
|
||||||
popup.Open();
|
popup.Open();
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.AfterRender);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.AfterRender, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
// The target's initial placement is (395,295) which is a 10x10 panel centered in a 800x600 window
|
// The target's initial placement is (395,295) which is a 10x10 panel centered in a 800x600 window
|
||||||
Assert.Equal(placementTarget.Bounds, new Rect(395D, 295D, 10, 10));
|
Assert.Equal(placementTarget.Bounds, new Rect(395D, 295D, 10, 10));
|
||||||
@@ -954,7 +954,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
window.PlatformImpl?.Resize(new Size(700D, 500D), WindowResizeReason.Unspecified);
|
window.PlatformImpl?.Resize(new Size(700D, 500D), WindowResizeReason.Unspecified);
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.AfterRender);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.AfterRender, TestContext.Current.CancellationToken);
|
||||||
Assert.False(raised);
|
Assert.False(raised);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -983,7 +983,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|||||||
var window = PreparedWindow(placementTarget);
|
var window = PreparedWindow(placementTarget);
|
||||||
window.Show();
|
window.Show();
|
||||||
popup.Open();
|
popup.Open();
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
// The target's initial placement is (395,295) which is a 10x10 panel centered in a 800x600 window
|
// The target's initial placement is (395,295) which is a 10x10 panel centered in a 800x600 window
|
||||||
Assert.Equal(placementTarget.Bounds, new Rect(395D, 295D, 10, 10));
|
Assert.Equal(placementTarget.Bounds, new Rect(395D, 295D, 10, 10));
|
||||||
@@ -1013,7 +1013,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
placementTarget.Margin = new Thickness(10, 0, 0, 0);
|
placementTarget.Margin = new Thickness(10, 0, 0, 0);
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
Assert.True(raised);
|
Assert.True(raised);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1043,7 +1043,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|||||||
var window = PreparedWindow(placementTarget);
|
var window = PreparedWindow(placementTarget);
|
||||||
window.Show();
|
window.Show();
|
||||||
popup.Open();
|
popup.Open();
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
// The target's initial placement is (395,295) which is a 10x10 panel centered in a 800x600 window
|
// The target's initial placement is (395,295) which is a 10x10 panel centered in a 800x600 window
|
||||||
Assert.Equal(placementTarget.Bounds, new Rect(395D, 295D, 10, 10));
|
Assert.Equal(placementTarget.Bounds, new Rect(395D, 295D, 10, 10));
|
||||||
@@ -1069,7 +1069,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
placementTarget.Margin = new Thickness(10, 0, 0, 0);
|
placementTarget.Margin = new Thickness(10, 0, 0, 0);
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
Assert.False(raised);
|
Assert.False(raised);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1240,7 +1240,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|||||||
|
|
||||||
root.LayoutManager.ExecuteInitialLayoutPass();
|
root.LayoutManager.ExecuteInitialLayoutPass();
|
||||||
popup.Open();
|
popup.Open();
|
||||||
Dispatcher.UIThread.RunJobs(DispatcherPriority.AfterRender);
|
Dispatcher.UIThread.RunJobs(DispatcherPriority.AfterRender, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
// X: Adorned Canvas.Left + Adorner Margin Left + Adorner Width
|
// X: Adorned Canvas.Left + Adorner Margin Left + Adorner Width
|
||||||
// Y: Adorned Canvas.Top + Adorner Margin Top + Adorner Height
|
// Y: Adorned Canvas.Top + Adorner Margin Top + Adorner Height
|
||||||
|
|||||||
@@ -1649,7 +1649,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|||||||
Prepare(target);
|
Prepare(target);
|
||||||
target.AddHandler(Control.RequestBringIntoViewEvent, (s, e) => raised = true);
|
target.AddHandler(Control.RequestBringIntoViewEvent, (s, e) => raised = true);
|
||||||
target.SelectedIndex = 2;
|
target.SelectedIndex = 2;
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
Assert.True(raised);
|
Assert.True(raised);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1676,7 +1676,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|||||||
target.AddHandler(Control.RequestBringIntoViewEvent, (s, e) => raised = true);
|
target.AddHandler(Control.RequestBringIntoViewEvent, (s, e) => raised = true);
|
||||||
target.SelectedIndex = 2;
|
target.SelectedIndex = 2;
|
||||||
Prepare(target);
|
Prepare(target);
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
Assert.True(raised);
|
Assert.True(raised);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1750,7 +1750,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|||||||
root.Child = null;
|
root.Child = null;
|
||||||
target.SelectedIndex = 1;
|
target.SelectedIndex = 1;
|
||||||
root.Child = target;
|
root.Child = target;
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
Assert.True(raised);
|
Assert.True(raised);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1811,11 +1811,11 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|||||||
var raised = false;
|
var raised = false;
|
||||||
target.AddHandler(Control.RequestBringIntoViewEvent, (s, e) => raised = true);
|
target.AddHandler(Control.RequestBringIntoViewEvent, (s, e) => raised = true);
|
||||||
target.SelectedIndex = 2;
|
target.SelectedIndex = 2;
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
Assert.False(raised);
|
Assert.False(raised);
|
||||||
|
|
||||||
target.AutoScrollToSelectedItem = true;
|
target.AutoScrollToSelectedItem = true;
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
Assert.True(raised);
|
Assert.True(raised);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
};
|
};
|
||||||
TimeSpan value = TimeSpan.FromHours(10);
|
TimeSpan value = TimeSpan.FromHours(10);
|
||||||
timePicker.SelectedTime = value;
|
timePicker.SelectedTime = value;
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
Assert.True(handled);
|
Assert.True(handled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -249,7 +249,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
|
|
||||||
Assert.True(DataValidationErrors.GetHasErrors(timePicker));
|
Assert.True(DataValidationErrors.GetHasErrors(timePicker));
|
||||||
|
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
timePicker.SelectedTime = new TimeSpan(11, 12, 13);
|
timePicker.SelectedTime = new TimeSpan(11, 12, 13);
|
||||||
Assert.True(handled);
|
Assert.True(handled);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Avalonia.Controls.Templates;
|
|||||||
using Avalonia.Headless;
|
using Avalonia.Headless;
|
||||||
using Avalonia.Layout;
|
using Avalonia.Layout;
|
||||||
using Avalonia.Platform;
|
using Avalonia.Platform;
|
||||||
|
using Avalonia.Threading;
|
||||||
using Avalonia.UnitTests;
|
using Avalonia.UnitTests;
|
||||||
using Avalonia.VisualTree;
|
using Avalonia.VisualTree;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace Avalonia.Controls.UnitTests.Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[MemberData(nameof(ElementsFactory), parameters: true)]
|
[MemberData(nameof(ElementsFactory), arguments: true)]
|
||||||
public void HotKeyManager_Should_Use_CommandParameter(string factoryName, Factory factory)
|
public void HotKeyManager_Should_Use_CommandParameter(string factoryName, Factory factory)
|
||||||
{
|
{
|
||||||
using (AvaloniaLocator.EnterScope())
|
using (AvaloniaLocator.EnterScope())
|
||||||
@@ -98,7 +98,7 @@ namespace Avalonia.Controls.UnitTests.Utils
|
|||||||
|
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[MemberData(nameof(ElementsFactory), parameters: true)]
|
[MemberData(nameof(ElementsFactory), arguments: true)]
|
||||||
public void HotKeyManager_Should_Do_Not_Executed_When_IsEnabled_False(string factoryName, Factory factory)
|
public void HotKeyManager_Should_Do_Not_Executed_When_IsEnabled_False(string factoryName, Factory factory)
|
||||||
{
|
{
|
||||||
using (AvaloniaLocator.EnterScope())
|
using (AvaloniaLocator.EnterScope())
|
||||||
@@ -141,7 +141,7 @@ namespace Avalonia.Controls.UnitTests.Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[MemberData(nameof(ElementsFactory), parameters:false)]
|
[MemberData(nameof(ElementsFactory), arguments:false)]
|
||||||
public void HotKeyManager_Should_Invoke_Event_Click_When_Command_Is_Null(string factoryName, Factory factory)
|
public void HotKeyManager_Should_Invoke_Event_Click_When_Command_Is_Null(string factoryName, Factory factory)
|
||||||
{
|
{
|
||||||
using (AvaloniaLocator.EnterScope())
|
using (AvaloniaLocator.EnterScope())
|
||||||
@@ -197,7 +197,7 @@ namespace Avalonia.Controls.UnitTests.Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[MemberData(nameof(ElementsFactory), parameters: true)]
|
[MemberData(nameof(ElementsFactory), arguments: true)]
|
||||||
public void HotKeyManager_Should_Not_Invoke_Event_Click_When_Command_Is_Not_Null(string factoryName, Factory factory)
|
public void HotKeyManager_Should_Not_Invoke_Event_Click_When_Command_Is_Not_Null(string factoryName, Factory factory)
|
||||||
{
|
{
|
||||||
using (AvaloniaLocator.EnterScope())
|
using (AvaloniaLocator.EnterScope())
|
||||||
|
|||||||
@@ -718,7 +718,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
target.Width = 120;
|
target.Width = 120;
|
||||||
target.Height = 70;
|
target.Height = 70;
|
||||||
|
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal(1, child.MeasureSizes.Count);
|
Assert.Equal(1, child.MeasureSizes.Count);
|
||||||
Assert.Equal(new Size(120, 70), child.MeasureSizes[0]);
|
Assert.Equal(new Size(120, 70), child.MeasureSizes[0]);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<WebAppDir>$(MSBuildThisFileDirectory)Remote/HtmlTransport/webapp</WebAppDir>
|
<WebAppDir>$(MSBuildThisFileDirectory)Remote/HtmlTransport/webapp</WebAppDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
||||||
|
|||||||
@@ -13,21 +13,20 @@ using Avalonia.Remote.Protocol;
|
|||||||
using Avalonia.Remote.Protocol.Designer;
|
using Avalonia.Remote.Protocol.Designer;
|
||||||
using Avalonia.Remote.Protocol.Viewport;
|
using Avalonia.Remote.Protocol.Viewport;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Extensions;
|
|
||||||
|
|
||||||
namespace Avalonia.DesignerSupport.Tests
|
namespace Avalonia.DesignerSupport.Tests
|
||||||
{
|
{
|
||||||
public class DesignerSupportTests
|
public class DesignerSupportTests
|
||||||
{
|
{
|
||||||
private const string DesignerAppPath = "../../../../../src/tools/Avalonia.Designer.HostApp/bin/$BUILD/$TFM/Avalonia.Designer.HostApp.dll";
|
private const string DesignerAppPath = "../../../../../src/tools/Avalonia.Designer.HostApp/bin/$BUILD/$TFM/Avalonia.Designer.HostApp.dll";
|
||||||
private readonly Xunit.Abstractions.ITestOutputHelper outputHelper;
|
private readonly ITestOutputHelper outputHelper;
|
||||||
|
|
||||||
public DesignerSupportTests(Xunit.Abstractions.ITestOutputHelper outputHelper)
|
public DesignerSupportTests(ITestOutputHelper outputHelper)
|
||||||
{
|
{
|
||||||
this.outputHelper = outputHelper;
|
this.outputHelper = outputHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SkippableTheory,
|
[Theory,
|
||||||
InlineData(
|
InlineData(
|
||||||
@"..\..\..\..\..\tests/Avalonia.DesignerSupport.TestApp/bin/$BUILD/$TFM/",
|
@"..\..\..\..\..\tests/Avalonia.DesignerSupport.TestApp/bin/$BUILD/$TFM/",
|
||||||
"Avalonia.DesignerSupport.TestApp",
|
"Avalonia.DesignerSupport.TestApp",
|
||||||
@@ -63,7 +62,7 @@ namespace Avalonia.DesignerSupport.Tests
|
|||||||
xamlFile = Path.GetFullPath(xamlFile.Replace('\\', Path.DirectorySeparatorChar));
|
xamlFile = Path.GetFullPath(xamlFile.Replace('\\', Path.DirectorySeparatorChar));
|
||||||
|
|
||||||
if (method == "win32")
|
if (method == "win32")
|
||||||
Skip.IfNot(RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
|
Assert.SkipUnless(RuntimeInformation.IsOSPlatform(OSPlatform.Windows), "Windows-only");
|
||||||
|
|
||||||
var xaml = File.ReadAllText(xamlFile);
|
var xaml = File.ReadAllText(xamlFile);
|
||||||
string buildType;
|
string buildType;
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ namespace Avalonia.DesignerSupport.Tests
|
|||||||
foreach (var p in t.GetProperties())
|
foreach (var p in t.GetProperties())
|
||||||
p.SetValue(o, GetRandomValue(p.PropertyType, $"{t.FullName}.{p.Name}"));
|
p.SetValue(o, GetRandomValue(p.PropertyType, $"{t.FullName}.{p.Name}"));
|
||||||
|
|
||||||
_client.Send(o).Wait(TimeoutInMs);
|
_client.Send(o).Wait(TimeoutInMs, TestContext.Current.CancellationToken);
|
||||||
var received = TakeServer();
|
var received = TakeServer();
|
||||||
Helpers.StructDiff(received, o);
|
Helpers.StructDiff(received, o);
|
||||||
|
|
||||||
@@ -199,11 +199,11 @@ namespace Avalonia.DesignerSupport.Tests
|
|||||||
{
|
{
|
||||||
exceptions.Add(ex);
|
exceptions.Add(ex);
|
||||||
}
|
}
|
||||||
});
|
}, TestContext.Current.CancellationToken);
|
||||||
tasks.Add(task);
|
tasks.Add(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
Task.WaitAll(tasks.ToArray(), TimeoutInMs * messages.Length * 10);
|
Task.WaitAll(tasks.ToArray(), TimeoutInMs * messages.Length * 10, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
// Verify no exceptions occurred
|
// Verify no exceptions occurred
|
||||||
Assert.Empty(exceptions);
|
Assert.Empty(exceptions);
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class InitializeComponentTests
|
|||||||
.Replace("\r", string.Empty)
|
.Replace("\r", string.Empty)
|
||||||
.Replace("$GeneratorVersion", generatorVersion);
|
.Replace("$GeneratorVersion", generatorVersion);
|
||||||
|
|
||||||
CSharpSyntaxTree.ParseText(code);
|
CSharpSyntaxTree.ParseText(code, cancellationToken: TestContext.Current.CancellationToken);
|
||||||
Assert.Equal(expected, code);
|
Assert.Equal(expected, code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class OnlyPropertiesTests
|
|||||||
.Replace("\r", string.Empty)
|
.Replace("\r", string.Empty)
|
||||||
.Replace("$GeneratorVersion", generatorVersion);
|
.Replace("$GeneratorVersion", generatorVersion);
|
||||||
|
|
||||||
CSharpSyntaxTree.ParseText(code);
|
CSharpSyntaxTree.ParseText(code, cancellationToken: TestContext.Current.CancellationToken);
|
||||||
Assert.Equal(expected, code);
|
Assert.Equal(expected, code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -3,6 +3,8 @@
|
|||||||
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
||||||
<IsTestProject>true</IsTestProject>
|
<IsTestProject>true</IsTestProject>
|
||||||
<DefineConstants>$(DefineConstants);NUNIT</DefineConstants>
|
<DefineConstants>$(DefineConstants);NUNIT</DefineConstants>
|
||||||
|
<EnableNUnitRunner>true</EnableNUnitRunner>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
||||||
@@ -14,7 +16,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="NUnit" Version="4.4.0" />
|
<PackageReference Include="NUnit" Version="4.4.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="6.0.1" />
|
<PackageReference Include="NUnit3TestAdapter" Version="6.0.1" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
+2
-1
@@ -3,6 +3,8 @@
|
|||||||
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
||||||
<IsTestProject>true</IsTestProject>
|
<IsTestProject>true</IsTestProject>
|
||||||
<DefineConstants>$(DefineConstants);NUNIT</DefineConstants>
|
<DefineConstants>$(DefineConstants);NUNIT</DefineConstants>
|
||||||
|
<EnableNUnitRunner>true</EnableNUnitRunner>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
||||||
@@ -14,7 +16,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="NUnit" Version="4.4.0" />
|
<PackageReference Include="NUnit" Version="4.4.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="6.0.1" />
|
<PackageReference Include="NUnit3TestAdapter" Version="6.0.1" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
+2
@@ -1,8 +1,10 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
<IsTestProject>true</IsTestProject>
|
<IsTestProject>true</IsTestProject>
|
||||||
<DefineConstants>$(DefineConstants);XUNIT</DefineConstants>
|
<DefineConstants>$(DefineConstants);XUNIT</DefineConstants>
|
||||||
|
<IsXUnit2>true</IsXUnit2>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
||||||
|
|||||||
+2
@@ -1,8 +1,10 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
<IsTestProject>true</IsTestProject>
|
<IsTestProject>true</IsTestProject>
|
||||||
<DefineConstants>$(DefineConstants);XUNIT</DefineConstants>
|
<DefineConstants>$(DefineConstants);XUNIT</DefineConstants>
|
||||||
|
<IsXUnit2>true</IsXUnit2>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
|
||||||
<IsRunningAppium2 Condition="'$(IsRunningAppium2)' == ''">false</IsRunningAppium2>
|
<IsRunningAppium2 Condition="'$(IsRunningAppium2)' == ''">false</IsRunningAppium2>
|
||||||
@@ -29,6 +30,13 @@
|
|||||||
<PackageReference Include="Appium.WebDriver" Version="5.2.0"/>
|
<PackageReference Include="Appium.WebDriver" Version="5.2.0"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<!-- This test project is run in CI via VSTest Azure Task, to have video recorder support -->
|
||||||
|
<!-- Video recorder isn't yet supported by Microsoft.Testing.Platform, we keep this project compatible with both VSTest and Microsoft.Testing.Platform. -->
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<Import Project="..\..\build\XUnit.props" />
|
<Import Project="..\..\build\XUnit.props" />
|
||||||
<Import Project="..\..\build\Rx.props" />
|
<Import Project="..\..\build\Rx.props" />
|
||||||
<Import Project="..\..\build\ImageSharp.props" />
|
<Import Project="..\..\build\ImageSharp.props" />
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
@@ -16,31 +17,22 @@ namespace Avalonia
|
|||||||
|
|
||||||
internal class PlatformFactAttribute : FactAttribute
|
internal class PlatformFactAttribute : FactAttribute
|
||||||
{
|
{
|
||||||
private readonly string? _reason;
|
public PlatformFactAttribute(
|
||||||
private string? _skip;
|
TestPlatforms platforms,
|
||||||
|
string? reason = null,
|
||||||
public PlatformFactAttribute(TestPlatforms platforms, string? reason = null)
|
[CallerFilePath] string? sourceFilePath = null,
|
||||||
|
[CallerLineNumber] int sourceLineNumber = -1)
|
||||||
|
: base(sourceFilePath, sourceLineNumber)
|
||||||
{
|
{
|
||||||
_reason = reason;
|
|
||||||
Platforms = platforms;
|
Platforms = platforms;
|
||||||
|
if (!IsSupported())
|
||||||
|
Skip = $"Ignored on {RuntimeInformation.OSDescription}" +
|
||||||
|
(reason is not null ? $" reason: '{reason}'" : "");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestPlatforms Platforms { get; }
|
public TestPlatforms Platforms { get; }
|
||||||
|
|
||||||
public override string? Skip
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_skip is not null)
|
|
||||||
return _skip;
|
|
||||||
if (!IsSupported())
|
|
||||||
return $"Ignored on {RuntimeInformation.OSDescription}" +
|
|
||||||
(_reason is not null ? $" reason: '{_reason}'" : "");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
set => _skip = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool IsSupported()
|
private bool IsSupported()
|
||||||
{
|
{
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
@@ -7,23 +8,20 @@ namespace Avalonia.IntegrationTests.Appium
|
|||||||
{
|
{
|
||||||
internal class PlatformTheoryAttribute : TheoryAttribute
|
internal class PlatformTheoryAttribute : TheoryAttribute
|
||||||
{
|
{
|
||||||
private string? _skip;
|
public PlatformTheoryAttribute(
|
||||||
|
TestPlatforms platforms = TestPlatforms.All,
|
||||||
public PlatformTheoryAttribute(TestPlatforms platforms = TestPlatforms.All) => Platforms = platforms;
|
[CallerFilePath] string? sourceFilePath = null,
|
||||||
|
[CallerLineNumber] int sourceLineNumber = -1) : base(sourceFilePath, sourceLineNumber)
|
||||||
|
{
|
||||||
|
Platforms = platforms;
|
||||||
|
if (!IsSupported())
|
||||||
|
{
|
||||||
|
Skip = $"Ignored on {RuntimeInformation.OSDescription}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public TestPlatforms Platforms { get; }
|
public TestPlatforms Platforms { get; }
|
||||||
|
|
||||||
public override string? Skip
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_skip is not null)
|
|
||||||
return _skip;
|
|
||||||
return !IsSupported() ? $"Ignored on {RuntimeInformation.OSDescription}" : null;
|
|
||||||
}
|
|
||||||
set => _skip = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool IsSupported()
|
private bool IsSupported()
|
||||||
{
|
{
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
|
|||||||
@@ -14,8 +14,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="xunit.v3" Version="3.2.1" />
|
<PackageReference Include="xunit.v3.mtp-v2" Version="3.2.1" />
|
||||||
<PackageReference Include="xunit.v3.extensibility.core" Version="3.2.1" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Import Project="../../build/SharedVersion.props" />
|
<Import Project="../../build/SharedVersion.props" />
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="..\..\build\Moq.props" />
|
<Import Project="..\..\build\Moq.props" />
|
||||||
<Import Project="..\..\build\XUnit.props" />
|
<Import Project="..\..\build\XUnit.props" />
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Xunit;
|
using System.Runtime.CompilerServices;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
namespace Avalonia.LeakTests;
|
namespace Avalonia.LeakTests;
|
||||||
|
|
||||||
@@ -7,7 +8,10 @@ namespace Avalonia.LeakTests;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ReleaseFactAttribute : FactAttribute
|
internal sealed class ReleaseFactAttribute : FactAttribute
|
||||||
{
|
{
|
||||||
public ReleaseFactAttribute()
|
public ReleaseFactAttribute(
|
||||||
|
[CallerFilePath] string? sourceFilePath = null,
|
||||||
|
[CallerLineNumber] int sourceLineNumber = -1
|
||||||
|
) : base(sourceFilePath, sourceLineNumber)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Skip = "Only runs in Release mode";
|
Skip = "Only runs in Release mode";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<IsTestProject>true</IsTestProject>
|
<IsTestProject>true</IsTestProject>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
||||||
|
|||||||
@@ -551,7 +551,7 @@ namespace Avalonia.Markup.UnitTests.Data
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Forces WeakEvent compact
|
// Forces WeakEvent compact
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal(0, source.SubscriberCount);
|
Assert.Equal(0, source.SubscriberCount);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ namespace Avalonia.Markup.UnitTests.Parsers
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Forces WeakEvent compact
|
// Forces WeakEvent compact
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal(new[] { AvaloniaProperty.UnsetValue, "baz" }, result);
|
Assert.Equal(new[] { AvaloniaProperty.UnsetValue, "baz" }, result);
|
||||||
Assert.Null(((INotifyCollectionChangedDebug)data.Foo).GetCollectionChangedSubscribers());
|
Assert.Null(((INotifyCollectionChangedDebug)data.Foo).GetCollectionChangedSubscribers());
|
||||||
@@ -188,7 +188,7 @@ namespace Avalonia.Markup.UnitTests.Parsers
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Forces WeakEvent compact
|
// Forces WeakEvent compact
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal(new[] { "foo", "bar" }, result);
|
Assert.Equal(new[] { "foo", "bar" }, result);
|
||||||
Assert.Null(((INotifyCollectionChangedDebug)data.Foo).GetCollectionChangedSubscribers());
|
Assert.Null(((INotifyCollectionChangedDebug)data.Foo).GetCollectionChangedSubscribers());
|
||||||
@@ -209,7 +209,7 @@ namespace Avalonia.Markup.UnitTests.Parsers
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Forces WeakEvent compact
|
// Forces WeakEvent compact
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal(new[] { "bar", "baz" }, result);
|
Assert.Equal(new[] { "bar", "baz" }, result);
|
||||||
Assert.Null(((INotifyCollectionChangedDebug)data.Foo).GetCollectionChangedSubscribers());
|
Assert.Null(((INotifyCollectionChangedDebug)data.Foo).GetCollectionChangedSubscribers());
|
||||||
@@ -268,7 +268,7 @@ namespace Avalonia.Markup.UnitTests.Parsers
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Forces WeakEvent compact
|
// Forces WeakEvent compact
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
var expected = new[] { "bar", "bar2" };
|
var expected = new[] { "bar", "bar2" };
|
||||||
Assert.Equal(expected, result);
|
Assert.Equal(expected, result);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>$(AvsCurrentTargetFramework)</TargetFrameworks>
|
<TargetFrameworks>$(AvsCurrentTargetFramework)</TargetFrameworks>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<IsTestProject>true</IsTestProject>
|
<IsTestProject>true</IsTestProject>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
||||||
@@ -38,15 +38,5 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="../Shared/ScopedSanityCheck.cs"/>
|
<Compile Include="../Shared/ScopedSanityCheck.cs"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Update="xunit.runner.console" Version="2.9.3">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Update="xunit.runner.visualstudio" Version="3.1.5">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="..\..\build\BuildTargets.targets" />
|
<Import Project="..\..\build\BuildTargets.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.Data
|
|||||||
Assert.Equal(button.IsEffectivelyEnabled, false);
|
Assert.Equal(button.IsEffectivelyEnabled, false);
|
||||||
|
|
||||||
vm.Parameter = true;
|
vm.Parameter = true;
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal(button.IsEffectivelyEnabled, true);
|
Assert.Equal(button.IsEffectivelyEnabled, true);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -2012,7 +2012,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions
|
|||||||
Assert.Equal(button.IsEffectivelyEnabled, false);
|
Assert.Equal(button.IsEffectivelyEnabled, false);
|
||||||
|
|
||||||
vm.Parameter = true;
|
vm.Parameter = true;
|
||||||
Threading.Dispatcher.UIThread.RunJobs();
|
Threading.Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal(button.IsEffectivelyEnabled, true);
|
Assert.Equal(button.IsEffectivelyEnabled, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ namespace Avalonia.Markup.Xaml.UnitTests
|
|||||||
w.ApplyTemplate();
|
w.ApplyTemplate();
|
||||||
w.Show();
|
w.Show();
|
||||||
|
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
var itemsPresenter = ((ItemsControl)w.Content!).GetVisualChildren().FirstOrDefault();
|
var itemsPresenter = ((ItemsControl)w.Content!).GetVisualChildren().FirstOrDefault();
|
||||||
Assert.NotNull(itemsPresenter);
|
Assert.NotNull(itemsPresenter);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>$(AvsCurrentWindowsTargetFramework)</TargetFramework>
|
<TargetFramework>$(AvsCurrentWindowsTargetFramework)</TargetFramework>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
<EnableWindowsTargeting>true</EnableWindowsTargeting>
|
<EnableWindowsTargeting>true</EnableWindowsTargeting>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWpf>true</UseWpf>
|
<UseWpf>true</UseWpf>
|
||||||
@@ -15,7 +16,7 @@
|
|||||||
<Content Include="../Avalonia.RenderTests/**/*.png" CopyToOutputDirectory="Always" />
|
<Content Include="../Avalonia.RenderTests/**/*.png" CopyToOutputDirectory="Always" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Xunit.StaFact" Version="1.2.69" />
|
<PackageReference Include="Xunit.StaFact" Version="3.0.13" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="..\..\build\Moq.props" />
|
<Import Project="..\..\build\Moq.props" />
|
||||||
<Import Project="..\..\build\Rx.props" />
|
<Import Project="..\..\build\Rx.props" />
|
||||||
|
|||||||
@@ -1,13 +1,20 @@
|
|||||||
using Xunit;
|
using System.Runtime.CompilerServices;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
namespace Avalonia.RenderTests.WpfCompare;
|
namespace Avalonia.RenderTests.WpfCompare;
|
||||||
|
|
||||||
public class CrossFactAttribute : StaFactAttribute
|
public class CrossFactAttribute : StaFactAttribute
|
||||||
{
|
{
|
||||||
|
public CrossFactAttribute([CallerFilePath] string? sourceFilePath = null, [CallerLineNumber] int sourceLineNumber = -1)
|
||||||
|
: base(sourceFilePath, sourceLineNumber)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CrossTheoryAttribute : StaTheoryAttribute
|
public class CrossTheoryAttribute : StaTheoryAttribute
|
||||||
{
|
{
|
||||||
|
public CrossTheoryAttribute([CallerFilePath] string? sourceFilePath = null, [CallerLineNumber] int sourceLineNumber = -1)
|
||||||
|
: base(sourceFilePath, sourceLineNumber)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public class DirectFbCompositionTests : TestBase
|
|||||||
control.Measure(new Size(control.Width, control.Height));
|
control.Measure(new Size(control.Width, control.Height));
|
||||||
control.Arrange(new Rect(control.DesiredSize));
|
control.Arrange(new Rect(control.DesiredSize));
|
||||||
renderer.Start();
|
renderer.Start();
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
timer.TriggerTick();
|
timer.TriggerTick();
|
||||||
var image1 =
|
var image1 =
|
||||||
$"{nameof(Should_Only_Update_Clipped_Rects_When_Retained_Fb_Is_Advertised)}_advertized-{advertised}_initial";
|
$"{nameof(Should_Only_Update_Clipped_Rects_When_Retained_Fb_Is_Advertised)}_advertized-{advertised}_initial";
|
||||||
@@ -112,7 +112,7 @@ public class DirectFbCompositionTests : TestBase
|
|||||||
|
|
||||||
r1.Fill = Brushes.Red;
|
r1.Fill = Brushes.Red;
|
||||||
r2.Fill = Brushes.Green;
|
r2.Fill = Brushes.Green;
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs(null, TestContext.Current.CancellationToken);
|
||||||
timer.TriggerTick();
|
timer.TriggerTick();
|
||||||
var image2 =
|
var image2 =
|
||||||
$"{nameof(Should_Only_Update_Clipped_Rects_When_Retained_Fb_Is_Advertised)}_advertized-{advertised}_updated";
|
$"{nameof(Should_Only_Update_Clipped_Rects_When_Retained_Fb_Is_Advertised)}_advertized-{advertised}_updated";
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
@@ -7,7 +8,11 @@ namespace Avalonia.Skia.RenderTests
|
|||||||
{
|
{
|
||||||
public class Win32Fact : FactAttribute
|
public class Win32Fact : FactAttribute
|
||||||
{
|
{
|
||||||
public Win32Fact(string message)
|
public Win32Fact(
|
||||||
|
string message,
|
||||||
|
[CallerFilePath] string? sourceFilePath = null,
|
||||||
|
[CallerLineNumber] int sourceLineNumber = -1)
|
||||||
|
: base(sourceFilePath, sourceLineNumber)
|
||||||
{
|
{
|
||||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
Skip = message;
|
Skip = message;
|
||||||
@@ -16,7 +21,11 @@ namespace Avalonia.Skia.RenderTests
|
|||||||
|
|
||||||
public class Win32Theory : TheoryAttribute
|
public class Win32Theory : TheoryAttribute
|
||||||
{
|
{
|
||||||
public Win32Theory(string message)
|
public Win32Theory(
|
||||||
|
string message,
|
||||||
|
[CallerFilePath] string? sourceFilePath = null,
|
||||||
|
[CallerLineNumber] int sourceLineNumber = -1)
|
||||||
|
: base(sourceFilePath, sourceLineNumber)
|
||||||
{
|
{
|
||||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
Skip = message;
|
Skip = message;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
<DefineConstants>$(DefineConstants);AVALONIA_SKIA</DefineConstants>
|
<DefineConstants>$(DefineConstants);AVALONIA_SKIA</DefineConstants>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<IncludeLinuxSkia>true</IncludeLinuxSkia>
|
<IncludeLinuxSkia>true</IncludeLinuxSkia>
|
||||||
|
|||||||
@@ -14,12 +14,22 @@ namespace Avalonia.Skia.RenderTests;
|
|||||||
|
|
||||||
class CrossFactAttribute : FactAttribute
|
class CrossFactAttribute : FactAttribute
|
||||||
{
|
{
|
||||||
|
public CrossFactAttribute(
|
||||||
|
[CallerFilePath] string? sourceFilePath = null,
|
||||||
|
[CallerLineNumber] int sourceLineNumber = -1
|
||||||
|
) : base(sourceFilePath, sourceLineNumber)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CrossTheoryAttribute : TheoryAttribute
|
class CrossTheoryAttribute : TheoryAttribute
|
||||||
{
|
{
|
||||||
|
public CrossTheoryAttribute(
|
||||||
|
[CallerFilePath] string? sourceFilePath = null,
|
||||||
|
[CallerLineNumber] int sourceLineNumber = -1
|
||||||
|
) : base(sourceFilePath, sourceLineNumber)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CrossTestBase : IDisposable
|
public class CrossTestBase : IDisposable
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
<Import Project="..\..\build\UnitTests.NetCore.targets" />
|
||||||
<Import Project="..\..\build\Moq.props" />
|
<Import Project="..\..\build\Moq.props" />
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Avalonia.Skia.UnitTests
|
namespace Avalonia.Skia.UnitTests
|
||||||
{
|
{
|
||||||
internal class Win32Fact : FactAttribute
|
internal class Win32Fact : FactAttribute
|
||||||
{
|
{
|
||||||
public Win32Fact(string message)
|
public Win32Fact(
|
||||||
|
string message,
|
||||||
|
[CallerFilePath] string? sourceFilePath = null,
|
||||||
|
[CallerLineNumber] int sourceLineNumber = -1)
|
||||||
|
: base(sourceFilePath, sourceLineNumber)
|
||||||
{
|
{
|
||||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
Skip = message;
|
Skip = message;
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Avalonia.Skia.UnitTests
|
namespace Avalonia.Skia.UnitTests
|
||||||
{
|
{
|
||||||
internal class Win32Theory: TheoryAttribute
|
internal class Win32Theory: TheoryAttribute
|
||||||
{
|
{
|
||||||
public Win32Theory(string message)
|
public Win32Theory(
|
||||||
|
string message,
|
||||||
|
[CallerFilePath] string? sourceFilePath = null,
|
||||||
|
[CallerLineNumber] int sourceLineNumber = -1) : base(sourceFilePath, sourceLineNumber)
|
||||||
{
|
{
|
||||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
Skip = message;
|
Skip = message;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
|
||||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Xunit.Sdk;
|
using Xunit.v3;
|
||||||
|
|
||||||
namespace Avalonia.UnitTests;
|
namespace Avalonia.UnitTests;
|
||||||
|
|
||||||
@@ -21,9 +21,9 @@ public sealed class InvariantCultureAttribute : BeforeAfterTestAttribute
|
|||||||
private CultureInfo? _previousCulture;
|
private CultureInfo? _previousCulture;
|
||||||
private CultureInfo? _previousUICulture;
|
private CultureInfo? _previousUICulture;
|
||||||
|
|
||||||
public override void Before(MethodInfo methodUnderTest)
|
public override void Before(MethodInfo methodUnderTest, IXunitTest test)
|
||||||
{
|
{
|
||||||
base.Before(methodUnderTest);
|
base.Before(methodUnderTest, test);
|
||||||
|
|
||||||
_previousCulture = CultureInfo.CurrentCulture;
|
_previousCulture = CultureInfo.CurrentCulture;
|
||||||
_previousUICulture = CultureInfo.CurrentUICulture;
|
_previousUICulture = CultureInfo.CurrentUICulture;
|
||||||
@@ -32,11 +32,11 @@ public sealed class InvariantCultureAttribute : BeforeAfterTestAttribute
|
|||||||
CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;
|
CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void After(MethodInfo methodUnderTest)
|
public override void After(MethodInfo methodUnderTest, IXunitTest test)
|
||||||
{
|
{
|
||||||
CultureInfo.CurrentCulture = _previousCulture!;
|
CultureInfo.CurrentCulture = _previousCulture!;
|
||||||
CultureInfo.CurrentUICulture = _previousUICulture!;
|
CultureInfo.CurrentUICulture = _previousUICulture!;
|
||||||
|
|
||||||
base.After(methodUnderTest);
|
base.After(methodUnderTest, test);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,15 @@ namespace Avalonia.UnitTests
|
|||||||
|
|
||||||
public override void RegisterServices()
|
public override void RegisterServices()
|
||||||
{
|
{
|
||||||
|
// Arrange (as part of layouting) calls TaskScheduler.FromCurrentSynchronizationContext, which needs a non-null context.
|
||||||
|
// If it's null, it will fail. So we need to ensure it's not null.
|
||||||
|
// Historically, this line wasn't needed because xunit itself used to always install its own SynchronizationContext.
|
||||||
|
// This was changed in xunit.v3.
|
||||||
|
if (SynchronizationContext.Current is null)
|
||||||
|
{
|
||||||
|
SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
|
||||||
|
}
|
||||||
|
|
||||||
AvaloniaLocator.CurrentMutable
|
AvaloniaLocator.CurrentMutable
|
||||||
.Bind<IAssetLoader?>().ToConstant(Services.AssetLoader)
|
.Bind<IAssetLoader?>().ToConstant(Services.AssetLoader)
|
||||||
.Bind<IGlobalClock?>().ToConstant(Services.GlobalClock)
|
.Bind<IGlobalClock?>().ToConstant(Services.GlobalClock)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Xunit.Sdk;
|
using Xunit.v3;
|
||||||
|
|
||||||
namespace Avalonia.UnitTests;
|
namespace Avalonia.UnitTests;
|
||||||
|
|
||||||
@@ -16,9 +16,9 @@ public sealed class UseEmptyDesignatorCultureAttribute : BeforeAfterTestAttribut
|
|||||||
private CultureInfo CultureInfo { get; } =
|
private CultureInfo CultureInfo { get; } =
|
||||||
new(string.Empty, false) { DateTimeFormat = { AMDesignator = string.Empty, PMDesignator = string.Empty } };
|
new(string.Empty, false) { DateTimeFormat = { AMDesignator = string.Empty, PMDesignator = string.Empty } };
|
||||||
|
|
||||||
public override void Before(MethodInfo methodUnderTest)
|
public override void Before(MethodInfo methodUnderTest, IXunitTest test)
|
||||||
{
|
{
|
||||||
base.Before(methodUnderTest);
|
base.Before(methodUnderTest, test);
|
||||||
|
|
||||||
_previousCulture = CultureInfo.CurrentCulture;
|
_previousCulture = CultureInfo.CurrentCulture;
|
||||||
_previousUICulture = CultureInfo.CurrentUICulture;
|
_previousUICulture = CultureInfo.CurrentUICulture;
|
||||||
@@ -27,11 +27,11 @@ public sealed class UseEmptyDesignatorCultureAttribute : BeforeAfterTestAttribut
|
|||||||
CultureInfo.CurrentUICulture = CultureInfo;
|
CultureInfo.CurrentUICulture = CultureInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void After(MethodInfo methodUnderTest)
|
public override void After(MethodInfo methodUnderTest, IXunitTest test)
|
||||||
{
|
{
|
||||||
CultureInfo.CurrentCulture = _previousCulture!;
|
CultureInfo.CurrentCulture = _previousCulture!;
|
||||||
CultureInfo.CurrentUICulture = _previousUICulture!;
|
CultureInfo.CurrentUICulture = _previousUICulture!;
|
||||||
|
|
||||||
base.After(methodUnderTest);
|
base.After(methodUnderTest, test);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ using System.Reflection;
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Sdk;
|
using Xunit.v3;
|
||||||
|
|
||||||
namespace Avalonia.UnitTests;
|
namespace Avalonia.UnitTests;
|
||||||
|
|
||||||
public sealed class VerifyEmptyDispatcherAfterTestAttribute : BeforeAfterTestAttribute
|
public sealed class VerifyEmptyDispatcherAfterTestAttribute : BeforeAfterTestAttribute
|
||||||
{
|
{
|
||||||
public override void After(MethodInfo methodUnderTest)
|
public override void After(MethodInfo methodUnderTest, IXunitTest test)
|
||||||
{
|
{
|
||||||
if (typeof(ScopedTestBase).IsAssignableFrom(methodUnderTest.DeclaringType))
|
if (typeof(ScopedTestBase).IsAssignableFrom(methodUnderTest.DeclaringType))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -3,5 +3,10 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<EnableNETAnalyzers>false</EnableNETAnalyzers>
|
<EnableNETAnalyzers>false</EnableNETAnalyzers>
|
||||||
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||||
|
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="2.0.2" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user