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_ss_chart_pop(self): # 图表相关操作 logging.info('==========test_ss_chart_pop==========') cv = CreateView(self.driver) cv.create_file(self.file_type) ss = SSView(self.driver) gv = GeneralView(self.driver) time.sleep(2) x, y, width, height = ss.object_position('drag_point1', 'drag_point2') ss.tap(x, y) time.sleep(2) ss.pop_menu_click('edit') self.driver.press_keycode(12) ss.tap(x, y + height) time.sleep(1) ss.tap(x, y + height) time.sleep(2) ss.pop_menu_click('edit') self.driver.press_keycode(15) self.driver.find_element( By.ID, 'com.yozo.office.en:id/formulabar_ok').click() # ss.tap(x, y) x, y = ss.find_pic_position('drag_point1') ss.swipe(x, y, x, y - height) time.sleep(1) ss.group_button_click(' Insert ') gv.insert_chart_insert(' Column Chart ', 2) x, y, width, height = ss.object_position('chart_all1', 'chart_all4') ss.tap(x, y) time.sleep(2) ss.pop_menu_click('cut') ss.tap(x, y) time.sleep(2) ss.tap(x, y) ss.pop_menu_click('paste') ss.tap(x, y) time.sleep(2) ss.pop_menu_click('copy') ss.tap(x, y) time.sleep(2) ss.pop_menu_click('paste') ss.swipe(x, y, x - 100, y + 100) x, y = ss.find_pic_position('chart_all1') ss.swipe(x, y, x - 100, y - 100)
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)