Index: third_party/WebKit/LayoutTests/svg/zoom/page/zoom-get-screen-ctm.html |
diff --git a/third_party/WebKit/LayoutTests/svg/zoom/page/zoom-get-screen-ctm.html b/third_party/WebKit/LayoutTests/svg/zoom/page/zoom-get-screen-ctm.html |
index b72c242781e2c6078dffb329ed335ca092f5854b..d9d2b7cef421f4baf1af6650fee72c2f9351ded1 100644 |
--- a/third_party/WebKit/LayoutTests/svg/zoom/page/zoom-get-screen-ctm.html |
+++ b/third_party/WebKit/LayoutTests/svg/zoom/page/zoom-get-screen-ctm.html |
@@ -1,53 +1,43 @@ |
<!DOCTYPE html> |
-<html> |
-<body style="margin: 0px; padding: 0px;"> |
- <div style="width: 100px; height: 100px;"></div> |
- <svg id="svg1" xmlns="http://www.w3.org/2000/svg" width="400" height="400"> |
+<title>SVGGraphicsElement.getScreenCTM subject to page zoom</title> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+<script src="../../../resources/run-after-layout-and-paint.js"></script> |
+<style> |
+body { margin: 0; padding: 0; } |
+</style> |
+<div style="width: 100px; height: 100px;"></div> |
+<svg id="svg1" width="400" height="400"> |
+ <rect width="100" height="100" fill="green"/> |
+ <svg id="svg2" x="100" y="100" width="300" height="300"> |
<rect width="100" height="100" fill="green"/> |
- <svg id="svg2" x="100" y="100" width="300" height="300"> |
+ <svg id="svg3" x="100" y="100" width="200" height="200"> |
<rect width="100" height="100" fill="green"/> |
- <svg id="svg3" x="100" y="100" width="200" height="200"> |
+ <svg id="svg4" x="100" y="100" width="100" height="100"> |
<rect width="100" height="100" fill="green"/> |
- <svg id="svg4" x="100" y="100" width="100" height="100"> |
- <rect width="100" height="100" fill="green"/> |
- </svg> |
</svg> |
</svg> |
</svg> |
- |
-<script src="../../../resources/js-test.js"></script> |
-<script src="../../../resources/run-after-layout-and-paint.js"></script> |
-<script src="../resources/testPageZoom.js"></script> |
- |
+</svg> |
<script> |
- var zoomCount = 2; |
- |
- window.jsTestIsAsync = true; |
- if (window.testRunner) { |
- testRunner.waitUntilDone(); |
- window.postZoomCallback = executeTest; |
- runAfterLayoutAndPaint(repaintTest); |
- } |
- |
- function ctmToString(ctm) { |
- return [ ctm.a, ctm.b, ctm.c, ctm.d, ctm.e, ctm.f ].join(', '); |
- } |
- |
- function executeTest() { |
- CTM1 = ctmToString(document.getElementById('svg1').getScreenCTM()); |
- CTM2 = ctmToString(document.getElementById('svg2').getScreenCTM()); |
- CTM3 = ctmToString(document.getElementById('svg3').getScreenCTM()); |
- CTM4 = ctmToString(document.getElementById('svg4').getScreenCTM()); |
- |
- description("This test checks getScreenCTM() on zoomed pages."); |
- |
- shouldBeEqualToString('CTM1', '1, 0, 0, 1, 0, 100'); |
- shouldBeEqualToString('CTM2', '1, 0, 0, 1, 100, 200'); |
- shouldBeEqualToString('CTM3', '1, 0, 0, 1, 200, 300'); |
- shouldBeEqualToString('CTM4', '1, 0, 0, 1, 300, 400'); |
- debug(''); |
- } |
- |
+function assert_matrix_equals(actual, expected) { |
+ for (let prop of [ 'a', 'b', 'c', 'd', 'e', 'f']) |
+ assert_equals(actual[prop], expected[prop], prop); |
+} |
+ |
+async_test(t => { |
+ runAfterLayoutAndPaint(t.step_func_done(() => { |
+ eventSender.zoomPageIn(); |
+ eventSender.zoomPageIn(); |
+ |
+ assert_matrix_equals(document.getElementById('svg1').getScreenCTM(), |
+ { a: 1, b: 0, c: 0, d: 1, e: 0, f: 100 }); |
+ assert_matrix_equals(document.getElementById('svg2').getScreenCTM(), |
+ { a: 1, b: 0, c: 0, d: 1, e: 100, f: 200 }); |
+ assert_matrix_equals(document.getElementById('svg3').getScreenCTM(), |
+ { a: 1, b: 0, c: 0, d: 1, e: 200, f: 300 }); |
+ assert_matrix_equals(document.getElementById('svg4').getScreenCTM(), |
+ { a: 1, b: 0, c: 0, d: 1, e: 300, f: 400 }); |
+ })); |
+}); |
</script> |
-</body> |
-</html> |