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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-gradient-without-path.html

Issue 2674933002: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: 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-gradient-without-path.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-gradient-without-path.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-gradient-without-path.html
index a618edbc515e27d723638072fd535fe3f9ae1ddc..7e4dc40f662eee7a9971fffa23ce5a005aa6b673 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-gradient-without-path.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-gradient-without-path.html
@@ -1,9 +1,38 @@
-<!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-gradient-without-path.js"></script>
+<script>
+test(function(t) {
+ var ctx = document.createElement('canvas').getContext('2d');
+
+ ctx.fillStyle = 'green';
+ ctx.fillRect(0, 0, 100, 100);
+
+ var gradient = ctx.createLinearGradient(0, 0, 0, 100);
+ gradient.addColorStop(1, 'red');
+ ctx.fillStyle = gradient;
+
+ ctx.fill();
+
+ var imageData = ctx.getImageData(1, 1, 98, 98);
+ var imgdata = imageData.data;
+ assert_equals(imgdata[4], 0);
+ assert_equals(imgdata[5], 128);
+ assert_equals(imgdata[6], 0);
+
+ ctx.strokeStyle = 'green';
+ ctx.lineWidth = 100;
+ ctx.strokeRect(50, 0, 100, 100);
+
+ ctx.strokeStyle = gradient;
+
+ ctx.stroke();
+
+ imageData = ctx.getImageData(1, 1, 98, 98);
+ imgdata = imageData.data;
+ assert_equals(imgdata[4], 0);
+ assert_equals(imgdata[5], 128);
+ assert_equals(imgdata[6], 0);
+}, "Series of tests to ensure that no gradient is drawn without path");
+</script>
</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698