Skip to content

Commit

Permalink
Added Test If Correct Layer Suffix is set
Browse files Browse the repository at this point in the history
  • Loading branch information
CPKreu committed Mar 13, 2021
1 parent 7cbca3d commit f5a95db
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions PixiEditorTests/ModelsTests/DataHoldersTests/DocumentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using PixiEditor.Models.Controllers;
using PixiEditor.Models.DataHolders;
using PixiEditor.Models.Enums;
using PixiEditor.Models.Layers;
using PixiEditor.Models.Position;
using PixiEditor.ViewModels;
using Xunit;
Expand Down Expand Up @@ -306,5 +307,26 @@ public void TestThatDocumentGetsAddedToRecentlyOpenedList()

Assert.Contains(viewModel.FileSubViewModel.RecentlyOpened, x => x == testFilePath);
}

[Fact]
public void TestThatCorrectLayerSuffixIsSet()
{
const string layerName = "New Layer";

Document document = new (10, 10);

document.AddNewLayer(layerName);
document.AddNewLayer(layerName);
document.AddNewLayer(layerName);

Assert.Equal(layerName, document.Layers[0].Name);
Assert.Equal(layerName + " (1)", document.Layers[1].Name);
Assert.Equal(layerName + " (2)", document.Layers[2].Name);

document.Layers.Add(new Layer(layerName + " (15)"));
document.AddNewLayer(layerName);

Assert.Equal(layerName + " (16)", document.Layers[4].Name);
}
}
}

0 comments on commit f5a95db

Please sign in to comment.