2024-10-19 23:50:41 +02:00
|
|
|
namespace IntroSkipper.Tests;
|
2022-11-06 21:25:23 -06:00
|
|
|
|
2024-10-19 23:50:41 +02:00
|
|
|
using IntroSkipper.Data;
|
2022-11-06 21:25:23 -06:00
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
public class TestFlags
|
|
|
|
{
|
|
|
|
[Fact]
|
|
|
|
public void TestEmptyFlagSerialization()
|
|
|
|
{
|
|
|
|
WarningManager.Clear();
|
|
|
|
Assert.Equal("None", WarningManager.GetWarnings());
|
|
|
|
}
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
public void TestSingleFlagSerialization()
|
|
|
|
{
|
|
|
|
WarningManager.Clear();
|
|
|
|
WarningManager.SetFlag(PluginWarning.UnableToAddSkipButton);
|
|
|
|
Assert.Equal("UnableToAddSkipButton", WarningManager.GetWarnings());
|
2024-08-31 16:48:31 +00:00
|
|
|
Assert.True(WarningManager.HasFlag(PluginWarning.UnableToAddSkipButton));
|
2022-11-06 21:25:23 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
public void TestDoubleFlagSerialization()
|
|
|
|
{
|
|
|
|
WarningManager.Clear();
|
|
|
|
WarningManager.SetFlag(PluginWarning.UnableToAddSkipButton);
|
|
|
|
WarningManager.SetFlag(PluginWarning.InvalidChromaprintFingerprint);
|
|
|
|
WarningManager.SetFlag(PluginWarning.InvalidChromaprintFingerprint);
|
2024-08-31 16:48:31 +00:00
|
|
|
Assert.True(WarningManager.HasFlag(PluginWarning.UnableToAddSkipButton) && WarningManager.HasFlag(PluginWarning.InvalidChromaprintFingerprint));
|
2022-11-06 21:25:23 -06:00
|
|
|
Assert.Equal(
|
|
|
|
"UnableToAddSkipButton, InvalidChromaprintFingerprint",
|
|
|
|
WarningManager.GetWarnings());
|
|
|
|
}
|
2024-08-31 16:48:31 +00:00
|
|
|
|
|
|
|
[Fact]
|
|
|
|
public void TestHasFlag()
|
|
|
|
{
|
|
|
|
WarningManager.Clear();
|
|
|
|
Assert.True(WarningManager.HasFlag(PluginWarning.None));
|
|
|
|
Assert.False(WarningManager.HasFlag(PluginWarning.UnableToAddSkipButton) && WarningManager.HasFlag(PluginWarning.InvalidChromaprintFingerprint));
|
|
|
|
WarningManager.SetFlag(PluginWarning.UnableToAddSkipButton);
|
|
|
|
WarningManager.SetFlag(PluginWarning.InvalidChromaprintFingerprint);
|
|
|
|
Assert.True(WarningManager.HasFlag(PluginWarning.UnableToAddSkipButton) && WarningManager.HasFlag(PluginWarning.InvalidChromaprintFingerprint));
|
|
|
|
Assert.False(WarningManager.HasFlag(PluginWarning.IncompatibleFFmpegBuild));
|
|
|
|
Assert.True(WarningManager.HasFlag(PluginWarning.None));
|
|
|
|
}
|
2022-11-06 21:25:23 -06:00
|
|
|
}
|