summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@qt.io>2019-05-14 10:51:35 +0200
committerFrederik Gladhorn <frederik.gladhorn@qt.io>2019-05-14 09:58:07 +0000
commit7431b0549a9bb69f5f4a036fc931683dd4e20d2c (patch)
tree32fb4e23682bdaf44872413db35e5cad22795e36
parent9310d5fb5285ae5eb4b94c01606791319b775b85 (diff)
tst_accessibility: Simplify role verification
Instead of casting to int and back to enum, just use the enum directly. Change-Id: Ifbd6a74ee499ffaeb99b0b4274cd59365833bfbd Reviewed-by: Liang Qi <liang.qi@qt.io>
-rw-r--r--tests/auto/accessibility/tst_accessibility.cpp100
1 files changed, 50 insertions, 50 deletions
diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp
index 7e491b54..0224f020 100644
--- a/tests/auto/accessibility/tst_accessibility.cpp
+++ b/tests/auto/accessibility/tst_accessibility.cpp
@@ -64,56 +64,56 @@ private:
void tst_accessibility::a11y_data()
{
QTest::addColumn<QString>("name");
- QTest::addColumn<int>("role");
+ QTest::addColumn<QAccessible::Role>("role");
QTest::addColumn<QString>("text");
- QTest::newRow("AbstractButton") << "abstractbutton" << 0x0000002B << "AbstractButton"; //QAccessible::Button
- QTest::newRow("BusyIndicator") << "busyindicator" << 0x00000027 << ""; //QAccessible::Indicator
- QTest::newRow("Button") << "button" << 0x0000002B << "Button"; //QAccessible::Button
- QTest::newRow("CheckBox") << "checkbox" << 0x0000002C << "CheckBox"; //QAccessible::CheckBox
- QTest::newRow("CheckDelegate") << "checkdelegate" << 0x0000002C << "CheckDelegate"; //QAccessible::CheckBox
- QTest::newRow("ComboBox") << "combobox" << 0x0000002E << "ComboBox"; //QAccessible::ComboBox
- QTest::newRow("Container") << "container" << 0x00000000 << ""; //QAccessible::NoRole
- QTest::newRow("Control") << "control" << 0x00000000 << ""; //QAccessible::NoRole
- QTest::newRow("Dial") << "dial" << 0x00000031 << ""; //QAccessible::Dial
- QTest::newRow("Dialog") << "dialog" << 0x00000012 << "Dialog"; //QAccessible::Dialog
- QTest::newRow("Drawer") << "drawer" << 0x00000012 << ""; //QAccessible::Dialog
- QTest::newRow("Frame") << "frame" << 0x00000013 << ""; //QAccessible::Border
- QTest::newRow("GroupBox") << "groupbox" << 0x00000014 << "GroupBox"; //QAccessible::Grouping
- QTest::newRow("ItemDelegate") << "itemdelegate" << 0x00000022 << "ItemDelegate"; //QAccessible::ListItem
- QTest::newRow("Label") << "label" << 0x00000029 << "Label"; //QAccessible::StaticText
- QTest::newRow("Menu") << "menu" << 0x0000000B << ""; //QAccessible::PopupMenu
- QTest::newRow("MenuItem") << "menuitem" << 0x0000000C << "MenuItem"; //QAccessible::MenuItem
- QTest::newRow("Page") << "page" << 0x00000025 << "Page"; //QAccessible::PageTab
- QTest::newRow("PageIndicator") << "pageindicator" << 0x00000027 << ""; //QAccessible::Indicator
- QTest::newRow("Pane") << "pane" << 0x00000010 << ""; //QAccessible::Pane
- QTest::newRow("Popup") << "popup" << 0x00000012 << ""; //QAccessible::Dialog
- QTest::newRow("ProgressBar") << "progressbar" << 0x00000030 << ""; //QAccessible::ProgressBar
- QTest::newRow("RadioButton") << "radiobutton" << 0x0000002D << "RadioButton"; //QAccessible::RadioButton
- QTest::newRow("RadioDelegate") << "radiodelegate" << 0x0000002D << "RadioDelegate"; //QAccessible::RadioButton
- QTest::newRow("RangeSlider") << "rangeslider" << 0x00000033 << ""; //QAccessible::Slider
- QTest::newRow("RoundButton") << "roundbutton" << 0x0000002B << "RoundButton"; //QAccessible::Button
- QTest::newRow("ScrollBar") << "scrollbar" << 0x00000003 << ""; //QAccessible::ScrollBar
- QTest::newRow("ScrollIndicator") << "scrollindicator" << 0x00000027 << ""; //QAccessible::Indicator
- QTest::newRow("Slider") << "slider" << 0x00000033 << ""; //QAccessible::Slider
- QTest::newRow("SpinBox") << "spinbox" << 0x00000034 << ""; //QAccessible::SpinBox
- QTest::newRow("StackView") << "stackview" << 0x00000080 << ""; //QAccessible::LayeredPane
- QTest::newRow("SwipeDelegate") << "swipedelegate" << 0x00000022 << "SwipeDelegate"; //QAccessible::ListItem
- QTest::newRow("SwipeView") << "swipeview" << 0x0000003C << ""; //QAccessible::Pane
- QTest::newRow("Switch") << "switch" << 0x0000002B << "Switch"; //QAccessible::Button
- QTest::newRow("SwitchDelegate") << "switchdelegate" << 0x00000022 << "SwitchDelegate"; //QAccessible::ListItem
- QTest::newRow("TabBar") << "tabbar" << 0x0000003C << ""; //QAccessible::PageTabList
- QTest::newRow("TabButton") << "tabbutton" << 0x00000025 << "TabButton"; //QAccessible::PageTab
- QTest::newRow("TextArea") << "textarea" << 0x0000002A << ""; //QAccessible::Accessible.EditableText
- QTest::newRow("TextField") << "textfield" << 0x0000002A << ""; //QAccessible::Accessible.EditableText
- QTest::newRow("ToolBar") << "toolbar" << 0x00000016 << ""; //QAccessible::ToolBar
- QTest::newRow("ToolButton") << "toolbutton" << 0x0000002B << "ToolButton"; //QAccessible::Button
- QTest::newRow("ToolTip") << "tooltip" << 0x0000000D << "ToolTip"; //QAccessible::ToolTip
- QTest::newRow("Tumbler") << "tumbler" << 0x00000000 << ""; //QAccessible::NoRole (TODO)
-
- QTest::newRow("DayOfWeekRow") << "dayofweekrow" << 0x0 << "DayOfWeekRow"; //QAccessible::NoRole
- QTest::newRow("MonthGrid") << "monthgrid" << 0x0 << "MonthGrid"; //QAccessible::NoRole
- QTest::newRow("WeekNumberColumn") << "weeknumbercolumn" << 0x0 << "WeekNumberColumn"; //QAccessible::NoRole
+ QTest::newRow("AbstractButton") << "abstractbutton" << QAccessible::Button << "AbstractButton";
+ QTest::newRow("BusyIndicator") << "busyindicator" << QAccessible::Indicator << "";
+ QTest::newRow("Button") << "button" << QAccessible::Button << "Button";
+ QTest::newRow("CheckBox") << "checkbox" << QAccessible::CheckBox << "CheckBox";
+ QTest::newRow("CheckDelegate") << "checkdelegate" << QAccessible::CheckBox << "CheckDelegate";
+ QTest::newRow("ComboBox") << "combobox" << QAccessible::ComboBox << "ComboBox";
+ QTest::newRow("Container") << "container" << QAccessible::NoRole << "";
+ QTest::newRow("Control") << "control" << QAccessible::NoRole << "";
+ QTest::newRow("Dial") << "dial" << QAccessible::Dial << "";
+ QTest::newRow("Dialog") << "dialog" << QAccessible::Dialog << "Dialog";
+ QTest::newRow("Drawer") << "drawer" << QAccessible::Dialog << "";
+ QTest::newRow("Frame") << "frame" << QAccessible::Border << "";
+ QTest::newRow("GroupBox") << "groupbox" << QAccessible::Grouping << "GroupBox";
+ QTest::newRow("ItemDelegate") << "itemdelegate" << QAccessible::ListItem << "ItemDelegate";
+ QTest::newRow("Label") << "label" << QAccessible::StaticText << "Label";
+ QTest::newRow("Menu") << "menu" << QAccessible::PopupMenu << "";
+ QTest::newRow("MenuItem") << "menuitem" << QAccessible::MenuItem << "MenuItem";
+ QTest::newRow("Page") << "page" << QAccessible::PageTab << "Page";
+ QTest::newRow("PageIndicator") << "pageindicator" << QAccessible::Indicator << "";
+ QTest::newRow("Pane") << "pane" << QAccessible::Pane << "";
+ QTest::newRow("Popup") << "popup" << QAccessible::Dialog << "";
+ QTest::newRow("ProgressBar") << "progressbar" << QAccessible::ProgressBar << "";
+ QTest::newRow("RadioButton") << "radiobutton" << QAccessible::RadioButton << "RadioButton";
+ QTest::newRow("RadioDelegate") << "radiodelegate" << QAccessible::RadioButton << "RadioDelegate";
+ QTest::newRow("RangeSlider") << "rangeslider" << QAccessible::Slider << "";
+ QTest::newRow("RoundButton") << "roundbutton" << QAccessible::Button << "RoundButton";
+ QTest::newRow("ScrollBar") << "scrollbar" << QAccessible::ScrollBar << "";
+ QTest::newRow("ScrollIndicator") << "scrollindicator" << QAccessible::Indicator << "";
+ QTest::newRow("Slider") << "slider" << QAccessible::Slider << "";
+ QTest::newRow("SpinBox") << "spinbox" << QAccessible::SpinBox << "";
+ QTest::newRow("StackView") << "stackview" << QAccessible::LayeredPane << "";
+ QTest::newRow("SwipeDelegate") << "swipedelegate" << QAccessible::ListItem << "SwipeDelegate";
+ QTest::newRow("SwipeView") << "swipeview" << QAccessible::PageTabList << "";
+ QTest::newRow("Switch") << "switch" << QAccessible::Button << "Switch";
+ QTest::newRow("SwitchDelegate") << "switchdelegate" << QAccessible::ListItem << "SwitchDelegate";
+ QTest::newRow("TabBar") << "tabbar" << QAccessible::PageTabList << "";
+ QTest::newRow("TabButton") << "tabbutton" << QAccessible::PageTab << "TabButton";
+ QTest::newRow("TextArea") << "textarea" << QAccessible::EditableText << "";
+ QTest::newRow("TextField") << "textfield" << QAccessible::EditableText << "";
+ QTest::newRow("ToolBar") << "toolbar" << QAccessible::ToolBar << "";
+ QTest::newRow("ToolButton") << "toolbutton" << QAccessible::Button << "ToolButton";
+ QTest::newRow("ToolTip") << "tooltip" << QAccessible::ToolTip << "ToolTip";
+ QTest::newRow("Tumbler") << "tumbler" << QAccessible::NoRole << ""; // TODO
+
+ QTest::newRow("DayOfWeekRow") << "dayofweekrow" << QAccessible::NoRole << "DayOfWeekRow";
+ QTest::newRow("MonthGrid") << "monthgrid" << QAccessible::NoRole << "MonthGrid";
+ QTest::newRow("WeekNumberColumn") << "weeknumbercolumn" << QAccessible::NoRole << "WeekNumberColumn";
}
#if QT_CONFIG(accessibility)
@@ -127,7 +127,7 @@ static QPlatformAccessibility *platformAccessibility()
void tst_accessibility::a11y()
{
QFETCH(QString, name);
- QFETCH(int, role);
+ QFETCH(QAccessible::Role, role);
QFETCH(QString, text);
QString fn = name;
@@ -169,7 +169,7 @@ void tst_accessibility::a11y()
}
}
QVERIFY(acc);
- QCOMPARE(acc->role(), (QAccessible::Role)role);
+ QCOMPARE(acc->role(), role);
QCOMPARE(acc->name(), text);
#else
Q_UNUSED(role)