Skip to content

Commit 5bb7b65

Browse files
authored
Fix broken tts:textShadow unit tests
1 parent 99b9779 commit 5bb7b65

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

src/test/python/test_imsc11text_filter.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -216,19 +216,18 @@ def test_line_padding_c_passes(self):
216216
def test_text_shadow_5_shadows_raises(self):
217217
doc = _make_simple_doc()
218218
body = doc.get_body()
219-
for element in body.dfs_iterator():
220-
if isinstance(element, model.Span):
221-
shadow = styles.TextShadowType.Shadow(
222-
x_offset=styles.LengthType(1, styles.LengthType.Units.pct),
223-
y_offset=styles.LengthType(1, styles.LengthType.Units.pct),
224-
)
225-
element.set_style(
226-
styles.StyleProperties.TextShadow,
227-
styles.TextShadowType(shadows=(shadow, shadow, shadow, shadow, shadow)),
228-
)
229-
230219
with self.assertRaises(ValueError):
231-
IMSC11TextFilter().process(doc)
220+
for element in body.dfs_iterator():
221+
if isinstance(element, model.Span):
222+
shadow = styles.TextShadowType.Shadow(
223+
x_offset=styles.LengthType(1, styles.LengthType.Units.pct),
224+
y_offset=styles.LengthType(1, styles.LengthType.Units.pct),
225+
)
226+
element.set_style(
227+
styles.StyleProperties.TextShadow,
228+
styles.TextShadowType(shadows=(shadow, shadow, shadow, shadow, shadow)),
229+
)
230+
IMSC11TextFilter().process(doc)
232231

233232
def test_text_shadow_4_shadows_passes(self):
234233
doc = _make_simple_doc()

src/test/python/test_model_style_properties.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
import unittest
3131
from ttconv import model
32-
from ttconv.style_properties import ExtentType, LengthType, StyleProperties
32+
from ttconv.style_properties import ExtentType, LengthType, StyleProperties, TextShadowType
3333

3434
class TestModelStyleProperties(unittest.TestCase):
3535

@@ -38,6 +38,18 @@ def test_make_initial(self):
3838
with self.subTest(style.__name__):
3939
style.validate(style.make_initial_value())
4040

41+
def test_text_shadow_5_shadows_raises(self):
42+
span = model.Span()
43+
with self.assertRaises(ValueError):
44+
shadow = TextShadowType.Shadow(
45+
x_offset=LengthType(1, LengthType.Units.pct),
46+
y_offset=LengthType(1, LengthType.Units.pct),
47+
)
48+
span.set_style(
49+
StyleProperties.TextShadow,
50+
TextShadowType(shadows=(shadow, shadow, shadow, shadow, shadow)),
51+
)
52+
4153
def test_extent_c_fail(self):
4254
doc = model.ContentDocument()
4355

0 commit comments

Comments
 (0)