unittests/tests/layout.js
author hamidouk
Tue, 29 Nov 2011 11:09:08 +0100
branchpopcorn-port
changeset 345 8a088f7daa66
parent 288 25fe0c8831de
permissions -rw-r--r--
rollover over the interface buttons now works as expected. Also changed the width of the buttons to the correct size. Resized the width and height of the sprites to be the same as the boxes we display them in.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
111
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
     1
/* tests for layout.js */
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
     2
function test_layout() {
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
     3
  module("layout manager", {setup: 
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
     4
    function() { 
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
     5
    IriSP.jQuery("#widget-div").append("<div id='LdtPlayer'></div>"); 
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
     6
    IriSP.jQuery("#widget-div").append("<div id='myDiv'></div>"); 
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
     7
    }});
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
     8
  
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
     9
  test("test the default initialization of layout manager", function() {
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
    10
      var lay = new IriSP.LayoutManager();
113
ebfd0d17e427 small changes to the layout manager.
hamidouk
parents: 111
diff changeset
    11
      equal(lay._div, "LdtPlayer", "the default div is set correctly");
111
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
    12
      equal(lay._width, 640, "the default width is set correctly");
159
de92bfdcbe4c removed default height from layout.js.
hamidouk
parents: 117
diff changeset
    13
      equal(lay._height, undefined, "the default height is set correctly");
111
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
    14
      
159
de92bfdcbe4c removed default height from layout.js.
hamidouk
parents: 117
diff changeset
    15
      equal(IriSP.jQuery("#" + lay._div).css("width"), lay._width + "px", "div width is set correctly");      
111
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
    16
  });
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
    17
  
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
    18
  test("test custom init of layout manager", function() {
117
b0a699baf3f1 some renames to the layout internal structures.
hamidouk
parents: 113
diff changeset
    19
    var lay = new IriSP.LayoutManager({container: "myDiv", width: 327, height: 542});
113
ebfd0d17e427 small changes to the layout manager.
hamidouk
parents: 111
diff changeset
    20
    equal(lay._div, "myDiv", "the default div is set correctly");
111
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
    21
    equal(lay._width, 327, "the default width is set correctly");
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
    22
    equal(lay._height, 542, "the default height is set correctly");
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
    23
    
113
ebfd0d17e427 small changes to the layout manager.
hamidouk
parents: 111
diff changeset
    24
    equal(IriSP.jQuery("#" + lay._div).css("width"), lay._width + "px", "div width is set correctly");
ebfd0d17e427 small changes to the layout manager.
hamidouk
parents: 111
diff changeset
    25
    equal(IriSP.jQuery("#" + lay._div).css("height"), lay._height + "px", "div height is set correctly");
ebfd0d17e427 small changes to the layout manager.
hamidouk
parents: 111
diff changeset
    26
  });
ebfd0d17e427 small changes to the layout manager.
hamidouk
parents: 111
diff changeset
    27
  
ebfd0d17e427 small changes to the layout manager.
hamidouk
parents: 111
diff changeset
    28
  test("test widget div creation", function() {
ebfd0d17e427 small changes to the layout manager.
hamidouk
parents: 111
diff changeset
    29
    var lay = new IriSP.LayoutManager({});
287
5c7495102bd7 added a spacer div to simplify some graphic animations.
hamidouk
parents: 159
diff changeset
    30
    var ret = lay.createDiv(); 
5c7495102bd7 added a spacer div to simplify some graphic animations.
hamidouk
parents: 159
diff changeset
    31
    var divId = ret[0];
5c7495102bd7 added a spacer div to simplify some graphic animations.
hamidouk
parents: 159
diff changeset
    32
    var spacerId = ret[1];
113
ebfd0d17e427 small changes to the layout manager.
hamidouk
parents: 111
diff changeset
    33
    
287
5c7495102bd7 added a spacer div to simplify some graphic animations.
hamidouk
parents: 159
diff changeset
    34
    equal(lay.selector.children("#" + divId).length, 1, "check that a subdiv container is created");
5c7495102bd7 added a spacer div to simplify some graphic animations.
hamidouk
parents: 159
diff changeset
    35
    equal(lay.selector.children("#" + spacerId).length, 1, "check that a spacer subdiv is created");
288
25fe0c8831de made the spacer height configurable. set to 0 by default.
hamidouk
parents: 287
diff changeset
    36
    equal(lay.selector.children("#" + spacerId).height() + "px", IriSP.widgetsDefaults.LayoutManager.spacer_div_height, "check that spacer height is set");
113
ebfd0d17e427 small changes to the layout manager.
hamidouk
parents: 111
diff changeset
    37
    
111
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
    38
  });
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
    39
  
df08c7f9535c added a basic layout manager.
hamidouk
parents:
diff changeset
    40
};