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

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

Issue 2675763005: 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-copyPixels.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-copyPixels.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-copyPixels.html
index d6d7d21fe1d8ca65883c61a59bf798fd5961587e..52b93decfc7b24a2870e55b210905c0d2712a2df 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-copyPixels.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-copyPixels.html
@@ -1,9 +1,37 @@
-<!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-copyPixels.js"></script>
+<script>
+test(function(t) {
+ var ctx = document.createElement('canvas').getContext('2d');
+
+ ctx.fillStyle = "red";
+ ctx.fillRect(0,0,50,20);
+ ctx.fillStyle = "green";
+ ctx.fillRect(50,0,50,20);
+ ctx.fillStyle = "blue";
+ ctx.fillRect(100,0,50,20);
+
+ var data = ctx.getImageData(0,0,150,20);
+ ctx.putImageData(data, 0, 20);
+
+ var imageData = ctx.getImageData(1, 21, 48, 18);
+ var imgdata = imageData.data;
+ assert_equals(imgdata[4], 255);
+ assert_equals(imgdata[5], 0);
+ assert_equals(imgdata[6], 0);
+
+ imageData = ctx.getImageData(51, 21, 48, 18);
+ imgdata = imageData.data;
+ assert_equals(imgdata[4], 0);
+ assert_equals(imgdata[5], 128);
+ assert_equals(imgdata[6], 0);
+
+ imageData = ctx.getImageData(101, 21, 48, 18);
+ imgdata = imageData.data;
+ assert_equals(imgdata[4], 0);
+ assert_equals(imgdata[5], 0);
+ assert_equals(imgdata[6], 255);
+}, "Test if putImageData gives back the same result as getImageData");
+</script>
</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698