public void AddCharacter_SuperscriptedToneNumber() { ValidCharacters validChars = ValidCharacters.Load(string.Empty, "Test WS", null); ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars); validChars.AddCharacter("\u00b9"); validChars.AddCharacter("\u2079"); Assert.AreEqual(2, validCharsW.WordFormingCharacters.Count); Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("\u00b9")); Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("\u2079")); Assert.AreEqual(0, validCharsW.NumericCharacters.Count); Assert.AreEqual(0, validCharsW.OtherCharacters.Count); }
public void AddCharacter_DuplicateOfOverriddenWordFormingChar() { string sXml = ksXmlHeader + "<ValidCharacters><WordForming>a\uFFFC-</WordForming>" + "<Numeric/>" + "<Other>{</Other>" + "</ValidCharacters>"; ValidCharacters validChars = ValidCharacters.Load(sXml, "Test WS", null); ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars); Assert.AreEqual(2, validCharsW.WordFormingCharacters.Count); Assert.AreEqual(0, validCharsW.NumericCharacters.Count); Assert.AreEqual(1, validCharsW.OtherCharacters.Count); Assert.IsTrue(validChars.IsWordForming("-")); Assert.IsFalse(validChars.IsWordForming("{")); validChars.AddCharacter("-"); Assert.AreEqual(2, validCharsW.WordFormingCharacters.Count); Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("a")); Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("-")); Assert.IsTrue(validChars.IsWordForming("-")); Assert.AreEqual(0, validCharsW.NumericCharacters.Count); Assert.AreEqual(1, validCharsW.OtherCharacters.Count); Assert.IsTrue(validCharsW.OtherCharacters.Contains("{")); Assert.IsFalse(validChars.IsWordForming("{")); }
public void AddCharacter_Duplicate() { ValidCharacters validChars = ValidCharacters.Load(string.Empty, "Test WS", null); ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars); validChars.AddCharacter("a"); validChars.AddCharacter("a"); Assert.AreEqual(1, validCharsW.WordFormingCharacters.Count); Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("a")); Assert.AreEqual(0, validCharsW.NumericCharacters.Count); Assert.AreEqual(0, validCharsW.OtherCharacters.Count); Assert.AreEqual(ksXmlHeader + "<ValidCharacters><WordForming>a</WordForming>" + "<Numeric /><Other /></ValidCharacters>", validChars.XmlString.Replace(Environment.NewLine, string.Empty).Replace("> <", "><")); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Verifies the sort order of characters added to the specified valid characters /// object. /// </summary> /// ------------------------------------------------------------------------------------ private void VerifySortOrder(ValidCharacters validChars) { ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars); Assert.AreEqual("b", validCharsW.WordFormingCharacters[0]); Assert.AreEqual("c", validCharsW.WordFormingCharacters[1]); Assert.AreEqual("t", validCharsW.WordFormingCharacters[2]); Assert.AreEqual("z", validCharsW.WordFormingCharacters[3]); validChars.AddCharacter("8"); validChars.AddCharacter("7"); validChars.AddCharacter("6"); validChars.AddCharacter("5"); Assert.AreEqual("5", validCharsW.NumericCharacters[0]); Assert.AreEqual("6", validCharsW.NumericCharacters[1]); Assert.AreEqual("7", validCharsW.NumericCharacters[2]); Assert.AreEqual("8", validCharsW.NumericCharacters[3]); }
private void EnsureQuoteAndHyphenWordForming(CoreWritingSystemDefinition wsObj) { ValidCharacters validChars = ValidCharacters.Load(wsObj); var fChangedSomething = false; if (!validChars.IsWordForming('-')) { validChars.AddCharacter("-", ValidCharacterType.WordForming); fChangedSomething = true; } if (!validChars.IsWordForming('\'')) { validChars.AddCharacter("'", ValidCharacterType.WordForming); fChangedSomething = true; } if (!fChangedSomething) { return; } validChars.SaveTo(wsObj); }
public void SortAfterAddSingles() { ValidCharacters validChars = ValidCharacters.Load(string.Empty, "Test WS", null); try { validChars.InitSortComparer("en"); validChars.AddCharacter("z"); validChars.AddCharacter("c"); validChars.AddCharacter("t"); validChars.AddCharacter("b"); validChars.AddCharacter("8"); validChars.AddCharacter("7"); validChars.AddCharacter("6"); validChars.AddCharacter("5"); VerifySortOrder(validChars); } finally { validChars.Dispose(); } }