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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-negative-source.html

Issue 2674933002: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Corrections 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-getImageData-negative-source.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-negative-source.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-negative-source.html
index cd22889cd6ae653f90280fb03a8ec299f0cc06e9..7aff9cbc8059175cfe4b7505b83b838dff3e9173 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-negative-source.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-negative-source.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-getImageData-negative-source.js"></script>
+<script>
+test(function(t) {
+ ctx = document.createElement('canvas').getContext('2d');
+
+ ctx.fillStyle = 'red';
+ ctx.fillRect(0, 0, 100, 100);
+ ctx.fillStyle = 'green';
+ ctx.fillRect(0, 0, 6, 6);
+
+ var imageData = ctx.getImageData(-10, 0, 100, 1);
+ var imgdata = imageData.data;
+
+ // Fully transparent black
+ assert_equals(imgdata[0], 0);
+ assert_equals(imgdata[1], 0);
+ assert_equals(imgdata[2], 0);
+ assert_equals(imgdata[3], 0);
+
+ // Green
+ assert_equals(imgdata[60], 0);
+ assert_equals(imgdata[61], 128);
+ assert_equals(imgdata[62], 0);
+ assert_equals(imgdata[63], 255);
+
+ // Red
+ assert_equals(imgdata[64], 255);
+ assert_equals(imgdata[65], 0);
+ assert_equals(imgdata[66], 0);
+ assert_equals(imgdata[67], 255);
+}, "Test the handling of negative sourceRect offset in getImageData().");
+</script>
</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698