def test_ppt_insert_new(self): logging.info('==========test_ppt_insert_new==========') cv = CreateView(self.driver) cv.create_file('pg') logging.info('==========insert new ppt==========') pv = PGView(self.driver) pv.insert_new_ppt() gv = GeneralView(self.driver) gv.fold_expand() logging.info('==========validate insert success==========') thumbnails_list = self.driver.find_elements(By.CLASS_NAME, 'android.view.View') thumbnails_list[0].click() pv.screenshot_edit_ppt(SEREEN_SHOTS + 'new_first.png') thumbnails_list[1].click() pv.screenshot_edit_ppt(SEREEN_SHOTS + 'new_second.png') result1 = gv.compare_pic('first.png', 'new_first.png') result2 = gv.compare_pic('new_second.png', 'new_ppt.png') self.assertEqual(result1, 0.0) self.assertEqual(result2, 0.0) logging.info('==========delete pngs==========') os.remove(SEREEN_SHOTS + 'first.png') os.remove(SEREEN_SHOTS + 'new_first.png') os.remove(SEREEN_SHOTS + 'new_second.png')
def test_shape_text_attr_pg(self): # 自选图形文本属性,仅WP和PG logging.info('==========test_shape_text_attr_pg==========') 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.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 "]') gv.fold_expand() time.sleep(1) x, y = gv.find_pic_position('drag_all') gv.tap(x, y) # 进入 Edit gv.pop_menu_click('editText') for i in range(20): self.driver.press_keycode(random.randint(29, 54)) time.sleep(1) gv.group_button_click(' Edit ') gv.bullets_numbers('pg', 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_wp_pic_fixed_rotate(self): # 图片旋转 logging.info('==========test_wp_pic_fixed_rotation==========') self.choose_pic_setup() gv = GeneralView(self.driver) gv.fold_expand() wp = WpView(self.driver) wp.pic_fixed_rotate()
def test_wp_shape_surround(self): # 设置形状文字环绕效果 logging.info('==========test_wp_shape_surround==========') self.shapeatt_setup() gv = GeneralView(self.driver) gv.fold_expand() wv = WpView(self.driver) wv.surround('shape')
def test_wp_shape_shadow(self): # 设置形状阴影和三维效果 logging.info('==========test_wp_shape_broad==========') self.shapeatt_setup() gv = GeneralView(self.driver) gv.fold_expand() wv = WpView(self.driver) wv.shape_effect()
def test_wp_shape_broad_width(self): # 设置形状轮廓粗细 logging.info('==========test_wp_shape_broad==========') self.shapeatt_setup() gv = GeneralView(self.driver) gv.fold_expand() wv = WpView(self.driver) wv.shape_broad_width()
def test_wp_shape_type(self): # 形状轮廓类型 logging.info('==========test_wp_shape_broad==========') self.shapeatt_setup() gv = GeneralView(self.driver) gv.fold_expand() wv = WpView(self.driver) wv.shape_broad_type()
def test_expand_fold(self): # 编辑栏收起展开 logging.info('==========test_expand_fold==========') ov = OpenView(self.driver) ov.open_file('用地统计表.xls') gv = GeneralView(self.driver) gv.switch_write_read() gv.fold_expand() gv.fold_expand()
def test_expand_fold(self, file_type): # 编辑栏收起展开 logging.info('==========test_expand_fold==========') suffix = SEARCH_DICT[file_type] ov = OpenView(self.driver) ov.open_random_file(suffix) gv = GeneralView(self.driver) gv.switch_write_read() gv.fold_expand() gv.fold_expand()
def test_expand_fold(self, type): # 编辑栏收起展开 logging.info('==========test_expand_fold==========') suffix = search_dict[type] ov = OpenView(self.driver) ov.open_file('欢迎使用永中Office.%s' % suffix) gv = GeneralView(self.driver) gv.switch_write_read() gv.fold_expand() gv.fold_expand()
def test_wp_pic_change_size(self): # 设置图片宽高 logging.info('==========test_wp_pic_change_size==========') self.choose_pic_setup() gv = GeneralView(self.driver) gv.fold_expand() wp = WpView(self.driver) wp.pic_change_size() time.sleep(5)
def test_wp_shape_layer(self): # 设置形状叠放次序 logging.info('==========test_wp_shape_surround==========') self.shapeatt_setup() wv = WpView(self.driver) gv = GeneralView(self.driver) gv.switch_write_read() gv.switch_write_read() wv.switch_option('插入') wv.insert_text_box() gv.fold_expand() wv.shape_layer()
def test_undo_redo(self, file_type): # 撤销、重做 logging.info('==========test_undo_redo==========') cv = CreateView(self.driver) gv = GeneralView(self.driver) cv.create_file(file_type) self.driver.find_element( By.ID, 'com.yozo.office.en:id/yozo_ui_toolbar_button_undo') # 判断页面是否已切过来 gv.group_button_click(' Insert ') gv.insert_shape(file_type, 1) gv.fold_expand() gv.undo_option() time.sleep(1) gv.redo_option() time.sleep(1) gv.undo_option() time.sleep(1) logging.info('capture before undo') gv.getScreenShot4Compare('before_undo') gv.redo_option() time.sleep(1) logging.info('capture before redo') gv.getScreenShot4Compare('before_redo') gv.undo_option() if file_type == 'ss': gv.fold_expand() gv.fold_expand() time.sleep(1) logging.info('capture after undo') gv.getScreenShot4Compare('after_undo') gv.redo_option() time.sleep(1) logging.info('capture after redo') gv.getScreenShot4Compare('after_redo') result1 = gv.compare_pic('before_undo.png', 'after_undo.png') result2 = gv.compare_pic('before_redo.png', 'after_redo.png') self.assertLess(result1, 100, 'undo fail!') self.assertLess(result2, 100, 'redo fail!')
def test_shape_attr1(self, file_type): # 文本框字符属性 logging.info('==========test_shape_attr1==========') cv = CreateView(self.driver) cv.create_file(file_type) gv = GeneralView(self.driver) x1, y1 = 0, 0 if file_type == 'ss': ss = SSView(self.driver) x1, y1, w, h = ss.cell_location() self.driver.find_element( By.ID, 'com.yozo.office.en:id/formulabar_ok').click() gv.group_button_click(' Insert ') gv.insert_shape(file_type) time.sleep(1) x, y = gv.find_pic_position('drag_all') gv.tap(x, y) # 进入编辑 gv.pop_menu_click('editText') if file_type == 'ss': gv.fold_expand() gv.fold_expand() x, y = gv.find_pic_position('drag_all') gv.tap(x, y) # 进入编辑 gv.pop_menu_click('editText') for i in range(50): self.driver.press_keycode(random.randint(7, 16)) if file_type == 'pg': gv.tap(250, 250) gv.tap(550, 850) elif file_type == 'ss': gv.tap(x1, y1) gv.tap(x, y) else: gv.tap(250, 450) time.sleep(1) gv.fold_expand() gv.tap(x, y) time.sleep(1) gv.fold_expand() gv.shape_option(file_type, 5, width=5, height=5) gv.shape_option(file_type, 6, top=0.5, bottom=0.5, left=0.5, right=0.5) ele1 = '//*[@text=" Shape "]' ele2 = '//*[@text=" Outline "]' ele3 = '//*[@text=" Effect "]' if file_type == 'pg': ele0 = '//*[@text=" Insert "]' gv.swipe_ele(ele0, ele1) gv.swipe_ele(ele2, ele1) gv.swipe_ele(ele3, ele1) gv.shape_content_align(file_type, '右对齐', '下对齐') gv.shape_content_align(file_type) gv.shape_content_align(file_type, '水平居中', '垂直居中') time.sleep(3)
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)