def test_wp_table_size(self): self.wp_insert_one_table() wp = WPView(self.driver) ele = '//*[@resource-id="com.yozo.office.en:id/yozo_ui_app_frame_office_view_container"]' e7 = wp.get_element_xy(ele, x_y=7) e9 = wp.get_element_xy(ele, x_y=9) # 改变表格大小 while not exists(wp.template_object('table_size.png')): wp.swipe(e9[0], e9[1], e7[0], e7[1]) swipe(wp.template_object('table_size.png'), wp.get_element_xy(ele, x_y=4)) time.sleep(5)
def test_wp_pic_free_rotate(self, type1='wp'): self.insert_one_pic(type1) wp = WPView(self.driver) s = wp.swipe_option('up') while not wp.exist('//*[@text=" Text Wrapping "]'): wp.swipe(s[0], s[1], s[2], s[3]) wp.text_wrap(' Square ') # 属性调整大小 cc = "com.yozo.office.en:id/yozo_ui_%s_option_id_picture_edit" % type1 while not wp.exist('//*[@resource-id="%s"]' % cc): wp.swipe(s[2], s[3], s[0], s[1]) wp.get_element('//*[@resource-id="%s"]' '/android.widget.FrameLayout[5]' % cc).click() wp.shape_option_5() if wp.exist( '//*[@resource-id="com.yozo.office.en:id/yozo_ui_option_content_container"]' ): wp.fold_expand() ele5 = wp.get_element_xy( '//*[@resource-id="com.yozo.office.en:id/yozo_ui_app_frame_office_view_container"]' ) ele9 = wp.get_element_xy( '//*[@resource-id="com.yozo.office.en:id/yozo_ui_app_frame_office_view_container"]', x_y=9) while not exists(wp.template_object('rotate_free.png')): wp.swipe(ele5[0], ele5[1], ele9[0], ele9[1]) # 向右移动图片 rotate_free = loop_find(wp.template_object('rotate_free.png')) wp.swipe(rotate_free[0], rotate_free[1] + 200, rotate_free[0] + 200, rotate_free[1] + 200) # 取消选中图片 wp.tap(ele9[0], ele9[1]) time.sleep(1) self.assertTrue(wp.exist('//*[@text="编辑"]'), msg='取消选中图片异常') # 选中图片 wp.tap(rotate_free[0] + 200, rotate_free[1] + 200) time.sleep(1) self.assertTrue(wp.exist('//*[@text="图片"]'), msg='选中图片异常') # 自由旋转 rotate_free = loop_find(wp.template_object('rotate_free.png')) wp.swipe(rotate_free[0], rotate_free[1], ele9[0], ele9[1]) rotate_free2 = loop_find(wp.template_object('rotate_free.png')) self.assertEqual(rotate_free, rotate_free2, msg='图片自由旋转失败')
def test_wp_table_left_rows(self): self.wp_insert_one_table() wp = WPView(self.driver) ele = '//*[@resource-id="com.yozo.office.en:id/yozo_ui_app_frame_office_view_container"]' e7 = wp.get_element_xy(ele, x_y=7) e9 = wp.get_element_xy(ele, x_y=9) # Insert 行 while not exists(wp.template_object('table_select.png')): wp.swipe(e7[0], e7[1], e9[0], e9[1]) touch(wp.template_object('table_cols_rows.png'))