mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
78 lines
2.8 KiB
HTML
78 lines
2.8 KiB
HTML
|
<!DOCTYPE HTML>
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>Test for Bug 477700</title>
|
||
|
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||
|
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div id="content" style="display: none">
|
||
|
</div>
|
||
|
|
||
|
<textarea id="textarea" style="-moz-appearance: none; border: 0;">Text</textarea>
|
||
|
|
||
|
<pre id="test">
|
||
|
<script type="application/javascript">
|
||
|
|
||
|
/** Test for textbox resizing **/
|
||
|
SimpleTest.waitForExplicitFinish();
|
||
|
addLoadEvent(function() SimpleTest.executeSoon(doTheTest));
|
||
|
|
||
|
// First, test the default value which is 'both', then test explicitly
|
||
|
// setting each possible value.
|
||
|
var currentResize = "both";
|
||
|
var resizeTypes = [ "horizontal", "vertical", "none", "inherit", "both" ];
|
||
|
|
||
|
function doTheTest() {
|
||
|
var textarea = $("textarea");
|
||
|
var rect = textarea.getBoundingClientRect();
|
||
|
// assume that the resizer is in the lower right corner
|
||
|
synthesizeMouse(textarea, rect.width - 8, rect.height - 8, { type:"mousedown" });
|
||
|
synthesizeMouse(textarea, rect.width + 40, rect.height + 40, { type:"mousemove" });
|
||
|
|
||
|
var newrect = textarea.getBoundingClientRect();
|
||
|
var hchange = (currentResize == "both" || currentResize == "horizontal");
|
||
|
var vchange = (currentResize == "both" || currentResize == "vertical");
|
||
|
|
||
|
is(Math.round(newrect.width), Math.round(rect.width + (hchange ? 48 : 0)),
|
||
|
currentResize + " width has increased");
|
||
|
is(Math.round(newrect.height), Math.round(rect.height + (vchange ? 48 : 0)),
|
||
|
currentResize + " height has increased");
|
||
|
|
||
|
synthesizeMouse(textarea, rect.width - 20, rect.height - 20, { type:"mousemove" });
|
||
|
|
||
|
newrect = textarea.getBoundingClientRect();
|
||
|
is(Math.round(newrect.width), Math.round(rect.width - (hchange ? 12 : 0)),
|
||
|
currentResize + " width has decreased");
|
||
|
is(Math.round(newrect.height), Math.round(rect.height - (vchange ? 12 : 0)),
|
||
|
currentResize + " height has decreased");
|
||
|
|
||
|
synthesizeMouse(textarea, rect.width - 220, rect.height - 220, { type:"mousemove" });
|
||
|
|
||
|
newrect = textarea.getBoundingClientRect();
|
||
|
ok(hchange ? newrect.width >= 15 : Math.round(newrect.width) == Math.round(rect.width),
|
||
|
currentResize + " width decreased below minimum");
|
||
|
ok(vchange ? newrect.height >= 15 : Math.round(newrect.height) == Math.round(rect.height),
|
||
|
currentResize + " height decreased below minimum");
|
||
|
|
||
|
synthesizeMouse(textarea, rect.width - 8, rect.height - 8, { type:"mouseup" });
|
||
|
|
||
|
currentResize = resizeTypes.shift();
|
||
|
if (currentResize) {
|
||
|
textarea.style.width = "auto";
|
||
|
textarea.style.height = "auto";
|
||
|
textarea.style.MozResize = currentResize;
|
||
|
SimpleTest.executeSoon(doTheTest);
|
||
|
}
|
||
|
else {
|
||
|
SimpleTest.finish();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
</script>
|
||
|
</pre>
|
||
|
</body>
|
||
|
</html>
|