améliorations diverses

This commit is contained in:
2026-09-17 22:19:05 +02:00
parent 5b8215e7f5
commit 0a453403cf
11 changed files with 1072 additions and 81 deletions
+69
View File
@@ -85,6 +85,53 @@ class GuiConvenienceTests(unittest.TestCase):
self.app.manual_panel.editor_button.invoke()
opened.assert_called_once_with(other_manual)
def test_successful_manual_resolution_returns_to_refaire_correction(self):
manual = self.evaluation / "manual_resolutions.txt"
manual.write_text("Copie01 A -> B|\n", encoding="utf-8")
self.app.state_store.update_step("manual_resolution", visited=True)
self.app.tree.selection_set("manual_resolution")
self.app.update()
self.app.active_step_id = "manual_resolution"
self.app._finish_process(0, False)
self.app.update()
self.assertEqual(self.app.current_step.id, "correction")
self.assertEqual(self.app.variant_var.get(), "refaire")
self.assertEqual(
self.app.state_store.step("correction")["variant"], "refaire"
)
self.assertNotIn("overwrite", self.app.arg_vars)
self.assertIn("--refaire", self.app._make_command())
def test_giving_names_waits_for_explicit_manual_completion(self):
return_dir = self.evaluation / "A Rendre" / "Student (01)"
return_dir.mkdir(parents=True)
(return_dir / "Student.jpg").write_bytes(b"jpg")
(return_dir / "Student.pdf").write_bytes(b"pdf")
self.app.tree.selection_set("giving_names")
self.app.update()
self.app.active_step_id = "giving_names"
self.app._finish_process(0, False)
self.app.update()
self.assertEqual(self.app.current_step.id, "giving_names")
self.assertEqual(
self.app.state_store.step("giving_names")["status"], "detected"
)
self.assertEqual(
self.app.complete_giving_names_button.cget("text"),
"Marquer terminée",
)
self.app.complete_giving_names_button.invoke()
self.app.update()
self.assertEqual(
self.app.state_store.step("giving_names")["status"], "success"
)
self.assertNotEqual(self.app.current_step.id, "giving_names")
def test_batch_status_waits_until_all_jobs_are_ready(self):
self.app.state_store.update_step("correction", variant="batch")
self.app.state_store.update_step("batch_status", visited=True)
@@ -213,6 +260,28 @@ class GuiConvenienceTests(unittest.TestCase):
self.assertIn("Cibler la copie sélectionnée", controls)
self.assertIn("Cibler tout le dossier", controls)
def test_label_review_can_show_and_target_one_copy(self):
copies = self.evaluation / "Copies"
copies.mkdir()
for name in ("Copie01.pdf", "Copie02.pdf"):
(copies / name).touch()
self.app.tree.selection_set("plotting")
self.app.update()
self.app.copy_var.set("Copie02.pdf")
with patch("copienator_gui.app.open_path") as opened:
self.app._open_selected_copy()
opened.assert_called_once_with(copies / "Copie02.pdf")
self.app._target_selected_copy()
command = self.app._make_command()
self.assertEqual(Path(command[-1]), copies / "Copie02.pdf")
labels = self._label_texts(self.app.form)
self.assertTrue(
any("Seule la copie ciblée sera vérifiée" in text for text in labels)
)
def test_free_form_arguments_are_shown_only_when_documented(self):
self.app.tree.selection_set("labels")
self.app.update()