OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <title>Floating point alpha value parssing and serialization</title> | |
sashab
2017/01/06 02:56:16
Do we have lots of other layout tests like this? G
ktyliu
2017/01/08 22:01:09
Removed <title> and fixed documentation in separat
| |
3 <body> | |
4 <script src="../resources/testharness.js"></script> | |
5 <script src="../resources/testharnessreport.js"></script> | |
6 <script> | |
7 test(function() { | |
8 for (var i = 0.0; i <= 1.0; i += 0.01) { | |
9 var rgba = 'rgba(0, 0, 0, ' + parseFloat(i.toFixed(2)) + ')'; | |
10 document.body.style.color = rgba; | |
11 assert_equals(document.body.style.color, rgba); | |
12 assert_equals(getComputedStyle(document.body).color, rgba); | |
13 } | |
14 }, 'Alpha values with two decimals should parse and serialize to the same value' ); | |
sashab
2017/01/06 02:56:16
How about, "Alpha values should parse and serializ
ktyliu
2017/01/08 22:01:09
Done.
| |
15 | |
16 test(function() { | |
17 var testCases = [ | |
18 ['rgba(0, 0, 0, 0.004)', 'rgba(0, 0, 0, 0.004)'], | |
19 ['rgba(0, 0, 0, 0.011)', 'rgba(0, 0, 0, 0.01)'], | |
20 ['rgba(0, 0, 0, 0.016)', 'rgba(0, 0, 0, 0.016)'], | |
21 ['rgba(0, 0, 0, 0.501)', 'rgba(0, 0, 0, 0.5)'] | |
22 ]; | |
23 for (var i = 0; i < testCases.length; ++i) { | |
24 var rgba = testCases[i][0]; | |
25 var expected = testCases[i][1]; | |
26 document.body.style.color = rgba; | |
27 assert_equals(document.body.style.color, expected); | |
28 assert_equals(getComputedStyle(document.body).color, expected); | |
29 } | |
30 }, 'Expected alpha values with three decimals'); | |
sashab
2017/01/06 02:56:16
"Alpha values with three decimals should parse and
ktyliu
2017/01/08 22:01:09
Updated wording and also test cases to highlight t
| |
31 </script> | |
32 | |
OLD | NEW |