-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Issues-116 support options for WriteToTTML #117
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<tt xmlns="http://www.w3.org/ns/ttml" xml:lang="fr" xmlns:ttm="http://www.w3.org/ns/ttml#metadata" xmlns:tts="http://www.w3.org/ns/ttml#styling"><head><metadata><ttm:copyright>Copyright test</ttm:copyright><ttm:title>Title test</ttm:title></metadata><styling><style xml:id="style_0" style="style_2" tts:color="white" tts:extent="100% 10%" tts:fontFamily="sansSerif" tts:fontStyle="normal" tts:origin="0% 90%" tts:textAlign="center"></style><style xml:id="style_1" tts:color="white" tts:extent="100% 13%" tts:fontFamily="sansSerif" tts:fontStyle="normal" tts:origin="0% 87%" tts:textAlign="center"></style><style xml:id="style_2" tts:color="white" tts:extent="100% 20%" tts:fontFamily="sansSerif" tts:fontStyle="normal" tts:origin="0% 80%" tts:textAlign="center"></style></styling><layout><region xml:id="region_0" style="style_0" tts:color="blue"></region><region xml:id="region_1" style="style_1"></region><region xml:id="region_2" style="style_2"></region></layout></head><body><div><p begin="00:01:39.000" end="00:01:41.040" region="region_1" style="style_1" tts:color="red"><span style="style_1" tts:color="black">(deep rumbling)</span></p><p begin="00:02:04.080" end="00:02:07.120" region="region_2"><span>MAN:</span><br></br><span>How did we </span><span style="style_1" tts:color="green">end up </span><span>here?</span></p><p begin="00:02:12.160" end="00:02:15.200" region="region_1"><span style="style_1">This place is horrible.</span></p><p begin="00:02:20.240" end="00:02:22.280" region="region_1"><span style="style_1">Smells like balls.</span></p><p begin="00:02:28.320" end="00:02:31.360" region="region_2"><span style="style_2">We don't belong</span><br></br><span style="style_1">in this shithole.</span></p><p begin="00:02:31.400" end="00:02:33.440" region="region_2"><span style="style_2">(computer playing</span><br></br><span style="style_1">electronic melody)</span></p></div></body></tt> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<tt xmlns="http://www.w3.org/ns/ttml" xml:lang="fr" xmlns:ttm="http://www.w3.org/ns/ttml#metadata" xmlns:tts="http://www.w3.org/ns/ttml#styling"><head><metadata><ttm:copyright>Copyright test</ttm:copyright><ttm:title>Title test</ttm:title></metadata><styling><style xml:id="style_0" style="style_2" tts:color="white" tts:extent="100% 10%" tts:fontFamily="sansSerif" tts:fontStyle="normal" tts:origin="0% 90%" tts:textAlign="center"></style><style xml:id="style_1" tts:color="white" tts:extent="100% 13%" tts:fontFamily="sansSerif" tts:fontStyle="normal" tts:origin="0% 87%" tts:textAlign="center"></style><style xml:id="style_2" tts:color="white" tts:extent="100% 20%" tts:fontFamily="sansSerif" tts:fontStyle="normal" tts:origin="0% 80%" tts:textAlign="center"></style></styling><layout><region xml:id="region_0" style="style_0" tts:color="blue"></region><region xml:id="region_1" style="style_1"></region><region xml:id="region_2" style="style_2"></region></layout></head><body><div><p begin="00:01:39.000" end="00:01:41.040" region="region_1" style="style_1" tts:color="red"><span style="style_1" tts:color="black">(deep rumbling)</span></p><p begin="00:02:04.080" end="00:02:07.120" region="region_2"><span>MAN:</span><br></br><span>How did we </span><span style="style_1" tts:color="green">end up </span><span>here?</span></p><p begin="00:02:12.160" end="00:02:15.200" region="region_1"><span style="style_1">This place is horrible.</span></p><p begin="00:02:20.240" end="00:02:22.280" region="region_1"><span style="style_1">Smells like balls.</span></p><p begin="00:02:28.320" end="00:02:31.360" region="region_2"><span style="style_2">We don't belong</span><br></br><span style="style_1">in this shithole.</span></p><p begin="00:02:31.400" end="00:02:33.440" region="region_2"><span style="style_2">(computer playing</span><br></br><span style="style_1">electronic melody)</span></p></div></body></tt> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,3 +68,20 @@ func TestTTMLBreakLines(t *testing.T) { | |
|
||
assert.Equal(t, strings.TrimSpace(string(c)), strings.TrimSpace(w.String())) | ||
} | ||
|
||
func TestTTMLWithOptionsNoIndent(t *testing.T) { | ||
// Open | ||
s, err := astisub.OpenFile("./testdata/example-in-no-indent.ttml") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why add this new There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I want to decouple the test file in the two test cases, so I add a new file for the test case.
Yes, I can use directly, If you think it is better. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand but I'd rather use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, will fix it soon. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixes: commit |
||
assert.NoError(t, err) | ||
|
||
// Write | ||
w := &bytes.Buffer{} | ||
|
||
err = s.WriteToTTML(w, astisub.WriteToTTMLWithIndentOption("")) | ||
assert.NoError(t, err) | ||
|
||
c, err := ioutil.ReadFile("./testdata/example-out-no-indent.ttml") | ||
assert.NoError(t, err) | ||
|
||
assert.Equal(t, strings.TrimSpace(string(c)), strings.TrimSpace(w.String())) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rename this test to
TestWriteToTTMLWithIndentOption
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, will rename it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes: commit