Example #1
0
def test_wait_template(region_and_template):
    _, template = region_and_template
    library = Images()
    library.take_screenshot = lambda: to_image(IMAGES / "source.png")

    library.matcher = TemplateMatcher(opencv=True)
    matches = library.wait_template_on_screen(IMAGES / template, timeout=0.52)
    assert len(matches) == 1
Example #2
0
def test_find_template(region_and_template):
    region, template = region_and_template
    region = Region(*region)

    library = Images()
    library.matcher = TemplateMatcher(opencv=True)

    matches = library.find_template_in_image(image=IMAGES / "source.png",
                                             template=IMAGES / template,
                                             limit=1)

    assert len(matches) == 1
    match = matches[0]
    assert match.center == region.center