diff options
author | Janne Koskinen <janne.p.koskinen@digia.com> | 2009-09-28 11:58:22 (GMT) |
---|---|---|
committer | Janne Koskinen <janne.p.koskinen@digia.com> | 2009-09-28 11:58:22 (GMT) |
commit | e058304cc2adc1115ccc3c557b3a16c6e1c1fa86 (patch) | |
tree | 28c0c97839a95e974728857b50a5afbffeec7d11 /tests | |
parent | e1c95146e889a33108a4b3013ba64a4d15414e87 (diff) | |
parent | db032c025f56d2137b96e49fd817cae35dd5c8a3 (diff) | |
download | Qt-e058304cc2adc1115ccc3c557b3a16c6e1c1fa86.zip Qt-e058304cc2adc1115ccc3c557b3a16c6e1c1fa86.tar.gz Qt-e058304cc2adc1115ccc3c557b3a16c6e1c1fa86.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qcombobox/tst_qcombobox.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qlabel/tst_qlabel.cpp | 15 | ||||
-rw-r--r-- | tests/auto/qmdiarea/tst_qmdiarea.cpp | 30 | ||||
-rw-r--r-- | tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp | 6 | ||||
-rw-r--r-- | tests/auto/qsharedmemory/qsystemlock/qsystemlock.pro | 4 | ||||
-rw-r--r-- | tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp | 9 | ||||
-rw-r--r-- | tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp | 36 | ||||
-rw-r--r-- | tests/auto/qstatemachine/tst_qstatemachine.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qtableview/tst_qtableview.cpp | 1 | ||||
-rw-r--r-- | tests/auto/qwidget/tst_qwidget.cpp | 20 | ||||
-rw-r--r-- | tests/auto/qwindowsurface/tst_qwindowsurface.cpp | 2 |
12 files changed, 86 insertions, 49 deletions
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index be1cb98..61aabaa 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -2125,15 +2125,17 @@ void tst_QComboBox::task248169_popupWithMinimalSize() comboBox.setGeometry(desktopSize.width() - (desktopSize.width() / 4), (desktopSize.width() / 4), (desktopSize.width() / 2), (desktopSize.width() / 4)); comboBox.show(); + QTest::qWaitForWindowShown(&comboBox); QTRY_VERIFY(comboBox.isVisible()); comboBox.showPopup(); QTRY_VERIFY(comboBox.view()); + QTest::qWaitForWindowShown(comboBox.view()); QTRY_VERIFY(comboBox.view()->isVisible()); #ifdef QT_BUILD_INTERNAL QFrame *container = qFindChild<QComboBoxPrivateContainer *>(&comboBox); QVERIFY(container); - QVERIFY(desktop.screenGeometry(container).contains(container->geometry())); + QTRY_VERIFY(desktop.screenGeometry(container).contains(container->geometry())); #endif } diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index 9c58b24..4e46819 100644 --- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -143,9 +143,11 @@ public: // It is only called once. void tst_QGraphicsLinearLayout::initTestCase() { -#ifndef Q_WS_S60 // since the style will influence the results, we have to ensure // that the tests are run using the same style on all platforms +#ifdef Q_WS_S60 + QApplication::setStyle(new QWindowsStyle); +#else QApplication::setStyle(new QPlastiqueStyle); #endif } diff --git a/tests/auto/qlabel/tst_qlabel.cpp b/tests/auto/qlabel/tst_qlabel.cpp index 8a5e344..dd03ef3 100644 --- a/tests/auto/qlabel/tst_qlabel.cpp +++ b/tests/auto/qlabel/tst_qlabel.cpp @@ -57,6 +57,8 @@ # define SRCDIR "" #endif +#include "../../shared/util.h" + class Widget : public QWidget { public: @@ -102,11 +104,11 @@ private slots: void eventPropagation_data(); void eventPropagation(); void focusPolicy(); - + void task190318_sizes(); void sizeHint(); - + void task226479_movieResize(); void emptyPixmap(); @@ -413,16 +415,17 @@ void tst_QLabel::task226479_movieResize() paintedRegion += e->region(); QLabel::paintEvent(e); } - + public: QRegion paintedRegion; }; - + Label label; label.resize(350,350); label.show(); QMovie *movie = new QMovie( &label ); label.setMovie(movie); + QTest::qWaitForWindowShown(&label); movie->setFileName(SRCDIR "red.png"); movie->start(); QTest::qWait(50); @@ -431,8 +434,8 @@ void tst_QLabel::task226479_movieResize() movie->setFileName(SRCDIR "green.png"); movie->start(); QTest::qWait(50); - - QCOMPARE(label.paintedRegion , QRegion(label.rect()) ); + + QTRY_COMPARE(label.paintedRegion , QRegion(label.rect()) ); } void tst_QLabel::emptyPixmap() diff --git a/tests/auto/qmdiarea/tst_qmdiarea.cpp b/tests/auto/qmdiarea/tst_qmdiarea.cpp index 65f1937..b110114 100644 --- a/tests/auto/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/qmdiarea/tst_qmdiarea.cpp @@ -639,9 +639,7 @@ void tst_QMdiArea::changeWindowTitle() mw->setCentralWidget( ws ); mw->menuBar(); mw->show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(mw); -#endif + QTest::qWaitForWindowShown(mw); QWidget *widget = new QWidget( ws ); widget->setWindowTitle( wc ); @@ -655,22 +653,17 @@ void tst_QMdiArea::changeWindowTitle() widget->setWindowState(Qt::WindowMaximized); #endif #if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) - QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); + QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); #endif mw->hide(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(mw); -#endif qApp->processEvents(); mw->show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(mw); -#endif qApp->processEvents(); + QTest::qWaitForWindowShown(mw); #if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) - QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); + QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); #endif #ifdef USE_SHOW @@ -688,7 +681,7 @@ void tst_QMdiArea::changeWindowTitle() #endif qApp->processEvents(); #if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) - QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); + QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); widget->setWindowTitle( wc2 ); QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc2) ); mw->setWindowTitle( mwc2 ); @@ -1697,11 +1690,8 @@ void tst_QMdiArea::tileSubWindows() workspace.setActiveSubWindow(windows.at(5)); workspace.resize(workspace.size() - QSize(10, 10)); workspace.setActiveSubWindow(0); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&workspace); -#endif QTest::qWait(250); // delayed re-arrange of minimized windows - QCOMPARE(workspace.viewport()->childrenRect(), workspace.viewport()->rect()); + QTRY_COMPARE(workspace.viewport()->childrenRect(), workspace.viewport()->rect()); // Add another window and verify that the views are not tiled anymore. workspace.addSubWindow(new QPushButton(QLatin1String("I'd like to mess up tiled views")))->show(); @@ -1732,9 +1722,6 @@ void tst_QMdiArea::tileSubWindows() // Verify that we try to resize the area such that all sub-windows are visible. // It's important that tiled windows are NOT overlapping. workspace.resize(350, 150); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&workspace); -#endif qApp->processEvents(); QTRY_COMPARE(workspace.size(), QSize(350, 150)); @@ -1761,13 +1748,10 @@ void tst_QMdiArea::tileSubWindows() #ifdef Q_OS_WINCE QSKIP("Not fixed yet! See task 197453", SkipAll); #endif - QCOMPARE(workspace.viewport()->rect().size(), expectedViewportSize); + QTRY_COMPARE(workspace.viewport()->rect().size(), expectedViewportSize); // Not enough space for all sub-windows to be visible -> provide scroll bars. workspace.resize(150, 150); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&workspace); -#endif qApp->processEvents(); QTRY_COMPARE(workspace.size(), QSize(150, 150)); diff --git a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp index d5d125a..b897d8f 100644 --- a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp @@ -1648,9 +1648,9 @@ void tst_QMdiSubWindow::resizeTimer() QMdiArea mdiArea; QMdiSubWindow *subWindow = mdiArea.addSubWindow(new QWidget); mdiArea.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&mdiArea); -#endif + QTest::qWaitForWindowShown(&mdiArea); + QTest::qWait(250); + EventSpy timerEventSpy(subWindow, QEvent::Timer); QCOMPARE(timerEventSpy.count(), 0); diff --git a/tests/auto/qsharedmemory/qsystemlock/qsystemlock.pro b/tests/auto/qsharedmemory/qsystemlock/qsystemlock.pro index 2628f19..e232443 100644 --- a/tests/auto/qsharedmemory/qsystemlock/qsystemlock.pro +++ b/tests/auto/qsharedmemory/qsystemlock/qsystemlock.pro @@ -5,9 +5,9 @@ include(../src/src.pri) win32: CONFIG += console mac:CONFIG -= app_bundle -wince*|symbian { +wince* { DEFINES += SRCDIR=\\\"\\\" -} else { +} else:!symbian { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp b/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp index 87fc3ee..35f05d1 100644 --- a/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp +++ b/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp @@ -46,6 +46,13 @@ //TESTED_CLASS= //TESTED_FILES= +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +// And underlying Open C have application private dir in default search path +#define SRCDIR "" +#endif + + #define EXISTING_SHARE "existing" class tst_QSystemLock : public QObject @@ -223,7 +230,7 @@ void tst_QSystemLock::processes() QCOMPARE(consumers.first()->exitCode(), 0); delete consumers.takeFirst(); } - QCOMPARE(failedProcesses, unsigned int(0)); + QCOMPARE(failedProcesses, (unsigned int)(0)); } QTEST_MAIN(tst_QSystemLock) diff --git a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp index 81ef498..8788117 100644 --- a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp +++ b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp @@ -42,6 +42,8 @@ #include <QtTest/QtTest> #include "qevent.h" +#include "qdialog.h" +#include "qdialogbuttonbox.h" #include "private/qsoftkeymanager_p.h" class tst_QSoftKeyManager : public QObject @@ -59,6 +61,7 @@ public slots: void cleanup(); private slots: void updateSoftKeysCompressed(); + void handleCommand(); }; class EventListener : public QObject @@ -133,6 +136,39 @@ void tst_QSoftKeyManager::updateSoftKeysCompressed() QVERIFY(listener.numUpdateSoftKeys == 1); } +/* + This tests that when the S60 environment sends us a command + that it actually gets mapped to the correct action. +*/ +void tst_QSoftKeyManager::handleCommand() +{ + QDialog w; + QDialogButtonBox *buttons = new QDialogButtonBox( + QDialogButtonBox::Ok | QDialogButtonBox::Cancel, + Qt::Horizontal, + &w); + + w.show(); + QApplication::processEvents(); + + QCOMPARE(w.actions().count(), 2); + + QSignalSpy spy0(w.actions()[0], SIGNAL(triggered())); + QSignalSpy spy1(w.actions()[1], SIGNAL(triggered())); + + // These should work eventually, but do not yet +// QTest::keyPress(&w, Qt::Key_Context1); +// QTest::keyPress(&w, Qt::Key_Context2); + + qApp->symbianHandleCommand(6000); + qApp->symbianHandleCommand(6001); + + QApplication::processEvents(); + + QCOMPARE(spy0.count(), 1); + QCOMPARE(spy1.count(), 1); +} + QTEST_MAIN(tst_QSoftKeyManager) #include "tst_qsoftkeymanager.moc" diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index a3f2f54..1fae92b 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -1754,7 +1754,7 @@ protected: bool eventTest(QEvent *e) { if (!QSignalTransition::eventTest(e)) return false; - QSignalEvent *se = static_cast<QSignalEvent*>(e); + QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e); const_cast<TestSignalTransition*>(this)->m_args = se->arguments(); return true; } @@ -3954,7 +3954,7 @@ public: void onTransition(QEvent *e) { QSignalTransition::onTransition(e); - QSignalEvent *se = static_cast<QSignalEvent*>(e); + QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e); eventSignalIndex = se->signalIndex(); } diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index f5d5040..71218a3 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -2339,6 +2339,7 @@ void tst_QTableView::scrollTo() // resizing to this size will ensure that there can ONLY_BE_ONE_CELL inside the view. QSize forcedSize(columnWidth * 2, rowHeight * 2); view.resize(forcedSize); + QTest::qWaitForWindowShown(&view); QTest::qWait(0); QTRY_COMPARE(view.size(), forcedSize); diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 4536ed7..a9fa9bc 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -1756,11 +1756,11 @@ void tst_QWidget::setTabOrder() container.show(); container.activateWindow(); + qApp->setActiveWindow(&container); #ifdef Q_WS_X11 QTest::qWaitForWindowShown(&container); QTest::qWait(50); #endif - qApp->setActiveWindow(&container); QTest::qWait(100); @@ -2316,8 +2316,9 @@ void tst_QWidget::showMinimizedKeepsFocus() QTRY_COMPARE(qApp->focusWidget(), static_cast<QWidget*>(0)); window.showNormal(); - QTest::qWait(30); qApp->setActiveWindow(&window); + QTest::qWaitForWindowShown(&window); + QTest::qWait(30); #ifdef Q_WS_MAC if (!macHasAccessToWindowsServer()) QEXPECT_FAIL("", "When not having WindowServer access, we lose focus.", Continue); @@ -3116,7 +3117,7 @@ void tst_QWidget::saveRestoreGeometry() widget.resize(size); widget.show(); QTest::qWaitForWindowShown(&widget); - QTest::qWait(100); + QTest::qWait(200); QTRY_COMPARE(widget.geometry().size(), size); QRect geom; @@ -3126,15 +3127,15 @@ void tst_QWidget::saveRestoreGeometry() geom = widget.geometry(); widget.setWindowState(widget.windowState() | Qt::WindowFullScreen); QTRY_VERIFY((widget.windowState() & Qt::WindowFullScreen)); - QTest::qWait(100); + QTest::qWait(200); QVERIFY(widget.restoreGeometry(savedGeometry)); - QTest::qWait(20); + QTest::qWait(120); QTRY_VERIFY(!(widget.windowState() & Qt::WindowFullScreen)); QTRY_COMPARE(widget.geometry(), geom); //Restore to full screen widget.setWindowState(widget.windowState() | Qt::WindowFullScreen); - QTest::qWait(20); + QTest::qWait(120); QTRY_VERIFY((widget.windowState() & Qt::WindowFullScreen)); QTest::qWait(200); savedGeometry = widget.saveGeometry(); @@ -3165,7 +3166,7 @@ void tst_QWidget::saveRestoreGeometry() QTest::qWait(20); QTRY_VERIFY((widget.windowState() & Qt::WindowMaximized)); QTRY_VERIFY(widget.geometry() != geom); - QTest::qWait(100); + QTest::qWait(200); QVERIFY(widget.restoreGeometry(savedGeometry)); QTest::qWait(20); QTRY_COMPARE(widget.geometry(), geom); @@ -5388,7 +5389,7 @@ void tst_QWidget::showAndMoveChild() child.move(desktopDimensions.width()/2, desktopDimensions.height()/2); qApp->processEvents(); - verifyColor(child.geometry().translated(tlwOffset), Qt::blue); + verifyColor(child.geometry().translated(tlwOffset), Qt::blue); verifyColor(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset), Qt::red); } @@ -6407,7 +6408,7 @@ void tst_QWidget::render() qApp->processEvents(); qApp->sendPostedEvents(); - QTest::qWait(100); + QTest::qWait(250); QImage sourceImage = QPixmap::grabWidget(&source).toImage(); qApp->processEvents(); @@ -6513,6 +6514,7 @@ void tst_QWidget::renderInvisible() dummyFocusWidget.show(); QTest::qWaitForWindowShown(&dummyFocusWidget); qApp->processEvents(); + QTest::qWait(100); // Create normal reference image. const QSize calendarSize = calendar->size(); diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp index 2c5ba72..0a6b7ad 100644 --- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp +++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp @@ -230,7 +230,7 @@ void tst_QWindowSurface::grabWidget() parentWidget.show(); QTest::qWaitForWindowShown(&parentWidget); - QTest::qWait(20); + QTest::qWait(120); QPixmap parentPixmap = parentWidget.windowSurface()->grabWidget(&parentWidget); QPixmap childPixmap = childWidget.windowSurface()->grabWidget(&childWidget); |