blob: 6f1c04820228da7d7a382b3454dd965e2466cbef [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../../resources/js-test-pre.js"></script>
<script src="resources/gesture-helpers.js"></script>
<style type="text/css">
#touchtarget {
width: 100px;
height: 100px;
background: white;
overflow:hidden;
}
::-webkit-scrollbar {
width: 0px;
height: 0px;
}
#greenbox {
width: 100px;
height: 100px;
background: green;
padding: 0px;
margin: 0px;
}
#redbox {
width: 100px;
height: 100px;
background: red;
padding: 0px;
margin: 0px;
}
td {
padding: 0px;
}
</style>
</head>
<body style="margin:0" onload="runTest();">
<div id="touchtarget">
<table border="0" cellspacing="0px" id="tablefoo">
<tr>
<td><div id="redbox"></div></td>
<td><div id="greenbox"></div></td>
</tr>
<tr>
<td><div id="greenbox"></div></td>
<td><div id="greenbox"></div></td>
</tr>
</table>
</div>
<p id="description"></p>
<div id="console"></div>
<script type="text/javascript">
var movingdiv;
var expectedGesturesTotal = 2;
var gesturesOccurred = 0;
var scrollAmountX = ['0', '0'];
var scrollAmountY = ['0', '0'];
var wheelEventsOccurred = 0;
var expectedWheelEventsOccurred = ['0', '0'];
var scrollEventsOccurred = 0;
var expectedScrollEventsOccurred = '0';
var scrolledElement = 'movingdiv'
function firstGestureScroll()
{
debug("first gesture");
eventSender.gestureScrollBegin(95, 12);
eventSender.gestureScrollUpdate(-90, 0);
eventSender.gestureScrollEnd(0, 0);
// Wait for layout.
checkScrollOffset();
}
function secondGestureScroll()
{
debug("second gesture");
eventSender.gestureScrollBegin(12, 97);
eventSender.gestureScrollUpdate(0, -95);
eventSender.gestureScrollEnd(0, 0);
// Wait for layout.
checkScrollOffset();
// In this test we do not expect any scroll events to
// be received by the event listener, so we signal
// the end of the test by calling this function instead
// of relying on recordScroll() to do it.
finishTest();
}
if (window.testRunner)
testRunner.waitUntilDone();
function runTest()
{
movingdiv = document.getElementById('touchtarget');
movingdiv.addEventListener("scroll", recordScroll);
window.addEventListener("mousewheel", recordWheel);
if (window.eventSender) {
description('This tests that a non-scrollable div cannot be scrolled with touch.');
if (checkTestDependencies())
firstGestureScroll();
else
exitIfNecessary();
} else {
debug("This test requires DumpRenderTree. Touch scroll the red rect to log.");
}
}
function finishTest()
{
if (window.eventSender) {
if (gesturesOccurred == expectedGesturesTotal) {
shouldBe('scrollEventsOccurred', expectedScrollEventsOccurred);
successfullyParsed = true;
isSuccessfullyParsed();
if (window.testRunner)
testRunner.notifyDone();
}
}
}
</script>
</body>
</html>