示例#1
0
		private void ValidateInsertSegmentBreakAfter1stTwfic(SegmentFreeFormAnnotationValidationHelper helper)
		{
			helper.CaptureAndValidateSegmentsAfterSegBreakEdit(4);
			// validate that the first segment is still the one that has the ff annotations.
			helper.ValidateSegFFCount(0, 3);
			helper.ValidateSegFFCount(1, 0);
			helper.ValidateSegFFCount(2, 3);
			helper.ValidateSegFFCount(3, 3);
			helper.ValidateMatchingFreeformAnnotations(0, 0);
			helper.ValidateMatchingFreeformAnnotations(1, 2);
			helper.ValidateMatchingFreeformAnnotations(2, 3);
		}
示例#2
0
		protected override void UndoDeleteParagraphViaBackspace(StTxtPara para0, StTxtPara para1, TextSelInfo tsiBeforeBackspace)
		{
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				base.UndoDeleteParagraphViaBackspace(para0, para1, tsiBeforeBackspace);
				TextSelInfo tsiAfterUndoDeleteParagraphViaBackspace = m_rtp.CurrentSelectionInfo;
				ValidateInsertParagraphBreakAfterFirstSegment(helper, tsiAfterUndoDeleteParagraphViaBackspace);
			}
		}
示例#3
0
		protected override void RedoInsertParagraphBreakAfterFirstSegment(StTxtPara para0, StTxtPara para1, TextSelInfo tsiAfterEnter)
		{
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				base.RedoInsertParagraphBreakAfterFirstSegment(para0, para1, tsiAfterEnter);
				ValidateInsertParagraphBreakAfterFirstSegment(helper, tsiAfterEnter);
			}
		}
示例#4
0
		protected override void RedoReplaceSentenceWithSameSizeSentence(TextSelInfo tsiAfterIns)
		{
			StTxtPara para0 = new StTxtPara(Cache, tsiAfterIns.HvoAnchor);
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				base.RedoReplaceSentenceWithSameSizeSentence(tsiAfterIns);
				ValidateReplaceSentenceWithSameSizeSentence(helper);
			}
		}
示例#5
0
		protected override void DeleteParagraphBreakViaBackspace(StTxtPara para1, StTxtPara para0, out TextSelInfo tsiAfterBackspace)
		{
			using (SegmentFreeFormAnnotationValidationHelper helper0 = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				using (SegmentFreeFormAnnotationValidationHelper helper1 = new SegmentFreeFormAnnotationValidationHelper(para1))
				{
					base.DeleteParagraphBreakViaBackspace(para1, para0, out tsiAfterBackspace);
					ValidateDeleteParagraphBreakViaBackspace(para0, helper0, helper1);
				}
			}
		}
示例#6
0
		protected override void UndoReplaceSentencesWithSentence(TextSelInfo tsiBeforeIns)
		{
			StTxtPara para0 = new StTxtPara(Cache, tsiBeforeIns.HvoAnchor);
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				base.UndoReplaceSentencesWithSentence(tsiBeforeIns);
				helper.CaptureAndValidateSegmentsAfterSegBreakEdit(3);
				helper.ValidateSegFFCount(0, 3);
				helper.ValidateSegFFCount(1, 3);
				helper.ValidateSegFFCount(2, 3);
				// validate all previous segments and ffs were deleted
				helper.ValidateSegAndFFsWereDeleted(0);
			}
		}
示例#7
0
		private static void ValidateReplaceSentenceWithSameSizeSentence(SegmentFreeFormAnnotationValidationHelper helper)
		{
			helper.CaptureAndValidateSegmentsAfterSegBreakEdit(3);
			helper.ValidateSegFFCount(0, 0);
			helper.ValidateSegFFCount(1, 3);
			helper.ValidateSegFFCount(2, 3);
			helper.ValidateSegAndFFsWereDeleted(0);
			helper.ValidateMatchingFreeformAnnotations(1, 1);
			helper.ValidateMatchingFreeformAnnotations(2, 2);
		}
示例#8
0
		public override void DeleteRangeSpanningSegmentBoundaryAndWholeTwfics()
		{
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(m_text1.ContentsOA.ParagraphsOS[0] as StTxtPara))
			{
				base.DeleteRangeSpanningSegmentBoundaryAndWholeTwfics();

				helper.CaptureAndValidateSegmentsAfterSegBreakEdit(2);
				helper.ValidateSegFFCount(0, 4); // merge will result in one extra ff, because we don't merge notes.
				helper.ValidateSegFFCount(1, 3);
				helper.ValidateMergedFreeformAnnotations(0, 1);

				// test that the freeform annotations in segment 2 remained unchanged.
				helper.ValidateMatchingFreeformAnnotations(2, 1);

				// TODO: Check to make sure Freeform Annotation Content status gets flagged as Unfinished.
			}
		}
示例#9
0
		protected override void ReplaceSegBreakWithAnotherSegBreak(StTxtPara para0, out TextSelInfo tsiBeforeIns1, out TextSelInfo tsiAfterIns1)
		{
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				base.ReplaceSegBreakWithAnotherSegBreak(para0, out tsiBeforeIns1, out tsiAfterIns1);
				// shouldn't be any changes
				ValidateSegBreakEditDidNotChangeState(helper);
			}
		}
示例#10
0
		protected override void UndoInsertSegmentBreakAfter1stTwfic(TextSelInfo tsiBeforeIns)
		{
			StTxtPara para0 = new StTxtPara(Cache, tsiBeforeIns.HvoAnchor);
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				base.UndoInsertSegmentBreakAfter1stTwfic(tsiBeforeIns);
				ValidateDeleteSegmentBreakAfter1stTwfic(helper);
			}
		}
示例#11
0
		protected override void RedoDeleteSegmentBreakAfter1stTwfic(TextSelInfo tsiAfterBackspace)
		{
			StTxtPara para0 = new StTxtPara(Cache, tsiAfterBackspace.HvoAnchor);
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				base.RedoDeleteSegmentBreakAfter1stTwfic(tsiAfterBackspace);
				ValidateDeleteSegmentBreakAfter1stTwfic(helper);
			}
		}
示例#12
0
		protected override void UndoDeleteSegmentBreakAfter1stTwfic(TextSelInfo tsiBeforeBackspace)
		{
			StTxtPara para0 = new StTxtPara(Cache, tsiBeforeBackspace.HvoAnchor);
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				base.UndoDeleteSegmentBreakAfter1stTwfic(tsiBeforeBackspace);
				// we should be back to the state after we inserted the new segment break
				ValidateInsertSegmentBreakAfter1stTwfic(helper);
			}
		}
示例#13
0
		private static void ValidateDeleteSegmentBreakAfter1stTwfic(SegmentFreeFormAnnotationValidationHelper helper)
		{
			helper.CaptureAndValidateSegmentsAfterSegBreakEdit(3);
			helper.ValidateSegFFCount(0, 3);
			helper.ValidateSegFFCount(1, 3);
			helper.ValidateSegFFCount(2, 3);
			helper.ValidateMatchingFreeformAnnotations(0, 0);
			helper.ValidateMatchingFreeformAnnotations(2, 1);
			helper.ValidateMatchingFreeformAnnotations(3, 2);
		}
示例#14
0
		protected override void DeleteSegmentBreakAfter1stTwfic(StTxtPara para0, out TextSelInfo tsiBeforeBackspace, out TextSelInfo tsiAfterBackspace)
		{
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				base.DeleteSegmentBreakAfter1stTwfic(para0, out tsiBeforeBackspace, out tsiAfterBackspace);

				// validate that the first segment is still the one that has the ff annotations.
				// we should be back to the initial state
				ValidateDeleteSegmentBreakAfter1stTwfic(helper);
			}
		}
示例#15
0
		public override void DeleteFirstTwoSentences()
		{
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(m_text1.ContentsOA.ParagraphsOS[0] as StTxtPara))
			{
				base.DeleteFirstTwoSentences();

				helper.CaptureAndValidateSegmentsAfterSegBreakEdit(1);
				helper.ValidateSegFFCount(0, 3);
				// validate the last sentence ff annotation was unaffected.
				helper.ValidateMatchingFreeformAnnotations(2, 0);
				// validate the ffs of the first two segments have been deleted.
				helper.ValidateSegAndFFsWereDeleted(0);
				helper.ValidateSegAndFFsWereDeleted(1);
			}
		}
示例#16
0
		private static void ValidateSegBreakEditDidNotChangeState(SegmentFreeFormAnnotationValidationHelper helper)
		{
			helper.CaptureAndValidateSegmentsAfterSegBreakEdit(3);
			helper.ValidateSegFFCount(0, 3);
			helper.ValidateSegFFCount(1, 3);
			helper.ValidateSegFFCount(2, 3);
			helper.ValidateMatchingFreeformAnnotations(0, 0);
			helper.ValidateMatchingFreeformAnnotations(1, 1);
			helper.ValidateMatchingFreeformAnnotations(2, 2);
		}
示例#17
0
		private static void ValidateReplaceSentencesWithSentence(SegmentFreeFormAnnotationValidationHelper helper)
		{
			helper.CaptureAndValidateSegmentsAfterSegBreakEdit(1);
			helper.ValidateSegFFCount(0, 0);
			// validate all previous segments and ffs were deleted
			helper.ValidateSegAndFFsWereDeleted(0);
			helper.ValidateSegAndFFsWereDeleted(1);
			helper.ValidateSegAndFFsWereDeleted(2);
		}
示例#18
0
		protected override void ReplaceSegmentBreakWithNonSegmentBreak(StTxtPara para0, out TextSelInfo tsiBeforeIns2, out TextSelInfo tsiAfterIns2)
		{
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				base.ReplaceSegmentBreakWithNonSegmentBreak(para0, out tsiBeforeIns2, out tsiAfterIns2);
				ValidateReplaceSegmentBreakWithNonSegmentBreakResultedInMerge(helper);
			}
		}
示例#19
0
		protected override void ReplaceSentenceWithSameSizeSentence(StTxtPara para0, out TextSelInfo tsiBeforeIns, out TextSelInfo tsiAfterIns)
		{
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				base.ReplaceSentenceWithSameSizeSentence(para0, out tsiBeforeIns, out tsiAfterIns);
				ValidateReplaceSentenceWithSameSizeSentence(helper);
			}
		}
示例#20
0
		private static void ValidateReplaceSegmentBreakWithNonSegmentBreakResultedInMerge(SegmentFreeFormAnnotationValidationHelper helper)
		{
			helper.CaptureAndValidateSegmentsAfterSegBreakEdit(2);
			helper.ValidateSegFFCount(0, 4); // merge will result in one extra ff, because we don't merge notes.
			helper.ValidateSegFFCount(1, 3);
			helper.ValidateMergedFreeformAnnotations(0, 1);
			helper.ValidateMatchingFreeformAnnotations(2, 1);
		}
示例#21
0
		protected override void UndoReplaceSentenceWithSameSizeSentence(TextSelInfo tsiBeforeIns)
		{
			StTxtPara para0 = new StTxtPara(Cache, tsiBeforeIns.HvoAnchor);
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				base.UndoReplaceSentenceWithSameSizeSentence(tsiBeforeIns);
				helper.CaptureAndValidateSegmentsAfterSegBreakEdit(3);
				helper.ValidateSegFFCount(0, 3);
				helper.ValidateSegFFCount(1, 3);
				helper.ValidateSegFFCount(2, 3);
				helper.ValidateSegAndFFsWereDeleted(0);
				helper.ValidateMatchingFreeformAnnotations(1, 1);
				helper.ValidateMatchingFreeformAnnotations(2, 2);
			}
		}
示例#22
0
		protected override void UndoReplaceSegmentBreakwithNonSegmentBreak(TextSelInfo tsiBeforeIns2)
		{
			StTxtPara para0 = new StTxtPara(Cache, tsiBeforeIns2.HvoAnchor);
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				base.UndoReplaceSegmentBreakwithNonSegmentBreak(tsiBeforeIns2);
				// we should be back to non-merged state.
				helper.CaptureAndValidateSegmentsAfterSegBreakEdit(3);
				helper.ValidateSegFFCount(0, 3);
				helper.ValidateSegFFCount(1, 3);
				helper.ValidateSegFFCount(2, 3);
				// only the last segment should match
				helper.ValidateMatchingFreeformAnnotations(1, 2);
			}
		}
示例#23
0
		void ValidateInsertParagraphBreakAfterFirstSegment(SegmentFreeFormAnnotationValidationHelper helper, TextSelInfo tsiAfterEnter)
		{
			// validate the existing paragraph.
			helper.CaptureAndValidateSegmentsAfterSegBreakEdit(1);
			helper.ValidateSegFFCount(0, 3);
			helper.ValidateMatchingFreeformAnnotations(0, 0);
			// now validate against the new paragraph.
			StTxtPara para1 = new StTxtPara(Cache, tsiAfterEnter.HvoAnchor);
			helper.CaptureAndValidateSegmentsAfterSegBreakEdit(2, para1);
			helper.ValidateSegFFCount(0, 3, para1);
			helper.ValidateSegFFCount(1, 3, para1);
			helper.ValidateMatchingFreeformAnnotations(1, 0);
			helper.ValidateMatchingFreeformAnnotations(2, 1);
		}
示例#24
0
		protected override void UndoReplaceSegBreakWithAnotherSegBreak(TextSelInfo tsiBeforeIns1)
		{
			StTxtPara para0 = new StTxtPara(Cache, tsiBeforeIns1.HvoAnchor);
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				base.UndoReplaceSegBreakWithAnotherSegBreak(tsiBeforeIns1);
				// undoing from non-merged state to initial state, shouldn't result in any changes.
				ValidateSegBreakEditDidNotChangeState(helper);
			}
		}
示例#25
0
		private static void ValidateDeleteParagraphBreakViaBackspace(StTxtPara para0, SegmentFreeFormAnnotationValidationHelper helper0, SegmentFreeFormAnnotationValidationHelper helper1)
		{
			helper0.CaptureAndValidateSegmentsAfterSegBreakEdit(3);
			helper0.ValidateSegFFCount(0, 3);
			helper0.ValidateSegFFCount(1, 3);
			helper0.ValidateSegFFCount(2, 3);
			helper0.ValidateMatchingFreeformAnnotations(0, 0);

			// validate against the old paragraph
			helper1.CaptureAndValidateSegmentsAfterSegBreakEdit(3, para0);
			helper1.ValidateMatchingFreeformAnnotations(0, 1);
			helper1.ValidateMatchingFreeformAnnotations(1, 2);
		}
示例#26
0
		protected override void RedoReplaceSegBreakWithAnotherSegBreak(TextSelInfo tsiAfterIns1)
		{
			StTxtPara para0 = new StTxtPara(Cache, tsiAfterIns1.HvoAnchor);
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				base.RedoReplaceSegBreakWithAnotherSegBreak(tsiAfterIns1);
				ValidateSegBreakEditDidNotChangeState(helper);
			}
		}
示例#27
0
		protected override void UndoInsertParagraphBreakAfterFirstSegment(StTxtPara para1, StTxtPara para0, TextSelInfo tsiBeforeEnter)
		{
			using (SegmentFreeFormAnnotationValidationHelper helper0 = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				using (SegmentFreeFormAnnotationValidationHelper helper1 = new SegmentFreeFormAnnotationValidationHelper(para1))
				{
					base.UndoInsertParagraphBreakAfterFirstSegment(para1, para0, tsiBeforeEnter);
					ValidateDeleteParagraphBreakViaBackspace(para0, helper0, helper1);
				}
			}
		}
示例#28
0
		protected override void RedoReplaceSegmentBreakWithNonSegmentBreak(TextSelInfo tsiAfterIns2)
		{
			StTxtPara para0 = new StTxtPara(Cache, tsiAfterIns2.HvoAnchor);
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				base.RedoReplaceSegmentBreakWithNonSegmentBreak(tsiAfterIns2);
				ValidateReplaceSegmentBreakWithNonSegmentBreakResultedInMerge(helper);
			}
		}
示例#29
0
		protected override void InsertSentencesAfterFirstSentence(StTxtPara para0, out TextSelInfo tsiBeforeIns, out TextSelInfo tsiAfterIns)
		{
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				base.InsertSentencesAfterFirstSentence(para0, out tsiBeforeIns, out tsiAfterIns);
				helper.CaptureAndValidateSegmentsAfterSegBreakEdit(5);
				helper.ValidateSegFFCount(0, 3);
				helper.ValidateMatchingFreeformAnnotations(0, 0);
				// Note: Ideally, segment 1 should get pushed out to segment 3,
				// but currently we treat insertions at the beginning of a segment
				// as insertions into the segment (see LT-????).
				helper.ValidateSegFFCount(1, 3);
				helper.ValidateMatchingFreeformAnnotations(1, 1);
				helper.ValidateSegFFCount(2, 0);
				helper.ValidateSegFFCount(3, 0);
				helper.ValidateSegFFCount(4, 3);
				helper.ValidateMatchingFreeformAnnotations(2, 4);
			}
		}
示例#30
0
		protected override void InsertSegmentBreakAfter1stTwfic(StTxtPara para0, out TextSelInfo tsiBeforeIns)
		{
			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(para0))
			{
				helper.ValidateSegFFCount(0, 3);
				helper.ValidateSegFFCount(1, 3);
				helper.ValidateSegFFCount(2, 3);

				base.InsertSegmentBreakAfter1stTwfic(para0, out tsiBeforeIns);
				// we split the first segment into two, resulting in one more segment.
				ValidateInsertSegmentBreakAfter1stTwfic(helper);
			}
		}