From 5bb1f58b12a409327e41b38c9616c3dfc745a690 Mon Sep 17 00:00:00 2001 From: JE-Chen <33644111+JE-Chen@users.noreply.github.com> Date: Tue, 20 Dec 2022 15:46:53 +0800 Subject: [PATCH 1/5] now locate image center will return int array not numpy int64 array now locate image center will return int array not numpy int64 array int(numpy int64) --- .idea/workspace.xml | 120 +++---- dev_setup.py | 2 +- je_auto_control/wrapper/auto_control_image.py | 7 +- test/test_source/1.png | Bin 270 -> 250 bytes test/unit_test/execute_action/test.json | 38 +-- test/unit_test/html_report/default_name.html | 295 ++++++++++++++++++ 6 files changed, 365 insertions(+), 97 deletions(-) create mode 100644 test/unit_test/html_report/default_name.html diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 9bf5e1a..fb6297c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,36 +3,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - { - "keyToString": { - "DefaultHtmlFileTemplate": "HTML File", - "RunOnceActivity.OpenProjectViewOnStart": "true", - "RunOnceActivity.ShowReadmeOnStart": "true", - "WebServerToolWindowFactoryState": "false", - "last_opened_file_path": "C:/program_workspace/python/AutoControl/docs/source/Zh_Hant_TW", - "nodejs_package_manager_path": "npm", - "settings.editor.selected.configurable": "com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable", - "vue.rearranger.settings.migration": "true" + +}]]> + - @@ -108,7 +82,7 @@ - + - + - + - + - + + + + + + + + @@ -492,6 +473,20 @@ + + + + + + + + + + + + + + @@ -512,4 +507,9 @@ + + + + + \ No newline at end of file diff --git a/dev_setup.py b/dev_setup.py index b7dc7de..9145d3d 100644 --- a/dev_setup.py +++ b/dev_setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="je_auto_control_dev", - version="0.0.48", + version="0.0.49", author="JE-Chen", author_email="zenmailman@gmail.com", description="auto testing", diff --git a/je_auto_control/wrapper/auto_control_image.py b/je_auto_control/wrapper/auto_control_image.py index 3844e10..05f11fc 100644 --- a/je_auto_control/wrapper/auto_control_image.py +++ b/je_auto_control/wrapper/auto_control_image.py @@ -1,6 +1,7 @@ import sys from typing import List, Union + from je_auto_control.utils.exception.exception_tag import cant_find_image from je_auto_control.utils.exception.exception_tag import find_image_error_variable from je_auto_control.utils.exception.exceptions import ImageNotFoundException @@ -24,7 +25,7 @@ def locate_all_image(image, detect_threshold: [float, int] = 1, try: image_data_array = template_detection.find_image_multi(image, detect_threshold, draw_image) except ImageNotFoundException as error: - raise ImageNotFoundException(find_image_error_variable + " " + repr(error)) + raise ImageNotFoundException(find_image_error_variable + " " + repr(error) + " " + str(image)) if image_data_array[0] is True: record_action_to_list("locate_all_image", param) return image_data_array[1] @@ -47,13 +48,13 @@ def locate_image_center(image, detect_threshold: [float, int] = 1, draw_image: b try: image_data_array = template_detection.find_image(image, detect_threshold, draw_image) except ImageNotFoundException as error: - raise ImageNotFoundException(find_image_error_variable + " " + repr(error)) + raise ImageNotFoundException(find_image_error_variable + " " + repr(error) + " " + str(image)) if image_data_array[0] is True: height = image_data_array[1][2] - image_data_array[1][0] width = image_data_array[1][3] - image_data_array[1][1] center = [int(height / 2), int(width / 2)] record_action_to_list("locate_image_center", param) - return [image_data_array[1][0] + center[0], image_data_array[1][1] + center[1]] + return [int(image_data_array[1][0] + center[0]), int(image_data_array[1][1] + center[1])] else: raise ImageNotFoundException(cant_find_image) except Exception as error: diff --git a/test/test_source/1.png b/test/test_source/1.png index 87ebb02e3537939e662dc13b49963a2b62b5230f..3f94725e96027aabe70645445391fb17cf172114 100644 GIT binary patch delta 207 zcmeBU`o*Z&8Q|y6%O%Cdz`(%k>ERLtq?LhKhJy`AzW&OlI8o8GzTeZuF(ktM?X``( zM+7B~J$%0|JmP>7SM!Yn9Bc+nygUi2-GAOI72UmEBT`g3-)%*m;-S|+CwcF=Ucq`y zp~q38S*CO4R3a(4IY+$M9Ik)^Fu5 zYqwfvtt>xgY3}UzYya&Mu4GjKkSRYD-6fh0*mi2TJz@TOKrYHPf1?x7jSQZyelF{r G5}E*uqf=V| delta 227 zcmeyx*vF*U8Q|y6%O%Cdz`(%k>ERLtq_u%qi-QeBGA>G;sAyWh*we)^B*OjejorLQ z6a-u^e%$8BKE;7irNo7G3!5b4lM5a7v-r+%U)VRf$MmA;CY_m&_ncI#v)XhROIfOttw^bG!5N8-t%4?y8U%+U#;I|OZ8+PPtBKN zPkyfbxoYdTb8|jt_Ef4Lnq+zXK-6mgi2uJ$9g;z&NOT|SwnR4hl-oun@xJ6EMmeFs Ro&ep=;OXk;vd$@?2>=R-ThRaj diff --git a/test/unit_test/execute_action/test.json b/test/unit_test/execute_action/test.json index 3a7ba11..d7b0b59 100644 --- a/test/unit_test/execute_action/test.json +++ b/test/unit_test/execute_action/test.json @@ -1,35 +1,7 @@ [ - [ - "type_key", - { - "keycode": 0 - } - ], - [ - "mouse_left", - { - "mouse_keycode": "mouse_left", - "x": 500, - "y": 500 - } - ], - [ - "position" - ], - [ - "press_mouse", - { - "mouse_keycode": "mouse_left", - "x": 500, - "y": 500 - } - ], - [ - "release_mouse", - { - "mouse_keycode": "mouse_left", - "x": 500, - "y": 500 - } - ] + ["type_key", {"keycode": 0}], + ["mouse_left", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], + ["position"], + ["press_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], + ["release_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}] ] \ No newline at end of file diff --git a/test/unit_test/html_report/default_name.html b/test/unit_test/html_report/default_name.html new file mode 100644 index 0000000..c9fb00e --- /dev/null +++ b/test/unit_test/html_report/default_name.html @@ -0,0 +1,295 @@ + + + + + AutoControl Report + + + + +

+ Test Report +

+ + + + + + + + + + + + + + + + + + + + + + + + +
Test Report
function_nametype_key
param{'keycode': 65, 'is_shift': False, 'skip_record': False}
time2022-11-29 14:29:16.294245
exceptionNone
+
+ + + + + + + + + + + + + + + + + + + + + + + +
Test Report
function_nameposition
paramNone
time2022-11-29 14:29:16.300627
exceptionNone
+
+ + + + + + + + + + + + + + + + + + + + + + + +
Test Report
function_nameclick_mouse
param{'mouse_keycode': 'mouse_left', 'x': 500, 'y': 500}
time2022-11-29 14:29:16.307549
exceptionNone
+
+ + + + + + + + + + + + + + + + + + + + + + + +
Test Report
function_nameposition
paramNone
time2022-11-29 14:29:16.307549
exceptionNone
+
+ + + + + + + + + + + + + + + + + + + + + + + +
Test Report
function_nameposition
paramNone
time2022-11-29 14:29:16.307549
exceptionNone
+
+ + + + + + + + + + + + + + + + + + + + + + + +
Test Report
function_namepress_mouse
param{'mouse_keycode': 'mouse_left', 'x': 500, 'y': 500}
time2022-11-29 14:29:16.311854
exceptionNone
+
+ + + + + + + + + + + + + + + + + + + + + + + +
Test Report
function_nameposition
paramNone
time2022-11-29 14:29:16.311854
exceptionNone
+
+ + + + + + + + + + + + + + + + + + + + + + + +
Test Report
function_namepress_mouse
param{'mouse_keycode': 'mouse_left', 'x': 500, 'y': 500}
time2022-11-29 14:29:16.312852
exceptionNone
+
+ + + + + + + + + + + + + + + + + + + + + + + +
Test Report
function_nameexecute_action
paramNone
time2022-11-29 14:29:16.312852
exception'TypeError("type_key() got an unexpected keyword argument \'mouse_keycode\'")'
+
+ + \ No newline at end of file From 216dd23ecf5efb7a711c1e3f808cf5d16a514cb5 Mon Sep 17 00:00:00 2001 From: JE-Chen <33644111+JE-Chen@users.noreply.github.com> Date: Tue, 20 Dec 2022 20:26:35 +0800 Subject: [PATCH 2/5] update stable version update stable version --- .idea/workspace.xml | 7 ++----- setup.py | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index fb6297c..ec9d1a9 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,10 +3,7 @@ - - - - + diff --git a/setup.py b/setup.py index 0fa1768..d225104 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="je_auto_control", - version="0.0.114", + version="0.0.115", author="JE-Chen", author_email="zenmailman@gmail.com", description="auto testing", From 3851dd5d650d81678893718b7f18b52f9edf795d Mon Sep 17 00:00:00 2001 From: JE-Chen <33644111+JE-Chen@users.noreply.github.com> Date: Wed, 21 Dec 2022 19:00:04 +0800 Subject: [PATCH 3/5] now can't find image will show can;t find what image now can't find image will show can;t find what image --- .idea/workspace.xml | 27 ++++++++++--------- dev_setup.py | 2 +- je_auto_control/wrapper/auto_control_image.py | 6 ++--- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index ec9d1a9..0f2e19c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,7 +3,6 @@ - - { + "keyToString": { + "DefaultHtmlFileTemplate": "HTML File", + "RunOnceActivity.OpenProjectViewOnStart": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "WebServerToolWindowFactoryState": "false", + "last_opened_file_path": "C:/program_workspace/python/AutoControl", + "nodejs_package_manager_path": "npm", + "settings.editor.selected.configurable": "editor.preferences.fonts.default", + "vue.rearranger.settings.migration": "true" } -}]]> +}
@@ -483,7 +482,9 @@ - + + + diff --git a/dev_setup.py b/dev_setup.py index 9145d3d..c9a6648 100644 --- a/dev_setup.py +++ b/dev_setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="je_auto_control_dev", - version="0.0.49", + version="0.0.50", author="JE-Chen", author_email="zenmailman@gmail.com", description="auto testing", diff --git a/je_auto_control/wrapper/auto_control_image.py b/je_auto_control/wrapper/auto_control_image.py index 05f11fc..c779d32 100644 --- a/je_auto_control/wrapper/auto_control_image.py +++ b/je_auto_control/wrapper/auto_control_image.py @@ -30,7 +30,7 @@ def locate_all_image(image, detect_threshold: [float, int] = 1, record_action_to_list("locate_all_image", param) return image_data_array[1] else: - raise ImageNotFoundException(cant_find_image) + raise ImageNotFoundException(cant_find_image + " / " + repr(image)) except Exception as error: record_action_to_list("locate_all_image", param, repr(error)) print(repr(error), file=sys.stderr) @@ -56,7 +56,7 @@ def locate_image_center(image, detect_threshold: [float, int] = 1, draw_image: b record_action_to_list("locate_image_center", param) return [int(image_data_array[1][0] + center[0]), int(image_data_array[1][1] + center[1])] else: - raise ImageNotFoundException(cant_find_image) + raise ImageNotFoundException(cant_find_image + " / " + repr(image)) except Exception as error: record_action_to_list("locate_image_center", param, repr(error)) print(repr(error), file=sys.stderr) @@ -90,7 +90,7 @@ def locate_and_click( record_action_to_list("locate_and_click", param) return [image_center_x, image_center_y] else: - raise ImageNotFoundException(cant_find_image) + raise ImageNotFoundException(cant_find_image + " / " + repr(image)) except Exception as error: record_action_to_list("locate_and_click", param, repr(error)) print(repr(error), file=sys.stderr) From 7b08bb28404cd1189733ca6c27b665bbd55069aa Mon Sep 17 00:00:00 2001 From: JE-Chen <33644111+JE-Chen@users.noreply.github.com> Date: Wed, 21 Dec 2022 19:20:04 +0800 Subject: [PATCH 4/5] update stable version update stable version --- .idea/workspace.xml | 2 ++ setup.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0f2e19c..d354410 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,6 +3,7 @@ + diff --git a/setup.py b/setup.py index d225104..8347a9f 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="je_auto_control", - version="0.0.115", + version="0.0.116", author="JE-Chen", author_email="zenmailman@gmail.com", description="auto testing", From e900b65754c251efe4618dddb78e36089eb95b10 Mon Sep 17 00:00:00 2001 From: JE-Chen <33644111+JE-Chen@users.noreply.github.com> Date: Wed, 21 Dec 2022 20:19:14 +0800 Subject: [PATCH 5/5] update dev and stable now locate and click will return int(x), int(y) not Numpyint64(x) Numpyint64(y) --- .idea/workspace.xml | 5 ++++- dev_setup.py | 2 +- je_auto_control/wrapper/auto_control_image.py | 2 +- setup.py | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d354410..0836728 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,6 +3,8 @@ + + diff --git a/dev_setup.py b/dev_setup.py index c9a6648..3ccac5a 100644 --- a/dev_setup.py +++ b/dev_setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="je_auto_control_dev", - version="0.0.50", + version="0.0.51", author="JE-Chen", author_email="zenmailman@gmail.com", description="auto testing", diff --git a/je_auto_control/wrapper/auto_control_image.py b/je_auto_control/wrapper/auto_control_image.py index c779d32..f0bdf86 100644 --- a/je_auto_control/wrapper/auto_control_image.py +++ b/je_auto_control/wrapper/auto_control_image.py @@ -88,7 +88,7 @@ def locate_and_click( set_position(int(image_center_x), int(image_center_y)) click_mouse(mouse_keycode) record_action_to_list("locate_and_click", param) - return [image_center_x, image_center_y] + return [int(image_center_x), int(image_center_y)] else: raise ImageNotFoundException(cant_find_image + " / " + repr(image)) except Exception as error: diff --git a/setup.py b/setup.py index 8347a9f..7a2cde3 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="je_auto_control", - version="0.0.116", + version="0.0.117", author="JE-Chen", author_email="zenmailman@gmail.com", description="auto testing",