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

Side by Side 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML>
2 <html> 2 <title>SVGAnimatedPreserveAspectRatio interface - utilizing the preserveAspectRa tio property of SVGSVGElement</title>
3 <head> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 </head> 5 <script>
6 <body> 6 test(function() {
7 <p id="description"></p> 7 // This test checks the SVGAnimatedPreserveAspectRatio API - utilizing the pre serveAspectRatio property of SVGSVGElement.
8 <div id="console"></div> 8
9 <script src="script-tests/SVGAnimatedPreserveAspectRatio.js"></script> 9 var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg") ;
10 </body> 10
11 </html> 11 // Check initial preserveAspectRatio value.
12 assert_true(svgElement.preserveAspectRatio instanceof SVGAnimatedPreserveAspec tRatio);
13 assert_true(svgElement.preserveAspectRatio.baseVal instanceof SVGPreserveAspec tRatio);
14 assert_equals(svgElement.preserveAspectRatio.baseVal.align, SVGPreserveAspectR atio.SVG_PRESERVEASPECTRATIO_XMIDYMID);
15 assert_equals(svgElement.preserveAspectRatio.baseVal.meetOrSlice, SVGPreserveA spectRatio.SVG_MEETORSLICE_MEET);
16
17 // Check that preserveAspectRatios are dynamic, caching value in a local varia ble and modifying it, should take effect;
18 var aspectRef = svgElement.preserveAspectRatio.baseVal;
19 aspectRef.align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN;
20 aspectRef.meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE;
21 assert_equals(aspectRef.align, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_ XMAXYMIN);
22 assert_equals(aspectRef.meetOrSlice, SVGPreserveAspectRatio.SVG_MEETORSLICE_SL ICE);
23 assert_equals(svgElement.preserveAspectRatio.baseVal.align, SVGPreserveAspectR atio.SVG_PRESERVEASPECTRATIO_XMAXYMIN);
24 assert_equals(svgElement.preserveAspectRatio.baseVal.meetOrSlice, SVGPreserveA spectRatio.SVG_MEETORSLICE_SLICE);
25
26 // Check that assigning to baseVal has no effect, as no setter is defined.
27 // And the preserveAspectRatio align/meetOrSlice remained xMaxYMin/slice.
28 svgElement.preserveAspectRatio.baseVal = -1;
29 assert_equals(svgElement.preserveAspectRatio.baseVal.align, SVGPreserveAspectR atio.SVG_PRESERVEASPECTRATIO_XMAXYMIN);
30 assert_equals(svgElement.preserveAspectRatio.baseVal.meetOrSlice, SVGPreserveA spectRatio.SVG_MEETORSLICE_SLICE);
31 svgElement.preserveAspectRatio.baseVal = 'aString';
32 assert_equals(svgElement.preserveAspectRatio.baseVal.align, SVGPreserveAspectR atio.SVG_PRESERVEASPECTRATIO_XMAXYMIN);
33 assert_equals(svgElement.preserveAspectRatio.baseVal.meetOrSlice, SVGPreserveA spectRatio.SVG_MEETORSLICE_SLICE);
34 svgElement.preserveAspectRatio.baseVal = svgElement;
35 assert_equals(svgElement.preserveAspectRatio.baseVal.align, SVGPreserveAspectR atio.SVG_PRESERVEASPECTRATIO_XMAXYMIN);
36 assert_equals(svgElement.preserveAspectRatio.baseVal.meetOrSlice, SVGPreserveA spectRatio.SVG_MEETORSLICE_SLICE);
37
38 // Check that the preserveAspectRatio baseVal type has not been changed.
39 assert_true(svgElement.preserveAspectRatio.baseVal instanceof SVGPreserveAspec tRatio);
40 });
41 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698