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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-rule.html

Issue 2676493005: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Addressing comments Created 3 years, 10 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 | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-rule-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-rule.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-rule.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-rule.html
index b25a8837c6962137d0b1fb588227e7a710b9ca34..1669213d910d1c8e28eebb27d01ef55cc5138098 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-rule.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-rule.html
@@ -1,8 +1,58 @@
-<!doctype html>
-<html>
-<head>
-<script src="../../resources/js-test.js"></script>
-</head>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
<body>
-<script src="script-tests/canvas-fill-rule.js"></script>
+<script>
+
+var tmpimg = document.createElement('canvas');
+tmpimg.width = 200;
+tmpimg.height = 200;
+ctx = tmpimg.getContext('2d');
+
+// Create the image for blending test with images.
+var img = document.createElement('canvas');
+img.width = 100;
+img.height = 100;
+var imgCtx = img.getContext('2d');
+
+function checkResult(expectedColors, sigma) {
+ var pixel = ctx.getImageData(50, 50, 1, 1).data;
+ for (var i = 0; i < 4; i++)
+ assert_approx_equals(pixel[i], expectedColors[i], sigma);
+}
+
+test(function(t) {
+ // Testing default fill
+ ctx.fillStyle = 'rgb(255,0,0)';
+ ctx.beginPath();
+ ctx.fillRect(0, 0, 100, 100);
+ ctx.fillStyle = 'rgb(0,255,0)';
+ ctx.beginPath();
+ ctx.rect(0, 0, 100, 100);
+ ctx.rect(25, 25, 50, 50);
+ ctx.fill();
+ checkResult([0, 255, 0, 255], 5);
+
+ // Testing nonzero fill
+ ctx.fillStyle = 'rgb(255,0,0)';
+ ctx.beginPath();
+ ctx.fillRect(0, 0, 100, 100);
+ ctx.fillStyle = 'rgb(0,255,0)';
+ ctx.beginPath();
+ ctx.rect(0, 0, 100, 100);
+ ctx.rect(25, 25, 50, 50);
+ ctx.fill('nonzero');
+ checkResult([0, 255, 0, 255], 5);
+
+ // Testing evenodd fill
+ ctx.fillStyle = 'rgb(255,0,0)';
+ ctx.beginPath();
+ ctx.fillRect(0, 0, 100, 100);
+ ctx.fillStyle = 'rgb(0,255,0)';
+ ctx.beginPath();
+ ctx.rect(0, 0, 100, 100);
+ ctx.rect(25, 25, 50, 50);
+ ctx.fill('evenodd');
+ checkResult([255, 0, 0, 255], 5);
+}, "Series of tests to ensure correct results of the winding rule.");
+</script>
</body>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/canvas-fill-rule-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698