layout/base/tests/test_bug514127.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/tests/test_bug514127.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=514127
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 514127</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.13 +</head>
    1.14 +<body onload="runTest();">
    1.15 +<p><a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=514127">Mozilla Bug 514127</a></p>
    1.16 +
    1.17 +<!--
    1.18 +iframe source is
    1.19 +<html><body style='background: rgb(0,0,255); width: 100px; height: 50100px;'></body></html>
    1.20 +-->
    1.21 +<iframe id="source" width="50" height="50"
    1.22 +       src="data:text/html,%3Chtml%3E%3Cbody%20style%3D%27background%3A%20rgb%280%2C0%2C255%29%3B%20width%3A%20100px%3B%20height%3A%2050100px%3B%27%3E%3C%2Fbody%3E%3C%2Fhtml%3E"></iframe>
    1.23 +
    1.24 +<pre id="test">
    1.25 +<script type="application/javascript">
    1.26 +
    1.27 +/** Test for Bug 514127 **/
    1.28 +
    1.29 +SimpleTest.waitForExplicitFinish();
    1.30 +
    1.31 +function runTest() {
    1.32 +  
    1.33 +  var source = document.getElementById('source').contentWindow;
    1.34 +  var canvasWidth = 50;
    1.35 +  var canvasHeight = 50;
    1.36 +
    1.37 +  rect = { left: 25, top: 50000,
    1.38 +           width: canvasWidth, height: canvasHeight };
    1.39 +  var canvas = SpecialPowers.snapshotRect(source, rect, "transparent");
    1.40 +  var context = canvas.getContext("2d");
    1.41 +  
    1.42 +  var data = context.getImageData(0, 0, canvasWidth, canvasHeight).data;
    1.43 +  var failed = false;
    1.44 +  for (var i = 0; i < data.length; i+=4) {
    1.45 +    if (data[i] != 0 || data[i+1] != 0 || data[i+2] != 255 || data[i+3] != 255) {
    1.46 +      failed = true;
    1.47 +      break;
    1.48 +    }
    1.49 +  }
    1.50 +  ok(!failed, "all pixels blue");
    1.51 +  
    1.52 +  SimpleTest.finish();
    1.53 +}
    1.54 +
    1.55 +</script>
    1.56 +</pre>
    1.57 +</body>
    1.58 +</html>

mercurial