Exemple #1
0
 def theme(self):
     top_y = self.BF.keyboard_get_ready('com.qisiemoji.inputmethod/com.android.inputmethod.latin.LatinIME', 'class',
                                        'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     k = keyboard.get_keyboard_picture(0, top_y, keyboard.phone_width, (keyboard.density()['app'] - top_y),
                                       'keyboard')
     keyboard.send_input('system')
     keyboard.main_menu_click('theme')
     keyboard.select_theme(2, 1)
     pic_text = keyboard.get_keyboard_picture(0, top_y, keyboard.phone_width, (keyboard.density()['app'] - top_y),
                                              'keyboard_back')
     pic_text = keyboard.pic_text(pic_text)
     if 'q' in pic_text:
         pass
     else:
         assert 1 + 1 > 2, '没有回到键盘'
     k_s = keyboard.keyboard_same(0, top_y, keyboard.phone_width, (keyboard.density()['app'] - top_y), k)
     self.BF.check_assertFalse(k_s, '主题更换失败')
     # 回选到默认主题
     keyboard.send_input('system')
     keyboard.main_menu_click('theme')
     keyboard.select_theme(1, 2)
     pic_text = keyboard.get_keyboard_picture(0, top_y, keyboard.phone_width, (keyboard.density()['app'] - top_y),
                                              'keyboard_back')
     pic_text = keyboard.pic_text(pic_text)
     if 'q' in pic_text:
         pass
     else:
         assert 1 + 1 > 2, '没有回到键盘'
     k_s = keyboard.keyboard_same(0, top_y, keyboard.phone_width, (keyboard.density()['app'] - top_y), k)
     self.BF.check_assertTrue(k_s, '主题更换失败')
Exemple #2
0
 def chang_theme(self):
     top_y = self.BF.keyboard_get_ready(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     height = (keyboard.phone_height - top_y)
     width = keyboard.phone_width
     load = keyboard.get_keyboard_picture(
         0, top_y, width, height - 40 * int(keyboard.density()['density']),
         'keyboard')
     keyboard.send_input('system')
     keyboard.main_menu_click('theme')
     keyboard.select_theme(1, 2)
     # 判断是否回到了键盘主页
     text = keyboard.word_in_pic(
         0, top_y + int(keyboard.density()['density']) * 40,
         keyboard.phone_width,
         (int(keyboard.density()['app']) - top_y -
          int(keyboard.density()['density']) * 40) / 4, 'q')
     self.BF.check_assertTrue(text, '返回qwerty键盘失败,可能没有选择主题')
     time.sleep(5)
     same = keyboard.keyboard_same(
         0, top_y, width, height - 40 * int(keyboard.density()['density']),
         load)
     self.BF.check_assertFalse(same, '主题风格更换失败')
     self.BF.result_picture('emoji_style')
Exemple #3
0
 def por_input(self):
     top_y = self.M.select_user(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME')
     keyboard = Keyboard_Operation(self.d, top_y)
     # 切换输入法至葡萄牙语
     while True:
         location = keyboard.keyboard_reader(' ')
         orc = keyboard.orc_location(location['x'], location['y'],
                                     location['width'], location['height'])
         print(orc)
         if 'Po' in orc:
             break
         else:
             keyboard.swip_location(location['x'], location['y'],
                                    location['width'], location['height'])
     keyboard.send_input('portug')
     orc_select = keyboard.orc_location(0,
                                        top_y,
                                        keyboard.phone_width,
                                        40 * keyboard.density()['density'],
                                        set_lang='por')
     print(orc_select)
     if 'Português' in orc_select:
         orc_result = True
     else:
         orc_result = False
     self.BF.check_assertTrue(orc_result, '没有纠正')
Exemple #4
0
 def es_input(self):
     top_y = self.M.select_user(
         'com.qisiemoji.inputmethod/com.android.inputmethod.latin.LatinIME')
     keyboard = Keyboard_Operation(self.d, top_y)
     # 切换输入法至西班牙语
     while True:
         location = keyboard.keyboard_reader(' ')
         orc = keyboard.orc_location_text(location['x'], location['y'],
                                          location['width'],
                                          location['height'])
         print(orc)
         if 'Es' in orc:
             break
         else:
             keyboard.swip_location(location['x'], location['y'],
                                    location['width'], location['height'])
     keyboard.send_input('espa')
     orc_select = keyboard.orc_location_text(0,
                                             top_y,
                                             keyboard.phone_width,
                                             40 *
                                             keyboard.density()['density'],
                                             set_lang='epo')
     # print(orc_select)
     if 'Espaĥol' in orc_select:
         orc_result = True
     else:
         orc_result = False
     self.BF.check_assertTrue(orc_result, '没有纠正')
    def old_new_app_theme(self, i, package, Typewriting, old, new):
        if self.device_config == 'none':
            try:
                unin_result = os.popen('adb uninstall %s' % package)
            except Exception as e:
                print(e)
                print('没有对应应用')
        else:
            try:
                unin_result = os.popen('adb -s %s uninstall %s' % (self.device_config, package))
            except Exception as e:
                print(e)
                print('没有对应应用')
        # 安装老应用
        # self.driver.install_app(old)
        o = os.popen('adb install -r %s' % old)
        print(o.read())
        self.BF.keyboard_select(Typewriting)
        self.change_theme(i)
        self.driver.start_activity('yuside.cn.numbersonly', 'yuside.cn.numbersonly.MainActivity')
        # 截图
        top_y = self.BF.keyboard_get_ready(Typewriting, 'class', 'android.widget.ScrollView')
        keyboard = Keyboard_Operation(self.driver, top_y)
        old_keyboard = keyboard.get_keyboard_picture(0, top_y + 40 * keyboard.density()['density'],
                                                     keyboard.phone_width,
                                                     (keyboard.density()['app'] - top_y - 40 * keyboard.density()[
                                                         'density']) * 3 / 4,
                                                     'keyboard_old')
        self.driver.back()
        self.driver.back()
        # 强制安装
        self.BF.adb_install(new, self.device_config)
        # 对比
        # 以防键盘不弹起来
        self.BF.keyboard_select(Typewriting)
        self.driver.start_activity('yuside.cn.numbersonly', 'yuside.cn.numbersonly.MainActivity')
        time.sleep(5)
        top_y = self.BF.keyboard_get_ready(Typewriting, 'class', 'android.widget.ScrollView')

        keyboard = Keyboard_Operation(self.driver, top_y)
        k = keyboard.keyboard_same(0, top_y + 40 * keyboard.density()['density'],
                                   keyboard.phone_width,
                                   (keyboard.density()['app'] - top_y - 40 * keyboard.density()[
                                       'density']) * 3 / 4,
                                   old_keyboard)
        # self.BF.check_assertTrue(k, '第%s个默认主题出现问题' % (no + 1))
        return {'%s' % (i + 1): k}
Exemple #6
0
 def input(self):
     top_y = self.BF.keyboard_get_ready(
         'com.qisiemoji.inputmethod/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     default = keyboard.get_keyboard_picture(
         0, top_y, keyboard.phone_width, 40 * keyboard.density()['density'],
         'indian_default')
     self.BF.click('xpath', '//android.widget.EditText[@index="1"]')
     wrong = []
     with open('./vocab_hinglish', 'r') as word_list:
         for line in word_list:
             print(line)
             print(line.split('\n')[0])
             keyboard.send_input(line.split('\n')[0].lower(), number=True)
             keyboard.send_input(' ', number=True)
             same = keyboard.keyboard_same(0,
                                           top_y,
                                           keyboard.phone_width,
                                           40 *
                                           keyboard.density()['density'],
                                           default,
                                           diff=2)
             print(same)
             key = self.BF.attribute_name(
                 'xpath', '//android.widget.EditText[@index="1"]')
             if line.split('\n')[0] in key:
                 key = True
             else:
                 key = False
             print(key)
             # self.BF.check_find_element('xpath', '//android.widget.EditText[@index="1"]').clear()
             count = 0
             while True:
                 keyboard.send_input('delete')
                 count += 1
                 if count > 8:
                     break
             if key is True and same is False:
                 pass
             else:
                 wrong.append(line.split('\n')[0])
             print(wrong)
     print(wrong)
Exemple #7
0
 def emoji_style_change(self):
     top_y = self.BF.keyboard_get_ready('com.qisiemoji.inputmethod/com.android.inputmethod.latin.LatinIME', 'class',
                                        'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     keyboard.send_input('emoji')
     old_emoji = keyboard.get_keyboard_picture(0, top_y + 40 * keyboard.density()['density'], keyboard.phone_width,
                                               keyboard.density()['app'] - top_y - 80 * keyboard.density()[
                                                   'density'],
                                               'old_emoji')
     self.kika.change_emoji_style(1)
     self.d.start_activity('yuside.cn.numbersonly', 'yuside.cn.numbersonly.MainActivity')
     # 键盘输入检查
     top_y = self.BF.keyboard_get_ready('com.qisiemoji.inputmethod/com.android.inputmethod.latin.LatinIME', 'class',
                                        'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     keyboard.send_input('emoji')
     now_emoji = keyboard.keyboard_same(0, top_y + 40 * keyboard.density()['density'], keyboard.phone_width,
                                        keyboard.density()['app'] - top_y - 80 * keyboard.density()['density'],
                                        old_emoji)
     self.BF.check_assertFalse(now_emoji, 'emoji风格更换失败')
Exemple #8
0
    def download_font(self):
        top_y = self.BF.keyboard_get_ready('com.qisiemoji.inputmethod/com.android.inputmethod.latin.LatinIME', 'class',
                                           'android.widget.ScrollView')
        keyboard = Keyboard_Operation(self.d, top_y)
        old_keyboard = keyboard.get_keyboard_picture(0, top_y + 40 * keyboard.density()['density'],
                                                     keyboard.phone_width,
                                                     (keyboard.density()['app'] - top_y - 40 * keyboard.density()[
                                                         'density']) * 3 / 4,
                                                     'keyboard_old')
        self.kika.random_download_font()
        self.d.start_activity('yuside.cn.numbersonly', 'yuside.cn.numbersonly.MainActivity')
        time.sleep(5)
        top_y = self.BF.keyboard_get_ready('com.qisiemoji.inputmethod/com.android.inputmethod.latin.LatinIME', 'class',
                                           'android.widget.ScrollView')

        keyboard = Keyboard_Operation(self.d, top_y)
        k = keyboard.keyboard_same(0, top_y + 40 * keyboard.density()['density'], keyboard.phone_width,
                                   (keyboard.density()['app'] - top_y - 40 * keyboard.density()['density']) * 3 / 4,
                                   old_keyboard)
        self.BF.check_assertFalse(k, '字体修改失败')
        self.kika.clear_font()
Exemple #9
0
 def emoji_style(self):
     top_y = self.BF.keyboard_get_ready(
         'com.emoji.ikeyboard/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     keyboard.send_input('emoji')
     keyboard.send_input('emoji', keyboard_type='emoji')
     height = (keyboard.phone_height - top_y)
     width = keyboard.phone_width
     load = keyboard.get_keyboard_picture(
         0, top_y, width, height - 40 * int(keyboard.density()['density']),
         'emojy')
     keyboard.send_input('normal_key', keyboard_type='emoji')
     keyboard.send_input('system')
     keyboard.main_menu_click('style')
     keyboard.select_theme(1, 2)
     time.sleep(5)
     keyboard.send_input('emoji')
     same = keyboard.keyboard_same(
         0, top_y, width, height - 40 * int(keyboard.density()['density']),
         load)
     self.BF.check_assertFalse(same, '表情风格更换失败')
     self.BF.result_picture('emoji_style')
Exemple #10
0
 def input_io(self):
     top_y = self.BF.keyboard_get_ready(
         'com.qisiemoji.inputmethod/com.android.inputmethod.latin.LatinIME',
         'class', 'android.widget.ScrollView')
     keyboard = Keyboard_Operation(self.d, top_y)
     # default = keyboard.get_keyboard_picture(0, top_y, keyboard.phone_width, 40 * keyboard.density()['density'],
     #                                         'indian_default')
     self.BF.click('xpath', '//android.widget.EditText[@index="1"]')
     wrong = []
     with open('./hinglish_hindi_pair', 'r') as word_list:
         for line in word_list:
             i = line.split('\t')[0].lower()
             o = line.split('\t')[1].split('\n')[0]
             # i = 'kya'
             # o = 'क्या'
             print(i, o)
             keyboard.send_input(i, number=True)
             # keyboard.send_input(' ', number=True)
             self.d.tap([(keyboard.phone_width / 4,
                          top_y + 20 * keyboard.density()['density'])])
             # same = keyboard.orc_location_text(0, top_y, keyboard.phone_width, 40 * keyboard.density()['density'],
             #                                   set_lang='eng')
             same = self.BF.attribute_name(
                 'xpath', '//android.widget.EditText[@index="1"]')
             print(same)
             if o in same:
                 same = True
             else:
                 same = False
             # print(same)
             # key = self.BF.attribute_name('xpath', '//android.widget.EditText[@index="1"]')
             # if i in key:
             #     key = True
             # else:
             #     key = False
             # print(key)
             # self.BF.check_find_element('xpath', '//android.widget.EditText[@index="1"]').clear()
             count = 0
             while True:
                 keyboard.send_input('delete')
                 count += 1
                 if count > 8:
                     break
             if same is True:
                 pass
             else:
                 wrong.append(line.split('\n')[0])
             print(wrong)
     print(wrong)
Exemple #11
0
    def old_new_app_custom_keyboard(self, package, typewriting, old, new):
        if self.device == 'none':
            try:
                unin_result = os.popen('adb uninstall %s' % package)
            except Exception as e:
                print(e)
                print('没有对应应用')
        else:
            try:
                unin_result = os.popen('adb -s %s uninstall %s' %
                                       (self.device, package))
            except Exception as e:
                print(e)
                print('没有对应应用')
        # 安装老应用
        o = os.popen('adb install -r %s' % old)
        print(o.read())
        self.BF.keyboard_select(typewriting)
        self.custom_keyboard()
        self.driver.tap([(200, 200)])
        self.driver.back()
        self.BF.open_app_atcivity(
            'com.emoji.ikeyboard/com.qisi.ikeyboarduirestruct.NavigationActivity',
            self.device)
        # 截图
        top_y = self.BF.keyboard_get_ready(typewriting, 'class',
                                           'android.widget.ScrollView')
        keyboard = Keyboard_Operation(self.driver, top_y)
        old_keyboard = keyboard.get_keyboard_picture(
            0, top_y + 40 * keyboard.density()['density'],
            keyboard.phone_width, (keyboard.density()['app'] - top_y -
                                   40 * keyboard.density()['density']) * 3 / 4,
            'keyboard_old')
        self.driver.back()
        self.driver.back()
        # 强制安装
        self.BF.adb_install(new, self.device)
        # 对比
        self.BF.keyboard_select(typewriting)
        self.BF.open_app_atcivity(
            'com.emoji.ikeyboard/com.qisi.ikeyboarduirestruct.NavigationActivity',
            self.device)
        time.sleep(5)
        top_y = self.BF.keyboard_get_ready(typewriting, 'class',
                                           'android.widget.ScrollView')

        keyboard = Keyboard_Operation(self.driver, top_y)
        k = keyboard.keyboard_same(
            0, top_y + 40 * keyboard.density()['density'],
            keyboard.phone_width, (keyboard.density()['app'] - top_y -
                                   40 * keyboard.density()['density']) * 3 / 4,
            old_keyboard)
        self.BF.check_assertTrue(k, '自定义主题消失了')
    def old_new_app_theme(self, i, package, typewriting, old, new):
        if self.device == 'none':
            try:
                unin_result = os.popen('adb uninstall %s' % package)
            except Exception as e:
                print(e)
                print('没有对应应用')
        else:
            try:
                unin_result = os.popen('adb -s %s uninstall %s' %
                                       (self.device, package))
            except Exception as e:
                print(e)
                print('没有对应应用')
        # 安装老应用
        # self.driver.install_app(old)
        o = os.popen('adb install -r %s' % old)
        print(o.read())
        self.BF.keyboard_select(typewriting)
        self.change_theme(i)
        self.BF.open_app_atcivity(
            'com.qisiemoji.inputmethod/com.qisi.ikeyboarduirestruct.NavigationActivity',
            self.device)
        top_y = self.BF.keyboard_get_ready(typewriting, 'class',
                                           'android.widget.ScrollView')
        keyboard = Keyboard_Operation(self.driver, top_y)
        old_keyboard = keyboard.get_keyboard_picture(
            0, top_y + 40 * keyboard.density()['density'],
            keyboard.phone_width, (keyboard.density()['app'] - top_y -
                                   40 * keyboard.density()['density']) * 3 / 4,
            'keyboard_old')
        self.driver.back()
        self.driver.back()
        # 强制安装
        self.BF.adb_install(new, self.device)
        # 对比
        # 以防键盘不弹起来
        self.BF.keyboard_select(typewriting)
        self.BF.open_app_atcivity(
            'com.qisiemoji.inputmethod/com.qisi.ikeyboarduirestruct.NavigationActivity',
            self.device)
        time.sleep(5)
        top_y = self.BF.keyboard_get_ready(typewriting, 'class',
                                           'android.widget.ScrollView')

        keyboard = Keyboard_Operation(self.driver, top_y)
        k = keyboard.keyboard_same(
            0, top_y + 40 * keyboard.density()['density'],
            keyboard.phone_width, (keyboard.density()['app'] - top_y -
                                   40 * keyboard.density()['density']) * 3 / 4,
            old_keyboard)
        # self.BF.check_assertTrue(k, '第%s个默认主题出现问题' % (no + 1))
        return {'%s' % (i + 1): k}