unittests/tests/init.js
branchpopcorn-port
changeset 127 3ce493c93d6c
child 142 caefb8b4218f
equal deleted inserted replaced
126:e007a7ad66b8 127:3ce493c93d6c
       
     1 function test_init() {
       
     2 	module("test initialization routines", 
       
     3   {
       
     4     setup: function() {
       
     5       IriSP.jQuery("#widget-div").append("<div id='player_container'></div>");
       
     6       this.popcornOptions = {
       
     7           container: "#player_container",
       
     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",
       
    25                metadata:{
       
    26                 format:'cinelab',
       
    27                 src:'test.json',
       
    28                 type:'dummy'}
       
    29               },
       
    30              {type: "SegmentsWidget", 
       
    31                metadata:{
       
    32                 format:'cinelab',
       
    33                 src:'test.json',
       
    34                 type:'dummy'}
       
    35               },
       
    36              {type: "AnnotationsWidget", 
       
    37                metadata:{
       
    38                 format:'cinelab',
       
    39                 src:'test.json',
       
    40                 type:'dummy'}
       
    41               },
       
    42             ]};
       
    43     }
       
    44   });
       
    45   
       
    46   test("test the creation of a correct popcorn object", function() {
       
    47 
       
    48             
       
    49     var pop = IriSP.configurePopcorn(this.popcornOptions);
       
    50     notDeepEqual(pop, undefined, "returned object is not undefined");
       
    51     
       
    52     /* FIXME: add more test options ? */
       
    53     equal(pop.options.type, "jwplayer", "the player is of the correct type.");
       
    54   });
       
    55   
       
    56   test("test the instantiation of a bunch of widgets", function() {
       
    57     var pop = IriSP.configurePopcorn(this.popcornOptions);
       
    58     var widgets = IriSP.configureWidgets(pop, this.widgetOptions);
       
    59     
       
    60     ok(widgets[0] instanceof IriSP.PlayerWidget, "first widget is a player widget");
       
    61     ok(widgets[1] instanceof IriSP.SegmentsWidget, "second widget is a segments widget");
       
    62     ok(widgets[2] instanceof IriSP.AnnotationsWidget, "third widget is an annotation widget");
       
    63   });
       
    64 }