Add unit tests for TTML region attrs in style, chained styles UT

This commit is contained in:
Olivier Jouvenaux 2025-01-03 10:54:38 +01:00 committed by Ian Baker
parent 026700a9d9
commit 82bed39140
2 changed files with 8 additions and 0 deletions

View File

@ -1107,6 +1107,11 @@ public final class TtmlParserTest {
assertThat(secondCue.position).isEqualTo(30f / 100f); assertThat(secondCue.position).isEqualTo(30f / 100f);
assertThat(secondCue.line).isEqualTo(30f / 100f); assertThat(secondCue.line).isEqualTo(30f / 100f);
assertThat(secondCue.size).isEqualTo(40f / 100f); assertThat(secondCue.size).isEqualTo(40f / 100f);
Cue thirdCue = Iterables.getOnlyElement(allCues.get(2).cues);
assertThat(thirdCue.position).isEqualTo(30f / 100f);
assertThat(thirdCue.line).isEqualTo(30f / 100f);
assertThat(thirdCue.size).isEqualTo(20f / 100f);
} }
private static Spanned getOnlyCueTextAtIndex(List<CuesWithTiming> allCues, int index) { private static Spanned getOnlyCueTextAtIndex(List<CuesWithTiming> allCues, int index) {

View File

@ -4,16 +4,19 @@
<styling> <styling>
<style xml:id="style1" tts:extent="20% 20%" /> <style xml:id="style1" tts:extent="20% 20%" />
<style xml:id="style2" tts:origin="30% 30%" /> <style xml:id="style2" tts:origin="30% 30%" />
<style xml:id="style3" style="style1 style2" />
</styling> </styling>
<layout> <layout>
<region xml:id="region1" style="style1" tts:origin="10% 10%" /> <region xml:id="region1" style="style1" tts:origin="10% 10%" />
<region xml:id="region2" style="style2" tts:extent="40% 40%" /> <region xml:id="region2" style="style2" tts:extent="40% 40%" />
<region xml:id="region3" style="style3" />
</layout> </layout>
</head> </head>
<body> <body>
<div> <div>
<p begin="2s" end="4s" region="region1">text 1</p> <p begin="2s" end="4s" region="region1">text 1</p>
<p begin="4s" end="6s" region="region2">text 2</p> <p begin="4s" end="6s" region="region2">text 2</p>
<p begin="8s" end="10s" region="region3">text 3</p>
</div> </div>
</body> </body>
</tt> </tt>