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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-set-properties-with-non-invertible-ctm.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-set-properties-with-non-invertible-ctm.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-set-properties-with-non-invertible-ctm.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-set-properties-with-non-invertible-ctm.html
index 89bd3324cbbd29f667162db176e44c711210fddf..541efc218fdd84285e8b65007f82c535dbec94de 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-set-properties-with-non-invertible-ctm.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-set-properties-with-non-invertible-ctm.html
@@ -1,9 +1,72 @@
-<!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-set-properties-with-non-invertible-ctm.js"></script>
+<script>
+var canvas = document.createElement("canvas");
+canvas.width = 100;
+canvas.height = 100;
+var ctx = canvas.getContext('2d');
+document.body.appendChild(canvas);
+
+function checkPixel(x, y, rgb) {
+ assert_array_equals(ctx.getImageData(x, y, 1, 1).data.slice(0,3), rgb);
+}
+
+test(function(t) {
+ // Test our ability to set fillStyle
+ ctx.save();
+ ctx.scale(0, 0);
+ ctx.fillStyle = "green";
+ assert_equals(ctx.fillStyle, "#008000");
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
+ ctx.fillRect(0, 0, 100, 100);
+ checkPixel(50, 50, [0, 128, 0]);
+ ctx.restore();
+
+ // Test our ability to set strokeStyle
+ ctx.save();
+ ctx.fillStyle = "red";
+ ctx.fillRect(0, 0, 100, 100);
+ ctx.scale(0, 0);
+ ctx.strokeStyle = "green";
+ assert_equals(ctx.strokeStyle, "#008000");
+ ctx.lineWidth = 100;
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
+ ctx.strokeRect(0, 0, 100, 100);
+ checkPixel(50, 50, [0, 128, 0]);
+ ctx.restore();
+
+ // test closePath
+ ctx.save();
+ ctx.fillStyle = "red";
+ ctx.fillRect(0, 0, 100, 100);
+
+ ctx.beginPath();
+ ctx.strokeStyle = "green";
+ ctx.lineWidth = 100;
+ ctx.moveTo(-100, 50);
+ ctx.lineTo(-100, -100);
+ ctx.lineTo( 200, -100);
+ ctx.lineTo( 200, 50);
+ ctx.scale(0, 0);
+ ctx.closePath();
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
+ ctx.stroke();
+ ctx.restore();
+ checkPixel(50, 50, [0, 128, 0]);
+
+ // Test beginPath behaviour
+ ctx.fillStyle = "green";
+ ctx.fillRect(0, 0, 100, 100);
+ ctx.fillStyle = "red";
+ ctx.rect(0, 0, 100, 100);
+ ctx.scale(0, 0);
+ ctx.beginPath();
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
+ ctx.fill();
+
+ checkPixel(50, 50, [0, 128, 0]);
+
+}, "Tests to make sure we can assign to non-ctm effected properties with a non-invertible ctm set");
+</script>
</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698