Ejemplo n.º 1
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);
			}
		}
Ejemplo n.º 2
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);
		}
Ejemplo n.º 3
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);
		}
Ejemplo n.º 4
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);
		}
Ejemplo n.º 5
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);
			}
		}
Ejemplo n.º 6
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);
		}
Ejemplo n.º 7
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);
			}
		}
Ejemplo n.º 8
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);
			}
		}
Ejemplo n.º 9
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);
			}
		}
Ejemplo n.º 10
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);
		}
Ejemplo n.º 11
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);
		}
Ejemplo n.º 12
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.
			}
		}
Ejemplo n.º 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);
		}
Ejemplo n.º 14
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);
		}
Ejemplo n.º 15
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);
			}
		}
Ejemplo n.º 16
0
		public override void DeleteSegmentBreakToMerge2Sentences()
		{
			// get segment annotations for affected sentences.

			using (SegmentFreeFormAnnotationValidationHelper helper = new SegmentFreeFormAnnotationValidationHelper(m_text1.ContentsOA.ParagraphsOS[0] as StTxtPara))
			{
				base.DeleteSegmentBreakToMerge2Sentences();

				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 last sentence ff annotation was unaffected.
				helper.ValidateMatchingFreeformAnnotations(2, 1);

				// TODO: Check to make sure Freeform Annotation Content status gets flagged as Unfinished.
			}

		}