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

Unified Diff: LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/supported-shapes/support/test-utils.js

Issue 816533002: Import CSSWG Shapes tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: One more test expectations update Created 6 years 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: LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/supported-shapes/support/test-utils.js
diff --git a/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/supported-shapes/support/test-utils.js b/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/supported-shapes/support/test-utils.js
new file mode 100644
index 0000000000000000000000000000000000000000..616374d4937b2af0490fde1af42e3870ff3b5264
--- /dev/null
+++ b/LayoutTests/imported/csswg-test/css-shapes-1/shape-outside/supported-shapes/support/test-utils.js
@@ -0,0 +1,29 @@
+function verifyTextPoints(shape, numLines, tolerance, side) {
+ var failed = false;
+ if (tolerance === undefined)
+ tolerance = 0.5;
+ if (side === undefined)
+ side = "left";
+
+ if (side === "right")
+ shape.roundedRect.x = shape.containerWidth - (shape.roundedRect.x + shape.roundedRect.width);
+
+ var expected = getRoundedRectLeftEdge(shape);
+
+ for(var i = 0; i < numLines; i++) {
+ var line = document.getElementById('test'+i);
+ var actual = line.getBoundingClientRect().left;
+ if (side === "right")
+ actual = shape.containerWidth - (actual + line.getBoundingClientRect().width);
+
+ if( Math.abs( (actual - expected[i])) > tolerance ){
+ line.style.setProperty('color', 'red');
+ console.log('diff: ' + Math.abs(actual - expected[i]));
+ failed = true;
+ }
+ }
+ if (window.done) {
+ assert_false(failed, "Lines positioned properly around the shape.");
+ done();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698