def test_wp_font_attr(self): logging.info('==========test_wp_font_attr===========') cv = CreateView(self.driver) cv.create_file(self.file_type) time.sleep(1) wp = WPView(self.driver) wp.group_button_click(' Edit ') wp.font_size(16) wp.font_style(self.file_type, '倾斜') wp.font_color(self.file_type, 3) ele1 = '//*[@text=" Edit "]' ele2 = '//*[@text=" Font Color "]' ele3 = '//*[@text=" Highlight Color "]' ele4 = '//*[@text=" Columns "]' wp.swipe_ele(ele2, ele1) time.sleep(1) wp.tap(450, 450) for i in range(100): self.driver.press_keycode(random.randint(29, 54)) wp.group_button_click(' Edit ') wp.drag_coordinate(450, 500, 200, 500) wp.high_light_color(self.file_type, 3) wp.bullets_numbers(self.file_type, 6, 14) wp.text_align(self.file_type, '右对齐') wp.swipe_ele(ele3, ele1) wp.text_line_space(self.file_type, 2.5) wp.text_indent(self.file_type, '右缩进') wp.swipe_ele(ele4, ele1) wp.text_columns(4) wp.text_columns(3) wp.text_columns(2) time.sleep(3)
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_check_approve(self): # 修订 logging.info('==========test_wp_check_approve==========') cv = CreateView(self.driver) cv.create_file(self.file_type) wp = WPView(self.driver) wp.group_button_click(' Review ') wp.change_name('super_root') wp.group_button_click(' Review ') wp.revision_on_off('ON') wp.tap(450, 550) for i in range(20): self.driver.press_keycode(random.randint(29, 54)) wp.group_button_click(' Review ') wp.revision_accept_not('yes') wp.tap(450, 550) for i in range(20): self.driver.press_keycode(random.randint(29, 54)) wp.group_button_click(' Review ') wp.revision_accept_not() wp.group_button_click(' Review ') wp.revision_on_off('OFF') time.sleep(3)