summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-05-17 13:46:26 +1000
committerJason McDonald <jason.mcdonald@nokia.com>2011-05-19 13:59:04 +1000
commit4a52cc3ac0f765d8b31364d4827b3cd55711b73b (patch)
tree3cf358f73e62df38c5199bec5b0ee0fb6b5e6cbc /tests
parentb0a5a988900b777cb08012408eb108512a3e873b (diff)
Remove Qt3Support test code from accessibility autotest
Change-Id: Id31836ea52da71b40c0bcbb67d9beffc70b90400 Task-number: QTBUG-19325 Reviewed-by: Rohan McGovern
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qaccessibility/tst_qaccessibility.cpp1007
1 files changed, 0 insertions, 1007 deletions
diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp
index dcd6286b07..9110bd717d 100644
--- a/tests/auto/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp
@@ -40,9 +40,6 @@
****************************************************************************/
-#ifdef QT3_SUPPORT
-#include <Qt3Support/Qt3Support>
-#endif
#include <QtTest/QtTest>
#ifndef Q_OS_WINCE
#include "../../shared/util.h"
@@ -228,17 +225,10 @@ private slots:
void customWidget();
void deletedWidget();
- void childCount();
- void childAt(); // also indexOfChild
- void relationTo();
void navigateGeometric();
void navigateHierarchy();
void navigateSlider();
void navigateCovered();
- void navigateControllers();
- void navigateLabels();
- void text();
- void setText();
void hideShowTest();
void userActionCount();
@@ -248,7 +238,6 @@ private slots:
void applicationTest();
void mainWindowTest();
void buttonTest();
- void sliderTest();
void scrollBarTest();
void tabTest();
void tabWidgetTest();
@@ -271,15 +260,11 @@ private slots:
void tableViewTest();
void calendarWidgetTest();
void dockWidgetTest();
- void pushButtonTest();
void comboBoxTest();
void accessibleName();
void treeWidgetTest();
void labelTest();
void accelerators();
-
-private:
- QWidget *createGUI();
};
const double Q_PI = 3.14159265358979323846;
@@ -458,378 +443,6 @@ void tst_QAccessibility::deletedWidget()
delete iface;
}
-QWidget *tst_QAccessibility::createGUI()
-{
-#if !defined(QT3_SUPPORT)
- qWarning( "Should never get here without Qt3Support");
- return 0;
-#else
- QWidget *toplevel = new QWidget(0, Qt::X11BypassWindowManagerHint);
- QGridLayout *grid = new QGridLayout(toplevel, 2, 2);
-
- // topLeft - hierarchies
- Q3VBox *topLeft = new Q3VBox(toplevel, "topLeft");
- topLeft->setSpacing(2);
- grid->addWidget(topLeft, 0, 0);
-
- Q3VButtonGroup *group1 = new Q3VButtonGroup("Title1:", topLeft, "group1");
- /*QPushButton *pb1 = */ new QPushButton("Button&1", group1, "pb1");
- Q3VButtonGroup *group2 = new Q3VButtonGroup("Title2:", topLeft, "group2");
- /*QPushButton *pb2 = */ new QPushButton("Button2", group2, "pb2");
-
- Q3WidgetStack *stack = new Q3WidgetStack(topLeft, "stack");
- QLabel *page1 = new QLabel("Page 1", stack, "page1");
- stack->addWidget(page1);
- QLabel *page2 = new QLabel("Page 2", stack, "page2");
- stack->addWidget(page2);
- QLabel *page3 = new QLabel("Page 3", stack, "page3");
- stack->addWidget(page3);
-
- // topRight - controlling
- Q3VBox *topRight= new Q3VBox(toplevel, "topRight");
- grid->addWidget(topRight, 0, 1);
-
- QPushButton *pbOk = new QPushButton("Ok", topRight, "pbOk" );
- pbOk->setDefault(TRUE);
- QSlider *slider = new QSlider(Qt::Horizontal, topRight, "slider");
- QLCDNumber *sliderLcd = new QLCDNumber(topRight, "sliderLcd");
- QSpinBox *spinBox = new QSpinBox(topRight, "spinBox");
-
- connect(pbOk, SIGNAL(clicked()), toplevel, SLOT(close()) );
- connect(slider, SIGNAL(valueChanged(int)), sliderLcd, SLOT(display(int)));
- connect(spinBox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
-
- spinBox->setValue(50);
-
- // bottomLeft - labeling and controlling
- Q3HBox *bottomLeft = new Q3HBox(toplevel, "bottomLeft");
- grid->addWidget(bottomLeft, 1, 0);
-
- QLabel *label = new QLabel("This is a &lineedit:", bottomLeft, "label");
- QLineEdit *lineedit = new QLineEdit(bottomLeft, "lineedit");
- label->setBuddy(lineedit);
- QLabel *label2 = new QLabel(bottomLeft, "label2");
-
- connect(lineedit, SIGNAL(textChanged(const QString&)), label2, SLOT(setText(const QString&)));
-
- Q3VButtonGroup *radiogroup = new Q3VButtonGroup("Exclusive &choices:", bottomLeft, "radiogroup");
- QLineEdit *frequency = new QLineEdit(radiogroup, "frequency");
- frequency->setText("100 Mhz");
- QRadioButton *radioAM = new QRadioButton("&AM", radiogroup, "radioAM");
- /* QRadioButton *radioFM = */ new QRadioButton("&FM", radiogroup, "radioFM");
- /* QRadioButton *radioSW = */ new QRadioButton("&Shortwave", radiogroup, "radioSW");
-
- // bottomRight - ### empty
- Q3HBox *bottomRight = new Q3HBox(toplevel, "bottomRight");
- grid->addWidget(bottomRight, 1, 1);
-
- toplevel->adjustSize(); // sends layout and child events
-
- // some tooltips
- QToolTip::add(label, "A label");
- QToolTip::add(lineedit, "A line edit");
- // some whatsthis
- QWhatsThis::add(label, "A label displays static text");
- QWhatsThis::add(frequency, "You can enter a single line of text here");
-
- radioAM->setFocus();
- QTestAccessibility::clearEvents();
- return toplevel;
-#endif // !QT3_SUPPORT
-}
-
-void tst_QAccessibility::childAt()
-{
-#if !defined(QT3_SUPPORT)
- QSKIP("This test needs Qt3Support", SkipAll);
-#else
- QWidget *toplevel = createGUI();
- QAccessibleInterface *acc_toplevel = QAccessible::queryAccessibleInterface(toplevel);
- QVERIFY(acc_toplevel);
- // this is necessary to have the layout setup correctly
- toplevel->show();
-
- QObjectList children = toplevel->queryList("QWidget", 0, 0, 0);
- for (int c = 1; c <= children.count(); ++c) {
- QWidget *child = qobject_cast<QWidget*>(children.at(c-1));
- QAccessibleInterface *acc_child = QAccessible::queryAccessibleInterface(child);
- QVERIFY(acc_child);
- QCOMPARE(acc_child->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask, QAccessible::Child);
-
- QPoint center(child->mapToGlobal(child->rect().center()));
- QRect childRect(child->geometry());
- childRect.moveCenter(center);
-
- QCOMPARE(acc_child->rect(0), childRect);
- QCOMPARE(acc_toplevel->childAt(childRect.center().x(), childRect.center().y()), c);
- QCOMPARE(acc_toplevel->childAt(childRect.left(), childRect.top()), c);
- QCOMPARE(acc_toplevel->childAt(childRect.left(), childRect.bottom()), c);
- QCOMPARE(acc_toplevel->childAt(childRect.right(), childRect.top()), c);
- QCOMPARE(acc_toplevel->childAt(childRect.right(), childRect.bottom()), c);
-
- QCOMPARE(acc_toplevel->indexOfChild(acc_child), c);
- delete acc_child;
- }
-
- delete acc_toplevel;
- delete toplevel;
- QTestAccessibility::clearEvents();
-#endif // !QT3_SUPPORT
-}
-
-void tst_QAccessibility::childCount()
-{
-#if !defined(QT3_SUPPORT)
- QSKIP("This test needs Qt3Support", SkipAll);
-#else
- QWidget *toplevel = createGUI();
- QObject *topLeft = toplevel->child("topLeft");
- QObject *topRight = toplevel->child("topRight");
- QObject *bottomLeft = toplevel->child("bottomLeft");
- QObject *bottomRight = toplevel->child("bottomRight");
-
- QAccessibleInterface* acc_toplevel = QAccessible::queryAccessibleInterface(toplevel);
- QAccessibleInterface* acc_topLeft = QAccessible::queryAccessibleInterface(topLeft);
- QAccessibleInterface* acc_topRight = QAccessible::queryAccessibleInterface(topRight);
- QAccessibleInterface* acc_bottomLeft = QAccessible::queryAccessibleInterface(bottomLeft);
- QAccessibleInterface* acc_bottomRight = QAccessible::queryAccessibleInterface(bottomRight);
-
- QVERIFY(acc_toplevel);
- QVERIFY(acc_topLeft);
- QVERIFY(acc_topRight);
- QVERIFY(acc_bottomLeft);
- QVERIFY(acc_bottomRight);
-
- toplevel->show();
- QCOMPARE(acc_toplevel->childCount(), toplevel->queryList("QWidget", 0, 0, 0).count());
- QCOMPARE(acc_topLeft->childCount(), topLeft->queryList("QWidget", 0, 0, 0).count());
- QCOMPARE(acc_topRight->childCount(), topRight->queryList("QWidget", 0, 0, 0).count());
- QCOMPARE(acc_bottomLeft->childCount(), bottomLeft->queryList("QWidget", 0, 0, 0).count());
- QCOMPARE(acc_bottomRight->childCount(), bottomRight->queryList("QWidget", 0, 0, 0).count());
-
- delete acc_toplevel;
- delete acc_topLeft;
- delete acc_topRight;
- delete acc_bottomLeft;
- delete acc_bottomRight;
- delete toplevel;
- QTestAccessibility::clearEvents();
-#endif // !QT3_SUPPORT
-}
-
-void tst_QAccessibility::relationTo()
-{
-#if !defined(QT3_SUPPORT)
- QSKIP("This test needs Qt3Support", SkipAll);
-#else
- QWidget *toplevel = createGUI();
- toplevel->resize(400,300);
- QObject *topLeft = toplevel->child("topLeft");
- QObject *topRight = toplevel->child("topRight");
- QObject *bottomLeft = toplevel->child("bottomLeft");
- QObject *bottomRight = toplevel->child("bottomRight");
-
- toplevel->show();
-
- QAccessibleInterface *acc_toplevel = QAccessible::queryAccessibleInterface(toplevel);
-
- QAccessibleInterface *acc_topLeft = QAccessible::queryAccessibleInterface(topLeft);
- QAccessibleInterface *acc_group1 = QAccessible::queryAccessibleInterface(topLeft->child("group1"));
- QVERIFY(topLeft->child("group1"));
- QAccessibleInterface *acc_pb1 = QAccessible::queryAccessibleInterface(topLeft->child("group1")->child("pb1"));
- QAccessibleInterface *acc_group2 = QAccessible::queryAccessibleInterface(topLeft->child("group2"));
- QAccessibleInterface *acc_pb2 = 0;
- QAccessibleInterface *acc_stack = QAccessible::queryAccessibleInterface(topLeft->child("stack"));
- QAccessibleInterface *acc_page1 = QAccessible::queryAccessibleInterface(topLeft->child("stack")->child("page1"));
- QAccessibleInterface *acc_page2 = QAccessible::queryAccessibleInterface(topLeft->child("stack")->child("page2"));
- QAccessibleInterface *acc_page3 = QAccessible::queryAccessibleInterface(topLeft->child("stack")->child("page3"));
- QAccessibleInterface *acc_topRight = QAccessible::queryAccessibleInterface(topRight);
- QAccessibleInterface *acc_pbOk = QAccessible::queryAccessibleInterface(topRight->child("pbOk"));
- QAccessibleInterface *acc_slider = QAccessible::queryAccessibleInterface(topRight->child("slider"));
- QAccessibleInterface *acc_spinBox = QAccessible::queryAccessibleInterface(topRight->child("spinBox"));
- QAccessibleInterface *acc_sliderLcd = QAccessible::queryAccessibleInterface(topRight->child("sliderLcd"));
-
- QAccessibleInterface *acc_bottomLeft = QAccessible::queryAccessibleInterface(bottomLeft);
- QAccessibleInterface *acc_label = QAccessible::queryAccessibleInterface(bottomLeft->child("label"));
- QAccessibleInterface *acc_lineedit = QAccessible::queryAccessibleInterface(bottomLeft->child("lineedit"));
- QAccessibleInterface *acc_label2 = QAccessible::queryAccessibleInterface(bottomLeft->child("label2"));
- QAccessibleInterface *acc_radiogroup = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup"));
- QAccessibleInterface *acc_radioAM = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup")->child("radioAM"));
- QAccessibleInterface *acc_radioFM = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup")->child("radioFM"));
- QAccessibleInterface *acc_radioSW = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup")->child("radioSW"));
- QAccessibleInterface *acc_frequency = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup")->child("frequency"));
-
- QAccessibleInterface *acc_bottomRight = QAccessible::queryAccessibleInterface(bottomRight);
-
- QVERIFY(acc_toplevel);
- QVERIFY(acc_topLeft);
- QVERIFY(acc_topRight);
- QVERIFY(acc_bottomLeft);
- QVERIFY(acc_bottomRight);
- QVERIFY(acc_group1);
- QVERIFY(acc_group2);
- QVERIFY(acc_stack);
- QVERIFY(acc_page1);
- QVERIFY(acc_page2);
- QVERIFY(acc_page3);
- QVERIFY(acc_pbOk);
- QVERIFY(acc_slider);
- QVERIFY(acc_spinBox);
- QVERIFY(acc_sliderLcd);
- QVERIFY(acc_label);
- QVERIFY(acc_lineedit);
- QVERIFY(acc_radiogroup);
- QVERIFY(acc_radioAM);
- QVERIFY(acc_radioFM);
- QVERIFY(acc_radioSW);
- QVERIFY(acc_frequency);
-
- // hierachy relations
- QCOMPARE(acc_toplevel->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask,
- QAccessible::Self);
- QCOMPARE(acc_toplevel->relationTo(1, acc_toplevel, 0) & QAccessible::HierarchyMask,
- QAccessible::Child);
- QCOMPARE(acc_toplevel->relationTo(0, acc_toplevel, 1) & QAccessible::HierarchyMask,
- QAccessible::Ancestor);
-
- QCOMPARE(acc_toplevel->relationTo(0, acc_topLeft, 0) & QAccessible::HierarchyMask,
- QAccessible::Ancestor);
- QCOMPARE(acc_toplevel->relationTo(0, acc_topRight, 0) & QAccessible::HierarchyMask,
- QAccessible::Ancestor);
- QCOMPARE(acc_toplevel->relationTo(0, acc_bottomLeft, 0) & QAccessible::HierarchyMask,
- QAccessible::Ancestor);
- QCOMPARE(acc_toplevel->relationTo(0, acc_bottomRight, 0) & QAccessible::HierarchyMask,
- QAccessible::Ancestor);
-
- QCOMPARE(acc_toplevel->relationTo(0, acc_group1, 0) & QAccessible::HierarchyMask,
- QAccessible::Ancestor);
- QCOMPARE(acc_toplevel->relationTo(0, acc_page1, 0) & QAccessible::HierarchyMask,
- QAccessible::Ancestor);
- QCOMPARE(acc_group1->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask,
- QAccessible::Descendent);
- QCOMPARE(acc_stack->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask,
- QAccessible::Descendent);
- QCOMPARE(acc_page1->relationTo(0, acc_stack, 0) & QAccessible::HierarchyMask,
- QAccessible::Child);
- QCOMPARE(acc_page1->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask,
- QAccessible::Descendent);
-
- QCOMPARE(acc_topLeft->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask,
- QAccessible::Child);
- QCOMPARE(acc_topRight->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask,
- QAccessible::Child);
- QCOMPARE(acc_bottomLeft->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask,
- QAccessible::Child);
- QCOMPARE(acc_bottomRight->relationTo(0, acc_toplevel, 0) & QAccessible::HierarchyMask,
- QAccessible::Child);
-
- QCOMPARE(acc_topLeft->relationTo(0, acc_topRight, 0) & QAccessible::HierarchyMask,
- QAccessible::Sibling);
- QCOMPARE(acc_topLeft->relationTo(0, acc_bottomLeft, 0) & QAccessible::HierarchyMask,
- QAccessible::Sibling);
- QCOMPARE(acc_topLeft->relationTo(0, acc_bottomRight, 0) & QAccessible::HierarchyMask,
- QAccessible::Sibling);
-
- QCOMPARE(acc_pb1->relationTo(0, acc_pb2, 0), QAccessible::Unrelated);
-
- // geometrical relations - only valid for siblings
- QCOMPARE(acc_topLeft->relationTo(0, acc_topRight, 0), QAccessible::Sibling | QAccessible::Left);
- QCOMPARE(acc_topLeft->relationTo(0, acc_bottomLeft, 0), QAccessible::Sibling | QAccessible::Up);
- QCOMPARE(acc_topLeft->relationTo(0, acc_bottomRight, 0), QAccessible::Sibling | QAccessible::Left | QAccessible::Up);
-
- QCOMPARE(acc_bottomRight->relationTo(0, acc_topLeft, 0), QAccessible::Sibling | QAccessible::Right | QAccessible::Down);
- QCOMPARE(acc_bottomRight->relationTo(0, acc_topRight, 0), QAccessible::Sibling | QAccessible::Down);
- QCOMPARE(acc_bottomRight->relationTo(0, acc_bottomLeft, 0), QAccessible::Sibling | QAccessible::Right);
-#ifdef Q_WS_MAC
- QEXPECT_FAIL("", "Task 155501", Continue);
-#endif
- QCOMPARE(acc_group1->relationTo(0, acc_group2, 0), QAccessible::Sibling | QAccessible::Up);
-#ifdef Q_WS_MAC
- QEXPECT_FAIL("", "Task 155501", Continue);
-#endif
- QCOMPARE(acc_group2->relationTo(0, acc_group1, 0), QAccessible::Sibling | QAccessible::Down);
-
- // Covers/Covered tested in navigateCovered
-
- // logical relations - focus
- QCOMPARE(acc_radioAM->relationTo(0, acc_radioFM, 0) & QAccessible::FocusChild,
- QAccessible::Unrelated);
- QCOMPARE(acc_radioAM->relationTo(0, acc_radiogroup, 0) & QAccessible::FocusChild,
- QAccessible::FocusChild);
- QCOMPARE(acc_radioAM->relationTo(0, acc_bottomLeft, 0) & QAccessible::FocusChild,
- QAccessible::FocusChild);
- QCOMPARE(acc_radioAM->relationTo(0, acc_topLeft, 0) & QAccessible::FocusChild,
- QAccessible::Unrelated);
- QCOMPARE(acc_radioAM->relationTo(0, acc_toplevel, 0) & QAccessible::FocusChild,
- QAccessible::FocusChild);
-
- // logical relations - labels
- QCOMPARE(acc_label->relationTo(0, acc_lineedit, 0) & QAccessible::LogicalMask,
- QAccessible::Label);
- QCOMPARE(acc_lineedit->relationTo(0, acc_label, 0) & QAccessible::LogicalMask,
- QAccessible::Labelled);
- QCOMPARE(acc_label->relationTo(0, acc_radiogroup, 0) & QAccessible::LogicalMask,
- QAccessible::Unrelated);
- QCOMPARE(acc_lineedit->relationTo(0, acc_lineedit, 0) & QAccessible::LogicalMask,
- QAccessible::Unrelated);
-
- QEXPECT_FAIL("", "Make me accessible", Continue);
- QCOMPARE(acc_radiogroup->relationTo(0, acc_radioAM, 0) & QAccessible::LogicalMask,
- QAccessible::Label | QAccessible::Controlled);
- QEXPECT_FAIL("", "Make me accessible", Continue);
- QCOMPARE(acc_radiogroup->relationTo(0, acc_radioFM, 0) & QAccessible::LogicalMask,
- QAccessible::Label | QAccessible::Controlled);
- QEXPECT_FAIL("", "Make me accessible", Continue);
- QCOMPARE(acc_radiogroup->relationTo(0, acc_radioSW, 0) & QAccessible::LogicalMask,
- QAccessible::Label | QAccessible::Controlled);
- QCOMPARE(acc_radiogroup->relationTo(0, acc_frequency, 0) & QAccessible::LogicalMask,
- QAccessible::Label);
- QCOMPARE(acc_frequency->relationTo(0, acc_radiogroup, 0) & QAccessible::LogicalMask,
- QAccessible::Labelled);
- QCOMPARE(acc_radiogroup->relationTo(0, acc_lineedit, 0) & QAccessible::LogicalMask,
- QAccessible::Unrelated);
-
- // logical relations - controller
- QCOMPARE(acc_pbOk->relationTo(0, acc_toplevel, 0) & QAccessible::LogicalMask,
- QAccessible::Controller);
- QCOMPARE(acc_slider->relationTo(0, acc_sliderLcd, 0) & QAccessible::LogicalMask,
- QAccessible::Controller);
- QCOMPARE(acc_spinBox->relationTo(0, acc_slider, 0) & QAccessible::LogicalMask,
- QAccessible::Controller);
- QCOMPARE(acc_lineedit->relationTo(0, acc_label2, 0) & QAccessible::LogicalMask,
- QAccessible::Controller);
-
- delete acc_toplevel;
- delete acc_topLeft;
- delete acc_group1;
- delete acc_pb1;
- delete acc_group2;
- delete acc_stack;
- delete acc_page1;
- delete acc_page2;
- delete acc_page3;
- delete acc_topRight;
- delete acc_pbOk;
- delete acc_slider;
- delete acc_spinBox;
- delete acc_sliderLcd;
- delete acc_bottomLeft;
- delete acc_label;
- delete acc_lineedit;
- delete acc_label2;
- delete acc_radiogroup;
- delete acc_radioAM;
- delete acc_radioFM;
- delete acc_radioSW;
- delete acc_frequency;
- delete acc_bottomRight;
-
- delete toplevel;
-
- QTestAccessibility::clearEvents();
-#endif // !QT3_SUPPORT
-}
-
void tst_QAccessibility::navigateGeometric()
{
{
@@ -1167,225 +780,6 @@ void tst_QAccessibility::navigateHierarchy()
#define QSETCOMPARE(thetypename, elements, otherelements) \
QCOMPARE((QSet<thetypename>() << elements), (QSet<thetypename>() << otherelements))
-void tst_QAccessibility::navigateControllers()
-{
-#if !defined(QT3_SUPPORT)
- QSKIP("This test needs Qt3Support", SkipAll);
-#else
- {
- Q3VBox vbox;
- QSlider slider(&vbox);
- QSpinBox spinBox(&vbox);
- QLCDNumber lcd1(&vbox);
- QLCDNumber lcd2(&vbox);
- QLabel label(&vbox);
- vbox.show();
-
- slider.setObjectName("slider");
- spinBox.setObjectName("spinBox");
- lcd1.setObjectName("lcd1");
- lcd2.setObjectName("lcd2");
- label.setObjectName("label");
-
- QTestAccessibility::clearEvents();
-
- connect(&slider, SIGNAL(valueChanged(int)), &lcd1, SLOT(display(int)));
- connect(&slider, SIGNAL(valueChanged(int)), &lcd2, SLOT(display(int)));
- connect(&spinBox, SIGNAL(valueChanged(int)), &lcd2, SLOT(display(int)));
- connect(&spinBox, SIGNAL(valueChanged(int)), &lcd1, SLOT(display(int)));
- connect(&spinBox, SIGNAL(valueChanged(const QString&)), &label, SLOT(setText(const QString&)));
-
- QAccessibleInterface *acc_slider = QAccessible::queryAccessibleInterface(&slider);
- QAccessibleInterface *acc_spinBox = QAccessible::queryAccessibleInterface(&spinBox);
- QAccessibleInterface *acc_lcd1 = QAccessible::queryAccessibleInterface(&lcd1);
- QAccessibleInterface *acc_lcd2 = QAccessible::queryAccessibleInterface(&lcd2);
- QAccessibleInterface *acc_label = QAccessible::queryAccessibleInterface(&label);
-
- QVERIFY(acc_slider->relationTo(0, acc_lcd1, 0) & QAccessible::Controller);
- QVERIFY(acc_slider->relationTo(0, acc_lcd2, 0) & QAccessible::Controller);
- QVERIFY(acc_spinBox->relationTo(0, acc_lcd1, 0) & QAccessible::Controller);
- QVERIFY(acc_spinBox->relationTo(0, acc_lcd2, 0) & QAccessible::Controller);
- QVERIFY(acc_spinBox->relationTo(0, acc_label, 0) & QAccessible::Controller);
-
- QAccessibleInterface *acc_target1, *acc_target2, *acc_target3;
- // from controller
- QCOMPARE(acc_slider->navigate(QAccessible::Controlled, 0, &acc_target1), -1);
- QVERIFY(!acc_target1);
- QCOMPARE(acc_slider->navigate(QAccessible::Controlled, 1, &acc_target1), 0);
- QCOMPARE(acc_slider->navigate(QAccessible::Controlled, 2, &acc_target2), 0);
- QSETCOMPARE(QObject*, acc_lcd1->object() << acc_lcd2->object(),
- acc_target1->object() << acc_target2->object());
- delete acc_target1;
- delete acc_target2;
-
- QCOMPARE(acc_slider->navigate(QAccessible::Controlled, 3, &acc_target1), -1);
- QVERIFY(!acc_target1);
-
- QCOMPARE(acc_spinBox->navigate(QAccessible::Controlled, 0, &acc_target1), -1);
- QVERIFY(!acc_target1);
- QCOMPARE(acc_spinBox->navigate(QAccessible::Controlled, 1, &acc_target1), 0);
- QCOMPARE(acc_spinBox->navigate(QAccessible::Controlled, 2, &acc_target2), 0);
- QCOMPARE(acc_spinBox->navigate(QAccessible::Controlled, 3, &acc_target3), 0);
- QSETCOMPARE(QObject*, acc_lcd1->object() << acc_lcd2->object() << acc_label->object(),
- acc_target1->object() << acc_target2->object() << acc_target3->object());
- delete acc_target1;
- delete acc_target2;
- delete acc_target3;
-
- QCOMPARE(acc_spinBox->navigate(QAccessible::Controlled, 4, &acc_target1), -1);
- QVERIFY(!acc_target1);
-
- // to controller
- QCOMPARE(acc_lcd1->navigate(QAccessible::Controller, 0, &acc_target1), -1);
- QVERIFY(!acc_target1);
- QCOMPARE(acc_lcd1->navigate(QAccessible::Controller, 1, &acc_target1), 0);
- QCOMPARE(acc_lcd1->navigate(QAccessible::Controller, 2, &acc_target2), 0);
- QSETCOMPARE(QObject*, acc_slider->object() << acc_spinBox->object(),
- acc_target1->object() << acc_target2->object());
- delete acc_target1;
- delete acc_target2;
- QCOMPARE(acc_lcd1->navigate(QAccessible::Controller, 3, &acc_target1), -1);
- QVERIFY(!acc_target1);
-
- delete acc_label;
- delete acc_lcd2;
- delete acc_lcd1;
- delete acc_spinBox;
- delete acc_slider;
- }
- QTestAccessibility::clearEvents();
-#endif // !QT3_SUPPORT
-}
-
-void tst_QAccessibility::navigateLabels()
-{
-#if !defined(QT3_SUPPORT)
- QSKIP("This test needs Qt3Support", SkipAll);
-#else
- {
- Q3VBox vbox;
- Q3HBox hbox(&vbox);
-
- QLabel label(&hbox);
- label.setText("This is a lineedit:");
- QLineEdit lineedit(&hbox);
- label.setBuddy(&lineedit);
-
- Q3VButtonGroup groupbox(&vbox);
- groupbox.setTitle("Be my children!");
- QRadioButton radio(&groupbox);
- QLabel label2(&groupbox);
- label2.setText("Another lineedit:");
- QLineEdit lineedit2(&groupbox);
- label2.setBuddy(&lineedit2);
- Q3GroupBox groupbox2(&groupbox);
- groupbox2.setTitle("Some grand-children");
- QLineEdit grandchild(&groupbox2);
-
- Q3GroupBox border(&vbox);
- QLineEdit lineedit3(&border);
- vbox.show();
- QTestAccessibility::clearEvents();
-
- QAccessibleInterface *acc_label = QAccessible::queryAccessibleInterface(&label);
- QAccessibleInterface *acc_lineedit = QAccessible::queryAccessibleInterface(&lineedit);
- QAccessibleInterface *acc_groupbox = QAccessible::queryAccessibleInterface(&groupbox);
- QAccessibleInterface *acc_radio = QAccessible::queryAccessibleInterface(&radio);
- QAccessibleInterface *acc_label2 = QAccessible::queryAccessibleInterface(&label2);
- QAccessibleInterface *acc_lineedit2 = QAccessible::queryAccessibleInterface(&lineedit2);
- QAccessibleInterface *acc_groupbox2 = QAccessible::queryAccessibleInterface(&groupbox2);
- QAccessibleInterface *acc_grandchild = QAccessible::queryAccessibleInterface(&grandchild);
- QAccessibleInterface *acc_border = QAccessible::queryAccessibleInterface(&border);
- QAccessibleInterface *acc_lineedit3 = QAccessible::queryAccessibleInterface(&lineedit3);
-
- QVERIFY(acc_label->relationTo(0, acc_lineedit,0) & QAccessible::Label);
- QVERIFY(acc_groupbox->relationTo(0, acc_radio,0) & QAccessible::Label);
- QVERIFY(acc_groupbox->relationTo(0, acc_lineedit2,0) & QAccessible::Label);
- QVERIFY(acc_groupbox->relationTo(0, acc_groupbox2,0) & QAccessible::Label);
- QVERIFY(acc_groupbox2->relationTo(0, acc_grandchild,0) & QAccessible::Label);
- QVERIFY(!(acc_border->relationTo(0, acc_lineedit3,0) & QAccessible::Label));
-
- QAccessibleInterface *acc_target;
- // from label
- QCOMPARE(acc_label->navigate(QAccessible::Labelled, 0, &acc_target), -1);
- QVERIFY(!acc_target);
- QCOMPARE(acc_label->navigate(QAccessible::Labelled, 1, &acc_target), 0);
- QVERIFY(acc_target->object() == acc_lineedit->object());
- delete acc_target; acc_target = 0;
- QCOMPARE(acc_label->navigate(QAccessible::Labelled, 2, &acc_target), -1);
- QVERIFY(!acc_target);
-
- QCOMPARE(acc_groupbox->navigate(QAccessible::Labelled, 0, &acc_target), -1);
- QVERIFY(!acc_target);
- QCOMPARE(acc_groupbox->navigate(QAccessible::Labelled, 1, &acc_target), 0);
- QVERIFY(acc_target->object() == acc_radio->object());
- delete acc_target; acc_target = 0;
- QCOMPARE(acc_groupbox->navigate(QAccessible::Labelled, 2, &acc_target), 0);
- QVERIFY(acc_target->object() == acc_label2->object());
- delete acc_target; acc_target = 0;
- QCOMPARE(acc_groupbox->navigate(QAccessible::Labelled, 3, &acc_target), 0);
- QVERIFY(acc_target->object() == acc_lineedit2->object());
- delete acc_target; acc_target = 0;
- QCOMPARE(acc_groupbox->navigate(QAccessible::Labelled, 4, &acc_target), 0);
- QVERIFY(acc_target->object() == acc_groupbox2->object());
- delete acc_target; acc_target = 0;
- QCOMPARE(acc_groupbox->navigate(QAccessible::Labelled, 5, &acc_target), -1);
- QVERIFY(!acc_target);
-
- QCOMPARE(acc_border->navigate(QAccessible::Labelled, 0, &acc_target), -1);
- QVERIFY(!acc_target);
- QCOMPARE(acc_border->navigate(QAccessible::Labelled, 1, &acc_target), -1);
- QVERIFY(!acc_target);
-
- // to label
- QCOMPARE(acc_lineedit->navigate(QAccessible::Label, 0, &acc_target), -1);
- QVERIFY(!acc_target);
- QCOMPARE(acc_lineedit->navigate(QAccessible::Label, 1, &acc_target), 0);
- QVERIFY(acc_target->object() == acc_label->object());
- delete acc_target; acc_target = 0;
- QCOMPARE(acc_lineedit->navigate(QAccessible::Label, 2, &acc_target), -1);
- QVERIFY(!acc_target);
-
- QCOMPARE(acc_radio->navigate(QAccessible::Label, 0, &acc_target), -1);
- QVERIFY(!acc_target);
- QCOMPARE(acc_radio->navigate(QAccessible::Label, 1, &acc_target), 0);
- QVERIFY(acc_target->object() == acc_groupbox->object());
- delete acc_target; acc_target = 0;
- QCOMPARE(acc_radio->navigate(QAccessible::Label, 2, &acc_target), -1);
- QVERIFY(!acc_target);
-
- QCOMPARE(acc_lineedit2->navigate(QAccessible::Label, 1, &acc_target), 0);
- QVERIFY(acc_target->object() == acc_label2->object());
- delete acc_target; acc_target = 0;
- QCOMPARE(acc_lineedit2->navigate(QAccessible::Label, 2, &acc_target), 0);
- QVERIFY(acc_target->object() == acc_groupbox->object());
- delete acc_target; acc_target = 0;
- QCOMPARE(acc_lineedit2->navigate(QAccessible::Label, 3, &acc_target), -1);
- QVERIFY(!acc_target);
-
- QCOMPARE(acc_grandchild->navigate(QAccessible::Label, 1, &acc_target), 0);
- QVERIFY(acc_target->object() == acc_groupbox2->object());
- delete acc_target; acc_target = 0;
- QCOMPARE(acc_grandchild->navigate(QAccessible::Label, 2, &acc_target), -1);
- QVERIFY(!acc_target);
- QCOMPARE(acc_grandchild->navigate(QAccessible::Label, 3, &acc_target), -1);
- QVERIFY(!acc_target);
-
- delete acc_label;
- delete acc_lineedit;
- delete acc_groupbox;
- delete acc_radio;
- delete acc_label2;
- delete acc_lineedit2;
- delete acc_groupbox2;
- delete acc_grandchild;
- delete acc_border;
- delete acc_lineedit3;
- }
- QTestAccessibility::clearEvents();
-#endif // !QT3_SUPPORT
-}
-
static QWidget *createWidgets()
{
QWidget *w = new QWidget();
@@ -1460,140 +854,6 @@ void tst_QAccessibility::accessibleName()
QTestAccessibility::clearEvents();
}
-void tst_QAccessibility::text()
-{
-#if !defined(QT3_SUPPORT)
- QSKIP("This test needs Qt3Support", SkipAll);
-#else
- QWidget *toplevel = createGUI();
- toplevel->show();
-#if defined(Q_WS_X11)
- qt_x11_wait_for_window_manager(toplevel);
- QTest::qWait(100);
-#endif
- QObject *topLeft = toplevel->child("topLeft");
- QObject *topRight = toplevel->child("topRight");
- QObject *bottomLeft = toplevel->child("bottomLeft");
-
- QAccessibleInterface *acc_pb1 = QAccessible::queryAccessibleInterface(topLeft->child("pb1"));
-
- QAccessibleInterface *acc_pbOk = QAccessible::queryAccessibleInterface(topRight->child("pbOk"));
- QAccessibleInterface *acc_slider = QAccessible::queryAccessibleInterface(topRight->child("slider"));
- QAccessibleInterface *acc_spinBox = QAccessible::queryAccessibleInterface(topRight->child("spinBox"));
- QAccessibleInterface *acc_sliderLcd = QAccessible::queryAccessibleInterface(topRight->child("sliderLcd"));
-
- QAccessibleInterface *acc_label = QAccessible::queryAccessibleInterface(bottomLeft->child("label"));
- QAccessibleInterface *acc_lineedit = QAccessible::queryAccessibleInterface(bottomLeft->child("lineedit"));
- QAccessibleInterface *acc_radiogroup = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup"));
- QVERIFY(bottomLeft->child("radiogroup"));
- QAccessibleInterface *acc_radioAM = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup")->child("radioAM"));
- QAccessibleInterface *acc_frequency = QAccessible::queryAccessibleInterface(bottomLeft->child("radiogroup")->child("frequency"));
-
- QVERIFY(acc_pb1);
-
- QVERIFY(acc_pbOk);
- QVERIFY(acc_slider);
- QVERIFY(acc_spinBox);
- QVERIFY(acc_sliderLcd);
-
- QVERIFY(acc_label);
- QVERIFY(acc_lineedit);
- QVERIFY(acc_radiogroup);
- QVERIFY(acc_radioAM);
- QVERIFY(acc_frequency);
-
- QVERIFY(acc_label->relationTo(0, acc_lineedit, 0) & QAccessible::Label);
- QVERIFY(acc_radiogroup->relationTo(0, acc_frequency, 0) & QAccessible::Label);
- QVERIFY(acc_slider->relationTo(0, acc_sliderLcd, 0) & QAccessible::Controller);
- QVERIFY(acc_spinBox->relationTo(0, acc_slider, 0) & QAccessible::Controller);
-
- // Name
- QCOMPARE(acc_lineedit->text(QAccessible::Name, 0), acc_label->text(QAccessible::Name,0));
- QCOMPARE(acc_frequency->text(QAccessible::Name, 0), acc_radiogroup->text(QAccessible::Name,0));
- QCOMPARE(acc_sliderLcd->text(QAccessible::Name, 0), acc_slider->text(QAccessible::Value,0));
- QCOMPARE(acc_pbOk->text(QAccessible::Name, 0), QString("Ok"));
- QCOMPARE(acc_radioAM->text(QAccessible::Name, 0), QString("AM"));
- QCOMPARE(acc_pb1->text(QAccessible::Name, 0), QString("Button1"));
-
- // Description
- QString desc = qobject_cast<QWidget*>(acc_label->object())->toolTip();
- QVERIFY(!desc.isEmpty());
- QCOMPARE(acc_label->text(QAccessible::Description, 0), desc);
- desc = qobject_cast<QWidget*>(acc_lineedit->object())->toolTip();
- QVERIFY(!desc.isEmpty());
- QCOMPARE(acc_lineedit->text(QAccessible::Description, 0), desc);
-
- // Help
- QString help = qobject_cast<QWidget*>(acc_label->object())->whatsThis();
- QVERIFY(!help.isEmpty());
- QCOMPARE(acc_label->text(QAccessible::Help, 0), help);
- help = qobject_cast<QWidget*>(acc_frequency->object())->whatsThis();
- QVERIFY(!help.isEmpty());
- QCOMPARE(acc_frequency->text(QAccessible::Help, 0), help);
-
- // Value
- QString value = acc_frequency->object()->property("text").toString();
- QVERIFY(!value.isEmpty());
- QCOMPARE(acc_frequency->text(QAccessible::Value, 0), value);
- value = acc_slider->object()->property("value").toString();
- QVERIFY(!value.isEmpty());
- QCOMPARE(acc_slider->text(QAccessible::Value, 0), value);
- QCOMPARE(acc_spinBox->text(QAccessible::Value, 0), value);
-
- // Accelerator
- QCOMPARE(acc_pbOk->text(QAccessible::Accelerator, 0), Q3Accel::keyToString(Qt::Key_Enter));
- QCOMPARE(acc_pb1->text(QAccessible::Accelerator, 0), Q3Accel::keyToString(Qt::ALT + Qt::Key_1));
- QCOMPARE(acc_lineedit->text(QAccessible::Accelerator, 0), Q3Accel::keyToString(Qt::ALT) + "L");
- QCOMPARE(acc_frequency->text(QAccessible::Accelerator, 0), Q3Accel::keyToString(Qt::ALT) + "C");
-
- delete acc_pb1;
- delete acc_pbOk;
- delete acc_slider;
- delete acc_spinBox;
- delete acc_sliderLcd;
-
- delete acc_label;
- delete acc_lineedit;
- delete acc_radiogroup;
- delete acc_radioAM;
- delete acc_frequency;
-
- delete toplevel;
- QTestAccessibility::clearEvents();
-#endif // !QT3_SUPPORT
-}
-
-void tst_QAccessibility::setText()
-{
-#if !defined(QT3_SUPPORT)
- QSKIP("This test needs Qt3Support", SkipAll);
-#else
- QWidget *toplevel = createGUI();
- toplevel->show();
- QObject *bottomLeft = toplevel->findChild<QObject *>("bottomLeft");
-
- QAccessibleInterface *acc_lineedit = QAccessible::queryAccessibleInterface(bottomLeft->findChild<QLineEdit *>("lineedit"));
- // Value, read-write
- QString txt = acc_lineedit->text(QAccessible::Value, 0);
- QVERIFY(txt.isEmpty());
- txt = QLatin1String("Writable");
- acc_lineedit->setText(QAccessible::Value, 0, txt);
- QCOMPARE(acc_lineedit->text(QAccessible::Value, 0), txt);
-
- // Description, read-only
- txt = acc_lineedit->text(QAccessible::Description, 0);
- QVERIFY(!txt.isEmpty());
- acc_lineedit->setText(QAccessible::Description, 0, QLatin1String(""));
- QCOMPARE(acc_lineedit->text(QAccessible::Description, 0), txt);
-
- QVERIFY(acc_lineedit);
-
- delete acc_lineedit;
- delete toplevel;
- QTestAccessibility::clearEvents();
-#endif //QT3_SUPPORT
-}
-
void tst_QAccessibility::hideShowTest()
{
QWidget * const window = new QWidget();
@@ -1768,32 +1028,6 @@ void tst_QAccessibility::buttonTest()
toggletool.setText("Toggle");
toggletool.setMinimumSize(20,20);
-#if 0
- // QT3_SUPPORT
- // push button with a menu
- QPushButton menuButton("Menu", &window);
- Q3PopupMenu buttonMenu(&menuButton);
- buttonMenu.insertItem("Some item");
- menuButton.setPopup(&buttonMenu);
-
- // menu toolbutton
- QToolButton menuToolButton(&window);
- menuToolButton.setText("Menu Tool");
- Q3PopupMenu toolMenu(&menuToolButton);
- toolMenu.insertItem("Some item");
- menuToolButton.setPopup(&toolMenu);
- menuToolButton.setMinimumSize(20,20);
-
- // splitted menu toolbutton
- QToolButton splitToolButton(&window);
- splitToolButton.setTextLabel("Split Tool");
- Q3PopupMenu splitMenu(&splitToolButton);
- splitMenu.insertItem("Some item");
- splitToolButton.setPopup(&splitMenu);
- splitToolButton.setPopupDelay(0);
- splitToolButton.setMinimumSize(20,20);
-#endif
-
// test push button
QAccessibleInterface* interface = QAccessible::queryAccessibleInterface(&pushButton);
QAccessibleActionInterface* actionInterface = interface->actionInterface();
@@ -1927,206 +1161,6 @@ void tst_QAccessibility::buttonTest()
QTestAccessibility::clearEvents();
}
-void tst_QAccessibility::sliderTest()
-{
-#if !defined(QT3_SUPPORT)
- QSKIP("This test needs Qt3Support", SkipAll);
-#else
- QAccessibleInterface *test = 0;
- Q3VBox *vbox = new Q3VBox;
- QLabel *labelHorizontal = new QLabel("Horizontal", vbox);
- QSlider *sliderHorizontal = new QSlider(Qt::Horizontal, vbox);
- labelHorizontal->setBuddy(sliderHorizontal);
-
- QLabel *labelVertical = new QLabel("Vertical", vbox);
- QSlider *sliderVertical = new QSlider(Qt::Vertical, vbox);
- labelVertical->setBuddy(sliderVertical);
- vbox->show();
-
- // test horizontal slider
- test = QAccessible::queryAccessibleInterface(sliderHorizontal);
- QVERIFY(test);
- QCOMPARE(test->childCount(), 3);
- QCOMPARE(test->role(0), QAccessible::Slider);
- QCOMPARE(test->role(1), QAccessible::PushButton);
- QCOMPARE(test->role(2), QAccessible::Indicator);
- QCOMPARE(test->role(3), QAccessible::PushButton);
-
- QCOMPARE(test->text(QAccessible::Name, 0), labelHorizontal->text());
- QCOMPARE(test->text(QAccessible::Name, 1), QSlider::tr("Page left"));
- QCOMPARE(test->text(QAccessible::Name, 2), QSlider::tr("Position"));
- QCOMPARE(test->text(QAccessible::Name, 3), QSlider::tr("Page right"));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal->value()));
- QCOMPARE(test->text(QAccessible::Value, 1), QString());
- QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderHorizontal->value()));
- QCOMPARE(test->text(QAccessible::Value, 3), QString());
-// Skip action tests.
-#if 0
- QCOMPARE(test->defaultAction(0), QAccessible::SetFocus);
- QCOMPARE(test->defaultAction(1), QAccessible::Press);
- QCOMPARE(test->defaultAction(2), QAccessible::NoAction);
- QCOMPARE(test->defaultAction(3), QAccessible::Press);
- QCOMPARE(test->actionText(QAccessible::SetFocus, QAccessible::Name, 0), QSlider::tr("Set Focus"));
- QCOMPARE(test->actionText(QAccessible::Press, QAccessible::Name, 1), QSlider::tr("Press"));
- QCOMPARE(test->actionText(QAccessible::Increase, QAccessible::Name, 2), QSlider::tr("Increase"));
- QCOMPARE(test->actionText(QAccessible::Decrease, QAccessible::Name, 2), QSlider::tr("Decrease"));
- QCOMPARE(test->actionText(QAccessible::Press, QAccessible::Name, 3), QSlider::tr("Press"));
- QVERIFY(test->doAction(QAccessible::Press, 3));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal->pageStep()));
- QVERIFY(test->doAction(QAccessible::Press, 3));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderHorizontal->pageStep()));
- QVERIFY(test->doAction(QAccessible::Press, 1));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal->pageStep()));
- QVERIFY(test->doAction(QAccessible::Press, 1));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(0));
- QVERIFY(test->doAction(QAccessible::Increase, 2));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal->lineStep()));
- QVERIFY(test->doAction(QAccessible::Increase, 2));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderHorizontal->lineStep()));
- QVERIFY(test->doAction(QAccessible::Decrease, 2));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal->lineStep()));
- QVERIFY(test->doAction(QAccessible::Decrease, 2));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(0));
-#endif
- delete test;
-
- // test vertical slider
- test = QAccessible::queryAccessibleInterface(sliderVertical);
- QVERIFY(test);
- QCOMPARE(test->childCount(), 3);
- QCOMPARE(test->role(0), QAccessible::Slider);
- QCOMPARE(test->role(1), QAccessible::PushButton);
- QCOMPARE(test->role(2), QAccessible::Indicator);
- QCOMPARE(test->role(3), QAccessible::PushButton);
-
- QCOMPARE(test->text(QAccessible::Name, 0), labelVertical->text());
- QCOMPARE(test->text(QAccessible::Name, 1), QSlider::tr("Page up"));
- QCOMPARE(test->text(QAccessible::Name, 2), QSlider::tr("Position"));
- QCOMPARE(test->text(QAccessible::Name, 3), QSlider::tr("Page down"));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical->value()));
- QCOMPARE(test->text(QAccessible::Value, 1), QString());
- QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderVertical->value()));
- QCOMPARE(test->text(QAccessible::Value, 3), QString());
-// Skip action tests.
-#if 0
- QCOMPARE(test->defaultAction(0), QAccessible::SetFocus);
- QCOMPARE(test->defaultAction(1), QAccessible::Press);
- QCOMPARE(test->defaultAction(2), QAccessible::NoAction);
- QCOMPARE(test->defaultAction(3), QAccessible::Press);
- QCOMPARE(test->actionText(QAccessible::SetFocus, QAccessible::Name, 0), QSlider::tr("Set Focus"));
- QCOMPARE(test->actionText(QAccessible::Press, QAccessible::Name, 1), QSlider::tr("Press"));
- QCOMPARE(test->actionText(QAccessible::Increase, QAccessible::Name, 2), QSlider::tr("Increase"));
- QCOMPARE(test->actionText(QAccessible::Decrease, QAccessible::Name, 2), QSlider::tr("Decrease"));
- QCOMPARE(test->actionText(QAccessible::Press, QAccessible::Name, 3), QSlider::tr("Press"));
- QVERIFY(test->doAction(QAccessible::Press, 3));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical->pageStep()));
- QVERIFY(test->doAction(QAccessible::Press, 3));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderVertical->pageStep()));
- QVERIFY(test->doAction(QAccessible::Press, 1));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical->pageStep()));
- QVERIFY(test->doAction(QAccessible::Press, 1));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(0));
- QVERIFY(test->doAction(QAccessible::Increase, 2));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical->lineStep()));
- QVERIFY(test->doAction(QAccessible::Increase, 2));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderVertical->lineStep()));
- QVERIFY(test->doAction(QAccessible::Decrease, 2));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical->lineStep()));
- QVERIFY(test->doAction(QAccessible::Decrease, 2));
- QCOMPARE(test->text(QAccessible::Value, 0), QString::number(0));
-#endif
- delete test;
- delete sliderHorizontal;
- delete sliderVertical;
- delete labelHorizontal;
- delete labelVertical;
- delete vbox;
-
- // Test that when we hide() a slider, the PageLeft, Indicator, and PageRight also gets the
- // Invisible state bit set.
- enum SubControls { PageLeft = 1, Position = 2, PageRight = 3 };
-
- QSlider *slider = new QSlider();
- QAccessibleInterface * const sliderInterface = QAccessible::queryAccessibleInterface(slider);
- QVERIFY(sliderInterface);
-
- QVERIFY(sliderInterface->state(0) & QAccessible::Invisible);
- QVERIFY(sliderInterface->state(PageLeft) & QAccessible::Invisible);
- QVERIFY(sliderInterface->state(Position) & QAccessible::Invisible);
- QVERIFY(sliderInterface->state(PageRight) & QAccessible::Invisible);
-
- slider->show();
- QVERIFY(sliderInterface->state(0) ^ QAccessible::Invisible);
- QVERIFY(sliderInterface->state(PageLeft) ^ QAccessible::Invisible);
- QVERIFY(sliderInterface->state(Position) ^ QAccessible::Invisible);
- QVERIFY(sliderInterface->state(PageRight) ^ QAccessible::Invisible);
- QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(slider, 0, QAccessible::ObjectShow)));
- QTestAccessibility::clearEvents();
-
- slider->hide();
- QVERIFY(sliderInterface->state(0) & QAccessible::Invisible);
- QVERIFY(sliderInterface->state(PageLeft) & QAccessible::Invisible);
- QVERIFY(sliderInterface->state(Position) & QAccessible::Invisible);
- QVERIFY(sliderInterface->state(PageRight) & QAccessible::Invisible);
- QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(slider, 0, QAccessible::ObjectHide)));
- QTestAccessibility::clearEvents();
-
- // Test that the left/right subcontrols are set to unavailable when the slider is at the minimum/maximum.
- slider->show();
- slider->setMinimum(0);
- slider->setMaximum(100);
-
- slider->setValue(50);
- QVERIFY(sliderInterface->state(PageLeft) ^ QAccessible::Unavailable);
- QVERIFY(sliderInterface->state(Position) ^ QAccessible::Unavailable);
- QVERIFY(sliderInterface->state(PageRight) ^ QAccessible::Unavailable);
-
- slider->setValue(0);
- QVERIFY(sliderInterface->state(PageLeft) & QAccessible::Unavailable);
- QVERIFY(sliderInterface->state(Position) ^ QAccessible::Unavailable);
- QVERIFY(sliderInterface->state(PageRight) ^ QAccessible::Unavailable);
-
- slider->setValue(100);
- QVERIFY(sliderInterface->state(PageLeft) ^ QAccessible::Unavailable);
- QVERIFY(sliderInterface->state(Position) ^ QAccessible::Unavailable);
- QVERIFY(sliderInterface->state(PageRight) & QAccessible::Unavailable);
-
- delete sliderInterface;
- delete slider;
-
- // Test that the rects are ok.
- {
- QSlider *slider = new QSlider(Qt::Horizontal);
- slider->show();
-#if defined(Q_WS_X11)
- qt_x11_wait_for_window_manager(slider);
- QTest::qWait(100);
-#endif
- QAccessibleInterface * const sliderInterface = QAccessible::queryAccessibleInterface(slider);
- QVERIFY(sliderInterface);
-
- slider->setMinimum(0);
- slider->setMaximum(100);
- slider->setValue(50);
-
- const QRect sliderRect = sliderInterface->rect(0);
- QVERIFY(sliderRect.isValid());
-
- // Verify that the sub-control rects are valid and inside the slider rect.
- for (int i = PageLeft; i <= PageRight; ++i) {
- const QRect testRect = sliderInterface->rect(i);
- QVERIFY(testRect.isValid());
- QVERIFY(sliderRect.contains(testRect));
- }
-
- delete slider;
- delete sliderInterface;
- }
-
- QTestAccessibility::clearEvents();
-#endif //!QT3_SUPPORT
-}
-
void tst_QAccessibility::scrollBarTest()
{
// Test that when we hide() a slider, the PageLeft, Indicator, and PageRight also gets the
@@ -3787,47 +2821,6 @@ void tst_QAccessibility::dockWidgetTest()
#endif // QT_NO_DOCKWIDGET
}
-void tst_QAccessibility::pushButtonTest()
-{
-#if !defined(QT3_SUPPORT)
- QSKIP( "Should never get here without Qt3Support", SkipAll);
-#else
- // Set up a proper main window with two dock widgets
- QWidget *toplevel = createGUI();
- QObject *topRight = toplevel->findChild<QObject *>("topRight");
-
- toplevel->show();
-#if defined(Q_WS_X11)
- qt_x11_wait_for_window_manager(toplevel);
- QTest::qWait(100);
-#endif
- QPushButton *pb = qobject_cast<QPushButton*>(topRight->findChild<QPushButton *>("pbOk"));
- QPoint pt = pb->mapToGlobal(pb->geometry().topLeft());
- QRect rect(pt, pb->geometry().size());
- pt = rect.center();
-
- QAccessibleInterface *accToplevel = QAccessible::queryAccessibleInterface(toplevel);
- QAccessibleInterface *acc;
- QAccessibleInterface *acc2;
- int entry = accToplevel->childAt(pt.x(), pt.y());
- accToplevel->navigate(QAccessible::Child, entry, &acc);
- if (acc) {
- entry = acc->childAt(pt.x(), pt.y());
- acc->navigate(QAccessible::Child, entry, &acc2);
- delete acc;
- acc = acc2;
- }
- QCOMPARE(acc->role(0), QAccessible::PushButton);
- QCOMPARE(acc->rect(0), rect);
- QCOMPARE(acc->childAt(pt.x(), pt.y()), 0);
-
- delete acc;
- delete accToplevel;
- delete toplevel;
- QTestAccessibility::clearEvents();
-#endif //QT3_SUPPORT
-}
-
void tst_QAccessibility::comboBoxTest()
{
#if defined(Q_OS_WINCE)