opton to skip visual check in cutleft
This commit is contained in:
1 parent
5b7d4b611e
commit
2f8422f6d5
5 files changed
+112
-3
No files matched your search
@@ -4,7 +4,7 @@ import threading
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from queue import Queue
|
||||
from unittest.mock import Mock, patch
|
||||
from unittest.mock import Mock, call, patch
|
||||
|
||||
from PIL import Image
|
||||
|
||||
@@ -157,6 +157,36 @@ class MarkedCopiesTests(unittest.TestCase):
|
||||
self.assertEqual(cutleft.main([str(self.workspace.root), "--marked"]), expected)
|
||||
self.assertEqual(reviewer.call_args.args[0], [self.files[1]])
|
||||
|
||||
def test_fullpage_processes_every_copy_without_opening_the_reviewer(self):
|
||||
for path in self.files:
|
||||
mark_copy_error(self.workspace, path, "Review needed")
|
||||
image = Image.new("RGB", (8, 8), "white")
|
||||
result = (image, [image], {"columns_per_file": [1]})
|
||||
|
||||
with patch.object(
|
||||
cutleft, "process_single_pdf", side_effect=[result, None]
|
||||
) as process, patch.object(cutleft, "save_results") as save, patch.object(
|
||||
cutleft, "ImageReviewer"
|
||||
) as reviewer:
|
||||
status = cutleft.run(
|
||||
self.workspace,
|
||||
self.workspace.root,
|
||||
fullpage=True,
|
||||
no_visual_check=True,
|
||||
)
|
||||
|
||||
self.assertEqual(status, ExitCode.PARTIAL)
|
||||
reviewer.assert_not_called()
|
||||
self.assertEqual(
|
||||
process.call_args_list,
|
||||
[
|
||||
call(self.files[0], max_per_file=1),
|
||||
call(self.files[1], max_per_file=1),
|
||||
],
|
||||
)
|
||||
save.assert_called_once_with(result, self.files[0], self.workspace.cutleft_dir)
|
||||
self.assertEqual(set(copy_errors(self.workspace)), {"Copie02.pdf"})
|
||||
|
||||
|
||||
@unittest.skipUnless(os.environ.get("DISPLAY"), "Tk requires a display")
|
||||
class MarkedCopiesGuiTests(unittest.TestCase):
|
||||
|
||||
Reference in new issue
Block a user