コード例 #1
0
        public void LevelsHebrew()
        {
            using (var bidi = new BiDi())
            {
                bidi.SetPara(HEBREW_LONG, BiDi.DEFAULT_LTR, null);

                Assert.AreEqual(BiDi.BiDiDirection.RTL, bidi.Direction);
                Assert.AreEqual(1, bidi.GetParaLevel());
                Assert.AreEqual(1, bidi.GetLevelAt(HEBREW_LONG.Length / 2));
                var levels = bidi.GetLevels().ToArray();
                Assert.AreEqual(HEBREW_LONG.Length, levels.Length);
                Assert.That(levels.Where(ll => ll != 1).Count() == 0);
            }
        }
コード例 #2
0
        public void LevelsHebrewEnglish()
        {
            using (var bidi = new BiDi())
            {
                bidi.SetPara(HEBREW_ENGLISH_MIXED, BiDi.DEFAULT_LTR, null);

                Assert.AreEqual(BiDi.BiDiDirection.MIXED, bidi.Direction);
                Assert.AreEqual(1, bidi.GetParaLevel());
                Assert.AreEqual(1, bidi.GetLevelAt(HEBREW_ENGLISH_MIXED.Length - 1));
                var levels = bidi.GetLevels().ToArray();
                Assert.AreEqual(HEBREW_ENGLISH_MIXED.Length, levels.Length);
                Assert.That(levels.Where(ll => ll == 2).Count() > 0);
            }
        }
コード例 #3
0
        public void LevelsEnglish()
        {
            using (var bidi = new BiDi())
            {
                bidi.SetPara(ENGLISH_LONG, BiDi.DEFAULT_LTR, null);

                Assert.AreEqual(BiDi.BiDiDirection.LTR, bidi.Direction);
                Assert.AreEqual(0, bidi.GetParaLevel());
                Assert.AreEqual(0, bidi.GetLevelAt(ENGLISH_LONG.Length / 2));
                var levels = bidi.GetLevels().ToArray();
                Assert.AreEqual(ENGLISH_LONG.Length, levels.Length);
                Assert.That(levels.Where(ll => ll != 0).Count() == 0);
            }
        }
コード例 #4
0
        public void LevelsEnglishHebrew()
        {
            using (var bidi = new BiDi())
            {
                bidi.SetPara(ENGLISH_HEBREW_MIXED, BiDi.DEFAULT_LTR, null);

                Assert.AreEqual(BiDi.BiDiDirection.MIXED, bidi.Direction);
                Assert.AreEqual(0, bidi.GetParaLevel());
                Assert.AreEqual(0, bidi.GetLevelAt(ENGLISH_HEBREW_MIXED.Length - 1));
                var levels = bidi.GetLevels().ToArray();
                Assert.AreEqual(ENGLISH_HEBREW_MIXED.Length, levels.Length);
                Assert.AreEqual(HEBREW_SHORT.Length, levels.Where(ll => ll != 0).Count());
            }
        }