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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-imageSmoothingEnabled-repaint.js

Issue 2679083003: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Adding virtual/gpu/fast/canvas/canvas-imageSmoothingQuality.html to TestExpectations 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 unified diff | Download patch
OLDNEW
(Empty)
1 // This is a regression test for bug https://bugs.webkit.org/show_bug.cgi?id=890 18
2
3 description("Tests that disabling the imageSmoothingEnabled attribute still work s after multiple repaints");
4 var dstCanvas = document.getElementById("destination");
5 var dstCtx = dstCanvas.getContext('2d');
6 var srcCanvas = document.getElementById("source");
7 var srcCtx = srcCanvas.getContext('2d');
8
9
10 var srcCanvas, srcCtx, dstCanvas, dstCtx;
11
12 function draw()
13 {
14 srcCtx.clearRect(0, 0, 300, 300);
15 dstCtx.clearRect(0, 0, 300, 300);
16 srcCtx.fillStyle = "rgb(255, 0, 0)";
17 srcCtx.fillRect(0, 0, 1, 1);
18 srcCtx.fillStyle = "rgb(0, 255, 0)";
19 srcCtx.fillRect(1, 0, 1, 1);
20 dstCtx.imageSmoothingEnabled = false;
21 dstCtx.drawImage(srcCanvas, 0, 0, 2, 1, 0, 0, 300, 300);
22 }
23
24 function testResult() {
25 debug("Test that the image is not filtered");
26 left_of_center_pixel = dstCtx.getImageData(149, 150, 1, 1);
27 shouldBe("left_of_center_pixel.data[0]", "255");
28 shouldBe("left_of_center_pixel.data[1]", "0");
29 shouldBe("left_of_center_pixel.data[2]", "0");
30 right_of_center_pixel = dstCtx.getImageData(150, 150, 1, 1);
31 shouldBe("right_of_center_pixel.data[0]", "0");
32 shouldBe("right_of_center_pixel.data[1]", "255");
33 shouldBe("right_of_center_pixel.data[2]", "0");
34 finishJSTest();
35 }
36
37 // Bug 89018 requires 2 draw iteration in order to manifest itself.
38 var drawIterations = 2;
39
40 function BrowserPaint(){
41 draw();
42 if (drawIterations > 0) {
43 drawIterations = drawIterations - 1;
44 window.requestAnimationFrame(BrowserPaint);
45 } else {
46 testResult();
47 }
48 }
49
50 function onLoadHandler()
51 {
52 BrowserPaint();
53 }
54
55 window.jsTestIsAsync = true;
56 window.onload = onLoadHandler;
57
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698