def test_22_doubleclick(self): print("#测试点# 标准窗口测试:双击") sleep(0.5) caption_x, caption_y = d(resourceId="android:id/caption").center() extendevent.drag_2(d, mouseID, caption_x, caption_y, screen_width / 2, 100) sleep(0.5) extendevent.double_click(d, mouseID, d(resourceId="android:id/caption")) sleep(0.5) check_windowBounds = { 'top': 0, 'bottom': screen_height, 'left': 0, 'right': screen_width } windowBounds = extendfunction.getParentBounds( d.dump_hierarchy(), 'resource-id="android:id/caption"') print("期望:" + str(check_windowBounds)) print("实际:" + str(windowBounds)) output_res(windowBounds == check_windowBounds) if (module_result == True): print("模块通过") else: print("模块失败")
def test_72_desktopmode_move_left1(self): print("#测试点# 强制横屏模式测试:移动-屏幕内左移") sleep(0.5) caption_x, caption_y = d(resourceId="android:id/caption").center() extendevent.drag_2(d, mouseID, caption_x, caption_y, screen_width / 2, 100) sleep(0.5) caption_x, caption_y = d(resourceId="android:id/caption").center() windowBounds = extendfunction.getParentBounds( d.dump_hierarchy(), 'resource-id="android:id/caption"') extendevent.drag_2(d, mouseID, caption_x, caption_y, 480 + 100, caption_y) check_windowBounds = { 'top': windowBounds['top'], 'bottom': windowBounds['top'] + 540, 'left': 100, 'right': 100 + 960 } sleep(0.5) windowBounds = extendfunction.getParentBounds( d.dump_hierarchy(), 'resource-id="android:id/caption"') print("期望:" + str(check_windowBounds)) print("实际:" + str(windowBounds)) output_res(windowBounds == check_windowBounds) if (module_result == True): print("模块通过") else: print("模块失败")
def test_13_move_up1(self): print("#测试点# 标准窗口测试:移动-屏幕内上移") sleep(0.5) caption_x, caption_y = d(resourceId="android:id/caption").center() windowBounds = extendfunction.getParentBounds( d.dump_hierarchy(), 'resource-id="android:id/caption"') window_width = windowBounds['right'] - windowBounds['left'] window_height = windowBounds['bottom'] - windowBounds['top'] caption_bounds = d( resourceId="android:id/caption").info.get('visibleBounds') caption_height = caption_bounds['bottom'] - caption_bounds['top'] extendevent.drag_2(d, mouseID, caption_x, caption_y, screen_width / 2, 100) check_windowBounds = { 'top': 100 - caption_height / 2 - 1, 'bottom': (100 - caption_height / 2) - 1 + window_height, 'left': screen_width / 2 - window_width / 2, 'right': screen_width / 2 + window_width / 2 } sleep(0.5) windowBounds = extendfunction.getParentBounds( d.dump_hierarchy(), 'resource-id="android:id/caption"') print("期望:" + str(check_windowBounds)) print("实际:" + str(windowBounds)) output_res(windowBounds == check_windowBounds) if (module_result == True): print("模块通过") else: print("模块失败")
def test_12_move_right1(self): print("#测试点# 标准窗口测试:移动-屏幕内右移") sleep(0.5) caption_x, caption_y = d(resourceId="android:id/caption").center() windowBounds = extendfunction.getParentBounds( d.dump_hierarchy(), 'resource-id="android:id/caption"') window_width = windowBounds['right'] - windowBounds['left'] extendevent.drag_2(d, mouseID, caption_x, caption_y, screen_width - 100 - window_width / 2, caption_y) check_windowBounds = { 'top': windowBounds['top'], 'bottom': windowBounds['bottom'], 'left': screen_width - 100 - window_width, 'right': screen_width - 100 } sleep(0.5) windowBounds = extendfunction.getParentBounds( d.dump_hierarchy(), 'resource-id="android:id/caption"') print("期望:" + str(check_windowBounds)) print("实际:" + str(windowBounds)) output_res(windowBounds == check_windowBounds) if (module_result == True): print("模块通过") else: print("模块失败")
def test_18_move_rightdown(self): print("#测试点# 标准窗口测试:移动-出屏幕右下") sleep(0.5) caption_x, caption_y = d(resourceId="android:id/caption").center() extendevent.drag_2(d, mouseID, caption_x, caption_y, 1900, 700) if (module_result == True): print("模块通过") else: print("模块失败")
def test_73_desktopmode_move_rightbottom(self): print("#测试点# 强制横屏模式测试:移动-右下") sleep(0.5) caption_x, caption_y = d(resourceId="android:id/caption").center() extendevent.drag_2(d, mouseID, caption_x, caption_y, screen_width - 300, screen_height - 300) if (module_result == True): print("模块通过") else: print("模块失败")
def test_16_move_right2(self): print("#测试点# 标准窗口测试:移动-出屏幕右移") sleep(0.5) caption_x, caption_y = d(resourceId="android:id/caption").center() extendevent.drag_2(d, mouseID, caption_x, caption_y, screen_width - 300, 100) if (module_result == True): print("模块通过") else: print("模块失败")
def test_14_move_down1(self): print("#测试点# 标准窗口测试:移动-屏幕内下移") sleep(0.5) caption_x, caption_y = d(resourceId="android:id/caption").center() windowBounds = extendfunction.getParentBounds( d.dump_hierarchy(), 'resource-id="android:id/caption"') window_height = windowBounds['top'] - windowBounds['bottom'] extendevent.drag_2(d, mouseID, caption_x, caption_y, caption_x, 800 - window_height) if (module_result == True): print("模块通过") else: print("模块失败")
def test_31_button_minimum(self): print("#测试点# 标准窗口测试:按钮-最小化") sleep(0.5) d(resourceId="android:id/minimize_window").click() sleep(0.5) output_res(d(text="回收站").exists) d.app_stop(package) sleep(0.5) startapp(package) caption_x, caption_y = d(resourceId="android:id/caption").center() extendevent.drag_2(d, mouseID, caption_x, caption_y, screen_width / 2, 100) if (module_result == True): print("模块通过") else: print("模块失败")
def test_64_phonemode_move_top(self): print("#测试点# 强制竖屏模式测试:移动-上边界") sleep(0.5) caption_x, caption_y = d(resourceId="android:id/caption").center() extendevent.drag_2(d, mouseID, caption_x, caption_y, 800, 0) sleep(0.5) windowBounds = extendfunction.getParentBounds( d.dump_hierarchy(), 'resource-id="android:id/caption"') check_windowBounds = { 'top': 0, 'bottom': 720, 'left': windowBounds['left'], 'right': windowBounds['left'] + 405 } print("期望:" + str(check_windowBounds)) print("实际:" + str(windowBounds)) output_res(windowBounds == check_windowBounds) if (module_result == True): print("模块通过") else: print("模块失败")