Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/canvas/translate-text.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/translate-text.html b/third_party/WebKit/LayoutTests/fast/canvas/translate-text.html |
| index 60992030f7a911a9354d3d254eb415466fe0e867..651a227424d1da3c67924d6bf6bda01ce41cafd2 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/canvas/translate-text.html |
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/translate-text.html |
| @@ -1,9 +1,39 @@ |
| -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| -<html> |
| -<head> |
| -<script src="../../resources/js-test.js"></script> |
| -</head> |
| -<body> |
| -<script src="script-tests/translate-text.js"></script> |
| -</body> |
| -</html> |
| +<!DOCTYPE html> |
| +<title>Test for chromium's canvas bug where fillText resets the current context</title> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| + |
| +<body></body> |
| +<script> |
| +test(function() { |
| + function pixelToString(p) { |
| + return "[" + p[0] + ", " + p[1] + ", " + p[2] + ", " + p[3] + "]" |
|
sivag
2016/09/15 05:31:14
maintain indentation
Abhishek Kanike
2016/09/15 11:52:56
Done.
|
| + } |
| + |
| + var canvas = document.createElement("canvas"); |
| + canvas.height = 100; |
| + canvas.width = 500; |
| + canvas.style.height = "100"; |
| + canvas.style.width = "500"; |
| + |
| + document.body.appendChild(canvas); |
| + |
| + var ctx = canvas.getContext('2d'); |
| + ctx.fillStyle = 'rgb(0,255,0)'; |
| + ctx.fillRect(0, 0, 500, 100); |
| + ctx.fillStyle = 'rgb(0,0,0)'; |
| + ctx.fillText("This text should be seen", 20, 20); |
| + ctx.translate(0, 50); |
| + ctx.font = "10pt Arial"; |
| + ctx.fillText("This text should NOT be seen", 20, 20); |
| + // If fillText resets the current context, this rectangle won't hide the text. |
| + ctx.fillStyle = 'rgb(0,0,0)'; |
| + ctx.fillRect(0, 0, 500, 50); |
| + |
| + // Pixel value at 0, 0 |
|
sivag
2016/09/15 05:31:14
maintain indentation
Abhishek Kanike
2016/09/15 11:52:56
Done.
|
| + var imageData = ctx.getImageData(0, 0, 1, 1); |
| + var pixel = imageData.data; |
| + |
| + assert_equals(pixelToString(pixel), "[0, 255, 0, 255]"); |
| +}); |
| +</script> |