示例#1
0
        private void CheckConsistency(SylConfig sylConf)
        {
            int i = 0;

            while (i < SylConfig.NrButtons && !sylConf.ButtonIsActivableOne(i))
            {
                i++;
            }
            // i is the activable button (or SylConfig.NrButtons)
            for (int j = 0; j < SylConfig.NrButtons; j++)
            {
                if (j == i - 1)
                {
                    Assert.IsTrue(sylConf.ButtonIsLastActive(j));
                }
                else
                {
                    Assert.IsFalse(sylConf.ButtonIsLastActive(j));
                }
                if (j != i)
                {
                    Assert.IsFalse(sylConf.ButtonIsActivableOne(j));
                }
                if (j <= i)
                {
                    Assert.IsTrue(sylConf.GetSylButtonConfFor(j).buttonClickable);
                }
                else
                {
                    Assert.IsFalse(sylConf.GetSylButtonConfFor(j).buttonClickable);
                }
            }
        }
示例#2
0
        public void TestMethod1()
        {
            // Effacer tous les formatages
            SylConfig sC = conf.sylConf;

            for (int i = SylConfig.NrButtons - 1; i >= 0; i--)
            {
                if (sC.ButtonIsLastActive(i))
                {
                    sC.ClearButton(i);
                    Assert.IsTrue(sylButModNr.Contains(i));
                    if (i < SylConfig.NrButtons - 2)
                    {
                        Assert.IsTrue(sylButModNr.Contains(i + 1));
                    }
                }
                else
                {
                    Assert.ThrowsException <ArgumentException>(() => sC.ClearButton(i));
                }
                CheckConsistency(sC);
                ResetEventCounters();
            }


            Assert.IsTrue(sC.ButtonIsActivableOne(0));
            // conf.sylConf.SylButtonModified(0, TestTheText.blueCF);
            Assert.ThrowsException <ArgumentException>
                (() => sC.SetSylButtonCF(1, TestTheText.redCF));
            CheckConsistency(sC);
        }
示例#3
0
        public void TestDefault()
        {
            SylConfig sC = conf.sylConf;

            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);
        }
示例#4
0
        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);
        }