public void TestColConfWinUndo_1() { ColConfWin ccw = new ColConfWin(PhonConfType.phonemes); ccw.SetCeras(); Assert.AreEqual(ColConfWinTest.cfAN, ccw.GetCF("an")); ccw.SetCbxAndCF("m", ColConfWinTest.cfBLEUCLAIR); Assert.AreEqual(ColConfWinTest.cfBLEUCLAIR, ccw.GetCF("m")); Assert.IsTrue(ccw.GetCheck("m")); ccw.SetCFSon("m", ColConfWinTest.cfON); Assert.AreEqual(ColConfWinTest.cfON, ccw.GetCF("m")); UndoFactory.UndoLastAction(); Assert.AreEqual(ColConfWinTest.cfBLEUCLAIR, ccw.GetCF("m")); UndoFactory.UndoLastAction(); Assert.AreEqual(ColConfWinTest.cfBlack, ccw.GetCF("m")); Assert.IsFalse(ccw.GetCheck("m")); UndoFactory.RedoLastCanceledAction(); Assert.AreEqual(ColConfWinTest.cfBLEUCLAIR, ccw.GetCF("m")); Assert.IsTrue(ccw.GetCheck("m")); UndoFactory.UndoLastAction(); Assert.AreEqual(ColConfWinTest.cfe, ccw.GetCF("é")); UndoFactory.UndoLastAction(); Assert.AreEqual(ColConfWinTest.cfeRose, ccw.GetCF("é")); ccw.SetChkSon("é", false); Assert.IsFalse(ccw.GetCheck("é")); UndoFactory.UndoLastAction(); Assert.IsTrue(ccw.GetCheck("é")); }
public void TestColConfWinUndo_3() { ColConfWin ccw = new ColConfWin(PhonConfType.phonemes); ccw.SetCeras(); Assert.AreEqual(ColConfWinTest.cfAN, ccw.GetCF("an")); ccw.SetCbxAndCF("m", ColConfWinTest.cfBLEUCLAIR); Assert.AreEqual(ColConfWinTest.cfBLEUCLAIR, ccw.GetCF("m")); Assert.IsTrue(ccw.GetCheck("m")); ccw.SetCFSon("m", ColConfWinTest.cfON); Assert.AreEqual(ColConfWinTest.cfON, ccw.GetCF("m")); ccw.IllRuleToUse = ColConfWin.IllRule.lirecouleur; Assert.AreEqual(ColConfWin.IllRule.lirecouleur, ccw.IllRuleToUse); ccw.SetDefaultBehaviourTo(ColConfWin.DefBeh.noir); Assert.AreEqual(ColConfWin.DefBeh.noir, ccw.defBeh); ccw.Reset(); Assert.AreEqual(ColConfWinTest.cfeRose, ccw.GetCF("é")); Assert.IsFalse(ccw.GetCheck("m")); Assert.AreEqual(ColConfWin.IllRule.ceras, ccw.IllRuleToUse); Assert.AreEqual(ColConfWin.DefBeh.transparent, ccw.defBeh); UndoFactory.UndoLastAction(); Assert.AreEqual(ColConfWinTest.cfON, ccw.GetCF("m")); Assert.IsTrue(ccw.GetCheck("m")); Assert.AreEqual(ColConfWin.IllRule.lirecouleur, ccw.IllRuleToUse); Assert.AreEqual(ColConfWin.DefBeh.noir, ccw.defBeh); }
public void TestePredefCols() { ColConfWin ccw = conf.colors[PhonConfType.phonemes]; Assert.AreEqual(cNoir, ColConfWin.predefinedColors[(int)PredefCol.black]); Assert.AreEqual(cJaune, ColConfWin.predefinedColors[(int)PredefCol.darkYellow]); Assert.AreEqual(cOrange, ColConfWin.predefinedColors[(int)PredefCol.orange]); Assert.AreEqual(cVertSapin, ColConfWin.predefinedColors[(int)PredefCol.darkGreen]); Assert.AreEqual(cViolet, ColConfWin.predefinedColors[(int)PredefCol.violet]); Assert.AreEqual(cBleuFoncé, ColConfWin.predefinedColors[(int)PredefCol.darkBlue]); Assert.AreEqual(cRouge, ColConfWin.predefinedColors[(int)PredefCol.red]); Assert.AreEqual(cMarron, ColConfWin.predefinedColors[(int)PredefCol.brown]); Assert.AreEqual(cBleu, ColConfWin.predefinedColors[(int)PredefCol.blue]); Assert.AreEqual(cTurquoise, ColConfWin.predefinedColors[(int)PredefCol.turquoise]); Assert.AreEqual(cGris, ColConfWin.predefinedColors[(int)PredefCol.grey]); Assert.AreEqual(cRose, ColConfWin.predefinedColors[(int)PredefCol.pink]); Assert.AreEqual(cVertGren, ColConfWin.predefinedColors[(int)PredefCol.frogGreen]); Assert.AreEqual(cGrisUn, ColConfWin.predefinedColors[(int)PredefCol.cerasUn]); Assert.AreEqual(cGrisNeutre, ColConfWin.predefinedColors[(int)PredefCol.neutral]); Assert.AreEqual(cBleuPur, ColConfWin.predefinedColors[(int)PredefCol.pureBlue]); Assert.AreEqual(cBleuClair, ColConfWin.predefinedColors[(int)PredefCol.lightBlue]); Assert.AreEqual(cRougeFonce, ColConfWin.predefinedColors[(int)PredefCol.darkRed]); Assert.AreEqual(cBlanc, ColConfWin.predefinedColors[(int)PredefCol.white]); // CharFormatting Assert.AreEqual(cfBlack, ColConfWin.coloredCF[(int)PredefCol.black]); Assert.AreEqual(cfO, ColConfWin.coloredCF[(int)PredefCol.darkYellow]); Assert.AreEqual(cfAN, ColConfWin.coloredCF[(int)PredefCol.orange]); Assert.AreEqual(cf5, ColConfWin.coloredCF[(int)PredefCol.darkGreen]); Assert.AreEqual(cfE, ColConfWin.coloredCF[(int)PredefCol.violet]); Assert.AreEqual(cfe, ColConfWin.coloredCF[(int)PredefCol.darkBlue]); Assert.AreEqual(cfu, ColConfWin.coloredCF[(int)PredefCol.red]); Assert.AreEqual(cfON, ColConfWin.coloredCF[(int)PredefCol.brown]); Assert.AreEqual(cf2, ColConfWin.coloredCF[(int)PredefCol.blue]); Assert.AreEqual(cfOIN, ColConfWin.coloredCF[(int)PredefCol.turquoise]); Assert.AreEqual(cfMUET, ColConfWin.coloredCF[(int)PredefCol.grey]); Assert.AreEqual(cfeRose, ColConfWin.coloredCF[(int)PredefCol.pink]); Assert.AreEqual(cfVGrenou, ColConfWin.coloredCF[(int)PredefCol.frogGreen]); Assert.AreEqual(cfGrisUn, ColConfWin.coloredCF[(int)PredefCol.cerasUn]); Assert.AreEqual(cfNeutre, ColConfWin.coloredCF[(int)PredefCol.neutral]); Assert.AreEqual(cfBLEU, ColConfWin.coloredCF[(int)PredefCol.pureBlue]); Assert.AreEqual(cfBLEUCLAIR, ColConfWin.coloredCF[(int)PredefCol.lightBlue]); Assert.AreEqual(cfROUGEF, ColConfWin.coloredCF[(int)PredefCol.darkRed]); Assert.AreEqual(cfBLANC, ColConfWin.coloredCF[(int)PredefCol.white]); // La seule chose qui compte pour les couleurs CERAS est qu'elles soient attribuées // correctement aux sons. // configuration par défaut: CERAS rosé. HashSet <string> cerasSons = new HashSet <string>() { "oi", "o", "an", "5", "è", "u", "on", "2", "oin", "_muet", "é", "ill", "1" }; HashSet <string> tousLesSons = new HashSet <string>(ColConfWin.sonsValides); tousLesSons.ExceptWith(cerasSons); HashSet <string> sonsNonCeras = tousLesSons; Assert.IsTrue(cerasSons.IsSubsetOf(ColConfWin.sonsValides)); Assert.AreEqual(cfOI, ccw.GetCF("oi")); Assert.AreEqual(cfO, ccw.GetCF("o")); Assert.AreEqual(cfAN, ccw.GetCF("an")); Assert.AreEqual(cf5, ccw.GetCF("5")); Assert.AreEqual(cfE, ccw.GetCF("è")); Assert.AreEqual(cfu, ccw.GetCF("u")); Assert.AreEqual(cfON, ccw.GetCF("on")); Assert.AreEqual(cf2, ccw.GetCF("2")); Assert.AreEqual(cfOIN, ccw.GetCF("oin")); Assert.AreEqual(cfMUET, ccw.GetCF("_muet")); Assert.AreEqual(cfeRose, ccw.GetCF("é")); Assert.AreEqual(cfILL, ccw.GetCF("ill")); Assert.AreEqual(cf1, ccw.GetCF("1")); foreach (string son in cerasSons) { Assert.IsTrue(ccw.GetCheck(son)); } foreach (string son in sonsNonCeras) { Assert.IsFalse(ccw.GetCheck(son)); } ResetEventCounters(); ccw.SetCeras(); Assert.AreEqual(2, SonCharFormattingModifiedEvents.Count); // é et ill Assert.AreEqual(1, SonCBModifiedEvents.Count); // ill Assert.AreEqual("ill", SonCBModifiedEvents[0].son); Assert.AreEqual(cfOI, ccw.GetCF("oi")); Assert.AreEqual(cfO, ccw.GetCF("o")); Assert.AreEqual(cfAN, ccw.GetCF("an")); Assert.AreEqual(cf5, ccw.GetCF("5")); Assert.AreEqual(cfE, ccw.GetCF("è")); Assert.AreEqual(cfe, ccw.GetCF("é")); Assert.AreEqual(cfu, ccw.GetCF("u")); Assert.AreEqual(cfON, ccw.GetCF("on")); Assert.AreEqual(cf2, ccw.GetCF("2")); Assert.AreEqual(cfOIN, ccw.GetCF("oin")); Assert.AreEqual(cfMUET, ccw.GetCF("_muet")); Assert.AreEqual(cf1, ccw.GetCF("1")); cerasSons.Remove("ill"); sonsNonCeras.Add("ill"); foreach (string son in cerasSons) { Assert.IsTrue(ccw.GetCheck(son)); } foreach (string son in sonsNonCeras) { Assert.IsFalse(ccw.GetCheck(son)); } CheckConsistency(ccw); }