Skip to content
This repository
Newer
Older
100644 306 lines (270 sloc) 14.633 kb
54fffcf2 »
2010-03-09 New cssMath tests
1 <!DOCTYPE HTML>
2
3 <html>
4
5 <head>
6 <meta charset="UTF-8" />
7
8 <title>Cross-Browser CSS3 Rule Generator</title>
9
38ad415c »
2010-09-30 New stuff for css3please2
10 <script src="test_math.js"></script>
54fffcf2 »
2010-03-09 New cssMath tests
11 <script type="text/javascript">
12
13 /* ---- cssMath Firebug tests ---- */
14
15 console.log(
b9e46a08 »
2010-09-30 New stuff for css3please2
16 '--------------------------------------------------------------------------------\n' +
17 'General Tests' +
18 '\n--------------------------------------------------------------------------------'
19 );
20
21 console.log(
22 'Testing round: function (n, l = 10)', '\n',
54fffcf2 »
2010-03-09 New cssMath tests
23 'Number rounded by Length', '\n',
24 'cssMath.round(3.1417534)', 'returns: ', cssMath.round(3.1417534), '\n',
25 'cssMath.round(3.1417534, 2)', 'returns: ', cssMath.round(3.1417534, 2), '\n'
26 );
27
28 console.log(
b9e46a08 »
2010-09-30 New stuff for css3please2
29 '--------------------------------------------------------------------------------\n' +
30 'Rotation Tests' +
31 '\n--------------------------------------------------------------------------------'
32 );
33
34 console.log(
54fffcf2 »
2010-03-09 New cssMath tests
35 'Testing xy2rs: function (x, y)', '\n',
36 'X and Y coordinates to rotation and strength', '\n',
37 'cssMath.xy2rs(4, 4)', 'returns: ', cssMath.xy2rs(4, 4), '\n',
38 'cssMath.xy2rs(10, 15)', 'returns: ', cssMath.xy2rs(10, 15), '\n'
39 );
40
41 console.log(
42 'Testing rs2xy: function (r, s)', '\n',
43 'Rotation and Strength to x and y coordinates', '\n',
44 'cssMath.rs2xy(135, 5.657)', 'returns: ', cssMath.rs2xy(135, 5.657), '\n',
45 'cssMath.rs2xy(146.31, 18.028)', 'returns: ', cssMath.rs2xy(146.31, 18.028), '\n'
46 );
47
48 console.log(
49 'Testing r2d: function (r)', '\n',
50 'Rotation to degree', '\n',
51 'cssMath.r2d(3)', 'returns: ', cssMath.r2d(3), '\n',
52 'cssMath.r2d(3.5)', 'returns: ', cssMath.r2d(3.5), '\n'
53 );
54
55 console.log(
56 'Testing d2r: function (d)', '\n',
57 'Degree to rotation', '\n',
58 'cssMath.d2r(270)', 'returns: ', cssMath.d2r(270), '\n',
59 'cssMath.d2r(315)', 'returns: ', cssMath.d2r(315), '\n'
60 );
61
62 console.log(
b9e46a08 »
2010-09-30 New stuff for css3please2
63 '--------------------------------------------------------------------------------\n' +
64 'Color Tests' +
65 '\n--------------------------------------------------------------------------------'
66 );
67
68 console.log(
54fffcf2 »
2010-03-09 New cssMath tests
69 'Testing lh2sh: function (lh)', '\n',
70 'Long Hexadecimals compressed to short hexadecimals', '\n',
71 'cssMath.lh2sh(\'FF33FF\')', 'returns: ', cssMath.lh2sh('FF33FF'), '\n',
72 'cssMath.lh2sh(\'#FF33FF\')', 'returns: ', cssMath.lh2sh('#FF33FF'), '\n',
b9e46a08 »
2010-09-30 New stuff for css3please2
73 'cssMath.lh2sh(\'#F3F\')', 'returns: ', cssMath.lh2sh('#F3F'), '\n',
74 'cssMath.lh2sh(\'#FF33FE\')', 'returns: ', cssMath.lh2sh('#FF33FE'), '\n'
54fffcf2 »
2010-03-09 New cssMath tests
75 );
76
77 console.log(
78 'Testing sh2lh: function (sh)', '\n',
79 'Short Hexadecimals expanded to long hexadecimals', '\n',
80 'cssMath.sh2lh(\'F3F\')', 'returns: ', cssMath.sh2lh('F3F'), '\n',
81 'cssMath.lh2sh(\'#F3F\')', 'returns: ', cssMath.sh2lh('#F3F'), '\n',
82 'cssMath.lh2sh(\'#FF33FF\')', 'returns: ', cssMath.sh2lh('#FF33FF'), '\n'
83 );
84
85 console.log(
86 'Testing c2h: function (c)', '\n',
87 'Channel to hexadecimal', '\n',
88 'cssMath.c2h(255)', 'returns: ', cssMath.c2h(255), '\n',
89 'cssMath.c2h(0)', 'returns: ', cssMath.c2h(0), '\n'
90 );
91
92 console.log(
93 'Testing h2c: function (c)', '\n',
94 'Hexadecimal to channel', '\n',
95 'cssMath.h2c(\'FF\')', 'returns: ', cssMath.h2c('FF'), '\n',
96 'cssMath.h2c(\'00\')', 'returns: ', cssMath.h2c('00'), '\n'
97 );
98
99 console.log(
100 'Testing c2a: function (c)', '\n',
101 'Channels to array', '\n',
102 'cssMath.c2a(\'255, 0, 255\')', 'returns: ', cssMath.c2a('255, 0, 255'), '\n',
103 'cssMath.c2a(\'255,0,255\')', 'returns: ', cssMath.c2a('255,0,255'), '\n',
104 'cssMath.c2a(\'(255,0,255)\')', 'returns: ', cssMath.c2a('(255,0,255)'), '\n',
105 'cssMath.c2a(\'rgb(255,0,255)\')', 'returns: ', cssMath.c2a('rgb(255,0,255)'), '\n',
106 'cssMath.c2a(\'rgb ( 255 , 0 , 255 )\')', 'returns: ', cssMath.c2a('rgb ( 255 , 0 , 255 )'), '\n'
107 );
108
109 console.log(
110 'Testing h2a: function (c)', '\n',
111 'Hexadecimals to array', '\n',
112 'cssMath.h2a(\'FF00FF\')', 'returns: ', cssMath.h2a('FF00FF'), '\n',
113 'cssMath.h2a(\'#FF00FF\')', 'returns: ', cssMath.h2a('#FF00FF'), '\n',
114 'cssMath.h2a(\'#F0F\')', 'returns: ', cssMath.h2a('#F0F'), '\n',
115 'cssMath.h2a(\'F0F\')', 'returns: ', cssMath.h2a('F0F'), '\n'
116 );
117
118 console.log(
119 'Testing c2h2: function (c)', '\n',
120 'Channels to hexadecimals', '\n',
121 'cssMath.c2h2(\'255, 0, 255\')', 'returns: ', cssMath.c2h2('255, 0, 255'), '\n',
122 'cssMath.c2h2(\'255,0,255\')', 'returns: ', cssMath.c2h2('255,0,255'), '\n',
123 'cssMath.c2h2(\'(255,0,255)\')', 'returns: ', cssMath.c2h2('(255,0,255)'), '\n',
124 'cssMath.c2h2(\'rgb(255,0,255)\')', 'returns: ', cssMath.c2h2('rgb(255,0,255)'), '\n',
125 'cssMath.c2h2(\'rgb ( 255 , 0 , 255 )\')', 'returns: ', cssMath.c2h2('rgb ( 255 , 0 , 255 )'), '\n'
126 );
127
128 console.log(
129 'Testing h2c2: function (h)', '\n',
130 'Hexadecimals to channels', '\n',
131 'cssMath.h2c2(\'FF00FF\')', 'returns: ', cssMath.h2c2('FF00FF'), '\n',
132 'cssMath.h2c2(\'#FF00FF\')', 'returns: ', cssMath.h2c2('#FF00FF'), '\n',
133 'cssMath.h2c2(\'#F0F\')', 'returns: ', cssMath.h2c2('#F0F'), '\n',
134 'cssMath.h2c2(\'F0F\')', 'returns: ', cssMath.h2c2('F0F'), '\n'
135 );
136
137 console.log(
138 'Testing cf: function (c)', '\n',
139 'Channels proper formatting', '\n',
140 'cssMath.cf(\'255, 0, 255\')', 'returns: ', cssMath.cf('255, 0, 255'), '\n',
141 'cssMath.cf(\'255,0,255\')', 'returns: ', cssMath.cf('255,0,255'), '\n',
142 'cssMath.cf(\'(255,0,255)\')', 'returns: ', cssMath.cf('(255,0,255)'), '\n',
143 'cssMath.cf(\'rgb(255,0,255)\')', 'returns: ', cssMath.cf('rgb(255,0,255)'), '\n',
144 'cssMath.cf(\'rgb ( 255 , 0 , 255 )\')', 'returns: ', cssMath.cf('rgb ( 255 , 0 , 255 )'), '\n',
145 'cssMath.cf(\'255, 0, 255, 204\')', 'returns: ', cssMath.cf('255, 0, 255, 204'), '\n',
146 'cssMath.cf(\'255,0,255,204\')', 'returns: ', cssMath.cf('255,0,255,204'), '\n',
147 'cssMath.cf(\'(255,0,255,204)\')', 'returns: ', cssMath.cf('(255,0,255,204)'), '\n',
148 'cssMath.cf(\'rgb(255,0,255,204)\')', 'returns: ', cssMath.cf('rgb(255,0,255,204)'), '\n',
149 'cssMath.cf(\'rgb ( 255 , 0 , 255 , 204)\')', 'returns: ', cssMath.cf('rgb ( 255 , 0 , 255 , 204)'), '\n'
150 );
151
152 console.log(
153 'Testing hf: function (h)', '\n',
154 'Hexadecimals proper formatting', '\n',
155 'cssMath.hf(\'FF00FF\')', 'returns: ', cssMath.hf('FF00FF'), '\n',
156 'cssMath.hf(\'#FF00FF\')', 'returns: ', cssMath.hf('#FF00FF'), '\n',
157 'cssMath.hf(\'#F0F\')', 'returns: ', cssMath.hf('#F0F'), '\n',
158 'cssMath.hf(\'F0F\')', 'returns: ', cssMath.hf('F0F'), '\n',
159 'cssMath.hf(\'CCFF00FF\')', 'returns: ', cssMath.hf('CCFF00FF'), '\n',
160 'cssMath.hf(\'CF0F\')', 'returns: ', cssMath.hf('CF0F'), '\n'
161 );
162
163 console.log(
164 'Testing cm: function (c, m)', '\n',
165 'Channel Move', '\n',
166 'cssMath.cm(254, 1)', 'returns: ', cssMath.cm(254, 1), '\n',
167 'cssMath.cm(253, 2)', 'returns: ', cssMath.cm(253, 2), '\n',
168 'cssMath.cm(255, -51)', 'returns: ', cssMath.cm(255, -51), '\n'
169 );
170
171 console.log(
172 'Testing hm: function (h, m)', '\n',
173 'Hexadecimal Move', '\n',
174 'cssMath.hm(\'FE\', 1)', 'returns: ', cssMath.hm('FE', 1), '\n',
175 'cssMath.hm(\'FD\', 2)', 'returns: ', cssMath.hm('FD', 2), '\n',
176 'cssMath.hm(\'FF\', -51)', 'returns: ', cssMath.hm('FF', -51), '\n'
177 );
178
179 console.log(
180 'Testing cm2: function (c, m)', '\n',
181 'Channels Move', '\n',
182 'cssMath.cm2(\'254, 254, 254\', 1)', 'returns: ', cssMath.cm2('254, 254, 254', 1), '\n',
183 'cssMath.cm2(\'253, 253, 253\', 2)', 'returns: ', cssMath.cm2('253, 253, 253', 2), '\n',
184 'cssMath.cm2(\'255, 255, 255\', -51)', 'returns: ', cssMath.cm2('255, 255, 255', -51), '\n'
185 );
186
187 console.log(
188 'Testing hm2: function (h, m)', '\n',
189 'Hexadecimals Move', '\n',
190 'cssMath.hm2(\'FEFEFE\', 1)', 'returns: ', cssMath.hm2('FEFEFE', 1), '\n',
191 'cssMath.hm2(\'FDFDFD\', 2)', 'returns: ', cssMath.hm2('FDFDFD', 2), '\n',
192 'cssMath.hm2(\'FFFFFF\', -51)', 'returns: ', cssMath.hm2('FFFFFF', -51), '\n'
193 );
194
195 console.log(
b9e46a08 »
2010-09-30 New stuff for css3please2
196 '--------------------------------------------------------------------------------\n' +
197 'String Tests' +
198 '\n--------------------------------------------------------------------------------'
199 );
200
201 console.log(
54fffcf2 »
2010-03-09 New cssMath tests
202 'Testing s2sh: function (s)', '\n',
203 'String to short hexadecimal', '\n',
b9e46a08 »
2010-09-30 New stuff for css3please2
204 'cssMath.s2sh(\'255, 238, 255\')', 'returns: ', cssMath.s2sh('255, 238, 255'), '\n',
205 'cssMath.s2sh(\'rgb(255, 238, 255)\')', 'returns: ', cssMath.s2sh('rgb(255, 238, 255)'), '\n',
206 'cssMath.s2sh(\'rgba(255, 238, 255, 255)\')', 'returns: ', cssMath.s2sh('rgba(255, 238, 255, 255)'), '\n',
207 'cssMath.s2sh(\'rgb(255, 238, 255, 255)\')', 'returns: ', cssMath.s2sh('rgb(255, 238, 255, 255)'), '\n',
208 'cssMath.s2sh(\'rgba(255, 238, 255)\')', 'returns: ', cssMath.s2sh('rgba(255, 238, 255)'), '\n',
209 'cssMath.s2sh(\'F3F\')', 'returns: ', cssMath.s2sh('F3F'), '\n',
210 'cssMath.s2sh(\'FF33FF\')', 'returns: ', cssMath.s2sh('FF33FF'), '\n',
211 'cssMath.s2sh(\'FF3F\')', 'returns: ', cssMath.s2sh('FF3F'), '\n',
212 'cssMath.s2sh(\'FFFF33FF\')', 'returns: ', cssMath.s2sh('FFFF33FF'), '\n',
213 'cssMath.s2sh(\'#F3F\')', 'returns: ', cssMath.s2sh('#F3F'), '\n',
214 'cssMath.s2sh(\'#FF33FF\')', 'returns: ', cssMath.s2sh('#FF33FF'), '\n',
215 'cssMath.s2sh(\'#FF3F\')', 'returns: ', cssMath.s2sh('#FF3F'), '\n',
216 'cssMath.s2sh(\'#FFFF33FF\')', 'returns: ', cssMath.s2sh('#FFFF33FF'), '\n'
54fffcf2 »
2010-03-09 New cssMath tests
217 );
218
219 console.log(
220 'Testing s2lh: function (s)', '\n',
221 'String to long hexadecimal', '\n',
b9e46a08 »
2010-09-30 New stuff for css3please2
222 'cssMath.s2lh(\'255, 238, 255\')', 'returns: ', cssMath.s2lh('255, 238, 255'), '\n',
223 'cssMath.s2lh(\'rgb(255, 238, 255)\')', 'returns: ', cssMath.s2lh('rgb(255, 238, 255)'), '\n',
224 'cssMath.s2lh(\'rgba(255, 238, 255, 255)\')', 'returns: ', cssMath.s2lh('rgba(255, 238, 255, 255)'), '\n',
225 'cssMath.s2lh(\'rgb(255, 238, 255, 255)\')', 'returns: ', cssMath.s2lh('rgb(255, 238, 255, 255)'), '\n',
226 'cssMath.s2lh(\'rgba(255, 238, 255)\')', 'returns: ', cssMath.s2lh('rgba(255, 238, 255)'), '\n',
227 'cssMath.s2lh(\'F3F\')', 'returns: ', cssMath.s2lh('F3F'), '\n',
228 'cssMath.s2lh(\'FF33FF\')', 'returns: ', cssMath.s2lh('FF33FF'), '\n',
229 'cssMath.s2lh(\'FF3F\')', 'returns: ', cssMath.s2lh('FF3F'), '\n',
230 'cssMath.s2lh(\'FFFF33FF\')', 'returns: ', cssMath.s2lh('FFFF33FF'), '\n',
231 'cssMath.s2lh(\'#F3F\')', 'returns: ', cssMath.s2lh('#F3F'), '\n',
232 'cssMath.s2lh(\'#FF33FF\')', 'returns: ', cssMath.s2lh('#FF33FF'), '\n',
233 'cssMath.s2lh(\'#FF3F\')', 'returns: ', cssMath.s2lh('#FF3F'), '\n',
234 'cssMath.s2lh(\'#FFFF33FF\')', 'returns: ', cssMath.s2lh('#FFFF33FF'), '\n'
54fffcf2 »
2010-03-09 New cssMath tests
235 );
236
237 console.log(
238 'Testing s2c: function (s)', '\n',
239 'String to channels', '\n',
b9e46a08 »
2010-09-30 New stuff for css3please2
240 'cssMath.s2c(\'255, 238, 255\')', 'returns: ', cssMath.s2c('255, 238, 255'), '\n',
241 'cssMath.s2c(\'rgb(255, 238, 255)\')', 'returns: ', cssMath.s2c('rgb(255, 238, 255)'), '\n',
242 'cssMath.s2c(\'rgba(255, 238, 255, 255)\')', 'returns: ', cssMath.s2c('rgba(255, 238, 255, 255)'), '\n',
243 'cssMath.s2c(\'rgb(255, 238, 255, 255)\')', 'returns: ', cssMath.s2c('rgb(255, 238, 255, 255)'), '\n',
244 'cssMath.s2c(\'rgba(255, 238, 255)\')', 'returns: ', cssMath.s2c('rgba(255, 238, 255)'), '\n',
245 'cssMath.s2c(\'F3F\')', 'returns: ', cssMath.s2c('F3F'), '\n',
246 'cssMath.s2c(\'FF33FF\')', 'returns: ', cssMath.s2c('FF33FF'), '\n',
247 'cssMath.s2c(\'FF3F\')', 'returns: ', cssMath.s2c('FF3F'), '\n',
248 'cssMath.s2c(\'FFFF33FF\')', 'returns: ', cssMath.s2c('FFFF33FF'), '\n',
249 'cssMath.s2c(\'#F3F\')', 'returns: ', cssMath.s2c('#F3F'), '\n',
250 'cssMath.s2c(\'#FF33FF\')', 'returns: ', cssMath.s2c('#FF33FF'), '\n',
251 'cssMath.s2c(\'#FF3F\')', 'returns: ', cssMath.s2c('#FF3F'), '\n',
252 'cssMath.s2c(\'#FFFF33FF\')', 'returns: ', cssMath.s2c('#FFFF33FF'), '\n'
253 );
254
255 console.log(
256 'Testing s2x: function (s, m)', '\n',
257 'String of channels, hexadecimals, or units to string and moved', '\n',
258 'cssMath.s2x(\'255, 238, 255\', 17)', 'returns: ', cssMath.s2x('255, 238, 255', 17), '\n',
259 'cssMath.s2x(\'rgb(255, 238, 255)\', 17)', 'returns: ', cssMath.s2x('rgb(255, 238, 255)', 17), '\n',
260 'cssMath.s2x(\'rgba(255, 238, 255, 255)\', 17)', 'returns: ', cssMath.s2x('rgba(255, 238, 255, 255)', 17), '\n',
261 'cssMath.s2x(\'rgb(255, 238, 255, 255)\', 17)', 'returns: ', cssMath.s2x('rgb(255, 238, 255, 255)', 17), '\n',
262 'cssMath.s2x(\'rgba(255, 238, 255)\', 17)', 'returns: ', cssMath.s2x('rgba(255, 238, 255)', 17), '\n',
263 'cssMath.s2x(\'FEF\', 17)', 'returns: ', cssMath.s2x('FEF', 17), '\n',
264 'cssMath.s2x(\'FFEEFF\', 17)', 'returns: ', cssMath.s2x('FFEEFF', 17), '\n',
265 'cssMath.s2x(\'FFEF\', 17)', 'returns: ', cssMath.s2x('FFEF', 17), '\n',
266 'cssMath.s2x(\'FFFFEEFF\', 17)', 'returns: ', cssMath.s2x('FFFFEEFF', 17), '\n',
267 'cssMath.s2x(\'#FEF\', 17)', 'returns: ', cssMath.s2x('#FEF', 17), '\n',
268 'cssMath.s2x(\'#FFEEFF\', 17)', 'returns: ', cssMath.s2x('#FFEEFF', 17), '\n',
269 'cssMath.s2x(\'#FFEF\', 17)', 'returns: ', cssMath.s2x('#FFEF', 17), '\n',
270 'cssMath.s2x(\'#FFFFEEFF\', 17)', 'returns: ', cssMath.s2x('#FFFFEEFF', 17), '\n',
271 'cssMath.s2x(\'1px\', 9)', 'returns: ', cssMath.s2x('1px', 9), '\n',
272 'cssMath.s2x(\'1em\', 9)', 'returns: ', cssMath.s2x('1em', 9), '\n',
273 'cssMath.s2x(\'1%\', 9)', 'returns: ', cssMath.s2x('1%', 9), '\n',
274 'cssMath.s2x(\'1px 1px 11px 1px\', 9)', 'returns: ', cssMath.s2x('1px 1px 11px 1px', 9), '\n',
275 'cssMath.s2x(\'5px 0 10px 15px\', 5)', 'returns: ', cssMath.s2x('5px 0 10px 15px', 5), '\n'
54fffcf2 »
2010-03-09 New cssMath tests
276 );
277
278 console.log(
b9e46a08 »
2010-09-30 New stuff for css3please2
279 'Testing s2sx: function (s, m)', '\n',
280 'String of channels, hexadecimals, or units to short string and moved', '\n',
281 'cssMath.s2sx(\'255, 238, 255\', 17)', 'returns: ', cssMath.s2sx('255, 238, 255', 17), '\n',
282 'cssMath.s2sx(\'rgb(255, 238, 255)\', 17)', 'returns: ', cssMath.s2sx('rgb(255, 238, 255)', 17), '\n',
283 'cssMath.s2sx(\'rgba(255, 238, 255, 255)\', 17)', 'returns: ', cssMath.s2sx('rgba(255, 238, 255, 255)', 17), '\n',
284 'cssMath.s2sx(\'rgb(255, 238, 255, 255)\', 17)', 'returns: ', cssMath.s2sx('rgb(255, 238, 255, 255)', 17), '\n',
285 'cssMath.s2sx(\'rgba(255, 238, 255)\', 17)', 'returns: ', cssMath.s2sx('rgba(255, 238, 255)', 17), '\n',
286 'cssMath.s2sx(\'FEF\', 17)', 'returns: ', cssMath.s2sx('FEF', 17), '\n',
287 'cssMath.s2sx(\'FFEEFF\', 17)', 'returns: ', cssMath.s2sx('FFEEFF', 17), '\n',
288 'cssMath.s2sx(\'FFEF\', 17)', 'returns: ', cssMath.s2sx('FFEF', 17), '\n',
289 'cssMath.s2sx(\'FFFFEEFF\', 17)', 'returns: ', cssMath.s2sx('FFFFEEFF', 17), '\n',
290 'cssMath.s2sx(\'#FEF\', 17)', 'returns: ', cssMath.s2sx('#FEF', 17), '\n',
291 'cssMath.s2sx(\'#FFEEFF\', 17)', 'returns: ', cssMath.s2sx('#FFEEFF', 17), '\n',
292 'cssMath.s2sx(\'#FFEF\', 17)', 'returns: ', cssMath.s2sx('#FFEF', 17), '\n',
293 'cssMath.s2sx(\'#FFFFEEFF\', 17)', 'returns: ', cssMath.s2sx('#FFFFEEFF', 17), '\n',
294 'cssMath.s2sx(\'1px\', 9)', 'returns: ', cssMath.s2sx('1px', 9), '\n',
295 'cssMath.s2sx(\'1em\', 9)', 'returns: ', cssMath.s2sx('1em', 9), '\n',
296 'cssMath.s2sx(\'1%\', 9)', 'returns: ', cssMath.s2sx('1%', 9), '\n',
297 'cssMath.s2sx(\'1px 1px 11px 1px\', 9)', 'returns: ', cssMath.s2sx('1px 1px 11px 1px', 9), '\n',
298 'cssMath.s2sx(\'5px 0 10px 15px\', 5)', 'returns: ', cssMath.s2sx('5px 0 10px 15px', 5), '\n'
54fffcf2 »
2010-03-09 New cssMath tests
299 );
300
301 </script>
302 </head>
303
304 <body></body>
305
306 </html>
Something went wrong with that request. Please try again.