Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
michael@0 | 3 | <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> |
michael@0 | 4 | <!-- |
michael@0 | 5 | XUL Panel sizeTo tests |
michael@0 | 6 | --> |
michael@0 | 7 | <window title="XUL Panel sizeTo tests" |
michael@0 | 8 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 9 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
michael@0 | 10 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> |
michael@0 | 11 | |
michael@0 | 12 | <!-- test results are displayed in the html:body --> |
michael@0 | 13 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 14 | </body> |
michael@0 | 15 | |
michael@0 | 16 | <!-- test code goes here --> |
michael@0 | 17 | <script type="application/javascript"><![CDATA[ |
michael@0 | 18 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 19 | |
michael@0 | 20 | function openPopup() |
michael@0 | 21 | { |
michael@0 | 22 | document.getElementById("panel"). |
michael@0 | 23 | openPopupAtScreen(Math.round(window.mozInnerScreenX) + window.innerWidth - 130, |
michael@0 | 24 | Math.round(window.mozInnerScreenY) + window.innerHeight - 130); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | function sizeAndCheck(width, height) { |
michael@0 | 28 | var panel = document.getElementById("panel"); |
michael@0 | 29 | panel.sizeTo(width, height); |
michael@0 | 30 | is(panel.getBoundingClientRect().width, width, "width is correct"); |
michael@0 | 31 | is(panel.getBoundingClientRect().height, height, "height is correct"); |
michael@0 | 32 | |
michael@0 | 33 | } |
michael@0 | 34 | function popupShown(event) |
michael@0 | 35 | { |
michael@0 | 36 | var panel = document.getElementById("panel"); |
michael@0 | 37 | var bcr = panel.getBoundingClientRect(); |
michael@0 | 38 | // resize to 10px bigger in both dimensions. |
michael@0 | 39 | sizeAndCheck(bcr.width+10, bcr.height+10); |
michael@0 | 40 | // Same width, different height (based on *new* size from last sizeAndCheck) |
michael@0 | 41 | sizeAndCheck(bcr.width+10, bcr.height); |
michael@0 | 42 | // Same height, different width (also based on *new* size from last sizeAndCheck) |
michael@0 | 43 | sizeAndCheck(bcr.width, bcr.height); |
michael@0 | 44 | event.target.hidePopup(); |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | SimpleTest.waitForFocus(openPopup); |
michael@0 | 48 | ]]></script> |
michael@0 | 49 | |
michael@0 | 50 | <panel id="panel" onpopupshown="popupShown(event)" onpopuphidden="SimpleTest.finish()"> |
michael@0 | 51 | <resizer id="resizer" dir="bottomend" width="16" height="16"/> |
michael@0 | 52 | <hbox width="50" height="50" flex="1"/> |
michael@0 | 53 | </panel> |
michael@0 | 54 | |
michael@0 | 55 | </window> |