forked from ElectronNET/Electron.NET
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathScreenTests.cs
More file actions
84 lines (76 loc) · 2.73 KB
/
ScreenTests.cs
File metadata and controls
84 lines (76 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
namespace ElectronNET.IntegrationTests.Tests
{
using System.Runtime.Versioning;
using ElectronNET.API;
using ElectronNET.API.Entities;
using ElectronNET.IntegrationTests.Common;
[Collection("ElectronCollection")]
public class ScreenTests
{
// ReSharper disable once NotAccessedField.Local
private readonly ElectronFixture fx;
public ScreenTests(ElectronFixture fx)
{
this.fx = fx;
}
[SkipOnWslFact(Timeout = 20000)]
public async Task Primary_display_has_positive_dimensions()
{
var display = await Electron.Screen.GetPrimaryDisplayAsync();
display.Size.Width.Should().BeGreaterThan(0);
display.Size.Height.Should().BeGreaterThan(0);
}
[SkipOnWslFact(Timeout = 20000)]
public async Task GetAllDisplays_returns_at_least_one()
{
var displays = await Electron.Screen.GetAllDisplaysAsync();
displays.Should().NotBeNull();
displays.Length.Should().BeGreaterThan(0);
}
[Fact(Timeout = 20000)]
public async Task GetCursorScreenPoint_check()
{
var point = await Electron.Screen.GetCursorScreenPointAsync();
point.Should().NotBeNull();
}
[SkippableFact(Timeout = 20000)]
[SupportedOSPlatform("macOS")]
public async Task GetMenuBarWorkArea_check()
{
var area = await Electron.Screen.GetMenuBarWorkAreaAsync();
area.Should().NotBeNull();
area.X.Should().BeGreaterThanOrEqualTo(0);
area.Y.Should().BeGreaterThanOrEqualTo(0);
area.Height.Should().BeGreaterThan(0);
area.Width.Should().BeGreaterThan(0);
}
[SkipOnWslFact(Timeout = 20000)]
public async Task GetDisplayNearestPoint_check()
{
var point = new Point
{
X = 100,
Y = 100
};
var display = await Electron.Screen.GetDisplayNearestPointAsync(point);
display.Should().NotBeNull();
display.Size.Width.Should().BeGreaterThan(0);
display.Size.Height.Should().BeGreaterThan(0);
}
[SkipOnWslFact(Timeout = 20000)]
public async Task GetDisplayMatching_check()
{
var rectangle = new Rectangle
{
X = 100,
Y = 100,
Width = 100,
Height = 100
};
var display = await Electron.Screen.GetDisplayMatchingAsync(rectangle);
display.Should().NotBeNull();
display.Size.Width.Should().BeGreaterThan(0);
display.Size.Height.Should().BeGreaterThan(0);
}
}
}