diff options
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp | 12 | ||||
-rw-r--r-- | tests/auto/qpathclipper/tst_qpathclipper.cpp | 29 | ||||
-rw-r--r-- | tests/auto/qtreeview/tst_qtreeview.cpp | 32 |
3 files changed, 73 insertions, 0 deletions
diff --git a/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp index bf4ea5f..195f8b6 100644 --- a/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp +++ b/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp @@ -721,11 +721,13 @@ void tst_QDialogButtonBox::testDefaultButton_data() static int softKeyCount(QWidget *widget) { int softkeyCount = 0; +#ifndef QT_NO_ACTION QList<QAction *> actions = widget->actions(); foreach (QAction *action, actions) { if (action->softKeyRole() != QAction::NoSoftKey) softkeyCount++; } +#endif return softkeyCount; } @@ -737,14 +739,18 @@ void tst_QDialogButtonBox::testS60SoftKeys() buttonBox.setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); dialog.show(); +#ifndef QT_NO_ACTION QCOMPARE( softKeyCount(&dialog), 2); +#endif QDialog dialog2(0); QDialogButtonBox buttonBox2(&dialog2); buttonBox2.setStandardButtons(QDialogButtonBox::Cancel); dialog2.show(); +#ifndef QT_NO_ACTION QCOMPARE( softKeyCount(&dialog2), 1); +#endif #else QSKIP("S60-specific test", SkipAll ); @@ -759,21 +765,27 @@ void tst_QDialogButtonBox::testSoftKeyReparenting() buttonBox->addButton(QDialogButtonBox::Ok); buttonBox->addButton(QDialogButtonBox::Cancel); +#ifndef QT_NO_ACTION QCOMPARE(softKeyCount(&dialog), 0); QCOMPARE(softKeyCount(buttonBox), 2); +#endif // Were the softkeys re-parented correctly? dialog.setLayout(new QVBoxLayout); dialog.layout()->addWidget(buttonBox); +#ifndef QT_NO_ACTION QCOMPARE(softKeyCount(&dialog), 2); QCOMPARE(softKeyCount(buttonBox), 0); +#endif // Softkeys are only added to QDialog, not QWidget QWidget *nested = new QWidget; nested->setLayout(new QVBoxLayout); nested->layout()->addWidget(buttonBox); +#ifndef QT_NO_ACTION QCOMPARE(softKeyCount(nested), 0); QCOMPARE(softKeyCount(buttonBox), 2); +#endif } #endif diff --git a/tests/auto/qpathclipper/tst_qpathclipper.cpp b/tests/auto/qpathclipper/tst_qpathclipper.cpp index 38d253a..db5a13e 100644 --- a/tests/auto/qpathclipper/tst_qpathclipper.cpp +++ b/tests/auto/qpathclipper/tst_qpathclipper.cpp @@ -95,6 +95,8 @@ private slots: void task209056(); void task251909(); + + void qtbug3778(); }; Q_DECLARE_METATYPE(QPainterPath) @@ -1346,6 +1348,33 @@ void tst_QPathClipper::task251909() QVERIFY(result.elementCount() <= 5); } +void tst_QPathClipper::qtbug3778() +{ + QPainterPath path1; + path1.moveTo(200, 3.22409e-5); + // e-5 and higher leads to a bug + // Using 3.22409e-4 starts to work correctly + path1.lineTo(0, 0); + path1.lineTo(1.07025e-13, 1450); + path1.lineTo(750, 950); + path1.lineTo(950, 750); + path1.lineTo(200, 3.22409e-13); + + QPainterPath path2; + path2.moveTo(0, 0); + path2.lineTo(200, 800); + path2.lineTo(600, 1500); + path2.lineTo(1500, 1400); + path2.lineTo(1900, 1200); + path2.lineTo(2000, 1000); + path2.lineTo(1400, 0); + path2.lineTo(0, 0); + + QPainterPath p12 = path1.intersected(path2); + + QVERIFY(p12.contains(QPointF(100, 100))); +} + QTEST_APPLESS_MAIN(tst_QPathClipper) diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 2de189d..75a4c62 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -215,6 +215,7 @@ private slots: void addRowsWhileSectionsAreHidden(); void filterProxyModelCrash(); void styleOptionViewItem(); + void keyboardNavigationWithDisabled(); // task-specific tests: void task174627_moveLeftToRoot(); @@ -3753,5 +3754,36 @@ void tst_QTreeView::taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint() QTRY_VERIFY(view.painted > 0); } +void tst_QTreeView::keyboardNavigationWithDisabled() +{ + QTreeView view; + QStandardItemModel model(90, 0); + for (int i = 0; i < 90; i ++) { + model.setItem(i, new QStandardItem(QString::number(i))); + model.item(i)->setEnabled(i%6 == 0); + } + view.setModel(&model); + + view.resize(200, view.visualRect(model.index(0,0)).height()*10); + view.show(); + QApplication::setActiveWindow(&view); + QTest::qWaitForWindowShown(&view); + QTRY_VERIFY(view.isActiveWindow()); + + view.setCurrentIndex(model.index(1, 0)); + QTest::keyClick(view.viewport(), Qt::Key_Up); + QCOMPARE(view.currentIndex(), model.index(0, 0)); + QTest::keyClick(view.viewport(), Qt::Key_Down); + QCOMPARE(view.currentIndex(), model.index(6, 0)); + QTest::keyClick(view.viewport(), Qt::Key_PageDown); + QCOMPARE(view.currentIndex(), model.index(18, 0)); + QTest::keyClick(view.viewport(), Qt::Key_Down); + QCOMPARE(view.currentIndex(), model.index(24, 0)); + QTest::keyClick(view.viewport(), Qt::Key_PageUp); + QCOMPARE(view.currentIndex(), model.index(12, 0)); + QTest::keyClick(view.viewport(), Qt::Key_Up); + QCOMPARE(view.currentIndex(), model.index(6, 0)); +} + QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" |