From: stevenaw Date: Tue, 25 Jan 2011 20:58:24 +0000 (-0500) Subject: Demo, unit test done [#289] X-Git-Tag: v0.3~15^2~4^2~1 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=e4eccbb977ccc0ddc142b1c079abf950a4029ce5;p=popcorn-js.git Demo, unit test done [#289] --- diff --git a/parsers/parserTTXT/popcorn.parseTTXT.html b/parsers/parserTTXT/popcorn.parseTTXT.html index e65d669..53a7faa 100644 --- a/parsers/parserTTXT/popcorn.parseTTXT.html +++ b/parsers/parserTTXT/popcorn.parseTTXT.html @@ -1,17 +1,16 @@ - Popcorn 0.1 parser Plug-in Demo + Popcorn 0.3 TTXT parser Plug-in Demo - -

Popcorn 0.1 parser Plug-in Demo

-

+

Popcorn 0.3 TTXT parser Plug-in Demo

+

Subtitles are processed from here

- -
diff --git a/parsers/parserTTXT/popcorn.parseTTXT.unit.html b/parsers/parserTTXT/popcorn.parseTTXT.unit.html new file mode 100644 index 0000000..f2eb31c --- /dev/null +++ b/parsers/parserTTXT/popcorn.parseTTXT.unit.html @@ -0,0 +1,43 @@ + + + + Popcorn 0.3 TTXT parser Plug-in Test + + + + + + + + + + + +

Popcorn 0.3 TTXT parser Plug-in Test

+

+
+

+
    +
    + + + + diff --git a/parsers/parserTTXT/popcorn.parseTTXT.unit.js b/parsers/parserTTXT/popcorn.parseTTXT.unit.js new file mode 100644 index 0000000..2beb5ae --- /dev/null +++ b/parsers/parserTTXT/popcorn.parseTTXT.unit.js @@ -0,0 +1,47 @@ +test("Popcorn 0.3 TTXT Parser Plugin", function () { + + var expects = 8, + count = 0, + key, + numSubs = 0, + poppercorn = Popcorn( "#video" ), + subs = { // Expected values + "0": "", + "3": "[Background Music Playing]", + "6": "", + "16": "Heay!!", + "18": "", + "26": "[Bird noises]", + "31": "" + } + }; + + function plus() { + if ( ++count === expects ) { + start(); + } + } + + poppercorn.parseTTXT("data/data.ttxt"); + + expect(expects); + + stop( 10000 ); + + // Allow load time + setTimeout(function () { + Popcorn.forEach(poppercorn.getTrackEvents(), function(evt) { + if(evt._natives.type === "subtitle") { + numSubs++; + key = Math.ceil(evt.start).toString(); + equals(subs[key], evt.text , "Correct amounts" ); + plus(); + } + }); + + equals(7, numSubs , "Correctly parsed all subs" ); + plus(); + + }, 1500); + +});