| Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled.html
|
| index d9004064bd0626e2863b512a157ab5db97ecc9de..4e43cd70d873b095806c17da817913cecd743410 100644
|
| --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled.html
|
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled.html
|
| @@ -1,9 +1,72 @@
|
| -<!DOCTYPE html>
|
| -<html>
|
| -<head>
|
| - <script src="../../resources/js-test.js"></script>
|
| -</head>
|
| -<body>
|
| - <script src="script-tests/canvas-imageSmoothingEnabled.js"></script>
|
| +<script src="../../resources/testharness.js"></script>
|
| +<script src="../../resources/testharnessreport.js"></script>
|
| +<script>
|
| +test(function(t) {
|
| +
|
| +var ctx = document.createElement('canvas').getContext('2d');
|
| + assert_equals(ctx.imageSmoothingEnabled, true);
|
| +
|
| + ctx.imageSmoothingEnabled = false;
|
| + assert_equals(ctx.imageSmoothingEnabled, false);
|
| +
|
| + ctx.save();
|
| + ctx.imageSmoothingEnabled = true;
|
| + ctx.restore();
|
| + assert_equals(ctx.imageSmoothingEnabled, false);
|
| +
|
| + var image = document.createElement('canvas');
|
| + image.width = 2;
|
| + image.height = 1;
|
| +
|
| + // We use this to color the individual pixels
|
| + var dotter = ctx.createImageData(1, 1);
|
| +
|
| + // Color the left pixel black.
|
| + dotter.data.fill(0);
|
| + dotter.data[3] = 255;
|
| + image.getContext('2d').putImageData(dotter, 0, 0);
|
| +
|
| + // Color the right pixel white.
|
| + dotter.data.fill(255);
|
| + image.getContext('2d').putImageData(dotter, 1, 0);
|
| +
|
| + var canvas = document.createElement('canvas');
|
| + canvas.width = 4;
|
| + canvas.height = 1;
|
| + ctx = canvas.getContext('2d');
|
| + ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
|
| + left_of_center_pixel = ctx.getImageData(1, 0, 1, 1);
|
| +
|
| + assert_not_equals(left_of_center_pixel.data[0], 0);
|
| + assert_not_equals(left_of_center_pixel.data[1], 0);
|
| + assert_not_equals(left_of_center_pixel.data[2], 0);
|
| +
|
| + ctx.imageSmoothingEnabled = false;
|
| + ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
|
| + left_of_center_pixel = ctx.getImageData(1, 0, 1, 1);
|
| +
|
| + assert_equals(left_of_center_pixel.data[0], 0);
|
| + assert_equals(left_of_center_pixel.data[1], 0);
|
| + assert_equals(left_of_center_pixel.data[2], 0);
|
| +
|
| + ctx.imageSmoothingEnabled = true;
|
| + ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
|
| + left_of_center_pixel = ctx.getImageData(1, 0, 1, 1);
|
| +
|
| + assert_not_equals(left_of_center_pixel.data[0], 0);
|
| + assert_not_equals(left_of_center_pixel.data[1], 0);
|
| + assert_not_equals(left_of_center_pixel.data[2], 0);
|
| +
|
| + ctx.imageSmoothingEnabled = false;
|
| + ctx.save();
|
| + ctx.imageSmoothingEnabled = true;
|
| + ctx.restore();
|
| + ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
|
| + left_of_center_pixel = ctx.getImageData(1, 0, 1, 1);
|
| + assert_equals(left_of_center_pixel.data[0], 0);
|
| + assert_equals(left_of_center_pixel.data[1], 0);
|
| + assert_equals(left_of_center_pixel.data[2], 0);
|
| +
|
| + }, "Tests for the imageSmoothingEnabled attribute.");
|
| +</script>
|
| </body>
|
| -</html>
|
|
|