mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
c990b1c7e2
r=roc.
107 lines
4.2 KiB
XML
107 lines
4.2 KiB
XML
<?xml version="1.0"?>
|
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
|
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
|
|
<?xml-stylesheet href="data:text/css,description {min-width: 1px; padding: 2px;}" type="text/css"?>
|
|
<!--
|
|
XUL <resizer> tests
|
|
-->
|
|
<window title="XUL resizer tests"
|
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
<script type="application/javascript" src="/MochiKit/packed.js" />
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"/>
|
|
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"/>
|
|
|
|
<!-- test results are displayed in the html:body -->
|
|
<body xmlns="http://www.w3.org/1999/xhtml">
|
|
</body>
|
|
|
|
<!-- test code goes here -->
|
|
<script type="application/javascript"><![CDATA[
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
function openPopup()
|
|
{
|
|
document.getElementById("panel").
|
|
openPopupAtScreen(Math.round(window.mozInnerScreenX) + window.innerWidth - 130,
|
|
Math.round(window.mozInnerScreenY) + window.innerHeight - 130);
|
|
}
|
|
|
|
var step = 0;
|
|
function popupShown(event)
|
|
{
|
|
if (step == 0) {
|
|
// check to make sure that the popup cannot be resized past the edges of
|
|
// the content area
|
|
var resizerrect = document.getElementById("resizer").getBoundingClientRect();
|
|
synthesizeMouse(document.documentElement, resizerrect.left + 5, resizerrect.top + 5, { type:"mousedown" });
|
|
synthesizeMouse(document.documentElement, resizerrect.left + 2000, resizerrect.top + 2000, { type:"mousemove" });
|
|
|
|
// allow a one pixel variance as rounding is always done to the inside
|
|
// of a rectangle.
|
|
var popuprect = document.getElementById("panel").getBoundingClientRect();
|
|
ok(Math.round(popuprect.right) == window.innerWidth ||
|
|
Math.round(popuprect.right) == window.innerWidth - 1,
|
|
"resized to content edge width");
|
|
ok(Math.round(popuprect.bottom) == window.innerHeight ||
|
|
Math.round(popuprect.bottom) == window.innerHeight - 1,
|
|
"resized to content edge height");
|
|
|
|
resizerrect = document.getElementById("resizer").getBoundingClientRect();
|
|
synthesizeMouse(document.documentElement, resizerrect.left + 5, resizerrect.top + 5, { type:"mouseup" });
|
|
}
|
|
else {
|
|
// the popup is opened twice. Make sure that for the second time, the
|
|
// resized popup opens in the same direction as there should still be
|
|
// room for it
|
|
var popuprect = document.getElementById("panel").getBoundingClientRect();
|
|
is(Math.round(popuprect.left), window.innerWidth - 130, "reopen popup left");
|
|
is(Math.round(popuprect.top), window.innerHeight - 130, "reopen popup top");
|
|
}
|
|
|
|
event.target.hidePopup();
|
|
}
|
|
|
|
function doResizerWindowTests() {
|
|
step++;
|
|
if (step == 1) {
|
|
openPopup();
|
|
return;
|
|
}
|
|
|
|
if (/Mac/.test(navigator.platform)) {
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
|
|
window.open("window_resizer.xul", "_blank", "left=200,top=200,outerWidth=300,outerHeight=300,chrome");
|
|
}
|
|
else {
|
|
// Skip window_resizer.xul tests.
|
|
todo(false, "We can't test GTK and Windows native drag resizing implementations.");
|
|
// Run window_resizer_element.xul test only.
|
|
lastResizerTest();
|
|
}
|
|
}
|
|
|
|
function nextResizerTest()
|
|
{
|
|
// try opening the test again as a chrome window
|
|
if (step++ == 2)
|
|
window.open("window_resizer.xul", "_blank", "left=200,top=200,outerWidth=300,outerHeight=300");
|
|
else
|
|
lastResizerTest();
|
|
}
|
|
|
|
function lastResizerTest()
|
|
{
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
|
|
window.open("window_resizer_element.xul", "_blank", "left=200,top=200,outerWidth=300,outerHeight=300,chrome");
|
|
}
|
|
|
|
SimpleTest.waitForFocus(openPopup);
|
|
]]></script>
|
|
|
|
<panel id="panel" onpopupshown="popupShown(event)" onpopuphidden="doResizerWindowTests()">
|
|
<resizer id="resizer" dir="bottomend" width="16" height="16"/>
|
|
<hbox width="50" height="50" flex="1"/>
|
|
</panel>
|
|
|
|
</window>
|