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

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

Issue 2690183006: 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-strokeRect.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-strokeRect.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-strokeRect.html
index 1a5580b08cd4806d233fe3b19b81a5761c3dcf80..b71b1552befdc5e4216c52bbeaac22c62f0ca695 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-strokeRect.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-strokeRect.html
@@ -1,9 +1,61 @@
-<!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-strokeRect.js"></script>
+<script>
+
+var ctx = document.createElement('canvas').getContext('2d');
+var canvas2 = document.createElement('canvas');
+canvas2.width = 100;
+canvas2.height = 100;
+var ctx2 = canvas2.getContext('2d');
+
+test(function(t) {
+ ctx.beginPath();
+ ctx.strokeStyle = 'green';
+ ctx.lineWidth = 100;
+ ctx.strokeRect(50, 0, 100, 100);
+ assert_array_equals(ctx.getImageData(2, 1, 1, 1).data.slice(0,3), [0, 128, 0]);
+}, "Verify the correct behaviour of canvas.strokeRect() with solid green");
+
+test(function(t) {
+ ctx.clearRect(0, 0, 100, 100);
+ ctx2.fillStyle = 'green';
+ ctx2.fillRect(0, 0, 100, 100);
+ var pattern = ctx.createPattern(canvas2, 'repeat');
+ ctx.strokeStyle = 'pattern';
+ ctx.lineWidth = 100;
+ ctx.strokeRect(50, 0, 100, 100);
+ assert_array_equals(ctx.getImageData(2, 1, 1, 1).data.slice(0,3), [0, 128, 0]);
+}, "Verify the correct behaviour of canvas.strokeRect() with a pattern");
+
+test(function(t) {
+ ctx.clearRect(0, 0, 100, 100);
+ var gradient = ctx.createLinearGradient(0, 0, 0, 100);
+ gradient.addColorStop(0, "green");
+ gradient.addColorStop(1, "green");
+ ctx.strokeStyle = 'gradient';
+ ctx.lineWidth = 100;
+ ctx.strokeRect(50, 0, 100, 100);
+ assert_array_equals(ctx.getImageData(2, 1, 1, 1).data.slice(0,3), [0, 128, 0]);
+}, "Verify the correct behaviour of canvas.strokeRect() with a gradient");
+
+test(function(t) {
+ ctx.clearRect(0, 0, 100, 100);
+ ctx.strokeStyle = 'red';
+ ctx.lineWidth = 2;
+ ctx.strokeRect(0, 0, 0, 0);
+ assert_array_equals(ctx.getImageData(0, 0, 1, 1).data.slice(0,3), [0, 0, 0]);
+}, "Verify the correct behaviour of canvas.strokeRect() with height = width = 0 and lineWidth = 2");
+
+test(function(t) {
+ ctx.shadowOffsetX = 5;
+ ctx.shadowOffsetY = 5;
+ ctx.shadowColor = 'blue';
+ ctx.strokeStyle = 'red';
+ ctx.lineWidth = 2;
+ ctx.strokeRect(0, 0, 0, 0);
+ assert_array_equals(ctx.getImageData(0, 0, 1, 1).data.slice(0,3), [0, 0, 0]);
+}, "Verify the correct behaviour of canvas.strokeRect() with height = width = 0, lineWidth = 2, and shadow");
+
+</script>
</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698