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

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

Issue 2671853004: 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-alphaImageData-behavior.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-alphaImageData-behavior.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-alphaImageData-behavior.html
index d0d17b23a09f7d440660cb67f51ff0a4bdabb59c..0813297f59060240e40d3916c8796813da946963 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-alphaImageData-behavior.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-alphaImageData-behavior.html
@@ -1,10 +1,27 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src="../../resources/js-test.js"></script>
-</head>
-<body>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
<canvas id="canvas" width="200" height="200"></canvas>
-<script src="canvas-alphaImageData-behavior.js"></script>
-</body>
-</html>
+
+<script>
+test(function(t) {
+ var ctx = document.getElementById('canvas').getContext('2d');
+ ctx.fillStyle = 'rgba(255, 0, 0, 0.01)';
+ ctx.fillRect(0, 0, 1, 200);
+ ctx.fillStyle = 'rgba(0, 255, 0, 0.995)';
+ ctx.fillRect(1, 0, 199, 200);
+
+ var imageData = ctx.getImageData(0, 0, 200, 200);
+ var imgdata = imageData.data;
+ assert_equals(imgdata[4], 0);
+ assert_equals(imgdata[5], 255);
+ assert_equals(imgdata[6], 0);
+ assert_equals(imgdata[7], 254);
+
+ ctx.putImageData(imageData, 0, 0);
+ imgdata = ctx.getImageData(0, 0, 200, 200).data;
+ assert_equals(imgdata[4], 0);
+ assert_equals(imgdata[5], 255);
+ assert_equals(imgdata[6], 0);
+ assert_equals(imgdata[7], 254);
+}, 'Series of tests to ensure correct behaviour of getImageData and putImageData when alpha is involved.');
+</script>

Powered by Google App Engine
This is Rietveld 408576698