public void RightFont()
        {
            CreateSampleWritingSystemFile(_path);
            _collection.LoadFromLegacyWeSayFile(_path);
            WritingSystem_V1 ws = _collection["PretendAnalysis"];

            Assert.AreEqual("PretendAnalysis", ws.ISO);
            // since Linux may not have CourierNew, we
            // need to test against the font mapping
            Font expectedFont = new Font("Courier New", 10);

            Assert.AreEqual(expectedFont.Name, ws.Font.Name);
            Assert.AreEqual(expectedFont.Size, ws.Font.Size);
        }
예제 #2
0
        public void DeserializeOne_CustomSortRules_Before_SortUsing()
        {
            NetReflectorTypeTable t = new NetReflectorTypeTable();

            t.Add(typeof(WritingSystem_V1));
            NetReflectorReader r  = new NetReflectorReader(t);
            WritingSystem_V1   ws =
                (WritingSystem_V1)
                r.Read(
                    "<WritingSystem><CustomSortRules>test</CustomSortRules><SortUsing>CustomSimple</SortUsing><FontName>Tahoma</FontName><FontSize>99</FontSize><Id>one</Id></WritingSystem>");

            Assert.IsNotNull(ws);
            Assert.AreEqual("test", ws.CustomSortRules);
            Assert.AreEqual(WritingSystem_V1.CustomSortRulesType.CustomSimple.ToString(), ws.SortUsing);
        }
예제 #3
0
        public void DeserializeOne()
        {
            NetReflectorTypeTable t = new NetReflectorTypeTable();

            t.Add(typeof(WritingSystem_V1));
            NetReflectorReader r  = new NetReflectorReader(t);
            WritingSystem_V1   ws =
                (WritingSystem_V1)
                r.Read(
                    @"<WritingSystem>
	<Abbreviation>xx</Abbreviation>
	<CustomSortRules>B c d R</CustomSortRules>
	<FontName>Tahoma</FontName>
	<FontSize>99</FontSize>
	<Id>one</Id>
	<IsAudio>False</IsAudio>
	<IsUnicode>True</IsUnicode>
	<WindowsKeyman>IPA Unicode 5.1(ver 1.2 US) MSK</WindowsKeyman>
	<RightToLeft>False</RightToLeft>
	<SortUsing>one</SortUsing>
	<SpellCheckingId>xx</SpellCheckingId>
</WritingSystem>");
            // since Linux may not have Tahoma, we
            // need to test against the font mapping
            Font font = new Font("Tahoma", 99);

            Assert.IsNotNull(ws);
            Assert.AreEqual("xx", ws.Abbreviation);
            Assert.AreEqual("B c d R", ws.CustomSortRules);
#if __MonoCS__
            // Tahoma should not be available on Linux
            // Checking that what you asked for is in the ws
            // and what you get is the standard DejaVu Sans font
            Assert.AreEqual(font.OriginalFontName, ws.FontName);
            Assert.AreEqual(font.Name, "DejaVu Sans");
#else
            Assert.AreEqual(font.Name, ws.FontName);
#endif
            Assert.AreEqual(font.Size, ws.FontSize);
            Assert.AreEqual("one", ws.ISO);
            Assert.AreEqual(false, ws.IsAudio);
            Assert.AreEqual(true, ws.IsUnicode);
            Assert.AreEqual("IPA Unicode 5.1(ver 1.2 US) MSK", ws.KeyboardName);
            Assert.AreEqual(false, ws.RightToLeft);
            Assert.AreEqual("one", ws.SortUsing);
            Assert.AreEqual("xx", ws.SpellCheckingId);
        }
예제 #4
0
        public void CustomSortRules_SerializeAndDeserialize()
        {
            WritingSystem_V1 ws = new WritingSystem_V1("one", new Font("Arial", 99));

            ws.SortUsing = WritingSystem_V1.CustomSortRulesType.CustomICU.ToString();

            string rules = "&n < ng <<< Ng <<< NG";

            ws.CustomSortRules = rules;

            string s = NetReflector.Write(ws);

            NetReflectorTypeTable t = new NetReflectorTypeTable();

            t.Add(typeof(WritingSystem_V1));
            NetReflectorReader r      = new NetReflectorReader(t);
            WritingSystem_V1   wsRead = (WritingSystem_V1)r.Read(s);

            Assert.IsNotNull(wsRead);
            Assert.AreEqual(rules, ws.CustomSortRules);
        }
예제 #5
0
        public void Construct_DefaultFont()
        {
            WritingSystem_V1 ws = new WritingSystem_V1();

            Assert.IsNotNull(ws.Font);
        }
예제 #6
0
        public void NoSetupDefaultFont()
        {
            WritingSystem_V1 ws = new WritingSystem_V1("xx", new Font("Times", 33));

            Assert.AreEqual(33, ws.Font.Size);
        }