상속: ICommandUndoRedoText
예제 #1
0
        public void ApproveAndMoveNext_NewWordGloss()
        {
#if WANTPORTWFIC // Undo is not working. The part of the test up to Undo works, but leaves extra things on the Undo stack
            // that mess things up when this test is run first (NUnit) though not when run last (Resharper).
            var xfics = AnnotationServices.GetAnalysisOccurrences(m_para0_0).ToList();
            m_interlinDoc.SelectAnnotation(xfics[0]);
            var initialAnalysisTree_wfic0 = m_focusBox.InitialAnalysis;
            var newAnalysisTree_wfic0     = m_focusBox.NewAnalysisTree;
            m_focusBox.DoDuringUnitOfWork = () =>
                                            WordAnalysisOrGlossServices.CreateNewAnalysisTreeGloss(initialAnalysisTree_wfic0.Wordform);
            var undoRedoText = new MockUndoRedoText("Undo", "Redo");
            m_focusBox.ApproveAndMoveNext(undoRedoText);

            // expect change to the first wfic.
            Assert.AreEqual(newAnalysisTree_wfic0.Gloss, xfics[0].Analysis);
            // expect the focus box to be on the next wfic.
            Assert.AreEqual(xfics[1], m_focusBox.SelectedWfic);

            // test undo.
            Assert.AreEqual(1, Cache.ActionHandlerAccessor.UndoableSequenceCount);
            Cache.ActionHandlerAccessor.Undo();
            Assert.AreEqual(initialAnalysisTree_wfic0.Object, xfics[0].Analysis);
            // expect the focus box to be back on the first wfic.
            Assert.AreEqual(xfics[0], m_focusBox.SelectedWfic);
#endif
        }
예제 #2
0
        public void ApproveAndStayPut_NewWordGloss()
        {
            var occurrences = SegmentServices.GetAnalysisOccurrences(m_para0_0).ToList();

            m_interlinDoc.SelectOccurrence(occurrences[0]);
            // create a new analysis.
            var initialAnalysisTree = m_focusBox.InitialAnalysis;

            m_focusBox.DoDuringUnitOfWork = () =>
                                            WordAnalysisOrGlossServices.CreateNewAnalysisTreeGloss(initialAnalysisTree.Wordform);
            var undoRedoText = new MockUndoRedoText("Undo", "Redo");

            m_focusBox.ApproveAndStayPut(undoRedoText);

            // expect change to the first occurrence.
            Assert.AreEqual(m_focusBox.NewAnalysisTree.Gloss, occurrences[0].Analysis);
            // expect the focus box to still be on the first occurrence.
            Assert.AreEqual(occurrences[0], m_focusBox.SelectedOccurrence);

            // test undo.
            Assert.AreEqual(1, Cache.ActionHandlerAccessor.UndoableSequenceCount);
            Cache.ActionHandlerAccessor.Undo();
            Assert.AreEqual(initialAnalysisTree.Analysis, occurrences[0].Analysis);
            // expect the focus box to still be on the first occurrence.
            Assert.AreEqual(occurrences[0], m_focusBox.SelectedOccurrence);
        }
예제 #3
0
        public void ApproveAndMoveNext_NoChange()
        {
            var occurrences = SegmentServices.GetAnalysisOccurrences(m_para0_0).ToList();

            m_interlinDoc.SelectOccurrence(occurrences[0]);
            var initialAnalysisTree = m_focusBox.InitialAnalysis;
            var undoRedoText        = new MockUndoRedoText("Undo", "Redo");

            m_focusBox.ApproveAndMoveNext(undoRedoText);

            // expect no change to the first occurrence.
            Assert.AreEqual(initialAnalysisTree.Analysis, occurrences[0].Analysis);
            // expect the focus box to be on the next occurrence.
            Assert.AreEqual(occurrences[1], m_focusBox.SelectedOccurrence);

            // nothing to undo.
            Assert.AreEqual(0, Cache.ActionHandlerAccessor.UndoableSequenceCount);
        }
예제 #4
0
        public void ApproveAndStayPut_NoChange()
        {
            var ocurrences = SegmentServices.GetAnalysisOccurrences(m_para0_0).ToList();

            m_interlinDoc.SelectOccurrence(ocurrences[0]);
            var initialAnalysisObj = m_focusBox.InitialAnalysis.Analysis;

            // approve same wordform. Should not result in change during approve.
            m_focusBox.NewAnalysisTree.Analysis = ocurrences[0].Analysis;
            var undoRedoText = new MockUndoRedoText("Undo", "Redo");

            m_focusBox.ApproveAndStayPut(undoRedoText);

            // expect no change to the first occurrence.
            Assert.AreEqual(initialAnalysisObj, ocurrences[0].Analysis);
            // expect the focus box to still be on the first occurrence.
            Assert.AreEqual(ocurrences[0], m_focusBox.SelectedOccurrence);

            // nothing to undo.
            Assert.AreEqual(0, Cache.ActionHandlerAccessor.UndoableSequenceCount);
        }
		public void ApproveAndStayPut_NoChange()
		{
			var ocurrences = SegmentServices.GetAnalysisOccurrences(m_para0_0).ToList();
			m_interlinDoc.SelectOccurrence(ocurrences[0]);
			var initialAnalysisObj = m_focusBox.InitialAnalysis.Analysis;
			// approve same wordform. Should not result in change during approve.
			m_focusBox.NewAnalysisTree.Analysis = ocurrences[0].Analysis;
			var undoRedoText = new MockUndoRedoText("Undo", "Redo");
			m_focusBox.ApproveAndStayPut(undoRedoText);

			// expect no change to the first occurrence.
			Assert.AreEqual(initialAnalysisObj, ocurrences[0].Analysis);
			// expect the focus box to still be on the first occurrence.
			Assert.AreEqual(ocurrences[0], m_focusBox.SelectedOccurrence);

			// nothing to undo.
			Assert.AreEqual(0, Cache.ActionHandlerAccessor.UndoableSequenceCount);
		}
		public void ApproveAndMoveNext_NewWordGloss()
		{
#if WANTPORTWFIC // Undo is not working. The part of the test up to Undo works, but leaves extra things on the Undo stack
			// that mess things up when this test is run first (NUnit) though not when run last (Resharper).
			var xfics = AnnotationServices.GetAnalysisOccurrences(m_para0_0).ToList();
			m_interlinDoc.SelectAnnotation(xfics[0]);
			var initialAnalysisTree_wfic0 = m_focusBox.InitialAnalysis;
			var newAnalysisTree_wfic0 = m_focusBox.NewAnalysisTree;
			m_focusBox.DoDuringUnitOfWork = () =>
				WordAnalysisOrGlossServices.CreateNewAnalysisTreeGloss(initialAnalysisTree_wfic0.Wordform);
			var undoRedoText = new MockUndoRedoText("Undo", "Redo");
			m_focusBox.ApproveAndMoveNext(undoRedoText);

			// expect change to the first wfic.
			Assert.AreEqual(newAnalysisTree_wfic0.Gloss, xfics[0].Analysis);
			// expect the focus box to be on the next wfic.
			Assert.AreEqual(xfics[1], m_focusBox.SelectedWfic);

			// test undo.
			Assert.AreEqual(1, Cache.ActionHandlerAccessor.UndoableSequenceCount);
			Cache.ActionHandlerAccessor.Undo();
			Assert.AreEqual(initialAnalysisTree_wfic0.Object, xfics[0].Analysis);
			// expect the focus box to be back on the first wfic.
			Assert.AreEqual(xfics[0], m_focusBox.SelectedWfic);
#endif
		}
		public void ApproveAndMoveNext_NoChange()
		{
			var occurrences = SegmentServices.GetAnalysisOccurrences(m_para0_0).ToList();
			m_interlinDoc.SelectOccurrence(occurrences[0]);
			var initialAnalysisTree = m_focusBox.InitialAnalysis;
			var undoRedoText = new MockUndoRedoText("Undo", "Redo");
			m_focusBox.ApproveAndMoveNext(undoRedoText);

			// expect no change to the first occurrence.
			Assert.AreEqual(initialAnalysisTree.Analysis, occurrences[0].Analysis);
			// expect the focus box to be on the next occurrence.
			Assert.AreEqual(occurrences[1], m_focusBox.SelectedOccurrence);

			// nothing to undo.
			Assert.AreEqual(0, Cache.ActionHandlerAccessor.UndoableSequenceCount);
		}
		public void ApproveAndStayPut_NewWordGloss()
		{
			var occurrences = SegmentServices.GetAnalysisOccurrences(m_para0_0).ToList();
			m_interlinDoc.SelectOccurrence(occurrences[0]);
			// create a new analysis.
			var initialAnalysisTree = m_focusBox.InitialAnalysis;
			m_focusBox.DoDuringUnitOfWork = () =>
				WordAnalysisOrGlossServices.CreateNewAnalysisTreeGloss(initialAnalysisTree.Wordform);
			var undoRedoText = new MockUndoRedoText("Undo", "Redo");
			m_focusBox.ApproveAndStayPut(undoRedoText);

			// expect change to the first occurrence.
			Assert.AreEqual(m_focusBox.NewAnalysisTree.Gloss, occurrences[0].Analysis);
			// expect the focus box to still be on the first occurrence.
			Assert.AreEqual(occurrences[0], m_focusBox.SelectedOccurrence);

			// test undo.
			Assert.AreEqual(1, Cache.ActionHandlerAccessor.UndoableSequenceCount);
			Cache.ActionHandlerAccessor.Undo();
			Assert.AreEqual(initialAnalysisTree.Analysis, occurrences[0].Analysis);
			// expect the focus box to still be on the first occurrence.
			Assert.AreEqual(occurrences[0], m_focusBox.SelectedOccurrence);
		}