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

@ -23,7 +23,9 @@
function doTest() function doTest()
{ {
////////////////////
// textbox // textbox
////////////////////
var accTree = { var accTree = {
role: ROLE_ENTRY, role: ROLE_ENTRY,
children: [ children: [
@ -33,6 +35,8 @@
} }
] ]
}; };
// default textbox
testAccessibleTree("txc1", accTree); testAccessibleTree("txc1", accTree);
// number textbox // number textbox
@ -44,7 +48,9 @@
// timed textbox // timed textbox
testAccessibleTree("txc4_deprecated", accTree); testAccessibleTree("txc4_deprecated", accTree);
////////////////////
// password textbox // password textbox
////////////////////
accTree = { accTree = {
role: ROLE_PASSWORD_TEXT, role: ROLE_PASSWORD_TEXT,
children: [ children: [
@ -57,7 +63,9 @@
testAccessibleTree("txc5", accTree); testAccessibleTree("txc5", accTree);
////////////////////
// multiline textbox // multiline textbox
////////////////////
accTree = { accTree = {
role: ROLE_ENTRY, role: ROLE_ENTRY,
children: [ children: [
@ -74,29 +82,96 @@
testAccessibleTree("txc6", accTree); testAccessibleTree("txc6", accTree);
////////////////////
// autocomplete textbox // autocomplete textbox
////////////////////
accTree = { accTree = {
// textbox
role: ROLE_AUTOCOMPLETE, role: ROLE_AUTOCOMPLETE,
children: [ children: [
{ {
// html:input
role: ROLE_ENTRY, role: ROLE_ENTRY,
children: [ children: [
{ {
// #text
role: ROLE_TEXT_LEAF, role: ROLE_TEXT_LEAF,
children: [] children: []
} }
] ]
}, },
{ {
// xul:menupopup
role: ROLE_COMBOBOX_LIST, role: ROLE_COMBOBOX_LIST,
children: [] 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(); SimpleTest.waitForExplicitFinish();
@ -132,4 +207,3 @@
</hbox> </hbox>
</window> </window>