Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2150 mathias 1
if(!dojo._hasResource["dojox.color.tests.Generator"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2
dojo._hasResource["dojox.color.tests.Generator"] = true;
3
dojo.provide("dojox.color.tests.Generator");
4
dojo.require("dojox.color.Generator");
5
 
6
tests.register("dojox.color.tests.Generator", [
7
	function testAnalogous(t){
8
		//	test the defaults
9
		var args={ base: new dojox.color.Color({ r:128, g:0, b:0 }) };
10
		var a=dojox.color.Generator.analogous(args);
11
		var s='<h3>dojox.color.Generator.analogous</h3><table cellpadding="0" cellspacing="1" border="0"><tr>';
12
		var cols=5, c=0;
13
		dojo.forEach(a, function(item){
14
			if(c++%cols==0){ s+="</tr><tr>"; }
15
			s+='<td width="32" bgcolor="'+item.toHex()+'">&nbsp;</td>';
16
		});
17
		if(c<cols){
18
			for(; c<cols; c++){
19
				s+='<td width="32">&nbsp;</td>';
20
			}
21
		}
22
		t.debug(s+'</tr></table>');
23
	},
24
 
25
	function testMonochromatic(t){
26
		//	test the defaults
27
		var a=dojox.color.Generator.monochromatic({ base:new dojox.color.Color({r:128, g:0, b:0}) });
28
		var s='<h3>dojox.color.Generator.monochromatic</h3><table cellpadding="0" cellspacing="1" border="0"><tr>';
29
		var cols=8, c=0;
30
		dojo.forEach(a, function(item){
31
			if(c++%cols==0){ s+="</tr><tr>"; }
32
			s+='<td width="32" bgcolor="'+item.toHex()+'">&nbsp;</td>';
33
		});
34
		if(c<cols){
35
			for(; c<cols; c++){
36
				s+='<td width="32">&nbsp;</td>';
37
			}
38
		}
39
		t.debug(s+'</tr></table>');
40
	},
41
 
42
	function testTriadic(t){
43
		//	test the defaults
44
		var a=dojox.color.Generator.triadic({ base:new dojox.color.Color({r:128, g:0, b:0}) });
45
		var s='<h3>dojox.color.Generator.triadic</h3><table cellpadding="0" cellspacing="1" border="0"><tr>';
46
		var cols=3, c=0;
47
		dojo.forEach(a, function(item){
48
			if(c++%cols==0){ s+="</tr><tr>"; }
49
			s+='<td width="32" bgcolor="'+item.toHex()+'">&nbsp;</td>';
50
		});
51
		if(c<cols){
52
			for(; c<cols; c++){
53
				s+='<td width="32">&nbsp;</td>';
54
			}
55
		}
56
		t.debug(s+'</tr></table>');
57
	},
58
 
59
	function testComplementary(t){
60
		//	test the defaults
61
		var a=dojox.color.Generator.complementary({ base:new dojox.color.Color({r:128, g:0, b:0}) });
62
		var s='<h3>dojox.color.Generator.complementary</h3><table cellpadding="0" cellspacing="1" border="0"><tr>';
63
		var cols=2, c=0;
64
		dojo.forEach(a, function(item){
65
			if(c++%cols==0){ s+="</tr><tr>"; }
66
			s+='<td width="32" bgcolor="'+item.toHex()+'">&nbsp;</td>';
67
		});
68
		if(c<cols){
69
			for(; c<cols; c++){
70
				s+='<td width="32">&nbsp;</td>';
71
			}
72
		}
73
		t.debug(s+'</tr></table>');
74
	},
75
 
76
	function testSplitComplementary(t){
77
		//	test the defaults
78
		var a=dojox.color.Generator.splitComplementary({ base:new dojox.color.Color({r:128, g:0, b:0}) });
79
		var s='<h3>dojox.color.Generator.splitComplementary</h3><table cellpadding="0" cellspacing="1" border="0"><tr>';
80
		var cols=3, c=0;
81
		dojo.forEach(a, function(item){
82
			if(c++%cols==0){ s+="</tr><tr>"; }
83
			s+='<td width="32" bgcolor="'+item.toHex()+'">&nbsp;</td>';
84
		});
85
		if(c<cols){
86
			for(; c<cols; c++){
87
				s+='<td width="32">&nbsp;</td>';
88
			}
89
		}
90
		t.debug(s+'</tr></table>');
91
	},
92
 
93
	function testCompound(t){
94
		//	test the defaults
95
		var a=dojox.color.Generator.compound({ base:new dojox.color.Color({r:128, g:0, b:0}) });
96
		var s='<h3>dojox.color.Generator.compound</h3><table cellpadding="0" cellspacing="1" border="0"><tr>';
97
		var cols=4, c=0;
98
		dojo.forEach(a, function(item){
99
			if(c++%cols==0){ s+="</tr><tr>"; }
100
			s+='<td width="32" bgcolor="'+item.toHex()+'">&nbsp;</td>';
101
		});
102
		if(c<cols){
103
			for(; c<cols; c++){
104
				s+='<td width="32">&nbsp;</td>';
105
			}
106
		}
107
		t.debug(s+'</tr></table>');
108
	},
109
 
110
	function testShades(t){
111
		//	test the defaults
112
		var a=dojox.color.Generator.shades({ base:new dojox.color.Color({r:128, g:0, b:0}) });
113
		var s='<table cellpadding="0" cellspacing="1" border="0"><tr>';
114
		var cols=8, c=0;
115
		dojo.forEach(a, function(item){
116
			if(c++%cols==0){ s+="</tr><tr>"; }
117
			s+='<td width="32" bgcolor="'+item.toHex()+'">&nbsp;</td>';
118
		});
119
		if(c<cols){
120
			for(; c<cols; c++){
121
				s+='<td width="32">&nbsp;</td>';
122
			}
123
		}
124
		t.debug(s+'</tr></table>');
125
	}
126
]);
127
 
128
}