def test_BitmapFont(self): sf = surface.SDL_LoadBMP( byteify(RESOURCES.get_path("font.bmp"), "utf-8")) self.assertIsInstance(sf.contents, surface.SDL_Surface) font = sdl2ext.BitmapFont(sf, (32, 32), FONTMAP) self.assertIsInstance(font, sdl2ext.BitmapFont) sprite = sdl2ext.SoftwareSprite(sf.contents, True) self.assertIsInstance(sprite, sdl2ext.SoftwareSprite) font = sdl2ext.BitmapFont(sprite, (32, 32), FONTMAP) self.assertIsInstance(font, sdl2ext.BitmapFont)
def test_BitmapFont_can_render(self): sf = surface.SDL_LoadBMP( byteify(RESOURCES.get_path("font.bmp"), "utf-8")) self.assertIsInstance(sf.contents, surface.SDL_Surface) font = sdl2ext.BitmapFont(sf, (32, 32), FONTMAP) self.assertIsInstance(font, sdl2ext.BitmapFont) self.assertTrue(font.can_render("text")) self.assertTrue(font.can_render("473285435hfsjadfhriuewtrhefd")) self.assertFalse(font.can_render("testä"))
def test_BitmapFont_contains(self): sf = surface.SDL_LoadBMP( byteify(RESOURCES.get_path("font.bmp"), "utf-8")) self.assertIsInstance(sf.contents, surface.SDL_Surface) font = sdl2ext.BitmapFont(sf, (32, 32), FONTMAP) self.assertIsInstance(font, sdl2ext.BitmapFont) for ch in "abcde12345.-,+": self.assertTrue(font.contains(ch)) for ch in "äöüß": self.assertFalse(font.contains(ch))