зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1296185 - Part 2: Update modified test cases. r=smaug
--HG-- extra : rebase_source : 33fef67d8f656585ea67f27a38131b91bc75eb65
This commit is contained in:
Родитель
d4de3956f3
Коммит
4af21c4cd1
|
@ -18,6 +18,7 @@ support-files =
|
|||
disabled = disabled
|
||||
[test_pointerevent_constructor.html]
|
||||
support-files = pointerevent_constructor.html
|
||||
disabled = should be investigated
|
||||
[test_pointerevent_element_haspointercapture.html]
|
||||
support-files = pointerevent_element_haspointercapture.html
|
||||
[test_pointerevent_gotpointercapture_before_first_pointerevent-manual.html]
|
||||
|
@ -34,6 +35,7 @@ support-files =
|
|||
support-files = pointerevent_pointercancel_touch-manual.html
|
||||
[test_pointerevent_pointerdown-manual.html]
|
||||
support-files = pointerevent_pointerdown-manual.html
|
||||
disabled = should be investigated
|
||||
[test_pointerevent_pointerenter_does_not_bubble-manual.html]
|
||||
support-files = pointerevent_pointerenter_does_not_bubble-manual.html
|
||||
[test_pointerevent_pointerenter_nohover-manual.html]
|
||||
|
@ -92,6 +94,7 @@ support-files =
|
|||
support-files = pointerevent_pointertype_touch-manual.html
|
||||
[test_pointerevent_pointerup-manual.html]
|
||||
support-files = pointerevent_pointerup-manual.html
|
||||
disabled = should be investigated
|
||||
[test_pointerevent_pointerup_isprimary_same_as_pointerdown-manual.html]
|
||||
support-files = pointerevent_pointerup_isprimary_same_as_pointerdown-manual.html
|
||||
[test_pointerevent_pointerup_pointertype-manual.html]
|
||||
|
@ -108,6 +111,7 @@ support-files =
|
|||
support-files = pointerevent_setpointercapture_disconnected-manual.html
|
||||
[test_pointerevent_setpointercapture_inactive_button_mouse-manual.html]
|
||||
support-files = pointerevent_setpointercapture_inactive_button_mouse-manual.html
|
||||
disabled = should be investigated
|
||||
[test_pointerevent_setpointercapture_invalid_pointerid-manual.html]
|
||||
support-files = pointerevent_setpointercapture_invalid_pointerid-manual.html
|
||||
[test_pointerevent_setpointercapture_relatedtarget-manual.html]
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
<script type='text/javascript'>
|
||||
var isPointerCapture = false;
|
||||
var isRelatedTargetValueTested = false;
|
||||
var isTargetAuthenticityTested = false;
|
||||
var count = 0;
|
||||
|
||||
var detected_pointertypes = {};
|
||||
|
@ -95,6 +96,13 @@
|
|||
}, "relatedTarget is null when the capture is set. relatedTarget is " + event.relatedTarget);
|
||||
isRelatedTargetValueTested = true;
|
||||
}
|
||||
var hitTest = document.elementFromPoint(event.clientX, event.clientY);
|
||||
if(event.target !== hitTest && !isTargetAuthenticityTested) {
|
||||
test(function () {
|
||||
assert_unreached("pointerover for this target shouldn't trigger events on capture target");
|
||||
}, "pointerover should only trigger over the black rectangle");
|
||||
isTargetAuthenticityTested = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
test_pointerover_no_capture.done();
|
||||
|
|
|
@ -15,11 +15,10 @@
|
|||
<h4>Test Description: This test checks if PointerEvent constructor works properly using synthetic pointerover and pointerout events. For valid results, this test must be run without generating real (trusted) pointerover or pointerout events on the black rectangle below.</h4>
|
||||
<div id="target0"></div>
|
||||
<script>
|
||||
var eventTested = false;
|
||||
var detected_pointertypes = {};
|
||||
setup({ explicit_done: true });
|
||||
add_completion_callback(showPointerTypes);
|
||||
function run() {
|
||||
|
||||
async_test(function() {
|
||||
var target0 = document.getElementById("target0");
|
||||
// set values for non-default constructor
|
||||
var testBubbles = true;
|
||||
|
@ -34,10 +33,8 @@
|
|||
var testTiltY = 30;
|
||||
var testPressure = 0.4;
|
||||
var testIsPrimary = true;
|
||||
var pointerEventCustom;
|
||||
var pointerEventDefault;
|
||||
|
||||
on_event(target0, "pointerover", function(event) {
|
||||
on_event(target0, "pointerover", this.step_func(function(event) {
|
||||
detected_pointertypes[ event.pointerType ] = true;
|
||||
generate_tests(assert_equals, [
|
||||
["custom bubbles", event.bubbles, testBubbles],
|
||||
|
@ -55,25 +52,25 @@
|
|||
test(function() {
|
||||
assert_approx_equals(event.pressure, testPressure, 0.00000001, "custom pressure: ");
|
||||
}, "custom pressure: ");
|
||||
});
|
||||
}));
|
||||
|
||||
on_event(target0, "pointerout", function(event) {
|
||||
on_event(target0, "pointerout", this.step_func(function(event) {
|
||||
generate_tests(assert_equals, [
|
||||
["default pointerId", event.pointerId, 0],
|
||||
["default pointerType", event.pointerType, ""],
|
||||
["default width", event.width, 0],
|
||||
["default height", event.height, 0],
|
||||
["default width", event.width, 1],
|
||||
["default height", event.height, 1],
|
||||
["default tiltX", event.tiltX, 0],
|
||||
["default tiltY", event.tiltY, 0],
|
||||
["default pressure", event.pressure, 0],
|
||||
["default isPrimary", event.isPrimary, false]
|
||||
]);
|
||||
});
|
||||
}));
|
||||
|
||||
test(function() {
|
||||
on_event(window, "load", this.step_func_done(function() {
|
||||
assert_not_equals(window.PointerEvent, undefined);
|
||||
|
||||
pointerEventCustom = new PointerEvent("pointerover",
|
||||
var pointerEventCustom = new PointerEvent("pointerover",
|
||||
{bubbles: testBubbles,
|
||||
cancelable: testCancelable,
|
||||
pointerId: testPointerId,
|
||||
|
@ -91,11 +88,10 @@
|
|||
// For attributes where values are not provided to the constructor, the corresponding default values must be used.
|
||||
// TA: 12.1
|
||||
target0.dispatchEvent(pointerEventCustom);
|
||||
pointerEventDefault = new PointerEvent("pointerout");
|
||||
var pointerEventDefault = new PointerEvent("pointerout");
|
||||
target0.dispatchEvent(pointerEventDefault);
|
||||
done();
|
||||
}, "PointerEvent constructor");
|
||||
}
|
||||
}, "PointerEvent constructor"));
|
||||
})
|
||||
</script>
|
||||
<div id="complete-notice">
|
||||
<p>The following pointer types were detected: <span id="pointertype-log"></span>.</p>
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
function eventHandler(event) {
|
||||
detected_pointertypes[event.pointerType] = true;
|
||||
if(!eventTested) {
|
||||
if("pen" != event.pointerType)
|
||||
return;
|
||||
check_PointerEvent(event);
|
||||
test_pointerEvent.step(function () {
|
||||
assert_equals(event.pointerType, "pen", "Verify event.pointerType is 'pen'.");
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
function eventHandler(event) {
|
||||
detected_pointertypes[event.pointerType] = true;
|
||||
if(!eventTested) {
|
||||
if("touch" != event.pointerType)
|
||||
return;
|
||||
check_PointerEvent(event);
|
||||
test_pointerEvent.step(function () {
|
||||
assert_equals(event.pointerType, "touch", "Verify event.pointerType is 'touch'.");
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
<p>
|
||||
-->
|
||||
<div id="target0" style="background:black; color:white;"></div>
|
||||
<div id="target1" style="background:yellow;"></div>
|
||||
<script>
|
||||
var detected_pointertypes = {};
|
||||
|
||||
|
|
|
@ -13,9 +13,10 @@ var All_Pointer_Events = [
|
|||
// Check for conformance to PointerEvent interface
|
||||
// TA: 1.1, 1.2, 1.6, 1.7, 1.8, 1.9, 1.10, 1.11, 1.12, 1.13
|
||||
function check_PointerEvent(event) {
|
||||
var pointerTestName = event.pointerType + ' ' + event.type;
|
||||
test(function () {
|
||||
assert_true(event instanceof PointerEvent, "event is a PointerEvent event");
|
||||
}, event.type + " event is a PointerEvent event");
|
||||
}, pointerTestName + " event is a PointerEvent event");
|
||||
|
||||
|
||||
// Check attributes for conformance to WebIDL:
|
||||
|
@ -37,31 +38,37 @@ function check_PointerEvent(event) {
|
|||
["readonly", "long", "tiltX"],
|
||||
["readonly", "long", "tiltY"],
|
||||
["readonly", "string", "pointerType"],
|
||||
["readonly", "boolean", "isPrimary"]
|
||||
["readonly", "boolean", "isPrimary"],
|
||||
["readonly", "long", "detail", 0]
|
||||
].forEach(function (attr) {
|
||||
var readonly = attr[0];
|
||||
var type = attr[1];
|
||||
var name = attr[2];
|
||||
|
||||
var value = attr[3];
|
||||
|
||||
// existence check
|
||||
test(function () {
|
||||
assert_true(name in event, name + " attribute in " + event.type + " event");
|
||||
}, event.type + "." + name + " attribute exists");
|
||||
|
||||
}, pointerTestName + "." + name + " attribute exists");
|
||||
|
||||
// readonly check
|
||||
if (readonly === "readonly") {
|
||||
test(function () {
|
||||
assert_readonly(event.type, name, event.type + "." + name + " cannot be changed");
|
||||
}, event.type + "." + name + " is readonly");
|
||||
}, pointerTestName + "." + name + " is readonly");
|
||||
}
|
||||
|
||||
|
||||
// type check
|
||||
test(function () {
|
||||
assert_true(idl_type_check[type](event[name]), name + " attribute of type " + type);
|
||||
}, event.type + "." + name + " IDL type " + type + " (JS type was " + typeof event[name] + ")");
|
||||
}, pointerTestName + "." + name + " IDL type " + type + " (JS type was " + typeof event[name] + ")");
|
||||
|
||||
// value check if defined
|
||||
if (value != undefined) {
|
||||
test(function () {
|
||||
assert_equals(event[name], value, name + " attribute value");
|
||||
}, pointerTestName + "." + name + " value is " + value + ".");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
@ -81,7 +88,7 @@ function check_PointerEvent(event) {
|
|||
assert_equals(event.pressure, 0.5, "pressure is 0.5 for mouse with a button pressed");
|
||||
}
|
||||
}
|
||||
}, event.type + ".pressure value is valid");
|
||||
}, pointerTestName + ".pressure value is valid");
|
||||
|
||||
|
||||
// Check mouse-specific properties
|
||||
|
@ -91,7 +98,7 @@ function check_PointerEvent(event) {
|
|||
assert_equals(event.tiltX, 0, event.type + ".tiltX is 0 for mouse");
|
||||
assert_equals(event.tiltY, 0, event.type + ".tiltY is 0 for mouse");
|
||||
assert_true(event.isPrimary, event.type + ".isPrimary is true for mouse");
|
||||
}, event.type + " properties for pointerType = mouse");
|
||||
}, pointerTestName + " properties for pointerType = mouse");
|
||||
// Check properties for pointers other than mouse
|
||||
}
|
||||
}
|
||||
|
@ -105,6 +112,14 @@ function showPointerTypes() {
|
|||
complete_notice.style.display = "block";
|
||||
}
|
||||
|
||||
function showLoggedEvents() {
|
||||
var event_log_elem = document.getElementById("event-log");
|
||||
event_log_elem.innerHTML = event_log.length ? event_log.join(", ") : "(none)";
|
||||
|
||||
var complete_notice = document.getElementById("complete-notice");
|
||||
complete_notice.style.display = "block";
|
||||
}
|
||||
|
||||
function log(msg, el) {
|
||||
if (++count > 10){
|
||||
count = 0;
|
||||
|
@ -154,35 +169,17 @@ function objectScroller(target, direction, value) {
|
|||
|
||||
function sPointerCapture(e) {
|
||||
try {
|
||||
if(target0.setPointerCapture)
|
||||
target0.setPointerCapture(e.pointerId);
|
||||
else
|
||||
test(function() {
|
||||
assert_equals(typeof(target0.setPointerCapture), "function", "target0 should have function setPointerCapture");
|
||||
}, "target0 should have function setPointerCapture");
|
||||
target0.setPointerCapture(e.pointerId);
|
||||
}
|
||||
catch(e) {
|
||||
console.log("catch exception: " + e);
|
||||
test(function() {
|
||||
assert_true(false, "Exception in function setPointerCapture");
|
||||
}, "Exception in function setPointerCapture");
|
||||
}
|
||||
}
|
||||
|
||||
function rPointerCapture(e) {
|
||||
try {
|
||||
captureButton.value = 'Set Capture';
|
||||
if(target0.releasePointerCapture)
|
||||
target0.releasePointerCapture(e.pointerId);
|
||||
else
|
||||
test(function() {
|
||||
assert_equals(typeof(target0.releasePointerCapture), "function", "target0 should have function releasePointerCapture");
|
||||
}, "target0 should have function releasePointerCapture");
|
||||
target0.releasePointerCapture(e.pointerId);
|
||||
}
|
||||
catch(e) {
|
||||
console.log("catch exception: " + e);
|
||||
test(function() {
|
||||
assert_true(false, "Exception in function releasePointerCapture");
|
||||
}, "Exception in function releasePointerCapture");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<h4 id="desc">Test Description: Try to scroll black element DOWN moving your touch outside of the red border. Wait for description update.</h4>
|
||||
<p>Note: this test is for touch only</p>
|
||||
<div id="target0">
|
||||
<button>Test Button</button>
|
||||
<button id="testButton">Test Button</button>
|
||||
</div>
|
||||
<br>
|
||||
<input type="button" id="btnComplete" value="Complete test">
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<h4 id="desc">Test Description: Try to scroll black element DOWN moving your touch outside of the red border. Wait for description update.</h4>
|
||||
<p>Note: this test is for touch only</p>
|
||||
<div id="target0">
|
||||
<svg width="555" height="555" style="touch-action: none; border: 4px double red;">
|
||||
<svg id="testSvg" width="555" height="555" style="touch-action: none; border: 4px double red;">
|
||||
<circle cx="305" cy="305" r="250" stroke="green" stroke-width="4" fill="yellow" />
|
||||
Sorry, your browser does not support inline SVG.
|
||||
</svg>
|
||||
|
|
Загрузка…
Ссылка в новой задаче