If accessibility isn't built, don't try to test it

Only build the autotest when the feature to be tested is in the Qt
build.  This is better than building and running an empty test.

Change-Id: I67721f5f48296afcca64f761d12325f8e040f2d8
Reviewed-by: Rohan McGovern
(cherry picked from commit cf911bc0d297ed30e615fd115b0d3ae574cb2412)

Conflicts:

	tests/auto/qaccessibility/tst_qaccessibility.cpp
This commit is contained in:
Rohan McGovern 2011-05-18 09:58:16 +10:00
parent 7ef434c3a0
commit 089ad37751
3 changed files with 7 additions and 218 deletions

View File

@ -5,7 +5,6 @@ TEMPLATE=subdirs
SUBDIRS=\ SUBDIRS=\
# baselineexample \ Just an example demonstrating qbaselinetest usage # baselineexample \ Just an example demonstrating qbaselinetest usage
lancelot \ lancelot \
qaccessibility \
qalgorithms \ qalgorithms \
qcombobox \ qcombobox \
qcssparser \ qcssparser \
@ -36,6 +35,8 @@ SUBDIRS=\
windowsmobile \ windowsmobile \
nativeimagehandleprovider nativeimagehandleprovider
contains(QT_CONFIG, accessibility):SUBDIRS += qaccessibility
contains(QT_CONFIG, OdfWriter):SUBDIRS += qzip qtextodfwriter contains(QT_CONFIG, OdfWriter):SUBDIRS += qzip qtextodfwriter
mac: { mac: {
SUBDIRS += macgui \ SUBDIRS += macgui \

View File

@ -1,4 +1,5 @@
load(qttest_p4) load(qttest_p4)
requires(contains(QT_CONFIG,accessibility))
SOURCES += tst_qaccessibility.cpp SOURCES += tst_qaccessibility.cpp
unix:!mac:LIBS+=-lm unix:!mac:LIBS+=-lm

View File

@ -350,7 +350,6 @@ public:
} }
}; };
#ifdef QTEST_ACCESSIBILITY
class QtTestAccessibleWidgetIface: public QAccessibleWidget class QtTestAccessibleWidgetIface: public QAccessibleWidget
{ {
public: public:
@ -368,7 +367,6 @@ public:
return 0; return 0;
} }
}; };
#endif
tst_QAccessibility::tst_QAccessibility() tst_QAccessibility::tst_QAccessibility()
{ {
@ -380,17 +378,13 @@ tst_QAccessibility::~tst_QAccessibility()
void tst_QAccessibility::initTestCase() void tst_QAccessibility::initTestCase()
{ {
#ifdef QTEST_ACCESSIBILITY
QTestAccessibility::initialize(); QTestAccessibility::initialize();
QAccessible::installFactory(QtTestAccessibleWidgetIface::ifaceFactory); QAccessible::installFactory(QtTestAccessibleWidgetIface::ifaceFactory);
#endif
} }
void tst_QAccessibility::cleanupTestCase() void tst_QAccessibility::cleanupTestCase()
{ {
#ifdef QTEST_ACCESSIBILITY
QTestAccessibility::cleanup(); QTestAccessibility::cleanup();
#endif
} }
void tst_QAccessibility::init() void tst_QAccessibility::init()
@ -400,7 +394,6 @@ void tst_QAccessibility::init()
void tst_QAccessibility::cleanup() void tst_QAccessibility::cleanup()
{ {
#ifdef QTEST_ACCESSIBILITY
const EventList list = QTestAccessibility::events(); const EventList list = QTestAccessibility::events();
if (!list.isEmpty()) { if (!list.isEmpty()) {
qWarning("%d accessibility event(s) were not handled in testfunction '%s':", list.count(), qWarning("%d accessibility event(s) were not handled in testfunction '%s':", list.count(),
@ -410,14 +403,10 @@ void tst_QAccessibility::cleanup()
eventName(list.at(i).event).toAscii().constData(), list.at(i).event, list.at(i).child); eventName(list.at(i).event).toAscii().constData(), list.at(i).event, list.at(i).child);
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::eventTest() void tst_QAccessibility::eventTest()
{ {
#ifdef QTEST_ACCESSIBILITY
QPushButton* button = new QPushButton(0); QPushButton* button = new QPushButton(0);
button->setObjectName(QString("Olaf")); button->setObjectName(QString("Olaf"));
@ -438,14 +427,10 @@ void tst_QAccessibility::eventTest()
QVERIFY_EVENT(button, 0, QAccessible::ObjectHide); QVERIFY_EVENT(button, 0, QAccessible::ObjectHide);
delete button; delete button;
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::customWidget() void tst_QAccessibility::customWidget()
{ {
#ifdef QTEST_ACCESSIBILITY
QtTestAccessibleWidget* widget = new QtTestAccessibleWidget(0, "Heinz"); QtTestAccessibleWidget* widget = new QtTestAccessibleWidget(0, "Heinz");
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget);
@ -457,14 +442,10 @@ void tst_QAccessibility::customWidget()
delete iface; delete iface;
delete widget; delete widget;
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::deletedWidget() void tst_QAccessibility::deletedWidget()
{ {
#ifdef QTEST_ACCESSIBILITY
QtTestAccessibleWidget *widget = new QtTestAccessibleWidget(0, "Ralf"); QtTestAccessibleWidget *widget = new QtTestAccessibleWidget(0, "Ralf");
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget);
QVERIFY(iface != 0); QVERIFY(iface != 0);
@ -475,9 +456,6 @@ void tst_QAccessibility::deletedWidget()
widget = 0; widget = 0;
QVERIFY(!iface->isValid()); QVERIFY(!iface->isValid());
delete iface; delete iface;
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
QWidget *tst_QAccessibility::createGUI() QWidget *tst_QAccessibility::createGUI()
@ -486,7 +464,6 @@ QWidget *tst_QAccessibility::createGUI()
qWarning( "Should never get here without Qt3Support"); qWarning( "Should never get here without Qt3Support");
return 0; return 0;
#else #else
# ifdef QTEST_ACCESSIBILITY
QWidget *toplevel = new QWidget(0, Qt::X11BypassWindowManagerHint); QWidget *toplevel = new QWidget(0, Qt::X11BypassWindowManagerHint);
QGridLayout *grid = new QGridLayout(toplevel, 2, 2); QGridLayout *grid = new QGridLayout(toplevel, 2, 2);
@ -558,10 +535,6 @@ QWidget *tst_QAccessibility::createGUI()
radioAM->setFocus(); radioAM->setFocus();
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
return toplevel; return toplevel;
# else
Q_ASSERT(0); // this function cannot be called without accessibility support
return 0;
# endif
#endif // !QT3_SUPPORT #endif // !QT3_SUPPORT
} }
@ -570,7 +543,6 @@ void tst_QAccessibility::childAt()
#if !defined(QT3_SUPPORT) #if !defined(QT3_SUPPORT)
QSKIP("This test needs Qt3Support", SkipAll); QSKIP("This test needs Qt3Support", SkipAll);
#else #else
#ifdef QTEST_ACCESSIBILITY
QWidget *toplevel = createGUI(); QWidget *toplevel = createGUI();
QAccessibleInterface *acc_toplevel = QAccessible::queryAccessibleInterface(toplevel); QAccessibleInterface *acc_toplevel = QAccessible::queryAccessibleInterface(toplevel);
QVERIFY(acc_toplevel); QVERIFY(acc_toplevel);
@ -602,9 +574,6 @@ void tst_QAccessibility::childAt()
delete acc_toplevel; delete acc_toplevel;
delete toplevel; delete toplevel;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
#endif // !QT3_SUPPORT #endif // !QT3_SUPPORT
} }
@ -613,7 +582,6 @@ void tst_QAccessibility::childCount()
#if !defined(QT3_SUPPORT) #if !defined(QT3_SUPPORT)
QSKIP("This test needs Qt3Support", SkipAll); QSKIP("This test needs Qt3Support", SkipAll);
#else #else
#ifdef QTEST_ACCESSIBILITY
QWidget *toplevel = createGUI(); QWidget *toplevel = createGUI();
QObject *topLeft = toplevel->child("topLeft"); QObject *topLeft = toplevel->child("topLeft");
QObject *topRight = toplevel->child("topRight"); QObject *topRight = toplevel->child("topRight");
@ -646,9 +614,6 @@ void tst_QAccessibility::childCount()
delete acc_bottomRight; delete acc_bottomRight;
delete toplevel; delete toplevel;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
#endif // !QT3_SUPPORT #endif // !QT3_SUPPORT
} }
@ -657,7 +622,6 @@ void tst_QAccessibility::relationTo()
#if !defined(QT3_SUPPORT) #if !defined(QT3_SUPPORT)
QSKIP("This test needs Qt3Support", SkipAll); QSKIP("This test needs Qt3Support", SkipAll);
#else #else
#ifdef QTEST_ACCESSIBILITY
QWidget *toplevel = createGUI(); QWidget *toplevel = createGUI();
toplevel->resize(400,300); toplevel->resize(400,300);
QObject *topLeft = toplevel->child("topLeft"); QObject *topLeft = toplevel->child("topLeft");
@ -863,15 +827,11 @@ void tst_QAccessibility::relationTo()
delete toplevel; delete toplevel;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
#endif // !QT3_SUPPORT #endif // !QT3_SUPPORT
} }
void tst_QAccessibility::navigateGeometric() void tst_QAccessibility::navigateGeometric()
{ {
#ifdef QTEST_ACCESSIBILITY
{ {
static const int skip = 20; //speed the test up significantly static const int skip = 20; //speed the test up significantly
static const double step = Q_PI / 180; static const double step = Q_PI / 180;
@ -967,14 +927,10 @@ void tst_QAccessibility::navigateGeometric()
delete w; delete w;
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::navigateSlider() void tst_QAccessibility::navigateSlider()
{ {
#ifdef QTEST_ACCESSIBILITY
{ {
QSlider *slider = new QSlider(0); QSlider *slider = new QSlider(0);
slider->setObjectName(QString("Slidy")); slider->setObjectName(QString("Slidy"));
@ -1001,14 +957,10 @@ void tst_QAccessibility::navigateSlider()
delete slider; delete slider;
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::navigateCovered() void tst_QAccessibility::navigateCovered()
{ {
#ifdef QTEST_ACCESSIBILITY
{ {
QWidget *w = new QWidget(0); QWidget *w = new QWidget(0);
w->setObjectName(QString("Harry")); w->setObjectName(QString("Harry"));
@ -1111,14 +1063,10 @@ void tst_QAccessibility::navigateCovered()
delete w; delete w;
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::navigateHierarchy() void tst_QAccessibility::navigateHierarchy()
{ {
#ifdef QTEST_ACCESSIBILITY
{ {
QWidget *w = new QWidget(0); QWidget *w = new QWidget(0);
w->setObjectName(QString("Hans")); w->setObjectName(QString("Hans"));
@ -1214,9 +1162,6 @@ void tst_QAccessibility::navigateHierarchy()
delete w; delete w;
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
#define QSETCOMPARE(thetypename, elements, otherelements) \ #define QSETCOMPARE(thetypename, elements, otherelements) \
@ -1227,7 +1172,6 @@ void tst_QAccessibility::navigateControllers()
#if !defined(QT3_SUPPORT) #if !defined(QT3_SUPPORT)
QSKIP("This test needs Qt3Support", SkipAll); QSKIP("This test needs Qt3Support", SkipAll);
#else #else
#ifdef QTEST_ACCESSIBILITY
{ {
Q3VBox vbox; Q3VBox vbox;
QSlider slider(&vbox); QSlider slider(&vbox);
@ -1310,9 +1254,6 @@ void tst_QAccessibility::navigateControllers()
delete acc_slider; delete acc_slider;
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
#endif // !QT3_SUPPORT #endif // !QT3_SUPPORT
} }
@ -1321,7 +1262,6 @@ void tst_QAccessibility::navigateLabels()
#if !defined(QT3_SUPPORT) #if !defined(QT3_SUPPORT)
QSKIP("This test needs Qt3Support", SkipAll); QSKIP("This test needs Qt3Support", SkipAll);
#else #else
#ifdef QTEST_ACCESSIBILITY
{ {
Q3VBox vbox; Q3VBox vbox;
Q3HBox hbox(&vbox); Q3HBox hbox(&vbox);
@ -1443,9 +1383,6 @@ void tst_QAccessibility::navigateLabels()
delete acc_lineedit3; delete acc_lineedit3;
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
#endif // !QT3_SUPPORT #endif // !QT3_SUPPORT
} }
@ -1497,7 +1434,6 @@ static QWidget *createWidgets()
void tst_QAccessibility::accessibleName() void tst_QAccessibility::accessibleName()
{ {
#ifdef QTEST_ACCESSIBILITY
QWidget *toplevel = createWidgets(); QWidget *toplevel = createWidgets();
toplevel->show(); toplevel->show();
#if defined(Q_WS_X11) #if defined(Q_WS_X11)
@ -1522,9 +1458,6 @@ void tst_QAccessibility::accessibleName()
delete toplevel; delete toplevel;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::text() void tst_QAccessibility::text()
@ -1532,7 +1465,6 @@ void tst_QAccessibility::text()
#if !defined(QT3_SUPPORT) #if !defined(QT3_SUPPORT)
QSKIP("This test needs Qt3Support", SkipAll); QSKIP("This test needs Qt3Support", SkipAll);
#else #else
#ifdef QTEST_ACCESSIBILITY
QWidget *toplevel = createGUI(); QWidget *toplevel = createGUI();
toplevel->show(); toplevel->show();
#if defined(Q_WS_X11) #if defined(Q_WS_X11)
@ -1628,10 +1560,6 @@ void tst_QAccessibility::text()
delete toplevel; delete toplevel;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
#endif // !QT3_SUPPORT #endif // !QT3_SUPPORT
} }
@ -1640,7 +1568,6 @@ void tst_QAccessibility::setText()
#if !defined(QT3_SUPPORT) #if !defined(QT3_SUPPORT)
QSKIP("This test needs Qt3Support", SkipAll); QSKIP("This test needs Qt3Support", SkipAll);
#else #else
#ifdef QTEST_ACCESSIBILITY
QWidget *toplevel = createGUI(); QWidget *toplevel = createGUI();
toplevel->show(); toplevel->show();
QObject *bottomLeft = toplevel->findChild<QObject *>("bottomLeft"); QObject *bottomLeft = toplevel->findChild<QObject *>("bottomLeft");
@ -1664,16 +1591,11 @@ void tst_QAccessibility::setText()
delete acc_lineedit; delete acc_lineedit;
delete toplevel; delete toplevel;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
#endif //QT3_SUPPORT #endif //QT3_SUPPORT
} }
void tst_QAccessibility::hideShowTest() void tst_QAccessibility::hideShowTest()
{ {
#ifdef QTEST_ACCESSIBILITY
QWidget * const window = new QWidget(); QWidget * const window = new QWidget();
QWidget * const child = new QWidget(window); QWidget * const child = new QWidget(window);
@ -1700,14 +1622,10 @@ void tst_QAccessibility::hideShowTest()
delete window; delete window;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::userActionCount() void tst_QAccessibility::userActionCount()
{ {
#ifdef QTEST_ACCESSIBILITY
QWidget widget; QWidget widget;
QAccessibleInterface *test = QAccessible::queryAccessibleInterface(&widget); QAccessibleInterface *test = QAccessible::queryAccessibleInterface(&widget);
@ -1737,14 +1655,10 @@ void tst_QAccessibility::userActionCount()
QCOMPARE(test->userActionCount(1), 0); QCOMPARE(test->userActionCount(1), 0);
QCOMPARE(test->userActionCount(-1), 0); QCOMPARE(test->userActionCount(-1), 0);
delete test; test = 0; delete test; test = 0;
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::actionText() void tst_QAccessibility::actionText()
{ {
#ifdef QTEST_ACCESSIBILITY
QWidget widget; QWidget widget;
widget.show(); widget.show();
@ -1761,19 +1675,11 @@ void tst_QAccessibility::actionText()
QCOMPARE(test->actionText(QAccessible::SetFocus, QAccessible::Name, 0), QString("SetFocus")); QCOMPARE(test->actionText(QAccessible::SetFocus, QAccessible::Name, 0), QString("SetFocus"));
delete test; test = 0; delete test; test = 0;
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::doAction() void tst_QAccessibility::doAction()
{ {
#ifdef QTEST_ACCESSIBILITY
QSKIP("TODO: Implement me", SkipAll); QSKIP("TODO: Implement me", SkipAll);
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::applicationTest() void tst_QAccessibility::applicationTest()
@ -1828,7 +1734,6 @@ public Q_SLOTS:
void tst_QAccessibility::buttonTest() void tst_QAccessibility::buttonTest()
{ {
#ifdef QTEST_ACCESSIBILITY
QWidget window; QWidget window;
window.setLayout(new QVBoxLayout); window.setLayout(new QVBoxLayout);
@ -2017,10 +1922,6 @@ void tst_QAccessibility::buttonTest()
// test->release(); // test->release();
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::sliderTest() void tst_QAccessibility::sliderTest()
@ -2028,7 +1929,6 @@ void tst_QAccessibility::sliderTest()
#if !defined(QT3_SUPPORT) #if !defined(QT3_SUPPORT)
QSKIP("This test needs Qt3Support", SkipAll); QSKIP("This test needs Qt3Support", SkipAll);
#else #else
#ifdef QTEST_ACCESSIBILITY
QAccessibleInterface *test = 0; QAccessibleInterface *test = 0;
Q3VBox vbox; Q3VBox vbox;
QLabel labelHorizontal("Horizontal", &vbox); QLabel labelHorizontal("Horizontal", &vbox);
@ -2057,7 +1957,7 @@ void tst_QAccessibility::sliderTest()
QCOMPARE(test->text(QAccessible::Value, 1), QString()); QCOMPARE(test->text(QAccessible::Value, 1), QString());
QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderHorizontal.value())); QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderHorizontal.value()));
QCOMPARE(test->text(QAccessible::Value, 3), QString()); QCOMPARE(test->text(QAccessible::Value, 3), QString());
// Skip acton tests. // Skip action tests.
#if 0 #if 0
QCOMPARE(test->defaultAction(0), QAccessible::SetFocus); QCOMPARE(test->defaultAction(0), QAccessible::SetFocus);
QCOMPARE(test->defaultAction(1), QAccessible::Press); QCOMPARE(test->defaultAction(1), QAccessible::Press);
@ -2104,7 +2004,7 @@ void tst_QAccessibility::sliderTest()
QCOMPARE(test->text(QAccessible::Value, 1), QString()); QCOMPARE(test->text(QAccessible::Value, 1), QString());
QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderVertical.value())); QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderVertical.value()));
QCOMPARE(test->text(QAccessible::Value, 3), QString()); QCOMPARE(test->text(QAccessible::Value, 3), QString());
// Skip acton tests. // Skip action tests.
#if 0 #if 0
QCOMPARE(test->defaultAction(0), QAccessible::SetFocus); QCOMPARE(test->defaultAction(0), QAccessible::SetFocus);
QCOMPARE(test->defaultAction(1), QAccessible::Press); QCOMPARE(test->defaultAction(1), QAccessible::Press);
@ -2215,17 +2115,12 @@ void tst_QAccessibility::sliderTest()
delete sliderInterface; delete sliderInterface;
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
#endif //!QT3_SUPPORT #endif //!QT3_SUPPORT
} }
void tst_QAccessibility::scrollBarTest() void tst_QAccessibility::scrollBarTest()
{ {
#ifdef QTEST_ACCESSIBILITY
// Test that when we hide() a slider, the PageLeft, Indicator, and PageRight also gets the // Test that when we hide() a slider, the PageLeft, Indicator, and PageRight also gets the
// Invisible state bit set. // Invisible state bit set.
enum SubControls { LineUp = 1, enum SubControls { LineUp = 1,
@ -2233,7 +2128,7 @@ void tst_QAccessibility::scrollBarTest()
Position = 3, Position = 3,
PageDown = 4, PageDown = 4,
LineDown = 5 LineDown = 5
}; };
QScrollBar *scrollBar = new QScrollBar(); QScrollBar *scrollBar = new QScrollBar();
QAccessibleInterface * const scrollBarInterface = QAccessible::queryAccessibleInterface(scrollBar); QAccessibleInterface * const scrollBarInterface = QAccessible::queryAccessibleInterface(scrollBar);
@ -2315,15 +2210,10 @@ void tst_QAccessibility::scrollBarTest()
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::tabTest() void tst_QAccessibility::tabTest()
{ {
#ifdef QTEST_ACCESSIBILITY
QTabBar *tabBar = new QTabBar(); QTabBar *tabBar = new QTabBar();
tabBar->show(); tabBar->show();
@ -2359,9 +2249,6 @@ void tst_QAccessibility::tabTest()
delete tabBar; delete tabBar;
delete interface; delete interface;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::tabWidgetTest() void tst_QAccessibility::tabWidgetTest()
@ -2459,7 +2346,6 @@ void tst_QAccessibility::tabWidgetTest()
void tst_QAccessibility::menuTest() void tst_QAccessibility::menuTest()
{ {
#ifdef QTEST_ACCESSIBILITY
{ {
QMainWindow mw; QMainWindow mw;
mw.resize(300, 200); mw.resize(300, 200);
@ -2705,14 +2591,10 @@ void tst_QAccessibility::menuTest()
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::spinBoxTest() void tst_QAccessibility::spinBoxTest()
{ {
#ifdef QTEST_ACCESSIBILITY
QSpinBox * const spinBox = new QSpinBox(); QSpinBox * const spinBox = new QSpinBox();
spinBox->show(); spinBox->show();
@ -2739,14 +2621,10 @@ void tst_QAccessibility::spinBoxTest()
QVERIFY(events.contains(expectedEvent)); QVERIFY(events.contains(expectedEvent));
delete spinBox; delete spinBox;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::doubleSpinBoxTest() void tst_QAccessibility::doubleSpinBoxTest()
{ {
#ifdef QTEST_ACCESSIBILITY
QDoubleSpinBox *doubleSpinBox = new QDoubleSpinBox; QDoubleSpinBox *doubleSpinBox = new QDoubleSpinBox;
doubleSpinBox->show(); doubleSpinBox->show();
@ -2766,14 +2644,10 @@ void tst_QAccessibility::doubleSpinBoxTest()
delete doubleSpinBox; delete doubleSpinBox;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::textEditTest() void tst_QAccessibility::textEditTest()
{ {
#ifdef QTEST_ACCESSIBILITY
{ {
QTextEdit edit; QTextEdit edit;
QString text = "hello world\nhow are you today?\n"; QString text = "hello world\nhow are you today?\n";
@ -2793,14 +2667,10 @@ void tst_QAccessibility::textEditTest()
QCOMPARE(iface->textInterface()->characterRect(6, QAccessible2::RelativeToParent).size(), QSize(fm.width("w"), fm.height())); QCOMPARE(iface->textInterface()->characterRect(6, QAccessible2::RelativeToParent).size(), QSize(fm.width("w"), fm.height()));
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::textBrowserTest() void tst_QAccessibility::textBrowserTest()
{ {
#ifdef QTEST_ACCESSIBILITY
{ {
QTextBrowser textBrowser; QTextBrowser textBrowser;
QString text = QLatin1String("Hello world\nhow are you today?\n"); QString text = QLatin1String("Hello world\nhow are you today?\n");
@ -2817,14 +2687,10 @@ void tst_QAccessibility::textBrowserTest()
QCOMPARE(interface->text(QAccessible::Value, 6), QString()); QCOMPARE(interface->text(QAccessible::Value, 6), QString());
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::listViewTest() void tst_QAccessibility::listViewTest()
{ {
#if 1 //def QTEST_ACCESSIBILITY
{ {
QListView listView; QListView listView;
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&listView); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&listView);
@ -2890,15 +2756,11 @@ void tst_QAccessibility::listViewTest()
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::mdiAreaTest() void tst_QAccessibility::mdiAreaTest()
{ {
#ifdef QTEST_ACCESSIBILITY
{ {
QMdiArea mdiArea; QMdiArea mdiArea;
mdiArea.resize(400,300); mdiArea.resize(400,300);
@ -2947,14 +2809,10 @@ void tst_QAccessibility::mdiAreaTest()
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::mdiSubWindowTest() void tst_QAccessibility::mdiSubWindowTest()
{ {
#ifdef QTEST_ACCESSIBILITY
{ {
QMdiArea mdiArea; QMdiArea mdiArea;
mdiArea.show(); mdiArea.show();
@ -3077,14 +2935,10 @@ void tst_QAccessibility::mdiSubWindowTest()
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::lineEditTest() void tst_QAccessibility::lineEditTest()
{ {
#ifdef QTEST_ACCESSIBILITY
QLineEdit *le = new QLineEdit; QLineEdit *le = new QLineEdit;
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(le); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(le);
QVERIFY(iface); QVERIFY(iface);
@ -3142,14 +2996,10 @@ void tst_QAccessibility::lineEditTest()
delete le2; delete le2;
delete toplevel; delete toplevel;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::workspaceTest() void tst_QAccessibility::workspaceTest()
{ {
#ifdef QTEST_ACCESSIBILITY
{ {
QWorkspace workspace; QWorkspace workspace;
workspace.resize(400,300); workspace.resize(400,300);
@ -3203,14 +3053,10 @@ void tst_QAccessibility::workspaceTest()
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::dialogButtonBoxTest() void tst_QAccessibility::dialogButtonBoxTest()
{ {
#ifdef QTEST_ACCESSIBILITY
{ {
QDialogButtonBox box(QDialogButtonBox::Reset | QDialogButtonBox box(QDialogButtonBox::Reset |
QDialogButtonBox::Help | QDialogButtonBox::Help |
@ -3323,14 +3169,10 @@ void tst_QAccessibility::dialogButtonBoxTest()
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::dialTest() void tst_QAccessibility::dialTest()
{ {
#ifdef QTEST_ACCESSIBILITY
{ {
QDial dial; QDial dial;
dial.setValue(20); dial.setValue(20);
@ -3372,28 +3214,20 @@ void tst_QAccessibility::dialTest()
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::rubberBandTest() void tst_QAccessibility::rubberBandTest()
{ {
#ifdef QTEST_ACCESSIBILITY
QRubberBand rubberBand(QRubberBand::Rectangle); QRubberBand rubberBand(QRubberBand::Rectangle);
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&rubberBand); QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&rubberBand);
QVERIFY(interface); QVERIFY(interface);
QCOMPARE(interface->role(0), QAccessible::Border); QCOMPARE(interface->role(0), QAccessible::Border);
delete interface; delete interface;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::abstractScrollAreaTest() void tst_QAccessibility::abstractScrollAreaTest()
{ {
#ifdef QTEST_ACCESSIBILITY
{ {
QAbstractScrollArea abstractScrollArea; QAbstractScrollArea abstractScrollArea;
@ -3551,14 +3385,10 @@ void tst_QAccessibility::abstractScrollAreaTest()
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::scrollAreaTest() void tst_QAccessibility::scrollAreaTest()
{ {
#ifdef QTEST_ACCESSIBILITY
{ {
QScrollArea scrollArea; QScrollArea scrollArea;
scrollArea.show(); scrollArea.show();
@ -3572,14 +3402,10 @@ void tst_QAccessibility::scrollAreaTest()
delete interface; delete interface;
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::tableWidgetTest() void tst_QAccessibility::tableWidgetTest()
{ {
#ifdef QTEST_ACCESSIBILITY
{ {
QWidget *topLevel = new QWidget; QWidget *topLevel = new QWidget;
QTableWidget *w = new QTableWidget(8,4,topLevel); QTableWidget *w = new QTableWidget(8,4,topLevel);
@ -3619,10 +3445,6 @@ void tst_QAccessibility::tableWidgetTest()
delete topLevel; delete topLevel;
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
class QtTestTableModel: public QAbstractTableModel class QtTestTableModel: public QAbstractTableModel
@ -3705,7 +3527,6 @@ public:
void tst_QAccessibility::tableViewTest() void tst_QAccessibility::tableViewTest()
{ {
#ifdef QTEST_ACCESSIBILITY
{ {
QtTestTableModel *model = new QtTestTableModel(3, 4); QtTestTableModel *model = new QtTestTableModel(3, 4);
QTableView *w = new QTableView(); QTableView *w = new QTableView();
@ -3785,15 +3606,11 @@ void tst_QAccessibility::tableViewTest()
delete model; delete model;
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::calendarWidgetTest() void tst_QAccessibility::calendarWidgetTest()
{ {
#ifndef QT_NO_CALENDARWIDGET #ifndef QT_NO_CALENDARWIDGET
#ifdef QTEST_ACCESSIBILITY
{ {
QCalendarWidget calendarWidget; QCalendarWidget calendarWidget;
@ -3886,17 +3703,12 @@ void tst_QAccessibility::calendarWidgetTest()
} }
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
#endif // QT_NO_CALENDARWIDGET #endif // QT_NO_CALENDARWIDGET
} }
void tst_QAccessibility::dockWidgetTest() void tst_QAccessibility::dockWidgetTest()
{ {
#ifndef QT_NO_DOCKWIDGET #ifndef QT_NO_DOCKWIDGET
#ifdef QTEST_ACCESSIBILITY
// Set up a proper main window with two dock widgets // Set up a proper main window with two dock widgets
QMainWindow *mw = new QMainWindow(); QMainWindow *mw = new QMainWindow();
QFrame *central = new QFrame(mw); QFrame *central = new QFrame(mw);
@ -3964,19 +3776,14 @@ void tst_QAccessibility::dockWidgetTest()
delete dock2; delete dock2;
delete mw; delete mw;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
#endif // QT_NO_DOCKWIDGET #endif // QT_NO_DOCKWIDGET
} }
void tst_QAccessibility::pushButtonTest() void tst_QAccessibility::pushButtonTest()
{ {
#if !defined(QT3_SUPPORT) #if !defined(QT3_SUPPORT)
qWarning( "Should never get here without Qt3Support"); QSKIP( "Should never get here without Qt3Support", SkipAll);
return ;
#else #else
#ifdef QTEST_ACCESSIBILITY
// Set up a proper main window with two dock widgets // Set up a proper main window with two dock widgets
QWidget *toplevel = createGUI(); QWidget *toplevel = createGUI();
QObject *topRight = toplevel->findChild<QObject *>("topRight"); QObject *topRight = toplevel->findChild<QObject *>("topRight");
@ -4010,15 +3817,11 @@ void tst_QAccessibility::pushButtonTest()
delete accToplevel; delete accToplevel;
delete toplevel; delete toplevel;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
#endif //QT3_SUPPORT #endif //QT3_SUPPORT
} }
void tst_QAccessibility::comboBoxTest() void tst_QAccessibility::comboBoxTest()
{ {
#ifdef QTEST_ACCESSIBILITY
#if defined(Q_OS_WINCE) #if defined(Q_OS_WINCE)
if (!IsValidCEPlatform()) { if (!IsValidCEPlatform()) {
QSKIP("Test skipped on Windows Mobile test hardware", SkipAll); QSKIP("Test skipped on Windows Mobile test hardware", SkipAll);
@ -4056,15 +3859,10 @@ void tst_QAccessibility::comboBoxTest()
delete w; delete w;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::treeWidgetTest() void tst_QAccessibility::treeWidgetTest()
{ {
#ifdef QTEST_ACCESSIBILITY
QWidget *w = new QWidget; QWidget *w = new QWidget;
QTreeWidget *tree = new QTreeWidget(w); QTreeWidget *tree = new QTreeWidget(w);
QHBoxLayout *l = new QHBoxLayout(w); QHBoxLayout *l = new QHBoxLayout(w);
@ -4122,14 +3920,10 @@ void tst_QAccessibility::treeWidgetTest()
delete w; delete w;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::labelTest() void tst_QAccessibility::labelTest()
{ {
#ifdef QTEST_ACCESSIBILITY
QString text = "Hello World"; QString text = "Hello World";
QLabel *label = new QLabel(text); QLabel *label = new QLabel(text);
label->show(); label->show();
@ -4168,14 +3962,10 @@ void tst_QAccessibility::labelTest()
delete acc_label; delete acc_label;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs accessibility support.", SkipAll);
#endif
} }
void tst_QAccessibility::accelerators() void tst_QAccessibility::accelerators()
{ {
#ifdef QTEST_ACCESSIBILITY
QWidget *window = new QWidget; QWidget *window = new QWidget;
QHBoxLayout *lay = new QHBoxLayout(window); QHBoxLayout *lay = new QHBoxLayout(window);
QLabel *label = new QLabel(tr("&Line edit"), window); QLabel *label = new QLabel(tr("&Line edit"), window);
@ -4208,9 +3998,6 @@ void tst_QAccessibility::accelerators()
QTest::qWait(100); QTest::qWait(100);
delete window; delete window;
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
#else
QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll);
#endif
} }