예제 #1
0
        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);
        }
예제 #3
0
        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));
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }