[#541] Wrote some unit tests in order to test the timeupdating functionality of the baseplayer

This commit is contained in:
David Seifried 2011-06-06 14:38:09 -04:00
Родитель f0d3b4b9cb
Коммит e5b7c63e3c
3 изменённых файлов: 33 добавлений и 3 удалений

Просмотреть файл

@ -59,7 +59,7 @@
setTimeout( function() {
self.timeupdate.call( self );
}, 15 );
}, 250 );
},
// By default, assumes this.resource is a DOM Element

Просмотреть файл

@ -32,6 +32,15 @@
height: 250px;
background: #FFAAAA;
}
#video {
position: absolute;
left:620px;
top: 260px;
width: 300px;
height: 175px;
background: #FFAAAA;
}
</style>
</head>
<body>
@ -43,5 +52,23 @@
<div id="qunit-fixture"> </div>
<span id="player_1">This is a container for the player, auto-sized for testing purposes.</span>
<div >
<video id='video'
controls
width= '250px'
poster="../../test/poster.png">
<source id='mp4'
src="../../test/trailer.mp4"
type='video/mp4; codecs="avc1, mp4a"'>
<source id='ogv'
src="../../test/trailer.ogv"
type='video/ogg; codecs="theora, vorbis"'>
<p>Your user agent does not support the HTML5 Video element.</p>
</video>
</div>
</body>
</html>

Просмотреть файл

@ -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