зеркало из https://github.com/mozilla/popcorn-js.git
[#t381] subtitle position check on all platforms
This commit is contained in:
Родитель
a0904c0e82
Коммит
23ce806b80
|
@ -3,10 +3,8 @@ test("Popcorn Subtitle Plugin", function () {
|
|||
var popped = Popcorn("#video"),
|
||||
expects = 9,
|
||||
count = 0,
|
||||
interval,
|
||||
interval2,
|
||||
interval3,
|
||||
interval4,
|
||||
subTop = 9001,
|
||||
subLeft = 9001,
|
||||
subtitlediv;
|
||||
|
||||
expect(expects);
|
||||
|
@ -53,16 +51,40 @@ test("Popcorn Subtitle Plugin", function () {
|
|||
|
||||
popped.exec( 0.5, function() {
|
||||
|
||||
equals ( subtitlediv.style.left, "400px", "subtitle left position moved" );
|
||||
plus();
|
||||
equals ( subtitlediv.style.top, "657px", "subtitle top position moved" );
|
||||
plus();
|
||||
equals (subtitlediv.innerHTML, "this is the first subtitle of 2011", "subtitle displaying correct information" );
|
||||
// capturing location now, to check against later,
|
||||
// a subtitle must be displayed to get valid data
|
||||
// which is why we do this in exec
|
||||
subLeft = subtitlediv.style.left;
|
||||
subTop = subtitlediv.style.top;
|
||||
|
||||
// changing position
|
||||
popped.media.style.position = "absolute";
|
||||
popped.media.style.left = "400px";
|
||||
popped.media.style.top = "600px";
|
||||
|
||||
equals( subtitlediv.innerHTML, "this is the first subtitle of 2011", "subtitle displaying correct information" );
|
||||
plus();
|
||||
});
|
||||
|
||||
popped.exec( 1.5, function() {
|
||||
|
||||
|
||||
// check position of subttile that should of moved with video,
|
||||
// a subtitle must be displayed to get valid data
|
||||
ok( subtitlediv.style.left !== subLeft, "subtitle's left position has changed" );
|
||||
plus();
|
||||
ok( subtitlediv.style.top !== subTop, "subtitle's top position has changed" );
|
||||
plus();
|
||||
|
||||
// we know values have changed, but how accurate are they?
|
||||
// check values against the video's values
|
||||
// we need four checks because if we just check against video's position,
|
||||
// and video's position hasn't updated either, we'll pass when we should fail
|
||||
equals( subtitlediv.style.left, popped.position().left + "px", "subtitle left position moved" );
|
||||
plus();
|
||||
ok( Popcorn.position( subtitlediv ).top > popped.position().top, "subtitle top position moved" );
|
||||
plus();
|
||||
|
||||
equals (subtitlediv.innerHTML, "this is the second subtitle of 2011", "subtitle displaying correct information" );
|
||||
plus();
|
||||
});
|
||||
|
@ -78,14 +100,5 @@ test("Popcorn Subtitle Plugin", function () {
|
|||
equals (subtitlediv.innerHTML, "this is the third subtitle of 2011", "subtitle displaying correct information" );
|
||||
plus();
|
||||
});
|
||||
|
||||
equals ( "8px", subtitlediv.style.left, "subtitle left position default" );
|
||||
plus();
|
||||
equals ( "247px", subtitlediv.style.top, "subtitle top position default" );
|
||||
plus();
|
||||
|
||||
popped.media.style.position = "absolute";
|
||||
popped.media.style.left = "400px";
|
||||
popped.media.style.top = "600px";
|
||||
|
||||
});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче