1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/base/tests/test_bug469170.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,49 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=469170 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 469170</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=469170">Mozilla Bug 469170</a></p> 1.16 + 1.17 +<iframe id="source" width="50" height="50" 1.18 + src="data:text/html,%3Chtml%3E%3C%2Fhtml%3E"></iframe> 1.19 + 1.20 +<pre id="test"> 1.21 +<script type="application/javascript"> 1.22 + 1.23 +/** Test for Bug 469170 **/ 1.24 + 1.25 +SimpleTest.waitForExplicitFinish(); 1.26 + 1.27 +function runTest() { 1.28 + var source = document.getElementById('source').contentWindow; 1.29 + rect = { left: 0, top: 0, 1.30 + width: source.innerWidth, height: source.innerHeight }; 1.31 + var canvas = SpecialPowers.snapshotRect(source, rect, "transparent"); 1.32 + var context = canvas.getContext("2d"); 1.33 + 1.34 + var components = [ "red", "green", "blue", "alpha" ]; 1.35 + 1.36 + var data = context.getImageData(0, 0, canvas.width, canvas.height).data; 1.37 + var failed = false; 1.38 + for (var i = 0; i < data.length; i++) { 1.39 + if (data[i] != 0) { 1.40 + is(data[i], 0, "pixel " + Math.floor(i/4) + " " + components[i%4]); 1.41 + failed = true; 1.42 + } 1.43 + } 1.44 + if (!failed) { 1.45 + ok(!failed, "all pixels fully transparent"); 1.46 + } 1.47 + SimpleTest.finish(); 1.48 +} 1.49 +</script> 1.50 +</pre> 1.51 +</body> 1.52 +</html>