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

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

Issue 2689243002: 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-pattern-transform.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-pattern-transform.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-pattern-transform.html
index a546d9704f6fc054b30cded5b4beaeecaffde4c6..ec9d6cbf519fc127e8cfd270c649dc5301ff0ad0 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-pattern-transform.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-pattern-transform.html
@@ -1,9 +1,43 @@
-<!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="canvas-pattern-transform.js"></script>
+<script>
+var canvas = document.createElement('canvas');
+canvas.width = 100;
+canvas.height = 100;
+var ctx2 = canvas.getContext('2d');
+ctx2.fillStyle = '#0f0';
+ctx2.fillRect(0, 0, 50, 50);
+ctx2.fillRect(50, 50, 50, 50);
+ctx2.fillStyle = '#f00';
+ctx2.fillRect(50, 0, 50, 50);
+ctx2.fillRect(0, 50, 50, 50);
+
+var ctx = document.createElement('canvas').getContext('2d');
+
+ctx.save();
+ctx.transform(2, 0, 0, 2, 0, 0);
+var pattern = ctx.createPattern(canvas, 'repeat');
+ctx.fillStyle = pattern;
+ctx.fillRect(0, 0, 100, 100);
+ctx.restore();
+
+ctx.save();
+ctx.transform(0.5, 0, 0, 0.5, 0, 0);
+pattern = ctx.createPattern(canvas, 'repeat');
+ctx.fillStyle = pattern;
+ctx.fillRect(0, 0, 100, 100);
+ctx.restore();
+
+test(function(t) {
+ var imageData = ctx.getImageData(26, 26, 74, 74).data;
+ assert_array_equals(imageData.slice(4, 7), [0, 255, 0]);
+
+ imageData = ctx.getImageData(25, 0, 25, 25).data;
+ assert_array_equals(imageData.slice(4, 7), [255, 0, 0]);
+
+ imageData = ctx.getImageData(0, 0, 25, 25).data;
+ assert_array_equals(imageData.slice(4, 7), [0, 255, 0]);
+}, "Series of tests to ensure correct behaviour on transform of a pattern.");
+</script>
</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698