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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-strokePath-cap-join.html

Issue 2693193003: 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-strokePath-cap-join.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-strokePath-cap-join.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-strokePath-cap-join.html
index 65542cd0ae0adc572404e44d8f4d279f4c607d5d..e304c7e15c87002acba37b83b529053c0ca90a3b 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-strokePath-cap-join.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-strokePath-cap-join.html
@@ -1,9 +1,162 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<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-strokePath-cap-join.js"></script>
+<script>
+
+var canvas = document.createElement('canvas');
+document.body.appendChild(canvas);
+canvas.setAttribute('width', '700');
+canvas.setAttribute('height', '200');
+var ctx = canvas.getContext('2d');
+
+ctx.miterLimit = 5;
+ctx.lineWidth = 15;
+
+ctx.fillStyle="rgba(255, 255, 255, 1.0)";
+ctx.fillRect(0, 0, 700, 200);
+
+ctx.strokeStyle="rgba(0, 0, 0, 1.0)";
+ctx.lineJoin = "miter";
+ctx.lineCap = "round";
+
+ctx.translate(0, 50);
+ctx.save();
+
+ctx.beginPath();
+ctx.moveTo(10, 100);
+ctx.lineTo(30, 2);
+ctx.lineTo(50, 100);
+ctx.stroke();
+
+ctx.translate(60 ,0);
+ctx.beginPath();
+ctx.moveTo(10, 100);
+ctx.lineTo(30, 3);
+ctx.lineTo(50, 100);
+ctx.stroke();
+
+ctx.translate(90 ,0);
+ctx.save();
+ctx.rotate(0.2);
+ctx.beginPath();
+ctx.moveTo(10, 100);
+ctx.lineTo(30, 3);
+ctx.lineTo(50, 100);
+ctx.closePath();
+ctx.stroke();
+ctx.restore();
+
+ctx.restore();
+
+ctx.lineJoin = "bevel";
+ctx.lineCap = "square";
+
+ctx.translate(200, 0);
+ctx.save();
+
+ctx.beginPath();
+ctx.moveTo(10, 100);
+ctx.lineTo(30, 2);
+ctx.lineTo(50, 100);
+ctx.stroke();
+
+ctx.translate(60 ,0);
+ctx.beginPath();
+ctx.moveTo(10, 100);
+ctx.lineTo(30, 3);
+ctx.lineTo(50, 100);
+ctx.stroke();
+
+ctx.translate(90 ,0);
+ctx.save();
+ctx.rotate(0.2);
+ctx.beginPath();
+ctx.moveTo(10, 100);
+ctx.lineTo(30, 3);
+ctx.lineTo(50, 100);
+ctx.closePath();
+ctx.stroke();
+ctx.restore();
+
+ctx.restore();
+
+ctx.lineJoin = "round";
+ctx.lineCap = "butt";
+
+ctx.translate(200, 0);
+ctx.save();
+
+ctx.beginPath();
+ctx.moveTo(10, 100);
+ctx.lineTo(30, 2);
+ctx.lineTo(50, 100);
+ctx.stroke();
+
+ctx.translate(60 ,0);
+ctx.beginPath();
+ctx.moveTo(10, 100);
+ctx.lineTo(30, 3);
+ctx.lineTo(50, 100);
+ctx.stroke();
+
+ctx.translate(90 ,0);
+ctx.save();
+ctx.rotate(0.2);
+ctx.beginPath();
+ctx.moveTo(10, 100);
+ctx.lineTo(30, 3);
+ctx.lineTo(50, 100);
+ctx.closePath();
+ctx.stroke();
+ctx.restore();
+
+ctx.restore();
+
+function checkPixel(x, y, redComponent)
+{
+ assert_equals(ctx.getImageData(x, y, 1, 1).data[0], redComponent);
+}
+
+var testScenarios = [
+ ['Verify Join : miter, Cap : round. 1', 30, 51, 0],
+ ['Verify Join : miter, Cap : round. 2', 30, 49, 255],
+ ['Verify Join : miter, Cap : round. 3', 14, 154, 0],
+ ['Verify Join : miter, Cap : round. 4', 14, 157, 255],
+ ['Verify Join : miter, Cap : round. 5', 89, 22, 0],
+ ['Verify Join : miter, Cap : round. 6', 89, 12, 255],
+ ['Verify Join : miter, Cap : round. 7', 184, 29, 0],
+ ['Verify Join : miter, Cap : round. 8', 180, 27, 255],
+ ['Verify Join : miter, Cap : round. 9', 132, 152, 0],
+ ['Verify Join : miter, Cap : round. 10', 130, 157, 255],
+
+ ['Verify Join : bevel, Cap : square. 1', 202, 154, 0],
+ ['Verify Join : bevel, Cap : square. 2', 201, 150, 255],
+ ['Verify Join : bevel, Cap : square. 3', 228, 52, 0],
+ ['Verify Join : bevel, Cap : square. 4', 225, 48, 255],
+ ['Verify Join : bevel, Cap : square. 5', 316, 154, 0],
+ ['Verify Join : bevel, Cap : square. 6', 316, 157, 255],
+ ['Verify Join : bevel, Cap : square. 7', 289, 52, 0],
+ ['Verify Join : bevel, Cap : square. 8', 289, 48, 255],
+ ['Verify Join : bevel, Cap : square. 9', 372, 58, 0],
+ ['Verify Join : bevel, Cap : square. 10', 373, 54, 255],
+ ['Verify Join : bevel, Cap : square. 11', 380, 159, 0],
+ ['Verify Join : bevel, Cap : square. 12', 383, 162, 255],
+
+ ['Verify Join : round, Cap : butt. 1', 405, 147, 0],
+ ['Verify Join : round, Cap : butt. 2', 405, 151, 255],
+ ['Verify Join : round, Cap : butt. 3', 429, 46, 0],
+ ['Verify Join : round, Cap : butt. 4', 429, 43, 255],
+ ['Verify Join : round, Cap : butt. 5', 464, 146, 0],
+ ['Verify Join : round, Cap : butt. 6', 464, 150, 255],
+ ['Verify Join : round, Cap : butt. 7', 489, 46, 0],
+ ['Verify Join : round, Cap : butt. 8', 489, 43, 255],
+ ['Verify Join : round, Cap : butt. 9', 534, 151, 0],
+ ['Verify Join : round, Cap : butt. 10', 531, 153, 255],
+ ['Verify Join : round, Cap : butt. 11', 579, 52, 0],
+ ['Verify Join : round, Cap : butt. 12', 579, 48, 255],
+];
+
+generate_tests(checkPixel, testScenarios);
+
+</script>
</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698