Browse Source

Added Test If Correct Layer Suffix is set

CPKreuz 4 years ago
parent
commit
f5a95dbefd
1 changed files with 22 additions and 0 deletions
  1. 22 0
      PixiEditorTests/ModelsTests/DataHoldersTests/DocumentTests.cs

+ 22 - 0
PixiEditorTests/ModelsTests/DataHoldersTests/DocumentTests.cs

@@ -3,6 +3,7 @@ using System.Windows.Media;
 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;
@@ -306,5 +307,26 @@ namespace PixiEditorTests.ModelsTests.DataHoldersTests
 
             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);
+        }
     }
 }