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); }
private void CheckConsistency(ColConfWin ccw) { Assert.IsTrue(ccw.GetFlag(ColConfWin.RuleFlag.undefined)); Assert.ThrowsException <ArgumentOutOfRangeException> (() => ccw.GetFlag(ColConfWin.RuleFlag.last)); switch (ccw.IllRuleToUse) { case ColConfWin.IllRule.ceras: Assert.IsTrue(ccw.GetFlag(ColConfWin.RuleFlag.IllCeras)); Assert.IsFalse(ccw.GetFlag(ColConfWin.RuleFlag.IllLireCouleur)); break; case ColConfWin.IllRule.lirecouleur: Assert.IsTrue(ccw.GetFlag(ColConfWin.RuleFlag.IllLireCouleur)); Assert.IsFalse(ccw.GetFlag(ColConfWin.RuleFlag.IllCeras)); break; case ColConfWin.IllRule.undefined: Assert.IsFalse(ccw.GetFlag(ColConfWin.RuleFlag.IllLireCouleur)); Assert.IsFalse(ccw.GetFlag(ColConfWin.RuleFlag.IllCeras)); break; default: throw new ArgumentOutOfRangeException("Valeur inconnue pour IllRuleToUse"); break; } }