File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -199,12 +199,17 @@ def _region_always_has_background(region: typing.Type[model.Region]) -> bool:
199199 return False
200200
201201 bg_color : styles .ColorType = region .get_style (styles .StyleProperties .BackgroundColor )
202+ if bg_color is None :
203+ bg_color = region .get_doc ().get_initial_value (styles .StyleProperties .BackgroundColor );
202204 if bg_color is not None :
203205 if bg_color .ident is not styles .ColorType .Colorimetry .RGBA8 :
204206 raise RuntimeError (f"Unsupported colorimetry system: { bg_color .ident } " )
205207
206208 if bg_color .components [3 ] == 0 :
207209 return False
210+ else :
211+ # no background color specified, so transparent
212+ return False
208213
209214 return True
210215
Original file line number Diff line number Diff line change 2727
2828# pylint: disable=R0201,C0115,C0116
2929
30+ from fractions import Fraction
3031import unittest
3132from ttconv .isd import ISD
3233import ttconv .model as model
3738
3839class ISDCacheTests (unittest .TestCase ):
3940
41+ def test_large_number_of_regions (self ):
42+ doc = model .ContentDocument ()
43+ body = model .Body (doc )
44+ doc .set_body (body )
45+
46+ for i in range (1000 ):
47+ r_id = "r" + str (i )
48+ r = model .Region (r_id , doc )
49+ doc .put_region (r )
50+
51+ div = model .Div (doc )
52+ div .set_region (r )
53+ body .push_child (div )
54+
55+ p = model .P (doc )
56+ p .set_begin (Fraction (2 * i ))
57+ p .set_end (Fraction (2 * i + 1 ))
58+ div .push_child (p )
59+
60+ span = model .Span (doc )
61+ span .push_child (model .Text (doc , f"div { i } content" ))
62+ p .push_child (span )
63+
64+ sig_times = ISD .significant_times (doc )
65+
66+ for t in sig_times :
67+ ISD .from_model (doc , t , sig_times )
68+
4069 def test_show_background (self ):
4170 ttml_doc = """<tt xml:lang="en"
4271 xmlns="http://www.w3.org/ns/ttml"
You can’t perform that action at this time.
0 commit comments