| 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; -webkit-transform: rotate(100grad); -
webkit-animation-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 var invalidAccessError = "InvalidAccessError: A parameter or an operation was no
t supported by the underlying object."; | |
| 13 | |
| 14 description("Testing whether CSSPrimitiveValue.getFloatValue() converts units co
rrectly."); | 12 description("Testing whether CSSPrimitiveValue.getFloatValue() converts units co
rrectly."); |
| 15 | 13 |
| 16 function getFloatValue(propertyName, unit) | 14 function getFloatValue(propertyName, unit) |
| 17 { | 15 { |
| 18 var result = document.getElementById("test-div").style.getPropertyCSSValue(p
ropertyName).getFloatValue(unit); | 16 var result = document.getElementById("test-div").style.getPropertyCSSValue(p
ropertyName).getFloatValue(unit); |
| 19 return Number(result.toFixed(6)); | 17 return Number(result.toFixed(6)); |
| 20 } | 18 } |
| 21 | 19 |
| 22 function getFirstFloatValueInList(propertyName, unit) | 20 function getFirstFloatValueInList(propertyName, unit) |
| 23 { | 21 { |
| 24 var result = document.getElementById("test-div").style.getPropertyCSSValue(p
ropertyName)[0][0].getFloatValue(unit); | 22 var result = document.getElementById("test-div").style.getPropertyCSSValue(p
ropertyName)[0][0].getFloatValue(unit); |
| 25 return Number(result.toFixed(6)); | 23 return Number(result.toFixed(6)); |
| 26 } | 24 } |
| 27 | 25 |
| 28 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_PT)", "10"); | 26 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_PT)", "10"); |
| 29 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_MM)", "3.527778"); | 27 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_MM)", "3.527778"); |
| 30 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_CM)", "0.352778"); | 28 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_CM)", "0.352778"); |
| 31 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_IN)", "0.138889"); | 29 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_IN)", "0.138889"); |
| 32 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_PC)", "0.833333"); | 30 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_PC)", "0.833333"); |
| 33 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_PX)", "13.333333"); | 31 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_PX)", "13.333333"); |
| 34 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_NUMBER)", "13.333333"
); | 32 shouldBe("getFloatValue('font-size', CSSPrimitiveValue.CSS_NUMBER)", "13.333333"
); |
| 35 shouldBe("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_DE
G)", "90"); | 33 shouldBe("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_DE
G)", "90"); |
| 36 shouldBe("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_RA
D)", "1.570796"); | 34 shouldBe("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_RA
D)", "1.570796"); |
| 37 shouldBe("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_GR
AD)", "100"); | 35 shouldBe("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_GR
AD)", "100"); |
| 38 shouldBe("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_NU
MBER)", "90"); | 36 shouldBe("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS_NU
MBER)", "90"); |
| 39 shouldBe("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_MS)", "
200"); | 37 shouldBe("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_MS)", "
200"); |
| 40 shouldBe("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_S)", "0
.2"); | 38 shouldBe("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_S)", "0
.2"); |
| 41 shouldBe("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_NUMBER)
", "200"); | 39 shouldBe("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_NUMBER)
", "200"); |
| 42 | 40 |
| 43 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_PERCENTAGE)", "inv
alidAccessError"); | 41 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_PERCENTAGE)"); |
| 44 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_MS)", "invalidAcce
ssError"); | 42 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_MS)"); |
| 45 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_HZ)", "invalidAcce
ssError"); | 43 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_HZ)"); |
| 46 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_DEG)", "invalidAcc
essError"); | 44 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_DEG)"); |
| 47 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_RGBCOLOR)", "inval
idAccessError"); | 45 shouldThrow("getFloatValue('font-size', CSSPrimitiveValue.CSS_RGBCOLOR)"); |
| 48 | 46 |
| 49 shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS
_PERCENTAGE)", "invalidAccessError"); | 47 shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS
_PERCENTAGE)"); |
| 50 shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS
_PX)", "invalidAccessError"); | 48 shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS
_PX)"); |
| 51 shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS
_MS)", "invalidAccessError"); | 49 shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS
_MS)"); |
| 52 shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS
_HZ)", "invalidAccessError"); | 50 shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS
_HZ)"); |
| 53 shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS
_RGBCOLOR)", "invalidAccessError"); | 51 shouldThrow("getFirstFloatValueInList('-webkit-transform', CSSPrimitiveValue.CSS
_RGBCOLOR)"); |
| 54 | 52 |
| 55 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_PERC
ENTAGE)", "invalidAccessError"); | 53 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_PERC
ENTAGE)"); |
| 56 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_PX)"
, "invalidAccessError"); | 54 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_PX)"
); |
| 57 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_DEG)
", "invalidAccessError"); | 55 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_DEG)
"); |
| 58 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_HZ)"
, "invalidAccessError"); | 56 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_HZ)"
); |
| 59 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_RGBC
OLOR)", "invalidAccessError"); | 57 shouldThrow("getFloatValue('-webkit-animation-delay', CSSPrimitiveValue.CSS_RGBC
OLOR)"); |
| 60 </script> | 58 </script> |
| 61 </body> | 59 </body> |
| OLD | NEW |