minor: ядро (09) микрооптимизация

This commit is contained in:
2026-09-05 20:38:42 +03:00
parent 6a15f82b2a
commit 29a50b1e93
3 changed files with 51 additions and 32 deletions
+13
View File
@@ -114,6 +114,7 @@ class HalftoneServiceTests(BaseMediaTestCase):
self.assertIn("rotate(12deg)", svg)
self.assertIn("scale(0.92)", svg)
self.assertIn("#ff5500", svg)
self.assertIn(".aH{--d:0s}", svg)
def test_generate_from_bytes(self):
buf = io.BytesIO()
@@ -371,6 +372,18 @@ class SvgAnalysisAndActiveSvgTests(BaseMediaTestCase):
active = prepare_active_svg(gallery_svg)
self.assertNotIn("animation-play-state:paused!important", active)
def test_prepare_active_svg_modern_format(self):
img = Image.new("RGB", (20, 20), color="black")
raw_svg = generate_halftone_svg(img, cols=15, max_radius=6, blink=5)
gallery_svg = prepare_gallery_svg(raw_svg)
self.assertIn("svg{--hypn0-play:paused}", gallery_svg)
self.assertIn("animation-play-state:var(--hypn0-play,paused)!important", gallery_svg)
active = prepare_active_svg(gallery_svg)
self.assertNotIn("svg{--hypn0-play:paused}", active)
self.assertNotIn("animation-play-state:var(--hypn0-play,paused)!important", active)
self.assertIn("animation-play-state:var(--hypn0-play,running)", active)
def test_prepare_active_svg_preserves_color_and_animation(self):
gallery_svg = (
'<svg xmlns="http://www.w3.org/2000/svg">'