public void TestSylConfig_1() { var sc = new SylConfig(); Assert.IsTrue(sc.GetSylButtonConfFor(0).buttonClickable); Assert.IsTrue(sc.GetSylButtonConfFor(1).buttonClickable); Assert.IsTrue(sc.GetSylButtonConfFor(2).buttonClickable); Assert.IsFalse(sc.GetSylButtonConfFor(3).buttonClickable); Assert.IsFalse(sc.GetSylButtonConfFor(4).buttonClickable); Assert.IsFalse(sc.GetSylButtonConfFor(5).buttonClickable); sc.SetSylButtonCF(0, TestTheText.redCF); sc.SetSylButtonCF(1, TestTheText.redCF); sc.SetSylButtonCF(2, TestTheText.redCF); Assert.AreEqual(TestTheText.redCF, sc.GetSylButtonConfFor(0).cf); Assert.AreEqual(TestTheText.redCF, sc.GetSylButtonConfFor(1).cf); Assert.AreEqual(TestTheText.redCF, sc.GetSylButtonConfFor(2).cf); sc.SetSylButtonCF(1, TestTheText.blueCF); Assert.AreEqual(TestTheText.blueCF, sc.GetSylButtonConfFor(1).cf); sc.SetSylButtonCF(2, TestTheText.blueCF); Assert.AreEqual(TestTheText.blueCF, sc.GetSylButtonConfFor(2).cf); UndoFactory.UndoLastAction(); Assert.AreEqual(TestTheText.redCF, sc.GetSylButtonConfFor(2).cf); Assert.AreEqual(TestTheText.blueCF, sc.GetSylButtonConfFor(1).cf); UndoFactory.UndoLastAction(); Assert.AreEqual(TestTheText.redCF, sc.GetSylButtonConfFor(1).cf); UndoFactory.RedoLastCanceledAction(); Assert.AreEqual(TestTheText.blueCF, sc.GetSylButtonConfFor(1).cf); sc.DoubleConsStd = true; sc.DoubleConsStd = false; Assert.IsFalse(sc.DoubleConsStd); UndoFactory.UndoLastAction(); Assert.IsTrue(sc.DoubleConsStd); UndoFactory.RedoLastCanceledAction(); Assert.IsFalse(sc.DoubleConsStd); sc.mode = SylConfig.Mode.ecrit; sc.mode = SylConfig.Mode.oral; sc.mode = SylConfig.Mode.poesie; Assert.AreEqual(SylConfig.Mode.poesie, sc.mode); UndoFactory.UndoLastAction(); Assert.AreEqual(SylConfig.Mode.oral, sc.mode); UndoFactory.UndoLastAction(); Assert.AreEqual(SylConfig.Mode.ecrit, sc.mode); UndoFactory.RedoLastCanceledAction(); Assert.AreEqual(SylConfig.Mode.oral, sc.mode); UndoFactory.RedoLastCanceledAction(); Assert.AreEqual(SylConfig.Mode.poesie, sc.mode); sc.marquerMuettes = true; sc.marquerMuettes = false; Assert.IsFalse(sc.marquerMuettes); UndoFactory.UndoLastAction(); Assert.IsTrue(sc.marquerMuettes); UndoFactory.RedoLastCanceledAction(); Assert.IsFalse(sc.marquerMuettes); sc.chercherDierese = true; sc.chercherDierese = false; Assert.IsFalse(sc.chercherDierese); UndoFactory.UndoLastAction(); Assert.IsTrue(sc.chercherDierese); UndoFactory.RedoLastCanceledAction(); Assert.IsFalse(sc.chercherDierese); sc.nbrPieds = 12; sc.nbrPieds = 8; sc.nbrPieds = 9; Assert.AreEqual(9, sc.nbrPieds); UndoFactory.UndoLastAction(); Assert.AreEqual(8, sc.nbrPieds); UndoFactory.UndoLastAction(); Assert.AreEqual(12, sc.nbrPieds); UndoFactory.RedoLastCanceledAction(); Assert.AreEqual(8, sc.nbrPieds); UndoFactory.RedoLastCanceledAction(); Assert.AreEqual(9, sc.nbrPieds); sc.Reset(); Assert.IsTrue(sc.DoubleConsStd); Assert.AreEqual(SylConfig.Mode.ecrit, sc.mode); Assert.IsTrue(sc.marquerMuettes); Assert.IsTrue(sc.chercherDierese); Assert.AreEqual(0, sc.nbrPieds); UndoFactory.UndoLastAction(); Assert.AreEqual(TestTheText.blueCF, sc.GetSylButtonConfFor(1).cf); Assert.IsFalse(sc.DoubleConsStd); Assert.AreEqual(SylConfig.Mode.poesie, sc.mode); Assert.IsFalse(sc.marquerMuettes); Assert.IsFalse(sc.chercherDierese); Assert.AreEqual(9, sc.nbrPieds); UndoFactory.RedoLastCanceledAction(); Assert.IsTrue(sc.DoubleConsStd); Assert.AreEqual(SylConfig.Mode.ecrit, sc.mode); Assert.IsTrue(sc.marquerMuettes); Assert.IsTrue(sc.chercherDierese); Assert.AreEqual(0, sc.nbrPieds); Assert.IsTrue(sc.GetSylButtonConfFor(0).buttonClickable); Assert.IsTrue(sc.GetSylButtonConfFor(1).buttonClickable); Assert.IsTrue(sc.GetSylButtonConfFor(2).buttonClickable); Assert.IsFalse(sc.GetSylButtonConfFor(3).buttonClickable); Assert.IsFalse(sc.GetSylButtonConfFor(4).buttonClickable); Assert.IsFalse(sc.GetSylButtonConfFor(5).buttonClickable); }
public void TestMethod6() { // Effacer tous les formatages SylConfig sC = conf.sylConf; for (int i = SylConfig.NrButtons - 1; i >= 0; i--) { if (sC.ButtonIsLastActive(i)) { sC.ClearButton(i); } } ResetEventCounters(); sC.SetSylButtonCF("0", TestTheText.blueCF); Assert.IsTrue(sylButModNr.Contains(0)); Assert.IsTrue(sylButModNr.Contains(1)); Assert.IsTrue(sylButModNr.Count == 2); CheckConsistency(sC); CheckAlernateCF(TestTheText.blueCF, conf); ResetEventCounters(); sC.SetSylButtonCF("1", TestTheText.redCF); Assert.IsTrue(sylButModNr.Contains(1)); Assert.IsTrue(sylButModNr.Contains(2)); Assert.IsTrue(sylButModNr.Count == 2); CheckConsistency(sC); CheckAlernateCF(TestTheText.blueCF, TestTheText.redCF, conf); ResetEventCounters(); sC.SetSylButtonCF("2", TestTheText.fixCFs[2]); Assert.IsTrue(sylButModNr.Contains(2)); Assert.IsTrue(sylButModNr.Contains(3)); Assert.IsTrue(sylButModNr.Count == 2); CheckConsistency(sC); CheckAlernateCF(TestTheText.blueCF, TestTheText.redCF, TestTheText.fixCFs[2], conf); ResetEventCounters(); sC.SetSylButtonCF("3", TestTheText.fixCFs[3]); Assert.IsTrue(sylButModNr.Contains(3)); Assert.IsTrue(sylButModNr.Contains(4)); Assert.IsTrue(sylButModNr.Count == 2); CheckConsistency(sC); CheckAlernateCF(TestTheText.blueCF, TestTheText.redCF, TestTheText.fixCFs[2], TestTheText.fixCFs[3], conf); ResetEventCounters(); sC.SetSylButtonCF("4", TestTheText.fixCFs[4]); Assert.IsTrue(sylButModNr.Contains(4)); Assert.IsTrue(sylButModNr.Contains(5)); Assert.IsTrue(sylButModNr.Count == 2); CheckConsistency(sC); CheckAlernateCF(TestTheText.blueCF, TestTheText.redCF, TestTheText.fixCFs[2], TestTheText.fixCFs[3], TestTheText.fixCFs[4], conf); ResetEventCounters(); sC.SetSylButtonCF("5", TestTheText.fixCFs[5]); Assert.IsTrue(sylButModNr.Contains(5)); Assert.IsTrue(sylButModNr.Count == 1); CheckConsistency(sC); CheckAlernateCF(TestTheText.blueCF, TestTheText.redCF, TestTheText.fixCFs[2], TestTheText.fixCFs[3], TestTheText.fixCFs[4], TestTheText.fixCFs[5], conf); ResetEventCounters(); sC.SetSylButtonCF("4", TestTheText.fixCFs[7]); Assert.IsTrue(sylButModNr.Contains(4)); Assert.IsTrue(sylButModNr.Count == 1); CheckConsistency(sC); CheckAlernateCF(TestTheText.blueCF, TestTheText.redCF, TestTheText.fixCFs[2], TestTheText.fixCFs[3], TestTheText.fixCFs[7], TestTheText.fixCFs[5], conf); sC.Reset(); Assert.IsTrue(sC.DoubleConsStd); Assert.AreEqual(SylConfig.Mode.ecrit, sC.mode); Assert.IsTrue(sC.marquerMuettes); Assert.IsTrue(sC.chercherDierese); Assert.AreEqual(0, sC.nbrPieds); Assert.AreEqual(ColConfWinTest.cfBLEU, sC.GetSylButtonConfFor(0).cf); Assert.AreEqual(ColConfWinTest.cfu, sC.GetSylButtonConfFor(1).cf); Assert.IsTrue(sC.ButtonIsLastActive(1)); Assert.IsTrue(sC.ButtonIsActivableOne(2)); Assert.IsTrue(sC.GetSylButtonConfFor(0).buttonClickable); Assert.IsTrue(sC.GetSylButtonConfFor(1).buttonClickable); Assert.IsTrue(sC.GetSylButtonConfFor(2).buttonClickable); Assert.IsFalse(sC.GetSylButtonConfFor(3).buttonClickable); }