예제 #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));
        }