diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-02-07 16:19:10 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-03-03 19:24:49 +0100 |
commit | a6e2a47db5a109519fbc4f41a4c9c22d766fecf8 (patch) | |
tree | cd80afe85d55d8db9f3cb8b6231ebb5a7871f541 /tests | |
parent | c9c038430bf21909f2038ba66a6c85faf0989dd4 (diff) |
Fix accessibility test for table elements
They need the general structure around, and a hint that
the table is not just for layout.
Change-Id: I12f0512a940da4aabb8ce1513da139d8f023f1e2
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/accessibility/tst_accessibility.cpp | 240 |
1 files changed, 119 insertions, 121 deletions
diff --git a/tests/auto/widgets/accessibility/tst_accessibility.cpp b/tests/auto/widgets/accessibility/tst_accessibility.cpp index 80defb248..98f15e684 100644 --- a/tests/auto/widgets/accessibility/tst_accessibility.cpp +++ b/tests/auto/widgets/accessibility/tst_accessibility.cpp @@ -333,139 +333,139 @@ void tst_Accessibility::value() void tst_Accessibility::roles_data() { QTest::addColumn<QString>("html"); - QTest::addColumn<bool>("isSection"); + QTest::addColumn<int>("nested"); QTest::addColumn<QAccessible::Role>("role"); - QTest::newRow("AX_ROLE_ABBR") << QString("<abbr>a</abbr>") << false << QAccessible::StaticText; - QTest::newRow("AX_ROLE_ALERT") << QString("<div role='alert'>alert</div>") << true << QAccessible::AlertMessage; - QTest::newRow("AX_ROLE_ALERT_DIALOG") << QString("<div role='alertdialog'>alert</div>") << true << QAccessible::AlertMessage; - QTest::newRow("AX_ROLE_ANCHOR") << QString("<a id='a'>Chapter a</a>") << false << QAccessible::Link; - QTest::newRow("AX_ROLE_ANNOTATION") << QString("<rt>a</rt>") << false << QAccessible::StaticText; - QTest::newRow("AX_ROLE_APPLICATION") << QString("<div role='application'>landmark</div>") << true << QAccessible::Document; - QTest::newRow("AX_ROLE_ARTICLE") << QString("<article>a</article>") << true << QAccessible::Section; - QTest::newRow("AX_ROLE_AUDIO") << QString("<audio controls><source src='test.mp3' type='audio/mpeg'></audio>") << false << QAccessible::Sound; - QTest::newRow("AX_ROLE_BANNER") << QString("<div role=banner>a</div>") << true << QAccessible::Section; - QTest::newRow("AX_ROLE_BLOCKQUOTE") << QString("<blockquote>a</blockquote>") << true << QAccessible::Section; - QTest::newRow("AX_ROLE_BUTTON") << QString("<button>a</button>") << false << QAccessible::Button; + QTest::newRow("AX_ROLE_ABBR") << QString("<abbr>a</abbr>") << 1 << QAccessible::StaticText; + QTest::newRow("AX_ROLE_ALERT") << QString("<div role='alert'>alert</div>") << 0 << QAccessible::AlertMessage; + QTest::newRow("AX_ROLE_ALERT_DIALOG") << QString("<div role='alertdialog'>alert</div>") << 0 << QAccessible::AlertMessage; + QTest::newRow("AX_ROLE_ANCHOR") << QString("<a id='a'>Chapter a</a>") << 1 << QAccessible::Link; + QTest::newRow("AX_ROLE_ANNOTATION") << QString("<rt>a</rt>") << 1 << QAccessible::StaticText; + QTest::newRow("AX_ROLE_APPLICATION") << QString("<div role='application'>landmark</div>") << 0 << QAccessible::Document; + QTest::newRow("AX_ROLE_ARTICLE") << QString("<article>a</article>") << 0 << QAccessible::Section; + QTest::newRow("AX_ROLE_AUDIO") << QString("<audio controls><source src='test.mp3' type='audio/mpeg'></audio>") << 1 << QAccessible::Sound; + QTest::newRow("AX_ROLE_BANNER") << QString("<div role=banner>a</div>") << 0 << QAccessible::Section; + QTest::newRow("AX_ROLE_BLOCKQUOTE") << QString("<blockquote>a</blockquote>") << 0 << QAccessible::Section; + QTest::newRow("AX_ROLE_BUTTON") << QString("<button>a</button>") << 1 << QAccessible::Button; //QTest::newRow("AX_ROLE_BUTTON_DROP_DOWN"); // TODO: Remove this during the next Chromium update: https://chromium-review.googlesource.com/842475 - //QTest::newRow("AX_ROLE_CANVAS") << QString("<canvas width='10' height='10'></canvas>") << true << QAccessible::Canvas; // FIXME: The test case might be wrong (see AXLayoutObject.cpp) - QTest::newRow("AX_ROLE_CAPTION") << QString("<table><caption>a</caption></table>") << false << QAccessible::Heading; + //QTest::newRow("AX_ROLE_CANVAS") << QString("<canvas width='10' height='10'></canvas>") << 0 << QAccessible::Canvas; // FIXME: The test case might be wrong (see AXLayoutObject.cpp) + QTest::newRow("AX_ROLE_CAPTION") << QString("<table><caption>a</caption></table>") << 1 << QAccessible::Heading; //QTest::newRow("AX_ROLE_CARET"); // Not a blink accessibility role - //QTest::newRow("AX_ROLE_CELL") << QString("<td role='cell'>a</td>") << true << QAccessible::Cell; // FIXME: Aria role 'cell' should work for <td> - QTest::newRow("AX_ROLE_CHECK_BOX") << QString("<input type='checkbox'>a</input>") << false << QAccessible::CheckBox; - QTest::newRow("AX_ROLE_CLIENT") << QString("") << true << QAccessible::Client; - QTest::newRow("AX_ROLE_COLOR_WELL") << QString("<input type='color'>a</input>") << false << QAccessible::ColorChooser; - //QTest::newRow("AX_ROLE_COLUMN") << QString("<table><tr><td>a</td></tr>") << true << QAccessible::Column; // FIXME: The test case might be wrong (see AXTableColumn.h) - QTest::newRow("AX_ROLE_COLUMN_HEADER") << QString("<div role='columnheader'>a</div>") << true << QAccessible::ColumnHeader; - QTest::newRow("AX_ROLE_COMBO_BOX_GROUPING") << QString("<div role='combobox'><input></div>") << true << QAccessible::ComboBox; - QTest::newRow("AX_ROLE_COMBO_BOX_MENU_BUTTON") << QString("<div tabindex=0 role='combobox'>Select</div>") << true << QAccessible::ComboBox; - QTest::newRow("AX_ROLE_TEXT_FIELD_WITH_COMBO_BOX") << QString("<input role='combobox'>") << false << QAccessible::ComboBox; - QTest::newRow("AX_ROLE_COMPLEMENTARY") << QString("<aside>a</aside>") << true << QAccessible::ComplementaryContent; - QTest::newRow("AX_ROLE_CONTENT_INFO") << QString("<address>a</address>") << true << QAccessible::Section; - QTest::newRow("AX_ROLE_DATE") << QString("<input type='date'></input>") << false << QAccessible::Clock; - QTest::newRow("AX_ROLE_DATE_TIME") << QString("<input type='datetime-local'></input>") << false << QAccessible::Clock; - QTest::newRow("AX_ROLE_DEFINITION") << QString("<div role='definition'>landmark</div>") << true << QAccessible::Paragraph; - QTest::newRow("AX_ROLE_DESCRIPTION_LIST") << QString("<dl>a</dl>") << true << QAccessible::List; - QTest::newRow("AX_ROLE_DESCRIPTION_LIST_DETAIL") << QString("<dd>a</dd>") << true << QAccessible::Paragraph; - QTest::newRow("AX_ROLE_DESCRIPTION_LIST_TERM") << QString("<dt>a</dt>") << true << QAccessible::ListItem; - QTest::newRow("AX_ROLE_DETAILS") << QString("<details>a</details>") << true << QAccessible::Grouping; + QTest::newRow("AX_ROLE_CELL") << QString("<table role=table><tr><td>a</td></tr></table>") << 2 << QAccessible::Cell; + QTest::newRow("AX_ROLE_CHECK_BOX") << QString("<input type='checkbox'>a</input>") << 1 << QAccessible::CheckBox; + QTest::newRow("AX_ROLE_CLIENT") << QString("") << 0 << QAccessible::Client; + QTest::newRow("AX_ROLE_COLOR_WELL") << QString("<input type='color'>a</input>") << 1 << QAccessible::ColorChooser; + //QTest::newRow("AX_ROLE_COLUMN") << QString("<table><tr><td>a</td></tr>") << 0 << QAccessible::Column; // FIXME: The test case might be wrong (see AXTableColumn.h) + QTest::newRow("AX_ROLE_COLUMN_HEADER") << QString("<table role=table><tr><th>a</th></tr><tr><td>a</td></tr></table>") << 2 << QAccessible::ColumnHeader; + QTest::newRow("AX_ROLE_COMBO_BOX_GROUPING") << QString("<div role='combobox'><input></div>") << 0 << QAccessible::ComboBox; + QTest::newRow("AX_ROLE_COMBO_BOX_MENU_BUTTON") << QString("<div tabindex=0 role='combobox'>Select</div>") << 0 << QAccessible::ComboBox; + QTest::newRow("AX_ROLE_TEXT_FIELD_WITH_COMBO_BOX") << QString("<input role='combobox'>") << 1 << QAccessible::ComboBox; + QTest::newRow("AX_ROLE_COMPLEMENTARY") << QString("<aside>a</aside>") << 0 << QAccessible::ComplementaryContent; + QTest::newRow("AX_ROLE_CONTENT_INFO") << QString("<address>a</address>") << 0 << QAccessible::Section; + QTest::newRow("AX_ROLE_DATE") << QString("<input type='date'></input>") << 1 << QAccessible::Clock; + QTest::newRow("AX_ROLE_DATE_TIME") << QString("<input type='datetime-local'></input>") << 1 << QAccessible::Clock; + QTest::newRow("AX_ROLE_DEFINITION") << QString("<div role='definition'>landmark</div>") << 0 << QAccessible::Paragraph; + QTest::newRow("AX_ROLE_DESCRIPTION_LIST") << QString("<dl>a</dl>") << 0 << QAccessible::List; + QTest::newRow("AX_ROLE_DESCRIPTION_LIST_DETAIL") << QString("<dd>a</dd>") << 0 << QAccessible::Paragraph; + QTest::newRow("AX_ROLE_DESCRIPTION_LIST_TERM") << QString("<dt>a</dt>") << 0 << QAccessible::ListItem; + QTest::newRow("AX_ROLE_DETAILS") << QString("<details>a</details>") << 0 << QAccessible::Grouping; //QTest::newRow("AX_ROLE_DESKTOP"); // Not a blink accessibility role - QTest::newRow("AX_ROLE_DIALOG") << QString("<div role='dialog'></div>") << true << QAccessible::Dialog; - //QTest::newRow("AX_ROLE_DIRECTORY") << QString("<div role='directory'></div>") << true << QAccessible::NoRole; // FIXME: Aria role 'directory' should work - QTest::newRow("AX_ROLE_DISCLOSURE_TRIANGLE") << QString("<details><summary>a</summary></details>") << false << QAccessible::NoRole; - QTest::newRow("AX_ROLE_GENERIC_CONTAINER") << QString("<div>a</div>") << true << QAccessible::Section; - QTest::newRow("AX_ROLE_DOCUMENT") << QString("<div role='document'>a</div>") << true << QAccessible::Document; - QTest::newRow("AX_ROLE_EMBEDDED_OBJECT") << QString("<object width='10' height='10'></object>") << false << QAccessible::Grouping; - QTest::newRow("AX_ROLE_FEED") << QString("<div role='feed'>a</div>") << true << QAccessible::Section; - QTest::newRow("AX_ROLE_FIGCAPTION") << QString("<figcaption>a</figcaption>") << true << QAccessible::Heading; - QTest::newRow("AX_ROLE_FIGURE") << QString("<figure>a</figure>") << true << QAccessible::Section; - QTest::newRow("AX_ROLE_FOOTER") << QString("<footer>a</footer>") << true << QAccessible::Footer; - QTest::newRow("AX_ROLE_FORM") << QString("<form></form>") << true << QAccessible::Form; - QTest::newRow("AX_ROLE_GRID") << QString("<div role='grid'></div>") << true << QAccessible::Table; - QTest::newRow("AX_ROLE_GROUP") << QString("<fieldset></fieldset>") << true << QAccessible::Grouping; - QTest::newRow("AX_ROLE_HEADER)") << QString("<header>a</header>") << true << QAccessible::Section; - QTest::newRow("AX_ROLE_HEADING") << QString("<h1>a</h1>") << true << QAccessible::Heading; - QTest::newRow("AX_ROLE_IFRAME") << QString("<iframe>a</iframe>") << true << QAccessible::Section; - QTest::newRow("AX_ROLE_IFRAME_PRESENTATIONAL") << QString("<iframe role='presentation'>a</iframe>") << false << QAccessible::NoRole; - //QTest::newRow("AX_ROLE_IGNORED") << QString("<tag>a</tag>") << true << QAccessible::NoRole; // FIXME: The HTML element should not be exposed as an element (see AXNodeObject.cpp) - QTest::newRow("AX_ROLE_IMAGE") << QString("<img>") << false << QAccessible::Graphic; - //QTest::newRow("AX_ROLE_IMAGE_MAP") << QString("<map>a</map>") << true << QAccessible::Graphic; // FIXME: The test case might be wrong (see AXLayoutObject.cpp) - QTest::newRow("AX_ROLE_INLINE_TEXT_BOX") << QString("<textarea rows='4' cols='50'></textarea>") << false << QAccessible::EditableText; - QTest::newRow("AX_ROLE_INPUT_TIME") << QString("<input type='time'></input>") << false << QAccessible::SpinBox; - QTest::newRow("AX_ROLE_LABEL_TEXT") << QString("<label>a</label>") << false << QAccessible::StaticText; - QTest::newRow("AX_ROLE_LEGEND") << QString("<legend>a</legend>") << true << QAccessible::StaticText; - QTest::newRow("AX_ROLE_LINE_BREAK") << QString("<br>") << false << QAccessible::Separator; - QTest::newRow("AX_ROLE_LINK") << QString("<a href=''>link</a>") << false << QAccessible::Link; - QTest::newRow("AX_ROLE_LIST") << QString("<ul></ul>") << true << QAccessible::List; - QTest::newRow("AX_ROLE_LIST_BOX") << QString("<select multiple></select>") << false << QAccessible::ComboBox; - QTest::newRow("AX_ROLE_LIST_BOX_OPTION") << QString("<option>a</option>") << true << QAccessible::ListItem; - QTest::newRow("AX_ROLE_LIST_ITEM") << QString("<li>a</li>") << true << QAccessible::ListItem; - QTest::newRow("AX_ROLE_LIST_MARKER") << QString("<li><ul></ul></li>") << false << QAccessible::StaticText; + QTest::newRow("AX_ROLE_DIALOG") << QString("<div role='dialog'></div>") << 0 << QAccessible::Dialog; + //QTest::newRow("AX_ROLE_DIRECTORY") << QString("<div role='directory'></div>") << 0 << QAccessible::NoRole; // FIXME: Aria role 'directory' should work + QTest::newRow("AX_ROLE_DISCLOSURE_TRIANGLE") << QString("<details><summary>a</summary></details>") << 1 << QAccessible::NoRole; + QTest::newRow("AX_ROLE_GENERIC_CONTAINER") << QString("<div>a</div>") << 0 << QAccessible::Section; + QTest::newRow("AX_ROLE_DOCUMENT") << QString("<div role='document'>a</div>") << 0 << QAccessible::Document; + QTest::newRow("AX_ROLE_EMBEDDED_OBJECT") << QString("<object width='10' height='10'></object>") << 1 << QAccessible::Grouping; + QTest::newRow("AX_ROLE_FEED") << QString("<div role='feed'>a</div>") << 0 << QAccessible::Section; + QTest::newRow("AX_ROLE_FIGCAPTION") << QString("<figcaption>a</figcaption>") << 0 << QAccessible::Heading; + QTest::newRow("AX_ROLE_FIGURE") << QString("<figure>a</figure>") << 0 << QAccessible::Section; + QTest::newRow("AX_ROLE_FOOTER") << QString("<footer>a</footer>") << 0 << QAccessible::Footer; + QTest::newRow("AX_ROLE_FORM") << QString("<form></form>") << 0 << QAccessible::Form; + QTest::newRow("AX_ROLE_GRID") << QString("<div role='grid'></div>") << 0 << QAccessible::Table; + QTest::newRow("AX_ROLE_GROUP") << QString("<fieldset></fieldset>") << 0 << QAccessible::Grouping; + QTest::newRow("AX_ROLE_HEADER)") << QString("<header>a</header>") << 0 << QAccessible::Section; + QTest::newRow("AX_ROLE_HEADING") << QString("<h1>a</h1>") << 0 << QAccessible::Heading; + QTest::newRow("AX_ROLE_IFRAME") << QString("<iframe>a</iframe>") << 0 << QAccessible::Section; + QTest::newRow("AX_ROLE_IFRAME_PRESENTATIONAL") << QString("<iframe role='presentation'>a</iframe>") << 1 << QAccessible::NoRole; + //QTest::newRow("AX_ROLE_IGNORED") << QString("<tag>a</tag>") << 0 << QAccessible::NoRole; // FIXME: The HTML element should not be exposed as an element (see AXNodeObject.cpp) + QTest::newRow("AX_ROLE_IMAGE") << QString("<img>") << 1 << QAccessible::Graphic; + //QTest::newRow("AX_ROLE_IMAGE_MAP") << QString("<map>a</map>") << 0 << QAccessible::Graphic; // FIXME: The test case might be wrong (see AXLayoutObject.cpp) + QTest::newRow("AX_ROLE_INLINE_TEXT_BOX") << QString("<textarea rows='4' cols='50'></textarea>") << 1 << QAccessible::EditableText; + QTest::newRow("AX_ROLE_INPUT_TIME") << QString("<input type='time'></input>") << 1 << QAccessible::SpinBox; + QTest::newRow("AX_ROLE_LABEL_TEXT") << QString("<label>a</label>") << 1 << QAccessible::StaticText; + QTest::newRow("AX_ROLE_LEGEND") << QString("<legend>a</legend>") << 0 << QAccessible::StaticText; + QTest::newRow("AX_ROLE_LINE_BREAK") << QString("<br>") << 1 << QAccessible::Separator; + QTest::newRow("AX_ROLE_LINK") << QString("<a href=''>link</a>") << 1 << QAccessible::Link; + QTest::newRow("AX_ROLE_LIST") << QString("<ul></ul>") << 0 << QAccessible::List; + QTest::newRow("AX_ROLE_LIST_BOX") << QString("<select multiple></select>") << 1 << QAccessible::ComboBox; + QTest::newRow("AX_ROLE_LIST_BOX_OPTION") << QString("<option>a</option>") << 0 << QAccessible::ListItem; + QTest::newRow("AX_ROLE_LIST_ITEM") << QString("<li>a</li>") << 0 << QAccessible::ListItem; + QTest::newRow("AX_ROLE_LIST_MARKER") << QString("<li><ul></ul></li>") << 1 << QAccessible::StaticText; //QTest::newRow("AX_ROLE_LOCATION_BAR"); // Not a blink accessibility role - QTest::newRow("AX_ROLE_LOG") << QString("<div role='log'>a</div>") << true << QAccessible::Section; - QTest::newRow("AX_ROLE_MAIN") << QString("<main>a</main>") << true << QAccessible::Grouping; - QTest::newRow("AX_ROLE_MARK") << QString("<mark>a</mark>") << false << QAccessible::StaticText; - QTest::newRow("AX_ROLE_MARQUEE") << QString("<div role='marquee'>a</div>") << true << QAccessible::Section; - QTest::newRow("AX_ROLE_MATH") << QString("<math>a</math>") << false << QAccessible::Equation; - QTest::newRow("AX_ROLE_MENU") << QString("<div role='menu'>a</div>") << true << QAccessible::PopupMenu; - QTest::newRow("AX_ROLE_MENU_BAR") << QString("<div role='menubar'>a</div>") << true << QAccessible::MenuBar; - QTest::newRow("AX_ROLE_MENU_ITEM") << QString("<menu role='menu'><input type='button' /></menu>") << false << QAccessible::MenuItem; - QTest::newRow("AX_ROLE_MENU_ITEM_CHECK_BOX") << QString("<menu role='menu'><input type='checkbox'></input></menu>") << false << QAccessible::CheckBox; - QTest::newRow("AX_ROLE_MENU_ITEM_RADIO") << QString("<menu role='menu'><input type='radio'></input></menu>") << false << QAccessible::RadioButton; - QTest::newRow("AX_ROLE_MENU_BUTTON") << QString("<menu role='group'><div role='menuitem'>a</div></menu>") << false << QAccessible::MenuItem; + QTest::newRow("AX_ROLE_LOG") << QString("<div role='log'>a</div>") << 0 << QAccessible::Section; + QTest::newRow("AX_ROLE_MAIN") << QString("<main>a</main>") << 0 << QAccessible::Grouping; + QTest::newRow("AX_ROLE_MARK") << QString("<mark>a</mark>") << 1 << QAccessible::StaticText; + QTest::newRow("AX_ROLE_MARQUEE") << QString("<div role='marquee'>a</div>") << 0 << QAccessible::Section; + QTest::newRow("AX_ROLE_MATH") << QString("<math>a</math>") << 1 << QAccessible::Equation; + QTest::newRow("AX_ROLE_MENU") << QString("<div role='menu'>a</div>") << 0 << QAccessible::PopupMenu; + QTest::newRow("AX_ROLE_MENU_BAR") << QString("<div role='menubar'>a</div>") << 0 << QAccessible::MenuBar; + QTest::newRow("AX_ROLE_MENU_ITEM") << QString("<menu role='menu'><input type='button' /></menu>") << 1 << QAccessible::MenuItem; + QTest::newRow("AX_ROLE_MENU_ITEM_CHECK_BOX") << QString("<menu role='menu'><input type='checkbox'></input></menu>") << 1 << QAccessible::CheckBox; + QTest::newRow("AX_ROLE_MENU_ITEM_RADIO") << QString("<menu role='menu'><input type='radio'></input></menu>") << 1 << QAccessible::RadioButton; + QTest::newRow("AX_ROLE_MENU_BUTTON") << QString("<menu role='group'><div role='menuitem'>a</div></menu>") << 1 << QAccessible::MenuItem; //QTest::newRow("AX_ROLE_MENU_LIST_OPTION") << QString("<select role='menu'><option>a</option></select>") << false << QAccessible::MenuItem; // FIXME: <select> should be a menu list (see AXMenuListOption.cpp) - //QTest::newRow("AX_ROLE_MENU_LIST_POPUP") << QString("<menu type='context'>a</menu>") << true << QAccessible::PopupMenu; // FIXME: <menu> is not fully supported by Chromium (see AXMenuListPopup.h) - QTest::newRow("AX_ROLE_METER") << QString("<meter>a</meter>") << false << QAccessible::Chart; - QTest::newRow("AX_ROLE_NAVIGATION") << QString("<nav>a</nav>") << true << QAccessible::Section; - QTest::newRow("AX_ROLE_NOTE") << QString("<div role='note'>a</div>") << true << QAccessible::Note; + //QTest::newRow("AX_ROLE_MENU_LIST_POPUP") << QString("<menu type='context'>a</menu>") << 0 << QAccessible::PopupMenu; // FIXME: <menu> is not fully supported by Chromium (see AXMenuListPopup.h) + QTest::newRow("AX_ROLE_METER") << QString("<meter>a</meter>") << 1 << QAccessible::Chart; + QTest::newRow("AX_ROLE_NAVIGATION") << QString("<nav>a</nav>") << 0 << QAccessible::Section; + QTest::newRow("AX_ROLE_NOTE") << QString("<div role='note'>a</div>") << 0 << QAccessible::Note; //QTest::newRow("AX_ROLE_PANE"); // Not a blink accessibility role - QTest::newRow("AX_ROLE_PARAGRAH") << QString("<p>a</p>") << true << QAccessible::Paragraph; - QTest::newRow("AX_ROLE_POP_UP_BUTTON") << QString("<select><option>a</option></select>") << false << QAccessible::ComboBox; - QTest::newRow("AX_ROLE_PRE") << QString("<pre>a</pre>") << true << QAccessible::Section; - //QTest::newRow("AX_ROLE_PRESENTATIONAL") << QString("<div role='presentation'>a</div>") << true << QAccessible::NoRole; // FIXME: Aria role 'presentation' should work - QTest::newRow("AX_ROLE_PROGRESS_INDICATOR") << QString("<div role='progressbar' aria-valuenow='77' aria-valuemin='22' aria-valuemax='99'></div>") << true << QAccessible::ProgressBar; - QTest::newRow("AX_ROLE_RADIO_BUTTON") << QString("<input type='radio'></input>") << false << QAccessible::RadioButton; - QTest::newRow("AX_ROLE_RADIO_GROUP") << QString("<fieldset role='radiogroup'></fieldset>") << true << QAccessible::Grouping; - QTest::newRow("AX_ROLE_REGION") << QString("<section>a</section>") << true << QAccessible::Section; - //QTest::newRow("AX_ROLE_ROW") << QString("<tr role='row'>a</tr>") << true << QAccessible::Row; // FIXME: Aria role 'row' should work for <tr> - //QTest::newRow("AX_ROLE_ROW_HEADER") << QString("<td role='rowheader'>a</td>") << true << QAccessible::RowHeader; // FIXME: Aria role 'rowheader' should work for <td> - QTest::newRow("AX_ROLE_RUBY") << QString("<ruby>a</ruby>") << false << QAccessible::StaticText; - QTest::newRow("AX_ROLE_SCROLL_BAR") << QString("<div role='scrollbar'>a</a>") << true << QAccessible::ScrollBar; - QTest::newRow("AX_ROLE_SEARCH") << QString("<div role='search'>landmark</div>") << true << QAccessible::Section; - QTest::newRow("AX_ROLE_SEARCH_BOX") << QString("<input type='search'></input>") << false << QAccessible::EditableText; - QTest::newRow("AX_ROLE_SLIDER") << QString("<input type='range'></input>") << false << QAccessible::Slider; + QTest::newRow("AX_ROLE_PARAGRAH") << QString("<p>a</p>") << 0 << QAccessible::Paragraph; + QTest::newRow("AX_ROLE_POP_UP_BUTTON") << QString("<select><option>a</option></select>") << 1 << QAccessible::ComboBox; + QTest::newRow("AX_ROLE_PRE") << QString("<pre>a</pre>") << 0 << QAccessible::Section; + //QTest::newRow("AX_ROLE_PRESENTATIONAL") << QString("<div role='presentation'>a</div>") << 0 << QAccessible::NoRole; // FIXME: Aria role 'presentation' should work + QTest::newRow("AX_ROLE_PROGRESS_INDICATOR") << QString("<div role='progressbar' aria-valuenow='77' aria-valuemin='22' aria-valuemax='99'></div>") << 0 << QAccessible::ProgressBar; + QTest::newRow("AX_ROLE_RADIO_BUTTON") << QString("<input type='radio'></input>") << 1 << QAccessible::RadioButton; + QTest::newRow("AX_ROLE_RADIO_GROUP") << QString("<fieldset role='radiogroup'></fieldset>") << 0 << QAccessible::Grouping; + QTest::newRow("AX_ROLE_REGION") << QString("<section>a</section>") << 0 << QAccessible::Section; + QTest::newRow("AX_ROLE_ROW") << QString("<table role=table><tr><td>a</td></tr></table>") << 1 << QAccessible::Row; + QTest::newRow("AX_ROLE_ROW_HEADER") << QString("<table role=table><tr><th>a</td><td>b</td></tr></table>") << 2 << QAccessible::RowHeader; + QTest::newRow("AX_ROLE_RUBY") << QString("<ruby>a</ruby>") << 1 << QAccessible::StaticText; + QTest::newRow("AX_ROLE_SCROLL_BAR") << QString("<div role='scrollbar'>a</a>") << 0 << QAccessible::ScrollBar; + QTest::newRow("AX_ROLE_SEARCH") << QString("<div role='search'>landmark</div>") << 0 << QAccessible::Section; + QTest::newRow("AX_ROLE_SEARCH_BOX") << QString("<input type='search'></input>") << 1 << QAccessible::EditableText; + QTest::newRow("AX_ROLE_SLIDER") << QString("<input type='range'></input>") << 1 << QAccessible::Slider; //QTest::newRow("AX_ROLE_SLIDER_THUMB"); // No mapping to ARIA role - QTest::newRow("AX_ROLE_SPIN_BUTTON") << QString("<input type='number'></input>") << false << QAccessible::SpinBox; + QTest::newRow("AX_ROLE_SPIN_BUTTON") << QString("<input type='number'></input>") << 1 << QAccessible::SpinBox; //QTest::newRow("AX_ROLE_SPIN_BUTTON_PART"); // No mapping to ARIA role - QTest::newRow("AX_ROLE_SPLITER") << QString("<hr>") << true << QAccessible::Splitter; - QTest::newRow("AX_ROLE_STATIC_TEXT") << QString("a") << false << QAccessible::StaticText; - QTest::newRow("AX_ROLE_STATUS") << QString("<output>a</output>") << false << QAccessible::Indicator; - QTest::newRow("AX_ROLE_SVG_ROOT") << QString("<svg width='10' height='10'></svg>") << false << QAccessible::Graphic; - QTest::newRow("AX_ROLE_SWITCH") << QString("<button aria-checked='false'>a</button>") << false << QAccessible::Button; - //QTest::newRow("AX_ROLE_TABLE") << QString("<table>a</table>") << true << QAccessible::Table; // FIXME: The test case might be wrong (see AXTable.cpp) + QTest::newRow("AX_ROLE_SPLITER") << QString("<hr>") << 0 << QAccessible::Splitter; + QTest::newRow("AX_ROLE_STATIC_TEXT") << QString("a") << 1 << QAccessible::StaticText; + QTest::newRow("AX_ROLE_STATUS") << QString("<output>a</output>") << 1 << QAccessible::Indicator; + QTest::newRow("AX_ROLE_SVG_ROOT") << QString("<svg width='10' height='10'></svg>") << 1 << QAccessible::Graphic; + QTest::newRow("AX_ROLE_SWITCH") << QString("<button aria-checked='false'>a</button>") << 1 << QAccessible::Button; + QTest::newRow("AX_ROLE_TABLE") << QString("<table role=table><td>a</td></table>") << 0 << QAccessible::Table; //QTest::newRow("AX_ROLE_TABLE_HEADER_CONTAINER"); // No mapping to ARIA role - QTest::newRow("AX_ROLE_TAB") << QString("<div role='tab'>a</div>") << true << QAccessible::PageTab; - QTest::newRow("AX_ROLE_TAB_LIST") << QString("<div role='tablist'>a</div>") << true << QAccessible::PageTabList; - QTest::newRow("AX_ROLE_TAB_PANEL") << QString("<div role='tabpanel'>a</div>") << true << QAccessible::Pane; - QTest::newRow("AX_ROLE_TERM") << QString("<div role='term'>a</div>") << true << QAccessible::StaticText; - QTest::newRow("AX_ROLE_TEXT_FIELD") << QString("<input type='text'></input>") << false << QAccessible::EditableText; - QTest::newRow("AX_ROLE_TIME") << QString("<time>a</time>") << false << QAccessible::Clock; - QTest::newRow("AX_ROLE_TIMER") << QString("<div role='timer'>a</div>") << true << QAccessible::Clock; + QTest::newRow("AX_ROLE_TAB") << QString("<div role='tab'>a</div>") << 0 << QAccessible::PageTab; + QTest::newRow("AX_ROLE_TAB_LIST") << QString("<div role='tablist'>a</div>") << 0 << QAccessible::PageTabList; + QTest::newRow("AX_ROLE_TAB_PANEL") << QString("<div role='tabpanel'>a</div>") << 0 << QAccessible::Pane; + QTest::newRow("AX_ROLE_TERM") << QString("<div role='term'>a</div>") << 0 << QAccessible::StaticText; + QTest::newRow("AX_ROLE_TEXT_FIELD") << QString("<input type='text'></input>") << 1 << QAccessible::EditableText; + QTest::newRow("AX_ROLE_TIME") << QString("<time>a</time>") << 1 << QAccessible::Clock; + QTest::newRow("AX_ROLE_TIMER") << QString("<div role='timer'>a</div>") << 0 << QAccessible::Clock; //QTest::newRow("AX_ROLE_TITLE_BAR"); // Not a blink accessibility role - QTest::newRow("AX_ROLE_TOGGLE_BUTTON") << QString("<button aria-pressed='false'>a</button>") << false << QAccessible::Button; - QTest::newRow("AX_ROLE_TOOLBAR") << QString("<div role='toolbar'>a</div>") << true << QAccessible::ToolBar; - QTest::newRow("AX_ROLE_TOOLTIP") << QString("<div role='tooltip'>a</div>") << true << QAccessible::ToolTip; - QTest::newRow("AX_ROLE_TREE") << QString("<div role='tree'>a</div>") << true << QAccessible::Tree; - QTest::newRow("AX_ROLE_TREE_GRID") << QString("<div role='treegrid'>a</div>") << true << QAccessible::Tree; - QTest::newRow("AX_ROLE_TREE_ITEM") << QString("<div role='treeitem'>a</div>") << true << QAccessible::TreeItem; - QTest::newRow("AX_ROLE_VIDEO") << QString("<video><source src='test.mp4' type='video/mp4'></video>") << false << QAccessible::Animation; + QTest::newRow("AX_ROLE_TOGGLE_BUTTON") << QString("<button aria-pressed='false'>a</button>") << 1 << QAccessible::Button; + QTest::newRow("AX_ROLE_TOOLBAR") << QString("<div role='toolbar'>a</div>") << 0 << QAccessible::ToolBar; + QTest::newRow("AX_ROLE_TOOLTIP") << QString("<div role='tooltip'>a</div>") << 0 << QAccessible::ToolTip; + QTest::newRow("AX_ROLE_TREE") << QString("<div role='tree'>a</div>") << 0 << QAccessible::Tree; + QTest::newRow("AX_ROLE_TREE_GRID") << QString("<div role='treegrid'>a</div>") << 0 << QAccessible::Tree; + QTest::newRow("AX_ROLE_TREE_ITEM") << QString("<div role='treeitem'>a</div>") << 0 << QAccessible::TreeItem; + QTest::newRow("AX_ROLE_VIDEO") << QString("<video><source src='test.mp4' type='video/mp4'></video>") << 1 << QAccessible::Animation; //QTest::newRow("AX_ROLE_WINDOW"); // No mapping to ARIA role } void tst_Accessibility::roles() { QFETCH(QString, html); - QFETCH(bool, isSection); + QFETCH(int, nested); QFETCH(QAccessible::Role, role); QWebEngineView webView; @@ -484,15 +484,13 @@ void tst_Accessibility::roles() QTRY_COMPARE(view->child(0)->childCount(), 1); QAccessibleInterface *document = view->child(0); - QAccessibleInterface *section = document->child(0); + QAccessibleInterface *element = document->child(0); - if (isSection) { - QCOMPARE(section->role(), role); - return; + while (nested--) { + QTRY_VERIFY(element->child(0)); + element = element->child(0); } - QVERIFY(section->childCount() > 0); - QAccessibleInterface *element = section->child(0); QCOMPARE(element->role(), role); } |