Пример #1
0
        public void TestMethod1()
        {
            TestTheText ttt  = new TestTheText(txt1);
            Config      conf = new Config();

            ttt.ColorizePhons(conf, PhonConfType.phonemes);
            int index = ttt.S.IndexOf("1867");

            ttt.AssertColor(index, 4, TestTheText.black);

            index = ttt.S.IndexOf("Rênal");
            ttt.AssertColor(index + 5, TestTheText.black);

            index = ttt.S.IndexOf("reme35rciant");
            ttt.AssertColor(index + 4, 2, TestTheText.black);

            index = ttt.S.IndexOf("23femme");
            ttt.AssertColor(index, 2, TestTheText.black);

            index = ttt.S.IndexOf("p45ar");
            ttt.AssertColor(index + 1, 2, TestTheText.black);

            index = ttt.S.IndexOf("déc0123456789idé");
            ttt.AssertColor(index + 3, 10, TestTheText.black);
        }
Пример #2
0
        public void TestTexteVide()
        {
            // le but principal est qu'il n'y ait pas d'exceptions...
            TestTheText ttt  = new TestTheText("");
            Config      conf = new Config();

            ttt.ColorizePhons(conf, PhonConfType.phonemes);
            ttt.ColorizePhons(conf, PhonConfType.muettes);
            List <PhonWord> list = ttt.GetPhonWordList(conf);

            Assert.IsNotNull(list);
            Assert.IsTrue(list.Count == 0);
            list = ttt.GetPhonWordList(conf, true);
            Assert.IsNotNull(list);
            Assert.IsTrue(list.Count == 0);
            ttt.MarkDuo(conf);
            ttt.MarkLetters(conf);
            ttt.MarkLignes(conf);
            ttt.MarkMuettes(conf);
            ttt.MarkNoir(conf);
            conf.sylConf.mode = SylConfig.Mode.ecrit;
            ttt.MarkSyls(conf);
            conf.sylConf.mode = SylConfig.Mode.oral;
            ttt.MarkSyls(conf);
            conf.sylConf.mode = SylConfig.Mode.poesie;
            ttt.MarkSyls(conf);
            ttt.MarkVoyCons(conf);
            ttt.MarkWords(conf);
            _ = ttt.ToLowerString();
            _ = ttt.ToString();
        }
Пример #3
0
        public void MyTestInitialize()
        {
            conf = TestTheText.GetSpecialConfig();
            ExceptionMots excm = new ExceptionMots(excTxt);

            excm.syllabes        = true;
            excm.mots            = true;
            excm.arcs            = true;
            excm.phonemes        = true;
            conf.sylConf.ExcMots = excm;
        }
Пример #4
0
        public void TestInvalidTextEl()
        {
            TestTheText ttt = new TestTheText("Bonjour");

            Assert.ThrowsException <ArgumentNullException>(() => _ = new TextElTest());
            Assert.ThrowsException <ArgumentNullException>(() => _ = new TextEl(null, 17, 18));
            Assert.ThrowsException <ArgumentException>(() => _     = new TextEl(ttt, 17, 18));
            Assert.ThrowsException <ArgumentException>(() => _     = new TextEl(ttt, -10, 18));
            Assert.ThrowsException <ArgumentException>(() => _     = new TextEl(ttt, -10, -2));

            ttt = new TestTheText("");
            Assert.ThrowsException <ArgumentException>(() => _ = new TextEl(ttt, 0, 0));
        }
Пример #5
0
        public void TestArcs()
        {
            TestTheText ttt = new TestTheText(txt1);

            ttt.MarkArcs(conf);
            ttt.AssertDrawArc(0, 2, false);
            ttt.AssertDrawArc(3, 8, true);
            int index = ttt.S.IndexOf("Sifflait");

            ttt.AssertDrawArc(index, 8, true);
            index = ttt.S.IndexOf("On n'avait pas de pain");
            ttt.AssertDrawArc(index, 2, false);
            ttt.AssertDrawArc(index + 3, 7, false);
            index = ttt.S.IndexOf("on était seul");
            ttt.AssertDrawArc(index, 2, false);
            ttt.AssertDrawArc(index + 3, 5, true);
            index = ttt.S.IndexOf("d'ombres");
            ttt.AssertDrawArc(index, 8, false);
        }
Пример #6
0
        public void TestPhonemes()
        {
            TestTheText ttt = new TestTheText(txt1);

            ttt.ColorizePhons(conf, PhonConfType.phonemes);
            ttt.AssertColor(0, TestTheText.black);
            ttt.AssertColor(1, TestTheText.black);
            ttt.AssertNotColor(3, TestTheText.black);
            int index = ttt.S.IndexOf("Sifflait");

            ttt.AssertNotColor(index, 8, TestTheText.black);
            index = ttt.S.IndexOf("On n'avait pas de pain");
            ttt.AssertColor(index, 22, TestTheText.black);
            index = ttt.S.IndexOf("on était seul");
            ttt.AssertColor(index, 2, TestTheText.black);
            ttt.AssertNotColor(index + 3, 5, TestTheText.black);
            index = ttt.S.IndexOf("d'ombres");
            ttt.AssertColor(index, 8, TestTheText.black);
        }
Пример #7
0
        public void TestMots()
        {
            TestTheText ttt = new TestTheText(txt1);

            ttt.MarkWords(conf);
            ttt.AssertColor(0, TestTheText.black);
            ttt.AssertColor(1, TestTheText.black);
            ttt.AssertNotColor(3, TestTheText.black);
            int index = ttt.S.IndexOf("Sifflait");

            ttt.AssertNotColor(index, 8, TestTheText.black);
            index = ttt.S.IndexOf("On n'avait pas de pain");
            ttt.AssertColor(index, 22, TestTheText.black);
            index = ttt.S.IndexOf("on était seul");
            ttt.AssertColor(index, 2, TestTheText.black);
            ttt.AssertNotColor(index + 3, 5, TestTheText.black);
            index = ttt.S.IndexOf("d'ombres");
            ttt.AssertColor(index, 8, TestTheText.black);
        }
Пример #8
0
        public void TestLettresIsolées()
        {
            string txt =
                "a b c d e f g h i j k l m n o p q r s t u v w x y z " +
                "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z " +
                "é à è ö ü ä ù ï ë É À È Ö Ü Ä Ù Ï Ë " +
                "0 1 2 3 4 5 6 7 8 9";

            TestTheText ttt = new TestTheText(txt);

            ttt.ColorizePhons(conf, PhonConfType.phonemes);

            //                           CharFormatting(bold,  itali, under, caps,  chCol,theColor       )
            CharFormatting blackCF = new CharFormatting(false, false, false, false, false, TestTheText.black,
                                                        false, TestTheText.black);

            ttt.AssertCF(0, blackCF);                                               // a
            ttt.AssertCF(2, blackCF);                                               // b
            ttt.AssertCF(4, blackCF);                                               // c
            ttt.AssertCF(6, blackCF);                                               // d
            ttt.AssertCF(8, blackCF);                                               // e
            ttt.AssertCF(10, blackCF);                                              // f
            ttt.AssertCF(12, blackCF);                                              // g
            ttt.AssertCF(14, ColConfWin.coloredCF[(int)tstCERASColor.CERAS_muet]);  // h
            ttt.AssertCF(16, blackCF);                                              // i
            ttt.AssertCF(18, blackCF);                                              // j
            ttt.AssertCF(20, blackCF);                                              // k
            ttt.AssertCF(22, blackCF);                                              // l
            ttt.AssertCF(24, blackCF);                                              // m
            ttt.AssertCF(26, blackCF);                                              // n
            ttt.AssertCF(28, ColConfWin.coloredCF[(int)tstCERASColor.CERAS_o]);     // o
            ttt.AssertCF(30, blackCF);                                              // p
            ttt.AssertCF(32, blackCF);                                              // q
            ttt.AssertCF(34, blackCF);                                              // r
            ttt.AssertCF(36, blackCF);                                              // s
            ttt.AssertCF(38, blackCF);                                              // t
            ttt.AssertCF(40, blackCF);                                              // u
            ttt.AssertCF(42, blackCF);                                              // v
            ttt.AssertCF(44, blackCF);                                              // w
            ttt.AssertCF(46, blackCF);                                              // x
            ttt.AssertCF(48, blackCF);                                              // y
            ttt.AssertCF(50, blackCF);                                              // z

            ttt.AssertCF(52, blackCF);                                              // A
            ttt.AssertCF(54, blackCF);                                              // B
            ttt.AssertCF(56, blackCF);                                              // C
            ttt.AssertCF(58, blackCF);                                              // D
            ttt.AssertCF(60, blackCF);                                              // E
            ttt.AssertCF(62, blackCF);                                              // F
            ttt.AssertCF(64, blackCF);                                              // G
            ttt.AssertCF(66, ColConfWin.coloredCF[(int)tstCERASColor.CERAS_muet]);  // H
            ttt.AssertCF(68, blackCF);                                              // I
            ttt.AssertCF(70, blackCF);                                              // J
            ttt.AssertCF(72, blackCF);                                              // K
            ttt.AssertCF(74, blackCF);                                              // L
            ttt.AssertCF(76, blackCF);                                              // M
            ttt.AssertCF(78, blackCF);                                              // N
            ttt.AssertCF(80, ColConfWin.coloredCF[(int)tstCERASColor.CERAS_o]);     // O
            ttt.AssertCF(82, blackCF);                                              // P
            ttt.AssertCF(84, blackCF);                                              // Q
            ttt.AssertCF(86, blackCF);                                              // R
            ttt.AssertCF(88, blackCF);                                              // S
            ttt.AssertCF(90, blackCF);                                              // T
            ttt.AssertCF(92, blackCF);                                              // U
            ttt.AssertCF(94, blackCF);                                              // V
            ttt.AssertCF(96, blackCF);                                              // W
            ttt.AssertCF(98, blackCF);                                              // X
            ttt.AssertCF(100, blackCF);                                             // Y
            ttt.AssertCF(102, blackCF);                                             // Z

            ttt.AssertCF(104, ColConfWin.coloredCF[(int)tstCERASColor.CERAS_rosé]); // é
            ttt.AssertCF(106, blackCF);                                             // à
            ttt.AssertCF(108, ColConfWin.coloredCF[(int)tstCERASColor.CERAS_E]);    // è
            ttt.AssertCF(110, ColConfWin.coloredCF[(int)tstCERASColor.CERAS_o]);    // ö
            ttt.AssertCF(112, blackCF);                                             // ü
            ttt.AssertCF(114, blackCF);                                             // ä
            ttt.AssertCF(116, blackCF);                                             // ù
            ttt.AssertCF(118, blackCF);                                             // ï
            ttt.AssertCF(120, ColConfWin.coloredCF[(int)tstCERASColor.CERAS_E]);    // ë

            ttt.AssertCF(122, ColConfWin.coloredCF[(int)tstCERASColor.CERAS_rosé]); // É
            ttt.AssertCF(124, blackCF);                                             // À
            ttt.AssertCF(126, ColConfWin.coloredCF[(int)tstCERASColor.CERAS_E]);    // È
            ttt.AssertCF(128, ColConfWin.coloredCF[(int)tstCERASColor.CERAS_o]);    // Ö
            ttt.AssertCF(130, blackCF);                                             // Ü
            ttt.AssertCF(132, blackCF);                                             // Ä
            ttt.AssertCF(134, blackCF);                                             // Ù
            ttt.AssertCF(136, blackCF);                                             // Ï
            ttt.AssertCF(138, ColConfWin.coloredCF[(int)tstCERASColor.CERAS_E]);    // Ë

            ttt.AssertCF(140, blackCF);                                             // 0
            ttt.AssertCF(142, blackCF);                                             // 1
            ttt.AssertCF(144, blackCF);                                             // 2
            ttt.AssertCF(146, blackCF);                                             // 3
            ttt.AssertCF(148, blackCF);                                             // 4
            ttt.AssertCF(150, blackCF);                                             // 5
            ttt.AssertCF(152, blackCF);                                             // 6
            ttt.AssertCF(154, blackCF);                                             // 7
            ttt.AssertCF(156, blackCF);                                             // 8
            ttt.AssertCF(158, blackCF);                                             // 9
        }