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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-path2d-test.html

Issue 2679193002: 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/canvas-hit-regions-path2d-test.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-path2d-test.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-path2d-test.html
index 980cbf7e7db82ee9daca73890db9c0e2ca29699d..2b6407bd5bacb953cd04da76e3f5184a7556e339 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-path2d-test.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-path2d-test.html
@@ -1,61 +1,58 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Canvas Hit Regions: path2d test</title>
- <script src="../../resources/js-test.js"></script>
-</head>
+<title>Canvas Hit Regions: path2d test</title>
+<script src='../../resources/testharness.js'></script>
+<script src='../../resources/testharnessreport.js'></script>
<body>
-<canvas id="canvas" width="400" height="400">
- <button id="face"></button>
- <button id="eyes"></button>
+<canvas id='canvas' width='400' height='400'>
+ <button id='face'></button>
+ <button id='eyes'></button>
</canvas>
-<script src="./resources/canvas-hit-region-event.js"></script>
+<script src='./resources/canvas-hit-region-event.js'></script>
<script>
- var canvas = document.getElementById("canvas");
- var context = canvas.getContext("2d");
+test(function(t) {
+ var canvas = document.getElementById('canvas');
+ var context = canvas.getContext('2d');
var face = new Path2D();
- context.fillStyle = "pink";
+ context.fillStyle = 'pink';
face.arc(200, 175, 150, 0, Math.PI * 2, true);
context.fill(face);
- context.addHitRegion({ id : "face", control : document.getElementById("face"), path : face });
+ context.addHitRegion({ id : 'face', control : document.getElementById('face'), path : face });
var nose = new Path2D();
- context.fillStyle = "black";
+ context.fillStyle = 'black';
context.globalAlpha = .5;
nose.moveTo(200, 165);
nose.lineTo(240, 205);
nose.lineTo(160, 205);
nose.closePath();
context.fill(nose);
- context.addHitRegion({ id : "nose", path : nose });
+ context.addHitRegion({ id : 'nose', path : nose });
var mouth = new Path2D();
- context.fillStyle = "red";
+ context.fillStyle = 'red';
mouth.rect(125, 240, 150, 20);
context.fill(mouth);
- context.addHitRegion({ id : "mouth", path : mouth });
+ context.addHitRegion({ id : 'mouth', path : mouth });
var eyes = new Path2D();
context.globalAlpha = 1;
- context.fillStyle = "blue";
+ context.fillStyle = 'blue';
eyes.arc(150, 125, 25, 0, Math.PI * 2, true);
eyes.arc(250, 125, 25, 0, Math.PI * 2, true);
context.fill(eyes);
- context.addHitRegion({ id: "eye", control : document.getElementById("eyes"), path : eyes });
+ context.addHitRegion({ id: 'eye', control : document.getElementById('eyes'), path : eyes });
- debug("Hit detection and mouse event tests");
- shouldBe("clickCanvas(100, 100)", "'face'");
- shouldBe("clickCanvas(200, 200)", "'nose'");
- shouldBe("clickCanvas(127, 242)", "'mouth'");
- shouldBe("clickCanvas(150, 125)", "'eye'");
- shouldBe("clickCanvas(250, 125)", "'eye'");
- shouldBe("clickCanvas(200, 125)", "'face'");
- shouldBe("clickCanvas(20, 10)", "null");
- debug("");
+ // Hit detection and mouse event tests');
+ assert_equals(clickCanvas(100, 100), 'face');
+ assert_equals(clickCanvas(200, 200), 'nose');
+ assert_equals(clickCanvas(127, 242), 'mouth');
+ assert_equals(clickCanvas(150, 125), 'eye');
+ assert_equals(clickCanvas(250, 125), 'eye');
+ assert_equals(clickCanvas(200, 125), 'face');
+ assert_equals(clickCanvas(20, 10), null);
+}, 'Test that createImageBitmap from a bitmaprenderer canvas produces correct result');
</script>
</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698