summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.value.worker.js
blob: 2308315b63bfe96c9cd6fab70e260cab2a7bd7d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
// OffscreenCanvas test in a worker:2d.filter.value
// Description:test if ctx.filter works correctly
// Note:

importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");

var t = async_test("test if ctx.filter works correctly");
var t_pass = t.done.bind(t);
var t_fail = t.step_func(function(reason) {
    throw reason;
});
t.step(function() {

  var canvas = new OffscreenCanvas(100, 50);
  var ctx = canvas.getContext('2d');

  _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)');
  t.done();
});
done();