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

Unified Diff: LayoutTests/svg/custom/getBBox-circle-has-one-zero-value.html

Issue 307643003: Don't render empty shapes with non-scaling-stroke (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update TEs. Created 6 years, 7 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
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/svg/custom/getBBox-circle-has-one-zero-value-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/svg/custom/getBBox-circle-has-one-zero-value.html
diff --git a/LayoutTests/svg/custom/getBBox-circle-has-one-zero-value.html b/LayoutTests/svg/custom/getBBox-circle-has-one-zero-value.html
index 4b8401fe2c6d53d5cc74c22e95f096dfa7aa2fbe..861be96a646272d155778a720ae10c68c5faee46 100644
--- a/LayoutTests/svg/custom/getBBox-circle-has-one-zero-value.html
+++ b/LayoutTests/svg/custom/getBBox-circle-has-one-zero-value.html
@@ -1,39 +1,38 @@
-<!DOCTYPE HTML>
-<html>
-<!-- Test that svg bounding boxes are valid for a zero-width or zero-height circle -->
- <head>
- <script type="text/javascript">
- function checkBoundingBoxHasZeroValue() {
- if (window.testRunner)
- window.testRunner.dumpAsText();
- var circle1 = document.getElementById('circle1').getBBox();
- var circle2 = document.getElementById('circle2').getBBox();
- var circle3 = document.getElementById('circle3').getBBox();
- var circle4 = document.getElementById('circle4').getBBox();
- var results = "FAIL";
- if (circle1.width == 100 &&
- circle1.height == 100 &&
- circle2.width == 0 &&
- circle2.height == 0 &&
- circle3.width == 100 &&
- circle3.height == 100 &&
- circle4.width == 0 &&
- circle4.height == 0)
- results = "PASS";
- document.body.innerHTML = results + ", bounding boxes sizes are (" +
- circle1.width + ", " + circle1.height + "), (" +
- circle2.width + ", " + circle2.height + "), (" +
- circle3.width + ", " + circle3.height + ") and (" +
- circle4.width + ", " + circle4.height + ")";
- }
- </script>
- </head>
- <body onload="checkBoundingBoxHasZeroValue()">
- <svg>
- <circle id="circle1" cx="300" cy="300" r="50"/>
- <circle id="circle2" cx="300" cy="300" r="0"/>
- <circle id="circle3" vector-effect="non-scaling-stroke" cx="300" cy="300" r="50"/>
- <circle id="circle4" vector-effect="non-scaling-stroke" cx="300" cy="300" r="0"/>
- </svg>
- <body>
-</html>
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<title>SVG bounding boxes are valid for a zero-width or zero-height circle</title>
+<svg height="0">
+ <circle cx="300" cy="300" r="50"/>
+ <circle cx="300" cy="300" r="0"/>
+ <circle vector-effect="non-scaling-stroke" cx="300" cy="300" r="50"/>
+ <circle vector-effect="non-scaling-stroke" cx="300" cy="300" r="0"/>
+</svg>
+<script>
+BBox = function(x,y,w,h) {
+ this.x = x;
+ this.y = y;
+ this.width = w;
+ this.height = h;
+};
+BBox.prototype.toString = function() {
+ return this.x + "," + this.y + "," + this.width + "," + this.height;
+};
+// The order of expected sizes should equal the document order of the rects.
+var expectedBoxes = [
+ new BBox(250, 250, 100, 100),
+ new BBox(300, 300, 0, 0),
+ new BBox(250, 250, 100, 100),
+ new BBox(300, 300, 0, 0),
+];
+var circles = document.getElementsByTagName('circle');
+for (var i = 0, length = circles.length; i < length; ++i) {
+ var circleBBox = circles[i].getBBox();
+ test(function() {
+ assert_equals(circleBBox.x, expectedBoxes[i].x);
+ assert_equals(circleBBox.y, expectedBoxes[i].y);
+ assert_equals(circleBBox.width, expectedBoxes[i].width);
+ assert_equals(circleBBox.height, expectedBoxes[i].height);
+ }, 'Bounding box size ' + expectedBoxes[i]);
+}
+</script>
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/svg/custom/getBBox-circle-has-one-zero-value-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698