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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-state-intact-after-putImageData.html

Issue 2693193003: 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-state-intact-after-putImageData.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-state-intact-after-putImageData.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-state-intact-after-putImageData.html
index 7c555c08459f82eaa8f484119fdc836bb10be524..fa5375ca6e66b0f6b9250b3e11e8eac018c21e2b 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-state-intact-after-putImageData.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-state-intact-after-putImageData.html
@@ -1,9 +1,28 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src="../../resources/js-test.js"></script>
-</head>
-<body>
-<script src="script-tests/canvas-state-intact-after-putImageData.js"></script>
-</body>
-</html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+
+<script>
+test(function(t) {
+
+ var ctx = document.createElement('canvas').getContext('2d');
+
+ ctx.fillStyle = 'red';
+ ctx.fillRect(0, 0, 1, 1);
+
+ assert_equals(ctx.fillStyle, '#ff0000');
+ var imageData = ctx.getImageData(0, 0, 2, 1);
+ assert_array_equals(imageData.data.slice(0,4), [255, 0, 0, 255]);
+ assert_array_equals(imageData.data.slice(4), [0, 0, 0, 0]);
+
+ ctx.putImageData(imageData, 1, 1);
+ imageData = ctx.getImageData(1, 1, 1, 1);
+ assert_array_equals(imageData.data, [255, 0, 0, 255]);
+
+ assert_equals(ctx.fillStyle, '#ff0000');
+
+ ctx.fillRect(2, 2, 1, 1);
+ data = ctx.getImageData(2, 2, 1, 1).data;
+ assert_array_equals(data, [255, 0, 0, 255]);
+
+}, "Test that the rendering context state is intact after a call to putImageData()");
+</script>

Powered by Google App Engine
This is Rietveld 408576698