def test_insert_chart1(self, file_type): logging.info('==========test_insert_chart1==========') cv = CreateView(self.driver) cv.create_file(file_type) gv = GeneralView(self.driver) ss = SSView(self.driver) time.sleep(1) if file_type == 'ss': x, y, width, height = ss.cell_location() for i in range(3): cv.tap(x + width * 0.5, y + height * (i + 0.5)) ss.cell_edit() # 双击进入编辑 self.driver.press_keycode(random.randint(7, 16)) gv.drag_coordinate(x, y + height * 2, x, y) gv.group_button_click(' Insert ') if file_type == 'pg': ele1 = '//*[@text=" Slide "]' ele2 = '//*[@text=" Picture "]' gv.swipe_ele(ele2, ele1) gv.insert_chart_insert(' Column Chart ', random.randint(1, 9)) gv.chart_color(random.randint(1, 8)) gv.chart_element(file_type, '大标题', 1, 1, 1) gv.chart_element_XY('x', 'x', 0, 1, 1, 1, 1, 1) gv.chart_element_XY('y', 'y', 0, 1, 1, 0, 1, 0) self.driver.find_element( By.ID, 'com.yozo.office.en:id/yozo_ui_option_back_button').click() gv.change_row_column() time.sleep(3)
def test_insert_chart(self, type): # 插入图表,仅ss,pg logging.info('==========test_insert_chart==========') chart_list = ['柱形图', '条形图', '折线图', '饼图', '散点图', '面积图', '圆环图', '雷达图', '圆柱图', '圆锥图', '棱锥图'] cv = CreateView(self.driver) cv.create_file(type) gv = GeneralView(self.driver) time.sleep(1) if type == 'ss': for i in range(3): cv.tap(110 + 263 * 1.5, 295 + 55 * (1.5 + i)) # 双击进入编辑 cv.tap(110 + 263 * 1.5, 295 + 55 * (1.5 + i)) self.driver.press_keycode(random.randint(7, 16)) gv.drag_coordinate(110 + 263 * 2, 295 + 55 * 2, 110 + 263 * 2, 295 + 55 * 4) for i in chart_list: gv.group_button_click('插入') gv.insert_chart_insert(i, random.randint(1, 9)) gv.chart_template() ele1 = '//*[@text="图表类型"]' ele2 = '//*[@text="图表元素"]' gv.swipe_ele(ele2, ele1) gv.shape_layer('下移一层') gv.shape_layer('置于底层') gv.shape_layer('上移一层') gv.shape_layer() time.sleep(3)
def test_wp_shape_text_attr(self): # 自选图形文本属性,仅WP和PG logging.info('==========test_wp_shape_text_attr==========') cv = CreateView(self.driver) cv.create_file(self.file_type) gv = GeneralView(self.driver) gv.group_button_click(' Insert ') gv.insert_shape(self.file_type, 1) gv.tap(680, 750) gv.pop_menu_click('editText') time.sleep(1) gv.group_button_click(' Edit ') gv.font_name(self.file_type, 'AndroidClock') gv.font_size(15) gv.font_style(self.file_type, '倾斜') gv.font_color(self.file_type, 6, 29) gv.swipe_ele('//*[@text=" Font Color "]', '//*[@text=" Edit "]') time.sleep(1) for i in range(20): self.driver.press_keycode(random.randint(29, 54)) time.sleep(1) gv.swipe_ele('//*[@text=" Highlight Color "]', '//*[@text=" Edit "]') gv.drag_coordinate(680, 750, 680, 600) gv.high_light_color(self.file_type, 6, random.randint(1, 15)) gv.bullets_numbers(self.file_type, 6, 10) gv.text_align(self.file_type, '分散对齐') gv.text_align(self.file_type, '右对齐') gv.text_line_space(self.file_type, 1.5) gv.text_line_space(self.file_type, 3) gv.text_indent(self.file_type, '右缩进') gv.text_indent(self.file_type, '右缩进') gv.text_indent(self.file_type, '左缩进') time.sleep(3)
def test_pop_cell_row_col1(self): # 单元格、行、列相关操作 logging.info('==========test_pop_cell_row_col1==========') 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 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) cv.tap(x + width * 0.5, y + height * 0.5) # 复制粘贴 gv.pop_menu_click('copy') cv.tap(x + width * 1.5, y + height * 1.5) cv.tap(x + width * 1.5, y + height * 1.5) gv.pop_menu_click('paste') cv.tap(x + width * 0.5, y + height * 0.5) gv.pop_menu_click('cut') cv.tap(x + width * 2.5, y + height * 2.5) cv.tap(x + width * 2.5, y + height * 2.5) gv.pop_menu_click('paste') x, y = gv.find_pic_position('drag_point2') # 多选单元格 gv.drag_coordinate(x, y, x + width, y + height)
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_wp_pop_menu_text(self): logging.info('==========test_wp_pop_menu_text==========') cv = CreateView(self.driver) cv.create_file(self.file_type) gv = GeneralView(self.driver) time.sleep(1) gv.tap(700, 700) for i in range(100): self.driver.press_keycode(random.randint(29, 54)) gv.drag_coordinate(300, 540, 300, 200) gv.pop_menu_click('copy') gv.tap(700, 700) time.sleep(1) gv.long_press(700, 700) gv.pop_menu_click('paste') gv.drag_coordinate(300, 540, 300, 200) gv.pop_menu_click('cut') gv.tap(700, 700) time.sleep(1) gv.long_press(700, 700) gv.pop_menu_click('paste')
def test_insert_chart(self, file_type): # Insert 图表,仅ss,pg logging.info('==========test_insert_chart==========') chart_list = [ ' Column Chart ', ' Bar Chart ', ' Line Chart ', ' Pie Chart ', ' Scatter Chart ', ' Area Chart ', ' Doughnut Chart ', ' Radar Chart ', ' Bubble Chart ', ' Cylind Chart ', ' Cone Chart ', ' Pyramid Chart ' ] cv = CreateView(self.driver) cv.create_file(file_type) gv = GeneralView(self.driver) ss = SSView(self.driver) time.sleep(1) if file_type == 'ss': x, y, width, height = ss.cell_location() for i in range(3): cv.tap(x + width * 0.5, y + height * (i + 0.5)) ss.cell_edit() # 双击进入编辑 self.driver.press_keycode(random.randint(7, 16)) gv.drag_coordinate(x, y + height * 2, x, y) for i in range(3): gv.group_button_click(' Insert ') if file_type == 'pg' and i == 0: ele1 = '//*[@text=" Slide "]' ele2 = '//*[@text=" Picture "]' gv.swipe_ele(ele2, ele1) gv.insert_chart_insert(chart_list[i], random.randint(1, 9)) gv.chart_template() ele1 = '//*[@text=" Chart "]' ele2 = '//*[@text=" Chart Type "]' gv.swipe_ele(ele2, ele1) gv.shape_layer(' Send Backward ') gv.shape_layer(' Send to Back ') gv.shape_layer(' Bring Forward ') gv.shape_layer(' Bring to Front ') time.sleep(3)
def test_insert_chart1(self, type): logging.info('==========test_insert_chart1==========') cv = CreateView(self.driver) cv.create_file(type) gv = GeneralView(self.driver) time.sleep(1) if type == 'ss': for i in range(3): cv.tap(110 + 263 * 1.5, 295 + 55 * (1.5 + i)) # 双击进入编辑 cv.tap(110 + 263 * 1.5, 295 + 55 * (1.5 + i)) self.driver.press_keycode(random.randint(7, 16)) gv.drag_coordinate(110 + 263 * 2, 295 + 55 * 2, 110 + 263 * 2, 295 + 55 * 4) gv.group_button_click('插入') gv.insert_chart_insert('柱形图', random.randint(1, 9)) gv.chart_color(random.randint(1, 8)) gv.chart_element(type, '大标题', 1, 1) gv.chart_element_XY('x', 0, 1, 1, 1, 1, 1) gv.chart_element_XY('y', 0, 1, 1, 0) self.driver.find_element(By.ID, 'com.yozo.office:id/yozo_ui_option_back_button').click() gv.change_row_column() time.sleep(3)
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_pop_menu_shape1(self, file_type): logging.info('==========test_pop_menu_shape1_ws==========') cv = CreateView(self.driver) cv.create_file(file_type) gv = GeneralView(self.driver) if file_type == 'pg': pg = PGView(self.driver) gv.group_button_click(' Edit ') pg.edit_format('空白') time.sleep(1) gv.group_button_click(' Insert ') gv.insert_shape(file_type) gv.fold_expand() x1, y1 = gv.find_pic_position('drag_all') gv.drag_coordinate(x1, y1, x1 - 100, y1) x1, y1 = gv.find_pic_position('drag_all') gv.drag_coordinate(x1, y1, x1 + 100, y1) x1, y1 = gv.find_pic_position('drag_all') gv.drag_coordinate(x1, y1, x1 - 50, y1 - 50) x2, y2 = gv.find_pic_position('drag_all1') gv.drag_coordinate(x2, y2, x2, y2 - 100) x2, y2 = gv.find_pic_position('drag_all1') gv.drag_coordinate(x2, y2, x2, y2 + 100) x2, y2 = gv.find_pic_position('drag_all1') gv.drag_coordinate(x2, y2, x2 - 50, y2 - 50) x, y = gv.find_pic_position('rotate_free') gv.drag_coordinate(x, y, x + 50, y + 50)
def test_pop_menu_shape(self, file_type='wp'): logging.info('==========test_pop_menu_shape==========') cv = CreateView(self.driver) cv.create_file(file_type) gv = GeneralView(self.driver) gv.group_button_click(' Insert ') gv.insert_shape(file_type) time.sleep(1) if file_type == 'pg': gv.tap(550, 450) gv.pop_menu_click('editText') else: gv.tap(700, 700, 2) gv.tap(700, 700, 3) for i in range(50): self.driver.press_keycode(random.randint(29, 54)) if file_type == 'pg': gv.drag_coordinate(550, 830, 500, 800) gv.pop_menu_click('copy') gv.tap(550, 830) time.sleep(1) gv.long_press(550, 830) gv.pop_menu_click('paste') gv.drag_coordinate(550, 830, 500, 800) gv.pop_menu_click('cut') gv.tap(550, 830) time.sleep(1) gv.long_press(550, 830) gv.pop_menu_click('paste') gv.drag_coordinate(550, 830, 500, 800) gv.pop_menu_click('delete') else: gv.drag_coordinate(700, 700, 550, 550) gv.pop_menu_click('copy') gv.tap(700, 700) time.sleep(1) gv.long_press(700, 700) gv.pop_menu_click('paste') gv.drag_coordinate(700, 700, 550, 550) gv.pop_menu_click('cut') gv.tap(700, 700) time.sleep(1) gv.long_press(700, 700) gv.pop_menu_click('paste') gv.drag_coordinate(700, 700, 550, 550) gv.pop_menu_click('delete')