Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Tests that switch the animation setting run on their own and set it themselves

KnifeLemon0ce7a2a888a2
diff --git a/tests/Filee.App.Tests/DonutHighlightTests.cs b/tests/Filee.App.Tests/DonutHighlightTests.cs
index e8aa0f72..3f87cc13 100644
--- a/tests/Filee.App.Tests/DonutHighlightTests.cs
+++ b/tests/Filee.App.Tests/DonutHighlightTests.cs
@@ -9,6 +9,7 @@ using Filee.App.Controls;
namespace Filee.App.Tests;
+[Collection("Motion")]
public class DonutHighlightTests
{
[AvaloniaFact]
@@ -50,6 +51,8 @@ public class DonutHighlightTests
window.Show();
Dispatcher.UIThread.RunJobs();
+ // Animations on, whatever the machine reports (build servers report Windows animations off).
+ Filee.App.Services.Motion.Configure(false, () => false);
donut.PlayOpenAnimation(); // the render timer never ticks in this test: every frame request is lost
Assert.Equal(0, Open(donut).Max());
// The watchdog's checks, each after the loop got no frame for a while: two retries, then the donut is drawn open.
@@ -88,7 +91,7 @@ public class DonutHighlightTests
Assert.Equal(0, donut.LitAmount(1), 3);
}
- [Fact]
+ [AvaloniaFact] // switching the setting restyles the open windows, which belong to the UI thread
public void Following_the_system_reads_it_again_when_a_window_opens()
{
var reduced = true;
@@ -117,3 +120,10 @@ public class DonutHighlightTests
private static void Set(DonutMenu donut, string field, object value) =>
typeof(DonutMenu).GetField(field, BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(donut, value);
}
+
+/// <summary>
+/// Tests that switch the global animation setting (<see cref="Filee.App.Services.Motion"/>) run on their own: run next
+/// to others, the app's start-up in those would switch it back halfway through.
+/// </summary>
+[CollectionDefinition("Motion", DisableParallelization = true)]
+public sealed class MotionCollection;
diff --git a/tests/Filee.App.Tests/DonutProgressTests.cs b/tests/Filee.App.Tests/DonutProgressTests.cs
index 39af024a..8a58a721 100644
--- a/tests/Filee.App.Tests/DonutProgressTests.cs
+++ b/tests/Filee.App.Tests/DonutProgressTests.cs
@@ -10,6 +10,7 @@ using Filee.App.Services;
namespace Filee.App.Tests;
+[Collection("Motion")]
public class DonutProgressTests
{
private const double Frame = 1 / 60.0;