Пример #1
0
        public void TestFailedCharacterLookup()
        {
            var font    = new TestFontUsage("test");
            var builder = new TextBuilder(new TestStore(), font);

            builder.AddText("a");

            Assert.That(builder.Bounds, Is.EqualTo(Vector2.Zero));
        }
Пример #2
0
        public void TestSameCharacterFallsBackWithNoFontName()
        {
            var font     = new TestFontUsage("test");
            var nullFont = new TestFontUsage(null);
            var builder  = new TextBuilder(new TestStore(
                                               new GlyphEntry(font, new TestGlyph('b', 0, 0, 0, 0, 0, 0, 0)),
                                               new GlyphEntry(nullFont, new TestGlyph('a', 0, 0, 0, 0, 0, 0, 0)),
                                               new GlyphEntry(font, new TestGlyph('?', 0, 0, 0, 0, 0, 0, 0)),
                                               new GlyphEntry(nullFont, new TestGlyph('?', 0, 0, 0, 0, 0, 0, 0))
                                               ), font);

            builder.AddText("a");

            Assert.That(builder.Characters[0].Character, Is.EqualTo('a'));
        }
Пример #3
0
        public void TestFallBackCharacterFallsBackWithFontName()
        {
            var font     = new TestFontUsage("test");
            var nullFont = new TestFontUsage(null);
            var builder  = new TextBuilder(new TestStore(
                                               (font, new TestGlyph('b', 0, 0, 0, 0, 0, 0)),
                                               (nullFont, new TestGlyph('b', 0, 0, 0, 0, 0, 0)),
                                               (font, new TestGlyph('?', 0, 0, 0, 0, 0, 0)),
                                               (nullFont, new TestGlyph('?', 1, 0, 0, 0, 0, 0))
                                               ), font);

            builder.AddText("a");

            Assert.That(builder.Characters[0].Character, Is.EqualTo('?'));
            Assert.That(builder.Characters[0].XOffset, Is.EqualTo(0));
        }