Example #1
0
    def test_set_is_opaque(self):
        b = SkBitmap()

        for v in (True, False):
            b.setIsOpaque(v)

            self.assertEqual(b.isOpaque(), v)
Example #2
0
    def test_read_pixels(self):
        bitmap = SkBitmap()
        bitmap.setConfig(SkBitmap.kA8_Config, 1, 1)

        self.assertIsInstance(self.canvas.readPixels(bitmap, 0, 0), bool)
        self.assertIsInstance(
            self.canvas.readPixels(
                bitmap, 1, 1, SkCanvas.kNative_Premul_Config8888
            ),
            bool
        )
Example #3
0
    def test_write_pixels(self):
        bitmap = SkBitmap()
        bitmap.setConfig(SkBitmap.kA8_Config, 1, 1)

        self.canvas.readPixels(bitmap, 0, 0)
        self.canvas.readPixels(bitmap, 1, 1, SkCanvas.kNative_Premul_Config8888)
Example #4
0
    def test_set_volatile(self):
        b = SkBitmap()
        self.assertFalse(b.isVolatile())

        b.setIsVolatile(True)
        self.assertTrue(b.isVolatile())
Example #5
0
    def test_set_immutable(self):
        b = SkBitmap()
        self.assertFalse(b.isImmutable())

        b.setImmutable()
        self.assertTrue(b.isImmutable())
Example #6
0
    def test_set_config(self):
        b = SkBitmap()

        b.setConfig(SkBitmap.kARGB_8888_Config, 1, 1)
        b.setConfig(SkBitmap.kARGB_8888_Config, 1, 1, 1)
Example #7
0
    def test_set_pixel_ref(self):
        b = SkBitmap()
        b.setPixelRef(SkPixelRef())

        self.assertIsInstance(SkBitmap().pixelRef(), SkPixelRef)
Example #8
0
    def test_get_texture(self):
        b = SkBitmap()
        b.setConfig(SkBitmap.kA8_Config, 1, 1)

        self.assertIsInstance(b.getTexture(), SkGpuTexture)