def test_Canvas_getProps(canvas): props = skia.SurfaceProps(skia.SurfaceProps.kLegacyFontHost_InitType) assert isinstance(canvas.getProps(props), bool)
def test_Surface_unique(surface): assert surface.unique() def test_Surface_ref_unref(surface): surface.ref() surface.unref() @pytest.mark.parametrize('args', [ (skia.ImageInfo.MakeN32Premul(16, 16), bytearray(16 * 16 * 4)), (skia.ImageInfo.MakeN32Premul(16, 16), bytearray(16 * 16 * 4), 16 * 4), ( skia.ImageInfo.MakeN32Premul(16, 16), bytearray(16 * 16 * 4), 16 * 4, skia.SurfaceProps(skia.SurfaceProps.kLegacyFontHost_InitType),), ]) def test_Surface_MakeRasterDirect(args): check_surface(skia.Surface.MakeRasterDirect(*args)) @pytest.mark.parametrize('args', [ (skia.ImageInfo.MakeN32Premul(16, 16),), (skia.ImageInfo.MakeN32Premul(16, 16), 16 * 4), ( skia.ImageInfo.MakeN32Premul(16, 16), 16 * 4, skia.SurfaceProps(skia.SurfaceProps.kLegacyFontHost_InitType),), ]) def test_Surface_MakeRaster(args): check_surface(skia.Surface.MakeRaster(*args))
(skia.Point(0, 0), skia.Point(1, 1), skia.ColorRED), (skia.Point(1, 1), skia.Point(1, 0), skia.ColorRED), (skia.Point(1, 0), skia.Point(0, 0), skia.ColorRED), ]) def check_canvas(x): assert isinstance(x, skia.Canvas) @pytest.mark.parametrize('args', [ tuple(), (np.zeros((16, 16, 4), dtype=np.uint8), ), (100, 100), (100, 100, None), (100, 100, skia.SurfaceProps(skia.SurfaceProps.kLegacyFontHost_InitType)), (skia.Bitmap(), ), (skia.Bitmap(), skia.SurfaceProps(skia.SurfaceProps.kLegacyFontHost_InitType)), ]) def test_Canvas_init(args): check_canvas(skia.Canvas(*args)) def test_Canvas_imageInfo(canvas): assert isinstance(canvas.imageInfo(), skia.ImageInfo) def test_Canvas_getProps(canvas): props = skia.SurfaceProps(skia.SurfaceProps.kLegacyFontHost_InitType) assert isinstance(canvas.getProps(props), bool)