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

Unified Diff: LayoutTests/fast/canvas/canvas-filter-value.html

Issue 1194733002: Adding the 'filter' context attribute to 2D canvas (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: applied corrections Created 5 years, 6 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/canvas-filter-value.html
diff --git a/LayoutTests/fast/canvas/canvas-filter-value.html b/LayoutTests/fast/canvas/canvas-filter-value.html
new file mode 100644
index 0000000000000000000000000000000000000000..f3719e4f3e216cf8c0a19239921926cd5923d9af
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-filter-value.html
@@ -0,0 +1,39 @@
+<script src="../../resources/js-test.js"></script>
+<script>
+
+var canvas = document.createElement('canvas');
+var ctx = canvas.getContext('2d');
+
+shouldBe('ctx.filter', '"none"');
+ctx.filter = 'blur(5px)';
+shouldBe('ctx.filter', '"blur(5px)"');
+
+ctx.save();
+ctx.filter = 'none';
+shouldBe('ctx.filter', '"none"');
+ctx.restore();
+shouldBe('ctx.filter', '"blur(5px)"');
+
+// Invalid filter should be ignored
+ctx.filter = 'blur(10)';
+shouldBe('ctx.filter', '"blur(5px)"');
+ctx.filter = 'blur 10px';
+shouldBe('ctx.filter', '"blur(5px)"');
+
+ctx.filter = 'inherit';
+shouldBe('ctx.filter', '"blur(5px)"');
+ctx.filter = 'initial';
+shouldBe('ctx.filter', '"blur(5px)"');
+
+ctx.filter = '';
+shouldBe('ctx.filter', '"blur(5px)"');
+ctx.filter = null;
+shouldBe('ctx.filter', '"blur(5px)"');
+ctx.filter = undefined;
+shouldBe('ctx.filter', '"blur(5px)"');
+
+// verify that exact string is preserved
+ctx.filter = 'blur( 5px)';
+shouldBe('ctx.filter', '"blur( 5px)"');
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698