mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
111 lines
3.2 KiB
HTML
111 lines
3.2 KiB
HTML
<html>
|
|
|
|
<head>
|
|
<title>Text accessible caret testing</title>
|
|
|
|
<link rel="stylesheet" type="text/css"
|
|
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
|
|
|
<script type="application/javascript"
|
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script type="application/javascript"
|
|
src="../common.js"></script>
|
|
<script type="application/javascript"
|
|
src="../events.js"></script>
|
|
|
|
<script type="application/javascript">
|
|
/**
|
|
* Turn on/off the caret browsing mode.
|
|
*/
|
|
function turnCaretBrowsing(aIsOn)
|
|
{
|
|
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
|
|
getService(Components.interfaces.nsIPrefBranch);
|
|
prefs.setBoolPref("accessibility.browsewithcaret", aIsOn);
|
|
}
|
|
|
|
/**
|
|
* Test caret offset for the given accessible.
|
|
*/
|
|
function testCaretOffset(aID, aCaretOffset)
|
|
{
|
|
var acc = getAccessible(aID, [nsIAccessibleText]);
|
|
is(acc.caretOffset, aCaretOffset,
|
|
"Wrong caret offset for " + aID);
|
|
}
|
|
|
|
/**
|
|
* Do tests.
|
|
*/
|
|
var gQueue = null;
|
|
|
|
//gA11yEventDumpID = "eventdump"; // debug stuff
|
|
//gA11yEventDumpToConsole = true;
|
|
|
|
function doTests()
|
|
{
|
|
turnCaretBrowsing(true);
|
|
|
|
// test caret offsets
|
|
testCaretOffset(document, 14);
|
|
testCaretOffset("textbox", -1);
|
|
testCaretOffset("textarea", -1);
|
|
testCaretOffset("p", -1);
|
|
|
|
// test caret move events and caret offsets
|
|
gQueue = new eventQueue();
|
|
|
|
gQueue.push(new setCaretOffset("textbox", 1, "textbox"));
|
|
gQueue.push(new setCaretOffset("link", 1, "link"));
|
|
gQueue.push(new setCaretOffset("heading", 1, document));
|
|
gQueue.onFinish = function()
|
|
{
|
|
turnCaretBrowsing(false);
|
|
}
|
|
|
|
gQueue.invoke(); // Will call SimpleTest.finish();
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
addA11yLoadEvent(doTests);
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank"
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=448744"
|
|
title="caretOffset should return -1 if the system caret is not currently with in that particular object">
|
|
Mozilla Bug 448744
|
|
</a>
|
|
<a target="_blank"
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=524115"
|
|
title="HyperText accessible should get focus when the caret is positioned inside of it, text is changed or copied into clipboard by ATs">
|
|
Mozilla Bug 524115
|
|
</a>
|
|
<a target="_blank"
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=546068"
|
|
title="Position is not being updated when atk_text_set_caret_offset is used">
|
|
Mozilla Bug 546068
|
|
</a>
|
|
<a target="_blank"
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=725581"
|
|
title="caretOffset for textarea should be -1 when textarea doesn't have a focus">
|
|
Mozilla Bug 725581
|
|
</a>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none"></div>
|
|
<pre id="test">
|
|
</pre>
|
|
|
|
<input id="textbox" value="hello"/>
|
|
<textarea id="textarea">text<br>text</textarea>
|
|
<p id="p" contentEditable="true"><span>text</span><br/>text</p>
|
|
<a id="link" href="about:">about mozilla</a>
|
|
<h5 id="heading">heading</h5>
|
|
|
|
<div id="eventdump"></div>
|
|
</body>
|
|
</html>
|