diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /layout/base/tests/chrome/default_background_window.xul | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/base/tests/chrome/default_background_window.xul')
-rw-r--r-- | layout/base/tests/chrome/default_background_window.xul | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/layout/base/tests/chrome/default_background_window.xul b/layout/base/tests/chrome/default_background_window.xul new file mode 100644 index 000000000..110dd8c15 --- /dev/null +++ b/layout/base/tests/chrome/default_background_window.xul @@ -0,0 +1,60 @@ +<?xml version="1.0"?> +<?xml-stylesheet type="text/css" href="chrome://global/skin"?> +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" + type="text/css"?> +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + onload="runTests()"> + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + <script type="text/javascript" + src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script> + + <iframe type="content" id="f" src="about:blank" style="border:1px solid black;"/> + + <script type="application/javascript"> + <![CDATA[ + SimpleTest.waitForExplicitFinish(); + + var imports = [ "SimpleTest", "is", "isnot", "ok" ]; + for (var name of imports) { + window[name] = window.opener.wrappedJSObject[name]; + } + + function snapshot(win) { + var el = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"); + el.width = win.innerWidth; + el.height = win.innerHeight; + + var ctx = el.getContext("2d"); + ctx.drawWindow(win, 0, 0, + win.innerWidth, win.innerHeight, + "rgba(0,0,0,0)", 0); + return el; + } + + var color = '#2468AC'; + var prefs = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); + prefs.setCharPref('browser.display.background_color', color); + + function runTests() { + var f = document.getElementById("f"); + + var testCanvas = snapshot(f.contentWindow); + prefs.clearUserPref('browser.display.background_color'); + + var refCanvas = snapshot(f.contentWindow); + var ctx = refCanvas.getContext('2d'); + ctx.fillStyle = color; + ctx.fillRect(0, 0, refCanvas.width, refCanvas.height); + + var comparison = compareSnapshots(testCanvas, refCanvas, true); + ok(comparison[0], "Rendering OK, got " + comparison[1] + ", expected " + comparison[2]); + + var tester = window.SimpleTest; + window.close(); + tester.finish(); + } + ]]> + </script> +</window> |