layout/base/tests/chrome/chrome_content_integration_window.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/tests/chrome/chrome_content_integration_window.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,45 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
     1.6 +<window title="Content/chrome integration subwindow"
     1.7 +        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     1.8 +        onload="runTests()"
     1.9 +        style="background:black; -moz-appearance:none;">
    1.10 +  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
    1.11 +
    1.12 +  <stack style="height:300px; width:200px;">
    1.13 +    <!-- the bottom 100px is a strip of black that should be vixible through the content iframe -->
    1.14 +    <vbox style="background:pink; border-bottom:100px solid black"/>
    1.15 +    <!-- the middle 100px is a strip of black in the content iframe -->
    1.16 +    <!-- the bottom 100px of the iframe is transparent, the top 100px is yellow -->
    1.17 +    <iframe type="content" style="border:none;"
    1.18 +            transparent="transparent"
    1.19 +            src="data:text/html,&lt;div style='position:absolute;left:0;top:0;width:100%;height:100px;background:yellow;border-bottom:100px solid black'&gt;"/>
    1.20 +    <!-- the top 100px is a strip of black above the content iframe -->
    1.21 +    <vbox style="border-top:100px solid black;"/>
    1.22 +  </stack>
    1.23 +
    1.24 +  <script type="application/javascript">
    1.25 +    <![CDATA[
    1.26 +    var imports = [ "SimpleTest", "is", "isnot", "ok", "SpecialPowers" ];
    1.27 +    for each (var name in imports) {
    1.28 +      window[name] = window.opener.wrappedJSObject[name];
    1.29 +    }
    1.30 +    
    1.31 +    function runTests() {
    1.32 +      var testCanvas = snapshotWindow(window);
    1.33 +
    1.34 +      var refCanvas = snapshotWindow(window);
    1.35 +      var ctx = refCanvas.getContext('2d');
    1.36 +      ctx.fillStyle = "black";
    1.37 +      ctx.fillRect(0, 0, refCanvas.width, refCanvas.height);
    1.38 +
    1.39 +      var comparison = compareSnapshots(testCanvas, refCanvas, true);
    1.40 +      ok(comparison[0], "Rendering OK, got " + comparison[1] + ", expected " + comparison[2]);
    1.41 +
    1.42 +      var tester = window.SimpleTest;
    1.43 +      window.close();
    1.44 +      tester.finish();
    1.45 +    }
    1.46 +    ]]>
    1.47 +  </script>
    1.48 +</window>

mercurial