diff options
author | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-10-09 06:51:12 (GMT) |
---|---|---|
committer | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-10-09 06:51:12 (GMT) |
commit | 80892f907be2f271d567d902c2b3d909b0178853 (patch) | |
tree | b965540aa9a4d09d9c378acdcfb39551d7d7d79a /tests | |
parent | db1162da76f1d257ba9bfcaef574275e7430385f (diff) | |
parent | f370b5d986529155baf7d9dd95678854df4105e0 (diff) | |
download | Qt-80892f907be2f271d567d902c2b3d909b0178853.zip Qt-80892f907be2f271d567d902c2b3d909b0178853.tar.gz Qt-80892f907be2f271d567d902c2b3d909b0178853.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qabstractslider/tst_qabstractslider.cpp | 18 | ||||
-rw-r--r-- | tests/auto/qfiledialog/tst_qfiledialog.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 8 | ||||
-rw-r--r-- | tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp | 6 | ||||
-rw-r--r-- | tests/auto/qmenu/tst_qmenu.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qsound/qsound.pro | 2 | ||||
-rw-r--r-- | tests/auto/qsound/tst_qsound.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qspinbox/tst_qspinbox.cpp | 10 | ||||
-rw-r--r-- | tests/auto/qsqlrecord/qsqlrecord.pro | 6 | ||||
-rw-r--r-- | tests/auto/qtableview/tst_qtableview.cpp | 6 | ||||
-rw-r--r-- | tests/auto/qtextlayout/tst_qtextlayout.cpp | 18 | ||||
-rw-r--r-- | tests/auto/qtimer/tst_qtimer.cpp | 9 | ||||
-rw-r--r-- | tests/auto/qtoolbar/tst_qtoolbar.cpp | 123 | ||||
-rw-r--r-- | tests/auto/selftests/tst_selftests.cpp | 2 |
14 files changed, 166 insertions, 51 deletions
diff --git a/tests/auto/qabstractslider/tst_qabstractslider.cpp b/tests/auto/qabstractslider/tst_qabstractslider.cpp index 9f7a78e..5c70bde 100644 --- a/tests/auto/qabstractslider/tst_qabstractslider.cpp +++ b/tests/auto/qabstractslider/tst_qabstractslider.cpp @@ -714,7 +714,11 @@ void tst_QAbstractSlider::wheelEvent_data() << 1 // delta << int(Qt::Vertical) // orientation of slider << int(Qt::Vertical) // orientation of wheel +#ifdef Q_WS_MAC + << 1 // expected position after +#else << 20 // expected position after +#endif << QPoint(0,0); QTest::newRow("Normal data page") << 0 // initial position @@ -773,7 +777,11 @@ void tst_QAbstractSlider::wheelEvent_data() << 1 // delta << int(Qt::Horizontal) // orientation of slider << int(Qt::Horizontal) // orientation of wheel +#ifdef Q_WS_MAC + << 49 // expected position after +#else << 30 // expected position after +#endif << QPoint(1,1); QTest::newRow("Past end") << 50 // initial position @@ -784,7 +792,11 @@ void tst_QAbstractSlider::wheelEvent_data() << false // inverted controls << 1 // wheel scroll lines << false // with modifiers +#ifdef Q_WS_MAC + << 60 // delta +#else << 2 // delta +#endif << int(Qt::Horizontal) // orientation of slider << int(Qt::Horizontal) // orientation of wheel << 100 // expected position after @@ -798,7 +810,11 @@ void tst_QAbstractSlider::wheelEvent_data() << false // inverted controls << 1 // wheel scroll lines << false // with modifiers - << -2 // delta +#ifdef Q_WS_MAC + << -60 // delta +#else + << -2 // delta +#endif << int(Qt::Horizontal) // orientation of slider << int(Qt::Horizontal) // orientation of wheel << 0 // expected position after diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index f6b082f..dc2ca61 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -944,7 +944,7 @@ void tst_QFiledialog::selectFiles() QVERIFY(listView); for (int i = 0; i < list.count(); ++i) { fd.selectFile(fd.directory().path() + "/" + list.at(i)); -#if defined(Q_WS_MAC) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) +#if defined(QT_MAC_USE_COCOA) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) QEXPECT_FAIL("", "This test does not work on Mac, Windows, or Symbian", Abort); #endif QTRY_VERIFY(!listView->selectionModel()->selectedRows().isEmpty()); diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 8459331..f5e9acb 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -2819,17 +2819,15 @@ void tst_QGraphicsScene::update2() CustomView view; view.setScene(&scene); view.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif - QTest::qWait(250); + QTest::qWaitForWindowShown(&view); + QTRY_VERIFY(view.repaints >= 1); view.repaints = 0; // Make sure QGraphicsScene::update only requires one event-loop iteration // before the view is updated. scene.update(); qApp->processEvents(); - QCOMPARE(view.repaints, 1); + QTRY_COMPARE(view.repaints, 1); view.repaints = 0; // The same for partial scene updates. diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp index e8979ea..b407fef 100644 --- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp +++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp @@ -159,7 +159,11 @@ void tst_QGraphicsTransform::scale() // definitions correct for the difference. static inline bool fuzzyCompare(qreal p1, qreal p2) { - return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2))); + // increase delta on small machines using float instead of double + if (sizeof(qreal) == sizeof(float)) + return (qAbs(p1 - p2) <= 0.00002f * qMin(qAbs(p1), qAbs(p2))); + else + return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2))); } static bool fuzzyCompare(const QTransform& t1, const QTransform& t2) { diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 726ca55..4eb149f 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -812,6 +812,9 @@ public: void tst_QMenu::task258920_mouseBorder() { +#ifdef Q_OS_WINCE_WM + QSKIP("Mouse move related signals for Windows Mobile unavailable", SkipAll); +#endif Menu258920 menu; QAction *action = menu.addAction("test"); diff --git a/tests/auto/qsound/qsound.pro b/tests/auto/qsound/qsound.pro index c48d50d..383a085 100644 --- a/tests/auto/qsound/qsound.pro +++ b/tests/auto/qsound/qsound.pro @@ -4,7 +4,7 @@ SOURCES += tst_qsound.cpp wince*|symbian*: { deploy.sources += 4.wav DEPLOYMENT = deploy - DEFINES += SRCDIR=\\\"\\\" + !symbian:DEFINES += SRCDIR=\\\"\\\" } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" } diff --git a/tests/auto/qsound/tst_qsound.cpp b/tests/auto/qsound/tst_qsound.cpp index dd5f2ce..fdbf6a2 100644 --- a/tests/auto/qsound/tst_qsound.cpp +++ b/tests/auto/qsound/tst_qsound.cpp @@ -43,6 +43,10 @@ #include <QtTest/QtTest> #include <QtGui> +#if defined(Q_OS_SYMBIAN) +#define SRCDIR "" +#endif + class tst_QSound : public QObject { Q_OBJECT diff --git a/tests/auto/qspinbox/tst_qspinbox.cpp b/tests/auto/qspinbox/tst_qspinbox.cpp index 4829b6b..2389060 100644 --- a/tests/auto/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/qspinbox/tst_qspinbox.cpp @@ -980,26 +980,28 @@ void tst_QSpinBox::sizeHint() sizeHint_SpinBox *spinBox = new sizeHint_SpinBox; layout->addWidget(spinBox); widget->show(); - QTest::qWait(100); + QTest::qWaitForWindowShown(widget); // Prefix spinBox->sizeHintRequests = 0; spinBox->setPrefix(QLatin1String("abcdefghij")); qApp->processEvents(); - QVERIFY(spinBox->sizeHintRequests > 0); + QTRY_VERIFY(spinBox->sizeHintRequests > 0); // Suffix spinBox->sizeHintRequests = 0; spinBox->setSuffix(QLatin1String("abcdefghij")); qApp->processEvents(); - QVERIFY(spinBox->sizeHintRequests > 0); + QTRY_VERIFY(spinBox->sizeHintRequests > 0); // Range spinBox->sizeHintRequests = 0; spinBox->setRange(0, 1234567890); spinBox->setValue(spinBox->maximum()); qApp->processEvents(); - QVERIFY(spinBox->sizeHintRequests > 0); + QTRY_VERIFY(spinBox->sizeHintRequests > 0); + + delete widget; } QTEST_MAIN(tst_QSpinBox) diff --git a/tests/auto/qsqlrecord/qsqlrecord.pro b/tests/auto/qsqlrecord/qsqlrecord.pro index 7a72075..f36f076 100644 --- a/tests/auto/qsqlrecord/qsqlrecord.pro +++ b/tests/auto/qsqlrecord/qsqlrecord.pro @@ -9,11 +9,11 @@ symbian { DEPLOYMENT += sqlite } } -} -TARGET.EPOCSTACKSIZE=50000 -TARGET.EPOCHEAPSIZE=50000 5000000 + TARGET.EPOCSTACKSIZE=50000 + TARGET.EPOCHEAPSIZE=50000 5000000 } + QT += sql diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index 4bf7c2e..bb0e226 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -3412,6 +3412,12 @@ void tst_QTableView::mouseWheel() QFETCH(int, horizontalPositon); QFETCH(int, verticalPosition); + if (scrollMode == int(QAbstractItemView::ScrollPerPixel)) + { +#ifdef Q_OS_WINCE + QSKIP("Since different Windows CE versions sport different taskbars, we skip this test", SkipSingle); +#endif + } QtTestTableModel model(100, 100); QtTestTableView view; view.resize(500, 500); diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index 5ccae94..fe87dfb 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -1085,10 +1085,6 @@ QT_END_NAMESPACE void tst_QTextLayout::testTabDPIScale() { - #ifdef Q_OS_WINCE - QSKIP("This test fails for large DPIs.", SkipAll); - #endif - class MyPaintDevice : public QPaintDevice { QPaintEngine *paintEngine () const { return 0; } int metric (QPaintDevice::PaintDeviceMetric metric) const { @@ -1118,14 +1114,14 @@ void tst_QTextLayout::testTabDPIScale() QTextOption option = layout.textOption(); QList<QTextOption::Tab> tabs; QTextOption::Tab tab; - tab.position = 100; + tab.position = 200; tabs.append(tab); - tab.position = 200; + tab.position = 400; tab.type = QTextOption::RightTab; tabs.append(tab); - tab.position = 300; + tab.position = 600; tab.type = QTextOption::CenterTab; tabs.append(tab); option.setTabs(tabs); @@ -1133,7 +1129,7 @@ void tst_QTextLayout::testTabDPIScale() layout.beginLayout(); QTextLine line = layout.createLine(); - line.setLineWidth(500.); + line.setLineWidth(1500.); layout.endLayout(); QCOMPARE(line.cursorToX(0), 0.); QCOMPARE(line.cursorToX(1), (double) TESTFONT_SIZE); // check that the font does not resize @@ -1142,9 +1138,9 @@ void tst_QTextLayout::testTabDPIScale() int fixedScale = (int)( scale * qreal(64)); // into a QFixed scale = ((qreal)fixedScale)/(qreal)64; // and out of a QFixed - QCOMPARE(line.cursorToX(6), 100 * scale); - QCOMPARE(line.cursorToX(12), 200 * scale - TESTFONT_SIZE * 5); - QCOMPARE(line.cursorToX(18), 300 * scale - TESTFONT_SIZE * 3 / 2.0); + QCOMPARE(line.cursorToX(6), tabs.at(0).position * scale); + QCOMPARE(line.cursorToX(12), tabs.at(1).position * scale - TESTFONT_SIZE * 5); + QCOMPARE(line.cursorToX(18), tabs.at(2).position * scale - TESTFONT_SIZE * 3 / 2.0); } void tst_QTextLayout::tabHeight() diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index 0877500..01a6317 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -46,10 +46,6 @@ #include <qtimer.h> #include <qthread.h> - - - - #if defined Q_OS_UNIX #include <unistd.h> #endif @@ -242,7 +238,6 @@ public: // sleep for 2ms QTest::qSleep(2); - killTimer(te->timerId()); } @@ -277,9 +272,11 @@ void tst_QTimer::livelock() #elif defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) QEXPECT_FAIL("zero timer", "", Continue); QEXPECT_FAIL("non-zero timer", "", Continue); -#elif defined(Q_OS_WIN) +#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) if (QSysInfo::WindowsVersion < QSysInfo::WV_XP) QEXPECT_FAIL("non-zero timer", "Multimedia timers are not available on Windows 2000", Continue); +#elif defined(Q_OS_WINCE) + QEXPECT_FAIL("non-zero timer", "Windows CE devices often too slow", Continue); #endif QVERIFY(tester.postEventAtRightTime); } diff --git a/tests/auto/qtoolbar/tst_qtoolbar.cpp b/tests/auto/qtoolbar/tst_qtoolbar.cpp index e4f317c..ac86fd9 100644 --- a/tests/auto/qtoolbar/tst_qtoolbar.cpp +++ b/tests/auto/qtoolbar/tst_qtoolbar.cpp @@ -54,6 +54,8 @@ #include <qtoolbutton.h> #include <qlineedit.h> #include <qkeysequence.h> +#include <qmenu.h> +#include <private/qtoolbarextension_p.h> #include "../../shared/util.h" @@ -569,6 +571,29 @@ void tst_QToolBar::actionGeometry() qt_x11_wait_for_window_manager(&tb); #endif + QList<QToolBarExtension *> extensions = tb.findChildren<QToolBarExtension *>(); + + QRect rect01; + QRect rect02; + QRect rect03; + QRect rect04; + QMenu *popupMenu; + + if (extensions.size() != 0) + { + QToolBarExtension *extension = extensions.at(0); + if (extension->isVisible()) { + QRect rect0 = extension->geometry(); + QTest::mouseClick( extension, Qt::LeftButton, 0, rect0.center(), -1 ); + QApplication::processEvents(); + popupMenu = qobject_cast<QMenu *>(extension->menu()); + rect01 = popupMenu->actionGeometry(&action1); + rect02 = popupMenu->actionGeometry(&action2); + rect03 = popupMenu->actionGeometry(&action3); + rect04 = popupMenu->actionGeometry(&action4); + } + } + QRect rect1 = tb.actionGeometry(&action1); QRect rect2 = tb.actionGeometry(&action2); QRect rect3 = tb.actionGeometry(&action3); @@ -590,10 +615,25 @@ void tst_QToolBar::actionGeometry() QVERIFY(!rect4.isNull()); QVERIFY(!rect4.isEmpty()); - QCOMPARE(tb.actionAt(rect1.center()), &action1); - QCOMPARE(tb.actionAt(rect2.center()), &action2); - QCOMPARE(tb.actionAt(rect3.center()), &action3); - QCOMPARE(tb.actionAt(rect4.center()), &action4); + if (rect01.isValid()) + QCOMPARE(popupMenu->actionAt(rect01.center()), &action1); + else + QCOMPARE(tb.actionAt(rect1.center()), &action1); + + if (rect02.isValid()) + QCOMPARE(popupMenu->actionAt(rect02.center()), &action2); + else + QCOMPARE(tb.actionAt(rect2.center()), &action2); + + if (rect03.isValid()) + QCOMPARE(popupMenu->actionAt(rect03.center()), &action3); + else + QCOMPARE(tb.actionAt(rect3.center()), &action3); + + if (rect04.isValid()) + QCOMPARE(popupMenu->actionAt(rect04.center()), &action4); + else + QCOMPARE(tb.actionAt(rect4.center()), &action4); } void tst_QToolBar::actionAt() @@ -864,33 +904,82 @@ void tst_QToolBar::actionTriggered() qt_x11_wait_for_window_manager(&tb); #endif + QList<QToolBarExtension *> extensions = tb.findChildren<QToolBarExtension *>(); + + QRect rect01; + QRect rect02; + QRect rect03; + QRect rect04; + QMenu *popupMenu; + + if (extensions.size() != 0) + { + QToolBarExtension *extension = extensions.at(0); + if (extension->isVisible()) { + QRect rect0 = extension->geometry(); + QTest::mouseClick( extension, Qt::LeftButton, 0, rect0.center(), -1 ); + QApplication::processEvents(); + popupMenu = qobject_cast<QMenu *>(extension->menu()); + rect01 = popupMenu->actionGeometry(&action1); + rect02 = popupMenu->actionGeometry(&action2); + rect03 = popupMenu->actionGeometry(&action3); + rect04 = popupMenu->actionGeometry(&action4); + } + } + QRect rect1 = tb.actionGeometry(&action1); QRect rect2 = tb.actionGeometry(&action2); QRect rect3 = tb.actionGeometry(&action3); QRect rect4 = tb.actionGeometry(&action4); - QAbstractButton *button1 = qobject_cast<QAbstractButton *>(tb.childAt(rect1.center())); - QAbstractButton *button2 = qobject_cast<QAbstractButton *>(tb.childAt(rect2.center())); - QAbstractButton *button3 = qobject_cast<QAbstractButton *>(tb.childAt(rect3.center())); - QAbstractButton *button4 = qobject_cast<QAbstractButton *>(tb.childAt(rect4.center())); - QVERIFY(button1 != 0); - QVERIFY(button2 != 0); - QVERIFY(button3 != 0); - QVERIFY(button4 != 0); + + QAbstractButton *button1; + QAbstractButton *button2; + QAbstractButton *button3; + QAbstractButton *button4; + + if (!rect01.isValid()) { + button1 = qobject_cast<QAbstractButton *>(tb.childAt(rect1.center())); + QVERIFY(button1 != 0); + } + if (!rect02.isValid()) { + button2 = qobject_cast<QAbstractButton *>(tb.childAt(rect2.center())); + QVERIFY(button2 != 0); + } + if (!rect03.isValid()) { + button3 = qobject_cast<QAbstractButton *>(tb.childAt(rect3.center())); + QVERIFY(button3 != 0); + } + if (!rect04.isValid()) { + button4 = qobject_cast<QAbstractButton *>(tb.childAt(rect4.center())); + QVERIFY(button4 != 0); + } ::triggered = 0; - QTest::mouseClick(button1, Qt::LeftButton); + if (!rect01.isValid()) + QTest::mouseClick(button1, Qt::LeftButton); + else + QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect01.center(), -1 ); QCOMPARE(::triggered, &action1); ::triggered = 0; - QTest::mouseClick(button2, Qt::LeftButton); + if (!rect02.isValid()) + QTest::mouseClick(button2, Qt::LeftButton); + else + QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect02.center(), -1 ); QCOMPARE(::triggered, &action2); ::triggered = 0; - QTest::mouseClick(button3, Qt::LeftButton); + if (!rect03.isValid()) + QTest::mouseClick(button3, Qt::LeftButton); + else + QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect03.center(), -1 ); QCOMPARE(::triggered, &action3); ::triggered = 0; - QTest::mouseClick(button4, Qt::LeftButton); + if (!rect04.isValid()) + QTest::mouseClick(button4, Qt::LeftButton); + else + QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect04.center(), -1 ); QCOMPARE(::triggered, &action4); } @@ -977,7 +1066,7 @@ void tst_QToolBar::accel() mw.show(); QApplication::setActiveWindow(&mw); QTest::qWait(100); - QTRY_COMPARE(QApplication::activeWindow(), &mw); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&mw)); QTest::keyClick(&mw, Qt::Key_T, Qt::AltModifier); QTest::qWait(300); diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp index 1a2de65..579f4eb 100644 --- a/tests/auto/selftests/tst_selftests.cpp +++ b/tests/auto/selftests/tst_selftests.cpp @@ -299,7 +299,7 @@ void tst_Selftests::runSubTest() void tst_Selftests::initTestCase() { -#ifndef Q_OS_UNIX +#if !defined(Q_OS_UNIX) || defined(Q_WS_MAC) m_checkXMLBlacklist.append("crashes"); // This test crashes (XML valid on Unix only) #endif m_checkXMLBlacklist.append("waitwithoutgui"); // This test is not a QTestLib test. |