示例#1
0
        public void TestEvents1()
        {
            ColConfWin ccw = conf.colors[PhonConfType.phonemes];

            // IllRuleToUse
            ccw.IllRuleToUse = ColConfWin.IllRule.undefined;
            ResetEventCounters();
            ccw.IllRuleToUse = ColConfWin.IllRule.ceras;
            Assert.AreEqual(1, IllModifiedEvents.Count);
            Assert.AreEqual(PhonConfType.phonemes, IllModifiedEvents[0].pct);
            Assert.AreEqual(ColConfWin.IllRule.ceras, ccw.IllRuleToUse);
            Assert.IsTrue(ccw.GetFlag(ColConfWin.RuleFlag.IllCeras));
            Assert.IsFalse(ccw.GetFlag(ColConfWin.RuleFlag.IllLireCouleur));
            ResetEventCounters();
            ccw.IllRuleToUse = ColConfWin.IllRule.ceras;
            Assert.AreEqual(0, IllModifiedEvents.Count);
            Assert.AreEqual(ColConfWin.IllRule.ceras, ccw.IllRuleToUse);
            Assert.IsTrue(ccw.GetFlag(ColConfWin.RuleFlag.IllCeras));
            Assert.IsFalse(ccw.GetFlag(ColConfWin.RuleFlag.IllLireCouleur));
            ResetEventCounters();

            ccw.IllRuleToUse = ColConfWin.IllRule.lirecouleur;
            Assert.AreEqual(1, IllModifiedEvents.Count);
            Assert.AreEqual(PhonConfType.phonemes, IllModifiedEvents[0].pct);
            Assert.AreEqual(ColConfWin.IllRule.lirecouleur, ccw.IllRuleToUse);
            Assert.IsTrue(ccw.GetFlag(ColConfWin.RuleFlag.IllLireCouleur));
            Assert.IsFalse(ccw.GetFlag(ColConfWin.RuleFlag.IllCeras));
            ResetEventCounters();
            ccw.IllRuleToUse = ColConfWin.IllRule.lirecouleur;
            Assert.AreEqual(0, IllModifiedEvents.Count);
            Assert.AreEqual(ColConfWin.IllRule.lirecouleur, ccw.IllRuleToUse);
            Assert.IsTrue(ccw.GetFlag(ColConfWin.RuleFlag.IllLireCouleur));
            Assert.IsFalse(ccw.GetFlag(ColConfWin.RuleFlag.IllCeras));
            ResetEventCounters();

            // defBeh
            ccw.SetDefaultBehaviourTo(ColConfWin.DefBeh.noir);
            ResetEventCounters();
            ccw.SetDefaultBehaviourTo(ColConfWin.DefBeh.transparent);
            Assert.AreEqual(1, DefBehModifiedEvents.Count);
            Assert.AreEqual(PhonConfType.phonemes, DefBehModifiedEvents[0].pct);
            Assert.AreEqual(ColConfWin.DefBeh.transparent, ccw.defBeh);
            ResetEventCounters();
            ccw.SetDefaultBehaviourTo(ColConfWin.DefBeh.transparent);
            Assert.AreEqual(0, DefBehModifiedEvents.Count);
            Assert.AreEqual(ColConfWin.DefBeh.transparent, ccw.defBeh);
            ResetEventCounters();
            ccw.SetDefaultBehaviourTo(ColConfWin.DefBeh.noir);
            Assert.AreEqual(1, DefBehModifiedEvents.Count);
            Assert.AreEqual(PhonConfType.phonemes, DefBehModifiedEvents[0].pct);
            Assert.AreEqual(ColConfWin.DefBeh.noir, ccw.defBeh);
            ResetEventCounters();
            ccw.SetDefaultBehaviourTo(ColConfWin.DefBeh.undefined);
            Assert.AreEqual(1, DefBehModifiedEvents.Count);
            Assert.AreEqual(PhonConfType.phonemes, DefBehModifiedEvents[0].pct);
            Assert.AreEqual(ColConfWin.DefBeh.undefined, ccw.defBeh);
            ResetEventCounters();

            CheckConsistency(ccw);
        }
示例#2
0
        public override void Undo()
        {
            logger.ConditionalDebug("Undo");
            switch (type)
            {
            case "sonCF":
                if (prevCF != null)
                {
                    ccw.SetCFSon(son, prevCF);
                }
                break;

            case "sonCB":
                ccw.SetChkSon(son, prevCB);
                break;

            case "ill":
                ccw.IllRuleToUse = prevIllRule;
                break;

            case "defBeh":
                ccw.SetDefaultBehaviourTo(prevDefBeh);
                break;

            default:
                logger.Error("Type de commande non traitée: {0}", type);
                throw new InvalidOperationException(String.Format("Type de commande non traitée: {0}", type));
            }
        }
示例#3
0
        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);
        }
示例#4
0
        public void TestColConfWinUndo_2()
        {
            ColConfWin ccw = new ColConfWin(PhonConfType.phonemes);

            Assert.AreEqual(ColConfWin.IllRule.ceras, ccw.IllRuleToUse);
            ccw.IllRuleToUse = ColConfWin.IllRule.lirecouleur;
            Assert.AreEqual(ColConfWin.IllRule.lirecouleur, ccw.IllRuleToUse);
            UndoFactory.UndoLastAction();
            Assert.AreEqual(ColConfWin.IllRule.ceras, ccw.IllRuleToUse);

            Assert.AreEqual(ColConfWin.DefBeh.transparent, ccw.defBeh);
            ccw.SetDefaultBehaviourTo(ColConfWin.DefBeh.noir);
            Assert.AreEqual(ColConfWin.DefBeh.noir, ccw.defBeh);
            UndoFactory.UndoLastAction();
            Assert.AreEqual(ColConfWin.DefBeh.transparent, ccw.defBeh);
        }