From: David Seifried Date: Mon, 6 Jun 2011 18:38:09 +0000 (-0400) Subject: [#541] Wrote some unit tests in order to test the timeupdating functionality of the... X-Git-Tag: v0.7^2~14^2~2^2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=e5b7c63e3c7678ba556f7b515e1b82107e51ec71;p=popcorn-js.git [#541] Wrote some unit tests in order to test the timeupdating functionality of the baseplayer --- diff --git a/players/baseplayer/popcorn.baseplayer.js b/players/baseplayer/popcorn.baseplayer.js index 4765c6a..9666d42 100644 --- a/players/baseplayer/popcorn.baseplayer.js +++ b/players/baseplayer/popcorn.baseplayer.js @@ -59,7 +59,7 @@ setTimeout( function() { self.timeupdate.call( self ); - }, 15 ); + }, 250 ); }, // By default, assumes this.resource is a DOM Element diff --git a/players/baseplayer/popcorn.baseplayer.unit.html b/players/baseplayer/popcorn.baseplayer.unit.html index 676ab77..d2161dc 100644 --- a/players/baseplayer/popcorn.baseplayer.unit.html +++ b/players/baseplayer/popcorn.baseplayer.unit.html @@ -32,6 +32,15 @@ height: 250px; background: #FFAAAA; } + + #video { + position: absolute; + left:620px; + top: 260px; + width: 300px; + height: 175px; + background: #FFAAAA; + } @@ -43,5 +52,23 @@
This is a container for the player, auto-sized for testing purposes. +
+ +
diff --git a/players/baseplayer/popcorn.baseplayer.unit.js b/players/baseplayer/popcorn.baseplayer.unit.js index d890f90..16e346b 100644 --- a/players/baseplayer/popcorn.baseplayer.unit.js +++ b/players/baseplayer/popcorn.baseplayer.unit.js @@ -119,16 +119,16 @@ test( "Default Functionality", function () { player.pause(); }); - player.play(); }); test( "Extension and Method Overriding", function () { - var expects = 4, + var expects = 5, count = 0, player = Popcorn.baseplayer(), playerForPopcorn = Popcorn.baseplayer(), + player2 = Popcorn("#video"), popcorn; function plus() { @@ -163,11 +163,14 @@ test( "Extension and Method Overriding", function () { popcorn = Popcorn( playerForPopcorn ) .exec( 2, function() { + ok( Math.abs(player2.currentTime() - playerForPopcorn.currentTime) < 0.2, "Time update is within a reasonable range" ); + plus(); ok( true, "Exec triggereed from popcorn after 2 seconds" ); plus(); }); player.load(); + player2.play(); player.play(); // Each player will define its own criteria for when readyState should be changed