Bug 1630798 [wpt PR 23036] - Move canvas-filter-value.html to wpt, a=testonly
authorYi Xu <yiyix@chromium.org>
Tue, 28 Apr 2020 11:33:11 +0000
changeset 527521 d8414923398ea820da780d25e92e8ac9011d8090
parent 527520 59d482cdb6bccf00c3120dc318c273afa3a76874
child 527522 fbd868c8613c7e913785d57e9c2c6728c869a967
push id37368
push userbtara@mozilla.com
push dateFri, 01 May 2020 21:45:51 +0000
treeherdermozilla-central@0f9c5a59e45d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1630798, 23036, 1071659, 2153927, 760612
milestone77.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1630798 [wpt PR 23036] - Move canvas-filter-value.html to wpt, a=testonly Automatic update from web-platform-tests Move canvas-filter-value.html to wpt Bug: 1071659 Change-Id: I3d062969335f76fdeef583683bfd390d49b9a21e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2153927 Reviewed-by: Fernando Serboncini <fserb@chromium.org> Commit-Queue: Yi Xu <yiyix@chromium.org> Cr-Commit-Position: refs/heads/master@{#760612} -- wpt-commits: e6147a55a769382e38a115fdfa420f4b11174e6a wpt-pr: 23036
testing/web-platform/tests/2dcontext/2d.filter.value.html
testing/web-platform/tests/2dcontext/tools/tests2d.yaml
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/2dcontext/2d.filter.value.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /2dcontext/tools/gentest.py. -->
+<title>Canvas test: 2d.filter.value</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/2dcontext/resources/canvas-tests.js"></script>
+<link rel="stylesheet" href="/2dcontext/resources/canvas-tests.css">
+<body class="show_output">
+
+<h1>2d.filter.value</h1>
+<p class="desc">test if ctx.filter works correctly</p>
+
+
+<p class="output">Actual output:</p>
+<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
+
+<ul id="d"></ul>
+<script>
+var t = async_test("test if ctx.filter works correctly");
+_addTest(function(canvas, ctx) {
+
+_assert(ctx.filter == 'none', "ctx.filter == 'none'");
+ctx.filter = 'blur(5px)';
+_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'");
+ctx.save();
+ctx.filter = 'none';
+_assert(ctx.filter == 'none', "ctx.filter == 'none'");
+ctx.restore();
+_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'");
+
+ctx.filter = 'blur(10)';
+_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'");
+ctx.filter = 'blur 10px';
+_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'");
+
+ctx.filter = 'inherit';
+_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'");
+ctx.filter = 'initial';
+_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'");
+ctx.filter = 'unset';
+_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'");
+
+ctx.filter = '';
+_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'");
+ctx.filter = null;
+_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'");
+ctx.filter = undefined;
+_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'");
+
+ctx.filter = 'blur(  5px)';
+assert_equals(ctx.filter, 'blur(  5px)');
+
+
+});
+</script>
+
--- a/testing/web-platform/tests/2dcontext/tools/tests2d.yaml
+++ b/testing/web-platform/tests/2dcontext/tools/tests2d.yaml
@@ -10323,8 +10323,46 @@
     window.scrollTo(0, 0);
 
     var path = new Path2D();
     path.rect(4, 8, 16, 32);
     ctx.scrollPathIntoView(path);
     var rect = canvas.getBoundingClientRect();
     @assert Math.round(rect.top) === -8;
     @assert Math.round(rect.left) === 200;
+
+- name: 2d.filter.value
+  desc: test if ctx.filter works correctly
+  testing:
+    - 2d.filter.value
+  code: |
+    @assert ctx.filter == 'none';
+    ctx.filter = 'blur(5px)';
+    @assert ctx.filter == 'blur(5px)';
+    ctx.save();
+    ctx.filter = 'none';
+    @assert ctx.filter == 'none';
+    ctx.restore();
+    @assert ctx.filter == 'blur(5px)';
+
+    ctx.filter = 'blur(10)';
+    @assert ctx.filter == 'blur(5px)';
+    ctx.filter = 'blur 10px';
+    @assert ctx.filter == 'blur(5px)';
+
+    ctx.filter = 'inherit';
+    @assert ctx.filter == 'blur(5px)';
+    ctx.filter = 'initial';
+    @assert ctx.filter == 'blur(5px)';
+    ctx.filter = 'unset';
+    @assert ctx.filter == 'blur(5px)';
+
+    ctx.filter = '';
+    @assert ctx.filter == 'blur(5px)';
+    ctx.filter = null;
+    @assert ctx.filter == 'blur(5px)';
+    ctx.filter = undefined;
+    @assert ctx.filter == 'blur(5px)';
+
+    ctx.filter = 'blur(  5px)';
+    assert_equals(ctx.filter, 'blur(  5px)');
+
+