예제 #1
0
        public void ClearingAnnotationOfEmptyAlternativeRemovesTheAlternative()
        {
            MultiTextBase multiTextBase = new MultiTextBase();

            multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", true);
            multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", false);
            Assert.IsFalse(multiTextBase.ContainsAlternative("zz"));
        }
예제 #2
0
        public void ClearingAnnotationOfNonEmptyAlternative()
        {
            MultiTextBase multiTextBase = new MultiTextBase();

            multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", true);
            multiTextBase["zz"] = "hello";
            multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", false);
            Assert.IsTrue(multiTextBase.ContainsAlternative("zz"));
        }
예제 #3
0
        public void SetAnnotation()
        {
            MultiTextBase multiTextBase = new MultiTextBase();

            multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", true);
            Assert.AreEqual(String.Empty, multiTextBase.GetExactAlternative("zz"));
            Assert.IsTrue(multiTextBase.GetAnnotationOfAlternativeIsStarred("zz"));
            multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", false);
            Assert.IsFalse(multiTextBase.GetAnnotationOfAlternativeIsStarred("zz"));
        }
예제 #4
0
        public void HasFormWithSameContent_OneEmpty_False()
        {
            MultiTextBase x = new MultiTextBase();
            MultiTextBase y = new MultiTextBase();

            y["ws"] = "test";
            y.SetAnnotationOfAlternativeIsStarred("ws", true);
            Assert.IsFalse(x.HasFormWithSameContent(y));
            Assert.IsFalse(y.HasFormWithSameContent(x));
        }
예제 #5
0
        public void EmptyingTextOfFlaggedAlternativeDoesNotDeleteIfFlagged()
        {
            // REVIEW: not clear really what behavior we want here, since user deletes via clearing text
            MultiTextBase multiTextBase = new MultiTextBase();

            multiTextBase["zz"] = "hello";
            multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", true);
            multiTextBase["zz"] = "";
            Assert.IsTrue(multiTextBase.ContainsAlternative("zz"));
        }
 private static void AddAnnotationsToMultiText(LiftMultiText forms, MultiTextBase text)
 {
     foreach (Annotation annotation in forms.Annotations)
     {
         if (annotation.Name == "flag")
         {
             text.SetAnnotationOfAlternativeIsStarred(annotation.LanguageHint,
                                                      int.Parse(annotation.Value) > 0);
         }
         else
         {
             //log dropped
         }
     }
 }