public void TestUndoThrowsExcpOnEmpty()
        {
            var hk = new HistoryKeeper <int>(0);

            Assert.Throws <EmptyHistoryException>(() => hk.GoBack());
            hk.Do(4);
            hk.GoBack();
            Assert.Throws <EmptyHistoryException>(() => hk.GoBack());
        }
        public void TestRedoClearsOnDo()
        {
            var hk = new HistoryKeeper <int>(0);

            hk.Do(4);
            hk.Do(4);
            hk.GoBack();
            hk.Do(5);
            Assert.Throws <EmptyHistoryException>(() => hk.GoForward());
        }
        public void TestUndoNormal()
        {
            var hk = new HistoryKeeper <int>(0);

            hk.Do(4);
            Assert.AreEqual(0, hk.GoBack());

            hk.Do(1);
            hk.Do(2);
            hk.Do(3);
            Assert.AreEqual(2, hk.GoBack());
            Assert.AreEqual(1, hk.GoBack());
            Assert.AreEqual(0, hk.GoBack());
        }
        public void TestRedoNormal()
        {
            var hk = new HistoryKeeper <int>(0);

            hk.Do(4);
            hk.GoBack();
            Assert.AreEqual(4, hk.GoForward());
            hk.Do(1);
            hk.Do(2);
            hk.Do(3);
            hk.GoBack();
            hk.GoBack();
            Assert.AreEqual(2, hk.GoForward());
            Assert.AreEqual(3, hk.GoForward());
            hk.GoBack();
            Assert.AreEqual(3, hk.GoForward());
        }
예제 #5
0
        public HSREraseTile(HistoryKeeper parent, IntVector2 tileLocation)
            : base(parent)
        {
            location = tileLocation;

            var tileCheck = MapManager.singleton.GetTileAt(tileLocation);

            if (tileCheck != null)
            {
                //MapManager.BrushType oldType = tileCheck.GetComponent<TileListener>().
                oldPrefab = MapManager.singleton.GetTilePrefabForType(MapManager.BrushType.TILE); //TODO: make this consider terrain types/ animated types etc.
                oldSwatch = tileCheck.GetComponent <TileListener>().swatchData;
            }
            else
            {
                oldPrefab = null;
            }
        }
예제 #6
0
        public HSRDrawTile(HistoryKeeper parent, ColorPickerPopup.SwatchData swatch, IntVector2 tileLocation, GameObject prefab)
            : base(parent)
        {
            newSwatch = swatch;
            location  = tileLocation;
            newPrefab = prefab;

            var tileCheck = MapManager.singleton.GetTileAt(tileLocation);

            if (tileCheck != null)
            {
                oldPrefab = newPrefab; //TODO: make this consider terrain types/ animated types etc.
                oldSwatch = tileCheck.GetComponent <TileListener>().swatchData;
            }
            else
            {
                oldPrefab = null;
            }
        }
        public void TestRedoThrowsExcpOnEmpty()
        {
            var hk = new HistoryKeeper <int>(0);

            Assert.Throws <EmptyHistoryException>(() => hk.GoForward());
            hk.Do(4);
            Assert.Throws <EmptyHistoryException>(() => hk.GoForward());
            hk.GoBack();
            hk.GoForward();
            Assert.Throws <EmptyHistoryException>(() => hk.GoForward());
            hk.Do(1);
            hk.Do(2);
            hk.Do(3);
            hk.GoBack();
            hk.GoBack();
            Assert.AreEqual(2, hk.GoForward());
            Assert.AreEqual(3, hk.GoForward());
            hk.GoBack();
            Assert.AreEqual(3, hk.GoForward());
        }
예제 #8
0
 public FtpFileManager(Folder root, Ftp client)
 {
     Client      = client;
     CurrentPath = root.Path;
     History     = new HistoryKeeper <Folder>(root);
 }
예제 #9
0
 public WinFileManager(Folder root)
 {
     CurrentPath = root.Path;
     History     = new HistoryKeeper <Folder>(root);
 }
예제 #10
0
 //public properties
 public HistoryStackRecord(HistoryKeeper parent)
 {
     historyKeeper = parent;
 }
예제 #11
0
 public HSRBatchEnd(HistoryKeeper parent)
     : base(parent)
 {
 }
예제 #12
0
 public HSRBatchBegin(HistoryKeeper parent)
     : base(parent)
 {
 }