Skip to content

Commit

Permalink
Fixed tests syntax err
Browse files Browse the repository at this point in the history
  • Loading branch information
flabbet committed Feb 20, 2022
1 parent 54ab3c5 commit c1c3858
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
46 changes: 23 additions & 23 deletions PixiEditorTests/ModelsTests/DataHoldersTests/LayerStructureTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class LayerStructureTests
public void TestThatAddNewGroupAddsNewGroup()
{
Document doc = new Document(1, 1);
doc.Layers.Add(new("_testLayer"));
doc.Layers.Add(new("_testLayer", 1, 1));
var testLayer = doc.Layers[^1];
doc.LayerStructure.AddNewGroup("test", testLayer.GuidValue);

Expand All @@ -24,7 +24,7 @@ public void TestThatAddNewGroupAddsNewGroup()
public void TestThatAddNewGroupAddsNewGroupAsASubgroup()
{
Document doc = new Document(1, 1);
doc.Layers.Add(new("_testLayer"));
doc.Layers.Add(new("_testLayer", 1, 1));
var testLayer = doc.Layers[^1];
doc.LayerStructure.AddNewGroup("test", testLayer.GuidValue);
doc.LayerStructure.AddNewGroup("test1", testLayer.GuidValue);
Expand All @@ -41,8 +41,8 @@ public void TestThatAddNewGroupAddsNewGroupAsASubgroup()
public void TestThatMoveGroupMovesSwapsLayerPlacesWithOtherGroup()
{
Document doc = new Document(1, 1);
doc.Layers.Add(new Layer("_testLayer"));
doc.Layers.Add(new Layer("_testLayer1"));
doc.Layers.Add(new Layer("_testLayer", 1, 1));
doc.Layers.Add(new Layer("_testLayer1", 1, 1));
var testLayer = doc.Layers[0];
var testLayer1 = doc.Layers[^1];
doc.LayerStructure.AddNewGroup("test", testLayer.GuidValue);
Expand All @@ -61,7 +61,7 @@ public void TestThatMoveGroupMovesSwapsLayerPlacesWithOtherGroup()
public void TestThatIsChildOfDetectsNestedGroupCorrectly()
{
LayerStructure ls = new LayerStructure(new Document(1, 1));
Layer testLayer = new Layer("tst");
Layer testLayer = new Layer("tst", 1, 1);
ls.Groups.Add(new GuidStructureItem("group 1", testLayer.GuidValue));
ls.Groups[0].Subgroups.Add(new GuidStructureItem("group 1 nested", testLayer.GuidValue));

Expand All @@ -73,7 +73,7 @@ public void TestThatIsChildOfDetectsNestedGroupCorrectly()
public void TestThatIsChildOfDetectsNestedLayersCorrectly()
{
var doc = new Document(1, 1);
doc.Layers.Add(new Layer("tst"));
doc.Layers.Add(new Layer("tst", 1, 1));
Guid testLayerGuid = doc.Layers[0].GuidValue;
LayerStructure ls = new LayerStructure(doc);
ls.AddNewGroup("Test group", testLayerGuid);
Expand All @@ -87,7 +87,7 @@ public void TestThatIsChildOfDetectsNestedLayersCorrectly()
public void TestThatGroupContainsOnlyLayerDetectsOnlySingleLayerCorrectly()
{
var doc = new Document(1, 1);
doc.Layers.Add(new Layer("layer"));
doc.Layers.Add(new Layer("layer", 1, 1));
var guid = doc.Layers[0].GuidValue;
doc.LayerStructure.AddNewGroup("layer group", guid);
Assert.True(LayerStructure.GroupContainsOnlyLayer(guid, doc.LayerStructure.Groups[0]));
Expand All @@ -97,7 +97,7 @@ public void TestThatGroupContainsOnlyLayerDetectsOnlySingleLayerCorrectly()
public void TestThatGroupContainsOnlyLayerDetectsOnlySingleLayerThatIsNested()
{
var doc = new Document(1, 1);
doc.Layers.Add(new Layer("layer"));
doc.Layers.Add(new Layer("layer", 1, 1));
var guid = doc.Layers[0].GuidValue;
doc.LayerStructure.AddNewGroup("layer group", guid);
doc.LayerStructure.AddNewGroup("layer group nested", guid);
Expand All @@ -109,8 +109,8 @@ public void TestThatGroupContainsOnlyLayerDetectsOnlySingleLayerThatIsNested()
public void TestThatCloneReturnsSameLayerStructure()
{
Document doc = new(1, 1);
doc.Layers.Add(new("Test"));
doc.Layers.Add(new("Test2"));
doc.Layers.Add(new("Test", 1, 1));
doc.Layers.Add(new("Test2", 1, 1));
LayerStructure structure = new(doc);
structure.AddNewGroup("Test group", doc.Layers[0].GuidValue);

Expand All @@ -125,7 +125,7 @@ public void TestThatCloneReturnsSameLayerStructure()
public void TestThatGetGroupByGuidReturnsNullForNonExistingGroup()
{
Document doc = new(1, 1);
doc.Layers.Add(new("Test"));
doc.Layers.Add(new("Test", 1, 1));

Assert.Null(doc.LayerStructure.GetGroupByGuid(null));
Assert.Null(doc.LayerStructure.GetGroupByGuid(Guid.NewGuid()));
Expand All @@ -135,7 +135,7 @@ public void TestThatGetGroupByGuidReturnsNullForNonExistingGroup()
public void TestThatGetGroupByGuidReturnsGroupCorrectly()
{
Document doc = new(1, 1);
doc.Layers.Add(new("Test"));
doc.Layers.Add(new("Test", 1, 1));
var group = doc.LayerStructure.AddNewGroup("Test group", doc.Layers[0].GuidValue);

Assert.Equal(group.GroupGuid, doc.LayerStructure.GetGroupByGuid(group.GroupGuid).GroupGuid);
Expand All @@ -145,7 +145,7 @@ public void TestThatGetGroupByGuidReturnsGroupCorrectly()
public void TestThatPreMoveReassignBoundsMakesNestedGroupEmptyAndRemovesItAndParent()
{
Document doc = new(1, 1);
doc.Layers.Add(new("Test"));
doc.Layers.Add(new("Test", 1, 1));
doc.LayerStructure.AddNewGroup("Test group", doc.Layers[0].GuidValue);
var group1 = doc.LayerStructure.AddNewGroup("Test group nested", doc.Layers[0].GuidValue);

Expand All @@ -158,11 +158,11 @@ public void TestThatPreMoveReassignBoundsMakesNestedGroupEmptyAndRemovesItAndPar
public void TestThatPostMoveReassignBoundsAssignsNewLayerToGroup()
{
Document doc = new(1, 1);
doc.Layers.Add(new("Test"));
doc.Layers.Add(new("Test", 1, 1));
doc.LayerStructure.AddNewGroup("Test group", doc.Layers[0].GuidValue);
var group1 = doc.LayerStructure.AddNewGroup("Test group nested", doc.Layers[0].GuidValue);

doc.Layers.Add(new("Test 1"));
doc.Layers.Add(new("Test 1", 1, 1));

var firstLayer = doc.Layers[0];
var layer = doc.Layers[^1];
Expand All @@ -181,13 +181,13 @@ public void TestThatPostMoveReassignBoundsAssignsNewLayerToGroup()
public void TestThatAssignParentAssignsParent()
{
Document doc = new(1, 1);
doc.Layers.Add(new Layer("Test"));
doc.Layers.Add(new Layer("Test", 1, 1));

var firstLayer = doc.Layers[0];

doc.LayerStructure.AddNewGroup("Test group", doc.Layers[0].GuidValue);

doc.Layers.Add(new Layer("Test 1"));
doc.Layers.Add(new Layer("Test 1", 1, 1));

var layer = doc.Layers[^1];

Expand All @@ -201,13 +201,13 @@ public void TestThatAssignParentAssignsParent()
public void TestThatAssignParentDeAssignsParentOnNull()
{
Document doc = new(1, 1);
doc.Layers.Add(new Layer("Test"));
doc.Layers.Add(new Layer("Test", 1, 1));

var firstLayer = doc.Layers[0];

doc.LayerStructure.AddNewGroup("Test group", doc.Layers[0].GuidValue);

doc.Layers.Add(new Layer("Test 1"));
doc.Layers.Add(new Layer("Test 1", 1, 1));

var layer = doc.Layers[^1];

Expand All @@ -222,10 +222,10 @@ public void TestThatAssignParentDeAssignsParentOnNull()
public void TestThatGetGroupLayersReturnsAllLayersInGroup()
{
Document doc = new(1, 1);
doc.Layers.Add(new Layer("Test"));
doc.Layers.Add(new Layer("Test 1"));
doc.Layers.Add(new Layer("Test 2"));
doc.Layers.Add(new Layer("Test 3"));
doc.Layers.Add(new Layer("Test", 1, 1));
doc.Layers.Add(new Layer("Test 1", 1, 1));
doc.Layers.Add(new Layer("Test 2", 1, 1));
doc.Layers.Add(new Layer("Test 3", 1, 1));
doc.LayerStructure.AddNewGroup("Test group", doc.Layers[0].GuidValue);

doc.LayerStructure.AssignParent(doc.Layers[1].GuidValue, doc.LayerStructure.Groups[0].GroupGuid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class SelectionTests
[Fact]
public void TestThatSetSelectionNewSetsCorrectSelection()
{
Selection selection = new Selection(Array.Empty<Coordinates>());
Selection selection = new Selection(Array.Empty<Coordinates>(), new (10, 10));
Coordinates[] points = { new Coordinates(0, 0), new Coordinates(1, 1) };

selection.SetSelection(points, SelectionType.New);
Expand All @@ -25,7 +25,7 @@ public void TestThatSetSelectionNewSetsCorrectSelection()
[Fact]
public void TestThatSetSelectionAddSetsCorrectSelection()
{
Selection selection = new Selection(Array.Empty<Coordinates>());
Selection selection = new Selection(Array.Empty<Coordinates>(), new PixelSize(10, 10));
Coordinates[] points = { new Coordinates(0, 0), new Coordinates(1, 1) };
Coordinates[] points2 = { new Coordinates(2, 4), new Coordinates(5, 7) };

Expand All @@ -38,7 +38,7 @@ public void TestThatSetSelectionAddSetsCorrectSelection()
[Fact]
public void TestThatSetSelectionSubtractSetsCorrectSelection()
{
Selection selection = new Selection(Array.Empty<Coordinates>());
Selection selection = new Selection(Array.Empty<Coordinates>(), new PixelSize(10, 10));
Coordinates[] points = { new Coordinates(0, 0), new Coordinates(1, 1) };
Coordinates[] points2 = { new Coordinates(1, 1) };

Expand All @@ -51,7 +51,7 @@ public void TestThatSetSelectionSubtractSetsCorrectSelection()
[Fact]
public void TestClearWorks()
{
Selection selection = new Selection(new[] { new Coordinates(0, 0), new Coordinates(5, 7) });
Selection selection = new Selection(new[] { new Coordinates(0, 0), new Coordinates(5, 7) }, new PixelSize(10, 10));
selection.Clear();

Assert.Empty(selection.SelectedPoints);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public Document GenerateTestDocument()
Random random = new Random();
testDocument.Layers = new WpfObservableRangeCollection<Layer>()
{
new Layer("Test layer" + random.Next(int.MinValue, int.MaxValue), testBitmap),
new Layer("Test layer 2" + random.Next(int.MinValue, int.MaxValue), testBitmap2) { Offset = new System.Windows.Thickness(2, 3, 0, 0) }
new Layer("Test layer" + random.Next(int.MinValue, int.MaxValue), testBitmap, testDocument.Width, testDocument.Height),
new Layer("Test layer 2" + random.Next(int.MinValue, int.MaxValue), testBitmap2, testDocument.Width, testDocument.Height) { Offset = new System.Windows.Thickness(2, 3, 0, 0) }
};
return testDocument;
}
Expand Down

0 comments on commit c1c3858

Please sign in to comment.