-
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c0a02db
Added a test for event sequence after implicit release.
mustaqahmed 037a345
Split the test into two: click & drag.
mustaqahmed 55a87c2
Replaced new tests with step().
mustaqahmed f081996
Added MultiPointerTypeTest.step() to hide multi-tests from test code.
mustaqahmed File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
pointerevents/pointerevent_sequence_at_implicit_release_on_click-manual.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Pointer Event: Event sequence at implicit release on click</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 after a click, 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 detected_pointertypes = {}; | ||
var event_log = []; | ||
var start_logging = false; | ||
|
||
function resetTestState() { | ||
detected_eventTypes = {}; | ||
event_log = []; | ||
start_logging = false; | ||
} | ||
|
||
function run() { | ||
var test_pointer_event = setup_pointerevent_test("Event sequence at implicit release on click", ALL_POINTERS); | ||
|
||
on_event(document.getElementById("done"), "click", function() { | ||
var expected_events = "pointerup, lostpointercapture, pointerout, pointerleave"; | ||
test(function () { | ||
assert_equals(event_log.join(", "), expected_events); | ||
}, expectedPointerType + " Event log"); | ||
|
||
test_pointer_event.done(); | ||
}); | ||
|
||
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); | ||
} | ||
}); | ||
}); | ||
} | ||
</script> | ||
<style> | ||
#target { | ||
margin: 20px; | ||
background-color: black; | ||
} | ||
|
||
#done { | ||
margin: 20px; | ||
background-color: green; | ||
} | ||
</style> | ||
</head> | ||
<body onload="run()"> | ||
<h1>Pointer Event: Event sequence at implicit release on click<h1> | ||
<h2 id="pointerTypeDescription"></h2> | ||
<h4> | ||
When a captured pointer is implicitly released after a click, the boundary events should follow the lostpointercapture event. | ||
</h4> | ||
<ol> | ||
<li>Click or tap 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> |
85 changes: 85 additions & 0 deletions
85
pointerevents/pointerevent_sequence_at_implicit_release_on_drag-manual.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Pointer Event: Event sequence at implicit release on drag</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 after a drag, 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 detected_pointertypes = {}; | ||
var event_log = []; | ||
var start_logging = false; | ||
|
||
function resetTestState() { | ||
detected_eventTypes = {}; | ||
event_log = []; | ||
start_logging = false; | ||
} | ||
|
||
function run() { | ||
var test_pointer_event = setup_pointerevent_test("Event sequence at implicit release on drag", ["touch"]); | ||
|
||
on_event(document.getElementById("done"), "click", function() { | ||
var expected_events = "pointercancel, lostpointercapture, pointerout, pointerleave"; | ||
test(function () { | ||
assert_equals(event_log.join(", "), expected_events); | ||
}, expectedPointerType + " Event log"); | ||
|
||
test_pointer_event.done(); | ||
}); | ||
|
||
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); | ||
} | ||
}); | ||
}); | ||
} | ||
</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 on drag<h1> | ||
<h2 id="pointerTypeDescription"></h2> | ||
<h4> | ||
When a captured pointer is implicitly released after a drag, the boundary events should follow the lostpointercapture event. | ||
</h4> | ||
<ol> | ||
<li>Drag quickly 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> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit: We could have done the test_pointer_event.step(function() ...) as this is the only thing that we test here. We can do that to reduce one line in the output as the async test doesn't have any other assert and always passes.
But we also need to add the step function to the MultiPointerTypeTest to call step function on the current active 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.
Does it look better? Or you prefer hiding currentTest from the 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.
I would have preferred defining the step function for MultiPointerTypeTest in pointerevent_support.js so that we could have just changed the test_pointer_event with a normal async test and everything should just work. Basically I tried to hide the fact that there are multiple tests from the test itself except in a few places.
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.
Here it is, ptal.