public void TestThatPopChangesPopsChanges() { PixelChangesController controller = CreateBasicController().Item2; System.Tuple <LayerChange, LayerChange>[] changes = controller.PopChanges(); Assert.NotEmpty(changes); Assert.Null(controller.PopChanges()); }
private static PixelChangesController CreateBasicController() { Coordinates[] cords = { new Coordinates(0, 0), new Coordinates(1, 1) }; PixelChangesController controller = new PixelChangesController(); controller.AddChanges(new LayerChange( BitmapPixelChanges.FromSingleColoredArray(cords, Colors.Black), 0), new LayerChange(BitmapPixelChanges.FromSingleColoredArray(cords, Colors.Transparent), 0)); return(controller); }
private static Tuple <Guid, PixelChangesController> CreateBasicController() { Coordinates[] cords = { new Coordinates(0, 0), new Coordinates(1, 1) }; PixelChangesController controller = new PixelChangesController(); Guid guid = Guid.NewGuid(); controller.AddChanges( new LayerChange( BitmapPixelChanges.FromSingleColoredArray(cords, Colors.Black), guid), new LayerChange(BitmapPixelChanges.FromSingleColoredArray(cords, Colors.Transparent), guid)); return(new Tuple <Guid, PixelChangesController>(guid, controller)); }
public void TestThatAddChangesAddsToExistingChange() { Coordinates[] cords2 = { new Coordinates(2, 2), new Coordinates(5, 5) }; var data = CreateBasicController(); PixelChangesController controller = data.Item2; controller.AddChanges( new LayerChange( BitmapPixelChanges.FromSingleColoredArray(cords2, Colors.Black), data.Item1), new LayerChange(BitmapPixelChanges.FromSingleColoredArray(cords2, Colors.Transparent), data.Item1)); Tuple <LayerChange, LayerChange>[] changes = controller.PopChanges(); Assert.Single(changes); Assert.Equal(4, changes[0].Item1.PixelChanges.ChangedPixels.Count); Assert.Equal(4, changes[0].Item2.PixelChanges.ChangedPixels.Count); }
public void TestThatAddChangesAddsAsNewChange() { var data = CreateBasicController(); PixelChangesController controller = data.Item2; Coordinates[] cords = { new Coordinates(5, 3), new Coordinates(7, 2) }; Guid guid = Guid.NewGuid(); controller.AddChanges( new LayerChange( BitmapPixelChanges.FromSingleColoredArray(cords, Colors.Black), guid), new LayerChange(BitmapPixelChanges.FromSingleColoredArray(cords, Colors.Transparent), guid)); System.Tuple <LayerChange, LayerChange>[] changes = controller.PopChanges(); Assert.Equal(2, changes.Length); }