Exemplo n.º 1
0
    def test_formula1(self):  # 其他类型公式
        logging.info('==========test_formula1==========')
        cv = CreateView(self.driver)
        ss = SSView(self.driver)
        cv.create_file('ss')
        time.sleep(1)

        x, y, width, height = ss.cell_location()  # cell B8
        for i in range(6):
            ss.tap(x + width * 1.5, y + height * (1.5 + i))
            ss.tap(x + width * 0.5, y + height * (1.5 + i))
            ss.cell_edit()
            self.driver.press_keycode(random.randint(7, 16))

        formula_dic = {
            ' Recently Used ': 'MAX',
            ' Math and Trig ': 'GCD',
            ' Financial ': 'DOLLARDE',
            ' Logical ': 'AND',
            ' Text ': 'CONCATENATE',
            ' Date and Time ': 'DATE',
            ' Lookup and Reference ': 'CHOOSE',
            ' Statistical ': 'AVERAGE',
            ' Engineering ': 'IMPRODUCT',
            ' Database ': 'GETPIVOTDATA',
            ' Information ': 'ISBLANK',
            ' ALL ': 'MAX'
        }

        keys_list = [
            ' Recently Used ', ' Math and Trig ', ' Financial ', ' Logical ',
            ' Text ', ' Date and Time ', ' Lookup and Reference ',
            ' Statistical ', ' Engineering ', ' Database ', ' Information ',
            ' All '
        ]
        for i in keys_list:
            if keys_list.index(i) > 5:
                ss.tap(x + width * 2.5,
                       y + height * (1.5 + keys_list.index(i) - 5))
            else:
                ss.tap(x + width * 1.5,
                       y + height * (1.5 + keys_list.index(i)))
            ss.formula_all(i, formula_dic.get(i))
            print(i, formula_dic.get(i))
            # cv.tap(110 + 263 * 1.5, 295 + 55 * 1.5)
            if i == ' Database ' or i == ' Date and Time ':
                m = 3
            elif i == ' Information ':
                m = 1
            else:
                m = 6
            for n in range(m):
                ss.tap(x + width * 0.5, y + height * (1.5 + n))
            self.driver.find_element(
                By.ID, 'com.yozo.office.en:id/formulabar_ok').click()
Exemplo n.º 2
0
    def test_formula1(self):  # 其他类型公式
        logging.info('==========test_formula1==========')
        cv = CreateView(self.driver)
        cv.create_file('ss')
        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 * 0.5)
        ss.formula_all('最近使用', 'MAX')
        cv.tap(110 + 263 * 1.5, 295 + 55 * 1.5)
        self.driver.find_element(By.ID, 'com.yozo.office:id/formulabar_ok').click()

        cv.tap(110 + 263 * 2.5, 295 + 55 * 1.5)
        ss.formula_all('数学和三角', 'ABS')
        cv.tap(110 + 263 * 1.5, 295 + 55 * 1.5)
        self.driver.find_element(By.ID, 'com.yozo.office:id/formulabar_ok').click()

        cv.tap(110 + 263 * 2.5, 295 + 55 * 2.5)
        ss.formula_all('财务', 'DOLLARDE')
        cv.tap(110 + 263 * 1.5, 295 + 55 * 1.5)
        time.sleep(0.5)
        cv.tap(110 + 263 * 1.5, 295 + 55 * 5.5)
        self.driver.find_element(By.ID, 'com.yozo.office:id/formulabar_ok').click()

        cv.tap(110 + 263 * 2.5, 295 + 55 * 3.5)
        ss.formula_all('逻辑', 'AND')
        cv.tap(110 + 263 * 1.5, 295 + 55 * 1.5)
        time.sleep(0.5)
        cv.tap(110 + 263 * 1.5, 295 + 55 * 5.5)
        self.driver.find_element(By.ID, 'com.yozo.office:id/formulabar_ok').click()

        cv.tap(110 + 263 * 2.5, 295 + 55 * 4.5)
        ss.formula_all('文本', 'ASC')
        cv.tap(110 + 263 * 1.5, 295 + 55 * 1.5)
        self.driver.find_element(By.ID, 'com.yozo.office:id/formulabar_ok').click()

        cv.tap(110 + 263 * 2.5, 295 + 55 * 5.5)
        ss.formula_all('日期和时间', 'NOW')
        self.driver.find_element(By.ID, 'com.yozo.office:id/formulabar_ok').click()

        cv.tap(110 + 263 * 2.5, 295 + 55 * 6.5)
        ss.formula_all('查找与引用', 'COLUMN')
        cv.tap(110 + 263 * 1.5, 295 + 55 * 1.5)
        self.driver.find_element(By.ID, 'com.yozo.office:id/formulabar_ok').click()

        cv.tap(110 + 263 * 2.5, 295 + 55 * 7.5)
        ss.formula_all('统计', 'AVERAGE')
        cv.tap(110 + 263 * 1.5, 295 + 55 * 1.5)
        self.driver.find_element(By.ID, 'com.yozo.office:id/formulabar_ok').click()

        # cv.tap(110 + 263 * 2.5, 295 + 55 * 8.5)
        # ss.formula_all('工程', 'DEC2BIN')
        # cv.tap(110 + 263 * 1.5, 295 + 55 * 1.5)
        # self.driver.find_element(By.ID, 'com.yozo.office:id/formulabar_ok').click()

        cv.tap(110 + 263 * 2.5, 295 + 55 * 9.5)
        ss.formula_all('信息', 'ISBLANK')
        cv.tap(110 + 263 * 1.5, 295 + 55 * 1.5)
        self.driver.find_element(By.ID, 'com.yozo.office:id/formulabar_ok').click()

        cv.tap(110 + 263 * 2.5, 295 + 55 * 10.5)
        ss.formula_all('所有公式', 'ABS')
        cv.tap(110 + 263 * 1.5, 295 + 55 * 1.5)
        self.driver.find_element(By.ID, 'com.yozo.office:id/formulabar_ok').click()