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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-style-intact-after-text.html

Issue 2695963004: 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-style-intact-after-text.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-style-intact-after-text.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-style-intact-after-text.html
index e390be7f9800fdcdfb0c68ae6807f4ce21d988de..a37c8b1e4fd911178f21bcc2c1e441c061c49def 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-style-intact-after-text.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-style-intact-after-text.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-style-intact-after-text.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');
+ var imageData = ctx.getImageData(0, 0, 2, 1).data;
+ assert_array_equals(imageData.slice(0,4), [255, 0, 0, 255]);
+ assert_array_equals(imageData.slice(4), [0, 0, 0, 0]);
+
+ ctx.strokeStyle = 'green';
+ ctx.lineWidth = 10;
+ ctx.fillStyle = 'red';
+ ctx.fillText("X", 0, 0);
+ assert_equals(ctx.strokeStyle, '#008000');
+ ctx.beginPath();
+ ctx.moveTo(0, 0);
+ ctx.lineTo(10, 10);
+ ctx.stroke();
+ imageData = ctx.getImageData(2, 2, 1, 1).data;
+ assert_array_equals(imageData, [0, 128, 0, 255]);
+
+ ctx.strokeStyle = 'red';
+ ctx.lineWidth = 100;
+ ctx.fillStyle = 'green';
+ ctx.strokeText("X", 0, 0);
+ assert_equals(ctx.fillStyle, '#008000');
+ ctx.fillRect(0, 0, 10, 10);
+ imageData = ctx.getImageData(2, 2, 1, 1).data;
+ assert_array_equals(imageData, [0, 128, 0, 255]);
+}, "Test that the rendering context's strokeStyle and fillStyle are intact after calling strokeText() and fillText()");
+</script>
</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698