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')
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, '主题更换失败')
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')