def test_formula(self): logging.info('==========test_formula==========') cv = CreateView(self.driver) cv.create_file('ss', 0) time.sleep(1) for i in range(10): 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)) ss = SSView(self.driver) cv.tap(110 + 263 * 2.5, 295 + 55 * 1.5) # 求和 ss.auto_sum('求和') for i in range(10): time.sleep(1) cv.tap(110 + 263 * 1.5, 295 + 55 * (1.5 + i)) self.driver.find_element(By.ID, 'com.yozo.office:id/formulabar_ok').click() cv.tap(110 + 263 * 2.5, 295 + 55 * 2.5) # 平均值 ss.auto_sum('平均值') for i in range(10): time.sleep(1) cv.tap(110 + 263 * 1.5, 295 + 55 * (1.5 + i)) self.driver.find_element(By.ID, 'com.yozo.office:id/formulabar_ok').click() cv.tap(110 + 263 * 2.5, 295 + 55 * 3.5) # 计数 ss.auto_sum('计数') for i in range(10): time.sleep(1) cv.tap(110 + 263 * 1.5, 295 + 55 * (1.5 + i)) self.driver.find_element(By.ID, 'com.yozo.office:id/formulabar_ok').click() cv.tap(110 + 263 * 2.5, 295 + 55 * 4.5) # 最大值 ss.auto_sum('最大值') for i in range(10): time.sleep(1) cv.tap(110 + 263 * 1.5, 295 + 55 * (1.5 + i)) self.driver.find_element(By.ID, 'com.yozo.office:id/formulabar_ok').click() cv.tap(110 + 263 * 2.5, 295 + 55 * 5.5) # 最小值 ss.auto_sum('最小值') for i in range(10): time.sleep(1) cv.tap(110 + 263 * 1.5, 295 + 55 * (1.5 + i)) self.driver.find_element(By.ID, 'com.yozo.office:id/formulabar_ok').click() time.sleep(3)
def test_ss_formula_auto_sum(self): logging.info('==========test_ss_formula_auto_sum==========') cv = CreateView(self.driver) cv.create_file('ss') ss = SSView(self.driver) x, y, width, height = ss.cell_location() # cell D6 for i in range(5): ss.tap(x + width * 0.5, y + height * (1.5 + i)) ss.tap(x + width * 1.5, y + height * (1.5 + i)) ss.cell_edit() self.driver.press_keycode(random.randint(7, 16)) for i, value in enumerate(AUTO_SUM): ss.tap(x + width * 2.5, y + height * (1.5 + i)) # 求和 ss.auto_sum(AUTO_SUM[i]) for n in range(5): # 依次点击代替拖动 ss.tap(x + width * 1.5, y + height * (1.5 + n)) # ss.drag_coordinate(x + width, y + height * 5, x + width, y + height) self.driver.find_element( By.ID, 'com.yozo.office.en:id/formulabar_ok').click()