SVG-Compression Profile balanced ist wesentlich konservativer, Datei-Eigenschaften der neuen PPTX enthält Hinweis auf PPTX Image Compressor in den Kommentaren
This commit is contained in:
+22
-25
@@ -155,15 +155,17 @@ class TestPptxImageCompress(unittest.TestCase):
|
||||
out.write_bytes(b"B" * 50)
|
||||
return out
|
||||
|
||||
result = pic.process_single_deck(
|
||||
input_pptx=input_pptx,
|
||||
output_pptx=output_pptx,
|
||||
threads=2,
|
||||
quality=90,
|
||||
min_savings="2%",
|
||||
compressor=fake_compressor,
|
||||
)
|
||||
with mock.patch("pptx_image_compress.update_core_description", create=True) as mocked_update_core_description:
|
||||
result = pic.process_single_deck(
|
||||
input_pptx=input_pptx,
|
||||
output_pptx=output_pptx,
|
||||
threads=2,
|
||||
quality=90,
|
||||
min_savings="2%",
|
||||
compressor=fake_compressor,
|
||||
)
|
||||
|
||||
mocked_update_core_description.assert_called_once_with(mock.ANY, "PPTX Image Compressor", pic.__version__)
|
||||
self.assertTrue(result.ok)
|
||||
self.assertEqual(result.error, None)
|
||||
self.assertTrue(output_pptx.exists())
|
||||
@@ -222,15 +224,17 @@ class TestPptxImageCompress(unittest.TestCase):
|
||||
out.write_bytes(b"B" * 700000)
|
||||
return out
|
||||
|
||||
result = pic.process_single_deck(
|
||||
input_pptx=input_pptx,
|
||||
output_pptx=output_pptx,
|
||||
threads=1,
|
||||
quality=90,
|
||||
min_savings="2%",
|
||||
compressor=fake_compressor,
|
||||
)
|
||||
with mock.patch("pptx_image_compress.update_core_description", create=True) as mocked_update_core_description:
|
||||
result = pic.process_single_deck(
|
||||
input_pptx=input_pptx,
|
||||
output_pptx=output_pptx,
|
||||
threads=1,
|
||||
quality=90,
|
||||
min_savings="2%",
|
||||
compressor=fake_compressor,
|
||||
)
|
||||
|
||||
mocked_update_core_description.assert_called_once_with(mock.ANY, "PPTX Image Compressor", pic.__version__)
|
||||
self.assertTrue(result.ok)
|
||||
with zipfile.ZipFile(output_pptx, "r") as z:
|
||||
self.assertIn("ppt/media/image1.jpg", z.namelist())
|
||||
@@ -314,13 +318,6 @@ class TestPptxImageCompress(unittest.TestCase):
|
||||
result = pic.optimize_svg_content_with_module(fake_module, svg)
|
||||
|
||||
self.assertEqual(result, "<svg/>")
|
||||
self.assertEqual(captured_options["digits"], 2)
|
||||
self.assertEqual(captured_options["indent_type"], "none")
|
||||
self.assertEqual(captured_options["newlines"], False)
|
||||
self.assertEqual(captured_options["strip_xml_prolog"], True)
|
||||
self.assertEqual(captured_options["strip_comments"], True)
|
||||
self.assertEqual(captured_options["strip_ids"], True)
|
||||
self.assertEqual(captured_options["renderer_workaround"], False)
|
||||
self.assertEqual(fake_module.optimize_path.call_count, 1)
|
||||
|
||||
def test_build_svg_polish_options_balanced_profile(self):
|
||||
@@ -336,8 +333,8 @@ class TestPptxImageCompress(unittest.TestCase):
|
||||
options = pic.build_svg_polish_options(fake_module, pic.SVG_PROFILE_BALANCED)
|
||||
|
||||
self.assertIsNotNone(options)
|
||||
self.assertEqual(captured_options["digits"], 3)
|
||||
self.assertEqual(captured_options["group_collapse"], True)
|
||||
self.assertEqual(captured_options["shorten_ids"], True)
|
||||
self.assertEqual(captured_options["enable_viewboxing"], True)
|
||||
self.assertNotIn("strip_ids", captured_options)
|
||||
|
||||
def test_compress_svg_with_svg_polish_returns_none_when_module_missing(self):
|
||||
|
||||
Reference in New Issue
Block a user