Skip to content

Commit ad31bd5

Browse files
authored
Merge pull request #3 from NickvisionApps/fix/platforms
V2026.1.3
2 parents 797c5fb + c683522 commit ad31bd5

45 files changed

Lines changed: 1119 additions & 1148 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Nickvision.Desktop.GNOME/Nickvision.Desktop.GNOME.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<ItemGroup>
2525
<PackageReference Include="GirCore.Adw-1" Version="0.7.0" />
26-
<PackageReference Include="Nickvision.Desktop" Version="2026.1.1" />
26+
<PackageReference Include="Nickvision.Desktop" Version="2026.1.2" />
2727
</ItemGroup>
2828

2929
<ItemGroup>

Nickvision.Desktop.Tests/DatabaseKeyringServiceTests.cs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,41 +17,21 @@ public sealed class DatabaseKeyringServiceTests
1717
[TestMethod]
1818
public void Case001_Init()
1919
{
20-
#if OS_LINUX
21-
if (global::System.Environment.GetEnvironmentVariable("CI") == "true")
22-
{
23-
Assert.Inconclusive("Dialogs are not supported in CI environments");
24-
}
25-
#endif
26-
#pragma warning disable CA1416
2720
_keyringService = new DatabaseKeyringService(new AppInfo("org.nickvision.desktop.test", "Nickvision.Desktop.Test", "Test"), new SystemSecretService());
28-
#pragma warning restore CA1416
2921
Assert.IsNotNull(_keyringService);
3022
Assert.IsTrue(_keyringService.IsSavingToDisk);
3123
}
3224

3325
[TestMethod]
3426
public void Case002_Check()
3527
{
36-
#if OS_LINUX
37-
if (global::System.Environment.GetEnvironmentVariable("CI") == "true")
38-
{
39-
Assert.Inconclusive("Dialogs are not supported in CI environments");
40-
}
41-
#endif
4228
Assert.IsNotNull(_keyringService);
4329
Assert.IsTrue(_keyringService.IsSavingToDisk);
4430
}
4531

4632
[TestMethod]
4733
public async Task Case003_Add()
4834
{
49-
#if OS_LINUX
50-
if (global::System.Environment.GetEnvironmentVariable("CI") == "true")
51-
{
52-
Assert.Inconclusive("Dialogs are not supported in CI environments");
53-
}
54-
#endif
5535
Assert.IsNotNull(_keyringService);
5636
Assert.IsTrue(await _keyringService.AddCredentialAsync(new Credential("YouTube", "abc", "123", new Uri("https://www.youtube.com"))));
5737
Assert.IsNotNull(_keyringService.Credentials.FirstOrDefault(c => c.Name == "YouTube"));
@@ -61,12 +41,6 @@ public async Task Case003_Add()
6141
[TestMethod]
6242
public async Task Case004_Update()
6343
{
64-
#if OS_LINUX
65-
if (global::System.Environment.GetEnvironmentVariable("CI") == "true")
66-
{
67-
Assert.Inconclusive("Dialogs are not supported in CI environments");
68-
}
69-
#endif
7044
Assert.IsNotNull(_keyringService);
7145
Assert.IsTrue(await _keyringService.AddCredentialAsync(new Credential("Google", "[email protected]", "asdfgh123!", new Uri("https://www.google.com"))));
7246
var cred = _keyringService.Credentials.FirstOrDefault(c => c.Name == "Google");
@@ -81,12 +55,6 @@ public async Task Case004_Update()
8155
[TestMethod]
8256
public async Task Case005_Remove()
8357
{
84-
#if OS_LINUX
85-
if (global::System.Environment.GetEnvironmentVariable("CI") == "true")
86-
{
87-
Assert.Inconclusive("Dialogs are not supported in CI environments");
88-
}
89-
#endif
9058
Assert.IsNotNull(_keyringService);
9159
Assert.IsTrue(await _keyringService.AddCredentialAsync(new Credential("Example", "user1", "pass1", new Uri("https://www.example.com"))));
9260
var cred = _keyringService.Credentials.FirstOrDefault(c => c.Name == "Example");
@@ -98,12 +66,6 @@ public async Task Case005_Remove()
9866
[TestMethod]
9967
public async Task Case006_Cleanup()
10068
{
101-
#if OS_LINUX
102-
if (global::System.Environment.GetEnvironmentVariable("CI") == "true")
103-
{
104-
Assert.Inconclusive("Dialogs are not supported in CI environments");
105-
}
106-
#endif
10769
Assert.IsNotNull(_keyringService);
10870
Assert.IsTrue(await _keyringService.DestroyAsync());
10971
Assert.IsFalse(_keyringService.Credentials.Any());

Nickvision.Desktop.Tests/EnvironmentTests.cs

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Nickvision.Desktop.System;
22
using System.IO;
33
using System.Linq;
4+
using Environment = Nickvision.Desktop.System.Environment;
45

56
namespace Nickvision.Desktop.Tests;
67

@@ -16,11 +17,7 @@ public sealed class EnvironmentTests
1617
[TestMethod]
1718
public void Case003_GlobalDependency()
1819
{
19-
#if OS_WINDOWS
20-
const string dependency = "cmd.exe";
21-
#else
22-
const string dependency = "ls";
23-
#endif
20+
var dependency = global::System.OperatingSystem.IsWindows() ? "cmd.exe" : "ls";
2421
var path = Environment.FindDependency(dependency);
2522
Assert.IsFalse(string.IsNullOrEmpty(path));
2623
Assert.IsTrue(File.Exists(path));
@@ -29,11 +26,7 @@ public void Case003_GlobalDependency()
2926
[TestMethod]
3027
public void Case004_AppDependency()
3128
{
32-
#if OS_WINDOWS
33-
const string dependency = "cmd.exe";
34-
#else
35-
const string dependency = "ls";
36-
#endif
29+
var dependency = global::System.OperatingSystem.IsWindows() ? "cmd.exe" : "ls";
3730
var path = Environment.FindDependency(dependency, DependencySearchOption.App);
3831
Assert.IsTrue(string.IsNullOrEmpty(path));
3932
Assert.IsFalse(File.Exists(path));
@@ -42,11 +35,7 @@ public void Case004_AppDependency()
4235
[TestMethod]
4336
public void Case005_SystemDependency()
4437
{
45-
#if OS_WINDOWS
46-
const string dependency = "cmd.exe";
47-
#else
48-
const string dependency = "ls";
49-
#endif
38+
var dependency = global::System.OperatingSystem.IsWindows() ? "cmd.exe" : "ls";
5039
var path = Environment.FindDependency(dependency, DependencySearchOption.System);
5140
Assert.IsFalse(string.IsNullOrEmpty(path));
5241
Assert.IsTrue(File.Exists(path));
@@ -55,11 +44,7 @@ public void Case005_SystemDependency()
5544
[TestMethod]
5645
public void Case006_LocalDependency()
5746
{
58-
#if OS_WINDOWS
59-
const string dependency = "cmd.exe";
60-
#else
61-
const string dependency = "ls";
62-
#endif
47+
var dependency = global::System.OperatingSystem.IsWindows() ? "cmd.exe" : "ls";
6348
var path = Environment.FindDependency(dependency, DependencySearchOption.Local);
6449
Assert.IsTrue(string.IsNullOrEmpty(path));
6550
Assert.IsFalse(File.Exists(path));

Nickvision.Desktop.Tests/GitHubUpdaterServiceTests.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void Case001_Initialize()
3636
{
3737
if (Environment.GetEnvironmentVariable("CI") == "true")
3838
{
39-
Assert.Inconclusive("Dialogs are not supported in CI environments");
39+
Assert.Inconclusive("Update service is not supported in CI environments");
4040
}
4141
Assert.IsNotNull(_client);
4242
_updaterService = new GitHubUpdaterService(new AppInfo("org.nickvision.tubeconverter", "Nickvision Parabolic", "Parabolic")
@@ -52,7 +52,7 @@ public async Task Case002_CheckForStableUpdates()
5252
{
5353
if (Environment.GetEnvironmentVariable("CI") == "true")
5454
{
55-
Assert.Inconclusive("Dialogs are not supported in CI environments");
55+
Assert.Inconclusive("Update service is not supported in CI environments");
5656
}
5757
Assert.IsNotNull(_updaterService);
5858
var version = await _updaterService.GetLatestStableVersionAsync();
@@ -65,7 +65,7 @@ public async Task Case003_CheckForPreviewUpdates()
6565
{
6666
if (Environment.GetEnvironmentVariable("CI") == "true")
6767
{
68-
Assert.Inconclusive("Dialogs are not supported in CI environments");
68+
Assert.Inconclusive("Update service is not supported in CI environments");
6969
}
7070
Assert.IsNotNull(_updaterService);
7171
var version = await _updaterService.GetLatestPreviewVersionAsync();
@@ -78,7 +78,7 @@ public async Task Case004_CompareVersions()
7878
{
7979
if (Environment.GetEnvironmentVariable("CI") == "true")
8080
{
81-
Assert.Inconclusive("Dialogs are not supported in CI environments");
81+
Assert.Inconclusive("Update service is not supported in CI environments");
8282
}
8383
Assert.IsNotNull(_updaterService);
8484
var preview = await _updaterService.GetLatestPreviewVersionAsync();
@@ -93,7 +93,7 @@ public async Task Case005_Ytdlp()
9393
{
9494
if (Environment.GetEnvironmentVariable("CI") == "true")
9595
{
96-
Assert.Inconclusive("Dialogs are not supported in CI environments");
96+
Assert.Inconclusive("Update service is not supported in CI environments");
9797
}
9898
Assert.IsNotNull(_client);
9999
var updateService = new GitHubUpdaterService("yt-dlp", "yt-dlp", _client);
@@ -102,19 +102,21 @@ public async Task Case005_Ytdlp()
102102
Assert.IsTrue(stable >= new AppVersion("2025.12.08"));
103103
}
104104

105-
#if OS_WINDOWS
106105
[TestMethod]
107106
public async Task Check006_WindowsUpdate()
108107
{
108+
if (!global::System.OperatingSystem.IsWindows())
109+
{
110+
Assert.Inconclusive("This test only runs on Windows");
111+
}
109112
if (Environment.GetEnvironmentVariable("CI") == "true")
110113
{
111-
Assert.Inconclusive("Dialogs are not supported in CI environments");
114+
Assert.Inconclusive("Update service is not supported in CI environments");
112115
}
113116
Assert.IsNotNull(_updaterService);
114117
var version = await _updaterService.GetLatestStableVersionAsync();
115118
Assert.IsNotNull(version);
116119
Assert.IsTrue(version > new Version("2025.10.0"));
117120
Assert.IsTrue(await _updaterService.WindowsUpdate(version));
118121
}
119-
#endif
120122
}

Nickvision.Desktop.Tests/Nickvision.Desktop.Tests.csproj

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@
88
<Nullable>enable</Nullable>
99
</PropertyGroup>
1010

11-
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
12-
<DefineConstants>OS_WINDOWS</DefineConstants>
13-
</PropertyGroup>
14-
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
15-
<DefineConstants>OS_LINUX</DefineConstants>
16-
</PropertyGroup>
17-
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
18-
<DefineConstants>OS_MAC</DefineConstants>
19-
</PropertyGroup>
20-
2111
<ItemGroup>
2212
<PackageReference Include="MSTest" Version="4.0.2"/>
2313
</ItemGroup>

Nickvision.Desktop.Tests/NotificationServiceTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Nickvision.Desktop.Application;
22
using Nickvision.Desktop.Filesystem;
33
using Nickvision.Desktop.Notifications;
4+
using System.Threading.Tasks;
45

56
namespace Nickvision.Desktop.Tests;
67

@@ -17,10 +18,10 @@ public void Case001_Initialize()
1718
}
1819

1920
[TestMethod]
20-
public void Case002_SendShell()
21+
public async Task Case002_SendShell()
2122
{
2223
Assert.IsNotNull(_notificationService);
23-
Assert.IsTrue(_notificationService.Send(new ShellNotification("Test Notification", "This is a test notification body.", NotificationSeverity.Information)
24+
Assert.IsTrue(await _notificationService.SendAsync(new ShellNotification("Test Notification", "This is a test notification body.", NotificationSeverity.Information)
2425
{
2526
Action = "open",
2627
ActionParam = UserDirectories.Home

Nickvision.Desktop.Tests/PowerServiceTests.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,27 @@ public void Case001_Initialize()
1818
[TestMethod]
1919
public async Task Case002_PreventSuspend()
2020
{
21-
#if OS_LINUX
22-
if (global::System.Environment.GetEnvironmentVariable("CI") == "true")
21+
if (global::System.OperatingSystem.IsLinux())
2322
{
24-
Assert.Inconclusive("org.freedesktop.ScreenSaver service not available in CI environments");
23+
if (global::System.Environment.GetEnvironmentVariable("CI") == "true")
24+
{
25+
Assert.Inconclusive("org.freedesktop.ScreenSaver service not available in CI environments");
26+
}
2527
}
26-
#endif
2728
Assert.IsNotNull(_powerService);
2829
Assert.IsTrue(await _powerService.PreventSuspendAsync());
2930
}
3031

3132
[TestMethod]
3233
public async Task Case003_AllowSuspend()
3334
{
34-
#if OS_LINUX
35-
if (global::System.Environment.GetEnvironmentVariable("CI") == "true")
35+
if (global::System.OperatingSystem.IsLinux())
3636
{
37-
Assert.Inconclusive("org.freedesktop.ScreenSaver service not available in CI environments");
37+
if (global::System.Environment.GetEnvironmentVariable("CI") == "true")
38+
{
39+
Assert.Inconclusive("org.freedesktop.ScreenSaver service not available in CI environments");
40+
}
3841
}
39-
#endif
4042
Assert.IsNotNull(_powerService);
4143
Assert.IsTrue(await _powerService.AllowSuspendAsync());
4244
}

0 commit comments

Comments
 (0)