Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 212 lines (181 sloc) 8.256 kB
b9e46a0 @mikeescobedo New stuff for css3please2
mikeescobedo authored
1 <!DOCTYPE HTML>
2
3 <html>
4
5 <head>
6 <meta charset="UTF-8" />
7
8 <title>Cross-Browser CSS3 Rule Generator</title>
9
10 <script src="test_math.js" type="text/javascript"></script>
11 <script type="text/javascript">
12
13 /* ---- cssMath Firebug tests ---- */
14
15 console.log(
16 'Testing round: function (n, l)', '\n',
17 'Number rounded by Length', '\n',
18 'cssMath.round(3.1417534)', 'returns: ', cssMath.round(3.1417534), '\n',
19 'cssMath.round(3.1417534, 2)', 'returns: ', cssMath.round(3.1417534, 2), '\n'
20 );
21
22 console.log(
23 'Testing xy2rs: function (x, y)', '\n',
24 'X and Y coordinates to rotation and strength', '\n',
25 'cssMath.xy2rs(4, 4)', 'returns: ', cssMath.xy2rs(4, 4), '\n',
26 'cssMath.xy2rs(10, 15)', 'returns: ', cssMath.xy2rs(10, 15), '\n'
27 );
28
29 console.log(
30 'Testing rs2xy: function (r, s)', '\n',
31 'Rotation and Strength to x and y coordinates', '\n',
32 'cssMath.rs2xy(135, 5.657)', 'returns: ', cssMath.rs2xy(135, 5.657), '\n',
33 'cssMath.rs2xy(146.31, 18.028)', 'returns: ', cssMath.rs2xy(146.31, 18.028), '\n'
34 );
35
36 console.log(
37 'Testing r2d: function (r)', '\n',
38 'Rotation to degree', '\n',
39 'cssMath.r2d(3)', 'returns: ', cssMath.r2d(3), '\n',
40 'cssMath.r2d(3.5)', 'returns: ', cssMath.r2d(3.5), '\n'
41 );
42
43 console.log(
44 'Testing d2r: function (d)', '\n',
45 'Degree to rotation', '\n',
46 'cssMath.d2r(270)', 'returns: ', cssMath.d2r(270), '\n',
47 'cssMath.d2r(315)', 'returns: ', cssMath.d2r(315), '\n'
48 );
49
50 console.log(
51 'Testing lh2sh: function (lh)', '\n',
52 'Long Hexadecimals compressed to short hexadecimals', '\n',
53 'cssMath.lh2sh(\'FF33FF\')', 'returns: ', cssMath.lh2sh('FF33FF'), '\n',
54 'cssMath.lh2sh(\'#FF33FF\')', 'returns: ', cssMath.lh2sh('#FF33FF'), '\n',
55 'cssMath.lh2sh(\'#F3F\')', 'returns: ', cssMath.lh2sh('#F3F'), '\n'
56 );
57
58 console.log(
59 'Testing sh2lh: function (sh)', '\n',
60 'Short Hexadecimals expanded to long hexadecimals', '\n',
61 'cssMath.sh2lh(\'F3F\')', 'returns: ', cssMath.sh2lh('F3F'), '\n',
62 'cssMath.lh2sh(\'#F3F\')', 'returns: ', cssMath.sh2lh('#F3F'), '\n',
63 'cssMath.lh2sh(\'#FF33FF\')', 'returns: ', cssMath.sh2lh('#FF33FF'), '\n'
64 );
65
66 console.log(
67 'Testing c2h: function (c)', '\n',
68 'Channel to hexadecimal', '\n',
69 'cssMath.c2h(255)', 'returns: ', cssMath.c2h(255), '\n',
70 'cssMath.c2h(0)', 'returns: ', cssMath.c2h(0), '\n'
71 );
72
73 console.log(
74 'Testing h2c: function (c)', '\n',
75 'Hexadecimal to channel', '\n',
76 'cssMath.h2c(\'FF\')', 'returns: ', cssMath.h2c('FF'), '\n',
77 'cssMath.h2c(\'00\')', 'returns: ', cssMath.h2c('00'), '\n'
78 );
79
80 console.log(
81 'Testing c2a: function (c)', '\n',
82 'Channels to array', '\n',
83 'cssMath.c2a(\'255, 0, 255\')', 'returns: ', cssMath.c2a('255, 0, 255'), '\n',
84 'cssMath.c2a(\'255,0,255\')', 'returns: ', cssMath.c2a('255,0,255'), '\n',
85 'cssMath.c2a(\'(255,0,255)\')', 'returns: ', cssMath.c2a('(255,0,255)'), '\n',
86 'cssMath.c2a(\'rgb(255,0,255)\')', 'returns: ', cssMath.c2a('rgb(255,0,255)'), '\n',
87 'cssMath.c2a(\'rgb ( 255 , 0 , 255 )\')', 'returns: ', cssMath.c2a('rgb ( 255 , 0 , 255 )'), '\n'
88 );
89
90 console.log(
91 'Testing h2a: function (c)', '\n',
92 'Hexadecimals to array', '\n',
93 'cssMath.h2a(\'FF00FF\')', 'returns: ', cssMath.h2a('FF00FF'), '\n',
94 'cssMath.h2a(\'#FF00FF\')', 'returns: ', cssMath.h2a('#FF00FF'), '\n',
95 'cssMath.h2a(\'#F0F\')', 'returns: ', cssMath.h2a('#F0F'), '\n',
96 'cssMath.h2a(\'F0F\')', 'returns: ', cssMath.h2a('F0F'), '\n'
97 );
98
99 console.log(
100 'Testing c2h2: function (c)', '\n',
101 'Channels to hexadecimals', '\n',
102 'cssMath.c2h2(\'255, 0, 255\')', 'returns: ', cssMath.c2h2('255, 0, 255'), '\n',
103 'cssMath.c2h2(\'255,0,255\')', 'returns: ', cssMath.c2h2('255,0,255'), '\n',
104 'cssMath.c2h2(\'(255,0,255)\')', 'returns: ', cssMath.c2h2('(255,0,255)'), '\n',
105 'cssMath.c2h2(\'rgb(255,0,255)\')', 'returns: ', cssMath.c2h2('rgb(255,0,255)'), '\n',
106 'cssMath.c2h2(\'rgb ( 255 , 0 , 255 )\')', 'returns: ', cssMath.c2h2('rgb ( 255 , 0 , 255 )'), '\n'
107 );
108
109 console.log(
110 'Testing h2c2: function (h)', '\n',
111 'Hexadecimals to channels', '\n',
112 'cssMath.h2c2(\'FF00FF\')', 'returns: ', cssMath.h2c2('FF00FF'), '\n',
113 'cssMath.h2c2(\'#FF00FF\')', 'returns: ', cssMath.h2c2('#FF00FF'), '\n',
114 'cssMath.h2c2(\'#F0F\')', 'returns: ', cssMath.h2c2('#F0F'), '\n',
115 'cssMath.h2c2(\'F0F\')', 'returns: ', cssMath.h2c2('F0F'), '\n'
116 );
117
118 console.log(
119 'Testing cf: function (c)', '\n',
120 'Channels proper formatting', '\n',
121 'cssMath.cf(\'255, 0, 255\')', 'returns: ', cssMath.cf('255, 0, 255'), '\n',
122 'cssMath.cf(\'255,0,255\')', 'returns: ', cssMath.cf('255,0,255'), '\n',
123 'cssMath.cf(\'(255,0,255)\')', 'returns: ', cssMath.cf('(255,0,255)'), '\n',
124 'cssMath.cf(\'rgb(255,0,255)\')', 'returns: ', cssMath.cf('rgb(255,0,255)'), '\n',
125 'cssMath.cf(\'rgb ( 255 , 0 , 255 )\')', 'returns: ', cssMath.cf('rgb ( 255 , 0 , 255 )'), '\n',
126 'cssMath.cf(\'255, 0, 255, 204\')', 'returns: ', cssMath.cf('255, 0, 255, 204'), '\n',
127 'cssMath.cf(\'255,0,255,204\')', 'returns: ', cssMath.cf('255,0,255,204'), '\n',
128 'cssMath.cf(\'(255,0,255,204)\')', 'returns: ', cssMath.cf('(255,0,255,204)'), '\n',
129 'cssMath.cf(\'rgb(255,0,255,204)\')', 'returns: ', cssMath.cf('rgb(255,0,255,204)'), '\n',
130 'cssMath.cf(\'rgb ( 255 , 0 , 255 , 204)\')', 'returns: ', cssMath.cf('rgb ( 255 , 0 , 255 , 204)'), '\n'
131 );
132
133 console.log(
134 'Testing hf: function (h)', '\n',
135 'Hexadecimals proper formatting', '\n',
136 'cssMath.hf(\'FF00FF\')', 'returns: ', cssMath.hf('FF00FF'), '\n',
137 'cssMath.hf(\'#FF00FF\')', 'returns: ', cssMath.hf('#FF00FF'), '\n',
138 'cssMath.hf(\'#F0F\')', 'returns: ', cssMath.hf('#F0F'), '\n',
139 'cssMath.hf(\'F0F\')', 'returns: ', cssMath.hf('F0F'), '\n',
140 'cssMath.hf(\'CCFF00FF\')', 'returns: ', cssMath.hf('CCFF00FF'), '\n',
141 'cssMath.hf(\'CF0F\')', 'returns: ', cssMath.hf('CF0F'), '\n'
142 );
143
144 console.log(
145 'Testing cm: function (c, m)', '\n',
146 'Channel Move', '\n',
147 'cssMath.cm(254, 1)', 'returns: ', cssMath.cm(254, 1), '\n',
148 'cssMath.cm(253, 2)', 'returns: ', cssMath.cm(253, 2), '\n',
149 'cssMath.cm(255, -51)', 'returns: ', cssMath.cm(255, -51), '\n'
150 );
151
152 console.log(
153 'Testing hm: function (h, m)', '\n',
154 'Hexadecimal Move', '\n',
155 'cssMath.hm(\'FE\', 1)', 'returns: ', cssMath.hm('FE', 1), '\n',
156 'cssMath.hm(\'FD\', 2)', 'returns: ', cssMath.hm('FD', 2), '\n',
157 'cssMath.hm(\'FF\', -51)', 'returns: ', cssMath.hm('FF', -51), '\n'
158 );
159
160 console.log(
161 'Testing cm2: function (c, m)', '\n',
162 'Channels Move', '\n',
163 'cssMath.cm2(\'254, 254, 254\', 1)', 'returns: ', cssMath.cm2('254, 254, 254', 1), '\n',
164 'cssMath.cm2(\'253, 253, 253\', 2)', 'returns: ', cssMath.cm2('253, 253, 253', 2), '\n',
165 'cssMath.cm2(\'255, 255, 255\', -51)', 'returns: ', cssMath.cm2('255, 255, 255', -51), '\n'
166 );
167
168 console.log(
169 'Testing hm2: function (h, m)', '\n',
170 'Hexadecimals Move', '\n',
171 'cssMath.hm2(\'FEFEFE\', 1)', 'returns: ', cssMath.hm2('FEFEFE', 1), '\n',
172 'cssMath.hm2(\'FDFDFD\', 2)', 'returns: ', cssMath.hm2('FDFDFD', 2), '\n',
173 'cssMath.hm2(\'FFFFFF\', -51)', 'returns: ', cssMath.hm2('FFFFFF', -51), '\n'
174 );
175
176 console.log(
177 'Testing s2sh: function (s)', '\n',
178 'String to short hexadecimal', '\n',
179 'cssMath.s2sh(\'255, 255, 255\', 1)', 'returns: ', cssMath.s2sh('255, 255, 255'), '\n'
180 );
181
182 console.log(
183 'Testing s2lh: function (s)', '\n',
184 'String to long hexadecimal', '\n',
185 'cssMath.s2lh(\'255, 51, 255\', 1)', 'returns: ', cssMath.s2lh('255, 51, 255'), '\n',
186 'cssMath.s2lh(\'255, 51, 255, 204\', 1)', 'returns: ', cssMath.s2lh('255, 51, 255, 204'), '\n',
187 'cssMath.s2lh(\'rgb (255, 51, 255, 204)\', 1)', 'returns: ', cssMath.s2lh('rgb (255, 51, 255, 204)'), '\n',
188 'cssMath.s2lh(\'rgba (255, 51, 255)\', 1)', 'returns: ', cssMath.s2lh('rgba (255, 51, 255)'), '\n'
189 );
190
191 console.log(
192 'Testing s2c: function (s)', '\n',
193 'String to channels', '\n',
194 'cssMath.s2c(\'FF33FF\', 1)', 'returns: ', cssMath.s2c('FF33FF'), '\n',
195 'cssMath.s2c(\'#FF33FF\', 1)', 'returns: ', cssMath.s2c('#FF33FF'), '\n',
196 'cssMath.s2c(\'CCFF33FF\', 1)', 'returns: ', cssMath.s2c('CCFF33FF'), '\n',
197 'cssMath.s2c(\'#CCFF33FF\', 1)', 'returns: ', cssMath.s2c('#CCFF33FF'), '\n'
198 );
199
cd172e4 small RGB input problem fix
Max Degterev authored
200 // No such function in javascript.js - not sure if this test is relevant
201 // console.log(
202 // 'Testing s2xm: function (s)', '\n',
203 // 'String to channels, hexadecimals, or units Moved', '\n',
204 // 'cssMath.s2xm(\'FFFEFF\', 1)', 'returns: ', cssMath.s2xm('FFFEFF', 1), '\n'
205 // );
b9e46a0 @mikeescobedo New stuff for css3please2
mikeescobedo authored
206
207 </script>
208 </head>
209
210 <body></body>
211
212 </html>
Something went wrong with that request. Please try again.