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); }
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); }
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); }
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); }
public void Construct_DefaultFont() { WritingSystem_V1 ws = new WritingSystem_V1(); Assert.IsNotNull(ws.Font); }
public void NoSetupDefaultFont() { WritingSystem_V1 ws = new WritingSystem_V1("xx", new Font("Times", 33)); Assert.AreEqual(33, ws.Font.Size); }