| author | hamidouk |
| Thu, 27 Oct 2011 13:36:49 +0200 | |
| branch | popcorn-port |
| changeset 158 | 1813e6e4f0d6 |
| parent 143 | 2b962708dff6 |
| child 171 | 158f0193ec54 |
| permissions | -rw-r--r-- |
| 127 | 1 |
function test_init() { |
2 |
module("test initialization routines", |
|
3 |
{ |
|
4 |
setup: function() { |
|
| 143 | 5 |
IriSP.jQuery("#widget-div").append("<div id='LdtPlayer'></div>"); |
| 127 | 6 |
this.popcornOptions = { |
|
158
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
7 |
container: "LdtPlayer", |
| 127 | 8 |
type: "jwplayer", file : "video/franceculture/franceculture_retourdudimanche20100620.flv", |
9 |
streamer: "rtmp://media.iri.centrepompidou.fr/ddc_player/", |
|
10 |
flashplayer : '../libs/player.swf', |
|
11 |
live: true, |
|
12 |
"controlbar.position" : "none", |
|
13 |
height: 300, |
|
14 |
width: 200, |
|
15 |
provider: "rtmp" |
|
16 |
}; |
|
17 |
|
|
18 |
this.widgetOptions = { |
|
19 |
width:650, |
|
20 |
height:480, |
|
21 |
container:'LdtPlayer', |
|
22 |
css:'../../src/css/LdtPlayer.css', |
|
23 |
widgets: [ |
|
24 |
{type: "PlayerWidget", |
|
| 142 | 25 |
mode: "radio", |
| 127 | 26 |
metadata:{ |
27 |
format:'cinelab', |
|
28 |
src:'test.json', |
|
29 |
type:'dummy'} |
|
30 |
}, |
|
31 |
{type: "SegmentsWidget", |
|
32 |
metadata:{ |
|
33 |
format:'cinelab', |
|
34 |
src:'test.json', |
|
35 |
type:'dummy'} |
|
36 |
}, |
|
37 |
{type: "AnnotationsWidget", |
|
38 |
metadata:{ |
|
39 |
format:'cinelab', |
|
40 |
src:'test.json', |
|
41 |
type:'dummy'} |
|
42 |
}, |
|
43 |
]}; |
|
44 |
} |
|
45 |
}); |
|
46 |
|
|
47 |
test("test the creation of a correct popcorn object", function() { |
|
48 |
||
|
158
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
49 |
var layoutManager = new IriSP.LayoutManager({container: "LdtPlayer", width: 327, height: 542}); |
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
50 |
var pop = IriSP.configurePopcorn(layoutManager, this.popcornOptions); |
| 127 | 51 |
notDeepEqual(pop, undefined, "returned object is not undefined"); |
52 |
|
|
53 |
/* FIXME: add more test options ? */ |
|
54 |
equal(pop.options.type, "jwplayer", "the player is of the correct type."); |
|
55 |
}); |
|
56 |
|
|
|
158
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
57 |
test("test the creation of a video tag", function() { |
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
58 |
|
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
59 |
var popcornOptions = { |
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
60 |
type: "html5", |
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
61 |
file: "demo.mp4" |
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
62 |
}; |
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
63 |
|
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
64 |
var layoutManager = new IriSP.LayoutManager({container: "LdtPlayer", width: 327, height: 542}); |
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
65 |
var pop = IriSP.configurePopcorn(layoutManager, popcornOptions); |
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
66 |
|
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
67 |
var elem = IriSP.jQuery("#LdtPlayer").find("video"); |
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
68 |
notDeepEqual(elem, [], "the element is not null"); |
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
69 |
equal(elem.attr("src"), popcornOptions.file, "the src attribute is set correctly"); |
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
70 |
}); |
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
71 |
|
| 127 | 72 |
test("test the instantiation of a bunch of widgets", function() { |
|
158
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
73 |
|
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
74 |
var layoutManager = new IriSP.LayoutManager({container: "LdtPlayer", width: 327, height: 542}); |
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
75 |
var pop = IriSP.configurePopcorn(layoutManager, this.popcornOptions); |
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
76 |
|
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
77 |
var widgets = IriSP.configureWidgets(pop, layoutManager, this.widgetOptions); |
| 143 | 78 |
|
79 |
ok(widgets[0] instanceof IriSP.PlayerWidget, "first widget is a player widget"); |
|
| 127 | 80 |
ok(widgets[1] instanceof IriSP.SegmentsWidget, "second widget is a segments widget"); |
81 |
ok(widgets[2] instanceof IriSP.AnnotationsWidget, "third widget is an annotation widget"); |
|
| 143 | 82 |
equal(IriSP.jQuery("#" + this.widgetOptions.container).length, 1, "a new dom element has been created"); |
| 127 | 83 |
}); |
84 |
} |