| author | hamidouk |
| Wed, 02 Nov 2011 12:33:20 +0100 | |
| branch | popcorn-port |
| changeset 171 | 158f0193ec54 |
| parent 158 | 1813e6e4f0d6 |
| child 179 | 7b46fbf4cf6c |
| 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 |
|
|
171
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
72 |
test("test the instantiation of a single widget without dependencies", function() { |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
73 |
|
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
74 |
var dt = new IriSP.DataLoader(); |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
75 |
var serialFactory = new IriSP.SerializerFactory(dt); |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
76 |
|
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
77 |
var layoutManager = new IriSP.LayoutManager({container: "LdtPlayer", width: 327, height: 542}); |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
78 |
var pop = IriSP.configurePopcorn(layoutManager, this.popcornOptions); |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
79 |
var conf = {type: "PlayerWidget", |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
80 |
mode: "radio", |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
81 |
metadata:{ |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
82 |
format:'cinelab', |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
83 |
src:'test.json', |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
84 |
type:'dummy'} |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
85 |
}; |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
86 |
|
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
87 |
var res = IriSP.instantiateWidget(pop, serialFactory, layoutManager, conf); |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
88 |
ok(res instanceof IriSP.PlayerWidget, "the returned widget is of the correct instance"); |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
89 |
}); |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
90 |
|
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
91 |
test("test the instantiation of a single widget with one dependency", function() { |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
92 |
var dt = new IriSP.DataLoader(); |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
93 |
var serialFactory = new IriSP.SerializerFactory(dt); |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
94 |
|
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
95 |
var layoutManager = new IriSP.LayoutManager({container: "LdtPlayer", width: 327, height: 542}); |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
96 |
|
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
97 |
var pop = IriSP.configurePopcorn(layoutManager, this.popcornOptions); |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
98 |
var conf = {type: "PlayerWidget", |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
99 |
mode: "radio", |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
100 |
metadata:{ |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
101 |
format:'cinelab', |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
102 |
src:'test.json', |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
103 |
type:'dummy'}, |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
104 |
requires: [ |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
105 |
{type: "PlayerWidget", |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
106 |
mode: "radio", |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
107 |
metadata:{ |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
108 |
format:'cinelab', |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
109 |
src:'test.json', |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
110 |
type:'dummy' |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
111 |
} }] |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
112 |
}; |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
113 |
|
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
114 |
|
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
115 |
var res = IriSP.instantiateWidget(pop, serialFactory, layoutManager, conf); |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
116 |
|
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
117 |
ok(res instanceof IriSP.PlayerWidget, "the returned widget is of the correct instance"); |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
118 |
ok(res.PlayerWidget instanceof IriSP.PlayerWidget, "the dependency widget is accessible from the parent"); |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
119 |
}); |
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
120 |
|
| 127 | 121 |
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
|
122 |
|
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
123 |
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
|
124 |
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
|
125 |
|
|
1813e6e4f0d6
made a small change to the way popcorn is integrated into the page.
hamidouk
parents:
143
diff
changeset
|
126 |
var widgets = IriSP.configureWidgets(pop, layoutManager, this.widgetOptions); |
| 143 | 127 |
|
128 |
ok(widgets[0] instanceof IriSP.PlayerWidget, "first widget is a player widget"); |
|
| 127 | 129 |
ok(widgets[1] instanceof IriSP.SegmentsWidget, "second widget is a segments widget"); |
130 |
ok(widgets[2] instanceof IriSP.AnnotationsWidget, "third widget is an annotation widget"); |
|
| 143 | 131 |
equal(IriSP.jQuery("#" + this.widgetOptions.container).length, 1, "a new dom element has been created"); |
| 127 | 132 |
}); |
|
171
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
133 |
|
|
158f0193ec54
added support for dependency widgets (i.e : a widget can now depend on another,
hamidouk
parents:
158
diff
changeset
|
134 |
|
| 127 | 135 |
} |