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

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

Issue 2694703004: 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-lineWidth-intact-after-strokeRect.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-lineWidth-intact-after-strokeRect.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-lineWidth-intact-after-strokeRect.html
index 2fc699575c2e561ff158a7952cdc3ee8f2bf3a51..8dabdef6ed36c0b2a9f38f7f46eb1966fd4ea1bf 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-lineWidth-intact-after-strokeRect.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-lineWidth-intact-after-strokeRect.html
@@ -1,9 +1,35 @@
-<!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-lineWidth-intact-after-strokeRect.js"></script>
+<script>
+test(function(t) {
+
+ var ctx = document.createElement('canvas').getContext('2d');
+
+ ctx.fillStyle = 'red';
+ ctx.fillRect(0, 0, 1, 1);
+
+ assert_equals(ctx.fillStyle, '#ff0000');
+ assert_array_equals(ctx.getImageData(0, 0, 1, 1).data, [255, 0, 0, 255]);
+ assert_array_equals(ctx.getImageData(1, 0, 1, 1).data, [0, 0, 0, 0]);
+
+ ctx.strokeStyle = 'red';
+ ctx.lineWidth = 100;
+ // NOTE: This version of strokeRect() is WebKit-specific and not part of the standard API.
+ ctx.strokeRect(0, 0, 10, 10, 1);
+ assert_equals(ctx.lineWidth, 100);
+
+ ctx.strokeStyle = 'green';
+ ctx.beginPath();
+ ctx.moveTo(0, 0);
+ ctx.lineTo(20, 20);
+ ctx.stroke();
+
+ assert_array_equals(ctx.getImageData(2, 2, 1, 1).data, [0, 128, 0, 255]);
+
+ document.body.appendChild(ctx.canvas)
+
+}, "Test that the rendering context's lineWidth is intact after calling strokeRect()");
+
+</script>
</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698