예제 #1
0
def test_mask_parameters():
    check_write_read(MaskParameters())
    check_write_read(MaskParameters(None, None, None, 1.0))
    check_write_read(MaskParameters(255, None, None, 1.0))
    check_write_read(MaskParameters(None, 1.0, None, 1.0))
    check_write_read(MaskParameters(255, 1.0, 255, None))
    assert MaskParameters().tobytes() == b'\x00'
    assert len(MaskParameters(255, 1.0, 255, 1.0).tobytes()) == 19
예제 #2
0
    check_write_read(MaskFlags())
    check_write_read(MaskFlags(True, True, True, True, True))


@pytest.mark.parametrize(['fixture'], [
    (b'(', ),
    (b'\t', ),
])
def test_mask_flags_rw(fixture):
    check_read_write(MaskFlags, fixture)


@pytest.mark.parametrize(['args'], [
    (dict(), ),
    (dict(flags=MaskFlags(parameters_applied=True),
          parameters=MaskParameters(255, 1.0, None, None)), ),
    (dict(
        real_flags=MaskFlags(True, True, True, True, True),
        real_background_color=255,
        real_top=0,
        real_left=0,
        real_bottom=100,
        real_right=100,
    ), ),
    (dict(
        flags=MaskFlags(parameters_applied=True),
        parameters=MaskParameters(None, 1.0, None, 1.0),
        real_flags=MaskFlags(True, True, True, True, True),
        real_background_color=255,
        real_top=0,
        real_left=0,
예제 #3
0
def test_mask_flags_wr():
    check_write_read(MaskFlags())
    check_write_read(MaskFlags(True, True, True, True, True))


@pytest.mark.parametrize(['fixture'], [
    (b'(', ),
    (b'\t', ),
])
def test_mask_flags_rw(fixture):
    check_read_write(MaskFlags, fixture)


@pytest.mark.parametrize(['args'], [
    (dict(), ),
    (dict(flags=MaskFlags(parameters_applied=True), parameters=MaskParameters(255, 1.0, None, None)), ),
    (dict(
        real_flags=MaskFlags(True, True, True, True, True),
        real_background_color=255,
        real_top=0,
        real_left=0,
        real_bottom=100,
        real_right=100,
    ), ),
    (dict(
        flags=MaskFlags(parameters_applied=True),
        parameters=MaskParameters(None, 1.0, None, 1.0),
        real_flags=MaskFlags(True, True, True, True, True),
        real_background_color=255,
        real_top=0,
        real_left=0,