mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
92 lines
3.4 KiB
HTML
92 lines
3.4 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: 2px solid black; padding: 3px; -moz-box-sizing: border-box;">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 currentBoxSizing = 0;
|
|
var resizeTypes = [ "horizontal", "vertical", "none", "inherit", "both" ];
|
|
var boxSizingTypes = [ "", "border-box", "padding-box" ];
|
|
|
|
function doTheTest() {
|
|
var boxSizingText = " with box sizing " + (currentBoxSizing ? boxSizingTypes[currentBoxSizing] : "content-box");
|
|
|
|
var textarea = $("textarea");
|
|
var rect = textarea.getBoundingClientRect();
|
|
// assume that the resizer is in the lower right corner
|
|
|
|
synthesizeMouse(textarea, rect.width - 10, rect.height - 10, { 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 ? 50 : 0)),
|
|
currentResize + " width has increased" + boxSizingText);
|
|
is(Math.round(newrect.height), Math.round(rect.height + (vchange ? 50 : 0)),
|
|
currentResize + " height has increased" + boxSizingText);
|
|
|
|
synthesizeMouse(textarea, rect.width - 20, rect.height - 20, { type:"mousemove" });
|
|
|
|
newrect = textarea.getBoundingClientRect();
|
|
|
|
is(Math.round(newrect.width), Math.round(rect.width - (hchange ? 10 : 0)),
|
|
currentResize + " width has decreased" + boxSizingText);
|
|
is(Math.round(newrect.height), Math.round(rect.height - (vchange ? 10 : 0)),
|
|
currentResize + " height has decreased" + boxSizingText);
|
|
|
|
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" + boxSizingText);
|
|
ok(vchange ? newrect.height >= 15 : Math.round(newrect.height) == Math.round(rect.height),
|
|
currentResize + " height decreased below minimum" + boxSizingText);
|
|
|
|
synthesizeMouse(textarea, rect.width - 8, rect.height - 8, { type:"mouseup" });
|
|
|
|
textarea.style.width = "auto";
|
|
textarea.style.height = "auto";
|
|
|
|
if (currentBoxSizing++ <= boxSizingTypes.length) {
|
|
textarea.style.MozBoxSizing = boxSizingTypes[currentBoxSizing];
|
|
SimpleTest.executeSoon(doTheTest);
|
|
}
|
|
else {
|
|
currentBoxSizing = 0;
|
|
currentResize = resizeTypes.shift();
|
|
if (currentResize) {
|
|
textarea.style.resize = currentResize;
|
|
SimpleTest.executeSoon(doTheTest);
|
|
}
|
|
else {
|
|
SimpleTest.finish();
|
|
}
|
|
}
|
|
}
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|