-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(single-mode): can not recognize class detail button
from adb device fix #135
- Loading branch information
1 parent
3dd5573
commit 5422f0b
Showing
7 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
|
||
|
||
__init__.py: *.png __init__.py.gotmpl | ||
# http://github.com/NateScarlet/gotmpl | ||
ls *.png | jq -nR 'reduce inputs as $$item ([]; . + [$$item]) | { Files: . }' | gotmpl -o $@ __init__.py.gotmpl | ||
py -3.8 -m black -t py38 $@ | ||
|
||
|
||
%.pos.png: | ||
magick convert $@ -depth 1 $@ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from auto_derby import template | ||
from pathlib import Path | ||
from typing import Text | ||
|
||
import PIL.Image | ||
|
||
from .. import mathtools | ||
|
||
DATA_PATH = Path(__file__).parent / "test_data" | ||
|
||
|
||
def use_screenshot(name: Text): | ||
img = PIL.Image.open(DATA_PATH / name).convert("RGB") | ||
template.g.screenshot_width = img.width | ||
return img, mathtools.ResizeProxy(img.width) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+204 Bytes
(230%)
auto_derby/templates/single_mode_class_detail_button.pos.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
auto_derby/templates/single_mode_class_detail_button_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from . import _test | ||
from .. import template, templates, action | ||
|
||
|
||
_EXPECTED_POS = (114, 165) | ||
|
||
|
||
def test_match(): | ||
img, rp = _test.use_screenshot("single_mode_command_scene.png") | ||
res = tuple(template.match(img, templates.SINGLE_MODE_CLASS_DETAIL_BUTTON)) | ||
assert len(res) == 1 | ||
(match1,) = res | ||
assert match1[1] == rp.vector2(_EXPECTED_POS, 540) | ||
|
||
|
||
def test_match_issue135(): | ||
img, rp = _test.use_screenshot("single_mode_command_scene_issue135.png") | ||
res = tuple(template.match(img, templates.SINGLE_MODE_CLASS_DETAIL_BUTTON)) | ||
assert len(res) == 1 | ||
(match1,) = res | ||
assert match1[1] == rp.vector2(_EXPECTED_POS, 540) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.64 MB
auto_derby/templates/test_data/single_mode_command_scene_issue135.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.