Exemplo n.º 1
0
        public void TestPixelRegistering()
        {
            // Create the tracker
            PixelHistoryTracker tracker = new PixelHistoryTracker(true, 12);

            // Add the pixels
            tracker.RegisterPixel(5, 5, 0xFF, 0x1F);

            var undo = tracker.PixelUndoForPixel(5, 5);

            Assert.IsTrue(undo != null && undo.Value.OldColor == 0xFF, "The returned PixelUndo does not contains the undo color that was expected");
        }
Exemplo n.º 2
0
        public void TestDuplicatedPixelUncheckedRegisteringReplaceOriginal()
        {
            // Create the tracker
            PixelHistoryTracker tracker = new PixelHistoryTracker(false, 12);

            // Add the pixels
            tracker.RegisterUncheckedPixel(5, 5, 0xFF, 0x1F);
            tracker.RegisterUncheckedPixel(5, 5, 0xEF, 0x2F);
            tracker.RegisterUncheckedPixel(5, 5, 0xCF, 0x3F);

            var undo = tracker.PixelUndoForPixel(5, 5);

            Assert.IsTrue(undo != null && undo.Value.OldColor == 0xCF,
                          "The returned PixelUndo does not contains the undo color that was expected. The pixel color must match the color of the last pixel registered RegisterPixel");
        }
Exemplo n.º 3
0
        public void TestClearing()
        {
            // Create the tracker
            PixelHistoryTracker tracker = new PixelHistoryTracker(false, 12);

            // Add the pixels
            tracker.RegisterPixel(5, 5, 0xFF, 0x1F);
            tracker.RegisterPixel(6, 5, 0xEF, 0x2F);
            tracker.RegisterPixel(7, 5, 0xCF, 0x3F);

            tracker.Clear();

            var undo = tracker.PixelUndoForPixel(5, 5);

            Assert.IsNull(undo, "After a call to .Clear(), all pixels that were previously stored must be cleared off the PixelHistoryTracker");
        }