Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do a full overhaul of our tests in Avalonia #422

Open
wants to merge 17 commits into
base: Avalonia
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,32 @@ jobs:
Windows:
imageName: 'windows-latest'
targetFramework: 'net8.0-windows'
displayName: Build & Test
displayName: Build & Maybe Test
pool:
vmImage: $(imageName)
steps:
- checkout: self
clean: true

- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: $(Build.SourcesDirectory)/src/SerialLoops/SerialLoops.csproj
arguments: -f $(targetFramework)
displayName: Build project

- pwsh: |
Invoke-WebRequest -Uri https://haroohie.nyc3.cdn.digitaloceanspaces.com/bootstrap/serial-loops/test-assets.zip -OutFile $(Build.ArtifactStagingDirectory)/test-assets.zip
Expand-Archive -Path $(Build.ArtifactStagingDirectory)/test-assets.zip -DestinationPath $(Build.ArtifactStagingDirectory)/test-assets
displayName: Download test assets

- task: DotNetCoreCLI@2
inputs:
command: 'test'
projects: $(Build.SourcesDirectory)/test/SerialLoops.Tests.Headless/SerialLoops.Tests.Headless.csproj
arguments: -f $(targetFramework)
arguments: -f $(targetFramework) --filter "Name !~ BackgroundMusicEditor_ReplacementAndRestoreWork"
publishTestResults: true
env:
ROM_URI: $(ChokuRomUri)
displayName: Run tests
ASSETS_DIRECTORY: $(Build.ArtifactStagingDirectory)/test-assets/
displayName: Run tests
condition: eq(variables.imageName, 'windows-latest')
2 changes: 0 additions & 2 deletions src/SerialLoops.Lib/Factories/ConfigFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
using System.Globalization;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text.Json;
using DynamicData.Binding;
using HaruhiChokuretsuLib.Util;

namespace SerialLoops.Lib.Factories;
Expand Down
3 changes: 1 addition & 2 deletions src/SerialLoops.Lib/Items/ItemDescription.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using HaruhiChokuretsuLib.Archive.Event;
using ReactiveUI;
Expand Down
2 changes: 1 addition & 1 deletion src/SerialLoops.Lib/Items/PuzzleItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ public override void Refresh(Project project, ILogger log)
"KOIZUMI",
"ANY",
];
}
}
1 change: 0 additions & 1 deletion src/SerialLoops.Lib/Items/ScriptItem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using HaruhiChokuretsuLib.Archive.Data;
using HaruhiChokuretsuLib.Archive.Event;
Expand Down
8 changes: 4 additions & 4 deletions src/SerialLoops.Lib/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public partial class Project
[JsonIgnore]
public string ProjectFile => Path.Combine(MainDirectory, $"{Name}.{PROJECT_FORMAT}");
[JsonIgnore]
public Config Config { get; private set; }
public Config Config { get; set; }
[JsonIgnore]
public ProjectSettings Settings { get; set; }
[JsonIgnore]
Expand Down Expand Up @@ -1003,9 +1003,9 @@ public static (Project Project, LoadProjectResult Result) OpenProject(string pro
}
return (project, result);
}
catch (Exception exc)
catch (Exception ex)
{
log.LogError($"Error while loading project: {exc.Message}\n\n{exc.StackTrace}");
log.LogException(localize("Error while loading project"), ex);
return (null, new(LoadProjectState.FAILED));
}
}
Expand Down Expand Up @@ -1328,4 +1328,4 @@ private bool ScriptIsInEpisode(ScriptItem script, int scenarioEpIndex, int scena

[GeneratedRegex(@"\((?<num>\d+)\)")]
private static partial Regex ProjectNameAppendedNumber();
}
}
4 changes: 2 additions & 2 deletions src/SerialLoops.Lib/Script/ScriptItemCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ private static List<ScriptParameter> GetScriptParameters(ScriptCommandInvocation
}
break;
case CommandVerb.SCENE_GOTO:
case CommandVerb.SCENE_GOTO2:
case CommandVerb.SCENE_GOTO_CHESS:
if (i == 0)
{
parameters.Add(new ConditionalScriptParameter(localize("Scene"), eventFile.ConditionalsSection.Objects[parameter]));
Expand Down Expand Up @@ -750,4 +750,4 @@ public ScriptItemCommand Clone()
};
}

}
}
6 changes: 3 additions & 3 deletions src/SerialLoops.Lib/SerialLoops.Lib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

<ItemGroup>
<PackageReference Include="BunLabs.NAudio.Flac" Version="2.0.1" />
<PackageReference Include="HarfBuzzSharp.NativeAssets.Linux" Version="7.3.0.2" />
<PackageReference Include="HarfBuzzSharp.NativeAssets.macOS" Version="7.3.0.2" />
<PackageReference Include="HaruhiChokuretsuLib" Version="0.43.0" />
<PackageReference Include="HarfBuzzSharp.NativeAssets.Linux" Version="7.3.0.3" />
<PackageReference Include="HarfBuzzSharp.NativeAssets.macOS" Version="7.3.0.3" />
<PackageReference Include="HaruhiChokuretsuLib" Version="0.44.0" />
<PackageReference Include="NAudio.Vorbis" Version="1.5.0" />
<PackageReference Include="NitroPacker.Core" Version="2.5.1" />
<PackageReference Include="NLayer" Version="1.16.0" />
Expand Down
4 changes: 2 additions & 2 deletions src/SerialLoops.Lib/Util/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static string GetOriginalString(this string line, Project project)
public static void CollectGarbage(this EventFile evt)
{
// Collect conditional garbage
IEnumerable<string> conditionalContainingCommands = new[] { CommandVerb.VGOTO, CommandVerb.SCENE_GOTO, CommandVerb.SCENE_GOTO2 }.Select(c => c.ToString());
IEnumerable<string> conditionalContainingCommands = new[] { CommandVerb.VGOTO, CommandVerb.SCENE_GOTO, CommandVerb.SCENE_GOTO_CHESS }.Select(c => c.ToString());
List<UsedIndex> conditionalUsedIndices = [];
foreach (ScriptCommandInvocation conditionalCommand in evt.ScriptSections.SelectMany(s => s.Objects).Where(c => conditionalContainingCommands.Contains(c.Command.Mnemonic)))
{
Expand Down Expand Up @@ -294,4 +294,4 @@ public override SKColor Read(ref Utf8JsonReader reader, Type typeToConvert, Json
}

public override void Write(Utf8JsonWriter writer, SKColor value, JsonSerializerOptions options) => writer.WriteStringValue($"{value.Alpha:X2}{value.Red:X2}{value.Green:X2}{value.Blue:X2}");
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Linq;
using NAudio.Wave;

// Adapted from https://github.com/naudio/NAudio.WaveFormRenderer/blob/master/WaveFormRendererLib/MaxPeakProvider.cs
// Copyright (c) 2021 NAudio
Expand Down
78 changes: 48 additions & 30 deletions src/SerialLoops/Assets/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/SerialLoops/Assets/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2641,4 +2641,10 @@ No project is currently open. Would you like to create a new project?</value>
<data name="Load Sound" xml:space="preserve">
<value>Load Sound</value><comment>The name of a parameter for the SND_PLAY command which indicates whether a sound should be loaded or not</comment>
</data>
<data name="&quot;Failed to open log file directly. Logs can be found at {0}&quot;" xml:space="preserve">
<value>"Failed to open log file directly. Logs can be found at {0}"</value>
</data>
<data name="Error while loading project" xml:space="preserve">
<value>Error while loading project</value>
</data>
</root>
2 changes: 1 addition & 1 deletion src/SerialLoops/Controls/ItemLink.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
xmlns:controls="using:SerialLoops.Controls"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SerialLoops.Controls.ItemLink">
<controls:LinkButton Name="Link" OnClick="Link_PointerPressed" Text="NONE" />
<controls:LinkButton Name="Link" Text="NONE" />
</UserControl>
Loading