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..644a3c9804fc553f0182ba50b6c1197095e0fce2 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,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-getImageData-negative-source.js"></script> |
+<script> |
+test(function(t) { |
+ |
+ctx = document.createElement('canvas').getContext('2d'); |
Justin Novosad
2017/02/03 18:07:18
indent
|
+ |
+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> |