OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Tests that all of the input values for stroke-width parse correctly</titl
e> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <body style="font-size:10px;"></body> |
| 6 <script> |
| 7 function assert_stroke_width_property_value(value, expected) |
| 8 { |
| 9 var div = document.createElement("div"); |
| 10 div.setAttribute("style", value); |
| 11 document.body.appendChild(div); |
| 12 |
| 13 var result = div.style.getPropertyValue("stroke-width"); |
| 14 assert_equals(result, expected); |
| 15 document.body.removeChild(div); |
| 16 } |
| 17 |
| 18 function assert_get_computed_style(value, expected) |
| 19 { |
| 20 var div = document.createElement("div"); |
| 21 div.setAttribute("style", value); |
| 22 document.body.appendChild(div); |
| 23 |
| 24 var result = window.getComputedStyle(div).strokeWidth; |
| 25 assert_equals(result, expected); |
| 26 document.body.removeChild(div); |
| 27 } |
| 28 |
| 29 function assert_get_computed_style_inherited(value, expected) |
| 30 { |
| 31 var div = document.createElement("div"); |
| 32 div.setAttribute("style", value); |
| 33 |
| 34 var div2 = document.createElement("div"); |
| 35 div.appendChild(div2); |
| 36 |
| 37 document.body.appendChild(div); |
| 38 |
| 39 var result = window.getComputedStyle(div2).strokeWidth; |
| 40 assert_equals(result, expected); |
| 41 document.body.removeChild(div); |
| 42 } |
| 43 |
| 44 test(function(){ |
| 45 assert_get_computed_style_inherited("stroke-width: 4px;", "4px"); |
| 46 assert_get_computed_style_inherited("stroke-width: 1em;", "10px"); |
| 47 assert_get_computed_style_inherited("stroke-width: 10%;", "10%"); |
| 48 |
| 49 assert_get_computed_style(";", "1px"); |
| 50 assert_stroke_width_property_value("stroke-width: 4px;", "4px"); |
| 51 assert_stroke_width_property_value("stroke-width: 0.01em;", "0.01em"); |
| 52 assert_stroke_width_property_value("stroke-width: 10%;", "10%"); |
| 53 |
| 54 assert_stroke_width_property_value("stroke-width: 4;", "4"); |
| 55 assert_stroke_width_property_value("stroke-width: em;", ""); |
| 56 assert_stroke_width_property_value("stroke-width: %;", ""); |
| 57 }); |
| 58 </script> |
OLD | NEW |