feat(ai): mark cover reset history in generate table
This commit is contained in:
@@ -384,6 +384,58 @@ class GuiTests(TempDirMixin, unittest.TestCase):
|
||||
apply_model.data(apply_model.index(0, 5), gui.Qt.ToolTipRole),
|
||||
)
|
||||
|
||||
def test_generate_table_marks_cover_reset_history_on_item_id_column(self):
|
||||
account = SimpleNamespace(alias="papa", account_name="papa 店铺")
|
||||
reset_task = SimpleNamespace(
|
||||
alias="papa",
|
||||
account_name="papa 店铺",
|
||||
item_id="26887160467",
|
||||
old_title="旧标题",
|
||||
new_title="新标题",
|
||||
new_cover_path="new.jpg",
|
||||
stage="generated",
|
||||
status="success",
|
||||
last_error="",
|
||||
collect_attempts=1,
|
||||
generate_attempts=1,
|
||||
apply_attempts=0,
|
||||
committed=0,
|
||||
cover_reset_count=2,
|
||||
cover_reset_at="2026-07-11T10:00:00",
|
||||
)
|
||||
normal_task = SimpleNamespace(
|
||||
alias="papa",
|
||||
account_name="papa 店铺",
|
||||
item_id="28431952912",
|
||||
old_title="旧标题",
|
||||
new_title="新标题",
|
||||
new_cover_path="new.jpg",
|
||||
stage="generated",
|
||||
status="success",
|
||||
last_error="",
|
||||
collect_attempts=1,
|
||||
generate_attempts=1,
|
||||
apply_attempts=0,
|
||||
committed=0,
|
||||
cover_reset_count=0,
|
||||
cover_reset_at=None,
|
||||
)
|
||||
model = gui.GenerateTaskTableModel()
|
||||
model.set_tasks([reset_task, normal_task], [account])
|
||||
|
||||
self.assert_foreground(model, 0, 1, gui.COLOR_WARNING)
|
||||
self.assertIsNone(model.data(model.index(1, 1), gui.Qt.ForegroundRole))
|
||||
self.assertIn(
|
||||
"该商品封面已重置 2 次",
|
||||
model.data(model.index(0, 1), gui.Qt.ToolTipRole),
|
||||
)
|
||||
self.assertIn(
|
||||
"双击可查看封面画廊",
|
||||
model.data(model.index(0, 1), gui.Qt.ToolTipRole),
|
||||
)
|
||||
self.assert_foreground(model, 0, 4, gui.COLOR_SUCCESS)
|
||||
self.assert_foreground(model, 0, 5, gui.COLOR_SUCCESS)
|
||||
|
||||
def test_main_window_has_five_tabs_in_workflow_order(self):
|
||||
with self.make_temp_dir() as temp_dir:
|
||||
window = MainWindow(config=self.make_config(temp_dir))
|
||||
|
||||
Reference in New Issue
Block a user