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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-path-context-clip.js

Issue 2689243002: 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
Index: third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-path-context-clip.js
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-path-context-clip.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-path-context-clip.js
deleted file mode 100644
index 9135da34307db990c6c572537a0b9243cb5fb9da..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-path-context-clip.js
+++ /dev/null
@@ -1,83 +0,0 @@
-description("Series of tests to ensure clip() works with path and winding rule parameters.");
-
-var ctx = document.getElementById('canvas').getContext('2d');
-
-function pixelDataAtPoint() {
- return ctx.getImageData(50, 50, 1, 1).data;
-}
-
-function checkResult(expectedColors, sigma) {
- for (var i = 0; i < 4; i++)
- shouldBeCloseTo("pixelDataAtPoint()[" + i + "]", expectedColors[i], sigma);
-}
-
-function drawRectanglesOn(contextOrPath) {
- contextOrPath.rect(0, 0, 100, 100);
- contextOrPath.rect(25, 25, 50, 50);
-}
-
-function formatName(fillRule, path) {
- return 'clip(' + (path ? 'path' : '') + (fillRule && path ? ', ' : '') +
- (fillRule ? '"' + fillRule + '"' : '') + ')';
-}
-
-function testClipWith(fillRule, path) {
- debug('Testing ' + formatName(fillRule, path));
- ctx.fillStyle = 'rgb(255,0,0)';
- ctx.beginPath();
- ctx.fillRect(0, 0, 100, 100);
- ctx.fillStyle = 'rgb(0,255,0)';
- if (path) {
- if (fillRule) {
- ctx.clip(path, fillRule);
- } else {
- ctx.clip(path);
- }
- } else {
- ctx.beginPath();
- drawRectanglesOn(ctx);
- if (fillRule) {
- ctx.clip(fillRule);
- } else {
- ctx.clip();
- }
- }
- ctx.beginPath();
- ctx.fillRect(0, 0, 100, 100);
- if (fillRule == 'evenodd') {
- checkResult([255, 0, 0, 255], 5);
- } else {
- checkResult([0, 255, 0, 255], 5);
- }
- debug('');
-}
-
-// Execute test.
-function prepareTestScenario() {
- fillRules = [undefined, 'nonzero', 'evenodd'];
- path = new Path2D();
- drawRectanglesOn(path);
-
- for (var i = 0; i < fillRules.length; i++) {
- testClipWith(fillRules[i]);
- testClipWith(fillRules[i], path);
- }
-
- // Test exception cases.
- shouldThrow("ctx.clip(null)");
- shouldThrow("ctx.clip(null, null)");
- shouldThrow("ctx.clip(null, 'nonzero')");
- shouldThrow("ctx.clip(path, null)");
- shouldThrow("ctx.clip([], 'nonzero')");
- shouldThrow("ctx.clip({}, 'nonzero')");
- shouldThrow("ctx.clip(null, 'evenodd')");
- shouldThrow("ctx.clip([], 'evenodd')");
- shouldThrow("ctx.clip({}, 'evenodd')");
- shouldThrow("ctx.clip('gazonk')");
- shouldThrow("ctx.clip(path, 'gazonk')");
- shouldThrow("ctx.clip(undefined, undefined)");
- shouldThrow("ctx.clip(undefined, 'nonzero')");
-}
-
-// Run test and allow variation of results.
-prepareTestScenario();

Powered by Google App Engine
This is Rietveld 408576698