-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a test for event sequence after implicit release. #4364
Changes from 1 commit
c0a02db
037a345
55a87c2
f081996
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Pointer Event: Event sequence at implicit release</title> | ||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/> | ||
<link rel="author" title="Google" href="http://www.google.com "/> | ||
<meta name="assert" content="When a captured pointer is implicitly released, the boundary events should follow the lostpointercapture event."/> | ||
<link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script type="text/javascript" src="pointerevent_support.js"></script> | ||
<script type="text/javascript"> | ||
var test_pointerEvent_0 = async_test("Event sequence at implicit release after click"); | ||
var test_pointerEvent_1 = async_test("Event sequence at implicit release after drag"); | ||
|
||
add_completion_callback(end_of_test); | ||
|
||
var detected_pointertypes = {}; | ||
|
||
var test_num = 0; | ||
var event_log = []; | ||
var start_logging = false; | ||
var seen_pointercancel = false; | ||
|
||
function end_of_test() { | ||
showLoggedEvents(); | ||
showPointerTypes(); | ||
} | ||
|
||
function end_of_current_test() { | ||
if (test_num == 0) { | ||
var expected_events = "pointerup, lostpointercapture, pointerout, pointerleave"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't seem right for the mouse case. If we just click in the black why do we get pointerout/leave for mouse? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We get out/leave right before clicking the green. |
||
test(function () { | ||
assert_equals(event_log.join(", "), expected_events); | ||
}, "Event log after click"); | ||
|
||
test_pointerEvent_0.done(); | ||
test_num++; | ||
event_log = []; | ||
start_logging = false; | ||
seen_pointercancel = false; | ||
|
||
} else { | ||
var expected_events = seen_pointercancel ? | ||
"pointercancel, lostpointercapture, pointerout, pointerleave" : | ||
"pointerup, lostpointercapture, pointerout, pointerleave"; | ||
test(function () { | ||
assert_equals(event_log.join(", "), expected_events); | ||
}, "Event log after drag"); | ||
|
||
test_pointerEvent_1.done(); | ||
test_num++; | ||
} | ||
} | ||
|
||
function run() { | ||
on_event(document.getElementById("done"), "click", end_of_current_test); | ||
|
||
var target = document.getElementById("target"); | ||
|
||
All_Pointer_Events.forEach(function(eventName) { | ||
on_event(target, eventName, function (event) { | ||
detected_pointertypes[event.pointerType] = true; | ||
|
||
if (event.type == "pointerdown") { | ||
event.target.setPointerCapture(event.pointerId); | ||
|
||
} else if (event.type == "gotpointercapture") { | ||
start_logging = true; | ||
|
||
} else if (event.type != "pointermove" && start_logging) { | ||
event_log.push(event.type); | ||
if (event.type == "pointercancel") | ||
seen_pointercancel = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why should we expect a pointercancel while the touch-action is none? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's touch-action:auto, to test implicit release caused by a pointercancel. |
||
} | ||
}); | ||
}); | ||
} | ||
</script> | ||
<style> | ||
#target { | ||
margin: 20px; | ||
background-color: black; | ||
touch-action: auto; | ||
} | ||
|
||
#done { | ||
margin: 20px; | ||
background-color: green; | ||
} | ||
</style> | ||
</head> | ||
<body onload="run()"> | ||
<h1>Pointer Event: Event sequence at implicit release<h1> | ||
<h4> | ||
When a captured pointer is implicitly released, the boundary events should follow the lostpointercapture event. | ||
</h4> | ||
<ol> | ||
<li> Click or tap on Black.</li> | ||
<li> Click or tap on Green.</li> | ||
<li> Drag quickly drag down starting on Black.</li> | ||
<li> Click or tap on Green.</li> | ||
</ol> | ||
<div id="target"></div> | ||
<div id="done"></div> | ||
<div id="complete-notice"> | ||
<p>The following pointer types were detected: <span id="pointertype-log"></span>.</p> | ||
<p>The following events were logged: <span id="event-log"></span>.</p> | ||
</div> | ||
<div id="log"></div> | ||
</body> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason we put these two tests in the same file? I mean they don't seem to share the instructions either.
Also is it possible to use setup_pointerevent_test if we expect multiple pointers to be used for this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done splitting into two. The second (drag) one is touch-only.