Exemple #1
0
    def test_BitmapFont(self):
        sf = sdlsurface.load_bmp(RESOURCES.get_path("font.bmp"))
        self.assertIsInstance(sf, sdlsurface.SDL_Surface)
        font = video.BitmapFont(sf, (32, 32), FONTMAP)
        self.assertIsInstance(font, video.BitmapFont)

        sprite = video.SoftwareSprite(sf, True)
        self.assertIsInstance(sprite, video.SoftwareSprite)
        font = video.BitmapFont(sprite, (32, 32), FONTMAP)
        self.assertIsInstance(font, video.BitmapFont)
Exemple #2
0
    def test_load_bmp(self):
        fpath = os.path.join(os.path.dirname(__file__), "resources")
        imgpath = os.path.join(fpath, "surfacetest.bmp")
        imgsurface = surface.load_bmp(imgpath)
        self.assertIsInstance(imgsurface, surface.SDL_Surface)
        surface.free_surface(imgsurface)

        self.assertRaises(sdl.SDLError, surface.load_bmp, "invalid path")
        self.assertRaises(sdl.SDLError, surface.load_bmp, None)
        self.assertRaises(sdl.SDLError, surface.load_bmp, 1234)