Bug 544171 - [SeaMonkey 2.1] mochitest-a11y: test_txtctrl.xul fails; (Av2a) Add support for XPFE (and Toolkit) autocomplete popup.

r=surkov.alexander (a=test-only).
This commit is contained in:
Serge Gautherie 2011-03-16 14:28:32 +01:00
parent 5190e6049c
commit c769bc4453

View File

@ -6,7 +6,7 @@
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Accessible XUL textbox and textarea hierarchy tests">
<script type="application/javascript"
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
@ -23,7 +23,9 @@
function doTest()
{
////////////////////
// textbox
////////////////////
var accTree = {
role: ROLE_ENTRY,
children: [
@ -33,6 +35,8 @@
}
]
};
// default textbox
testAccessibleTree("txc1", accTree);
// number textbox
@ -44,7 +48,9 @@
// timed textbox
testAccessibleTree("txc4_deprecated", accTree);
////////////////////
// password textbox
////////////////////
accTree = {
role: ROLE_PASSWORD_TEXT,
children: [
@ -57,7 +63,9 @@
testAccessibleTree("txc5", accTree);
////////////////////
// multiline textbox
////////////////////
accTree = {
role: ROLE_ENTRY,
children: [
@ -74,29 +82,96 @@
testAccessibleTree("txc6", accTree);
////////////////////
// autocomplete textbox
////////////////////
accTree = {
// textbox
role: ROLE_AUTOCOMPLETE,
children: [
{
// html:input
role: ROLE_ENTRY,
children: [
{
// #text
role: ROLE_TEXT_LEAF,
children: []
}
]
},
{
// xul:menupopup
role: ROLE_COMBOBOX_LIST,
children: []
}
]
};
testAccessibleTree("txc7", accTree);
// XPFE and Toolkit autocomplete widgets differ.
var txc7 = document.getElementById("txc7");
if ("clearResults" in txc7) {
SimpleTest.ok(true, "Testing (Old) XPFE autocomplete widget.");
SimpleTest.finish();
// Popup is always created. (See code below.)
accTree.children.push(
{
// xul:panel
role: ROLE_COMBOBOX_LIST,
children: [
{
// xul:tree
role: ROLE_TABLE,
children: [
{
// xul:treecols
role: ROLE_LIST,
children: [
{
// xul:treecol
role: ROLE_COLUMNHEADER,
children: []
}
]
}
]
}
]
}
);
} else {
SimpleTest.ok(true, "Testing (New) Toolkit autocomplete widget.");
// Dumb access to trigger popup lazy creation. (See code below.)
txc7.popup;
accTree.children.push(
{
role: ROLE_LIST,
children: [
{
role: ROLE_LIST,
children: [
{
role: ROLE_COLUMNHEADER,
children: []
}
]
}
]
}
);
}
// Delay txc7 test a bit, to let Toolkit popup lazy creation complete.
function test_txc7() {
testAccessibleTree("txc7", accTree);
SimpleTest.finish();
}
// SimpleTest.executeSoon() doesn't help here: use setTimeout() with a little delay.
setTimeout(test_txc7, 25);
}
SimpleTest.waitForExplicitFinish();
@ -132,4 +207,3 @@
</hbox>
</window>