예제 #1
0
        public void TestEndGroup()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);

            Assert.Throws<InvalidOperationException>(() =>
            {
                urr.EndGroup();
            });
        }
예제 #2
0
        public void TestPopRecordFromUndoStorage00()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);

            Assert.Throws<InvalidOperationException>(() =>
            {
                urr.PopRecordFromUndoStorage();
            });
        }
예제 #3
0
        public void TestRecordEdgeCreationForUndo01()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);

            Assert.Throws<ArgumentException>(() =>
            {
                urr.BeginGroup();
                urr.RecordEdgeCreationForUndo(null);
            });
        }
예제 #4
0
        public void TestRecordEdgeCreationForUndo00()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);
            EdgeController edgeController = new EdgeController(graphController);

            List<IVisualEdge> edgeList = new List<IVisualEdge>();
            VisualEdge edge = new VisualEdge(edgeController, EdgeType.ExplicitConnection);
            edgeList.Add(edge);

            Assert.Throws<InvalidOperationException>(() =>
            {
                urr.RecordEdgeCreationForUndo(edgeList);
            });
        }
예제 #5
0
        public void TestUndo()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);

            DeltaNodes deltaNodes = new DeltaNodes();
            bool result = urr.Undo(deltaNodes);
            Assert.AreEqual(false, result);
        }
예제 #6
0
        public void TestRecordRuntimeStatesForUndo00()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);
            RuntimeStates runtimeStates = new RuntimeStates();

            Assert.Throws<InvalidOperationException>(() =>
            {
                urr.RecordRuntimeStatesForUndo(runtimeStates);
            });
        }
예제 #7
0
        public void TestRecordNodeModificationForUndo02()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);

            urr.BeginGroup();
            urr.RecordNodeModificationForUndo(new List<IVisualNode>());
            Assert.AreEqual(0, urr.ActionCount);
        }
예제 #8
0
        public void TestRecordNodeModficationForUndo00()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);

            List<IVisualNode> nodeList = new List<IVisualNode>();
            DriverNode node = new DriverNode(graphController);
            nodeList.Add(node);

            Assert.Throws<InvalidOperationException>(() =>
            {
                urr.RecordNodeModificationForUndo(nodeList);
            });
        }
예제 #9
0
        public void TestRecordNodeDeletionForUndo01()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);

            urr.BeginGroup();
            urr.RecordNodeDeletionForUndo(null);
            Assert.AreEqual(0, urr.ActionCount);
        }
예제 #10
0
        public void TestRecordEdgeModificationForUndo02()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);

            Assert.Throws<ArgumentException>(() =>
            {
                urr.BeginGroup();
                urr.RecordEdgeModificationForUndo(new List<IVisualEdge>());
            });
        }
예제 #11
0
        private void InitializeInternal(IGraphVisualHost visualHost)
        {
            //The identity of this graph controller
            this.Identifier = GraphController.identifierCounter++;

            //Optional Object
            this.visualHost = visualHost;

            //Essential Object
            this.edgeController = new EdgeController(this);
            this.graphProperties = new GraphProperties();
            this.undoRedoRecorder = new UndoRedoRecorder(this);

            DrawingVisual visual = new DrawingVisual();
            this.selectionBox = new SelectionBox(this, this.visualHost);

            // Create a timer for auto-saving in the background.
            this.autoSaveTimer = new DispatcherTimer();
            this.autoSaveTimer.Interval = TimeSpan.FromSeconds(58);
            this.autoSaveTimer.Tick += OnAutoSaveTimerTicked;
        }