2 module("test initialization routines", |
2 module("test initialization routines", |
3 { |
3 { |
4 setup: function() { |
4 setup: function() { |
5 IriSP.jQuery("#widget-div").append("<div id='LdtPlayer'></div>"); |
5 IriSP.jQuery("#widget-div").append("<div id='LdtPlayer'></div>"); |
6 this.popcornOptions = { |
6 this.popcornOptions = { |
7 container: "widget-div", |
7 container: "LdtPlayer", |
8 type: "jwplayer", file : "video/franceculture/franceculture_retourdudimanche20100620.flv", |
8 type: "jwplayer", file : "video/franceculture/franceculture_retourdudimanche20100620.flv", |
9 streamer: "rtmp://media.iri.centrepompidou.fr/ddc_player/", |
9 streamer: "rtmp://media.iri.centrepompidou.fr/ddc_player/", |
10 flashplayer : '../libs/player.swf', |
10 flashplayer : '../libs/player.swf', |
11 live: true, |
11 live: true, |
12 "controlbar.position" : "none", |
12 "controlbar.position" : "none", |
44 } |
44 } |
45 }); |
45 }); |
46 |
46 |
47 test("test the creation of a correct popcorn object", function() { |
47 test("test the creation of a correct popcorn object", function() { |
48 |
48 |
49 |
49 var layoutManager = new IriSP.LayoutManager({container: "LdtPlayer", width: 327, height: 542}); |
50 var pop = IriSP.configurePopcorn(this.popcornOptions); |
50 var pop = IriSP.configurePopcorn(layoutManager, this.popcornOptions); |
51 notDeepEqual(pop, undefined, "returned object is not undefined"); |
51 notDeepEqual(pop, undefined, "returned object is not undefined"); |
52 |
52 |
53 /* FIXME: add more test options ? */ |
53 /* FIXME: add more test options ? */ |
54 equal(pop.options.type, "jwplayer", "the player is of the correct type."); |
54 equal(pop.options.type, "jwplayer", "the player is of the correct type."); |
55 }); |
55 }); |
56 |
56 |
|
57 test("test the creation of a video tag", function() { |
|
58 |
|
59 var popcornOptions = { |
|
60 type: "html5", |
|
61 file: "demo.mp4" |
|
62 }; |
|
63 |
|
64 var layoutManager = new IriSP.LayoutManager({container: "LdtPlayer", width: 327, height: 542}); |
|
65 var pop = IriSP.configurePopcorn(layoutManager, popcornOptions); |
|
66 |
|
67 var elem = IriSP.jQuery("#LdtPlayer").find("video"); |
|
68 notDeepEqual(elem, [], "the element is not null"); |
|
69 equal(elem.attr("src"), popcornOptions.file, "the src attribute is set correctly"); |
|
70 }); |
|
71 |
57 test("test the instantiation of a bunch of widgets", function() { |
72 test("test the instantiation of a bunch of widgets", function() { |
58 var pop = IriSP.configurePopcorn(this.popcornOptions); |
73 |
59 var widgets = IriSP.configureWidgets(pop, this.widgetOptions); |
74 var layoutManager = new IriSP.LayoutManager({container: "LdtPlayer", width: 327, height: 542}); |
|
75 var pop = IriSP.configurePopcorn(layoutManager, this.popcornOptions); |
|
76 |
|
77 var widgets = IriSP.configureWidgets(pop, layoutManager, this.widgetOptions); |
60 |
78 |
61 ok(widgets[0] instanceof IriSP.PlayerWidget, "first widget is a player widget"); |
79 ok(widgets[0] instanceof IriSP.PlayerWidget, "first widget is a player widget"); |
62 ok(widgets[1] instanceof IriSP.SegmentsWidget, "second widget is a segments widget"); |
80 ok(widgets[1] instanceof IriSP.SegmentsWidget, "second widget is a segments widget"); |
63 ok(widgets[2] instanceof IriSP.AnnotationsWidget, "third widget is an annotation widget"); |
81 ok(widgets[2] instanceof IriSP.AnnotationsWidget, "third widget is an annotation widget"); |
64 equal(IriSP.jQuery("#" + this.widgetOptions.container).length, 1, "a new dom element has been created"); |
82 equal(IriSP.jQuery("#" + this.widgetOptions.container).length, 1, "a new dom element has been created"); |