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

Unified Diff: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedPreserveAspectRatio.html

Issue 2705293005: Convert LayoutTests/svg/dom/SVGAnimated*.html js-tests.js to testharness.js based tests. (Closed)
Patch Set: Align with review comments Created 3 years, 10 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/svg/dom/SVGAnimatedPreserveAspectRatio.html
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedPreserveAspectRatio.html b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedPreserveAspectRatio.html
index 617929b57d5d17e129dba80316c8ffc37e67c4af..1e0f2233ddfcd963ff857567577b9b0a8db8b99f 100644
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedPreserveAspectRatio.html
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedPreserveAspectRatio.html
@@ -1,11 +1,41 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src="../../resources/js-test.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-<script src="script-tests/SVGAnimatedPreserveAspectRatio.js"></script>
-</body>
-</html>
+<!DOCTYPE HTML>
+<title>SVGAnimatedPreserveAspectRatio interface - utilizing the preserveAspectRatio property of SVGSVGElement</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ // This test checks the SVGAnimatedPreserveAspectRatio API - utilizing the preserveAspectRatio property of SVGSVGElement.
+
+ var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
+
+ // Check initial preserveAspectRatio value.
+ assert_true(svgElement.preserveAspectRatio instanceof SVGAnimatedPreserveAspectRatio);
+ assert_true(svgElement.preserveAspectRatio.baseVal instanceof SVGPreserveAspectRatio);
+ assert_equals(svgElement.preserveAspectRatio.baseVal.align, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID);
+ assert_equals(svgElement.preserveAspectRatio.baseVal.meetOrSlice, SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET);
+
+ // Check that preserveAspectRatios are dynamic, caching value in a local variable and modifying it, should take effect;
+ var aspectRef = svgElement.preserveAspectRatio.baseVal;
+ aspectRef.align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN;
+ aspectRef.meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE;
+ assert_equals(aspectRef.align, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN);
+ assert_equals(aspectRef.meetOrSlice, SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE);
+ assert_equals(svgElement.preserveAspectRatio.baseVal.align, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN);
+ assert_equals(svgElement.preserveAspectRatio.baseVal.meetOrSlice, SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE);
+
+ // Check that assigning to baseVal has no effect, as no setter is defined.
+ // And the preserveAspectRatio align/meetOrSlice remained xMaxYMin/slice.
+ svgElement.preserveAspectRatio.baseVal = -1;
+ assert_equals(svgElement.preserveAspectRatio.baseVal.align, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN);
+ assert_equals(svgElement.preserveAspectRatio.baseVal.meetOrSlice, SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE);
+ svgElement.preserveAspectRatio.baseVal = 'aString';
+ assert_equals(svgElement.preserveAspectRatio.baseVal.align, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN);
+ assert_equals(svgElement.preserveAspectRatio.baseVal.meetOrSlice, SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE);
+ svgElement.preserveAspectRatio.baseVal = svgElement;
+ assert_equals(svgElement.preserveAspectRatio.baseVal.align, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN);
+ assert_equals(svgElement.preserveAspectRatio.baseVal.meetOrSlice, SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE);
+
+ // Check that the preserveAspectRatio baseVal type has not been changed.
+ assert_true(svgElement.preserveAspectRatio.baseVal instanceof SVGPreserveAspectRatio);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698