public void get_IsNormalizedForm_SplitRuns_NFSCIsNotNFC() { // Setup string input = "A" + COMBINING_DIAERESIS; var intProps1 = new Dictionary <int, TsIntPropValue> { { (int)FwTextPropType.ktptWs, new TsIntPropValue((int)FwTextPropVar.ktpvDefault, EnglishWS) }, { (int)FwTextPropType.ktptBold, new TsIntPropValue((int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn) } }; var intProps2 = new Dictionary <int, TsIntPropValue> { { (int)FwTextPropType.ktptWs, new TsIntPropValue((int)FwTextPropVar.ktpvDefault, SpanishWS) }, { (int)FwTextPropType.ktptUnderline, new TsIntPropValue((int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn) } }; var runs = new List <TsRun>(); runs.Add(new TsRun(1, new TsTextProps(intProps1, null))); runs.Add(new TsRun(input.Length, new TsTextProps(intProps2, null))); var tsInput = new TsString(input, runs); // Before calling get_IsNormalizedForm once, we did NOT know that this string was valid NFSC Assert.That(tsInput.IsAlreadyNormalized(FwNormalizationMode.knmNFSC), Is.False); // Exercise Assert.That(tsInput.get_IsNormalizedForm(FwNormalizationMode.knmNFSC), Is.True); // We've set the NFSC flag, but NOT the NFKC or NFC flags -- because in some cases (like this one!), // a string can be NFSC but not NFC or NFKC. Assert.That(tsInput.IsAlreadyNormalized(FwNormalizationMode.knmNFSC), Is.True); Assert.That(tsInput.IsAlreadyNormalized(FwNormalizationMode.knmNFKC), Is.False); Assert.That(tsInput.IsAlreadyNormalized(FwNormalizationMode.knmNFC), Is.False); // And indeed, this string is NOT normalized under either NFC or NFKC. Assert.That(tsInput.get_IsNormalizedForm(FwNormalizationMode.knmNFC), Is.False); Assert.That(tsInput.get_IsNormalizedForm(FwNormalizationMode.knmNFKC), Is.False); }
public void get_IsNormalizedForm_SingleRun_NFKDIsAlsoNFD() { TsString tsInput = new TsString("A" + COMBINING_DIAERESIS, EnglishWS); Assert.That(tsInput.get_IsNormalizedForm(FwNormalizationMode.knmNFKD), Is.True); Assert.That(tsInput.IsAlreadyNormalized(FwNormalizationMode.knmNFKD), Is.True); Assert.That(tsInput.IsAlreadyNormalized(FwNormalizationMode.knmNFD), Is.True); }
public void get_IsNormalizedForm_SingleRun_NFKCIsAlsoNFSCAndNFC() { TsString tsInput = new TsString(A_WITH_DIAERESIS, EnglishWS); Assert.That(tsInput.get_IsNormalizedForm(FwNormalizationMode.knmNFKC), Is.True); Assert.That(tsInput.IsAlreadyNormalized(FwNormalizationMode.knmNFSC), Is.True); Assert.That(tsInput.IsAlreadyNormalized(FwNormalizationMode.knmNFKC), Is.True); Assert.That(tsInput.IsAlreadyNormalized(FwNormalizationMode.knmNFC), Is.True); }
public void get_IsNormalizedForm_SingleRun_NFDIsNotNecessarilyNFKD() { TsString tsInput = new TsString("A" + COMBINING_DIAERESIS, EnglishWS); Assert.That(tsInput.get_IsNormalizedForm(FwNormalizationMode.knmNFD), Is.True); // We have not set the NFKD flag automatically... Assert.That(tsInput.IsAlreadyNormalized(FwNormalizationMode.knmNFKD), Is.False); Assert.That(tsInput.IsAlreadyNormalized(FwNormalizationMode.knmNFD), Is.True); // ... even though it turns out that the string was indeed NFKD as well. Assert.That(tsInput.get_IsNormalizedForm(FwNormalizationMode.knmNFKD), Is.True); // And now the IsAlreadyNormalized flag is set, so we will go through the shortcut path next time Assert.That(tsInput.IsAlreadyNormalized(FwNormalizationMode.knmNFKD), Is.True); }
public void get_NormalizedForm_NullStrings_AfterNormalizationHaveAlreadyNormalizedFlagSet(FwNormalizationMode nm) { TsString nullString = new TsString(null, EnglishWS); nullString.get_NormalizedForm(nm); // Don't need result for this test Assert.That(nullString.IsAlreadyNormalized(nm), Is.True); }
public void get_NormalizedForm_NullStrings_AfterCheckingNormalizationHaveAlreadyNormalizedFlagSet(FwNormalizationMode nm) { TsString nullString = new TsString("", EnglishWS); Assert.That(nullString.get_IsNormalizedForm(nm), Is.True); Assert.That(nullString.IsAlreadyNormalized(nm), Is.True); }