miscs (Interro02) : horizontal cutting resolution

This commit is contained in:
2026-09-14 22:20:46 +02:00
parent 5080274e8f
commit 0a86403ca6
28 changed files with 1447 additions and 59 deletions
+60
View File
@@ -68,6 +68,66 @@ class GuiConvenienceTests(unittest.TestCase):
self.app.open_evaluation_button.invoke()
opened.assert_called_once_with(self.evaluation)
def test_manual_resolution_panel_follows_command_target(self):
manual = self.evaluation / "manual_resolutions.txt"
manual.write_text("Copie01 A -> B|\n", encoding="utf-8")
self.app.tree.selection_set("manual_resolution")
self.app.update()
self.assertEqual(len(self.app.manual_panel.pdf_buttons), 2)
other = self.repository / "Other"
other.mkdir()
other_manual = other / "manual_resolutions.txt"
other_manual.write_text("Copie02 C xs D\n", encoding="utf-8")
self.app.arg_vars["target"].set(str(other))
self.app.update()
self.assertIn("Copie02", self.app.manual_panel.text.get("1.0", "end"))
with patch("copienator_gui.manual_resolution.open_path") as opened:
self.app.manual_panel.editor_button.invoke()
opened.assert_called_once_with(other_manual)
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)
self.app.tree.selection_set("batch_status")
self.app.update()
command = self.app._make_command()
self.assertIn("--evaluation", command)
self.assertFalse(self.app.arg_vars)
self.app.active_step_id = "batch_status"
self.app._finish_process(4, False)
self.app.update()
self.assertEqual(self.app.current_step.id, "batch_status")
self.app.active_step_id = "batch_status"
self.app._finish_process(0, False)
self.app.update()
self.assertEqual(self.app.current_step.id, "fetch_batches")
def test_batch_watch_buttons_use_loaded_evaluation_and_stop_on_reload(self):
self.app.state_store.update_step("correction", variant="batch")
self.app.tree.selection_set("batch_status")
self.app.update()
with patch.object(self.app.batch_monitor, "start") as start:
self.app.watch_batches_button.invoke()
self.assertEqual(start.call_args.args[0][-2:], ["--evaluation", str(self.evaluation)])
self.app.batch_monitor.active = True
self.app._update_controls()
self.assertEqual(str(self.app.stop_watch_batches_button.cget("state")), "normal")
self.app.stop_watch_batches_button.invoke()
self.assertFalse(self.app.batch_monitor.active)
self.app.batch_monitor.active = True
self.app._load_evaluation()
self.assertFalse(self.app.batch_monitor.active)
def test_background_batch_readiness_notifies_without_changing_other_step(self):
self.app.tree.selection_set("inputs")
self.app.update()
with patch("copienator_gui.app.notify_desktop") as notify:
self.app._batch_results_ready()
notify.assert_called_once()
self.assertIn(self.evaluation.name, notify.call_args.args[1])
self.assertEqual(self.app.current_step.id, "inputs")
self.assertEqual(self.app.state_store.step("batch_status")["status"], "success")
def test_optional_blank_crop_can_target_a_copy_or_be_skipped(self):
copies = self.evaluation/"Copies"
copies.mkdir()