コード例 #1
0
def test_Image_makeWithFilter(image, context):
    outSubset = skia.IRect(100, 100)
    offset = skia.IPoint(0, 0)
    assert isinstance(
        image.makeWithFilter(context, skia.ImageFilters.Blur(1., 1.),
                             skia.IRect(100, 100), skia.IRect(100, 100),
                             outSubset, offset), skia.Image)
コード例 #2
0
ファイル: test_rect.py プロジェクト: taroyuyu/skia-python
def test_IRect_setLTRB(irect):
    irect.setLTRB(0, 0, 240, 120)


def test_IRect_setXYWH(irect):
    irect.setXYWH(0, 0, 240, 120)


def test_IRect_setWH(irect):
    irect.setWH(240, 120)


@pytest.mark.parametrize('args', [
    (10, 10),
    (skia.IPoint(10, 10), ),
])
def test_IRect_makeOffset(irect, args):
    assert isinstance(irect.makeOffset(*args), skia.IRect)


def test_IRect_makeInset(irect):
    assert isinstance(irect.makeInset(10, 10), skia.IRect)


def test_IRect_makeOutset(irect):
    assert isinstance(irect.makeOutset(10, 10), skia.IRect)


@pytest.mark.parametrize('args', [
    (10, 10),
コード例 #3
0
def test_Canvas_accessTopLayerPixels(canvas):
    point = skia.IPoint(0, 0)
    assert isinstance(canvas.accessTopLayerPixels(point),
                      (type(None), memoryview))
コード例 #4
0
ファイル: test_point.py プロジェクト: Bloodb0ne/skia-python
def test_IPoint_init():
    assert isinstance(skia.IPoint(4, 3), skia.IPoint)
    assert isinstance(skia.IPoint.Make(4, 3), skia.IPoint)
コード例 #5
0
ファイル: test_matrix.py プロジェクト: Bloodb0ne/skia-python
def test_Matrix_setScaleTranslate(matrix):
    matrix.setScaleTranslate(1, 1, 0, 0)


def test_Matrix_isFinite(matrix):
    assert isinstance(matrix.isFinite(), bool)


def test_Matrix_MakeScale():
    assert isinstance(skia.Matrix.MakeScale(1, 1), skia.Matrix)


@pytest.mark.parametrize('args', [
    (0, 0),
    (skia.Point(0, 0), ),
    (skia.IPoint(0, 0), ),
])
def test_Matrix_MakeTrans(args):
    assert isinstance(skia.Matrix.MakeTrans(*args), skia.Matrix)


def test_Matrix_MakeAll():
    assert isinstance(skia.Matrix.MakeAll(1, 0, 0, 0, 1, 0, 0, 0, 1),
                      skia.Matrix)


def test_Matrix_MakeRectToRect():
    assert isinstance(
        skia.Matrix.MakeRectToRect(skia.Rect(100, 100), skia.Rect(100, 100),
                                   skia.Matrix.kCenter_ScaleToFit),
        skia.Matrix)
コード例 #6
0
def test_IPoint_ne(ipoint):
    assert ipoint != skia.IPoint(4, 0)
コード例 #7
0
def test_ImageFilters_MatrixConvolution():
    assert isinstance(skia.ImageFilters.MatrixConvolution(
        skia.ISize(5, 5), [1. for i in range(25)], 1. / 25., 0,
        skia.IPoint(2, 2), skia.TileMode.kClamp, False), skia.ImageFilter)
コード例 #8
0
def test_IPoint_eq(ipoint):
    assert ipoint == skia.IPoint(4, 3)
    assert ipoint == (4, 3)
コード例 #9
0
def test_IPoint_isub(ipoint):
    ipoint -= skia.IPoint(1, 1)
    assert ipoint.equals(3, 2)
コード例 #10
0
def test_IPoint_iadd(ipoint):
    ipoint += skia.IPoint(1, 1)
    assert ipoint.equals(5, 4)
コード例 #11
0
def test_IPoint_init(args):
    assert isinstance(skia.IPoint(*args), skia.IPoint)
コード例 #12
0
    ipoint.fX = 4
    ipoint.fY = 3
    assert ipoint.fX == 4
    assert ipoint.fY == 3


def test_IPoint_eq(ipoint):
    assert ipoint == skia.IPoint(4, 3)
    assert ipoint == (4, 3)


def test_IPoint_ne(ipoint):
    assert ipoint != skia.IPoint(4, 0)


@pytest.mark.parametrize('other', [skia.IPoint(0, 0), (1, 0)])
def test_IPoint_add(ipoint, other):
    assert isinstance(ipoint + other, skia.IPoint)


@pytest.mark.parametrize('other', [skia.IPoint(0, 0), (1, 0)])
def test_IPoint_sub(ipoint, other):
    assert isinstance(ipoint - other, skia.IPoint)


def test_IPoint_Make():
    assert isinstance(skia.IPoint.Make(4, 3), skia.IPoint)


def test_IPoint_iter(ipoint):
    assert tuple(ipoint) == (4, 3)