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

Unified Diff: LayoutTests/imported/csswg-test/css-shapes-1/spec-examples/support/spec-example-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/spec-examples/support/spec-example-utils.js
diff --git a/LayoutTests/imported/csswg-test/css-shapes-1/spec-examples/support/spec-example-utils.js b/LayoutTests/imported/csswg-test/css-shapes-1/spec-examples/support/spec-example-utils.js
new file mode 100644
index 0000000000000000000000000000000000000000..9f4a19e4c6d29f5f41724a5472f3818449f717c7
--- /dev/null
+++ b/LayoutTests/imported/csswg-test/css-shapes-1/spec-examples/support/spec-example-utils.js
@@ -0,0 +1,26 @@
+function approxShapeTest(testId, linePrefix, epsilon, lineOffsets) {
+ var isPositioned = { 'relative': true, 'fixed': true, 'absolute': true, 'sticky': true },
+ loops = 0,
+ testDiv = document.getElementById(testId),
+ testOffset = isPositioned[getComputedStyle(testDiv).position] ? 0 : testDiv.offsetLeft,
+ firstLine = document.getElementById(linePrefix + '0');
+
+ function runTest() {
+ if (firstLine.offsetLeft == testOffset) {
+ // wait for the shape image to load and layout to happen
+ if (loops > 100)
+ assert_unreached("Giving up waiting for shape layout to happen!");
+ else
+ loops++;
+ window.setTimeout(runTest, 5);
+ return;
+ }
+
+ for (var i = 0; i < lineOffsets.length; i++) {
+ var line = document.getElementById(linePrefix + i);
+ assert_approx_equals(line.offsetLeft, lineOffsets[i] + testOffset, epsilon, 'Line ' + i + ' is positioned properly');
+ }
+ done();
+ }
+ runTest();
+}

Powered by Google App Engine
This is Rietveld 408576698