Show
Ignore:
Timestamp:
02/18/07 22:11:39 (2 years ago)
Author:
jburke
Message:

References #2366. Converting more tests to use dojo.addOnLoad()

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.4/tests/graphics/test_color.html

    r3994 r7350  
    2121dojo.require("dojo.graphics.color.hsl"); 
    2222 
    23 var c = dojo.graphics.color; 
    24 var hex = ["#003399", "#039", "003399", "039"]; 
    25 for(var i = 0; i < hex.length; i++) { 
    26         var rgb = c.hex2rgb(hex[i]); 
    27         dojo.debug(hex[i], "-> hex2rgb ->", rgb, "-> rgb2hex ->", c.rgb2hex(rgb)); 
    28         dojo.debug("extractRGB(" + hex[i] + ")", c.extractRGB(hex[i])); 
    29 } 
    30  
    31 dojo.debug(); 
    32 dojo.debug("Color object:"); 
    33 var color = new dojo.graphics.color.Color("ffc"); 
    34 dojo.debug("toRgb:", color.toRgb()); 
    35 dojo.debug("toHex:", color.toHex()); 
    36 dojo.debug("toCss:", color.toCss()); 
    37 dojo.debug("toString:", color.toString()); 
    38 dojo.debug("toHsv:", color.toHsv()); 
    39 dojo.debug("toHsl:", color.toHsl()); 
    40  
    41 dojo.debug(); 
    42 dojo.debug("Named colors:"); 
    43 for(var clr in c.named) { 
    44         var rgb = c.extractRGB(clr); 
    45         dojo.debug(clr, "->", rgb, "->", c.rgb2hex(rgb)); 
    46 } 
    47  
    48  
    49 dojo.debug(); 
    50 dojo.debug("Color spaces:"); 
    51  
    52 var a = [255,255,204]; 
    53 var b = dojo.graphics.color.rgb2hsv(a); 
    54 var c = dojo.graphics.color.hsv2rgb(b); 
    55 dojo.debug("HSV:", a, "->", b, "->", c); 
    56  
    57 var d = [255,255,204]; 
    58 var e = dojo.graphics.color.rgb2hsl(d); 
    59 var f = dojo.graphics.color.hsl2rgb(e); 
    60 dojo.debug("HSL:", d, "->", e, "->", f); 
    61  
    62  
    63 dojo.debug(); 
    64 dojo.debug("String handling:"); 
    65  
    66 dojo.debug('Hex from rgb(100,100,100): ' + new dojo.graphics.color.Color('rgb(100,100,100)').toHex()); 
    67 dojo.debug('Hex from rgb(255,0,128): ' + new dojo.graphics.color.Color('rgb(255,0,128)').toHex()); 
    68  
     23dojo.addOnLoad(function(){ 
     24        var c = dojo.graphics.color; 
     25        var hex = ["#003399", "#039", "003399", "039"]; 
     26        for(var i = 0; i < hex.length; i++) { 
     27                var rgb = c.hex2rgb(hex[i]); 
     28                dojo.debug(hex[i], "-> hex2rgb ->", rgb, "-> rgb2hex ->", c.rgb2hex(rgb)); 
     29                dojo.debug("extractRGB(" + hex[i] + ")", c.extractRGB(hex[i])); 
     30        } 
     31         
     32        dojo.debug(); 
     33        dojo.debug("Color object:"); 
     34        var color = new dojo.graphics.color.Color("ffc"); 
     35        dojo.debug("toRgb:", color.toRgb()); 
     36        dojo.debug("toHex:", color.toHex()); 
     37        dojo.debug("toCss:", color.toCss()); 
     38        dojo.debug("toString:", color.toString()); 
     39        dojo.debug("toHsv:", color.toHsv()); 
     40        dojo.debug("toHsl:", color.toHsl()); 
     41         
     42        dojo.debug(); 
     43        dojo.debug("Named colors:"); 
     44        for(var clr in c.named) { 
     45                var rgb = c.extractRGB(clr); 
     46                dojo.debug(clr, "->", rgb, "->", c.rgb2hex(rgb)); 
     47        } 
     48         
     49         
     50        dojo.debug(); 
     51        dojo.debug("Color spaces:"); 
     52         
     53        var a = [255,255,204]; 
     54        var b = dojo.graphics.color.rgb2hsv(a); 
     55        var c = dojo.graphics.color.hsv2rgb(b); 
     56        dojo.debug("HSV:", a, "->", b, "->", c); 
     57         
     58        var d = [255,255,204]; 
     59        var e = dojo.graphics.color.rgb2hsl(d); 
     60        var f = dojo.graphics.color.hsl2rgb(e); 
     61        dojo.debug("HSL:", d, "->", e, "->", f); 
     62         
     63         
     64        dojo.debug(); 
     65        dojo.debug("String handling:"); 
     66         
     67        dojo.debug('Hex from rgb(100,100,100): ' + new dojo.graphics.color.Color('rgb(100,100,100)').toHex()); 
     68        dojo.debug('Hex from rgb(255,0,128): ' + new dojo.graphics.color.Color('rgb(255,0,128)').toHex()); 
     69}); 
    6970</script> 
    7071</head>