tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_filter.html (1433B)


      1 <!DOCTYPE HTML>
      2 <script src="/tests/SimpleTest/SimpleTest.js"></script>
      3 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
      4 <body>
      5 <script>
      6 
      7 SpecialPowers.pushPrefEnv({ 'set': [['canvas.filters.enabled', true]] }, function () {
      8 
      9  var canvas = document.createElement('canvas');
     10  var ctx = canvas.getContext('2d');
     11 
     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');
     15 
     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');
     21 
     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');
     26 
     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');
     31 
     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');
     38 
     39  SimpleTest.finish();
     40  
     41 });
     42 
     43 SimpleTest.waitForExplicitFinish();
     44 
     45 </script>