mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 20:01:50 +00:00
Backed out changeset b61190bd4069 (bug 1121459)
This commit is contained in:
parent
27e07fcae4
commit
ca777970e8
106
dom/events/test/bug648573.html
Normal file
106
dom/events/test/bug648573.html
Normal file
@ -0,0 +1,106 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=648573
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 648573</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=648573">Mozilla Bug 648573</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 648573 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
var utils = SpecialPowers.getDOMWindowUtils(window);
|
||||
|
||||
ok("createTouch" in document, "Should have createTouch function");
|
||||
ok("createTouchList" in document, "Should have createTouchList function");
|
||||
ok(document.createEvent("touchevent"), "Should be able to create TouchEvent objects");
|
||||
|
||||
var t1 = document.createTouch(window, document, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||
is(t1.target, document, "Wrong target");
|
||||
is(t1.identifier, 1, "Wrong identifier");
|
||||
is(t1.pageX, 2, "Wrong pageX");
|
||||
is(t1.pageY, 3, "Wrong pageY");
|
||||
is(t1.screenX, 4, "Wrong screenX");
|
||||
is(t1.screenY, 5, "Wrong screenY");
|
||||
is(t1.clientX, 6, "Wrong clientX");
|
||||
is(t1.clientY, 7, "Wrong clientY");
|
||||
is(t1.radiusX, 8, "Wrong radiusX");
|
||||
is(t1.radiusY, 9, "Wrong radiusY");
|
||||
is(t1.rotationAngle, 10, "Wrong rotationAngle");
|
||||
is(t1.force, 11, "Wrong force");
|
||||
|
||||
var t2 = document.createTouch();
|
||||
|
||||
var l1 = document.createTouchList(t1);
|
||||
is(l1.length, 1, "Wrong length");
|
||||
is(l1.item(0), t1, "Wront item (1)");
|
||||
is(l1[0], t1, "Wront item (2)");
|
||||
|
||||
var l2 = document.createTouchList([t1, t2]);
|
||||
is(l2.length, 2, "Wrong length");
|
||||
is(l2.item(0), t1, "Wront item (3)");
|
||||
is(l2.item(1), t2, "Wront item (4)");
|
||||
is(l2[0], t1, "Wront item (5)");
|
||||
is(l2[1], t2, "Wront item (6)");
|
||||
|
||||
var l3 = document.createTouchList();
|
||||
|
||||
var e = document.createEvent("touchevent");
|
||||
e.initTouchEvent("touchmove", true, true, window, 0, true, true, true, true,
|
||||
l1, l2, l3);
|
||||
is(e.touches, l1, "Wrong list (1)");
|
||||
is(e.targetTouches, l2, "Wrong list (2)");
|
||||
is(e.changedTouches, l3, "Wrong list (3)");
|
||||
ok(e.altKey, "Alt should be true");
|
||||
ok(e.metaKey, "Meta should be true");
|
||||
ok(e.ctrlKey, "Ctrl should be true");
|
||||
ok(e.shiftKey, "Shift should be true");
|
||||
|
||||
|
||||
var events =
|
||||
["touchstart",
|
||||
"touchend",
|
||||
"touchmove",
|
||||
"touchcancel"];
|
||||
|
||||
function runEventTest(type) {
|
||||
var e = document.createEvent("touchevent");
|
||||
e.initTouchEvent(type, true, true, window, 0, true, true, true, true,
|
||||
l1, l2, l3);
|
||||
var t = document.createElement("div");
|
||||
// Testing target.onFoo;
|
||||
var didCall = false;
|
||||
t["on" + type] = function (evt) {
|
||||
is(evt, e, "Wrong event");
|
||||
evt.target.didCall = true;
|
||||
}
|
||||
t.dispatchEvent(e);
|
||||
ok(t.didCall, "Should have called the listener(1)");
|
||||
|
||||
// Testing <element onFoo="">
|
||||
t = document.createElement("div");
|
||||
t.setAttribute("on" + type, "this.didCall = true;");
|
||||
t.dispatchEvent(e);
|
||||
ok(t.didCall, "Should have called the listener(2)");
|
||||
}
|
||||
|
||||
for (var i = 0; i < events.length; ++i) {
|
||||
runEventTest(events[i]);
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -5,6 +5,7 @@ support-files =
|
||||
bug299673.js
|
||||
bug322588-popup.html
|
||||
bug426082.html
|
||||
bug648573.html
|
||||
bug656379-1.html
|
||||
bug418986-3.js
|
||||
error_event_worker.js
|
||||
|
@ -4,106 +4,27 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=648573
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 648573</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<title>Bug 648573 test</title>
|
||||
<style>
|
||||
iframe {
|
||||
width: 600px;
|
||||
height: 400px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=648573">Mozilla Bug 648573</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 648573 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
var utils = SpecialPowers.getDOMWindowUtils(window);
|
||||
|
||||
ok("createTouch" in document, "Should have createTouch function");
|
||||
ok("createTouchList" in document, "Should have createTouchList function");
|
||||
ok(document.createEvent("touchevent"), "Should be able to create TouchEvent objects");
|
||||
|
||||
var t1 = document.createTouch(window, document, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||
is(t1.target, document, "Wrong target");
|
||||
is(t1.identifier, 1, "Wrong identifier");
|
||||
is(t1.pageX, 2, "Wrong pageX");
|
||||
is(t1.pageY, 3, "Wrong pageY");
|
||||
is(t1.screenX, 4, "Wrong screenX");
|
||||
is(t1.screenY, 5, "Wrong screenY");
|
||||
is(t1.clientX, 6, "Wrong clientX");
|
||||
is(t1.clientY, 7, "Wrong clientY");
|
||||
is(t1.radiusX, 8, "Wrong radiusX");
|
||||
is(t1.radiusY, 9, "Wrong radiusY");
|
||||
is(t1.rotationAngle, 10, "Wrong rotationAngle");
|
||||
is(t1.force, 11, "Wrong force");
|
||||
|
||||
var t2 = document.createTouch();
|
||||
|
||||
var l1 = document.createTouchList(t1);
|
||||
is(l1.length, 1, "Wrong length");
|
||||
is(l1.item(0), t1, "Wront item (1)");
|
||||
is(l1[0], t1, "Wront item (2)");
|
||||
|
||||
var l2 = document.createTouchList([t1, t2]);
|
||||
is(l2.length, 2, "Wrong length");
|
||||
is(l2.item(0), t1, "Wront item (3)");
|
||||
is(l2.item(1), t2, "Wront item (4)");
|
||||
is(l2[0], t1, "Wront item (5)");
|
||||
is(l2[1], t2, "Wront item (6)");
|
||||
|
||||
var l3 = document.createTouchList();
|
||||
|
||||
var e = document.createEvent("touchevent");
|
||||
e.initTouchEvent("touchmove", true, true, window, 0, true, true, true, true,
|
||||
l1, l2, l3);
|
||||
is(e.touches, l1, "Wrong list (1)");
|
||||
is(e.targetTouches, l2, "Wrong list (2)");
|
||||
is(e.changedTouches, l3, "Wrong list (3)");
|
||||
ok(e.altKey, "Alt should be true");
|
||||
ok(e.metaKey, "Meta should be true");
|
||||
ok(e.ctrlKey, "Ctrl should be true");
|
||||
ok(e.shiftKey, "Shift should be true");
|
||||
|
||||
|
||||
var events =
|
||||
["touchstart",
|
||||
"touchend",
|
||||
"touchmove",
|
||||
"touchcancel"];
|
||||
|
||||
function runEventTest(type) {
|
||||
var e = document.createEvent("touchevent");
|
||||
e.initTouchEvent(type, true, true, window, 0, true, true, true, true,
|
||||
l1, l2, l3);
|
||||
var t = document.createElement("div");
|
||||
// Testing target.onFoo;
|
||||
var didCall = false;
|
||||
t["on" + type] = function (evt) {
|
||||
is(evt, e, "Wrong event");
|
||||
evt.target.didCall = true;
|
||||
}
|
||||
t.dispatchEvent(e);
|
||||
ok(t.didCall, "Should have called the listener(1)");
|
||||
|
||||
// Testing <element onFoo="">
|
||||
t = document.createElement("div");
|
||||
t.setAttribute("on" + type, "this.didCall = true;");
|
||||
t.dispatchEvent(e);
|
||||
ok(t.didCall, "Should have called the listener(2)");
|
||||
}
|
||||
|
||||
for (var i = 0; i < events.length; ++i) {
|
||||
runEventTest(events[i]);
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
</script>
|
||||
</pre>
|
||||
<div id="container"></div>
|
||||
</body>
|
||||
<script>
|
||||
// Touch/Selection caret's pref is checked only when PresShell is initialized.
|
||||
// To turn off the pref, we test bug 648573 in an iframe.
|
||||
SpecialPowers.pushPrefEnv({"set": [['touchcaret.enabled', false]]}, function() {
|
||||
SpecialPowers.pushPrefEnv({"set": [['selectioncaret.enabled', false]]}, function() {
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.src = "bug648573.html";
|
||||
document.getElementById('container').appendChild(iframe);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
|
@ -49,10 +49,11 @@ function isEnabledMiddleClickPaste()
|
||||
}
|
||||
}
|
||||
|
||||
function isEnabledAccessibleCaret()
|
||||
function isEnabledTouchCaret()
|
||||
{
|
||||
try {
|
||||
return SpecialPowers.getBoolPref("layout.accessiblecaret.enabled");
|
||||
return SpecialPowers.getBoolPref("touchcaret.enabled") ||
|
||||
SpecialPowers.getBoolPref("layout.accessiblecaret.enabled");
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
@ -68,7 +69,7 @@ function doTest(aButton)
|
||||
// then, the click event isn't generated.
|
||||
if (aButton != 2 &&
|
||||
(aButton != 1 || !isEnabledMiddleClickPaste()) &&
|
||||
(aButton != 0 || !isEnabledAccessibleCaret())) {
|
||||
(aButton != 0 || !isEnabledTouchCaret())) {
|
||||
gClickCount = 0;
|
||||
// click on border of input
|
||||
synthesizeMouse(input, 5, 5, { button: aButton });
|
||||
|
@ -57,10 +57,10 @@ skip-if(B2G||Mulet) random-if(Android) needs-focus != spellcheck-textarea-attr-d
|
||||
skip-if(B2G||Mulet) random-if(Android) needs-focus != spellcheck-textarea-attr-dynamic-override-inherit.html spellcheck-textarea-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
|
||||
skip-if(B2G||Mulet) random-if(Android) needs-focus != spellcheck-textarea-property-dynamic-override.html spellcheck-textarea-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
|
||||
skip-if(B2G||Mulet) random-if(Android) needs-focus != spellcheck-textarea-property-dynamic-override-inherit.html spellcheck-textarea-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
|
||||
needs-focus == caret_on_focus.html caret_on_focus-ref.html
|
||||
needs-focus pref(touchcaret.enabled,false) == caret_on_focus.html caret_on_focus-ref.html
|
||||
needs-focus != caret_on_textarea_lastline.html caret_on_textarea_lastline-ref.html
|
||||
needs-focus == input-text-onfocus-reframe.html input-text-onfocus-reframe-ref.html
|
||||
needs-focus == input-text-notheme-onfocus-reframe.html input-text-notheme-onfocus-reframe-ref.html
|
||||
needs-focus pref(touchcaret.enabled,false) pref(selectioncaret.enabled,false) == input-text-onfocus-reframe.html input-text-onfocus-reframe-ref.html
|
||||
needs-focus pref(touchcaret.enabled,false) pref(selectioncaret.enabled,false) == input-text-notheme-onfocus-reframe.html input-text-notheme-onfocus-reframe-ref.html
|
||||
skip-if(B2G||Mulet) needs-focus == caret_after_reframe.html caret_after_reframe-ref.html # B2G timed out waiting for reftest-wait to be removed # Initial mulet triage: parity with B2G/B2G Desktop
|
||||
== nobogusnode-1.html nobogusnode-ref.html
|
||||
== nobogusnode-2.html nobogusnode-ref.html
|
||||
@ -104,15 +104,15 @@ skip-if(Android||B2G||Mulet) needs-focus == 462758-grabbers-resizers.html 462758
|
||||
== 388980-1.html 388980-1-ref.html
|
||||
needs-focus == spellcheck-superscript-1.html spellcheck-superscript-1-ref.html
|
||||
skip-if(B2G||Mulet) fails-if(Android) needs-focus != spellcheck-superscript-2.html spellcheck-superscript-2-ref.html # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
|
||||
needs-focus pref(layout.accessiblecaret.enabled,false) == 824080-1.html 824080-1-ref.html
|
||||
needs-focus pref(layout.accessiblecaret.enabled,false) == 824080-2.html 824080-2-ref.html
|
||||
needs-focus pref(layout.accessiblecaret.enabled,false) == 824080-3.html 824080-3-ref.html
|
||||
needs-focus pref(selectioncaret.enabled,false) pref(layout.accessiblecaret.enabled,false) == 824080-1.html 824080-1-ref.html
|
||||
needs-focus pref(selectioncaret.enabled,false) pref(layout.accessiblecaret.enabled,false) == 824080-2.html 824080-2-ref.html
|
||||
needs-focus pref(selectioncaret.enabled,false) pref(layout.accessiblecaret.enabled,false) == 824080-3.html 824080-3-ref.html
|
||||
needs-focus != 824080-2.html 824080-3.html
|
||||
needs-focus pref(layout.accessiblecaret.enabled,false) == 824080-4.html 824080-4-ref.html
|
||||
needs-focus pref(layout.accessiblecaret.enabled,false) == 824080-5.html 824080-5-ref.html
|
||||
needs-focus pref(selectioncaret.enabled,false) pref(layout.accessiblecaret.enabled,false) == 824080-4.html 824080-4-ref.html
|
||||
needs-focus pref(selectioncaret.enabled,false) pref(layout.accessiblecaret.enabled,false) == 824080-5.html 824080-5-ref.html
|
||||
needs-focus != 824080-4.html 824080-5.html
|
||||
needs-focus == 824080-6.html 824080-6-ref.html
|
||||
needs-focus pref(layout.accessiblecaret.enabled,false) == 824080-7.html 824080-7-ref.html
|
||||
needs-focus pref(selectioncaret.enabled,false) pref(layout.accessiblecaret.enabled,false) == 824080-7.html 824080-7-ref.html
|
||||
needs-focus != 824080-6.html 824080-7.html
|
||||
# Bug 674927: copy spellcheck-textarea tests to contenteditable
|
||||
== spellcheck-contenteditable-attr.html spellcheck-contenteditable-nofocus-ref.html
|
||||
|
58
layout/base/tests/bug644768.html
Normal file
58
layout/base/tests/bug644768.html
Normal file
@ -0,0 +1,58 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=644768
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 644768</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.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 onload="test()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=644768">Mozilla Bug 644768</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<!-- test text is
|
||||
== زادروزها ==
|
||||
* [[۱۳۰۷]]
|
||||
-->
|
||||
<textarea id="testInput" dir="rtl" cols="80" rows="25">
|
||||
|
||||
== زادروزها ==
|
||||
* [[۱۳۰۷]]</textarea>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 644768 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function test() {
|
||||
var textInput = $("testInput");
|
||||
var s1, s2, equal, str1, str2;
|
||||
|
||||
textInput.focus();
|
||||
s1 = snapshotWindow(window);
|
||||
|
||||
synthesizeKey("VK_UP", { });
|
||||
synthesizeKey("VK_UP", { });
|
||||
synthesizeKey("VK_UP", { });
|
||||
synthesizeKey("VK_DELETE", { });
|
||||
synthesizeKey("VK_RETURN", { });
|
||||
// Bug 1016184: Touch caret will hide due to key event.
|
||||
s2 = snapshotWindow(window);
|
||||
|
||||
[equal, str1, str2] = compareSnapshots(s1, s2, true);
|
||||
ok(equal, "newline before bidi text shouldn't change direction: expected " +
|
||||
str1 + " but got " + str2);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -12,6 +12,7 @@ support-files =
|
||||
file_bug842853.html
|
||||
../../../dom/plugins/test/mochitest/plugin-utils.js
|
||||
bug558663.html
|
||||
bug644768.html
|
||||
bug956530-1.html
|
||||
bug956530-1-ref.html
|
||||
bug989012-1.html
|
||||
@ -246,6 +247,7 @@ support-files =
|
||||
bug687297_b.html
|
||||
bug687297_c.html
|
||||
[test_bug990340.html]
|
||||
[test_bug1070851.html]
|
||||
[test_bug1080360.html]
|
||||
support-files = bug1080360_inner.html
|
||||
[test_bug1078327.html]
|
||||
@ -253,6 +255,7 @@ support-files = bug1078327_inner.html
|
||||
[test_bug1080361.html]
|
||||
support-files = bug1080361_inner.html
|
||||
[test_frame_reconstruction_for_pseudo_elements.html]
|
||||
[test_touchcaret_visibility.html]
|
||||
[test_bug1093686.html]
|
||||
support-files = bug1093686_inner.html
|
||||
[test_bug1120705.html]
|
||||
|
59
layout/base/tests/test_bug1070851.html
Normal file
59
layout/base/tests/test_bug1070851.html
Normal file
@ -0,0 +1,59 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1070851
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1070851</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
<style>
|
||||
/* Eliminate the blue glow when focusing an element. */
|
||||
input, textarea, div {
|
||||
background: none;
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 1070851 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function testSnapshot(aElementId)
|
||||
{
|
||||
var noTouchCaret = snapshotWindow(window, true);
|
||||
|
||||
// Focus the element to make the touch caret show, but do not capture it.
|
||||
var element = document.getElementById(aElementId);
|
||||
element.focus();
|
||||
var notCaptureTouchCaret = snapshotWindow(window, false);
|
||||
|
||||
[result, first, second] = compareSnapshots(noTouchCaret, notCaptureTouchCaret,
|
||||
true);
|
||||
ok(result, "Both snapshots of " + aElementId + " should have no touch caret." +
|
||||
"\nFirst snapshot: " + first + "\nSecond snapshot: " + second);
|
||||
|
||||
element.blur();
|
||||
}
|
||||
|
||||
SimpleTest.waitForFocus(function() {
|
||||
testSnapshot('input');
|
||||
testSnapshot('textarea');
|
||||
testSnapshot('content');
|
||||
SimpleTest.finish();
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1070851">Mozilla Bug 1070851</a>
|
||||
<input id="input">
|
||||
<textarea id="textarea"></textarea>
|
||||
<div id="content" contenteditable="true">test</div>
|
||||
</body>
|
||||
</html>
|
@ -26,9 +26,10 @@
|
||||
SimpleTest.expectAssertions(0, 2);
|
||||
}
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
// AccessibleCaret's pref is checked only when PresShell is initialized. To turn
|
||||
// Selection caret's pref is checked only when PresShell is initialized. To turn
|
||||
// off the pref, we test bug 558663 in an iframe.
|
||||
SpecialPowers.pushPrefEnv({"set": [['layout.accessiblecaret.enabled', false]]}, function() {
|
||||
SpecialPowers.pushPrefEnv({"set": [['selectioncaret.enabled', false],
|
||||
['layout.accessiblecaret.enabled', false]]}, function() {
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.src = "bug558663.html";
|
||||
document.getElementById('container').appendChild(iframe);
|
||||
|
@ -4,59 +4,25 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=644768
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 644768</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.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 onload="test()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=644768">Mozilla Bug 644768</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<!-- test text is
|
||||
== زادروزها ==
|
||||
* [[۱۳۰۷]]
|
||||
-->
|
||||
<textarea id="testInput" dir="rtl" cols="80" rows="25">
|
||||
|
||||
== زادروزها ==
|
||||
* [[۱۳۰۷]]</textarea>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 644768 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function test() {
|
||||
var textInput = $("testInput");
|
||||
var s1, s2, equal, str1, str2;
|
||||
|
||||
textInput.focus();
|
||||
s1 = snapshotWindow(window);
|
||||
|
||||
synthesizeKey("VK_UP", { });
|
||||
synthesizeKey("VK_UP", { });
|
||||
synthesizeKey("VK_UP", { });
|
||||
synthesizeKey("VK_DELETE", { });
|
||||
synthesizeKey("VK_RETURN", { });
|
||||
// Bug 1016184: Touch caret will hide due to key event.
|
||||
s2 = snapshotWindow(window);
|
||||
|
||||
[equal, str1, str2] = compareSnapshots(s1, s2, true);
|
||||
ok(equal, "newline before bidi text shouldn't change direction: expected " +
|
||||
str1 + " but got " + str2);
|
||||
|
||||
SimpleTest.finish();
|
||||
<title>Bug 644768 test</title>
|
||||
<style>
|
||||
iframe {
|
||||
width: 600px;
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container"></div>
|
||||
</body>
|
||||
<script>
|
||||
// Touch caret's pref is checked only when PresShell is initialized. To turn
|
||||
// off the pref, we test bug 644768 in an iframe.
|
||||
SpecialPowers.pushPrefEnv({"set": [['touchcaret.enabled', false]]}, function() {
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.src = "bug644768.html";
|
||||
document.getElementById('container').appendChild(iframe);
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
|
@ -107,9 +107,11 @@ var tests = [
|
||||
[ 'bug1082486-1.html', 'bug1082486-1-ref.html'] ,
|
||||
[ 'bug1082486-2.html', 'bug1082486-2-ref.html'] ,
|
||||
// The following test cases are all involving with one sending
|
||||
// synthesizeKey(), the other without. They fail when accessiblecaret
|
||||
// is enabled. Test them with the preference off.
|
||||
function() {SpecialPowers.pushPrefEnv({'set': [['layout.accessiblecaret.enabled', false]]}, nextTest);} ,
|
||||
// synthesizeKey(), the other without. They fail when the touch
|
||||
// or selection caret is enabled. Test them with these preferences off.
|
||||
function() {SpecialPowers.pushPrefEnv({'set': [['touchcaret.enabled', false],
|
||||
['selectioncaret.enabled', false],
|
||||
['layout.accessiblecaret.enabled', false]]}, nextTest);} ,
|
||||
[ 'bug240933-1.html' , 'bug240933-1-ref.html' ] ,
|
||||
[ 'bug240933-2.html' , 'bug240933-1-ref.html' ] ,
|
||||
[ 'bug389321-1.html' , 'bug389321-1-ref.html' ] ,
|
||||
@ -155,14 +157,18 @@ var tests = [
|
||||
[ 'bug1123067-2.html' , 'bug1123067-ref.html' ] ,
|
||||
[ 'bug1123067-3.html' , 'bug1123067-ref.html' ] ,
|
||||
[ 'bug1132768-1.html' , 'bug1132768-1-ref.html'] ,
|
||||
function() {SpecialPowers.pushPrefEnv({'clear': [['layout.accessiblecaret.enabled']]}, nextTest);} ,
|
||||
function() {SpecialPowers.pushPrefEnv({'clear': [['touchcaret.enabled'],
|
||||
['selectioncaret.enabled'],
|
||||
['layout.accessiblecaret.enabled']]}, nextTest);} ,
|
||||
];
|
||||
|
||||
if (navigator.appVersion.indexOf("Android") == -1 &&
|
||||
SpecialPowers.Services.appinfo.name != "B2G") {
|
||||
tests.push(function() {SpecialPowers.pushPrefEnv({'set': [['touchcaret.enabled', false]]}, nextTest);});
|
||||
tests.push([ 'bug512295-1.html' , 'bug512295-1-ref.html' ]);
|
||||
tests.push([ 'bug512295-2.html' , 'bug512295-2-ref.html' ]);
|
||||
tests.push([ 'bug923376.html' , 'bug923376-ref.html' ]);
|
||||
tests.push(function() {SpecialPowers.pushPrefEnv({'clear': [['touchcaret.enabled']]}, nextTest);});
|
||||
tests.push(function() {SpecialPowers.pushPrefEnv({'set': [['layout.css.overflow-clip-box.enabled', true]]}, nextTest);});
|
||||
tests.push([ 'bug966992-1.html' , 'bug966992-1-ref.html' ]);
|
||||
tests.push([ 'bug966992-2.html' , 'bug966992-2-ref.html' ]);
|
||||
@ -175,6 +181,7 @@ if (navigator.appVersion.indexOf("Android") == -1 &&
|
||||
if (navigator.platform.indexOf("Linux") >= 0 &&
|
||||
SpecialPowers.Services.appinfo.name != "B2G") {
|
||||
tests = tests.concat([
|
||||
function() {SpecialPowers.pushPrefEnv({'set': [['touchcaret.enabled', false]]}, nextTest);} ,
|
||||
// eDirPrevious, Shift+click
|
||||
[ 'multi-range-user-select.html#prev1S_' , 'multi-range-user-select-ref.html#prev1S_' ] ,
|
||||
[ 'multi-range-user-select.html#prev2S_' , 'multi-range-user-select-ref.html#prev2S_' ] ,
|
||||
@ -267,6 +274,7 @@ if (navigator.platform.indexOf("Linux") >= 0 &&
|
||||
// eDirNext, VK_RIGHT / LEFT
|
||||
[ 'multi-range-script-select.html#next1SR' , 'multi-range-script-select-ref.html#next1SR' ] ,
|
||||
[ 'multi-range-script-select.html#next1SL' , 'multi-range-script-select-ref.html#next1SL' ] ,
|
||||
function() {SpecialPowers.pushPrefEnv({'clear': [['touchcaret.enabled']]}, nextTest);} ,
|
||||
]);
|
||||
}
|
||||
|
||||
|
97
layout/base/tests/test_touchcaret_visibility.html
Normal file
97
layout/base/tests/test_touchcaret_visibility.html
Normal file
@ -0,0 +1,97 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1059165
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1070851</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
|
||||
<style>
|
||||
/* Eliminate the blue glow when focusing an element. */
|
||||
input, textarea, div {
|
||||
background: none;
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="application/javascript;version=1.7">
|
||||
|
||||
/** Test for Bug 1059165 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function replaceContent(aElement, aTextToReplace)
|
||||
{
|
||||
// The element is an input or a textarea.
|
||||
if (typeof aElement.value != "undefined") {
|
||||
aElement.value = aTextToReplace;
|
||||
} else {
|
||||
aElement.innerHTML = aTextToReplace;
|
||||
}
|
||||
}
|
||||
|
||||
function runTest(aSelector, aTextToReplace)
|
||||
{
|
||||
let snapshotCaret = true;
|
||||
|
||||
let element = document.querySelector(aSelector);
|
||||
|
||||
// Reset the content in the element.
|
||||
replaceContent(element, "");
|
||||
|
||||
element.focus();
|
||||
let noTouchCaret = snapshotWindow(window, snapshotCaret);
|
||||
|
||||
// Insert content with a space to the element so that it makes no difference
|
||||
// visually in the snapshots.
|
||||
replaceContent(element, aTextToReplace);
|
||||
|
||||
// Move caret to the front so that the caret position is the same as in the
|
||||
// first snapshot.
|
||||
sendKey('LEFT');
|
||||
|
||||
element.blur();
|
||||
element.focus();
|
||||
let hasTouchCaret = snapshotWindow(window, snapshotCaret);
|
||||
|
||||
// If touch caret is enabled, the two snapshots should be different.
|
||||
let expected = !SpecialPowers.getBoolPref("touchcaret.enabled");
|
||||
let [result, first, second] = compareSnapshots(noTouchCaret, hasTouchCaret,
|
||||
expected);
|
||||
|
||||
let message = "First snapshot of " + aSelector + " shouldn't have touch caret. " +
|
||||
"Second snapshot of " + aSelector + " with content \'" +
|
||||
aTextToReplace + "\' should have touch caret.\n";
|
||||
|
||||
if(!result) {
|
||||
message += "First snapshot: " + first + "\nSecond snapshot: " + second;
|
||||
}
|
||||
|
||||
ok(result, message);
|
||||
|
||||
element.blur();
|
||||
}
|
||||
|
||||
SimpleTest.waitForFocus(function() {
|
||||
runTest('input', " ");
|
||||
runTest('textarea', " ");
|
||||
runTest('div', " ");
|
||||
runTest('div', "<span> </span>");
|
||||
|
||||
SimpleTest.finish();
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1059165">Mozilla Bug 1059165</a>
|
||||
<input>
|
||||
<textarea></textarea>
|
||||
<div contenteditable="true"></div>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user