Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-video-imageSmoothingEnabled.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-video-imageSmoothingEnabled.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-video-imageSmoothingEnabled.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..00151790e6030a77a65950662e65cd452ee60b1c |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-drawImage-video-imageSmoothingEnabled.html |
| @@ -0,0 +1,47 @@ |
| +<!DOCTYPE HTML> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script> |
| +function createNewCanvas(width, height) |
| +{ |
| + var canvas = document.createElement("canvas"); |
| + canvas.width = width; |
| + canvas.height = height; |
| + var ctx = canvas.getContext("2d"); |
| + ctx.clearRect(0, 0, width, height); |
| + return ctx; |
| +} |
| + |
| +function compareTwoCanvases(ctx1, ctx2, width, height) |
| +{ |
| + var data1 = ctx1.getImageData(0, 0, width, height).data; |
| + var data2 = ctx2.getImageData(0, 0, width, height).data; |
| + var dataMatched = true; |
| + for (var i = 0; i < data1.length; i++) { |
| + if (data1[i] != data2[i]) { |
| + dataMatched = false; |
| + break; |
| + } |
| + } |
| + assert_false(dataMatched); |
| +} |
| + |
| +async_test(function(t) { |
| + var video = document.createElement("video"); |
| + video.oncanplaythrough = t.step_func_done(function() { |
| + video.pause(); |
| + var width = 100; |
| + var height = 100; |
| + var ctx1 = createNewCanvas(width, height); |
| + var ctx2 = createNewCanvas(width, height); |
| + ctx1.imageSmoothingEnabled = true; |
| + ctx1.imageSmoothingQuality = 'low'; |
| + ctx2.imageSmoothingEnabled = true; |
| + ctx2.imageSmoothingQuality = 'high'; |
| + ctx1.drawImage(video, 0, 0, video.videoWidth, video.videoHeight, 0, 0, width, height); |
| + ctx2.drawImage(video, 0, 0, video.videoWidth, video.videoHeight, 0, 0, width, height); |
| + compareTwoCanvases(ctx1, ctx2, width, height); |
| + }); |
| + video.src = "../../compositing/resources/video.ogv"; |
| +}, 'createImageBitmap from a HTMLVideoElement with resize option.'); |
|
Justin Novosad
2016/08/25 19:18:19
Wrong text here.
xidachen
2016/08/26 02:21:39
Done.
|
| +</script> |