Example #1
0
def test_WindowsCursor_from_bitmap_with_static_png(static_png, hotspot,
                                                   image_dir) -> None:
    """Testing WindowsCursor `form_bitmap` classmethod for generating **static** cursor."""
    win = WindowsCursor.from_bitmap(
        png=static_png,
        hotspot=hotspot,
        size=(5, 5),
        canvas_size=(10, 10),
        out_dir=image_dir,
    )
    assert win.exists() is True
    assert win.__sizeof__() > 0
Example #2
0
def test_WindowsCursor_from_bitmap_with_animated_png_exceptions(
        animated_png, hotspot, image_dir) -> None:
    """Testing WindowsCursor `form_bitmap` classmethod exceptions for generating **animated** \
    cursor.
    """
    with pytest.raises(KeyError) as excinfo1:
        WindowsCursor.from_bitmap()
    assert str(excinfo1.value) == "\"argument 'png' required\""

    with pytest.raises(KeyError) as excinfo2:
        WindowsCursor.from_bitmap(png=animated_png)
    assert str(excinfo2.value) == "\"argument 'hotspot' required\""

    with pytest.raises(KeyError) as excinfo3:
        WindowsCursor.from_bitmap(png=animated_png, hotspot=hotspot)
    assert str(excinfo3.value) == "\"argument 'size' required\""

    with pytest.raises(KeyError) as excinfo4:
        WindowsCursor.from_bitmap(png=animated_png,
                                  hotspot=hotspot,
                                  size=(5, 5))
    assert str(excinfo4.value) == "\"argument 'canvas_size' required\""

    with pytest.raises(KeyError) as excinfo5:
        WindowsCursor.from_bitmap(png=animated_png,
                                  hotspot=hotspot,
                                  size=(5, 5),
                                  canvas_size=(10, 10))
    assert str(excinfo5.value) == "\"argument 'out_dir' required\""

    with pytest.raises(KeyError) as excinfo6:
        WindowsCursor.from_bitmap(
            png=animated_png,
            hotspot=hotspot,
            canvas_size=(10, 10),
            size=(5, 5),
            out_dir=image_dir,
        )
    assert str(excinfo6.value) == "\"argument 'delay' required\""

    WindowsCursor.from_bitmap(
        png=animated_png,
        hotspot=hotspot,
        canvas_size=(10, 10),
        size=(5, 5),
        out_dir=image_dir,
        position="top_left",
        delay=2,
    )

    WindowsCursor.from_bitmap(
        png=animated_png,
        hotspot=hotspot,
        canvas_size=(10, 10),
        size=(5, 5),
        out_dir=image_dir,
        position="top_left",
        delay=2,
        options=Options(add_shadows=True),
    )