mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-09-21 14:35:16 +00:00
GetSetZoomLevel: Don't use shared window
Because we need a visible window and the main window visibility must not be mutated by tests
This commit is contained in:
@@ -97,14 +97,32 @@ namespace ElectronNET.IntegrationTests.Tests
|
||||
[SkippableFact(Timeout = 20000)]
|
||||
public async Task GetSetZoomLevel_check()
|
||||
{
|
||||
Skip.If(Environment.GetEnvironmentVariable("GITHUB_RUN_ID") != null && RuntimeInformation.IsOSPlatform(OSPlatform.Windows), "Skipping test on Windows CI.");
|
||||
await fx.MainWindow.WebContents.GetZoomLevelAsync();
|
||||
var ok = await fx.MainWindow.WebContents.GetZoomLevelAsync();
|
||||
ok.Should().Be(0);
|
||||
fx.MainWindow.WebContents.SetZoomLevel(2);
|
||||
await Task.Delay(500);
|
||||
ok = await fx.MainWindow.WebContents.GetZoomLevelAsync();
|
||||
ok.Should().Be(2);
|
||||
BrowserWindow window = null;
|
||||
|
||||
try
|
||||
{
|
||||
////Skip.If(Environment.GetEnvironmentVariable("GITHUB_RUN_ID") != null && RuntimeInformation.IsOSPlatform(OSPlatform.Windows), "Skipping test on Windows CI.");
|
||||
|
||||
window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Show = true }, "about:blank");
|
||||
|
||||
await Task.Delay(100);
|
||||
|
||||
window.WebContents.SetZoomLevel(0);
|
||||
await Task.Delay(500);
|
||||
|
||||
var ok = await window.WebContents.GetZoomLevelAsync();
|
||||
ok.Should().Be(0);
|
||||
|
||||
window.WebContents.SetZoomLevel(2);
|
||||
await Task.Delay(500);
|
||||
|
||||
ok = await window.WebContents.GetZoomLevelAsync();
|
||||
ok.Should().Be(2);
|
||||
}
|
||||
finally
|
||||
{
|
||||
window?.Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
[SkippableFact(Timeout = 20000)]
|
||||
|
||||
Reference in New Issue
Block a user