diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-13 10:18:25 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-13 10:18:25 (GMT) |
commit | 33d20d417ea9387b449de96097c3d2b5913a0533 (patch) | |
tree | e70a742071e9c7e92f53dd375a444097b117199b /tests/auto | |
parent | 3e94b3a77affeef80544e48949e018ced4e0d96e (diff) | |
parent | 3c3d5521a94254bf3ce5591e8a326005fcb4d3b1 (diff) | |
download | Qt-33d20d417ea9387b449de96097c3d2b5913a0533.zip Qt-33d20d417ea9387b449de96097c3d2b5913a0533.tar.gz Qt-33d20d417ea9387b449de96097c3d2b5913a0533.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: (48 commits)
build fix for S60
Improve handling of QAction in soft key manager
Remove useless assert
qdrawhelper: fix optim in 2245641ba
QSlider and StyleSheet: fix one pixel error while drawing the SliderAddPage
accelerate QWindowsPipeWriter for bigger chunks of data
Fix antialiasing with transformed text in OpenGL2 paint engine
Fix flattening of largely scaled, thin, dashed beziers.
Increased the precision used to flatten beziers
Fix QT_NO_MOVIE
Fix compile error with QT_NO_ACTION in QtGui
Fix QT_NO_COMPLETER
Fix QT_NO_FSCOMPLETER
Fix QT_NO_FILESYSTEMMODEL
Build fix
Safeguard ourselves against corrupt registry values for cleartype gamma
fix cetest build properly
qdrawhelper: optimize the fetch transformed bilinear functions
Compile fix for WinCE
Make sure the selectionChanged signal is not called too much
...
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/qtabwidget/tst_qtabwidget.cpp | 47 | ||||
-rw-r--r-- | tests/auto/qtreeview/tst_qtreeview.cpp | 32 |
4 files changed, 120 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/qtabwidget/tst_qtabwidget.cpp b/tests/auto/qtabwidget/tst_qtabwidget.cpp index 4491fb3..204c27a 100644 --- a/tests/auto/qtabwidget/tst_qtabwidget.cpp +++ b/tests/auto/qtabwidget/tst_qtabwidget.cpp @@ -45,6 +45,7 @@ #include <qdebug.h> #include <qapplication.h> #include <qlabel.h> +#include <qboxlayout.h> //TESTED_CLASS= //TESTED_FILES= @@ -120,6 +121,8 @@ class tst_QTabWidget:public QObject { void clear(); void keyboardNavigation(); void paintEventCount(); + void heightForWidth(); + void heightForWidth_data(); private: int addPage(); @@ -621,6 +624,50 @@ void tst_QTabWidget::paintEventCount() QCOMPARE(tab2->count, 1); } +void tst_QTabWidget::heightForWidth_data() +{ + QTest::addColumn<int>("tabPosition"); + QTest::newRow("West") << int(QTabWidget::West); + QTest::newRow("North") << int(QTabWidget::North); + QTest::newRow("East") << int(QTabWidget::East); + QTest::newRow("South") << int(QTabWidget::South); +} + +void tst_QTabWidget::heightForWidth() +{ + QFETCH(int, tabPosition); + + QWidget *window = new QWidget; + QVBoxLayout *lay = new QVBoxLayout(window); + lay->setMargin(0); + lay->setSpacing(0); + QTabWidget *tabWid = new QTabWidget(window); + QWidget *w = new QWidget; + tabWid->addTab(w, QLatin1String("HFW page")); + tabWid->setTabPosition(QTabWidget::TabPosition(tabPosition)); + QVBoxLayout *lay2 = new QVBoxLayout(w); + QLabel *label = new QLabel("Label with wordwrap turned on makes it trade height for width." + " Make it a really long text so that it spans on several lines" + " when the label is on its narrowest." + " I don't like to repeat myself." + " I don't like to repeat myself." + " I don't like to repeat myself." + " I don't like to repeat myself." + ); + label->setWordWrap(true); + lay2->addWidget(label); + lay2->setMargin(0); + + lay->addWidget(tabWid); + int h = window->heightForWidth(160); + window->resize(160, h); + window->show(); + + QTest::qWaitForWindowShown(window); + QVERIFY(label->height() >= label->heightForWidth(label->width())); + + delete window; +} QTEST_MAIN(tst_QTabWidget) #include "tst_qtabwidget.moc" 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" |