def test_insert_pic(self, file_type='ss'): logging.info('==========test_insert_pic==========') cv = CreateView(self.driver) gv = GeneralView(self.driver) cv.create_file(file_type) cv.group_button_click(' Insert ') gv.insert_pic() gv.pic_option(file_type, 5, 4, 4) gv.pic_option(file_type, 1) ele1 = '//*[@text=" Picture "]' ele2 = '//*[@text=" Outline "]' # ele3 = '//*[@text="文字环绕"]' # ele4 = '//*[@text="叠放次序"]' gv.swipe_ele(ele2, ele1) if file_type == 'wp': gv.text_wrap() x, y = gv.find_pic_position('rotate_free') gv.swipe(x, y, x + 100, y + 100) x, y = gv.find_pic_position('drag_all') gv.tap(x, y) gv.pop_menu_click('copy') gv.tap(x, y) gv.pop_menu_click('paste') gv.tap(x, y) gv.pop_menu_click('paste') gv.shape_layer(' Send Backward ') gv.shape_layer(' Send to Back ') gv.shape_layer(' Bring Forward ') gv.shape_layer(' Bring to Front ')
def test_ppt_slide(self): # 幻灯片复制、剪切、粘贴 logging.info('==========test_ppt_slide==========') cv = CreateView(self.driver) cv.create_file(self.file_type) gv = GeneralView(self.driver) self.driver.find_element( By.XPATH, '//android.widget.HorizontalScrollView' '/android.widget.LinearLayout/android.view.View[1]').click() time.sleep(1) gv.pop_menu_click('copy') self.driver.find_element( By.XPATH, '//android.widget.HorizontalScrollView' '/android.widget.LinearLayout/android.view.View[1]').click() time.sleep(1) gv.pop_menu_click('paste') self.driver.find_element( By.XPATH, '//android.widget.HorizontalScrollView' '/android.widget.LinearLayout/android.view.View[2]').click() time.sleep(1) gv.pop_menu_click('cut') self.driver.find_element( By.XPATH, '//android.widget.HorizontalScrollView' '/android.widget.LinearLayout/android.view.View[1]').click() time.sleep(1) gv.pop_menu_click('paste') self.driver.find_element( By.XPATH, '//android.widget.HorizontalScrollView' '/android.widget.LinearLayout/android.view.View[2]').click() time.sleep(1) gv.pop_menu_click('create') self.driver.find_element( By.XPATH, '//android.widget.HorizontalScrollView' '/android.widget.LinearLayout/android.view.View[3]').click() time.sleep(1) gv.pop_menu_click('delete') self.driver.find_element( By.XPATH, '//android.widget.HorizontalScrollView' '/android.widget.LinearLayout/android.view.View[2]').click() time.sleep(1) x1, y1 = gv.find_pic_position('copy') x2, y2 = gv.find_pic_position('delete') gv.swipe(x2, y2, x1, y1) gv.pop_menu_click('hide') self.driver.find_element( By.XPATH, '//android.widget.HorizontalScrollView' '/android.widget.LinearLayout/android.view.View[2]').click() time.sleep(1) gv.pop_menu_click('hide_cancel') self.driver.find_element( By.XPATH, '//android.widget.HorizontalScrollView' '/android.widget.LinearLayout/android.view.View[2]').click() time.sleep(1) gv.pop_menu_click('comment') time.sleep(3)
def test_pop_cell_row_col3(self): # 单元格、行、列相关操作 logging.info('==========test_pop_cell_row_col3==========') cv = CreateView(self.driver) cv.create_file(self.file_type) gv = GeneralView(self.driver) ss = SSView(self.driver) time.sleep(1) x, y, width, height = ss.cell_location() # 新建默认B8 cv.tap(x + width * 0.5, y - height * 5.5) ss.cell_edit() # 进入 Edit for i in range(8): self.driver.press_keycode(random.randint(29, 54)) self.driver.find_element( By.ID, 'com.yozo.office.en:id/formulabar_ok').click() time.sleep(0.5) x1, y1, x2, y2 = ss.row_col_loc() ss.tap(x2 + width * 1.5, y2 - 10) gv.pop_menu_click('insert') ss.tap(x2 + width * 1.5, y2 - 10) gv.pop_menu_click('delete') ss.tap(x2 + width * 1.5, y2 - 10) gv.pop_menu_click('copy') ss.tap(x2 + width * 2.5, y2 - 10) x3, y3 = gv.find_pic_position('copy') x4, y4 = gv.find_pic_position('insert') gv.swipe(x3, y3, x4, y4) time.sleep(1) gv.pop_menu_click('paste') ss.tap(x2 + width * 1.5, y2 - 10) gv.pop_menu_click('cut') ss.tap(x2 + width * 2.5, y2 - 10) gv.pop_menu_click('paste') ss.tap(x2 + width * 1.5, y2 - 10) gv.pop_menu_click('hide') ss.tap(x2 + width * 1.5, y2 - 10) x3, y3 = gv.find_pic_position('hide') x4, y4 = gv.find_pic_position('copy') gv.swipe(x3, y3, x4, y4) time.sleep(1) gv.pop_menu_click('hide_cancel') ss.tap(x2 + width * 1.5, y2 - 10) x, y = gv.find_pic_position('column_right') gv.drag_coordinate(x, y, x + width, y) gv.drag_coordinate(x, y2 - 10, x + width, y2 - 10)
def test_insert_pic1(self, file_type='ss'): logging.info('==========test_insert_pic==========') suffix = SEARCH_DICT[file_type] ov = OpenView(self.driver) ov.open_random_file(suffix) gv = GeneralView(self.driver) gv.switch_write_read() gv.group_button_click(' Insert ') gv.insert_pic() gv.pic_option(file_type, 5, 4, 4) ele1 = '//*[@text=" Picture "]' ele2 = '//*[@text=" Outline "]' # ele3 = '//*[@text="文字环绕"]' # ele4 = '//*[@text="叠放次序"]' gv.swipe_ele(ele2, ele1) if file_type == 'wp': gv.text_wrap(' Square ') gv.text_wrap(' In Line with Text ') gv.text_wrap(' Tight ') gv.text_wrap(' Behind Text ') gv.text_wrap(' In Front of Text ') x, y = gv.find_pic_position('drag_pic') gv.tap(x, y) gv.pop_menu_click('cut') if file_type == 'wp': gv.long_press(x, y) else: gv.tap(x + 100, y) gv.tap(x + 100, y) gv.pop_menu_click('paste') x, y = gv.find_pic_position('drag_pic') gv.tap(x, y) x, y = gv.find_pic_position('rotate_90') gv.swipe(x, y, x - 50, y) gv.pop_menu_click('save_to_album') gv.pop_menu_click('delete')
def test_pop_menu_cell_text(self): logging.info('==========test_pop_menu_cell_text==========') cv = CreateView(self.driver) cv.create_file(self.file_type) gv = GeneralView(self.driver) ss = SSView(self.driver) time.sleep(1) x, y, width, height = ss.cell_location() # 新建默认B8 cv.tap(x + width * 0.5, y - height * 5.5) # 点击B2 ss.cell_edit() # 进入 Edit for i in range(15): self.driver.press_keycode(random.randint(29, 54)) # time.sleep(1) gv.drag_coordinate(x + 200, y - height * 5.5, x + 50, y - height * 5.5) gv.pop_menu_click('copy') gv.tap(x + width * 0.5, y - height * 5.5) gv.pop_menu_click('paste') gv.drag_coordinate(x + 200, y - height * 5.5, x + 50, y - height * 5.5) gv.pop_menu_click('cut') gv.tap(x + width * 0.5, y - height * 5.5) gv.pop_menu_click('paste') gv.tap(x + width * 0.5, y - height * 5.5) gv.pop_menu_click('newline') self.driver.find_element( By.ID, 'com.yozo.office.en:id/formulabar_ok').click() gv.tap(x + width * 0.5, y - height * 5.5) gv.pop_menu_click('fill_data') x1, y1 = gv.find_pic_position('fill_down') gv.drag_coordinate(x1, y1, x1, y1 + height * 2) gv.tap(x + width * 0.5, y - height * 5.5) time.sleep(1) x2, y2 = gv.find_pic_position('fill_data') gv.swipe(x2, y2, x2 - width * 2, y2) gv.pop_menu_click('clear_content')
def test_wp_sign(self): # wp签批 logging.info('==========test_wp_pic_fixed_rotation==========') self.signoption_setup() gv = GeneralView(self.driver) gv.use_finger('wp') gv.use_finger('wp') gv.pen_type('wp', '钢笔') gv.pen_color('wp', 15) gv.pen_size('wp', 3) gv.swipe(300, 400, 800, 400, 500) gv.pen_type('wp', '荧光笔') gv.pen_color('wp', 30) gv.pen_size('wp', 6) gv.swipe(300, 600, 800, 600, 500) gv.pen_type('wp', '擦除') gv.swipe(200, 400, 900, 400, 500) gv.swipe(200, 600, 900, 600, 500) time.sleep(3)
def test_signature(self, file_type): # 签批 logging.info('==========test_signature==========') cv = CreateView(self.driver) cv.create_file(file_type) gv = GeneralView(self.driver) gv.group_button_click(' Signature ') gv.use_finger(file_type) gv.use_finger(file_type) gv.pen_type(file_type, '钢笔') gv.pen_color(file_type, 15) gv.pen_size(file_type, 3) gv.swipe(300, 400, 800, 400, 500) gv.pen_type(file_type, '荧光笔') gv.pen_color(file_type, 30) gv.pen_size(file_type, 6) gv.swipe(300, 600, 800, 600, 500) gv.pen_type(file_type, '擦除') gv.swipe(200, 400, 900, 400, 500) gv.swipe(200, 600, 900, 600, 500) time.sleep(3)