tests/playlist, tests/subtitle: comments: specs only
This commit is contained in:
1 parent
e0ab895027
commit
928ac9b39f
6 files changed
+10
-44
No files matched your search
@@ -1,6 +1,4 @@
|
||||
-- subtitle/ass tests: ffmpeg's ASS output of a random script (times to the centisecond, text through the override
|
||||
-- markup), hand-written ASS (styles, comments, commas in text, overrides, [Fonts]) and SSA v4 files against ffmpeg's
|
||||
-- SRT conversion of them, styles as data, round trips through the encoder, the contract and the fuzz pass.
|
||||
-- subtitle/ass tests: ffmpeg's ASS output and hand-written ASS / SSA files against ffmpeg's SRT conversion.
|
||||
-- Fixtures: tools/fixtures/subtitles.py.
|
||||
local T = require("@tests/T")
|
||||
local Ass = require("@rosetta/subtitle/ass")
|
||||
@@ -87,7 +85,6 @@ for _, s in { a, ssa, subs } do
|
||||
end
|
||||
end
|
||||
t:eq(buffer.tostring(Ass.encode(a) :: buffer), Fx.hand[2].data, "hand ASS written back byte for byte")
|
||||
-- cues from another format: markup converted, a Default style made
|
||||
do
|
||||
local out = Ass.encode({ kind = "subtitles", cues = { { start = 1, stop = 2.5, text = "<i>it</i> and <b>bold</b>\nline <font color=\"red\">x</font>" } }, styles = {}, meta = {} } :: any) :: buffer
|
||||
local back = Ass.decode(Bytes.reader(out))
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
-- subtitle/srt tests: a random SRT script against ffmpeg (its own parse via its srt muxer: times to the millisecond,
|
||||
-- text), ffmpeg's conversions of WebVTT / ASS / SSA files to SRT, odd layouts (no index, blank lines in text, CRLF,
|
||||
-- BOM, dot decimals, coordinates), round trips through the encoder, the contract and the fuzz pass.
|
||||
-- subtitle/srt tests: a random SRT script and ffmpeg's WebVTT / ASS / SSA conversions against ffmpeg.
|
||||
-- Fixtures: tools/fixtures/subtitles.py.
|
||||
local T = require("@tests/T")
|
||||
local Srt = require("@rosetta/subtitle/srt")
|
||||
@@ -35,7 +33,6 @@ t:eq(Srt.name, "srt", "name")
|
||||
t:eq(Srt.category, "subtitle", "category")
|
||||
t:check(Srt.caps.decode and Srt.caps.encode, "caps")
|
||||
|
||||
-- the random script and ffmpeg's re-mux of it
|
||||
local subs, err = decode(Fx.srt)
|
||||
t:check(subs, "decode: " .. tostring(err))
|
||||
same(subs, Fx.cues, "random")
|
||||
@@ -48,7 +45,6 @@ for _, h in Fx.hand do
|
||||
same(decode(h.ffmpeg_srt), h.cues, "ffmpeg " .. h.name .. " -> srt")
|
||||
end
|
||||
|
||||
-- odd layouts
|
||||
do
|
||||
local s = "\239\187\1911\r\n00:00:01.5 --> 00:00:02,25 X1:10 X2:20 Y1:5 Y2:6\r\nfirst\r\n\r\nsecond paragraph\r\n\r\n\r\n00:00:03,000 --> 00:00:04,000\r\nno index\r\n2\r\n00:00:05,000-->00:00:06,000\r\n"
|
||||
local r = decode(s)
|
||||
@@ -66,7 +62,6 @@ do
|
||||
t:eq(again.cues[1].settings, r.cues[1].settings, "odd: round trip keeps the coordinates")
|
||||
end
|
||||
|
||||
-- round trips (LF and CRLF)
|
||||
for _, crlf in { false, true } do
|
||||
local out = Srt.encode(subs, { crlf = crlf }) :: buffer
|
||||
local back = Srt.decode(Bytes.reader(out))
|
||||
@@ -82,7 +77,6 @@ for _, crlf in { false, true } do
|
||||
end
|
||||
end
|
||||
|
||||
-- errors
|
||||
do
|
||||
local _, e = decode("just some text\nno timings")
|
||||
t:check(e and e.code == Err.CORRUPT, "no cues: " .. tostring(e))
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
-- subtitle/vtt tests: ffmpeg's WebVTT output of a random script (times, text), a hand-written file with a header,
|
||||
-- STYLE / REGION / NOTE blocks, ids, settings and hour timestamps against ffmpeg's SRT conversion of it, round trips
|
||||
-- through the encoder, the contract and the fuzz pass. Fixtures: tools/fixtures/subtitles.py.
|
||||
-- subtitle/vtt tests: ffmpeg's WebVTT output and a hand-written file against ffmpeg's SRT conversion.
|
||||
-- Fixtures: tools/fixtures/subtitles.py.
|
||||
local T = require("@tests/T")
|
||||
local Vtt = require("@rosetta/subtitle/vtt")
|
||||
local Bytes = require("@rosetta/core/Bytes")
|
||||
@@ -76,7 +75,6 @@ do
|
||||
local back = decode(buffer.tostring(Vtt.encode(v) :: buffer))
|
||||
t:eq(back.meta.css[1], v.meta.css[1], "rt css")
|
||||
t:eq(back.meta.regions[1], v.meta.regions[1], "rt region")
|
||||
-- text that WebVTT cannot hold
|
||||
local w = Vtt.encode({ kind = "subtitles", cues = { { start = 0, stop = 1, text = "a\n\nb --> c" } }, styles = {}, meta = {} } :: any) :: buffer
|
||||
local wb = Vtt.decode(Bytes.reader(w))
|
||||
t:eq(wb.cues[1].text, "a\nb --> c", "blank lines dropped, arrow escaped")
|
||||
|
||||
Reference in new issue
Block a user