dom/plugins/test/mochitest/test_zero_opacity.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/plugins/test/mochitest/test_zero_opacity.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,44 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Test whether windowed plugins with opacity:0 get their window set correctly</title>
     1.8 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     1.9 +  <script type="text/javascript" src="utils.js"></script>
    1.10 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.11 +
    1.12 +<body onload="startTest()">
    1.13 +  <script type="application/javascript;version=1.8">
    1.14 +  SimpleTest.waitForExplicitFinish();
    1.15 +  setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
    1.16 +
    1.17 +  var p = null;
    1.18 +
    1.19 +  function startTest() {
    1.20 +    p = document.getElementById('theplugin');
    1.21 +    if (!p.hasWidget()) {
    1.22 +      todo(false, "This test is only relevant for windowed plugins");
    1.23 +      SimpleTest.finish();
    1.24 +      return;
    1.25 +    }
    1.26 +
    1.27 +    // Wait for the plugin to have painted once.
    1.28 +    var interval = setInterval(function() {
    1.29 +      if (!p.getPaintCount())
    1.30 +        return;
    1.31 +
    1.32 +      clearInterval(interval);
    1.33 +      doTest();
    1.34 +      SimpleTest.finish();
    1.35 +    }, 100);
    1.36 +  }
    1.37 +
    1.38 +  function doTest() {
    1.39 +    is(p.getClipRegionRectCount(), 1, "getClipRegionRectCount should be a single rect");
    1.40 +    is(p.getClipRegionRectEdge(0,2) - p.getClipRegionRectEdge(0,0), 100, "width of clip region rect");
    1.41 +    is(p.getClipRegionRectEdge(0,3) - p.getClipRegionRectEdge(0,1), 50, "height of clip region rect");
    1.42 +  }
    1.43 +  </script>
    1.44 +
    1.45 +  <p id="display"></p>
    1.46 +
    1.47 +  <embed id="theplugin" type="application/x-test" width="100" height="50" style="opacity:0" wmode="window"></embed>
    1.48 \ No newline at end of file

mercurial