diff options
Diffstat (limited to 'tests/auto/other')
-rw-r--r-- | tests/auto/other/lancelot/lancelot.pro | 1 | ||||
-rw-r--r-- | tests/auto/other/lancelot/scripts/statictext.qps | 34 | ||||
-rw-r--r-- | tests/auto/other/lancelot/scripts/text.qps | 34 | ||||
-rw-r--r-- | tests/auto/other/qaccessibility/tst_qaccessibility.cpp | 102 |
4 files changed, 153 insertions, 18 deletions
diff --git a/tests/auto/other/lancelot/lancelot.pro b/tests/auto/other/lancelot/lancelot.pro index b577e0dbc9..ef557691e3 100644 --- a/tests/auto/other/lancelot/lancelot.pro +++ b/tests/auto/other/lancelot/lancelot.pro @@ -1,5 +1,6 @@ CONFIG += testcase CONFIG += parallel_test +CONFIG -= app_bundle TARGET = tst_lancelot QT += xml widgets testlib diff --git a/tests/auto/other/lancelot/scripts/statictext.qps b/tests/auto/other/lancelot/scripts/statictext.qps index b62b623462..c5ddda197f 100644 --- a/tests/auto/other/lancelot/scripts/statictext.qps +++ b/tests/auto/other/lancelot/scripts/statictext.qps @@ -50,7 +50,25 @@ save drawStaticText 0 80 "scaled sansserif 10pt, bold italic" restore - translate 0 100 + translate 200 200 + setPen black + save + scale -1 -1 + + setFont "sansserif" 10 normal + drawStaticText 0 20 "flipped sansserif 10pt, normal" + + setFont "sansserif" 12 normal + drawStaticText 0 40 "flipped sansserif 12pt, normal" + + setFont "sansserif" 10 bold + drawStaticText 0 60 "flipped sansserif 12pt, bold" + + setFont "sansserif" 10 bold italic + drawStaticText 0 80 "flipped sansserif 10pt, bold italic" + restore + + translate -200 20 setPen black save translate 200 90 @@ -91,26 +109,26 @@ restore end_block translate 250 0 -drawStaticText 25 520 "clipped to rectangle" +drawStaticText 25 640 "clipped to rectangle" save setPen #3f000000 setBrush nobrush - drawRect 20 0 100 500 - setClipRect 20 0 100 500 + drawRect 20 0 100 620 + setClipRect 20 0 100 620 setPen black repeat_block text_drawing restore translate 150 0 -drawStaticText 25 520 "clipped to path" +drawStaticText 25 640 "clipped to path" save path_moveTo clip 20 0 path_cubicTo clip 0 200 40 400 20 400 - path_lineTo clip 30 500 + path_lineTo clip 30 620 path_lineTo clip 30 0 path_lineTo clip 40 0 - path_lineTo clip 40 500 - path_lineTo clip 120 500 + path_lineTo clip 40 620 + path_lineTo clip 120 620 path_lineTo clip 120 0 path_lineTo clip 20 0 setPen #3f000000 diff --git a/tests/auto/other/lancelot/scripts/text.qps b/tests/auto/other/lancelot/scripts/text.qps index d7ee83290b..88c8690ca0 100644 --- a/tests/auto/other/lancelot/scripts/text.qps +++ b/tests/auto/other/lancelot/scripts/text.qps @@ -52,7 +52,25 @@ save drawText 0 80 "scaled sansserif 10pt, bold italic" restore - translate 0 100 + translate 200 200 + setPen black + save + scale -1 -1 + + setFont "sansserif" 10 normal + drawStaticText 0 20 "flipped sansserif 10pt, normal" + + setFont "sansserif" 12 normal + drawStaticText 0 40 "flipped sansserif 12pt, normal" + + setFont "sansserif" 10 bold + drawStaticText 0 60 "flipped sansserif 12pt, bold" + + setFont "sansserif" 10 bold italic + drawStaticText 0 80 "flipped sansserif 10pt, bold italic" + restore + + translate -200 20 setPen black save translate 200 90 @@ -93,26 +111,26 @@ restore end_block translate 250 0 -drawText 25 520 "clipped to rectangle" +drawText 25 640 "clipped to rectangle" save setPen #3f000000 setBrush nobrush - drawRect 20 0 100 500 - setClipRect 20 0 100 500 + drawRect 20 0 100 620 + setClipRect 20 0 100 620 setPen black repeat_block text_drawing restore translate 150 0 -drawText 25 520 "clipped to path" +drawText 25 640 "clipped to path" save path_moveTo clip 20 0 path_cubicTo clip 0 200 40 400 20 400 - path_lineTo clip 30 500 + path_lineTo clip 30 620 path_lineTo clip 30 0 path_lineTo clip 40 0 - path_lineTo clip 40 500 - path_lineTo clip 120 500 + path_lineTo clip 40 620 + path_lineTo clip 120 620 path_lineTo clip 120 0 path_lineTo clip 20 0 setPen #3f000000 diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index b0d0459326..202843f5a8 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -768,12 +768,40 @@ void tst_QAccessibility::actionTest() void tst_QAccessibility::applicationTest() { + { QLatin1String name = QLatin1String("My Name"); qApp->setApplicationName(name); - QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(qApp); + QAIPtr interface(QAccessible::queryAccessibleInterface(qApp)); QCOMPARE(interface->text(QAccessible::Name), name); + QCOMPARE(interface->text(QAccessible::Description), qApp->applicationFilePath()); + QCOMPARE(interface->text(QAccessible::Value), QString()); QCOMPARE(interface->role(), QAccessible::Application); - delete interface; + QCOMPARE(interface->window(), static_cast<QWindow*>(0)); + QCOMPARE(interface->parent(), static_cast<QAccessibleInterface*>(0)); + QCOMPARE(interface->focusChild(), static_cast<QAccessibleInterface*>(0)); + QCOMPARE(interface->indexOfChild(0), -1); + QCOMPARE(interface->child(0), static_cast<QAccessibleInterface*>(0)); + QCOMPARE(interface->child(-1), static_cast<QAccessibleInterface*>(0)); + QCOMPARE(interface->child(1), static_cast<QAccessibleInterface*>(0)); + QCOMPARE(interface->childCount(), 0); + + QWidget widget; + widget.show(); + qApp->setActiveWindow(&widget); + QVERIFY(QTest::qWaitForWindowActive(&widget)); + + QAIPtr widgetIface(QAccessible::queryAccessibleInterface(&widget)); + QCOMPARE(interface->childCount(), 1); + QAIPtr focus(interface->focusChild()); + QCOMPARE(focus->object(), &widget); + QCOMPARE(interface->indexOfChild(0), -1); + QCOMPARE(interface->indexOfChild(widgetIface.data()), 0); + QAIPtr child(interface->child(0)); + QCOMPARE(child->object(), &widget); + QCOMPARE(interface->child(-1), static_cast<QAccessibleInterface*>(0)); + QCOMPARE(interface->child(1), static_cast<QAccessibleInterface*>(0)); + } + QTestAccessibility::clearEvents(); } void tst_QAccessibility::mainWindowTest() @@ -2702,6 +2730,76 @@ void tst_QAccessibility::tableTest() QCOMPARE(table2->rowDescription(1), QString("v2")); QCOMPARE(table2->rowDescription(2), QString("v3")); + tableView->clearSelection(); + tableView->setSelectionBehavior(QAbstractItemView::SelectItems); + tableView->setSelectionMode(QAbstractItemView::SingleSelection); + QVERIFY(!table2->selectRow(0)); + QVERIFY(!table2->isRowSelected(0)); + tableView->setSelectionBehavior(QAbstractItemView::SelectRows); + QVERIFY(table2->selectRow(0)); + QVERIFY(table2->selectRow(1)); + QVERIFY(!table2->isRowSelected(0)); + tableView->setSelectionMode(QAbstractItemView::MultiSelection); + QVERIFY(table2->selectRow(0)); + QVERIFY(table2->isRowSelected(1)); + QVERIFY(table2->unselectRow(0)); + QVERIFY(!table2->isRowSelected(0)); + tableView->setSelectionBehavior(QAbstractItemView::SelectColumns); + QVERIFY(!table2->selectRow(0)); + QVERIFY(!table2->isRowSelected(0)); + tableView->clearSelection(); + QCOMPARE(table2->selectedColumnCount(), 0); + QCOMPARE(table2->selectedRowCount(), 0); + QVERIFY(table2->selectColumn(1)); + QVERIFY(table2->isColumnSelected(1)); + tableView->clearSelection(); + tableView->setSelectionMode(QAbstractItemView::ContiguousSelection); + table2->selectColumn(0); + table2->selectColumn(2); + QVERIFY(!(table2->isColumnSelected(2) && table2->isColumnSelected(0))); + tableView->clearSelection(); + tableView->setSelectionBehavior(QAbstractItemView::SelectItems); + tableView->setSelectionMode(QAbstractItemView::MultiSelection); + table2->selectColumn(1); + table2->selectRow(1); + QVERIFY(table2->isColumnSelected(1)); + QVERIFY(table2->isRowSelected(1)); + + QAIPtr cell4(table2->cellAt(2,2)); + QVERIFY(cell1->actionInterface()); + QVERIFY(cell1->tableCellInterface()); + + tableView->clearSelection(); + tableView->setSelectionBehavior(QAbstractItemView::SelectRows); + tableView->setSelectionMode(QAbstractItemView::SingleSelection); + QVERIFY(!cell1->tableCellInterface()->isSelected()); + QVERIFY(cell1->actionInterface()->actionNames().contains(QAccessibleActionInterface::toggleAction())); + cell1->actionInterface()->doAction(QAccessibleActionInterface::toggleAction()); + QVERIFY(cell2->tableCellInterface()->isSelected()); + + tableView->clearSelection(); + tableView->setSelectionBehavior(QAbstractItemView::SelectColumns); + cell3->actionInterface()->doAction(QAccessibleActionInterface::toggleAction()); + QVERIFY(cell4->tableCellInterface()->isSelected()); + + tableView->clearSelection(); + tableView->setSelectionBehavior(QAbstractItemView::SelectItems); + tableView->setSelectionMode(QAbstractItemView::SingleSelection); + cell1->actionInterface()->doAction(QAccessibleActionInterface::toggleAction()); + QVERIFY(cell1->tableCellInterface()->isSelected()); + cell2->actionInterface()->doAction(QAccessibleActionInterface::toggleAction()); + QVERIFY(!cell1->tableCellInterface()->isSelected()); + + tableView->clearSelection(); + tableView->setSelectionMode(QAbstractItemView::MultiSelection); + cell1->actionInterface()->doAction(QAccessibleActionInterface::toggleAction()); + cell2->actionInterface()->doAction(QAccessibleActionInterface::toggleAction()); + QVERIFY(cell1->tableCellInterface()->isSelected()); + QVERIFY(cell2->tableCellInterface()->isSelected()); + cell2->actionInterface()->doAction(QAccessibleActionInterface::toggleAction()); + QVERIFY(cell1->tableCellInterface()->isSelected()); + QVERIFY(!cell2->tableCellInterface()->isSelected()); + delete tableView; QTestAccessibility::clearEvents(); |