Skip to content

Commit

Permalink
test: assert icons are generated only once
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpinedam committed Feb 9, 2025
1 parent c09181c commit 8a4e6a8
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/Resizetizer/test/UnitTests/ResizetizeImagesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,38 @@ public void ColorsInCssCanBeUsed()

AssertFileContains("not_working.scale-100.png", 0xFF71559B, 2, 6);
}

[Theory]
[InlineData("android")]
[InlineData("uwp")]
[InlineData("ios")]
[InlineData("wasm")]
[InlineData("wpf")]
public void GenerationSkippedOnIncrementalBuild(string platform)
{
var items = new[]
{
new TaskItem("images/dotnet_logo.svg", new Dictionary<string, string>
{
["IsAppIcon"] = bool.TrueString,
["ForegroundFile"] = $"images/dotnet_foreground.svg",
["Link"] = "appicon",
["BackgroundFile"] = $"images/dotnet_background.svg",
}),
};

var task = GetNewTask(platform, items);
var success = task.Execute();
Assert.True(success, LogErrorEvents.FirstOrDefault()?.Message);

LogErrorEvents.Clear();
LogMessageEvents.Clear();
task = GetNewTask(platform, items);
success = task.Execute();
Assert.True(success, LogErrorEvents.FirstOrDefault()?.Message);

Assert.True(LogMessageEvents.Any(x => x.Message.Contains("Skipping ", StringComparison.OrdinalIgnoreCase)), $"Image generation should have been skipped.");
}
}

public class ExecuteForAny : ExecuteForApp
Expand Down

0 comments on commit 8a4e6a8

Please sign in to comment.