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.

Toolbar test: find the delete dialog's default button through the zoom wrapper

KnifeLemon32744140c649
diff --git a/tests/Filee.App.Tests/ToolbarEditorTests.cs b/tests/Filee.App.Tests/ToolbarEditorTests.cs
index a82346f1..b6f417cb 100644
--- a/tests/Filee.App.Tests/ToolbarEditorTests.cs
+++ b/tests/Filee.App.Tests/ToolbarEditorTests.cs
@@ -1553,8 +1553,8 @@ public class ToolbarPaletteModelTests
var delete = vm.DeleteProfileCommand.ExecuteAsync(null);
Dispatcher.UIThread.RunJobs();
var dialog = Assert.Single(windows.Main!.OwnedWindows);
- var button = ((StackPanel)dialog.Content!).Children.OfType<StackPanel>()
- .Single().Children.OfType<Button>().Single(b => b.IsDefault);
+ // Found wherever it sits: the window zoom wraps a dialog's content.
+ var button = dialog.GetVisualDescendants().OfType<Button>().Single(b => b.IsDefault);
button.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
await delete.WaitAsync(TimeSpan.FromSeconds(5), TestContext.Current.CancellationToken);
Assert.False(vm.HasJudgement(original.Id, "test-jpg"));