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: keep captured frames alive while saving; no trim in the test host (diagnostic)

KnifeLemonc6cff354b7f1
diff --git a/tests/Filee.App.Tests/DonutLabelPlacementTests.cs b/tests/Filee.App.Tests/DonutLabelPlacementTests.cs
index 1ebbce2a..5933004c 100644
--- a/tests/Filee.App.Tests/DonutLabelPlacementTests.cs
+++ b/tests/Filee.App.Tests/DonutLabelPlacementTests.cs
@@ -45,7 +45,8 @@ public class DonutLabelPlacementTests
AvaloniaHeadlessPlatform.ForceRenderTimerTick();
}
- var (pixels, width, height) = Read(window.CaptureRenderedFrame()!);
+ using var frame = window.CaptureRenderedFrame()!;
+ var (pixels, width, height) = Read(frame);
var origin = donut.TranslatePoint(new Point(0, 0), window)!.Value;
var center = new Point(origin.X + donut.Bounds.Width / 2, origin.Y + donut.Bounds.Height / 2);
var labelRadius = (OuterRadius + OuterRadius * HoleRatio) / 2;
diff --git a/tests/Filee.App.Tests/DonutProgressTests.cs b/tests/Filee.App.Tests/DonutProgressTests.cs
index 8a58a721..ba92aa30 100644
--- a/tests/Filee.App.Tests/DonutProgressTests.cs
+++ b/tests/Filee.App.Tests/DonutProgressTests.cs
@@ -150,7 +150,7 @@ public class DonutProgressTests
{
Dispatcher.UIThread.RunJobs();
AvaloniaHeadlessPlatform.ForceRenderTimerTick();
- var frame = window.CaptureRenderedFrame()!;
+ using var frame = window.CaptureRenderedFrame()!;
using var stream = File.Create(Path.Combine(TestServices.ScreenshotDirectory, name));
frame.Save(stream, new PngBitmapEncoderOptions());
}
diff --git a/tests/Filee.App.Tests/GroupEditorTests.cs b/tests/Filee.App.Tests/GroupEditorTests.cs
index c0a744af..75ea8cb3 100644
--- a/tests/Filee.App.Tests/GroupEditorTests.cs
+++ b/tests/Filee.App.Tests/GroupEditorTests.cs
@@ -167,7 +167,7 @@ public class GroupEditorTests
Dispatcher.UIThread.RunJobs();
AvaloniaHeadlessPlatform.ForceRenderTimerTick();
}
- var frame = window.CaptureRenderedFrame();
+ using var frame = window.CaptureRenderedFrame();
Assert.NotNull(frame);
using (var stream = File.Create(Path.Combine(TestServices.ScreenshotDirectory, $"group-editor-{language}.png")))
frame.Save(stream, new Avalonia.Media.Imaging.PngBitmapEncoderOptions());
diff --git a/tests/Filee.App.Tests/RenderTests.cs b/tests/Filee.App.Tests/RenderTests.cs
index aabfe58b..15a56a69 100644
--- a/tests/Filee.App.Tests/RenderTests.cs
+++ b/tests/Filee.App.Tests/RenderTests.cs
@@ -1121,7 +1121,9 @@ public class RenderTests
private static void Save(TopLevel window, string name)
{
- var frame = window.CaptureRenderedFrame();
+ // Disposed at the end, so the frame stays alive while Skia encodes it: a collection in between (the idle memory
+ // trim runs one on another thread) would otherwise finalize its image under the encoder.
+ using var frame = window.CaptureRenderedFrame();
Assert.NotNull(frame);
using var stream = File.Create(Path.Combine(TestServices.ScreenshotDirectory, name));
frame.Save(stream, new Avalonia.Media.Imaging.PngBitmapEncoderOptions());
diff --git a/tests/Filee.App.Tests/TestApp.cs b/tests/Filee.App.Tests/TestApp.cs
index dc0a3187..f667c961 100644
--- a/tests/Filee.App.Tests/TestApp.cs
+++ b/tests/Filee.App.Tests/TestApp.cs
@@ -41,6 +41,8 @@ internal static class TestServices
{
AppHost.Build(DataDirectory);
AppHost.Get<UserDataStore>().Load();
+ // DIAGNOSTIC (CI crash in RenderTests): no idle memory trim in the shared test host.
+ AppHost.Get<Filee.App.Services.MemoryTrimmer>().Dispose();
AppHost.Get<LocalizationService>().Attach(app);
_initializedFor = app;
}