Skip to content

Commit 347c1ef

Browse files
committed
Show_hide_visibility_roundtrip: Don't use shared window
1 parent 7c8eeef commit 347c1ef

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,28 @@ public async Task Can_set_and_get_content_bounds()
8282
[Fact(Timeout = 20000)]
8383
public async Task Show_hide_visibility_roundtrip()
8484
{
85-
this.fx.MainWindow.Show();
86-
await Task.Delay(500);
87-
(await this.fx.MainWindow.IsVisibleAsync()).Should().BeTrue();
88-
this.fx.MainWindow.Hide();
89-
await Task.Delay(500);
90-
(await this.fx.MainWindow.IsVisibleAsync()).Should().BeFalse();
85+
BrowserWindow window = null;
86+
87+
try
88+
{
89+
window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = true }, "about:blank");
90+
91+
await Task.Delay(100);
92+
93+
window.Show();
94+
95+
await Task.Delay(500);
96+
(await window.IsVisibleAsync()).Should().BeTrue();
97+
98+
window.Hide();
99+
await Task.Delay(500);
100+
101+
(await window.IsVisibleAsync()).Should().BeFalse();
102+
}
103+
finally
104+
{
105+
window?.Destroy();
106+
}
91107
}
92108

93109
[Fact(Timeout = 20000)]

0 commit comments

Comments
 (0)