feat: compact cover template actions
This commit is contained in:
+12
-3
@@ -697,6 +697,15 @@ class GuiTests(TempDirMixin, unittest.TestCase):
|
||||
self.assertFalse(tab.stop_generate_button.isEnabled())
|
||||
self.assertEqual("进度:标题0/0 · 封面0/0 · 失败0", tab.progress_label.text())
|
||||
self.assertEqual("默认", tab.cover_template_combo.currentText())
|
||||
self.assertEqual("模板操作", tab.cover_template_actions_button.text())
|
||||
self.assertIs(tab.cover_template_actions_menu, tab.cover_template_actions_button.menu())
|
||||
self.assertEqual(
|
||||
["另存为", "重命名", "删除"],
|
||||
[action.text() for action in tab.cover_template_actions_menu.actions()],
|
||||
)
|
||||
self.assertFalse(hasattr(tab, "save_cover_template_as_button"))
|
||||
self.assertFalse(hasattr(tab, "rename_cover_template_button"))
|
||||
self.assertFalse(hasattr(tab, "delete_cover_template_button"))
|
||||
self.assertEqual(["店铺", "商品ID", "旧标题", "新标题", "状态"], tab.model.HEADERS)
|
||||
self.assertEqual("任务 0/0 条", tab.summary_label.text())
|
||||
|
||||
@@ -751,12 +760,12 @@ class GuiTests(TempDirMixin, unittest.TestCase):
|
||||
|
||||
tab.cover_prompt_edit.setPlainText("另存模板 {新标题}")
|
||||
with mock.patch("app.gui.QInputDialog.getText", return_value=("另存", True)):
|
||||
tab.save_cover_template_as()
|
||||
tab.save_cover_template_as_action.trigger()
|
||||
self.assertEqual("另存", tab.cover_template_combo.currentText())
|
||||
self.assertEqual("另存模板 {新标题}", prompts.load_cover_template("另存", cover_prompts_dir))
|
||||
|
||||
with mock.patch("app.gui.QInputDialog.getText", return_value=("改名", True)):
|
||||
tab.rename_cover_template()
|
||||
tab.rename_cover_template_action.trigger()
|
||||
self.assertEqual("改名", tab.cover_template_combo.currentText())
|
||||
self.assertIn("改名", prompts.list_cover_templates(cover_prompts_dir))
|
||||
|
||||
@@ -775,7 +784,7 @@ class GuiTests(TempDirMixin, unittest.TestCase):
|
||||
self.assertTrue(tab.cover_prompt_edit.toPlainText().endswith("{新标题}"))
|
||||
|
||||
with mock.patch("app.gui.QMessageBox.question", return_value=gui.QMessageBox.Yes):
|
||||
tab.delete_cover_template()
|
||||
tab.delete_cover_template_action.trigger()
|
||||
self.assertNotIn("改名", prompts.list_cover_templates(cover_prompts_dir))
|
||||
|
||||
self.assert_removed(temp_dir)
|
||||
|
||||
Reference in New Issue
Block a user