From 155ac81b257b6a6c89325849f266b55c1068f2bc Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Thu, 8 Sep 2011 13:44:40 -0400 Subject: [PATCH] [#494] Adds a test for frame function --- test/popcorn.unit.js | 45 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/test/popcorn.unit.js b/test/popcorn.unit.js index a1b1f01..89855e7 100644 --- a/test/popcorn.unit.js +++ b/test/popcorn.unit.js @@ -1452,7 +1452,9 @@ test("Start Zero Immediately", function() { var $pop = Popcorn("#video"), expects = 1, - count = 0; + count = 0; + + expect(expects); function plus() { if ( ++count === expects ) { @@ -1479,6 +1481,47 @@ test("Start Zero Immediately", function() { end: 2 }); }); + +test("frame function (frameAnimation)", function() { + + var $pop = Popcorn("#video", { frameAnimation: true }), + fired = 0, + expects = 1, + count = 0; + + expect(expects); + + function plus() { + if ( ++count === expects ) { + // clean up added events after tests + Popcorn.removePlugin("frameFn"); + start(); + } + } + + stop(); + + $pop.pause().currentTime( 1 ); + + Popcorn.plugin( "frameFn", { + start: function() { + }, + frame: function() { + fired++; + }, + end: function() { + // if `frame` fired, then it will have value > 0 + ok( fired, "frame fired. (actual: " + fired + ")" ); + plus(); + } + }); + + $pop.frameFn({ + start: 1, + end: 3 + }).play(); +}); + test("Update Timer (timeupdate)", function() { QUnit.reset(); -- 2.43.0