Bug 535893 - [SeaMonkey 2.1] mochitest-a11y: test_combobox.xul fails; (Av1a) Add support for XPFE autocomplete popup and differently ordered children, Add explicit "no children" checks.

f=neil r=surkov.alexander (a=test-only).
This commit is contained in:
Serge Gautherie 2011-03-17 13:01:25 +01:00
Родитель e074bc92af
Коммит ab6220258e
1 изменённых файлов: 114 добавлений и 12 удалений

Просмотреть файл

@ -6,7 +6,7 @@
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Accessible XUL menulist and textbox @autocomplete hierarchy tests"> title="Accessible XUL menulist and textbox @autocomplete hierarchy tests">
<script type="application/javascript" <script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" /> src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript" <script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
@ -33,15 +33,18 @@
role: ROLE_COMBOBOX_LIST, role: ROLE_COMBOBOX_LIST,
children: [ children: [
{ {
role: ROLE_COMBOBOX_OPTION role: ROLE_COMBOBOX_OPTION,
children: []
}, },
{ {
role: ROLE_COMBOBOX_OPTION role: ROLE_COMBOBOX_OPTION,
children: []
} }
] ]
} }
] ]
}; };
testAccessibleTree("menulist", accTree); testAccessibleTree("menulist", accTree);
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -52,7 +55,9 @@
children: [ children: [
{ {
role: ROLE_ENTRY, role: ROLE_ENTRY,
children: [ ] // no text leaf accessible for text node children: [
// no text leaf accessible for text node
]
}, },
{ {
role: ROLE_COMBOBOX_LIST, // context menu role: ROLE_COMBOBOX_LIST, // context menu
@ -60,15 +65,18 @@
}, },
{ {
role: ROLE_PUSHBUTTON, // dropmarker role: ROLE_PUSHBUTTON, // dropmarker
children: []
}, },
{ {
role: ROLE_COMBOBOX_LIST, // option list role: ROLE_COMBOBOX_LIST, // option list
children: [ children: [
{ {
role: ROLE_COMBOBOX_OPTION role: ROLE_COMBOBOX_OPTION,
children: []
}, },
{ {
role: ROLE_COMBOBOX_OPTION role: ROLE_COMBOBOX_OPTION,
children: []
} }
] ]
} }
@ -84,49 +92,144 @@
// textbox@type=autocomplete #1 (history) // textbox@type=autocomplete #1 (history)
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,
name: "http://mochi.test:8888/redirect-a11y.html" name: "http://mochi.test:8888/redirect-a11y.html",
children: []
} }
] ]
}, },
{ {
// xul:menupopup
role: ROLE_COMBOBOX_LIST, // context menu popup role: ROLE_COMBOBOX_LIST, // context menu popup
children: [ ] children: []
} }
] ]
}; };
// XPFE and Toolkit autocomplete widgets differ.
var ac1h = document.getElementById("autocomplete");
if ("clearResults" in ac1h) {
SimpleTest.ok(true, "Testing (Old) XPFE autocomplete widget. (ac1h)");
// Popup is always created.
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. (ac1h)");
// Popup is lazily created, so not present in this case.
}
testAccessibleTree("autocomplete", accTree); testAccessibleTree("autocomplete", accTree);
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// textbox@type=autocomplete #2 (child menupoup) // textbox@type=autocomplete #2 (child menupoup)
accTree = { accTree = {
// textbox
role: ROLE_AUTOCOMPLETE, role: ROLE_AUTOCOMPLETE,
children: [ children: [
{ {
// menupopup
role: ROLE_COMBOBOX_LIST, // autocomplete menu popup role: ROLE_COMBOBOX_LIST, // autocomplete menu popup
children: [ children: [
{ {
role: ROLE_COMBOBOX_OPTION // menuitem
role: ROLE_COMBOBOX_OPTION,
children: []
} }
] ]
}, },
{ {
// html:input
role: ROLE_ENTRY, role: ROLE_ENTRY,
children: [ ] // no text leaf accessible for text node children: [
// no text leaf accessible for text node
]
}, },
{ {
// xul:menupopup
role: ROLE_COMBOBOX_LIST, // context menu popup role: ROLE_COMBOBOX_LIST, // context menu popup
children: [ ] children: []
} }
] ]
}; };
// XPFE and Toolkit autocomplete widgets differ.
var ac2cmp = document.getElementById("autocomplete2");
if ("clearResults" in ac2cmp) {
SimpleTest.ok(true, "Testing (Old) XPFE autocomplete widget. (ac2mp)");
// Toolkit has the menupopup first ...
var mp = accTree.children.splice(0, 1);
// Popup is always created.
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: []
}
]
}
]
}
]
}
);
// ... whereas XPFE has it last.
accTree.children.push(mp[0]);
} else {
SimpleTest.ok(true, "Testing (New) Toolkit autocomplete widget. (ac2mp)");
// Popup is lazily created, so not present in this case.
}
testAccessibleTree("autocomplete2", accTree); testAccessibleTree("autocomplete2", accTree);
SimpleTest.finish() SimpleTest.finish()
@ -184,4 +287,3 @@
</hbox> </hbox>
</window> </window>