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

Unified Diff: LayoutTests/fast/canvas/alpha.js

Issue 14298018: This CL implements the first draft of Canvas 2D Context Attributes, aka getContext('2d', { alpha: f… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixes from review comments; remove WebPreferences.h changes; fix comment. Created 7 years, 8 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: LayoutTests/fast/canvas/alpha.js
diff --git a/LayoutTests/fast/canvas/alpha.js b/LayoutTests/fast/canvas/alpha.js
new file mode 100644
index 0000000000000000000000000000000000000000..a3c282acfe302d254b385f96a46f77931a48e0a1
--- /dev/null
+++ b/LayoutTests/fast/canvas/alpha.js
@@ -0,0 +1,25 @@
+description("Series of tests for canvas alpha");
+
+var canvas1 = document.getElementById("canvas1");
+var canvas2 = document.getElementById("canvas2");
+var ctx1 = canvas1.getContext("2d");
+var ctx2 = canvas2.getContext("2d", { alpha: false } );
+var ctx3 = canvas3.getContext("2d", {} );
+var imgData1 = ctx1.getImageData(0, 0, 1, 1);
+shouldBe("ctx1.getContextAttributes().alpha", "true");
+shouldBe("imgData1.data[0]", "0");
+shouldBe("imgData1.data[1]", "0");
+shouldBe("imgData1.data[2]", "0");
+shouldBe("imgData1.data[3]", "0");
+var imgData2 = ctx2.getImageData(0, 0, 1, 1);
+shouldBe("ctx2.getContextAttributes().alpha", "false");
+shouldBe("imgData2.data[0]", "0");
+shouldBe("imgData2.data[1]", "0");
+shouldBe("imgData2.data[2]", "0");
+shouldBe("imgData2.data[3]", "255");
+var imgData3 = ctx3.getImageData(0, 0, 1, 1);
+shouldBe("ctx3.getContextAttributes().alpha", "true");
+shouldBe("imgData3.data[0]", "0");
+shouldBe("imgData3.data[1]", "0");
+shouldBe("imgData3.data[2]", "0");
+shouldBe("imgData3.data[3]", "0");

Powered by Google App Engine
This is Rietveld 408576698