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

Unified Diff: LayoutTests/svg/zoom/page/zoom-zoom-coords.xhtml

Issue 1038463002: Add a tolerance factor to the test. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: rebase Created 5 years, 9 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/svg/zoom/page/zoom-zoom-coords.xhtml
diff --git a/LayoutTests/svg/zoom/page/zoom-zoom-coords.xhtml b/LayoutTests/svg/zoom/page/zoom-zoom-coords.xhtml
index f5f4fc4c61260d4ea858659279217d692b36281e..23a7bfb9e01d956fe2349bc014cd1c919d6cbf2e 100644
--- a/LayoutTests/svg/zoom/page/zoom-zoom-coords.xhtml
+++ b/LayoutTests/svg/zoom/page/zoom-zoom-coords.xhtml
@@ -53,6 +53,9 @@
<script>
function executeTest() {
+ // 0.02 is slightly larger than one LayoutUnit, which is the biggest allowable difference.
+ var tolerance = 0.02;
+
description("This test checks getBoundingClientRect() on zoomed HTML and SVG elements");
debug("Gray rectangles: 100x50");
@@ -64,123 +67,123 @@ function executeTest() {
debug("");
div1 = document.getElementById("div1").getBoundingClientRect();
- shouldBeEqualToString('div1.left.toFixed(2)', '0.00');
- shouldBeEqualToString('div1.top.toFixed(2)', '0.00');
- shouldBeEqualToString('div1.width.toFixed(2)', '100.00');
- shouldBeEqualToString('div1.height.toFixed(2)', '50.00');
- shouldBeEqualToString('div1.right.toFixed(2)', '100.00');
- shouldBeEqualToString('div1.bottom.toFixed(2)', '50.00');
+ shouldBe('div1.left', '0.00', false, tolerance);
+ shouldBe('div1.top', '0.00', false, tolerance);
+ shouldBe('div1.width', '100.00', false, tolerance);
+ shouldBe('div1.height', '50.00', false, tolerance);
+ shouldBe('div1.right', '100.00', false, tolerance);
+ shouldBe('div1.bottom', '50.00', false, tolerance);
debug("");
div2 = document.getElementById("div2").getBoundingClientRect();
- shouldBeEqualToString('div2.left.toFixed(2)', '0.00');
- shouldBeEqualToString('div2.top.toFixed(2)', '25.00');
- shouldBeEqualToString('div2.width.toFixed(2)', '100.00');
- shouldBeEqualToString('div2.height.toFixed(2)', '50.00');
- shouldBeEqualToString('div2.right.toFixed(2)', '100.00');
- shouldBeEqualToString('div2.bottom.toFixed(2)', '75.00');
+ shouldBe('div2.left', '0.00', false, tolerance);
+ shouldBe('div2.top', '25.00', false, tolerance);
+ shouldBe('div2.width', '100.00', false, tolerance);
+ shouldBe('div2.height', '50.00', false, tolerance);
+ shouldBe('div2.right', '100.00', false, tolerance);
+ shouldBe('div2.bottom', '75.00', false, tolerance);
debug("");
div3 = document.getElementById("div3").getBoundingClientRect();
- shouldBeEqualToString('div3.left.toFixed(2)', '0.00');
- shouldBeEqualToString('div3.top.toFixed(2)', '300.00');
- shouldBeEqualToString('div3.width.toFixed(2)', '200.00');
- shouldBeEqualToString('div3.height.toFixed(2)', '100.00');
- shouldBeEqualToString('div3.right.toFixed(2)', '200.00');
- shouldBeEqualToString('div3.bottom.toFixed(2)', '400.00');
+ shouldBe('div3.left', '0.00', false, tolerance);
+ shouldBe('div3.top', '300.00', false, tolerance);
+ shouldBe('div3.width', '200.00', false, tolerance);
+ shouldBe('div3.height', '100.00', false, tolerance);
+ shouldBe('div3.right', '200.00', false, tolerance);
+ shouldBe('div3.bottom', '400.00', false, tolerance);
debug("");
debug("Checking SVG elements:");
debug("");
svg1 = document.getElementById("svg1").getBoundingClientRect();
- shouldBeEqualToString('svg1.left.toFixed(2)', '0.00');
- shouldBeEqualToString('svg1.top.toFixed(2)', '250.00');
- shouldBeEqualToString('svg1.width.toFixed(2)', '150.00');
- shouldBeEqualToString('svg1.height.toFixed(2)', '50.00');
- shouldBeEqualToString('svg1.right.toFixed(2)', '150.00');
- shouldBeEqualToString('svg1.bottom.toFixed(2)', '300.00');
+ shouldBe('svg1.left', '0.00', false, tolerance);
+ shouldBe('svg1.top', '250.00', false, tolerance);
+ shouldBe('svg1.width', '150.00', false, tolerance);
+ shouldBe('svg1.height', '50.00', false, tolerance);
+ shouldBe('svg1.right', '150.00', false, tolerance);
+ shouldBe('svg1.bottom', '300.00', false, tolerance);
rect1 = document.getElementById("rect1").getBoundingClientRect();
- shouldBeEqualToString('rect1.left.toFixed(2)', '0.00');
- shouldBeEqualToString('rect1.top.toFixed(2)', '250.00');
- shouldBeEqualToString('rect1.width.toFixed(2)', '100.00');
- shouldBeEqualToString('rect1.height.toFixed(2)', '50.00');
- shouldBeEqualToString('rect1.right.toFixed(2)', '100.00');
- shouldBeEqualToString('rect1.bottom.toFixed(2)', '300.00');
+ shouldBe('rect1.left', '0.00', false, tolerance);
+ shouldBe('rect1.top', '250.00', false, tolerance);
+ shouldBe('rect1.width', '100.00', false, tolerance);
+ shouldBe('rect1.height', '50.00', false, tolerance);
+ shouldBe('rect1.right', '100.00', false, tolerance);
+ shouldBe('rect1.bottom', '300.00', false, tolerance);
image1 = document.getElementById("image1").getBoundingClientRect();
- shouldBeEqualToString('image1.left.toFixed(2)', '100.00');
- shouldBeEqualToString('image1.top.toFixed(2)', '250.00');
- shouldBeEqualToString('image1.width.toFixed(2)', '50.00');
- shouldBeEqualToString('image1.height.toFixed(2)', '25.00');
- shouldBeEqualToString('image1.right.toFixed(2)', '150.00');
- shouldBeEqualToString('image1.bottom.toFixed(2)', '275.00');
+ shouldBe('image1.left', '100.00', false, tolerance);
+ shouldBe('image1.top', '250.00', false, tolerance);
+ shouldBe('image1.width', '50.00', false, tolerance);
+ shouldBe('image1.height', '25.00', false, tolerance);
+ shouldBe('image1.right', '150.00', false, tolerance);
+ shouldBe('image1.bottom', '275.00', false, tolerance);
text1 = document.getElementById("text1").getBoundingClientRect();
- shouldBeEqualToString('text1.left.toFixed(2)', '100.00');
- shouldBeEqualToString('text1.top.toFixed(2)', '282.66');
- shouldBeEqualToString('text1.width.toFixed(2)', '49.20');
- shouldBeEqualToString('text1.height.toFixed(2)', '6.16');
- shouldBeEqualToString('text1.right.toFixed(2)', '149.20');
- shouldBeEqualToString('text1.bottom.toFixed(2)', '288.82');
+ shouldBe('text1.left', '100.00', false, tolerance);
+ shouldBe('text1.top', '282.66', false, tolerance);
+ shouldBe('text1.width', '47.98', false, tolerance);
+ shouldBe('text1.height', '6.16', false, tolerance);
+ shouldBe('text1.right', '147.98', false, tolerance);
+ shouldBe('text1.bottom', '288.82', false, tolerance);
debug("");
svg2 = document.getElementById("svg2").getBoundingClientRect();
- shouldBeEqualToString('svg2.left.toFixed(2)', '75.00');
- shouldBeEqualToString('svg2.top.toFixed(2)', '100.00');
- shouldBeEqualToString('svg2.width.toFixed(2)', '150.00');
- shouldBeEqualToString('svg2.height.toFixed(2)', '50.00');
- shouldBeEqualToString('svg2.right.toFixed(2)', '225.00');
- shouldBeEqualToString('svg2.bottom.toFixed(2)', '150.00');
+ shouldBe('svg2.left', '75.00', false, tolerance);
+ shouldBe('svg2.top', '100.00', false, tolerance);
+ shouldBe('svg2.width', '150.00', false, tolerance);
+ shouldBe('svg2.height', '50.00', false, tolerance);
+ shouldBe('svg2.right', '225.00', false, tolerance);
+ shouldBe('svg2.bottom', '150.00', false, tolerance);
rect2 = document.getElementById("rect2").getBoundingClientRect();
- shouldBeEqualToString('rect2.left.toFixed(2)', '75.00');
- shouldBeEqualToString('rect2.top.toFixed(2)', '100.00');
- shouldBeEqualToString('rect2.width.toFixed(2)', '100.00');
- shouldBeEqualToString('rect2.height.toFixed(2)', '50.00');
- shouldBeEqualToString('rect2.right.toFixed(2)', '175.00');
- shouldBeEqualToString('rect2.bottom.toFixed(2)', '150.00');
+ shouldBe('rect2.left', '75.00', false, tolerance);
+ shouldBe('rect2.top', '100.00', false, tolerance);
+ shouldBe('rect2.width', '100.00', false, tolerance);
+ shouldBe('rect2.height', '50.00', false, tolerance);
+ shouldBe('rect2.right', '175.00', false, tolerance);
+ shouldBe('rect2.bottom', '150.00', false, tolerance);
image2 = document.getElementById("image2").getBoundingClientRect();
- shouldBeEqualToString('image2.left.toFixed(2)', '175.00');
- shouldBeEqualToString('image2.top.toFixed(2)', '100.00');
- shouldBeEqualToString('image2.width.toFixed(2)', '50.00');
- shouldBeEqualToString('image2.height.toFixed(2)', '25.00');
- shouldBeEqualToString('image2.right.toFixed(2)', '225.00');
- shouldBeEqualToString('image2.bottom.toFixed(2)', '125.00');
+ shouldBe('image2.left', '175.00', false, tolerance);
+ shouldBe('image2.top', '100.00', false, tolerance);
+ shouldBe('image2.width', '50.00', false, tolerance);
+ shouldBe('image2.height', '25.00', false, tolerance);
+ shouldBe('image2.right', '225.00', false, tolerance);
+ shouldBe('image2.bottom', '125.00', false, tolerance);
text2 = document.getElementById("text2").getBoundingClientRect();
- shouldBeEqualToString('text2.left.toFixed(2)', '175.00');
- shouldBeEqualToString('text2.top.toFixed(2)', '132.66');
- shouldBeEqualToString('text2.width.toFixed(2)', '47.44');
- shouldBeEqualToString('text2.height.toFixed(2)', '5.94');
- shouldBeEqualToString('text2.right.toFixed(2)', '222.44');
- shouldBeEqualToString('text2.bottom.toFixed(2)', '138.60');
+ shouldBe('text2.left', '175.00', false, tolerance);
+ shouldBe('text2.top', '132.66', false, tolerance);
+ shouldBe('text2.width', '47.98', false, tolerance);
+ shouldBe('text2.height', '5.94', false, tolerance);
+ shouldBe('text2.right', '222.98', false, tolerance);
+ shouldBe('text2.bottom', '138.60', false, tolerance);
debug("");
svg3 = document.getElementById("svg3").getBoundingClientRect();
- shouldBeEqualToString('svg3.left.toFixed(2)', '900.00');
- shouldBeEqualToString('svg3.top.toFixed(2)', '500.00');
- shouldBeEqualToString('svg3.width.toFixed(2)', '300.00');
- shouldBeEqualToString('svg3.height.toFixed(2)', '100.00');
- shouldBeEqualToString('svg3.right.toFixed(2)', '1200.00');
- shouldBeEqualToString('svg3.bottom.toFixed(2)', '600.00');
+ shouldBe('svg3.left', '900.00', false, tolerance);
+ shouldBe('svg3.top', '500.00', false, tolerance);
+ shouldBe('svg3.width', '300.00', false, tolerance);
+ shouldBe('svg3.height', '100.00', false, tolerance);
+ shouldBe('svg3.right', '1200.00', false, tolerance);
+ shouldBe('svg3.bottom', '600.00', false, tolerance);
rect3 = document.getElementById("rect3").getBoundingClientRect();
- shouldBeEqualToString('rect3.left.toFixed(2)', '900.00');
- shouldBeEqualToString('rect3.top.toFixed(2)', '500.00');
- shouldBeEqualToString('rect3.width.toFixed(2)', '200.00');
- shouldBeEqualToString('rect3.height.toFixed(2)', '100.00');
- shouldBeEqualToString('rect3.right.toFixed(2)', '1100.00');
- shouldBeEqualToString('rect3.bottom.toFixed(2)', '600.00');
+ shouldBe('rect3.left', '900.00', false, tolerance);
+ shouldBe('rect3.top', '500.00', false, tolerance);
+ shouldBe('rect3.width', '200.00', false, tolerance);
+ shouldBe('rect3.height', '100.00', false, tolerance);
+ shouldBe('rect3.right', '1100.00', false, tolerance);
+ shouldBe('rect3.bottom', '600.00', false, tolerance);
image3 = document.getElementById("image3").getBoundingClientRect();
- shouldBeEqualToString('image3.left.toFixed(2)', '1100.00');
- shouldBeEqualToString('image3.top.toFixed(2)', '500.00');
- shouldBeEqualToString('image3.width.toFixed(2)', '100.00');
- shouldBeEqualToString('image3.height.toFixed(2)', '50.00');
- shouldBeEqualToString('image3.right.toFixed(2)', '1200.00');
- shouldBeEqualToString('image3.bottom.toFixed(2)', '550.00');
+ shouldBe('image3.left', '1100.00', false, tolerance);
+ shouldBe('image3.top', '500.00', false, tolerance);
+ shouldBe('image3.width', '100.00', false, tolerance);
+ shouldBe('image3.height', '50.00', false, tolerance);
+ shouldBe('image3.right', '1200.00', false, tolerance);
+ shouldBe('image3.bottom', '550.00', false, tolerance);
text3 = document.getElementById("text3").getBoundingClientRect();
- shouldBeEqualToString('text3.left.toFixed(2)', '1100.00');
- shouldBeEqualToString('text3.top.toFixed(2)', '565.33');
- shouldBeEqualToString('text3.width.toFixed(2)', '98.41');
- shouldBeEqualToString('text3.height.toFixed(2)', '12.31');
- shouldBeEqualToString('text3.right.toFixed(2)', '1198.41');
- shouldBeEqualToString('text3.bottom.toFixed(2)', '577.64');
+ shouldBe('text3.left', '1100.00', false, tolerance);
+ shouldBe('text3.top', '565.33', false, tolerance);
+ shouldBe('text3.width', '95.97', false, tolerance);
+ shouldBe('text3.height', '12.31', false, tolerance);
+ shouldBe('text3.right', '1195.97', false, tolerance);
+ shouldBe('text3.bottom', '577.64', false, tolerance);
debug("");
}
</script>
« no previous file with comments | « LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698