Exemplo n.º 1
0
        public void AddCharacter_SuperscriptedToneNumber()
        {
            CoreWritingSystemDefinition ws         = m_wsManager.Create("en-US");
            ValidCharacters             validChars = ValidCharacters.Load(ws);
            var 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.OtherCharacters.Count);
        }
Exemplo n.º 2
0
        public void AddCharacter_DuplicateOfOverriddenWordFormingChar()
        {
            CoreWritingSystemDefinition ws = m_wsManager.Create("en-US");

            ws.CharacterSets.Add(new CharacterSetDefinition("main")
            {
                Characters = { "a", "-" }
            });
            ws.CharacterSets.Add(new CharacterSetDefinition("punctuation")
            {
                Characters = { "{" }
            });
            ValidCharacters validChars  = ValidCharacters.Load(ws);
            var             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("{"));
        }
Exemplo n.º 3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Verifies the sort order of characters added to the specified valid characters
        /// object.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void VerifySortOrder(ValidCharacters validChars)
        {
            var 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]);
        }
Exemplo n.º 4
0
        public void AddCharacter_Duplicate()
        {
            CoreWritingSystemDefinition ws1        = m_wsManager.Create("en-US");
            ValidCharacters             validChars = ValidCharacters.Load(ws1);
            var 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.OtherCharacters.Count);
            validChars.SaveTo(ws1);
            CoreWritingSystemDefinition ws2 = m_wsManager.Create("en-US");

            ws2.CharacterSets.Add(new CharacterSetDefinition("main")
            {
                Characters = { "a" }
            });
            Assert.That(ws1.ValueEquals(ws2), Is.True);
        }
Exemplo n.º 5
0
        public void SortAfterAddSingles()
        {
            CoreWritingSystemDefinition ws         = m_wsManager.Create("en");
            ValidCharacters             validChars = ValidCharacters.Load(ws);

            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);
        }