Skip to content

Commit

Permalink
adds a strings test
Browse files Browse the repository at this point in the history
  • Loading branch information
stakira committed Aug 3, 2024
1 parent 69d7ecd commit 1b6e333
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
32 changes: 30 additions & 2 deletions OpenUtau.Test/App/AppTest.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,39 @@
using Xunit;
using Avalonia;
using Avalonia.Headless;
using Avalonia.Styling;
using OpenUtau.App;

[assembly: AvaloniaTestApplication(typeof(TestAppBuilder))]

public class TestAppBuilder {
public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure<App>()
.UseHeadless(new AvaloniaHeadlessPlatformOptions());
}

namespace OpenUtau.App {
public class AppTest {
[Fact]
public void BuildTest() {
Assert.False(typeof(OpenUtau.App.App).IsAbstract);
Assert.False(typeof(OpenUtau.App.Program).IsAbstract);
Assert.False(typeof(App).IsAbstract);
Assert.False(typeof(Program).IsAbstract);
}

[Fact]
public void StringsTest() {
var appBuilder = TestAppBuilder.BuildAvaloniaApp()
.SetupWithoutStarting();
var app = appBuilder.Instance as App;
Assert.NotNull(app);

var languages = App.GetLanguages();
Assert.True(languages.Count > 1);
Assert.Contains("en-US", languages.Keys);
Assert.Contains("zh-CN", languages.Keys);
Assert.Contains("ja-JP", languages.Keys);
foreach (var pair in languages) {
Assert.NotNull(pair.Value);
}
}
}
}
1 change: 1 addition & 0 deletions OpenUtau.Test/OpenUtau.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Headless.XUnit" Version="11.0.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" />
Expand Down

0 comments on commit 1b6e333

Please sign in to comment.