Index: third_party/WebKit/LayoutTests/typedcssom/perspectiveTransformComponent.html |
diff --git a/third_party/WebKit/LayoutTests/typedcssom/perspectiveTransformComponent.html b/third_party/WebKit/LayoutTests/typedcssom/perspectiveTransformComponent.html |
index eac86631917951972ccfb97cf20907b535794f0e..8b3e1697170e8373c4f47cc580825f3c8b6b127c 100644 |
--- a/third_party/WebKit/LayoutTests/typedcssom/perspectiveTransformComponent.html |
+++ b/third_party/WebKit/LayoutTests/typedcssom/perspectiveTransformComponent.html |
@@ -10,20 +10,72 @@ test(function() { |
}, "Constructor should throw an error for CalcLengths with a percentage type"); |
test(function() { |
- var simpleLength = new SimpleLength(10, 'percent'); |
+ var simpleLength = new SimpleLength(10, "percent"); |
assert_throws(null, function() { new Perspective(simpleLength) }); |
}, "Constructor should throw an error for SimpleLengths with a percentage type"); |
test(function() { |
- var simpleLength = new SimpleLength(10, 'px'); |
+ var simpleLength = new SimpleLength(10, "px"); |
var calcLength = new CalcLength({px: 10, em: 3.2}); |
var perspectiveTransformSimple = new Perspective(simpleLength); |
var perspectiveTransformCalc = new Perspective(calcLength); |
- assert_equals(perspectiveTransformSimple.cssString, 'perspective(10px)'); |
- assert_equals(perspectiveTransformCalc.cssString,'perspective(calc(3.2em + 10px))'); |
+ assert_equals(perspectiveTransformSimple.cssString, "perspective(10px)"); |
+ assert_equals(perspectiveTransformCalc.cssString,"perspective(calc(3.2em + 10px))"); |
}, "cssString should return a string of form perspective(<LengthValue.cssString()>)"); |
+test(function() { |
+ var nonRelativeTypes = ["px", "cm", "mm", "in", "pc", "pt"]; |
+ for (var i = 0; i < nonRelativeTypes.length; ++i) { |
+ var simpleLength = new SimpleLength(1, nonRelativeTypes[i]); |
+ var perspective = new Perspective(simpleLength); |
+ perspective.asMatrix(); |
+ } |
+}, "asMatrix does not throw an exception for SimpleLength non-relative types"); |
+ |
+test(function() { |
+ var supportedRelativeTypes = ["ch", "em", "ex", "rem", "vw", "vh", "vmin", "vmax"]; |
+ for (var i = 0; i < supportedRelativeTypes.length; ++i) { |
+ var simpleLength = new SimpleLength(1, supportedRelativeTypes[i]); |
+ var perspective = new Perspective(simpleLength); |
+ assert_throws(null, function() { perspective.asMatrix() }); |
+ } |
+}, "asMatrix throws an exception for SimpleLength relative types"); |
+ |
+test(function() { |
+ var calcLengths = [ |
+ new CalcLength({px: 10, cm: -2}), |
+ new CalcLength({mm: -7.0, in: 0.1}), |
+ new CalcLength({pc: -4, pt: 2, px: 0, cm: 3, mm: 2, in: -4}) |
+ ]; |
+ |
+ for (var i = 0; i < calcLengths.length; ++i) { |
+ var perspective = new Perspective(calcLengths[i]); |
+ perspective.asMatrix(); |
+ } |
+}, "asMatrix does not throw an exception for CalcLength non-relative types"); |
+ |
+test(function() { |
+ var calcLengths = [ |
+ new CalcLength({ch: 1}), |
+ new CalcLength({em: 1}), |
+ new CalcLength({ex: 1}), |
+ new CalcLength({rem: 1}), |
+ new CalcLength({vw: 1}), |
+ new CalcLength({vh: 1}), |
+ new CalcLength({vmin: 1}), |
+ new CalcLength({vmax: 1}), |
+ new CalcLength({px: 10, ch: -4}), |
+ new CalcLength({px: 1, em: 0, ex: 0, rem: 0}), |
+ new CalcLength({px: -2, vw: 2, vh: 0, vmin: 3, vmax: 2}) |
+ ]; |
+ |
+ for (var i = 0; i < calcLengths.length; ++i) { |
+ var perspective = new Perspective(calcLengths[i]); |
+ assert_throws(null, function() { perspective.asMatrix() }); |
+ } |
+}, "asMatrix throws an exception for CalcLength relative types"); |
+ |
</script> |
<body> |