-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #257 from unoplatform/pj/svg-clean-up-improvements
Svg clean up improvements
- Loading branch information
Showing
5 changed files
with
76 additions
and
21 deletions.
There are no files selected for viewing
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/Resizetizer/test/UnitTests/RemoveSvgFromContentTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
using Xunit; | ||
|
||
namespace Uno.Resizetizer.Tests | ||
{ | ||
public class RemoveSvgFromContentTests : MSBuildTaskTestFixture<RemoveSvgFromContentTask_v0> | ||
{ | ||
RemoveSvgFromContentTask_v0 GetNewTask(ITaskItem[] collectionToRemove, ITaskItem[] unoImages) | ||
{ | ||
return new() | ||
{ | ||
CollectionToRemove = collectionToRemove, | ||
UnoImages = unoImages | ||
}; | ||
} | ||
|
||
|
||
[Fact] | ||
public void RemoveSvgContentIfItIsUnoImage() | ||
{ | ||
var assetPath = "Assets/Icons/back.svg"; | ||
var unoImage = new TaskItem(assetPath); | ||
var content = new TaskItem(assetPath); | ||
|
||
var task = GetNewTask(new[] { content }, new[] { unoImage }); | ||
|
||
var success = task.Execute(); | ||
|
||
|
||
Assert.True(success); | ||
Assert.True(task.RemovedItems.Length > 0); | ||
} | ||
|
||
[Fact] | ||
public void DoNotRemoveSvgIfHasSameNameButInDifferentLocation() | ||
{ | ||
var unoImage = new TaskItem("Assets/Icons/back.svg"); | ||
var content = new TaskItem("Assets/SVG/back.svg"); | ||
|
||
var task = GetNewTask(new[] { content }, new[] { unoImage }); | ||
|
||
var success = task.Execute(); | ||
|
||
|
||
Assert.True(success); | ||
Assert.True(task.RemovedItems.Length is 0); | ||
} | ||
} | ||
} |