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.

Engine update notice test: dispose the captured frame

KnifeLemon8d28ae076fdc
diff --git a/tests/Filee.App.Tests/EngineUpdateTests.cs b/tests/Filee.App.Tests/EngineUpdateTests.cs
index b36e2fe9..bc4120d5 100644
--- a/tests/Filee.App.Tests/EngineUpdateTests.cs
+++ b/tests/Filee.App.Tests/EngineUpdateTests.cs
@@ -52,10 +52,19 @@ public class EngineUpdateTests
var updated = 0;
var notice = new EngineUpdateNoticeWindow("FFmpeg 8.0 · LibreOffice 26.8", () => updated++);
notice.Show();
- Avalonia.Threading.Dispatcher.UIThread.RunJobs();
+ for (var i = 0; i < 40; i++)
+ {
+ Avalonia.Threading.Dispatcher.UIThread.RunJobs();
+ AvaloniaHeadlessPlatform.ForceRenderTimerTick();
+ }
- var frame = notice.CaptureRenderedFrame();
- frame?.Save(Path.Combine(TestServices.ScreenshotDirectory, "engine-update-notice-ko.png"));
+ // Disposed here: a frame left to the finalizer crashed the test process on Windows (0xC0000005).
+ using (var frame = notice.CaptureRenderedFrame())
+ {
+ Assert.NotNull(frame);
+ using var stream = File.Create(Path.Combine(TestServices.ScreenshotDirectory, "engine-update-notice-ko.png"));
+ frame.Save(stream, new Avalonia.Media.Imaging.PngBitmapEncoderOptions());
+ }
var update = notice.GetVisualDescendants().OfType<Avalonia.Controls.Button>()
.First(b => b.Classes.Contains("accent"));
update.RaiseEvent(new Avalonia.Interactivity.RoutedEventArgs(Avalonia.Controls.Button.ClickEvent));