| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <div id="test-div" style="font-size: 10pt; -webkit-transform: rotate(100grad); -
webkit-animation-delay: 0.2s;"></div> | 7 <div id="test-div" style="font-size: 10pt; transform: rotate(100grad); -webkit-a
nimation-delay: 0.2s;"></div> |
| 8 <script> | 8 <script> |
| 9 if (window.testRunner) | 9 if (window.testRunner) |
| 10 testRunner.dumpAsText(); | 10 testRunner.dumpAsText(); |
| 11 | 11 |
| 12 description("Testing whether CSSPrimitiveValue.getFloatValue() converts units co
rrectly."); | 12 description("Testing whether CSSPrimitiveValue.getFloatValue() converts units co
rrectly."); |
| 13 | 13 |
| 14 function getFloatValue(nestLevel, propertyName, unit) | 14 function getFloatValue(nestLevel, propertyName, unit) |
| 15 { | 15 { |
| 16 var value = document.getElementById("test-div").style.getPropertyCSSValue(pr
opertyName); | 16 var value = document.getElementById("test-div").style.getPropertyCSSValue(pr
opertyName); |
| 17 while (nestLevel--) | 17 while (nestLevel--) |
| 18 value = value[0]; | 18 value = value[0]; |
| 19 return Number(value.getFloatValue(unit).toFixed(6)); | 19 return Number(value.getFloatValue(unit).toFixed(6)); |
| 20 } | 20 } |
| 21 | 21 |
| 22 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_PT)", "10"); | 22 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_PT)", "10"); |
| 23 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_MM)", "3.527778"); | 23 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_MM)", "3.527778"); |
| 24 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_CM)", "0.352778"); | 24 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_CM)", "0.352778"); |
| 25 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_IN)", "0.138889"); | 25 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_IN)", "0.138889"); |
| 26 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_PC)", "0.833333"); | 26 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_PC)", "0.833333"); |
| 27 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_PX)", "13.333333")
; | 27 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_PX)", "13.333333")
; |
| 28 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_NUMBER)", "13.3333
33"); | 28 shouldBe("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_NUMBER)", "13.3333
33"); |
| 29 shouldBe("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_DEG)", "90
"); | 29 shouldBe("getFloatValue(2, 'transform', CSSPrimitiveValue.CSS_DEG)", "90"); |
| 30 shouldBe("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_RAD)", "1.
570796"); | 30 shouldBe("getFloatValue(2, 'transform', CSSPrimitiveValue.CSS_RAD)", "1.570796")
; |
| 31 shouldBe("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_GRAD)", "1
00"); | 31 shouldBe("getFloatValue(2, 'transform', CSSPrimitiveValue.CSS_GRAD)", "100"); |
| 32 shouldBe("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_NUMBER)",
"90"); | 32 shouldBe("getFloatValue(2, 'transform', CSSPrimitiveValue.CSS_NUMBER)", "90"); |
| 33 shouldBe("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_MS)"
, "200"); | 33 shouldBe("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_MS)"
, "200"); |
| 34 shouldBe("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_S)",
"0.2"); | 34 shouldBe("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_S)",
"0.2"); |
| 35 shouldBe("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_NUMB
ER)", "200"); | 35 shouldBe("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_NUMB
ER)", "200"); |
| 36 | 36 |
| 37 shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_PERCENTAGE)"); | 37 shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_PERCENTAGE)"); |
| 38 shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_MS)"); | 38 shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_MS)"); |
| 39 shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_HZ)"); | 39 shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_HZ)"); |
| 40 shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_DEG)"); | 40 shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_DEG)"); |
| 41 shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_RGBCOLOR)"); | 41 shouldThrow("getFloatValue(0, 'font-size', CSSPrimitiveValue.CSS_RGBCOLOR)"); |
| 42 | 42 |
| 43 shouldThrow("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_PERCENT
AGE)"); | 43 shouldThrow("getFloatValue(2, 'transform', CSSPrimitiveValue.CSS_PERCENTAGE)"); |
| 44 shouldThrow("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_PX)"); | 44 shouldThrow("getFloatValue(2, 'transform', CSSPrimitiveValue.CSS_PX)"); |
| 45 shouldThrow("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_MS)"); | 45 shouldThrow("getFloatValue(2, 'transform', CSSPrimitiveValue.CSS_MS)"); |
| 46 shouldThrow("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_HZ)"); | 46 shouldThrow("getFloatValue(2, 'transform', CSSPrimitiveValue.CSS_HZ)"); |
| 47 shouldThrow("getFloatValue(2, '-webkit-transform', CSSPrimitiveValue.CSS_RGBCOLO
R)"); | 47 shouldThrow("getFloatValue(2, 'transform', CSSPrimitiveValue.CSS_RGBCOLOR)"); |
| 48 | 48 |
| 49 shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_P
ERCENTAGE)"); | 49 shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_P
ERCENTAGE)"); |
| 50 shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_P
X)"); | 50 shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_P
X)"); |
| 51 shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_D
EG)"); | 51 shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_D
EG)"); |
| 52 shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_H
Z)"); | 52 shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_H
Z)"); |
| 53 shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_R
GBCOLOR)"); | 53 shouldThrow("getFloatValue(1, '-webkit-animation-delay', CSSPrimitiveValue.CSS_R
GBCOLOR)"); |
| 54 </script> | 54 </script> |
| 55 </body> | 55 </body> |
| OLD | NEW |