Bug 1935611 - Fix libyuv/libpng link failed for loongarch64. r=glandium,tnikkel,ng
[gecko.git] / dom / canvas / test / test_filter.html
blobf4cac00a4bb5b8737e93cb7ef9fafee502b249ec
1 <!DOCTYPE HTML>
2 <script src="/tests/SimpleTest/SimpleTest.js"></script>
3 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
4 <body>
5 <script>
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');
16 ctx.save();
17 ctx.filter = 'none';
18 is(ctx.filter, 'none', 'none should unset the filter');
19 ctx.restore();
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');
32 ctx.filter = '';
33 is(ctx.filter, 'blur(5px)', 'empty string should be ignored and not unset the filter');
34 ctx.filter = null;
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');
39 SimpleTest.finish();
41 });
43 SimpleTest.waitForExplicitFinish();
45 </script>