2 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
3 <link rel=
"stylesheet" href=
"/tests/SimpleTest/test.css">
7 SpecialPowers
.pushPrefEnv({ 'set': [['canvas.filters.enabled', true]] }, function () {
9 var canvas
= document
.createElement('canvas');
10 var ctx
= canvas
.getContext('2d');
12 is(ctx
.filter
, 'none', 'filter should intialy be set to \'none\'');
13 ctx
.filter
= 'blur(5px)';
14 is(ctx
.filter
, 'blur(5px)', 'valid filter should round-trip');
18 is(ctx
.filter
, 'none', 'none should unset the filter');
20 is(ctx
.filter
, 'blur(5px)', 'filter should be part of the state');
22 ctx
.filter
= 'blur(10)';
23 is(ctx
.filter
, 'blur(5px)', 'invalid filter should be ignored');
24 ctx
.filter
= 'blur 10px';
25 is(ctx
.filter
, 'blur(5px)', 'syntax error should be ignored');
27 ctx
.filter
= 'inherit';
28 is(ctx
.filter
, 'blur(5px)', 'inherit should be ignored');
29 ctx
.filter
= 'initial';
30 is(ctx
.filter
, 'blur(5px)', 'initial should be ignored');
33 is(ctx
.filter
, 'blur(5px)', 'empty string should be ignored and not unset the filter');
35 is(ctx
.filter
, 'blur(5px)', 'null should be ignored and not unset the filter');
36 ctx
.filter
= undefined;
37 is(ctx
.filter
, 'blur(5px)', 'undefined should be ignored and not unset the filter');
43 SimpleTest
.waitForExplicitFinish();