Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(580)

Unified Diff: third_party/WebKit/LayoutTests/typedcssom/cssSkew.html

Issue 2921243002: [CSS Typed OM] Add setters for the CSSNumericValues contained in CSSSkew (Closed)
Patch Set: Rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/typedcssom/cssSkew.html
diff --git a/third_party/WebKit/LayoutTests/typedcssom/cssSkew.html b/third_party/WebKit/LayoutTests/typedcssom/cssSkew.html
index 90afee5f415d768208162e1f772da202679fe02d..70b35a65c29521068e1f483c62346923fa967f52 100644
--- a/third_party/WebKit/LayoutTests/typedcssom/cssSkew.html
+++ b/third_party/WebKit/LayoutTests/typedcssom/cssSkew.html
@@ -12,6 +12,16 @@ function tanDegrees(degrees) {
return Math.tan(radians);
}
+function assert_array_approx_equals(actual, expected) {
+ for (var i = 0; i < actual.length; i++) {
+ assert_approx_equals(actual[i], expected[i], EPSILON);
+ }
+}
+
+function assert_matrix_approx_equals(actual, expected) {
+ assert_array_approx_equals(actual.toFloat64Array(), expected.toFloat64Array());
+}
+
var values = [
{input: new CSSSkew(angle(0), angle(0)), ax: 0, ay: 0, cssText: "skew(0deg, 0deg)"},
{input: new CSSSkew(angle(1), angle(2)), ax: 1, ay: 2, cssText: "skew(1deg, 2deg)"},
@@ -66,14 +76,31 @@ test(function() {
}
}, "asMatrix is constructed correctly for CSSSkew.");
-function assert_array_approx_equals(actual, expected) {
- for (var i = 0; i < actual.length; i++) {
- assert_approx_equals(actual[i], expected[i], EPSILON);
- }
-}
+test(function() {
+ var skew = new CSSSkew(new CSSUnitValue(1, 'deg'), new CSSUnitValue(2, 'deg'));
+ skew.ax = new CSSUnitValue(3, 'deg');
+ skew.ay = new CSSUnitValue(3, 'rad');
-function assert_matrix_approx_equals(actual, expected) {
- assert_array_approx_equals(actual.toFloat64Array(), expected.toFloat64Array());
+ assert_equals(skew.ax.value, 3);
+ assert_equals(skew.ay.value, 3);
+ assert_equals(skew.ax.unit, 'deg');
+ assert_equals(skew.ay.unit, 'rad');
+}, "Setting ax and ay for CSSSkew with valid CSSUnitValues");
+
+for (let a of ['ax', 'ay']) {
+ test(() => {
+ var skew = new CSSSkew(
+ new CSSUnitValue(1, 'deg'), new CSSUnitValue(2, 'deg'));
+ assert_throws(new TypeError(), () => {
+ skew[a] = new CSSUnitValue(1, 'px');
+ });
+ assert_throws(new TypeError(), () => {
+ skew[a] = 'bananas';
+ });
+ assert_throws(new TypeError(), () => {
+ skew[a] = null;
+ });
+ }, "Setting " + a + " with invalid values");
}
</script>

Powered by Google App Engine
This is Rietveld 408576698