diff --git a/case/test_dde_1271211.py b/case/test_dde_1271211.py new file mode 100644 index 0000000000000000000000000000000000000000..5a39445808d9294ffdd34a4fbc7bcfdcae6712cc --- /dev/null +++ b/case/test_dde_1271211.py @@ -0,0 +1,37 @@ +from apps.dde_autotest_euler.case.base_case import BaseCase +from apps.dde_autotest_euler.method.dde_method import DdeMethod +from apps.dde_autotest_euler.method.vender.deepin_font_manager_method import DeepinFontManagerMethod +from apps.dde_autotest_euler.method.vender.dde_file_manager_method import DdeFileManagerMethod +from src import sleep + + +class TestFontAddCase(BaseCase): + + def test_dde_1271211_1(self): + """字体管理器-导入一个字体""" + DdeMethod().open_software_by_launcher("zitiguanli") + sleep(6) + DeepinFontManagerMethod().method_click_menu() + DeepinFontManagerMethod().method_click_add_font() + DeepinFontManagerMethod().method_search_fonts("dde_autotest_euler/method/static_res/fonts/fangzheng") + DeepinFontManagerMethod().method_import_one_fonts() + self.assert_ocr_exist("吕建德字体") + DeepinFontManagerMethod().method_del_font() + sleep(3) + + def test_dde_1271211_2(self): + """字体管理器-导入多个字体""" + DdeMethod().open_software_by_launcher("zitiguanli") + sleep(6) + DeepinFontManagerMethod().method_click_menu() + DeepinFontManagerMethod().method_click_add_font() + DeepinFontManagerMethod().method_search_fonts("dde_autotest_euler/method/static_res/fonts/fangzheng") + DeepinFontManagerMethod().method_import_many_fonts() + self.assert_ocr_exist("吕建德字体") + self.assert_ocr_exist("真广标简体") + DeepinFontManagerMethod().method_del_font() + sleep(2) + + def teardown_method(self): + """关闭字体管理器""" + DdeMethod().kill_process("deepin-font-manager") diff --git a/case/test_dde_1271229.py b/case/test_dde_1271229.py index 539a6cdeb40fb8bba963c8c218f736eb41f3b5f7..777764a03e50d27e9711d0446aeb3af88ed8d609 100644 --- a/case/test_dde_1271229.py +++ b/case/test_dde_1271229.py @@ -24,8 +24,6 @@ class TestDdeCase(BaseCase): process_num = Src.get_daemon_process_num("fcitx-config-gtk3") self.assert_equal(0, process_num) - - - # def teardown_method(self): - # """通过命令关闭日志收集工具""" - # DdeMethod().kill_process("fcitx-config-gtk3") + def teardown_method(self): + """通过命令关闭日志收集工具""" + DdeMethod().kill_process("fcitx-config-gtk3") diff --git a/dde.csv b/dde.csv index bb5aa3b6f813cd86a77d22c25adbb29585d6ce6c..bf16d77ec7bf984fc4bef8e9f233c850d8239c5f 100644 --- a/dde.csv +++ b/dde.csv @@ -56,3 +56,4 @@ 1271251,,, 1271229,,, 1271217,,, +1271211,,, diff --git a/method/image_res/dde_fonts_delete_btn_icon.png b/method/image_res/dde_fonts_delete_btn_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..8812c8a5c2670e6b1caa54739cf2838b363dda76 Binary files /dev/null and b/method/image_res/dde_fonts_delete_btn_icon.png differ diff --git a/method/image_res/dde_fonts_menu_icon.png b/method/image_res/dde_fonts_menu_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..4f7e60b423e53c5593f7e78bf511a073b0ecaf07 Binary files /dev/null and b/method/image_res/dde_fonts_menu_icon.png differ diff --git a/method/image_res/dde_fonts_search_icon.png b/method/image_res/dde_fonts_search_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cd6d20adce943c01bdb693ad55ce6b246abd295c Binary files /dev/null and b/method/image_res/dde_fonts_search_icon.png differ diff --git a/method/static_res/fonts/NotoSansLinearB-Regular.ttf b/method/static_res/fonts/NotoSansLinearB-Regular.ttf new file mode 100644 index 0000000000000000000000000000000000000000..00b3f08bea8a1b81c560011a2f9cb5a167ce32af Binary files /dev/null and b/method/static_res/fonts/NotoSansLinearB-Regular.ttf differ diff --git a/method/static_res/fonts/fangzhenghanzhenguangbiao.ttf b/method/static_res/fonts/fangzhenghanzhenguangbiao.ttf new file mode 100644 index 0000000000000000000000000000000000000000..505964d939f51cf3b23e797a05e1322b2551d754 Binary files /dev/null and b/method/static_res/fonts/fangzhenghanzhenguangbiao.ttf differ diff --git a/method/static_res/fonts/fangzhenglvjiandexingkai.ttf b/method/static_res/fonts/fangzhenglvjiandexingkai.ttf new file mode 100644 index 0000000000000000000000000000000000000000..ce75d087a865a71318bd128a0fc607a50824e7df Binary files /dev/null and b/method/static_res/fonts/fangzhenglvjiandexingkai.ttf differ diff --git a/method/vender/deepin_font_manager_method.py b/method/vender/deepin_font_manager_method.py index 5244e74319967f36476cbaf572eb10bef1593222..2b47f5c938aeaa5858626d8255fa1b46386a7fcb 100644 --- a/method/vender/deepin_font_manager_method.py +++ b/method/vender/deepin_font_manager_method.py @@ -1,4 +1,5 @@ from apps.dde_autotest_euler.method.base_method import BaseMethod +from src import Src, sleep class DeepinFontManagerMethod(BaseMethod): @@ -13,3 +14,48 @@ class DeepinFontManagerMethod(BaseMethod): def method_click_search_box_attr(self): """在字体管理器中点击搜索框""" self.method_click_by_attr("DSearchEditIconButton") + + def method_click_menu(self): + """字体管理其中点击菜单""" + self.click_by_img("dde_fonts_menu_icon.png") + # self.method_click_by_attr("添加字体") + + def method_click_add_font(self): + """菜单添加字体""" + self.click(*self.ocr("添加字体")) + + def method_search_fonts(self, fonts_path): + """字体文件路径查找字体""" + self.click_by_img("dde_fonts_search_icon.png") + Src.input_message(fonts_path) + sleep(6) + Src.enter() + sleep(2) + + def method_import_one_fonts(self): + """选择一个字体添加""" + self.click_by_ocr("fangzhenglvjiandexingkai") + self.click(*self.ocr("打开")) + + def method_import_many_fonts(self): + """添加多个字体""" + self.click_by_ocr("fangzhenglvjiandexingkai") + Src.ctrl_a() + self.click(*self.ocr("打开")) + + def search_font_in_font_manager(self, font_name): + """在字体管理器中搜索字体""" + self.deepin_font_manager.method_click_search_box_attr() + self.input_message(font_name) + sleep(3) + self.enter() + + def method_del_font(self, font_name=None): + """删除字体""" + if font_name: + self.search_font_in_font_manager(font_name) + self.click_by_ocr(font_name) + Src.delete() + self.click_by_img("dde_fonts_delete_btn_icon.png") + +