diff --git a/src/sr/const/traing_mission_const.py b/src/sr/const/traing_mission_const.py index c7868d5d..fadc0780 100644 --- a/src/sr/const/traing_mission_const.py +++ b/src/sr/const/traing_mission_const.py @@ -19,6 +19,7 @@ def __init__(self, id_cn: str, desc_cn: str, able: bool): MISSION_DAILY_MISSION = DailyTrainingMission(id_cn='日常任务', desc_cn='完成1个日常任务', able=False) +MISSION_PATH = DailyTrainingMission(id_cn='侵蚀隧洞', desc_cn='完成1次侵蚀隧洞', able=False) # 1.6之后没了 MISSION_TRA_POWER = DailyTrainingMission(id_cn='消耗开拓力', desc_cn='累计消耗120点开拓力', able=False) MISSION_FORGOTTEN_HALL = DailyTrainingMission(id_cn='忘却之庭', desc_cn='完成1次忘却之庭', able=False) MISSION_SYNTHESIZE_CONSUMABLE = DailyTrainingMission(id_cn='合成', desc_cn='使用1次万能合成机', able=True) diff --git a/test/resources/sr/app/test_destroy_objects/1.png b/test/resources/sr/app/test_destroy_objects/1.png deleted file mode 100644 index efa7eb20..00000000 Binary files a/test/resources/sr/app/test_destroy_objects/1.png and /dev/null differ diff --git a/test/resources/sr/app/test_destroy_objects/2.png b/test/resources/sr/app/test_destroy_objects/2.png deleted file mode 100644 index 84704d99..00000000 Binary files a/test/resources/sr/app/test_destroy_objects/2.png and /dev/null differ diff --git a/test/resources/sr/app/test_destroy_objects/3.png b/test/resources/sr/app/test_destroy_objects/3.png deleted file mode 100644 index 7ceaa5a1..00000000 Binary files a/test/resources/sr/app/test_destroy_objects/3.png and /dev/null differ diff --git a/test/resources/sr/app/test_destroy_objects/4.png b/test/resources/sr/app/test_destroy_objects/4.png deleted file mode 100644 index 9637f0c1..00000000 Binary files a/test/resources/sr/app/test_destroy_objects/4.png and /dev/null differ diff --git a/test/resources/sr/operation/unit/guide/test_get_training_unfinished_mission/1.png b/test/resources/sr/operation/unit/guide/test_get_training_unfinished_mission/1.png deleted file mode 100644 index cfb2ceb8..00000000 Binary files a/test/resources/sr/operation/unit/guide/test_get_training_unfinished_mission/1.png and /dev/null differ diff --git a/test/resources/sr/operation/unit/guide/test_get_training_unfinished_mission/2.png b/test/resources/sr/operation/unit/guide/test_get_training_unfinished_mission/2.png deleted file mode 100644 index 679d517d..00000000 Binary files a/test/resources/sr/operation/unit/guide/test_get_training_unfinished_mission/2.png and /dev/null differ diff --git a/test/resources/sr/operation/unit/test_team/members_1.png b/test/resources/sr/operation/unit/test_team/members_1.png deleted file mode 100644 index a334679d..00000000 Binary files a/test/resources/sr/operation/unit/test_team/members_1.png and /dev/null differ diff --git a/test/resources/sr/sim_uni/op/test_sim_uni_battle/after_elite_curio.png b/test/resources/sr/sim_uni/op/test_sim_uni_battle/after_elite_curio.png deleted file mode 100644 index 2a575dea..00000000 Binary files a/test/resources/sr/sim_uni/op/test_sim_uni_battle/after_elite_curio.png and /dev/null differ diff --git a/test/resources/sr/sim_uni/op/test_sim_uni_battle/recover_technique_point.png b/test/resources/sr/sim_uni/op/test_sim_uni_battle/recover_technique_point.png deleted file mode 100644 index f2f8fa32..00000000 Binary files a/test/resources/sr/sim_uni/op/test_sim_uni_battle/recover_technique_point.png and /dev/null differ diff --git a/test/src/test/sr/app/test_destroy_objects.py b/test/src/test/sr/app/debug_destroy_objects.py similarity index 100% rename from test/src/test/sr/app/test_destroy_objects.py rename to test/src/test/sr/app/debug_destroy_objects.py diff --git a/test/src/test/sr/operation/unit/rogue/__init__.py b/test/src/test/sr/app/trailblaze_power/__init__.py similarity index 100% rename from test/src/test/sr/operation/unit/rogue/__init__.py rename to test/src/test/sr/app/trailblaze_power/__init__.py diff --git a/test/resources/sr/app/test_trailblaze_power/sim_uni_power.png b/test/src/test/sr/app/trailblaze_power/sim_uni_power.png similarity index 100% rename from test/resources/sr/app/test_trailblaze_power/sim_uni_power.png rename to test/src/test/sr/app/trailblaze_power/sim_uni_power.png diff --git a/test/src/test/sr/app/test_trailblaze_power.py b/test/src/test/sr/app/trailblaze_power/test_trailblaze_power.py similarity index 89% rename from test/src/test/sr/app/test_trailblaze_power.py rename to test/src/test/sr/app/trailblaze_power/test_trailblaze_power.py index c5ec0adc..a01f39ba 100644 --- a/test/src/test/sr/app/test_trailblaze_power.py +++ b/test/src/test/sr/app/trailblaze_power/test_trailblaze_power.py @@ -16,7 +16,7 @@ def test_get_sim_uni_power_and_qty(self): op = TrailblazePower(ctx) - screen = self.get_test_image('sim_uni_power') + screen = self.get_test_image_new('sim_uni_power.png') x, y = op._get_sim_uni_power_and_qty(screen) self.assertEqual(92, x) diff --git a/test/src/test/sr/cal_pos/test_cal_pos/__init__.py b/test/src/test/sr/cal_pos/test_cal_pos/__init__.py index 321806ad..e69de29b 100644 --- a/test/src/test/sr/cal_pos/test_cal_pos/__init__.py +++ b/test/src/test/sr/cal_pos/test_cal_pos/__init__.py @@ -1,137 +0,0 @@ -import os - -import cv2 - -import test -from basic import Point, cal_utils -from basic.img.os import get_debug_image -from basic.log_utils import log -from sr import cal_pos, performance_recorder -from sr.cal_pos import VerifyPosInfo -from sr.const.map_const import get_region_by_prl_id -from sr.context import get_context -from sr.image.image_holder import ImageHolder -from sr.image.sceenshot import mini_map, large_map -from test.sr.cal_pos.cal_pos_test_case import TestCase, read_test_cases, save_test_cases - - -class TestCalPos(test.SrTestBase): - - def __init__(self, *args, **kwargs): - test.SrTestBase.__init__(self, *args, **kwargs) - - ih = ImageHolder() - # 预热 方便后续统计耗时 - ih.preheat_for_world_patrol() - mini_map.preheat() - - @property - def cases_path(self) -> str: - return os.path.join(self.sub_package_path, 'test_cases.yml') - - def test_cal_pos(self): - fail_cnt = 0 - self.cases = read_test_cases(self.cases_path) - for case in self.cases: - result = self.run_one_test_case(case, show=False) - if not result: - fail_cnt += 1 - log.info('%s 计算坐标失败', case.unique_id) - - performance_recorder.log_all_performance() - self.assertEqual(0, fail_cnt) - - def test_specified_one(self): - fail_cnt = 0 - self.cases = read_test_cases(self.cases_path) - for case in self.cases: - if case.unique_id != 'P04_PNKN_R06_CSSH_02': - continue - result = self.run_one_test_case(case, show=True) - if not result: - fail_cnt += 1 - log.info('%s 计算坐标失败', case.unique_id) - - performance_recorder.log_all_performance() - self.assertEqual(0, fail_cnt) - - def test_init_case(self): - """ - 从debug中初始化 - :return: - """ - ctx = get_context() - file_name: str = '_1711787600419' - mm = get_debug_image(file_name) - - str_list = file_name.split('_') - is_running = (bool)(str_list.pop()) - pp_r = (int)(str_list.pop()) - pp_y = (int)(str_list.pop()) - pp_x = (int)(str_list.pop()) - region_prl_id = '_'.join(str_list) - - region = get_region_by_prl_id(region_prl_id) - - self.cases = read_test_cases(self.cases_path) - idx: int = 1 - while True: - existed: bool = False - for c in self.cases: - if c.region.prl_id != region_prl_id: - continue - if c.num == idx: - existed = True - break - if existed: - idx += 1 - else: - break - - case = TestCase(region, Point(pp_x, pp_y), idx, is_running, [pp_x, pp_y, pp_r]) - self.cases.append(case) - self.cases = sorted(self.cases, key=lambda x: x.unique_id) - save_test_cases(self.cases, self.cases_path) - self.save_test_image(mm, case.image_name) - log.info('新增样例 %s', case.unique_id) - - def run_one_test_case(self, case: TestCase, show: bool = False) -> bool: - """ - 执行一个测试样例 - :param case: 测试样例 - :param show: 显示 - :return: 是否与预期一致 - """ - ctx = get_context() - ctx.init_image_matcher() - - mm = self.get_test_image_new(case.image_name) - - lm_info = ctx.ih.get_large_map(case.region) - possible_pos = tuple(case.possible_pos) - lm_rect = large_map.get_large_map_rect_by_pos(lm_info.gray.shape, mm.shape[:2], possible_pos) - - mm_info = mini_map.analyse_mini_map(mm, ctx.im) - verify = VerifyPosInfo(last_pos=Point(case.possible_pos[0], case.possible_pos[1]), - max_distance=case.possible_pos[1]) - - pos = cal_pos.cal_character_pos(ctx.im, - lm_info=lm_info, - mm_info=mm_info, - running=case.running, - real_move_time=case.real_move_time, - lm_rect=lm_rect, - retry_without_rect=False, - show=show, - verify=verify - ) - if show: - cv2.waitKey(0) - - if pos is None: - log.error('%s 当前计算坐标为空', case.unique_id) - return False - else: - dis = cal_utils.distance_between(pos.center, case.pos) - log.info('%s 当前计算坐标为 %s 与目标点 %s 距离 %.2f', case.unique_id, pos.center, case.pos, dis) - return dis < 5 diff --git a/test/src/test/sr/cal_pos/test_cal_pos/debug_cal_pos.py b/test/src/test/sr/cal_pos/test_cal_pos/debug_cal_pos.py new file mode 100644 index 00000000..0578aae3 --- /dev/null +++ b/test/src/test/sr/cal_pos/test_cal_pos/debug_cal_pos.py @@ -0,0 +1,68 @@ +from basic import Point +from basic.img.os import get_debug_image +from basic.log_utils import log +from sr import performance_recorder +from sr.const.map_const import get_region_by_prl_id +from sr.context import get_context +from test.sr.cal_pos.cal_pos_test_case import read_test_cases, TestCase, save_test_cases +from test.sr.cal_pos.test_cal_pos.test_cal_pos import TestCalPos + + +class DebugCalPos(TestCalPos): + + def __init__(self, *args, **kwargs): + TestCalPos.__init__(self, *args, **kwargs) + + def test_specified_one(self): + fail_cnt = 0 + self.cases = read_test_cases(self.cases_path) + for case in self.cases: + if case.unique_id != 'P04_PNKN_R06_CSSH_02': + continue + result = self.run_one_test_case(case, show=True) + if not result: + fail_cnt += 1 + log.info('%s 计算坐标失败', case.unique_id) + + performance_recorder.log_all_performance() + self.assertEqual(0, fail_cnt) + + def test_init_case(self): + """ + 从debug中初始化 + :return: + """ + ctx = get_context() + file_name: str = '_1711787600419' + mm = get_debug_image(file_name) + + str_list = file_name.split('_') + is_running = (bool)(str_list.pop()) + pp_r = (int)(str_list.pop()) + pp_y = (int)(str_list.pop()) + pp_x = (int)(str_list.pop()) + region_prl_id = '_'.join(str_list) + + region = get_region_by_prl_id(region_prl_id) + + self.cases = read_test_cases(self.cases_path) + idx: int = 1 + while True: + existed: bool = False + for c in self.cases: + if c.region.prl_id != region_prl_id: + continue + if c.num == idx: + existed = True + break + if existed: + idx += 1 + else: + break + + case = TestCase(region, Point(pp_x, pp_y), idx, is_running, [pp_x, pp_y, pp_r]) + self.cases.append(case) + self.cases = sorted(self.cases, key=lambda x: x.unique_id) + save_test_cases(self.cases, self.cases_path) + self.save_test_image(mm, case.image_name) + log.info('新增样例 %s', case.unique_id) diff --git a/test/src/test/sr/cal_pos/test_cal_pos/test_cal_pos.py b/test/src/test/sr/cal_pos/test_cal_pos/test_cal_pos.py new file mode 100644 index 00000000..86fe8016 --- /dev/null +++ b/test/src/test/sr/cal_pos/test_cal_pos/test_cal_pos.py @@ -0,0 +1,81 @@ +import os + +import cv2 + +import test +from basic import Point, cal_utils +from basic.log_utils import log +from sr import cal_pos, performance_recorder +from sr.cal_pos import VerifyPosInfo +from sr.context import get_context +from sr.image.image_holder import ImageHolder +from sr.image.sceenshot import mini_map, large_map +from test.sr.cal_pos.cal_pos_test_case import TestCase, read_test_cases + + +class TestCalPos(test.SrTestBase): + + def __init__(self, *args, **kwargs): + test.SrTestBase.__init__(self, *args, **kwargs) + + ih = ImageHolder() + # 预热 方便后续统计耗时 + ih.preheat_for_world_patrol() + mini_map.preheat() + + @property + def cases_path(self) -> str: + return os.path.join(self.sub_package_path, 'test_cases.yml') + + def test_cal_pos(self): + fail_cnt = 0 + self.cases = read_test_cases(self.cases_path) + for case in self.cases: + result = self.run_one_test_case(case, show=False) + if not result: + fail_cnt += 1 + log.info('%s 计算坐标失败', case.unique_id) + + performance_recorder.log_all_performance() + self.assertEqual(0, fail_cnt) + + def run_one_test_case(self, case: TestCase, show: bool = False) -> bool: + """ + 执行一个测试样例 + :param case: 测试样例 + :param show: 显示 + :return: 是否与预期一致 + """ + ctx = get_context() + ctx.init_image_matcher() + + mm = self.get_test_image_new(case.image_name) + + lm_info = ctx.ih.get_large_map(case.region) + possible_pos = tuple(case.possible_pos) + lm_rect = large_map.get_large_map_rect_by_pos(lm_info.gray.shape, mm.shape[:2], possible_pos) + + mm_info = mini_map.analyse_mini_map(mm, ctx.im) + verify = VerifyPosInfo(last_pos=Point(case.possible_pos[0], case.possible_pos[1]), + max_distance=case.possible_pos[1]) + + pos = cal_pos.cal_character_pos(ctx.im, + lm_info=lm_info, + mm_info=mm_info, + running=case.running, + real_move_time=case.real_move_time, + lm_rect=lm_rect, + retry_without_rect=False, + show=show, + verify=verify + ) + if show: + cv2.waitKey(0) + + if pos is None: + log.error('%s 当前计算坐标为空', case.unique_id) + return False + else: + dis = cal_utils.distance_between(pos.center, case.pos) + log.info('%s 当前计算坐标为 %s 与目标点 %s 距离 %.2f', case.unique_id, pos.center, case.pos, dis) + return dis < 5 diff --git a/test/src/test/sr/cal_pos/test_cal_pos_for_sim_uni/__init__.py b/test/src/test/sr/cal_pos/test_cal_pos_for_sim_uni/__init__.py index 4c1f17d7..e69de29b 100644 --- a/test/src/test/sr/cal_pos/test_cal_pos_for_sim_uni/__init__.py +++ b/test/src/test/sr/cal_pos/test_cal_pos_for_sim_uni/__init__.py @@ -1,120 +0,0 @@ -import os - -import cv2 - -import test -from basic import Point, cal_utils -from basic.img.os import get_debug_image -from basic.log_utils import log -from sr import cal_pos, performance_recorder -from sr.cal_pos import VerifyPosInfo -from sr.const.map_const import get_region_by_prl_id -from sr.context import get_context -from sr.image.image_holder import ImageHolder -from sr.image.sceenshot import mini_map, large_map -from test.sr.cal_pos.cal_pos_test_case import read_test_cases, TestCase, save_test_cases - - -class TestCalPosForSimUni(test.SrTestBase): - - def __init__(self, *args, **kwargs): - test.SrTestBase.__init__(self, *args, **kwargs) - - ih = ImageHolder() - # 预热 方便后续统计耗时 - ih.preheat_for_world_patrol() - mini_map.preheat() - - @property - def cases_path(self) -> str: - return os.path.join(self.sub_package_path, 'test_cases.yml') - - def test_cal_pos_for_sim_uni(self): - fail_cnt = 0 - case_list = read_test_cases(self.cases_path) - for case in case_list: - # if case.unique_id !='P02_YLL6_R05_CXHL_01': - # continue - result = self.run_one_test_case(case, show=False) - if not result: - fail_cnt += 1 - log.info('%s 计算坐标失败', case.unique_id) - - performance_recorder.log_all_performance() - self.assertEqual(0, fail_cnt) - - def test_init_case(self): - ctx = get_context() - file_name = 'P02_YLL6_R05_CXHL_274_1318_30_True' - mm = get_debug_image(file_name) - - str_list = file_name.split('_') - is_running = (bool)(str_list.pop()) - pp_r = (int)(str_list.pop()) - pp_y = (int)(str_list.pop()) - pp_x = (int)(str_list.pop()) - region_prl_id = '_'.join(str_list) - - region = get_region_by_prl_id(region_prl_id) - - case_list = read_test_cases(self.cases_path) - idx: int = 1 - while True: - existed: bool = False - for c in case_list: - if c.region.prl_id != region_prl_id: - continue - if c.num == idx: - existed = True - break - if existed: - idx += 1 - else: - break - - case = TestCase(region, Point(pp_x, pp_y), idx, is_running, [pp_x, pp_y, pp_r]) - case_list.append(case) - case_list = sorted(case_list, key=lambda x: x.unique_id) - save_test_cases(case_list, self.cases_path) - - self.save_test_image(mm, case.image_name) - log.info('新增样例 %s', case.unique_id) - self.run_one_test_case(case, show=True) - - def run_one_test_case(self, case: TestCase, show: bool = False) -> bool: - """ - 执行一个测试样例 - :param case: 测试样例 - :param show: 显示 - :return: 是否与预期一致 - """ - ctx = get_context() - ctx.init_image_matcher() - - mm = self.get_test_image_new(case.image_name) - - lm_info = ctx.ih.get_large_map(case.region) - lm_rect = large_map.get_large_map_rect_by_pos(lm_info.gray.shape, mm.shape[:2], case.possible_pos) - mm_info = mini_map.analyse_mini_map(mm, ctx.im) - verify = VerifyPosInfo(last_pos=Point(case.possible_pos[0], case.possible_pos[1]), - max_distance=case.possible_pos[1]) - - pos = cal_pos.sim_uni_cal_pos(ctx.im, - lm_info=lm_info, - mm_info=mm_info, - running=case.running, - real_move_time=case.real_move_time, - lm_rect=lm_rect, - verify=verify, - show=show - ) - if show: - cv2.waitKey(0) - - if pos is None: - log.error('%s 当前计算坐标为空', case.unique_id) - return False - else: - dis = cal_utils.distance_between(pos, case.pos) - log.info('%s 当前计算坐标为 %s 与目标点 %s 距离 %.2f', case.unique_id, pos, case.pos, dis) - return dis < 5 diff --git a/test/src/test/sr/cal_pos/test_cal_pos_for_sim_uni/debug_cal_pos_for_sim_uni.py b/test/src/test/sr/cal_pos/test_cal_pos_for_sim_uni/debug_cal_pos_for_sim_uni.py new file mode 100644 index 00000000..0ce09dc5 --- /dev/null +++ b/test/src/test/sr/cal_pos/test_cal_pos_for_sim_uni/debug_cal_pos_for_sim_uni.py @@ -0,0 +1,51 @@ +from basic import Point +from basic.img.os import get_debug_image +from basic.log_utils import log +from sr.const.map_const import get_region_by_prl_id +from sr.context import get_context +from test.sr.cal_pos.cal_pos_test_case import read_test_cases, TestCase, save_test_cases +from test.sr.cal_pos.test_cal_pos_for_sim_uni.test_cal_pos_for_sim_uni import TestCalPosForSimUni + + +class DebugCalPosForSimUni(TestCalPosForSimUni): + + def __init__(self, *args, **kwargs): + TestCalPosForSimUni.__init__(self, *args, **kwargs) + + def test_init_case(self): + ctx = get_context() + file_name = 'P02_YLL6_R05_CXHL_274_1318_30_True' + mm = get_debug_image(file_name) + + str_list = file_name.split('_') + is_running = (bool)(str_list.pop()) + pp_r = (int)(str_list.pop()) + pp_y = (int)(str_list.pop()) + pp_x = (int)(str_list.pop()) + region_prl_id = '_'.join(str_list) + + region = get_region_by_prl_id(region_prl_id) + + case_list = read_test_cases(self.cases_path) + idx: int = 1 + while True: + existed: bool = False + for c in case_list: + if c.region.prl_id != region_prl_id: + continue + if c.num == idx: + existed = True + break + if existed: + idx += 1 + else: + break + + case = TestCase(region, Point(pp_x, pp_y), idx, is_running, [pp_x, pp_y, pp_r]) + case_list.append(case) + case_list = sorted(case_list, key=lambda x: x.unique_id) + save_test_cases(case_list, self.cases_path) + + self.save_test_image(mm, case.image_name) + log.info('新增样例 %s', case.unique_id) + self.run_one_test_case(case, show=True) diff --git a/test/src/test/sr/cal_pos/test_cal_pos_for_sim_uni/test_cal_pos_for_sim_uni.py b/test/src/test/sr/cal_pos/test_cal_pos_for_sim_uni/test_cal_pos_for_sim_uni.py new file mode 100644 index 00000000..1830345f --- /dev/null +++ b/test/src/test/sr/cal_pos/test_cal_pos_for_sim_uni/test_cal_pos_for_sim_uni.py @@ -0,0 +1,80 @@ +import os + +import cv2 + +import test +from basic import Point, cal_utils +from basic.log_utils import log +from sr import performance_recorder, cal_pos +from sr.cal_pos import VerifyPosInfo +from sr.context import get_context +from sr.image.image_holder import ImageHolder +from sr.image.sceenshot import mini_map, large_map +from test.sr.cal_pos.cal_pos_test_case import read_test_cases, TestCase + + +class TestCalPosForSimUni(test.SrTestBase): + + def __init__(self, *args, **kwargs): + test.SrTestBase.__init__(self, *args, **kwargs) + + ih = ImageHolder() + # 预热 方便后续统计耗时 + ih.preheat_for_world_patrol() + mini_map.preheat() + + @property + def cases_path(self) -> str: + return os.path.join(self.sub_package_path, 'test_cases.yml') + + def test_cal_pos_for_sim_uni(self): + fail_cnt = 0 + case_list = read_test_cases(self.cases_path) + for case in case_list: + # if case.unique_id !='P02_YLL6_R05_CXHL_01': + # continue + result = self.run_one_test_case(case, show=False) + if not result: + fail_cnt += 1 + log.info('%s 计算坐标失败', case.unique_id) + + performance_recorder.log_all_performance() + self.assertEqual(0, fail_cnt) + + def run_one_test_case(self, case: TestCase, show: bool = False) -> bool: + """ + 执行一个测试样例 + :param case: 测试样例 + :param show: 显示 + :return: 是否与预期一致 + """ + ctx = get_context() + ctx.init_image_matcher() + + mm = self.get_test_image_new(case.image_name) + + lm_info = ctx.ih.get_large_map(case.region) + lm_rect = large_map.get_large_map_rect_by_pos(lm_info.gray.shape, mm.shape[:2], case.possible_pos) + mm_info = mini_map.analyse_mini_map(mm, ctx.im) + verify = VerifyPosInfo(last_pos=Point(case.possible_pos[0], case.possible_pos[1]), + max_distance=case.possible_pos[1]) + + pos = cal_pos.sim_uni_cal_pos(ctx.im, + lm_info=lm_info, + mm_info=mm_info, + running=case.running, + real_move_time=case.real_move_time, + lm_rect=lm_rect, + verify=verify, + show=show + ) + if show: + cv2.waitKey(0) + + if pos is None: + log.error('%s 当前计算坐标为空', case.unique_id) + return False + else: + dis = cal_utils.distance_between(pos, case.pos) + log.info('%s 当前计算坐标为 %s 与目标点 %s 距离 %.2f', case.unique_id, pos, case.pos, dis) + return dis < 5 diff --git a/test/src/test/sr/control/mock_controller.py b/test/src/test/sr/control/mock_controller.py index 1fc68ddc..7732c0f9 100644 --- a/test/src/test/sr/control/mock_controller.py +++ b/test/src/test/sr/control/mock_controller.py @@ -11,5 +11,5 @@ def __init__(self, ocr: OcrMatcher): """ super().__init__(ocr) - def click(self, pos: Point = None, press_time: float = 0) -> bool: + def click(self, pos: Point = None, press_time: float = 0, pc_alt: bool = False) -> bool: return True diff --git a/test/src/test/sr/image/screenshot/test_mini_map.py b/test/src/test/sr/image/screenshot/mini_map/__init__.py similarity index 75% rename from test/src/test/sr/image/screenshot/test_mini_map.py rename to test/src/test/sr/image/screenshot/mini_map/__init__.py index 7f9b8cf1..dda1e88f 100644 --- a/test/src/test/sr/image/screenshot/test_mini_map.py +++ b/test/src/test/sr/image/screenshot/mini_map/__init__.py @@ -16,5 +16,5 @@ def test_with_enemy_nearby(self): ctx = get_context() ctx.init_image_matcher() - mm = self.get_test_image('mm_no_enemy') - self.assertFalse(mini_map.with_enemy_nearby(ctx.im, mm=mm)) + mm = self.get_test_image_new('mm_no_enemy.png') + self.assertFalse(mini_map.with_enemy_nearby(ctx.im, mm)) diff --git a/test/resources/sr/image/screenshot/test_mini_map/mm_no_enemy.png b/test/src/test/sr/image/screenshot/mini_map/mm_no_enemy.png similarity index 100% rename from test/resources/sr/image/screenshot/test_mini_map/mm_no_enemy.png rename to test/src/test/sr/image/screenshot/mini_map/mm_no_enemy.png diff --git a/test/src/test/sr/image/screenshot/test_screen_state.py b/test/src/test/sr/image/screenshot/test_screen_state.py deleted file mode 100644 index ceb2c22f..00000000 --- a/test/src/test/sr/image/screenshot/test_screen_state.py +++ /dev/null @@ -1,11 +0,0 @@ -import unittest - -import test -from sr.context import get_context -from sr.image.sceenshot import screen_state - - -class TestOperation(test.SrTestBase): - - def __init__(self, *args, **kwargs): - test.SrTestBase.__init__(self, *args, **kwargs) diff --git a/test/src/test/sr/operation/__init__.py b/test/src/test/sr/operation/__init__.py index 0661f3d2..e69de29b 100644 --- a/test/src/test/sr/operation/__init__.py +++ b/test/src/test/sr/operation/__init__.py @@ -1,101 +0,0 @@ -import unittest -import test -from sr.context import Context, get_context -from sr.operation import Operation, OperationOneRoundResult, OperationResult, StateOperation, StateOperationNode, \ - StateOperationEdge - - -class SimpleOperation(Operation): - - def __init__(self, ctx: Context, op_callback): - super().__init__(ctx, op_name='测试指令', op_callback=op_callback) - - def _execute_one_round(self) -> OperationOneRoundResult: - return Operation.round_success() - - -class TestOperation(test.SrTestBase): - - def __init__(self, *args, **kwargs): - test.SrTestBase.__init__(self, *args, **kwargs) - - def test_operation(self): - self.op.ctx.running = 1 - op_result = self.op.execute() - self.assertTrue(op_result.success) - self.assertTrue(self.callback_result) - - def _op_callback(self, result: OperationResult): - self.callback_result = result.success - - -class SimpleStateOperation(StateOperation): - - def __init__(self, ctx: Context): - """ - 当初始数为1时 - 1 + 1 = 2 - 2 * 2 = 4 - 4 - 1 = 3 - 当初始数为2时 - 2 + 1 = 3 - 3 * 3 = 9 - :param ctx: - """ - edges = [] - - add_one = StateOperationNode('加1', self.add_one) - mul_two = StateOperationNode('乘2', self.add_one) - edges.append(StateOperationEdge(add_one, mul_two, status='2')) - - mul_three = StateOperationNode('乘3', self.mul_three) - edges.append(StateOperationEdge(add_one, mul_three, ignore_status=True)) - - del_one = StateOperationNode('减1', self.del_one) - edges.append(StateOperationEdge(mul_two, del_one, status='4')) - - super().__init__(ctx, op_name='simple', edges=edges) - self.num: int = 1 - - def add_one(self): - self.num += 1 - return Operation.round_success(status=str(self.num)) - - def mul_two(self): - self.num *= 2 - return Operation.round_success(status=str(self.num)) - - def mul_three(self): - self.num *= 3 - return Operation.round_success(status=str(self.num)) - - def del_one(self): - self.num -= 1 - return Operation.round_success(status=str(self.num)) - - def del_two(self): - self.num -= 2 - return Operation.round_success(status=str(self.num)) - - -class TestStateOperation(test.SrTestBase): - - def __init__(self, *args, **kwargs): - test.SrTestBase.__init__(self, *args, **kwargs) - - self.op = SimpleStateOperation(get_context()) - - def test_execute(self): - self.op.ctx.running = 1 - - self.op.num = 1 - op_result = self.op.execute() - self.assertTrue(op_result.success) - self.assertEqual('3', op_result.status) - - self.op.num = 2 - op_result = self.op.execute() - self.assertTrue(op_result.success) - self.assertEqual('9', op_result.status) - - diff --git a/test/src/test/sr/operation/battle/test_choose_support/__init__.py b/test/src/test/sr/operation/battle/test_choose_support/__init__.py deleted file mode 100644 index 45ce21ad..00000000 --- a/test/src/test/sr/operation/battle/test_choose_support/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -import unittest - -import test -from sr.const import character_const -from sr.const.character_const import LUOCHA, TINGYUN, HERTA, DANHENGIMBIBITORLUNAE -from sr.context import get_context -from sr.operation.battle.choose_support import ChooseSupport -from sr.operation.battle.start_fight import StartFightForElite -from sr.operation.unit.team import GetTeamMemberInWorld - - -class TestChooseSupport(test.SrTestBase): - - def __init__(self, *args, **kwargs): - test.SrTestBase.__init__(self, *args, **kwargs) - - def test_op(self): - ctx = get_context() - ctx.init_all() - ctx.start_running() - - op = ChooseSupport(ctx, character_const.TOPAZNUMBY.id) - op.execute() diff --git a/test/src/test/sr/operation/test_operation.py b/test/src/test/sr/operation/test_operation.py new file mode 100644 index 00000000..5352ef26 --- /dev/null +++ b/test/src/test/sr/operation/test_operation.py @@ -0,0 +1,101 @@ +import unittest +import test +from sr.context import Context, get_context +from sr.operation import Operation, OperationOneRoundResult, OperationResult, StateOperation, StateOperationNode, \ + StateOperationEdge + + +class SimpleOperation(Operation): + + def __init__(self, ctx: Context, op_callback): + super().__init__(ctx, op_name='测试指令', op_callback=op_callback) + + def _execute_one_round(self) -> OperationOneRoundResult: + return Operation.round_success() + + +class TestOperation(test.SrTestBase): + + def __init__(self, *args, **kwargs): + test.SrTestBase.__init__(self, *args, **kwargs) + + def test_operation(self): + ctx = get_context() + op = SimpleOperation(ctx, self._op_callback) + op.ctx.running = 1 + op_result = op.execute() + self.assertTrue(op_result.success) + self.assertTrue(self.callback_result) + + def _op_callback(self, result: OperationResult): + self.callback_result = result.success + + +class SimpleStateOperation(StateOperation): + + def __init__(self, ctx: Context): + """ + 当初始数为1时 + 1 + 1 = 2 + 2 * 2 = 4 + 4 - 1 = 3 + 当初始数为2时 + 2 + 1 = 3 + 3 * 3 = 9 + :param ctx: + """ + edges = [] + + add_one = StateOperationNode('加1', self.add_one) + mul_two = StateOperationNode('乘2', self.add_one) + edges.append(StateOperationEdge(add_one, mul_two, status='2')) + + mul_three = StateOperationNode('乘3', self.mul_three) + edges.append(StateOperationEdge(add_one, mul_three, ignore_status=True)) + + del_one = StateOperationNode('减1', self.del_one) + edges.append(StateOperationEdge(mul_two, del_one, status='4')) + + super().__init__(ctx, op_name='simple', edges=edges) + self.num: int = 1 + + def add_one(self): + self.num += 1 + return Operation.round_success(status=str(self.num)) + + def mul_two(self): + self.num *= 2 + return Operation.round_success(status=str(self.num)) + + def mul_three(self): + self.num *= 3 + return Operation.round_success(status=str(self.num)) + + def del_one(self): + self.num -= 1 + return Operation.round_success(status=str(self.num)) + + def del_two(self): + self.num -= 2 + return Operation.round_success(status=str(self.num)) + + +class TestStateOperation(test.SrTestBase): + + def __init__(self, *args, **kwargs): + test.SrTestBase.__init__(self, *args, **kwargs) + + self.op = SimpleStateOperation(get_context()) + + def test_execute(self): + self.op.ctx.running = 1 + + self.op.num = 1 + op_result = self.op.execute() + self.assertTrue(op_result.success) + self.assertEqual('3', op_result.status) + + self.op.num = 2 + op_result = self.op.execute() + self.assertTrue(op_result.success) + self.assertEqual('9', op_result.status) diff --git a/test/src/test/sr/operation/unit/battle/team/__init__.py b/test/src/test/sr/operation/unit/battle/team/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/resources/sr/operation/unit/battle/test_choose_team/1.png b/test/src/test/sr/operation/unit/battle/team/choose_team_1.png similarity index 100% rename from test/resources/sr/operation/unit/battle/test_choose_team/1.png rename to test/src/test/sr/operation/unit/battle/team/choose_team_1.png diff --git a/test/resources/sr/operation/unit/battle/test_choose_team/2.png b/test/src/test/sr/operation/unit/battle/team/choose_team_2.png similarity index 100% rename from test/resources/sr/operation/unit/battle/test_choose_team/2.png rename to test/src/test/sr/operation/unit/battle/team/choose_team_2.png diff --git a/test/resources/sr/operation/unit/battle/test_choose_team/3.png b/test/src/test/sr/operation/unit/battle/team/choose_team_3.png similarity index 100% rename from test/resources/sr/operation/unit/battle/test_choose_team/3.png rename to test/src/test/sr/operation/unit/battle/team/choose_team_3.png diff --git a/test/src/test/sr/operation/unit/battle/test_choose_team.py b/test/src/test/sr/operation/unit/battle/team/test_choose_team.py similarity index 86% rename from test/src/test/sr/operation/unit/battle/test_choose_team.py rename to test/src/test/sr/operation/unit/battle/team/test_choose_team.py index baaee67d..5c0cf110 100644 --- a/test/src/test/sr/operation/unit/battle/test_choose_team.py +++ b/test/src/test/sr/operation/unit/battle/team/test_choose_team.py @@ -18,7 +18,7 @@ def __init__(self, *args, **kwargs): def test_get_all_num_pos(self): team_nums_in_img = [[1, 2, 3, 4, 5, 6, 7], [2, 3, 4, 5, 6, 7, 8], [3, 4, 5, 6, 7, 8, 9]] for i in range(1, 4): - screen = self.get_test_image(str(i)) + screen = self.get_test_image_new('choose_team_%d.png' % i) team_nums = self.op.get_all_num_pos(screen) self.assertEquals(len(team_nums_in_img[i - 1]), len(team_nums)) @@ -27,5 +27,5 @@ def test_get_all_num_pos(self): def test_in_secondary_ui(self): for i in range(1, 4): - screen = self.get_test_image(str(i)) + screen = self.get_test_image_new('choose_team_%d.png' % i) self.assertTrue(self.op.in_secondary_ui(screen)) diff --git a/test/src/test/sr/operation/unit/choose_region/__init__.py b/test/src/test/sr/operation/unit/choose_region/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/src/test/sr/operation/unit/test_choose_region/pnkn.png b/test/src/test/sr/operation/unit/choose_region/pnkn.png similarity index 100% rename from test/src/test/sr/operation/unit/test_choose_region/pnkn.png rename to test/src/test/sr/operation/unit/choose_region/pnkn.png diff --git a/test/src/test/sr/operation/unit/test_choose_region/__init__.py b/test/src/test/sr/operation/unit/choose_region/test_choose_region.py similarity index 91% rename from test/src/test/sr/operation/unit/test_choose_region/__init__.py rename to test/src/test/sr/operation/unit/choose_region/test_choose_region.py index 2b1691e4..d2ee7ff6 100644 --- a/test/src/test/sr/operation/unit/test_choose_region/__init__.py +++ b/test/src/test/sr/operation/unit/choose_region/test_choose_region.py @@ -17,7 +17,7 @@ def test_get_region_pos_list(self): op = ChooseRegion(ctx, map_const.P04_R03) screen = self.get_test_image_new('xzlf.png') - op.region = map_const.P03_R01 + op.region_to_choose_1 = map_const.P03_R01 pos_list = op.get_region_pos_list(screen) region_set = set() for pos in pos_list: @@ -28,7 +28,7 @@ def test_get_region_pos_list(self): self.assertEquals(8, len(region_set)) screen = self.get_test_image_new('pnkn.png') - op.region = map_const.P04_R01_F1 + op.region_to_choose_1 = map_const.P04_R01_F1 pos_list = op.get_region_pos_list(screen) region_set = set() for pos in pos_list: diff --git a/test/src/test/sr/operation/unit/test_choose_region/xzlf.png b/test/src/test/sr/operation/unit/choose_region/xzlf.png similarity index 100% rename from test/src/test/sr/operation/unit/test_choose_region/xzlf.png rename to test/src/test/sr/operation/unit/choose_region/xzlf.png diff --git a/test/resources/sr/operation/unit/forgotten_hall/test_choose_team_in_fh/1.png b/test/src/test/sr/operation/unit/forgotten_hall/choose_team_in_fh/1.png similarity index 100% rename from test/resources/sr/operation/unit/forgotten_hall/test_choose_team_in_fh/1.png rename to test/src/test/sr/operation/unit/forgotten_hall/choose_team_in_fh/1.png diff --git a/test/src/test/sr/operation/unit/forgotten_hall/choose_team_in_fh/__init__.py b/test/src/test/sr/operation/unit/forgotten_hall/choose_team_in_fh/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/src/test/sr/operation/unit/forgotten_hall/test_choose_team_in_fh.py b/test/src/test/sr/operation/unit/forgotten_hall/choose_team_in_fh/test_choose_team_in_fh.py similarity index 95% rename from test/src/test/sr/operation/unit/forgotten_hall/test_choose_team_in_fh.py rename to test/src/test/sr/operation/unit/forgotten_hall/choose_team_in_fh/test_choose_team_in_fh.py index 060a685c..80d55fad 100644 --- a/test/src/test/sr/operation/unit/forgotten_hall/test_choose_team_in_fh.py +++ b/test/src/test/sr/operation/unit/forgotten_hall/choose_team_in_fh/test_choose_team_in_fh.py @@ -21,7 +21,7 @@ def test_get_all_node_combat_types(self): """ 1.6版本更新 """ - screen = self.get_test_image('1') + screen = self.get_test_image_new('1.png') node_combat_types = self.op._get_all_node_combat_types(screen) self.assertEqual(2, len(node_combat_types)) diff --git a/test/src/test/sr/operation/unit/forgotten_hall/test_enter_fight_in_fh.py b/test/src/test/sr/operation/unit/forgotten_hall/debug_enter_fight_in_fh.py similarity index 100% rename from test/src/test/sr/operation/unit/forgotten_hall/test_enter_fight_in_fh.py rename to test/src/test/sr/operation/unit/forgotten_hall/debug_enter_fight_in_fh.py diff --git a/test/resources/sr/operation/unit/guide/test_get_training_score/1.png b/test/src/test/sr/operation/unit/guide/test_get_training_score/1.png similarity index 100% rename from test/resources/sr/operation/unit/guide/test_get_training_score/1.png rename to test/src/test/sr/operation/unit/guide/test_get_training_score/1.png diff --git a/test/src/test/sr/operation/unit/guide/test_get_training_score/__init__.py b/test/src/test/sr/operation/unit/guide/test_get_training_score/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/src/test/sr/operation/unit/guide/test_get_training_score.py b/test/src/test/sr/operation/unit/guide/test_get_training_score/test_get_training_score.py similarity index 90% rename from test/src/test/sr/operation/unit/guide/test_get_training_score.py rename to test/src/test/sr/operation/unit/guide/test_get_training_score/test_get_training_score.py index 04fd4458..003741ae 100644 --- a/test/src/test/sr/operation/unit/guide/test_get_training_score.py +++ b/test/src/test/sr/operation/unit/guide/test_get_training_score/test_get_training_score.py @@ -16,5 +16,5 @@ def __init__(self, *args, **kwargs): self.op = GetTrainingScore(ctx) def test_get_score(self): - screen = self.get_test_image('1') + screen = self.get_test_image_new('1.png') self.assertEquals(200, self.op._get_score(screen)) \ No newline at end of file diff --git a/test/src/test/sr/operation/unit/guide/test_get_training_unfinished_mission.py b/test/src/test/sr/operation/unit/guide/test_get_training_unfinished_mission.py deleted file mode 100644 index ac593431..00000000 --- a/test/src/test/sr/operation/unit/guide/test_get_training_unfinished_mission.py +++ /dev/null @@ -1,51 +0,0 @@ -import unittest -from typing import List - -import test -from basic import cal_utils, Point -from basic.img import MatchResult -from sr.const.traing_mission_const import MISSION_DAILY_MISSION, MISSION_PATH, MISSION_USE_CONSUMABLE, \ - MISSION_FORGOTTEN_HALL, DailyTrainingMission, MISSION_DESTRUCTIBLE_OBJECTS, MISSION_DEFEAT_ENEMY, \ - MISSION_WEAKNESS_BREAK -from sr.context import get_context -from sr.operation.unit.guide.get_training_unfinished_mission import GetTrainingUnfinishedMission - - -class TestGetTrainingUnfinishedMission(test.SrTestBase): - - def __init__(self, *args, **kwargs): - test.SrTestBase.__init__(self, *args, **kwargs) - - ctx = get_context() - ctx.init_ocr_matcher() - - self.op = GetTrainingUnfinishedMission(ctx) - - self.go_points: List[List[Point]] = [ - [Point(433, 830), Point(772, 830), Point(1109, 830), Point(1442, 830)], - [Point(513, 830), Point(834, 830), Point(1164, 830), Point(1504, 830)], - ] - self.missions: List[List[DailyTrainingMission]] = [ - [MISSION_DAILY_MISSION, MISSION_PATH, MISSION_USE_CONSUMABLE, MISSION_FORGOTTEN_HALL], - [MISSION_PATH, MISSION_WEAKNESS_BREAK, MISSION_DEFEAT_ENEMY, MISSION_DESTRUCTIBLE_OBJECTS], - ] - - def test_get_go_pos(self): - for pic in range(len(self.go_points)): - screen = self.get_test_image(str(pic + 1)) - go_points = self.go_points[pic] - go_pos_list = self.op._get_go_pos(screen) - self.assertEquals(4, len(go_pos_list)) - for i in range(4): - self.assertTrue(cal_utils.distance_between(go_pos_list[i].center, go_points[i]) < 20) - - def test_get_mission(self): - for pic in range(len(self.go_points)): - screen = self.get_test_image(str(pic + 1)) - go_points = self.go_points[pic] - missions = self.missions[pic] - - for i in range(4): - p = go_points[i] - m = MatchResult(1, p.x - 10, p.y - 10, 10, 10) - self.assertTrue(missions[i], self.op._get_mission(screen, m)) diff --git a/test/src/test/sr/operation/unit/guide/test_survival_index/__init__.py b/test/src/test/sr/operation/unit/guide/test_survival_index/__init__.py deleted file mode 100644 index 67fd517f..00000000 --- a/test/src/test/sr/operation/unit/guide/test_survival_index/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -import test -from sr.context import get_context -from sr.operation.combine.transport import Transport -from sr.interastral_peace_guide.survival_index_mission import SurvivalIndexCategoryEnum, SurvivalIndexMissionEnum - - -class TestSurvivalIndex(test.SrTestBase): - - def __init__(self, *args, **kwargs): - test.SrTestBase.__init__(self, *args, **kwargs) - - def test_tp(self): - ctx = get_context() - ctx.init_all(renew=True) - ctx.start_running() - start = False - for enum in SurvivalIndexMissionEnum: - if enum.value.cate == SurvivalIndexCategoryEnum.SIM_UNI.value: - continue - if enum == SurvivalIndexMissionEnum.ECHO_03: - start = True - if not start: - continue - tp = enum.value.tp - op = Transport(ctx, tp) - self.assertTrue(op.execute().success) diff --git a/test/resources/sr/operation/unit/store/test_click_store_item/parcel.png b/test/src/test/sr/operation/unit/store/parcel.png similarity index 100% rename from test/resources/sr/operation/unit/store/test_click_store_item/parcel.png rename to test/src/test/sr/operation/unit/store/parcel.png diff --git a/test/src/test/sr/operation/unit/store/test_click_store_item.py b/test/src/test/sr/operation/unit/store/test_click_store_item.py index 690fbf8e..be5a9bd9 100644 --- a/test/src/test/sr/operation/unit/store/test_click_store_item.py +++ b/test/src/test/sr/operation/unit/store/test_click_store_item.py @@ -6,7 +6,7 @@ from sr.operation.unit.store.click_store_item import ClickStoreItem -class TestGetTeamMemberInWorld(test.SrTestBase): +class TestClickStoreItem(test.SrTestBase): def __init__(self, *args, **kwargs): test.SrTestBase.__init__(self, *args, **kwargs) @@ -18,7 +18,7 @@ def __init__(self, *args, **kwargs): def test_parcel(self): """逾期未取的贵重邮包""" - screen = self.get_test_image('parcel') + screen = self.get_test_image_new('parcel.png') best_result = self.op._get_item_pos(screen) self.assertIsNotNone(best_result) self.assertTrue(cal_utils.distance_between(Point(430, 640), best_result.center) < 20) diff --git a/test/src/test/sr/operation/unit/team/__init__.py b/test/src/test/sr/operation/unit/team/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/resources/sr/operation/unit/test_get_team_member_in_world/1.png b/test/src/test/sr/operation/unit/team/team_members_in_world.png similarity index 100% rename from test/resources/sr/operation/unit/test_get_team_member_in_world/1.png rename to test/src/test/sr/operation/unit/team/team_members_in_world.png diff --git a/test/src/test/sr/operation/unit/test_get_team_member_in_world.py b/test/src/test/sr/operation/unit/team/test_get_team_member_in_world.py similarity index 93% rename from test/src/test/sr/operation/unit/test_get_team_member_in_world.py rename to test/src/test/sr/operation/unit/team/test_get_team_member_in_world.py index 14eb71a9..8f8f79d7 100644 --- a/test/src/test/sr/operation/unit/test_get_team_member_in_world.py +++ b/test/src/test/sr/operation/unit/team/test_get_team_member_in_world.py @@ -17,7 +17,7 @@ def __init__(self, *args, **kwargs): self.op = GetTeamMemberInWorld(ctx, 1) def test_get_character_id(self): - screen = self.get_test_image('1') + screen = self.get_test_image_new('team_members_in_world.png') self.op.character_num = 1 self.assertEquals(TINGYUN.id, self.op._get_character_id(screen)) diff --git a/test/src/test/sr/operation/unit/technique/__init__.py b/test/src/test/sr/operation/unit/technique/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/src/test/sr/operation/unit/test_technique/pc_can_use_tech.png b/test/src/test/sr/operation/unit/technique/pc_can_use_tech.png similarity index 100% rename from test/src/test/sr/operation/unit/test_technique/pc_can_use_tech.png rename to test/src/test/sr/operation/unit/technique/pc_can_use_tech.png diff --git a/test/src/test/sr/operation/unit/test_technique/__init__.py b/test/src/test/sr/operation/unit/technique/test_technique.py similarity index 100% rename from test/src/test/sr/operation/unit/test_technique/__init__.py rename to test/src/test/sr/operation/unit/technique/test_technique.py diff --git a/test/src/test/sr/operation/unit/test_enter_game/__init__.py b/test/src/test/sr/operation/unit/test_enter_game/__init__.py deleted file mode 100644 index e1ceed2b..00000000 --- a/test/src/test/sr/operation/unit/test_enter_game/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -import test -from sr.context import get_context -from sr.operation.unit.enter_game import LoginWithAnotherAccount - - -class TestEnterGame(test.SrTestBase): - - def __init__(self, *args, **kwargs): - test.SrTestBase.__init__(self, *args, **kwargs) - - def test_op_login_with_active_account(self): - ctx = get_context() - ctx.init_all() - ctx.start_running() - - op = LoginWithAnotherAccount(ctx) - op.execute() diff --git a/test/src/test/sr/operation/unit/test_team.py b/test/src/test/sr/operation/unit/test_team.py deleted file mode 100644 index fb9a30d0..00000000 --- a/test/src/test/sr/operation/unit/test_team.py +++ /dev/null @@ -1,39 +0,0 @@ -import unittest - -import test -from sr.const.character_const import RUANMEI, TINGYUN, JINGLIU, LUOCHA -from sr.context import get_context -from sr.operation.unit.team import SwitchMember, CheckTeamMembersInWorld - - -class TestTeam(test.SrTestBase): - - def __init__(self, *args, **kwargs): - test.SrTestBase.__init__(self, *args, **kwargs) - - def test_switch_op(self): - ctx = get_context() - ctx.start_running() - - op = SwitchMember(ctx, 1) - op.execute() - - def test_check_members(self): - ctx = get_context() - ctx.init_image_matcher() - ctx.init_ocr_matcher() - - op = CheckTeamMembersInWorld(ctx) - - screen = self.get_test_image('members_1') - answer = [RUANMEI, TINGYUN, JINGLIU, LUOCHA] - - op.character_list = [None, None, None, None] - op._check_by_avatar(screen) - for i in range(4): - self.assertEqual(answer[i], op.character_list[i]) - - op.character_list = [None, None, None, None] - op._check_by_name(screen) - for i in range(4): - self.assertEqual(answer[i], op.character_list[i]) diff --git a/test/src/test/sr/screen_area/screen_treasures_lightward/__init__.py b/test/src/test/sr/screen_area/screen_treasures_lightward/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/src/test/sr/screen_area/test_screen_treasures_lightward/normal_world.png b/test/src/test/sr/screen_area/screen_treasures_lightward/normal_world.png similarity index 100% rename from test/src/test/sr/screen_area/test_screen_treasures_lightward/normal_world.png rename to test/src/test/sr/screen_area/screen_treasures_lightward/normal_world.png diff --git a/test/src/test/sr/screen_area/test_screen_treasures_lightward/quick_pass.png b/test/src/test/sr/screen_area/screen_treasures_lightward/quick_pass.png similarity index 100% rename from test/src/test/sr/screen_area/test_screen_treasures_lightward/quick_pass.png rename to test/src/test/sr/screen_area/screen_treasures_lightward/quick_pass.png diff --git a/test/src/test/sr/screen_area/test_screen_treasures_lightward/quick_pass_empty.png b/test/src/test/sr/screen_area/screen_treasures_lightward/quick_pass_empty.png similarity index 100% rename from test/src/test/sr/screen_area/test_screen_treasures_lightward/quick_pass_empty.png rename to test/src/test/sr/screen_area/screen_treasures_lightward/quick_pass_empty.png diff --git a/test/src/test/sr/screen_area/test_screen_treasures_lightward/__init__.py b/test/src/test/sr/screen_area/screen_treasures_lightward/test_screen_treasures_lightward.py similarity index 100% rename from test/src/test/sr/screen_area/test_screen_treasures_lightward/__init__.py rename to test/src/test/sr/screen_area/screen_treasures_lightward/test_screen_treasures_lightward.py diff --git a/test/resources/sr/operation/unit/rogue/test_choose_sim_uni_num/1.png b/test/src/test/sr/sim_uni/op/choose_sim_uni_num/1.png similarity index 100% rename from test/resources/sr/operation/unit/rogue/test_choose_sim_uni_num/1.png rename to test/src/test/sr/sim_uni/op/choose_sim_uni_num/1.png diff --git a/test/src/test/sr/sim_uni/op/choose_sim_uni_num/__init__.py b/test/src/test/sr/sim_uni/op/choose_sim_uni_num/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/src/test/sr/operation/unit/rogue/test_choose_sim_uni_num.py b/test/src/test/sr/sim_uni/op/choose_sim_uni_num/test_choose_sim_uni_num.py similarity index 76% rename from test/src/test/sr/operation/unit/rogue/test_choose_sim_uni_num.py rename to test/src/test/sr/sim_uni/op/choose_sim_uni_num/test_choose_sim_uni_num.py index 6a5cfad7..d536be84 100644 --- a/test/src/test/sr/operation/unit/rogue/test_choose_sim_uni_num.py +++ b/test/src/test/sr/sim_uni/op/choose_sim_uni_num/test_choose_sim_uni_num.py @@ -16,9 +16,9 @@ def __init__(self, *args, **kwargs): self.op = ChooseSimUniNum(ctx, 1) def test_get_current_num(self): - screen = self.get_test_image('1') + screen = self.get_test_image_new('1.png') self.assertEqual(8, self.op._get_current_num(screen)) def test_is_going(self): - screen = self.get_test_image('1') - self.assertTrue(self.op._is_going(screen)) \ No newline at end of file + screen = self.get_test_image_new('1.png') + self.assertTrue(self.op._is_going(screen)) diff --git a/test/src/test/sr/sim_uni/op/move_in_sim_uni/__init__.py b/test/src/test/sr/sim_uni/op/move_in_sim_uni/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/resources/sr/sim_uni/op/test_move_in_sim_uni/next_level_battle_event.png b/test/src/test/sr/sim_uni/op/move_in_sim_uni/next_level_battle_event.png similarity index 100% rename from test/resources/sr/sim_uni/op/test_move_in_sim_uni/next_level_battle_event.png rename to test/src/test/sr/sim_uni/op/move_in_sim_uni/next_level_battle_event.png diff --git a/test/resources/sr/sim_uni/op/test_move_in_sim_uni/next_level_can_interact.png b/test/src/test/sr/sim_uni/op/move_in_sim_uni/next_level_can_interact.png similarity index 100% rename from test/resources/sr/sim_uni/op/test_move_in_sim_uni/next_level_can_interact.png rename to test/src/test/sr/sim_uni/op/move_in_sim_uni/next_level_can_interact.png diff --git a/test/src/test/sr/sim_uni/op/test_move_in_sim_uni.py b/test/src/test/sr/sim_uni/op/move_in_sim_uni/test_move_in_sim_uni.py similarity index 75% rename from test/src/test/sr/sim_uni/op/test_move_in_sim_uni.py rename to test/src/test/sr/sim_uni/op/move_in_sim_uni/test_move_in_sim_uni.py index ee84a093..df580a72 100644 --- a/test/src/test/sr/sim_uni/op/test_move_in_sim_uni.py +++ b/test/src/test/sr/sim_uni/op/move_in_sim_uni/test_move_in_sim_uni.py @@ -13,7 +13,7 @@ def test_get_next_level_type(self): ctx = get_context() ctx.init_image_matcher() - screen = self.get_test_image('next_level_battle_event') + screen = self.get_test_image_new('next_level_battle_event.png') result = MoveToNextLevel.get_next_level_type(screen, ctx.ih) self.assertEqual(2, len(result)) @@ -26,14 +26,7 @@ def test_next_level_can_interact(self): ctx.init_image_matcher() op = MoveToNextLevel(ctx, None) - screen = self.get_test_image('next_level_can_interact') + screen = self.get_test_image_new('next_level_can_interact.png') result = op._can_interact(screen) self.assertTrue(result, msg='当前应该可交互') - - def test_move_towards_next_level(self): - ctx = get_context() - ctx.start_running() - - op = MoveToNextLevel(ctx, None) - op.execute() diff --git a/test/src/test/sr/sim_uni/op/sim_uni_choose_bless/__init__.py b/test/src/test/sr/sim_uni/op/sim_uni_choose_bless/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/resources/sr/sim_uni/op/test_sim_uni_choose_bless/before_level.png b/test/src/test/sr/sim_uni/op/sim_uni_choose_bless/before_level.png similarity index 100% rename from test/resources/sr/sim_uni/op/test_sim_uni_choose_bless/before_level.png rename to test/src/test/sr/sim_uni/op/sim_uni_choose_bless/before_level.png diff --git a/test/resources/sr/sim_uni/op/test_sim_uni_choose_bless/before_level_bless.png b/test/src/test/sr/sim_uni/op/sim_uni_choose_bless/before_level_bless.png similarity index 100% rename from test/resources/sr/sim_uni/op/test_sim_uni_choose_bless/before_level_bless.png rename to test/src/test/sr/sim_uni/op/sim_uni_choose_bless/before_level_bless.png diff --git a/test/resources/sr/sim_uni/op/test_sim_uni_choose_bless/bless_2.png b/test/src/test/sr/sim_uni/op/sim_uni_choose_bless/bless_2.png similarity index 100% rename from test/resources/sr/sim_uni/op/test_sim_uni_choose_bless/bless_2.png rename to test/src/test/sr/sim_uni/op/sim_uni_choose_bless/bless_2.png diff --git a/test/resources/sr/sim_uni/op/test_sim_uni_choose_bless/can_reset_1.png b/test/src/test/sr/sim_uni/op/sim_uni_choose_bless/can_reset_1.png similarity index 100% rename from test/resources/sr/sim_uni/op/test_sim_uni_choose_bless/can_reset_1.png rename to test/src/test/sr/sim_uni/op/sim_uni_choose_bless/can_reset_1.png diff --git a/test/resources/sr/sim_uni/op/test_sim_uni_choose_bless/cant_reset_1.png b/test/src/test/sr/sim_uni/op/sim_uni_choose_bless/cant_reset_1.png similarity index 100% rename from test/resources/sr/sim_uni/op/test_sim_uni_choose_bless/cant_reset_1.png rename to test/src/test/sr/sim_uni/op/sim_uni_choose_bless/cant_reset_1.png diff --git a/test/resources/sr/sim_uni/op/test_sim_uni_choose_bless/cant_reset_2.png b/test/src/test/sr/sim_uni/op/sim_uni_choose_bless/cant_reset_2.png similarity index 100% rename from test/resources/sr/sim_uni/op/test_sim_uni_choose_bless/cant_reset_2.png rename to test/src/test/sr/sim_uni/op/sim_uni_choose_bless/cant_reset_2.png diff --git a/test/resources/sr/sim_uni/op/test_sim_uni_choose_bless/drop_bless_2.png b/test/src/test/sr/sim_uni/op/sim_uni_choose_bless/drop_bless_2.png similarity index 100% rename from test/resources/sr/sim_uni/op/test_sim_uni_choose_bless/drop_bless_2.png rename to test/src/test/sr/sim_uni/op/sim_uni_choose_bless/drop_bless_2.png diff --git a/test/src/test/sr/sim_uni/op/test_sim_uni_choose_bless.py b/test/src/test/sr/sim_uni/op/sim_uni_choose_bless/test_sim_uni_choose_bless.py similarity index 80% rename from test/src/test/sr/sim_uni/op/test_sim_uni_choose_bless.py rename to test/src/test/sr/sim_uni/op/sim_uni_choose_bless/test_sim_uni_choose_bless.py index f08f1483..d9cf6396 100644 --- a/test/src/test/sr/sim_uni/op/test_sim_uni_choose_bless.py +++ b/test/src/test/sr/sim_uni/op/sim_uni_choose_bless/test_sim_uni_choose_bless.py @@ -1,10 +1,9 @@ -import unittest from typing import List import test from basic.img import MatchResult from sr.context import get_context -from sr.sim_uni.op.sim_uni_choose_bless import SimUniChooseBless, get_bless_pos, get_bless_by_priority, SimUniDropBless, \ +from sr.sim_uni.op.sim_uni_choose_bless import SimUniChooseBless, get_bless_pos, get_bless_by_priority, \ SimUniUpgradeBless from sr.sim_uni.sim_uni_challenge_config import SimUniChallengeConfig from sr.sim_uni.sim_uni_const import SimUniBless, SimUniBlessEnum @@ -22,7 +21,7 @@ def test_get_bless(self): """ ctx = get_context() ctx.init_ocr_matcher() - screen = self.get_test_image('can_reset_1') + screen = self.get_test_image_new('can_reset_1.png') bless_list = get_bless_pos(screen, ctx.ocr, False) @@ -43,7 +42,7 @@ def test_get_bless_2(self): """ ctx = get_context() ctx.init_ocr_matcher() - screen = self.get_test_image('bless_2') + screen = self.get_test_image_new('bless_2.png') bless_list = get_bless_pos(screen, ctx.ocr, False) @@ -61,7 +60,7 @@ def test_get_bless_before_start(self): 楼层开始前的情况 :return: """ - screen = self.get_test_image('before_level') + screen = self.get_test_image_new('before_level.png') ctx = get_context() ctx.init_ocr_matcher() @@ -83,13 +82,13 @@ def test_can_reset(self): ctx.init_ocr_matcher() op = SimUniChooseBless(ctx) - screen = self.get_test_image('can_reset_1') + screen = self.get_test_image_new('can_reset_1.png') self.assertTrue(op._can_reset(screen)) - screen = self.get_test_image('cant_reset_1') + screen = self.get_test_image_new('cant_reset_1.png') self.assertFalse(op._can_reset(screen)) - screen = self.get_test_image('cant_reset_2') + screen = self.get_test_image_new('cant_reset_2.png') self.assertFalse(op._can_reset(screen)) def test_get_bless_to_choose(self): @@ -97,7 +96,7 @@ def test_get_bless_to_choose(self): 按优先级选择祝福 :return: """ - screen = self.get_test_image('cant_reset_1') + screen = self.get_test_image_new('cant_reset_1.png') ctx = get_context() ctx.init_ocr_matcher() @@ -131,7 +130,7 @@ def test_get_bless_to_choose(self): self.assertEqual(SimUniBlessEnum.BLESS_05_015.value, mr.data) # 重置 - screen = self.get_test_image('can_reset_1') + screen = self.get_test_image_new('can_reset_1.png') config.bless_priority = [SimUniBlessEnum.BLESS_01_000.name] config.bless_priority_2 = [SimUniBlessEnum.BLESS_01_000.name] bless_list = get_bless_pos(screen, ctx.ocr, False) @@ -142,7 +141,7 @@ def test_drop_get_bless_2(self): ctx = get_context() ctx.init_ocr_matcher() - screen = self.get_test_image('drop_bless_2') + screen = self.get_test_image_new('drop_bless_2.png') bless_pos_list: List[MatchResult] = get_bless_pos(screen, ctx.ocr, False) bless_list = [bless.data for bless in bless_pos_list] @@ -156,8 +155,12 @@ def test_drop_get_bless_2(self): for i in range(len(answer)): self.assertEqual(answer[i], bless_list[i]) - priority = SimUniChallengeConfig([SimUniBlessEnum.BLESS_01_007.name, SimUniBlessEnum.BLESS_08_009.name], []) - target_curio_pos: int = get_bless_by_priority(bless_list, priority, can_reset=False, asc=False) + config = SimUniChallengeConfig(9, mock=True) + + # 命中骨刃 + config.bless_priority = [SimUniBlessEnum.BLESS_01_007.name, SimUniBlessEnum.BLESS_08_009.name] + config.bless_priority_2 = [] + target_curio_pos: int = get_bless_by_priority(bless_list, config, can_reset=False, asc=False) self.assertEqual(1, target_curio_pos) def test_upgrade_get_bless_pos(self): @@ -167,27 +170,6 @@ def test_upgrade_get_bless_pos(self): op = SimUniUpgradeBless(ctx) - screen = self.get_test_image('upgrade') + screen = self.get_test_image_new('upgrade.png') pos = op._get_bless_pos(screen) self.assertIsNotNone(pos) - - def test_op(self): - ctx = get_context() - ctx.start_running() - - op = SimUniChooseBless(ctx, None, before_level_start=False) - op.execute() - - def test_drop_op(self): - ctx = get_context() - ctx.start_running() - - op = SimUniDropBless(ctx, None) - op.execute() - - def test_upgrade_op(self): - ctx = get_context() - ctx.start_running() - - op = SimUniUpgradeBless(ctx) - op.execute() diff --git a/test/resources/sr/sim_uni/op/test_sim_uni_choose_bless/upgrade.png b/test/src/test/sr/sim_uni/op/sim_uni_choose_bless/upgrade.png similarity index 100% rename from test/resources/sr/sim_uni/op/test_sim_uni_choose_bless/upgrade.png rename to test/src/test/sr/sim_uni/op/sim_uni_choose_bless/upgrade.png diff --git a/test/src/test/sr/sim_uni/op/sim_uni_choose_curio/__init__.py b/test/src/test/sr/sim_uni/op/sim_uni_choose_curio/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/src/test/sr/sim_uni/op/test_sim_uni_choose_curio/choose_pos_3.png b/test/src/test/sr/sim_uni/op/sim_uni_choose_curio/choose_pos_3.png similarity index 100% rename from test/src/test/sr/sim_uni/op/test_sim_uni_choose_curio/choose_pos_3.png rename to test/src/test/sr/sim_uni/op/sim_uni_choose_curio/choose_pos_3.png diff --git a/test/src/test/sr/sim_uni/op/test_sim_uni_choose_curio/drop_1.png b/test/src/test/sr/sim_uni/op/sim_uni_choose_curio/drop_1.png similarity index 100% rename from test/src/test/sr/sim_uni/op/test_sim_uni_choose_curio/drop_1.png rename to test/src/test/sr/sim_uni/op/sim_uni_choose_curio/drop_1.png diff --git a/test/src/test/sr/sim_uni/op/test_sim_uni_choose_curio/drop_2.png b/test/src/test/sr/sim_uni/op/sim_uni_choose_curio/drop_2.png similarity index 100% rename from test/src/test/sr/sim_uni/op/test_sim_uni_choose_curio/drop_2.png rename to test/src/test/sr/sim_uni/op/sim_uni_choose_curio/drop_2.png diff --git a/test/src/test/sr/sim_uni/op/test_sim_uni_choose_curio/__init__.py b/test/src/test/sr/sim_uni/op/sim_uni_choose_curio/test_sim_uni_choose_curio.py similarity index 100% rename from test/src/test/sr/sim_uni/op/test_sim_uni_choose_curio/__init__.py rename to test/src/test/sr/sim_uni/op/sim_uni_choose_curio/test_sim_uni_choose_curio.py diff --git a/test/src/test/sr/sim_uni/op/sim_uni_claim_weekly_reward/__init__.py b/test/src/test/sr/sim_uni/op/sim_uni_claim_weekly_reward/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/src/test/sr/sim_uni/op/test_sim_uni_claim_weekly_reward/claim_reward.png b/test/src/test/sr/sim_uni/op/sim_uni_claim_weekly_reward/claim_reward.png similarity index 100% rename from test/src/test/sr/sim_uni/op/test_sim_uni_claim_weekly_reward/claim_reward.png rename to test/src/test/sr/sim_uni/op/sim_uni_claim_weekly_reward/claim_reward.png diff --git a/test/src/test/sr/sim_uni/op/test_sim_uni_claim_weekly_reward/reward_icon.png b/test/src/test/sr/sim_uni/op/sim_uni_claim_weekly_reward/reward_icon.png similarity index 100% rename from test/src/test/sr/sim_uni/op/test_sim_uni_claim_weekly_reward/reward_icon.png rename to test/src/test/sr/sim_uni/op/sim_uni_claim_weekly_reward/reward_icon.png diff --git a/test/src/test/sr/sim_uni/op/test_sim_uni_claim_weekly_reward/__init__.py b/test/src/test/sr/sim_uni/op/sim_uni_claim_weekly_reward/test_sim_uni_claim_weekly_reward.py similarity index 100% rename from test/src/test/sr/sim_uni/op/test_sim_uni_claim_weekly_reward/__init__.py rename to test/src/test/sr/sim_uni/op/sim_uni_claim_weekly_reward/test_sim_uni_claim_weekly_reward.py diff --git a/test/src/test/sr/sim_uni/op/sim_uni_event/__init__.py b/test/src/test/sr/sim_uni/op/sim_uni_event/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/resources/sr/sim_uni/op/test_sim_uni_event/choose_bless.png b/test/src/test/sr/sim_uni/op/sim_uni_event/choose_bless.png similarity index 100% rename from test/resources/sr/sim_uni/op/test_sim_uni_event/choose_bless.png rename to test/src/test/sr/sim_uni/op/sim_uni_event/choose_bless.png diff --git a/test/resources/sr/sim_uni/op/test_sim_uni_event/confirm_with_2_lines.png b/test/src/test/sr/sim_uni/op/sim_uni_event/confirm_with_2_lines.png similarity index 100% rename from test/resources/sr/sim_uni/op/test_sim_uni_event/confirm_with_2_lines.png rename to test/src/test/sr/sim_uni/op/sim_uni_event/confirm_with_2_lines.png diff --git a/test/resources/sr/sim_uni/op/test_sim_uni_event/event_no_confirm.png b/test/src/test/sr/sim_uni/op/sim_uni_event/event_no_confirm.png similarity index 100% rename from test/resources/sr/sim_uni/op/test_sim_uni_event/event_no_confirm.png rename to test/src/test/sr/sim_uni/op/sim_uni_event/event_no_confirm.png diff --git a/test/resources/sr/sim_uni/op/test_sim_uni_event/herta_enhance.png b/test/src/test/sr/sim_uni/op/sim_uni_event/herta_enhance.png similarity index 100% rename from test/resources/sr/sim_uni/op/test_sim_uni_event/herta_enhance.png rename to test/src/test/sr/sim_uni/op/sim_uni_event/herta_enhance.png diff --git a/test/resources/sr/sim_uni/op/test_sim_uni_event/herta_normal_2.png b/test/src/test/sr/sim_uni/op/sim_uni_event/herta_normal_2.png similarity index 100% rename from test/resources/sr/sim_uni/op/test_sim_uni_event/herta_normal_2.png rename to test/src/test/sr/sim_uni/op/sim_uni_event/herta_normal_2.png diff --git a/test/resources/sr/sim_uni/op/test_sim_uni_event/no_event.png b/test/src/test/sr/sim_uni/op/sim_uni_event/no_event.png similarity index 100% rename from test/resources/sr/sim_uni/op/test_sim_uni_event/no_event.png rename to test/src/test/sr/sim_uni/op/sim_uni_event/no_event.png diff --git a/test/src/test/sr/sim_uni/op/test_sim_uni_event.py b/test/src/test/sr/sim_uni/op/sim_uni_event/test_sim_uni_event.py similarity index 72% rename from test/src/test/sr/sim_uni/op/test_sim_uni_event.py rename to test/src/test/sr/sim_uni/op/sim_uni_event/test_sim_uni_event.py index 7b7e49de..ecac484f 100644 --- a/test/src/test/sr/sim_uni/op/test_sim_uni_event.py +++ b/test/src/test/sr/sim_uni/op/sim_uni_event/test_sim_uni_event.py @@ -18,21 +18,21 @@ def test_get_opt_list(self): ctx.init_image_matcher() op = SimUniEvent(ctx) - screen = self.get_test_image('herta_normal_2') + screen = self.get_test_image_new('herta_normal_2.png') opt_list = op._get_opt_list(screen) self.assertEqual(4, len(opt_list)) - screen = self.get_test_image('event_no_confirm') + screen = self.get_test_image_new('event_no_confirm.png') opt_list = op._get_opt_list(screen) self.assertEqual(1, len(opt_list)) - screen = self.get_test_image('no_event') + screen = self.get_test_image_new('no_event.png') opt_list = op._get_opt_list(screen) self.assertEqual(0, len(opt_list)) - screen = self.get_test_image('herta_enhance') + screen = self.get_test_image_new('herta_enhance.png') opt_list = op._get_opt_list(screen) - self.assertEqual(1, len(opt_list)) # 暂时没有强化 + self.assertEqual(2, len(opt_list)) def test_confirm_rect(self): ctx = get_context() @@ -40,7 +40,7 @@ def test_confirm_rect(self): ctx.init_image_matcher() op = SimUniEvent(ctx) - screen = self.get_test_image('confirm_with_2_lines') + screen = self.get_test_image_new('confirm_with_2_lines.png') opt_list = op._get_opt_list(screen) self.assertEqual(2, len(opt_list)) part = cv2_utils.crop_image_only(screen, opt_list[1].confirm_rect) @@ -52,17 +52,10 @@ def test_get_screen_state(self): ctx.init_image_matcher() op = SimUniEvent(ctx) - screen = self.get_test_image('event_no_confirm') + screen = self.get_test_image_new('event_no_confirm.png') state = op._get_screen_state(screen) self.assertTrue('事件', state) - screen = self.get_test_image('choose_bless') + screen = self.get_test_image_new('choose_bless.png') state = op._get_screen_state(screen) self.assertTrue(screen_state.ScreenState.SIM_BLESS.value, state) - - def test_op_event(self): - ctx = get_context() - ctx.start_running() - - op = SimUniEvent(ctx) - op.execute() diff --git a/test/src/test/sr/sim_uni/op/sim_uni_reward/__init__.py b/test/src/test/sr/sim_uni/op/sim_uni_reward/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/resources/sr/sim_uni/op/test_sim_uni_reward/reward_right.png b/test/src/test/sr/sim_uni/op/sim_uni_reward/reward_right.png similarity index 100% rename from test/resources/sr/sim_uni/op/test_sim_uni_reward/reward_right.png rename to test/src/test/sr/sim_uni/op/sim_uni_reward/reward_right.png diff --git a/test/src/test/sr/sim_uni/op/test_sim_uni_reward.py b/test/src/test/sr/sim_uni/op/sim_uni_reward/test_sim_uni_reward.py similarity index 72% rename from test/src/test/sr/sim_uni/op/test_sim_uni_reward.py rename to test/src/test/sr/sim_uni/op/sim_uni_reward/test_sim_uni_reward.py index 26d6c07e..162f1ebb 100644 --- a/test/src/test/sr/sim_uni/op/test_sim_uni_reward.py +++ b/test/src/test/sr/sim_uni/op/sim_uni_reward/test_sim_uni_reward.py @@ -16,7 +16,7 @@ def test_get_reward_pos(self): ctx.init_ocr_matcher() op = SimUniReward(ctx, 1) - screen = self.get_test_image('reward_right') + screen = self.get_test_image_new('reward_right.png') pos = op._get_reward_pos(screen) self.assertIsNotNone(pos) @@ -26,14 +26,6 @@ def test_screen_state(self): ctx.init_image_matcher() op = SimUniReward(ctx, 1) - screen = self.get_test_image('reward_right') + screen = self.get_test_image_new('reward_right.png') state = op._get_screen_state(screen) self.assertEqual(screen_state.ScreenState.SIM_REWARD.value, state) - - def test_op(self): - ctx = get_context() - ctx.start_running() - - op = SimUniReward(ctx, 0) - # op._specified_start_node = op.edge_list[0].node_to - op.execute() diff --git a/test/src/test/sr/sim_uni/op/test_choose_sim_uni_num/__init__.py b/test/src/test/sr/sim_uni/op/test_choose_sim_uni_num/__init__.py deleted file mode 100644 index f8cb6e80..00000000 --- a/test/src/test/sr/sim_uni/op/test_choose_sim_uni_num/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -import test -from sr.context import get_context -from sr.sim_uni.op.choose_sim_uni_num import ChooseSimUniNum - - -class TestChooseSimUniNum(test.SrTestBase): - - def __init__(self, *args, **kwargs): - test.SrTestBase.__init__(self, *args, **kwargs) - - def test_get_current_num(self): - ctx = get_context() - ctx.init_ocr_matcher() - - op = ChooseSimUniNum(ctx, 6) - - screen = self.get_test_image_new('num2.png') - op.num = 6 - self.assertEqual(6, op._get_current_num(screen)) diff --git a/test/src/test/sr/sim_uni/op/test_choose_sim_uni_num/num2.png b/test/src/test/sr/sim_uni/op/test_choose_sim_uni_num/num2.png deleted file mode 100644 index f5c365e7..00000000 Binary files a/test/src/test/sr/sim_uni/op/test_choose_sim_uni_num/num2.png and /dev/null differ diff --git a/test/src/test/sr/sim_uni/op/test_sim_uni_battle.py b/test/src/test/sr/sim_uni/op/test_sim_uni_battle.py deleted file mode 100644 index 86b33eb1..00000000 --- a/test/src/test/sr/sim_uni/op/test_sim_uni_battle.py +++ /dev/null @@ -1,28 +0,0 @@ -import unittest - -import test -from sr.context import get_context -from sr.image.sceenshot import screen_state -from sr.screen_area.dialog import ScreenDialog -from sr.sim_uni.op.sim_uni_battle import SimUniEnterFight - - -class TestSimUniBattle(test.SrTestBase): - - def __init__(self, *args, **kwargs): - test.SrTestBase.__init__(self, *args, **kwargs) - - def test_get_screen_state(self): - ctx = get_context() - ctx.init_ocr_matcher() - ctx.init_image_matcher() - - op = SimUniEnterFight(ctx) - - screen = self.get_test_image('after_elite_curio') - self.assertEqual(screen_state.ScreenState.SIM_CURIOS.value, - op._get_screen_state(screen)) - - screen = self.get_test_image('recover_technique_point') - self.assertEqual(ScreenDialog.FAST_RECOVER_TITLE.value.text, - op._get_screen_state(screen)) diff --git a/test/src/test/sr/sim_uni/op/test_sim_uni_exit.py b/test/src/test/sr/sim_uni/op/test_sim_uni_exit.py deleted file mode 100644 index 1f23fb6a..00000000 --- a/test/src/test/sr/sim_uni/op/test_sim_uni_exit.py +++ /dev/null @@ -1,18 +0,0 @@ -import unittest - -import test -from sr.context import get_context -from sr.sim_uni.op.sim_uni_exit import SimUniExit - - -class TestSimUniEvent(test.SrTestBase): - - def __init__(self, *args, **kwargs): - test.SrTestBase.__init__(self, *args, **kwargs) - - def test_op(self): - ctx = get_context() - ctx.start_running() - - op = SimUniExit(ctx) - op.execute() diff --git a/test/src/test/sr/treasures_lightward/op/test_tl_battle/__init__.py b/test/src/test/sr/treasures_lightward/op/test_tl_battle/__init__.py deleted file mode 100644 index ec0f555b..00000000 --- a/test/src/test/sr/treasures_lightward/op/test_tl_battle/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -import test -from sr.context import get_context -from sr.operation import Operation -from sr.screen_area.screen_treasures_lightward import ScreenTreasuresLightWard -from sr.treasures_lightward.op.tl_battle import TlAfterNodeFight -from sr.treasures_lightward.treasures_lightward_const import TreasuresLightwardTypeEnum - - -class TestTlBattle(test.SrTestBase): - - def __init__(self, *args, **kwargs): - test.SrTestBase.__init__(self, *args, **kwargs) - - def test_op_after_node_fight(self): - ctx = get_context() - ctx.init_all() - ctx.start_running() - - op = TlAfterNodeFight(ctx, TreasuresLightwardTypeEnum.FORGOTTEN_HALL) - op.execute()