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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-repaint.html

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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-repaint.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-repaint.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-repaint.html
index db9365306f0659c737e50cbcd8ce1a476b19a3b5..ca94e8111f65396267a57cf184f56ca75b838403 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-repaint.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-repaint.html
@@ -1,11 +1,54 @@
-<!DOCTYPE html>
-<html>
-<head>
- <script src="../../resources/js-test.js"></script>
-</head>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
<body>
- <canvas id="destination" width="300" height="300"></canvas>
- <canvas id="source" width="300" height="300"></canvas>
- <script src="script-tests/canvas-imageSmoothingEnabled-repaint.js"></script>
+<canvas id="destination" width="300" height="300"></canvas>
+<canvas id="source" width="300" height="300"></canvas>
+<script>
+// This is a regression test for bug https://bugs.webkit.org/show_bug.cgi?id=89018
+var dstCanvas = document.getElementById("destination");
+var dstCtx = dstCanvas.getContext('2d');
+var srcCanvas = document.getElementById("source");
+var srcCtx = srcCanvas.getContext('2d');
+
+var srcCanvas, srcCtx, dstCanvas, dstCtx;
+
+function draw()
+{
+ srcCtx.clearRect(0, 0, 300, 300);
+ dstCtx.clearRect(0, 0, 300, 300);
+ srcCtx.fillStyle = "rgb(255, 0, 0)";
+ srcCtx.fillRect(0, 0, 1, 1);
+ srcCtx.fillStyle = "rgb(0, 255, 0)";
+ srcCtx.fillRect(1, 0, 1, 1);
+ dstCtx.imageSmoothingEnabled = false;
+ dstCtx.drawImage(srcCanvas, 0, 0, 2, 1, 0, 0, 300, 300);
+}
+
+// Bug 89018 requires 2 draw iteration in order to manifest itself.
+var drawIterations = 2;
+
+function BrowserPaint()
+{
+ draw();
+ if (drawIterations > 0) {
+ drawIterations = drawIterations - 1;
+ window.requestAnimationFrame(BrowserPaint);
+ return;
+ }
+ test(function(t) {
+ // Test that the image is not filtered
+ left_of_center_pixel = dstCtx.getImageData(149, 150, 1, 1);
+ assert_equals(left_of_center_pixel.data[0], 255);
+ assert_equals(left_of_center_pixel.data[1], 0);
+ assert_equals(left_of_center_pixel.data[2], 0);
+ right_of_center_pixel = dstCtx.getImageData(150, 150, 1, 1);
+ assert_equals(right_of_center_pixel.data[0], 0);
+ assert_equals(right_of_center_pixel.data[1], 255);
+ assert_equals(right_of_center_pixel.data[2], 0);
+ }, "Tests that disabling the imageSmoothingEnabled attribute still works after multiple repaints");
+}
+
+window.onload = BrowserPaint;
+
+</script>
</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698