diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-03 09:30:35 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-03 09:30:35 (GMT) |
commit | 76b78a7a79d63273edd7db10041fc36d4fa21cd7 (patch) | |
tree | 74a2939306e67ea25291bffaff06c783dd916051 | |
parent | 69ab0cd2b51a86fe27c92c7c18390f6791939b53 (diff) | |
parent | 561aeb6b8f7bc4ddb5e6d3e5cbc0ddc9cd344aa9 (diff) | |
download | Qt-76b78a7a79d63273edd7db10041fc36d4fa21cd7.zip Qt-76b78a7a79d63273edd7db10041fc36d4fa21cd7.tar.gz Qt-76b78a7a79d63273edd7db10041fc36d4fa21cd7.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-multimedia-staging into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-multimedia-staging: (52 commits)
Fix crash
fix isLikelyToBeNfs usage
Export isLikelyToBeNfs only if we have an internal build
Fixed QGraphicsView autotest to use a dummy toplevel widget
Fixed QMdiArea autotest to use a dummy toplevel widget.
Fixed QMenuBar autotest. Changed window activation order.
Fixed QStyleSheetStyle autotest to use a dummy toplevel widget
Fixed QPathCliper autotest, to skip a test when qreal != double
Fixed QComboBox autotest to use a dummy toplevel widget
Fixed QColumnView autotest. Added an QApplication::processEvents
Fixed QAccessability autotest to use a dummy toplevel widget
Fix QListWidget test
Fix QGraphicsItems autotest
Fixed QGraphicsScene autotest to use a dummy toplevel widget
Fixed QGraphicsItem autotest to use a dummy toplevel widget
Fixed QListView autotest to use a dummy toplevel widget
Fixed QMenu autotest to use a dummy toplevel widget
Fixed QMenuBar autotest. Added mainwindow activation
Fixed QString autotest when QT_QLOCALE_USES_FCVT is set
Fixed QButtonGroup autotest to run on Maemo
...
45 files changed, 613 insertions, 220 deletions
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 8ee42e7..c94ec7b 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -88,6 +88,12 @@ #define CSIDL_APPDATA 0x001a // <username>\Application Data #endif +#ifdef Q_AUTOTEST_EXPORT +# define Q_AUTOTEST_EXPORT_HELPER Q_AUTOTEST_EXPORT +#else +# define Q_AUTOTEST_EXPORT_HELPER static +#endif + // ************************************************************************ // QConfFile @@ -134,7 +140,7 @@ QT_BEGIN_INCLUDE_NAMESPACE # include <sys/mount.h> QT_END_INCLUDE_NAMESPACE -static bool isLikelyToBeNfs(int handle) +Q_AUTOTEST_EXPORT_HELPER bool isLikelyToBeNfs(int handle) { struct statfs buf; if (fstatfs(handle, &buf) != 0) @@ -160,7 +166,7 @@ QT_END_INCLUDE_NAMESPACE # define AUTOFSNG_SUPER_MAGIC 0x7d92b1a0 # endif -static bool isLikelyToBeNfs(int handle) +Q_AUTOTEST_EXPORT_HELPER bool isLikelyToBeNfs(int handle) { struct statfs buf; if (fstatfs(handle, &buf) != 0) @@ -177,7 +183,7 @@ QT_BEGIN_INCLUDE_NAMESPACE # include <sys/statvfs.h> QT_END_INCLUDE_NAMESPACE -static bool isLikelyToBeNfs(int handle) +Q_AUTOTEST_EXPORT_HELPER bool isLikelyToBeNfs(int handle) { struct statvfs buf; if (fstatvfs(handle, &buf) != 0) @@ -189,7 +195,7 @@ static bool isLikelyToBeNfs(int handle) #endif } #else -static inline bool isLikelyToBeNfs(int /* handle */) +Q_AUTOTEST_EXPORT_HELPER inline bool isLikelyToBeNfs(int /* handle */) { return true; } diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 6c4004e..a4ae46b 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -1430,10 +1430,18 @@ QStyle *QApplication::style() // Compile-time search for default style // QString style; - if (!QApplicationPrivate::styleOverride.isEmpty()) +#ifdef QT_BUILD_INTERNAL + QString envStyle = QString::fromLocal8Bit(qgetenv("QT_STYLE_OVERRIDE")); +#else + QString envStyle; +#endif + if (!QApplicationPrivate::styleOverride.isEmpty()) { style = QApplicationPrivate::styleOverride; - else + } else if (!envStyle.isEmpty()) { + style = envStyle; + } else { style = QApplicationPrivate::desktopStyleKey(); + } QStyle *&app_style = QApplicationPrivate::app_style; app_style = QStyleFactory::create(style); diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index a4cc5a3..7c68170 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -2334,6 +2334,30 @@ void qt_init(QApplicationPrivate *priv, int, X11->desktopEnvironment = DE_4DWM; break; } + + if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), + ATOM(_NET_SUPPORTING_WM_CHECK), + 0, 1024, False, XA_WINDOW, &type, + &format, &length, &after, &data) == Success) { + if (type == XA_WINDOW && format == 32) { + Window windowManagerWindow = *((Window*) data); + XFree(data); + data = 0; + + if (windowManagerWindow != XNone) { + Atom utf8atom = ATOM(UTF8_STRING); + if (XGetWindowProperty(QX11Info::display(), windowManagerWindow, ATOM(_NET_WM_NAME), + 0, 1024, False, utf8atom, &type, + &format, &length, &after, &data) == Success) { + if (type == utf8atom && format == 8) { + if (qstrcmp((const char *)data, "MCompositor") == 0) + X11->desktopEnvironment = DE_MEEGO_COMPOSITOR; + } + } + } + } + } + } while(0); if (data) diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h index d62d9c3..56c8094 100644 --- a/src/gui/kernel/qt_x11_p.h +++ b/src/gui/kernel/qt_x11_p.h @@ -338,6 +338,7 @@ enum DesktopEnvironment { DE_KDE, DE_GNOME, DE_CDE, + DE_MEEGO_COMPOSITOR, DE_4DWM }; diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index bc5a025..d9d5918 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -426,7 +426,8 @@ template<> void QSharedDataPointer<QNetworkProxyPrivate>::detach() QNetworkProxy::QNetworkProxy() : d(0) { - globalNetworkProxy()->init(); + if (QGlobalNetworkProxy *globalProxy = globalNetworkProxy()) + globalProx->init(); } /*! @@ -441,7 +442,8 @@ QNetworkProxy::QNetworkProxy(ProxyType type, const QString &hostName, quint16 po const QString &user, const QString &password) : d(new QNetworkProxyPrivate(type, hostName, port, user, password)) { - globalNetworkProxy()->init(); + if (QGlobalNetworkProxy *globalProxy = globalNetworkProxy()) + globalProx->init(); } /*! diff --git a/tests/auto/platformquirks.h b/tests/auto/platformquirks.h new file mode 100644 index 0000000..06d23d7 --- /dev/null +++ b/tests/auto/platformquirks.h @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PLATFORMQUIRKS_H +#define PLATFORMQUIRKS_H + +#include <qglobal.h> + +#ifdef QT_GUI_LIB +#include <qapplication.h> +#endif + +#ifdef Q_WS_X11 +#include <private/qt_x11_p.h> +#endif + +struct PlatformQuirks +{ + enum MediaFileTypes + { + mp3, + wav, + ogg + }; + + /* On some platforms, libpng or libjpeg sacrifice precision for speed. + Esp. with NEON support, color values after decoding can be off by up + to three bytes. + */ + static inline bool isImageLoaderImprecise() + { +#ifdef Q_WS_MAEMO_5 + return true; +#elif defined(Q_WS_X11) + // ### this is a very bad assumption, we should really check the version of libjpeg + return X11->desktopEnvironment == DE_MEEGO_COMPOSITOR; +#else + return false; +#endif + } + + /* Some windowing systems automatically maximize apps on startup (e.g. Maemo) + "Normal" fixed-sized windows do not work, the WM ignores their size settings. + */ + static inline bool isAutoMaximizing() + { +#ifdef Q_WS_MAEMO_5 + return true; +#elif defined(Q_WS_X11) + return X11->desktopEnvironment == DE_MEEGO_COMPOSITOR; +#else + return false; +#endif + } + + static inline bool haveMouseCursor() + { +#ifdef Q_WS_MAEMO_5 + return false; +#elif defined(Q_WS_X11) + return X11->desktopEnvironment != DE_MEEGO_COMPOSITOR; +#else + return true; +#endif + } + + /* On some systems an ogg codec is not installed by default. + The autotests have to know which fileType is the default on the system*/ + static inline MediaFileTypes defaultMediaFileType() + { +#ifdef Q_WS_MAEMO_5 + return PlatformQuirks::mp3; +#endif +#ifdef Q_WS_X11 + // ### very bad assumption + if (X11->desktopEnvironment == DE_MEEGO_COMPOSITOR) + return PlatformQuirks::mp3; +#endif + return PlatformQuirks::ogg; + } +}; + +#endif + diff --git a/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp b/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp index da83826..d6c4b53 100644 --- a/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp +++ b/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp @@ -353,12 +353,13 @@ void tst_QAbstractScrollArea::task214488_layoutDirection() void tst_QAbstractScrollArea::patternBackground() { - QScrollArea scrollArea; + QWidget topLevel; + QScrollArea scrollArea(&topLevel); scrollArea.resize(200, 200); QWidget widget; widget.resize(600, 600); scrollArea.setWidget(&widget); - scrollArea.show(); + topLevel.show(); QLinearGradient linearGrad(QPointF(250, 250), QPointF(300, 300)); linearGrad.setColorAt(0, Qt::yellow); diff --git a/tests/auto/qabstractslider/tst_qabstractslider.cpp b/tests/auto/qabstractslider/tst_qabstractslider.cpp index cf069db..cd41d05 100644 --- a/tests/auto/qabstractslider/tst_qabstractslider.cpp +++ b/tests/auto/qabstractslider/tst_qabstractslider.cpp @@ -55,6 +55,8 @@ class Slider : public QAbstractSlider { public: + Slider(QWidget *parent) + : QAbstractSlider(parent) {} using QAbstractSlider::setRepeatAction; using QAbstractSlider::repeatAction; }; @@ -95,6 +97,7 @@ private slots: private: void waitUntilTimeElapsed(const QTime& t, int ms); + QWidget *topLevel; Slider *slider; int previousAction; int reportedMinimum; @@ -113,7 +116,8 @@ Q_DECLARE_METATYPE(QPoint) void tst_QAbstractSlider::initTestCase() { - slider = new Slider; + topLevel = new QWidget; + slider = new Slider(topLevel); slider->setObjectName("testWidget"); slider->resize(100,100); slider->show(); @@ -129,7 +133,7 @@ void tst_QAbstractSlider::initTestCase() void tst_QAbstractSlider::cleanupTestCase() { - delete slider; + delete topLevel; } void tst_QAbstractSlider::actionTriggered(int action) @@ -735,7 +739,6 @@ void tst_QAbstractSlider::wheelEvent_data() << 100 // expected position after #endif << QPoint(1,1); - QTest::newRow("Different orientation") << 0 // initial position << 0 // minimum << 100 // maximum @@ -774,7 +777,6 @@ void tst_QAbstractSlider::wheelEvent_data() #endif << QPoint(0,0); - QTest::newRow("Inverted controls") << 50 // initial position << 0 // minimum << 100 // maximum @@ -924,6 +926,7 @@ void tst_QAbstractSlider::sliderPressedReleased() QFETCH(uint, subControl); QFETCH(int, expectedCount); + QWidget topLevel; QAbstractSlider *slider; switch (control) { default: @@ -931,11 +934,11 @@ void tst_QAbstractSlider::sliderPressedReleased() return; break; case QStyle::CC_Slider: - slider = new QSlider; + slider = new QSlider(&topLevel); slider->setLayoutDirection(Qt::LeftToRight); // Makes "upside down" much easier to compute break; case QStyle::CC_ScrollBar: - slider = new QScrollBar; + slider = new QScrollBar(&topLevel); break; } @@ -949,7 +952,7 @@ void tst_QAbstractSlider::sliderPressedReleased() QSignalSpy spy2(slider, SIGNAL(sliderReleased())); // Mac Style requires the control to be active to get the correct values... - slider->show(); + topLevel.show(); slider->activateWindow(); QStyleOptionSlider option; diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index cea259c..21a530e 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -2269,6 +2269,7 @@ void tst_QAccessibility::scrollBarTest() delete scrollBarInterface; delete scrollBar; + // Test that the rects are ok. { QScrollBar *scrollBar = new QScrollBar(Qt::Horizontal); @@ -2289,7 +2290,6 @@ void tst_QAccessibility::scrollBarTest() const QRect scrollBarRect = scrollBarInterface->rect(0); QVERIFY(scrollBarRect.isValid()); - // Verify that the sub-control rects are valid and inside the scrollBar rect. for (int i = LineUp; i <= LineDown; ++i) { const QRect testRect = scrollBarInterface->rect(i); @@ -3469,14 +3469,15 @@ void tst_QAccessibility::tableWidgetTest() { #ifdef QTEST_ACCESSIBILITY { - QTableWidget *w = new QTableWidget(8,4); + QWidget *topLevel = new QWidget; + QTableWidget *w = new QTableWidget(8,4,topLevel); for (int r = 0; r < 8; ++r) { for (int c = 0; c < 4; ++c) { w->setItem(r, c, new QTableWidgetItem(tr("%1,%2").arg(c).arg(r))); } } w->resize(100, 100); - w->show(); + topLevel->show(); #if defined(Q_WS_X11) qt_x11_wait_for_window_manager(w); QTest::qWait(100); @@ -3503,6 +3504,7 @@ void tst_QAccessibility::tableWidgetTest() delete view; delete client; delete w; + delete topLevel; } QTestAccessibility::clearEvents(); #else diff --git a/tests/auto/qboxlayout/tst_qboxlayout.cpp b/tests/auto/qboxlayout/tst_qboxlayout.cpp index c4acfdc..659f8a5 100644 --- a/tests/auto/qboxlayout/tst_qboxlayout.cpp +++ b/tests/auto/qboxlayout/tst_qboxlayout.cpp @@ -198,7 +198,8 @@ void tst_QBoxLayout::sizeConstraints() void tst_QBoxLayout::setGeometry() { - QWidget w; + QWidget toplevel; + QWidget w(&toplevel); QVBoxLayout *lay = new QVBoxLayout; lay->setMargin(0); lay->setSpacing(0); @@ -209,7 +210,7 @@ void tst_QBoxLayout::setGeometry() lay2->setAlignment(Qt::AlignRight); lay->addLayout(lay2); w.setLayout(lay); - w.show(); + toplevel.show(); QRect newGeom(0, 0, 70, 70); lay2->setGeometry(newGeom); diff --git a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp index a610a7f..1831e5d 100644 --- a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp +++ b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp @@ -396,19 +396,20 @@ void tst_QButtonGroup::task106609() vbox->addWidget(radio2); buttons->addButton(radio3, 3); vbox->addWidget(radio3); - - radio1->setFocus(); - radio1->setChecked(true); dlg.show(); + QTest::qWaitForWindowShown(&dlg); qRegisterMetaType<QAbstractButton*>("QAbstractButton*"); QSignalSpy spy1(buttons, SIGNAL(buttonClicked(QAbstractButton*))); QSignalSpy spy2(buttons, SIGNAL(buttonClicked(int))); - QTestEventLoop::instance().enterLoop(1); QApplication::setActiveWindow(&dlg); QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&dlg)); + radio1->setFocus(); + radio1->setChecked(true); + QTestEventLoop::instance().enterLoop(1); + //qDebug() << "int:" << spy2.count() << "QAbstractButton*:" << spy1.count(); QCOMPARE(spy2.count(), 2); QCOMPARE(spy1.count(), 2); diff --git a/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp b/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp index 042d8e0..01473d8 100644 --- a/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp +++ b/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp @@ -82,7 +82,8 @@ private slots: // Testing get/set functions void tst_QCalendarWidget::getSetCheck() { - QCalendarWidget object; + QWidget topLevel; + QCalendarWidget object(&topLevel); //horizontal header formats object.setHorizontalHeaderFormat(QCalendarWidget::NoHorizontalHeader); @@ -191,7 +192,7 @@ void tst_QCalendarWidget::buttonClickCheck() QCOMPARE(month, object.monthShown()); button = qFindChild<QToolButton *>(&object, "qt_calendar_yearbutton"); - QTest::mouseClick(button, Qt::LeftButton); + QTest::mouseClick(button, Qt::LeftButton, Qt::NoModifier, button->rect().center(), 2); QVERIFY(!button->isVisible()); QSpinBox *spinbox = qFindChild<QSpinBox *>(&object, "qt_calendar_yearedit"); QTest::qWait(500); diff --git a/tests/auto/qcolumnview/tst_qcolumnview.cpp b/tests/auto/qcolumnview/tst_qcolumnview.cpp index 1da8c5d..d4caede 100644 --- a/tests/auto/qcolumnview/tst_qcolumnview.cpp +++ b/tests/auto/qcolumnview/tst_qcolumnview.cpp @@ -398,9 +398,10 @@ void tst_QColumnView::scrollTo() QFETCH(bool, giveFocus); if (reverse) qApp->setLayoutDirection(Qt::RightToLeft); - ColumnView view; + QWidget topLevel; + ColumnView view(&topLevel); view.resize(200, 200); - view.show(); + topLevel.show(); view.scrollTo(QModelIndex(), QAbstractItemView::EnsureVisible); QCOMPARE(view.HorizontalOffset(), 0); @@ -428,6 +429,8 @@ void tst_QColumnView::scrollTo() view.setFocus(Qt::OtherFocusReason); else view.clearFocus(); + + qApp->processEvents(); QTRY_COMPARE(view.hasFocus(), giveFocus); // scroll to the right int level = 0; @@ -718,13 +721,14 @@ void tst_QColumnView::moveGrip() QFETCH(bool, reverse); if (reverse) qApp->setLayoutDirection(Qt::RightToLeft); - ColumnView view; + QWidget topLevel; + ColumnView view(&topLevel); TreeModel model; view.setModel(&model); QModelIndex home = model.thirdLevel(); view.setCurrentIndex(home); view.resize(640, 200); - view.show(); + topLevel.show(); QTest::qWait(ANIMATION_DELAY); int columnNum = view.createdColumns.count() - 2; @@ -741,9 +745,9 @@ void tst_QColumnView::moveGrip() QAbstractItemView *column = qobject_cast<QAbstractItemView *>(grip->parent()); int oldX = column->width(); - QCOMPARE(view.columnWidths()[columnNum], oldX); + QCOMPARE(view.columnWidths().value(columnNum), oldX); grip->moveGrip(10); - QCOMPARE(view.columnWidths()[columnNum], (oldX + (reverse ? -10 : 10))); + QCOMPARE(view.columnWidths().value(columnNum), (oldX + (reverse ? -10 : 10))); } void tst_QColumnView::doubleClick() @@ -889,12 +893,13 @@ void tst_QColumnView::rowDelegate() void tst_QColumnView::resize() { - ColumnView view; + QWidget topLevel; + ColumnView view(&topLevel); QDirModel model; view.setModel(&model); view.resize(200, 200); - view.show(); + topLevel.show(); QModelIndex home = model.index(QDir::homePath()).parent(); view.setCurrentIndex(home); QTest::qWait(ANIMATION_DELAY); diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index 1fcea9e..9614e1e 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -163,7 +163,7 @@ protected slots: private: QComboBox *testWidget; - QDialog *parent; + QWidget *parent; QPushButton* ok; int editTextCount; QString editText; @@ -395,7 +395,7 @@ tst_QComboBox::~tst_QComboBox() void tst_QComboBox::initTestCase() { // Create the test class - parent = new QDialog(0); + parent = new QWidget(0, Qt::Window); parent->setObjectName("parent"); parent->resize(400, 400); testWidget = new QComboBox(parent); @@ -1914,7 +1914,8 @@ void tst_QComboBox::itemListPosition() //we test QFontComboBox because it has the specific behaviour to set a fixed size //to the list view - QFontComboBox combo; + QWidget topLevel; + QFontComboBox combo(&topLevel); //the code to get the avaialbe screen space is copied from QComboBox code const int scrNumber = QApplication::desktop()->screenNumber(&combo); @@ -1932,7 +1933,7 @@ void tst_QComboBox::itemListPosition() combo.move(screen.width()-combo.sizeHint().width(), 0); //puts the combo to the top-right corner - combo.show(); + topLevel.show(); //wait because the window manager can move the window if there is a right panel QTRY_VERIFY(combo.isVisible()); combo.showPopup(); @@ -2254,9 +2255,10 @@ void tst_QComboBox::noScrollbar() qApp->setStyleSheet(stylesheet); { - QComboBox comboBox; + QWidget topLevel; + QComboBox comboBox(&topLevel); comboBox.addItems(initialContent); - comboBox.show(); + topLevel.show(); comboBox.resize(200, comboBox.height()); QTRY_VERIFY(comboBox.isVisible()); comboBox.showPopup(); diff --git a/tests/auto/qeventloop/tst_qeventloop.cpp b/tests/auto/qeventloop/tst_qeventloop.cpp index 8c2ffd9..8331a5f 100644 --- a/tests/auto/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/qeventloop/tst_qeventloop.cpp @@ -431,7 +431,7 @@ void tst_QEventLoop::exec() QCOMPARE(executor.returnCode, -1); } -#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_WINCE_WM) && !defined(Q_OS_SYMBIAN) +#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_WINCE_WM) && !defined(Q_OS_SYMBIAN) && !defined(NO_EVENTLOOP_EXCEPTIONS) // Windows Mobile cannot handle cross library exceptions // qobject.cpp will try to rethrow the exception after handling // which causes gwes.exe to crash diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp index 208110a..910ed97 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp @@ -70,6 +70,8 @@ # define SRCDIR "" #endif +extern Q_AUTOTEST_EXPORT bool isLikelyToBeNfs(int /* handle */); + //TESTED_CLASS= //TESTED_FILES= @@ -939,6 +941,10 @@ void tst_QFileInfo::fileTimes() QEXPECT_FAIL("longfile absolutepath", "Maximum total filepath cannot exceed 256 characters in Symbian", Abort); #endif QVERIFY(file.open(QFile::WriteOnly | QFile::Text)); +#ifdef Q_OS_UNIX + if (isLikelyToBeNfs(file.handle())) + QSKIP("This Test doesn't work on NFS", SkipAll); +#endif QTextStream ts(&file); ts << fileName << endl; } diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index 07fa630..5315cd1 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -51,6 +51,7 @@ #include "../../shared/util.h" #include <private/qgraphicseffect_p.h> +#include "../platformquirks.h" //TESTED_CLASS= //TESTED_FILES= @@ -710,7 +711,10 @@ void tst_QGraphicsEffect::prepareGeometryChangeInvalidateCache() scene.addItem(item); QGraphicsView view(&scene); - view.show(); + if(PlatformQuirks::isAutoMaximizing()) + view.showFullScreen(); + else + view.show(); QTest::qWaitForWindowShown(&view); QTRY_COMPARE(item->nbPaint, 1); diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index a3bd0b0..0b29410 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -94,6 +94,8 @@ Q_DECLARE_METATYPE(QRectF) #define COMPARE_REGIONS QTRY_COMPARE #endif +#include "../platformquirks.h" + static QGraphicsRectItem staticItem; //QTBUG-7629, we should not crash at exit. static void sendMousePress(QGraphicsScene *scene, const QPointF &point, Qt::MouseButton button = Qt::LeftButton) @@ -272,7 +274,7 @@ class MyGraphicsView : public QGraphicsView public: int repaints; QRegion paintedRegion; - MyGraphicsView(QGraphicsScene *scene) : QGraphicsView(scene), repaints(0) {} + MyGraphicsView(QGraphicsScene *scene, QWidget *parent=0) : QGraphicsView(scene,parent), repaints(0) {} void paintEvent(QPaintEvent *e) { paintedRegion += e->region(); @@ -4070,9 +4072,10 @@ void tst_QGraphicsItem::cursor() item1->setCursor(Qt::IBeamCursor); item2->setCursor(Qt::PointingHandCursor); - QGraphicsView view(&scene); + QWidget topLevel; + QGraphicsView view(&scene,&topLevel); view.setFixedSize(200, 100); - view.show(); + topLevel.show(); QTest::mouseMove(&view, view.rect().center()); QTest::qWait(25); @@ -4094,6 +4097,8 @@ void tst_QGraphicsItem::cursor() QApplication::sendEvent(view.viewport(), &event); } + if (!PlatformQuirks::haveMouseCursor()) + return; #if !defined(Q_OS_WINCE) QTest::qWait(250); #else @@ -4959,7 +4964,10 @@ void tst_QGraphicsItem::paint() QGraphicsView view(&scene); - view.show(); + if(PlatformQuirks::isAutoMaximizing()) + view.showFullScreen(); + else + view.show(); QTest::qWaitForWindowShown(&view); QApplication::processEvents(); #ifdef Q_OS_WIN32 @@ -5975,9 +5983,10 @@ void tst_QGraphicsItem::untransformable() QGraphicsScene scene(-500, -500, 1000, 1000); scene.addItem(item1); - QGraphicsView view(&scene); + QWidget topLevel; + QGraphicsView view(&scene,&topLevel); view.resize(300, 300); - view.show(); + topLevel.show(); view.scale(8, 8); view.centerOn(0, 0); @@ -6616,7 +6625,10 @@ void tst_QGraphicsItem::opacity2() scene.addItem(parent); MyGraphicsView view(&scene); - view.show(); + if(PlatformQuirks::isAutoMaximizing()) + view.showFullScreen(); + else + view.show(); QTest::qWaitForWindowShown(&view); QTRY_VERIFY(view.repaints >= 1); @@ -7050,6 +7062,7 @@ void tst_QGraphicsItem::tabChangesFocus() widget.setLayout(layout); widget.show(); QTest::qWaitForWindowShown(&widget); + QTest::qWait(2000); QTRY_VERIFY(scene.isActive()); @@ -7495,9 +7508,11 @@ void tst_QGraphicsItem::update() { QGraphicsScene scene; scene.setSceneRect(-100, -100, 200, 200); - MyGraphicsView view(&scene); + QWidget topLevel; + MyGraphicsView view(&scene,&topLevel); - view.show(); + topLevel.resize(300, 300); + topLevel.show(); #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&view); #endif @@ -7776,10 +7791,11 @@ void tst_QGraphicsItem::itemUsesExtendedStyleOption() MyStyleOptionTester *rect = new MyStyleOptionTester(QRect(0, 0, 100, 100)); scene.addItem(rect); rect->setPos(200, 200); - QGraphicsView view(&scene); - view.setWindowFlags(Qt::X11BypassWindowManagerHint); + QWidget topLevel; + QGraphicsView view(&scene, &topLevel); + topLevel.setWindowFlags(Qt::X11BypassWindowManagerHint); rect->startTrack = false; - view.show(); + topLevel.show(); QTest::qWaitForWindowShown(&view); QTest::qWait(60); rect->startTrack = true; @@ -7980,6 +7996,9 @@ void tst_QGraphicsItem::sorting_data() void tst_QGraphicsItem::sorting() { + if (PlatformQuirks::isAutoMaximizing()) + QSKIP("Skipped because Platform is auto maximizing", SkipAll); + _paintedItems.clear(); QGraphicsScene scene; @@ -8015,7 +8034,7 @@ void tst_QGraphicsItem::sorting() _paintedItems.clear(); view.viewport()->repaint(); -#ifdef Q_WS_MAC +#if defined(Q_WS_MAC) // There's no difference between repaint and update on the Mac, // so we have to process events here to make sure we get the event. QTest::qWait(100); @@ -8114,10 +8133,13 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem() QGraphicsScene scene; scene.setSceneRect(-100, -100, 200, 200); - QGraphicsView view(&scene); - view.show(); + QWidget toplevel; + + QGraphicsView view(&scene, &toplevel); + toplevel.resize(300, 300); + toplevel.show(); #ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); + qt_x11_wait_for_window_manager(&toplevel); #endif QTest::qWait(100); @@ -10721,7 +10743,10 @@ void tst_QGraphicsItem::QTBUG_6738_missingUpdateWithSetParent() scene.addItem(parent); MyGraphicsView view(&scene); - view.show(); + if(PlatformQuirks::isAutoMaximizing()) + view.showFullScreen(); + else + view.show(); QTest::qWaitForWindowShown(&view); QTRY_VERIFY(view.repaints > 0); @@ -10769,7 +10794,10 @@ void tst_QGraphicsItem::QT_2653_fullUpdateDiscardingOpacityUpdate() // ItemIgnoresTransformations, ItemClipsChildrenToShape, ItemIsSelectable parentGreen->setFlag(QGraphicsItem::ItemIgnoresTransformations); - view.show(); + if (PlatformQuirks::isAutoMaximizing()) + view.showFullScreen(); + else + view.show(); QTest::qWaitForWindowShown(&view); view.reset(); @@ -10954,7 +10982,10 @@ void tst_QGraphicsItem::doNotMarkFullUpdateIfNotInScene() item3->setParentItem(item2); item2->setParentItem(item); scene.addItem(item); - view.show(); + if(PlatformQuirks::isAutoMaximizing()) + view.showFullScreen(); + else + view.show(); QTest::qWaitForWindowShown(&view); QTRY_COMPARE(view.repaints, 1); QTRY_COMPARE(item->painted, 1); diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 09cf4e2..6a2f849 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -2694,12 +2694,14 @@ void tst_QGraphicsScene::render() QPixmap pix(30, 30); pix.fill(Qt::blue); - QGraphicsScene scene; + QGraphicsView view; + QGraphicsScene scene(&view); scene.addEllipse(QRectF(-10, -10, 20, 20), QPen(Qt::black), QBrush(Qt::white)); scene.addEllipse(QRectF(-2, -7, 4, 4), QPen(Qt::black), QBrush(Qt::yellow))->setZValue(1); QGraphicsPixmapItem *item = scene.addPixmap(pix); item->setZValue(2); item->setOffset(QPointF(3, 3)); + view.show(); scene.setSceneRect(scene.itemsBoundingRect()); @@ -2820,6 +2822,8 @@ void tst_QGraphicsScene::contextMenuEvent() QGraphicsView view(&scene); view.show(); + QTest::qWaitForWindowShown(&view); + view.activateWindow(); #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&view); #endif @@ -2851,12 +2855,14 @@ void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations() item->setFlag(QGraphicsItem::ItemIgnoresTransformations); scene.addItem(item); - QGraphicsView view(&scene); + QWidget topLevel; + QGraphicsView view(&scene, &topLevel); view.resize(200, 200); - view.show(); + topLevel.show(); #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&view); #endif + QTest::qWaitForWindowShown(&topLevel); { QPoint pos(50, 50); diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index af02c55..0a9633f 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -69,8 +69,10 @@ #include <QtGui/QStyle> #include <QtGui/QPushButton> #include <QtGui/QInputContext> +#include <QtGui/QDesktopWidget> #include <private/qgraphicsview_p.h> #include "../../shared/util.h" +#include "../platformquirks.h" //TESTED_CLASS= //TESTED_FILES= @@ -400,10 +402,13 @@ void tst_QGraphicsView::interactive() scene.addItem(item); QGraphicsView view(&scene); + if (PlatformQuirks::isAutoMaximizing()) + view.setWindowFlags(view.windowFlags()|Qt::X11BypassWindowManagerHint); view.setFixedSize(300, 300); QCOMPARE(item->events.size(), 0); view.show(); QTest::qWaitForWindowShown(&view); + view.activateWindow(); QApplication::processEvents(); QTRY_COMPARE(item->events.size(), 1); // activate @@ -531,13 +536,15 @@ void tst_QGraphicsView::sceneRect() void tst_QGraphicsView::sceneRect_growing() { + QWidget toplevel; + QGraphicsScene scene; for (int i = 0; i < 100; ++i) scene.addText(QString("(0, %1)").arg((i - 50) * 20))->setPos(0, (i - 50) * 20); - QGraphicsView view(&scene); + QGraphicsView view(&scene, &toplevel); view.setFixedSize(200, 200); - view.show(); + toplevel.show(); int size = 200; scene.setSceneRect(-size, -size, size * 2, size * 2); @@ -854,15 +861,17 @@ void tst_QGraphicsView::dragMode_rubberBand() void tst_QGraphicsView::rubberBandSelectionMode() { + QWidget toplevel; + QGraphicsScene scene; QGraphicsRectItem *rect = scene.addRect(QRectF(10, 10, 80, 80)); rect->setFlag(QGraphicsItem::ItemIsSelectable); - QGraphicsView view(&scene); + QGraphicsView view(&scene, &toplevel); QCOMPARE(view.rubberBandSelectionMode(), Qt::IntersectsItemShape); view.setDragMode(QGraphicsView::RubberBandDrag); view.resize(120, 120); - view.show(); + toplevel.show(); // Disable mouse tracking to prevent the window system from sending mouse // move events to the viewport while we are synthesizing events. If @@ -1071,16 +1080,18 @@ void tst_QGraphicsView::matrix_combine() void tst_QGraphicsView::centerOnPoint() { + QWidget toplevel; + QGraphicsScene scene; scene.addEllipse(QRectF(-100, -100, 50, 50)); scene.addEllipse(QRectF(50, -100, 50, 50)); scene.addEllipse(QRectF(-100, 50, 50, 50)); scene.addEllipse(QRectF(50, 50, 50, 50)); - QGraphicsView view(&scene); + QGraphicsView view(&scene, &toplevel); view.setSceneRect(-400, -400, 800, 800); view.setFixedSize(100, 100); - view.show(); + toplevel.show(); int tolerance = 5; @@ -1155,6 +1166,8 @@ void tst_QGraphicsView::centerOnItem() void tst_QGraphicsView::ensureVisibleRect() { + QWidget toplevel; + QGraphicsScene scene; QGraphicsItem *items[4]; items[0] = scene.addEllipse(QRectF(-25, -25, 50, 50), QPen(Qt::black), QBrush(Qt::green)); @@ -1170,11 +1183,11 @@ void tst_QGraphicsView::ensureVisibleRect() QGraphicsItem *icon = scene.addEllipse(QRectF(-10, -10, 20, 20), QPen(Qt::black), QBrush(Qt::gray)); - QGraphicsView view(&scene); + QGraphicsView view(&scene, &toplevel); view.setSceneRect(-500, -500, 1000, 1000); view.setFixedSize(250, 250); - view.show(); - QTest::qWaitForWindowShown(&view); + toplevel.show(); + QTest::qWaitForWindowShown(&toplevel); for (int y = -100; y < 100; y += 25) { for (int x = -100; x < 100; x += 13) { @@ -1253,6 +1266,9 @@ void tst_QGraphicsView::fitInView() view.setFixedSize(400, 200); #endif + if (PlatformQuirks::isAutoMaximizing()) + view.setWindowFlags(view.windowFlags()|Qt::X11BypassWindowManagerHint); + view.show(); view.fitInView(scene.itemsBoundingRect(), Qt::IgnoreAspectRatio); qApp->processEvents(); @@ -1432,10 +1448,12 @@ void tst_QGraphicsView::itemsInRect_cosmeticAdjust() QGraphicsView view(&scene); view.setOptimizationFlag(QGraphicsView::DontAdjustForAntialiasing, !adjustForAntialiasing); view.setRenderHint(QPainter::Antialiasing, adjustForAntialiasing); + if (PlatformQuirks::isAutoMaximizing()) + view.setWindowFlags(view.windowFlags()|Qt::X11BypassWindowManagerHint); view.setFrameStyle(0); view.resize(300, 300); view.show(); - QTest::qWaitForWindowShown(&view) ; + QTest::qWaitForWindowShown(&view); QTRY_VERIFY(rect->numPaints > 0); rect->numPaints = 0; @@ -1614,7 +1632,8 @@ void tst_QGraphicsView::mapToScene() QGraphicsScene scene; scene.addPixmap(QPixmap("3D-Qt-1-2.png")); - QGraphicsView view; + QWidget topLevel; + QGraphicsView view(&topLevel); view.setScene(&scene); view.setSceneRect(-500, -500, 1000, 1000); #if defined(Q_OS_WINCE) @@ -1624,7 +1643,7 @@ void tst_QGraphicsView::mapToScene() #endif view.setFixedSize(viewSize); - view.show(); + topLevel.show(); QApplication::processEvents(); QVERIFY(view.isVisible()); QCOMPARE(view.size(), viewSize); @@ -1804,11 +1823,14 @@ void tst_QGraphicsView::mapFromScenePoint() } } { + QWidget toplevel; + QGraphicsScene scene(0, 0, 200, 200); scene.addRect(QRectF(0, 0, 200, 200), QPen(Qt::black, 1)); - QGraphicsView view(&scene); + QGraphicsView view(&scene, &toplevel); + view.ensurePolished(); view.resize(view.sizeHint()); - view.show(); + toplevel.show(); QCOMPARE(view.mapFromScene(0, 0), QPoint(0, 0)); QCOMPARE(view.mapFromScene(0.4, 0.4), QPoint(0, 0)); @@ -1826,12 +1848,13 @@ void tst_QGraphicsView::mapFromScenePoint() void tst_QGraphicsView::mapFromSceneRect() { QGraphicsScene scene; - QGraphicsView view(&scene); + QWidget topLevel; + QGraphicsView view(&scene,&topLevel); view.rotate(90); view.setFixedSize(200, 200); view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - view.show(); + topLevel.show(); QTest::qWait(25); QPolygon polygon; @@ -2030,6 +2053,9 @@ void tst_QGraphicsView::cursor() #if defined(Q_OS_WINCE) QSKIP("Qt/CE does not have regular cursor support", SkipAll); #endif + if (PlatformQuirks::haveMouseCursor()) + QSKIP("The Platform does not have regular cursor support", SkipAll); + QGraphicsScene scene; QGraphicsItem *item = scene.addRect(QRectF(-10, -10, 20, 20)); item->setCursor(Qt::IBeamCursor); @@ -2057,6 +2083,9 @@ void tst_QGraphicsView::cursor2() #if defined(Q_OS_WINCE) QSKIP("Qt/CE does not have regular cursor support", SkipAll); #endif + if (PlatformQuirks::haveMouseCursor()) + QSKIP("The Platform does not have regular cursor support", SkipAll); + QGraphicsScene scene; QGraphicsItem *item = scene.addRect(QRectF(-10, -10, 20, 20)); item->setCursor(Qt::IBeamCursor); @@ -2209,6 +2238,8 @@ class CustomView : public QGraphicsView Q_OBJECT public: CustomView(QGraphicsScene *s = 0) : QGraphicsView(s) {} + CustomView(QGraphicsScene *s, QWidget *parent) + : QGraphicsView(s, parent) {} QList<QRegion> lastUpdateRegions; bool painted; @@ -2227,8 +2258,11 @@ void tst_QGraphicsView::viewportUpdateMode() scene.setBackgroundBrush(Qt::red); CustomView view; - view.setFixedSize(500, 500); + QDesktopWidget desktop; + view.setFixedSize(QSize(500, 500).boundedTo(desktop.availableGeometry().size())); // 500 is too big for all common smartphones view.setScene(&scene); + if(PlatformQuirks::isAutoMaximizing()) + view.setWindowFlags(view.windowFlags()|Qt::X11BypassWindowManagerHint); QCOMPARE(view.viewportUpdateMode(), QGraphicsView::MinimalViewportUpdate); // Show the view, and initialize our test. @@ -2303,17 +2337,20 @@ void tst_QGraphicsView::viewportUpdateMode() void tst_QGraphicsView::viewportUpdateMode2() { + QWidget toplevel; + // Create a view with viewport rect equal to QRect(0, 0, 200, 200). QGraphicsScene dummyScene; - CustomView view; + CustomView view(0, &toplevel); view.painted = false; view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); view.setScene(&dummyScene); + view.ensurePolished(); // make sure we get the right content margins int left, top, right, bottom; view.getContentsMargins(&left, &top, &right, &bottom); view.resize(200 + left + right, 200 + top + bottom); - view.show(); - QTest::qWaitForWindowShown(&view); + toplevel.show(); + QTest::qWaitForWindowShown(&toplevel); QTest::qWait(50); QTRY_VERIFY(view.painted); const QRect viewportRect = view.viewport()->rect(); @@ -3222,15 +3259,17 @@ void tst_QGraphicsView::scrollAfterResize() #else QCommonStyle style; #endif - QGraphicsView view; + QWidget toplevel; + + QGraphicsView view(&toplevel); view.setStyle(&style); if (reverse) view.setLayoutDirection(Qt::RightToLeft); view.setSceneRect(-1000, -1000, 2000, 2000); view.resize(300, 300); - view.show(); - QTest::qWaitForWindowShown(&view); + toplevel.show(); + QTest::qWaitForWindowShown(&toplevel); view.horizontalScrollBar()->setValue(0); view.verticalScrollBar()->setValue(0); QCOMPARE(view.viewportTransform(), x1); @@ -3321,8 +3360,10 @@ void tst_QGraphicsView::moveItemWhileScrolling() void tst_QGraphicsView::centerOnDirtyItem() { - QGraphicsView view; - view.setWindowFlags(view.windowFlags() | Qt::WindowStaysOnTopHint); + QWidget toplevel; + + QGraphicsView view(&toplevel); + toplevel.setWindowFlags(view.windowFlags() | Qt::WindowStaysOnTopHint); view.resize(200, 200); QGraphicsScene *scene = new QGraphicsScene; @@ -3334,8 +3375,9 @@ void tst_QGraphicsView::centerOnDirtyItem() scene->addItem(item); view.centerOn(item); - view.show(); - QTest::qWaitForWindowShown(&view); + toplevel.show(); + QTest::qWaitForWindowShown(&toplevel); + QTest::qWait(50); QImage before(view.viewport()->size(), QImage::Format_ARGB32); view.viewport()->render(&before); @@ -3697,19 +3739,26 @@ void tst_QGraphicsView::update() { QFETCH(QRect, updateRect); + // some window manager resize the toplevel to max screen size + // so we must make our view a child (no layout!) of a dummy toplevel + // to ensure that it's really 200x200 pixels + QWidget toplevel; + // Create a view with viewport rect equal to QRect(0, 0, 200, 200). QGraphicsScene dummyScene; - CustomView view; + CustomView view(0, &toplevel); view.setScene(&dummyScene); + view.ensurePolished(); // must ensure polished to get content margins right int left, top, right, bottom; view.getContentsMargins(&left, &top, &right, &bottom); view.resize(200 + left + right, 200 + top + bottom); - view.show(); - QTest::qWaitForWindowShown(&view); + toplevel.show(); + QTest::qWaitForWindowShown(&toplevel); - QApplication::setActiveWindow(&view); + + QApplication::setActiveWindow(&toplevel); QApplication::processEvents(); - QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&toplevel)); const QRect viewportRect = view.viewport()->rect(); QCOMPARE(viewportRect, QRect(0, 0, 200, 200)); @@ -3718,6 +3767,7 @@ void tst_QGraphicsView::update() const bool intersects = updateRect.intersects(viewportRect); QGraphicsViewPrivate *viewPrivate = static_cast<QGraphicsViewPrivate *>(qt_widget_private(&view)); QTRY_COMPARE(viewPrivate->updateRect(updateRect), intersects); + QApplication::processEvents(); view.lastUpdateRegions.clear(); viewPrivate->processPendingUpdates(); @@ -3741,22 +3791,22 @@ void tst_QGraphicsView::update2_data() QTest::addColumn<bool>("changedConnected"); // Anti-aliased. - QTest::newRow("pen width: 0.0, antialiasing: true") << 0.0 << true << false; - QTest::newRow("pen width: 1.5, antialiasing: true") << 1.5 << true << false; - QTest::newRow("pen width: 2.0, antialiasing: true") << 2.0 << true << false; - QTest::newRow("pen width: 3.0, antialiasing: true") << 3.0 << true << false; + QTest::newRow("pen width: 0.0, antialiasing: true") << qreal(0.0) << true << false; + QTest::newRow("pen width: 1.5, antialiasing: true") << qreal(1.5) << true << false; + QTest::newRow("pen width: 2.0, antialiasing: true") << qreal(2.0) << true << false; + QTest::newRow("pen width: 3.0, antialiasing: true") << qreal(3.0) << true << false; // Aliased. - QTest::newRow("pen width: 0.0, antialiasing: false") << 0.0 << false << false; - QTest::newRow("pen width: 1.5, antialiasing: false") << 1.5 << false << false; - QTest::newRow("pen width: 2.0, antialiasing: false") << 2.0 << false << false; - QTest::newRow("pen width: 3.0, antialiasing: false") << 3.0 << false << false; + QTest::newRow("pen width: 0.0, antialiasing: false") << qreal(0.0) << false << false; + QTest::newRow("pen width: 1.5, antialiasing: false") << qreal(1.5) << false << false; + QTest::newRow("pen width: 2.0, antialiasing: false") << qreal(2.0) << false << false; + QTest::newRow("pen width: 3.0, antialiasing: false") << qreal(3.0) << false << false; // changed() connected - QTest::newRow("pen width: 0.0, antialiasing: false, changed") << 0.0 << false << true; - QTest::newRow("pen width: 1.5, antialiasing: true, changed") << 1.5 << true << true; - QTest::newRow("pen width: 2.0, antialiasing: false, changed") << 2.0 << false << true; - QTest::newRow("pen width: 3.0, antialiasing: true, changed") << 3.0 << true << true; + QTest::newRow("pen width: 0.0, antialiasing: false, changed") << qreal(0.0) << false << true; + QTest::newRow("pen width: 1.5, antialiasing: true, changed") << qreal(1.5) << true << true; + QTest::newRow("pen width: 2.0, antialiasing: false, changed") << qreal(2.0) << false << true; + QTest::newRow("pen width: 3.0, antialiasing: true, changed") << qreal(3.0) << true << true; } void tst_QGraphicsView::update2() @@ -4198,8 +4248,8 @@ void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins() class VpGraphicsView: public QGraphicsView { public: - VpGraphicsView(QGraphicsScene *scene) - : QGraphicsView(scene) + VpGraphicsView(QGraphicsScene *scene, QWidget *parent=0) + : QGraphicsView(scene, parent) { setViewportMargins(8, 16, 12, 20); setTransformationAnchor(QGraphicsView::AnchorUnderMouse); @@ -4210,6 +4260,7 @@ void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins() VpGraphicsView view(&scene); view.setWindowFlags(Qt::X11BypassWindowManagerHint); view.show(); + QTest::qWaitForWindowShown(&view); QTest::qWait(50); QPoint mouseViewPos(20, 20); @@ -4324,6 +4375,9 @@ void tst_QGraphicsView::QTBUG_4151_clipAndIgnore() view.setFrameStyle(0); view.resize(75, 75); view.show(); + QTest::qWaitForWindowShown(&view); + view.activateWindow(); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget *)&view); QCOMPARE(view.items(view.rect()).size(), numItems); @@ -4357,6 +4411,8 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect() scene.addItem(&item); QGraphicsView view(&scene); + if (PlatformQuirks::isAutoMaximizing()) + view.setWindowFlags(view.windowFlags()|Qt::X11BypassWindowManagerHint); view.scale(4.15, 4.15); view.show(); QTest::qWaitForWindowShown(&view); diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 9d6def8..2368d59 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -53,6 +53,7 @@ #include <qaction.h> #include <qwidgetaction.h> #include "../../shared/util.h" +#include "../platformquirks.h" class EventSpy : public QObject @@ -1111,6 +1112,10 @@ void tst_QGraphicsWidget::initStyleOption_data() // void initStyleOption(QStyleOption* option) const public void tst_QGraphicsWidget::initStyleOption() { +#ifdef Q_WS_MAEMO_5 + QSKIP("The test passes, but it doesn't work when the display is in energy saving mode", SkipAll); +#endif + QGraphicsScene scene; QGraphicsView view(&scene); view.show(); @@ -1773,6 +1778,9 @@ void tst_QGraphicsWidget::verifyFocusChain() void tst_QGraphicsWidget::updateFocusChainWhenChildDie() { +#ifdef Q_WS_MAEMO_5 + QSKIP("On Maemo 5 the Display Manager is shown on Window change, so the test won't work", SkipAll); +#endif QGraphicsScene scene; QGraphicsView view(&scene); view.show(); @@ -3144,7 +3152,10 @@ void tst_QGraphicsWidget::initialShow() MyGraphicsWidget *widget = new MyGraphicsWidget; QGraphicsView view(&scene); - view.show(); + if(PlatformQuirks::isAutoMaximizing()) + view.showFullScreen(); + else + view.show(); QTest::qWaitForWindowShown(&view); scene.addItem(widget); @@ -3186,7 +3197,7 @@ void tst_QGraphicsWidget::initialShow2() scene.addItem(widget); QGraphicsView view(&scene); - view.setWindowFlags(Qt::X11BypassWindowManagerHint); + view.setWindowFlags(view.windowFlags()|Qt::X11BypassWindowManagerHint); view.show(); QTest::qWaitForWindowShown(&view); diff --git a/tests/auto/qgridlayout/tst_qgridlayout.cpp b/tests/auto/qgridlayout/tst_qgridlayout.cpp index e0924de..ed6d635 100644 --- a/tests/auto/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/qgridlayout/tst_qgridlayout.cpp @@ -52,6 +52,7 @@ #include <QStyleFactory> #include "../../shared/util.h" +#include "../platformquirks.h" //TESTED_CLASS= //TESTED_FILES=gui/kernel/qlayout.cpp gui/kernel/qlayout.h @@ -678,6 +679,8 @@ void tst_QGridLayout::spacingsAndMargins() QApplication::setStyle(new Qt42Style); QWidget toplevel; + if(PlatformQuirks::isAutoMaximizing()) + toplevel.setWindowFlags(Qt::X11BypassWindowManagerHint); QVBoxLayout vbox(&toplevel); QGridLayout grid1; vbox.addLayout(&grid1); @@ -713,11 +716,12 @@ void tst_QGridLayout::spacingsAndMargins() toplevel.show(); toplevel.adjustSize(); QApplication::processEvents(); + QTest::qWaitForWindowShown(&toplevel); QSize topsize = toplevel.size(); QSize minimumsize = vbox.totalMinimumSize(); -#ifdef Q_WS_QWS +#if defined(Q_WS_QWS) if (topsize.width() < minimumsize.width() || topsize.height() < minimumsize.height()) QSKIP("The screen is too small to run this test case", SkipSingle); #endif @@ -1463,15 +1467,18 @@ void tst_QGridLayout::layoutSpacingImplementation() QFETCH(int, vSpacing); QFETCH(bool, customSubElementRect); + QWidget toplevel; + CustomLayoutStyle *style = new CustomLayoutStyle(); style->hspacing = hSpacing; style->vspacing = vSpacing; style->reimplementSubelementRect = customSubElementRect; QApplication::setStyle(style); + widget->setParent(&toplevel); widget->resize(widget->sizeHint()); - widget->show(); -#if defined(Q_WS_X11) - qt_x11_wait_for_window_manager(widget); // wait for the show + toplevel.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&toplevel); // wait for the show #endif QLayout *layout = widget->layout(); @@ -1482,8 +1489,6 @@ void tst_QGridLayout::layoutSpacingImplementation() //qDebug() << item->widget()->pos(); QCOMPARE(item->widget()->pos(), expectedpositions.at(pi)); } - delete widget; - } void tst_QGridLayout::spacing() diff --git a/tests/auto/qheaderview/tst_qheaderview.cpp b/tests/auto/qheaderview/tst_qheaderview.cpp index da0a0bb..5252ec6 100644 --- a/tests/auto/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/qheaderview/tst_qheaderview.cpp @@ -196,6 +196,7 @@ private slots: void QTBUG12268_hiddenMovedSectionSorting(); protected: + QWidget *topLevel; QHeaderView *view; QStandardItemModel *model; }; @@ -345,7 +346,8 @@ void tst_QHeaderView::cleanupTestCase() void tst_QHeaderView::init() { - view = new QHeaderView(Qt::Vertical); + topLevel = new QWidget(); + view = new QHeaderView(Qt::Vertical,topLevel); // Some initial value tests before a model is added QCOMPARE(view->length(), 0); QVERIFY(view->sizeHint() == QSize(0,0)); @@ -373,7 +375,8 @@ void tst_QHeaderView::init() QSignalSpy spy(view, SIGNAL(sectionCountChanged(int, int))); view->setModel(model); QCOMPARE(spy.count(), 1); - view->show(); + view->resize(200,200); + topLevel->show(); } void tst_QHeaderView::cleanup() @@ -508,7 +511,7 @@ void tst_QHeaderView::stretch() view->resize(viewSize); view->setStretchLastSection(true); QCOMPARE(view->stretchLastSection(), true); - view->show(); + topLevel->show(); QCOMPARE(view->width(), viewSize.width()); QCOMPARE(view->visualIndexAt(view->viewport()->height() - 5), 3); @@ -674,7 +677,7 @@ void tst_QHeaderView::visualIndexAt() QFETCH(QList<int>, visual); view->setStretchLastSection(true); - view->show(); + topLevel->show(); for (int i = 0; i < hidden.count(); ++i) view->setSectionHidden(hidden.at(i), true); @@ -682,6 +685,8 @@ void tst_QHeaderView::visualIndexAt() for (int j = 0; j < from.count(); ++j) view->moveSection(from.at(j), to.at(j)); + QTest::qWait(100); + for (int k = 0; k < coordinate.count(); ++k) QCOMPARE(view->visualIndexAt(coordinate.at(k)), visual.at(k)); } @@ -696,7 +701,7 @@ void tst_QHeaderView::length() view->setFont(font); #endif view->setStretchLastSection(true); - view->show(); + topLevel->show(); //minimumSectionSize should be the size of the last section of the widget is not tall enough int length = view->minimumSectionSize(); @@ -708,7 +713,7 @@ void tst_QHeaderView::length() QCOMPARE(length, view->length()); view->setStretchLastSection(false); - view->show(); + topLevel->show(); QVERIFY(length != view->length()); @@ -759,7 +764,7 @@ void tst_QHeaderView::logicalIndexAt() QCOMPARE(view->logicalIndexAt(0), 0); QCOMPARE(view->logicalIndexAt(1), 0); - view->show(); + topLevel->show(); view->setStretchLastSection(true); // First item QCOMPARE(view->logicalIndexAt(0), 0); @@ -1062,7 +1067,7 @@ void tst_QHeaderView::resizeWithResizeModes() view->resizeSection(i, sections.at(i)); view->setResizeMode(i, (QHeaderView::ResizeMode)modes.at(i)); } - view->show(); + topLevel->show(); view->resize(size, size); for (int j = 0; j < expected.count(); ++j) QCOMPARE(view->sectionSize(j), expected.at(j)); @@ -1160,7 +1165,7 @@ void tst_QHeaderView::resizeSection() view->resize(400, 400); - view->show(); + topLevel->show(); view->setMovable(true); view->setStretchLastSection(false); @@ -2035,14 +2040,14 @@ void tst_QHeaderView::QTBUG7833_sectionClicked() QTest::mouseClick(tv.horizontalHeader()->viewport(), Qt::LeftButton, Qt::NoModifier, - QPoint(tv.horizontalHeader()->sectionViewportPosition(11) + 5, 5)); + QPoint(tv.horizontalHeader()->sectionViewportPosition(11) + tv.horizontalHeader()->sectionSize(11)/2, 5)); QCOMPARE(clickedSpy.count(), 1); QCOMPARE(pressedSpy.count(), 1); QCOMPARE(clickedSpy.at(0).at(0).toInt(), 11); QCOMPARE(pressedSpy.at(0).at(0).toInt(), 11); QTest::mouseClick(tv.horizontalHeader()->viewport(), Qt::LeftButton, Qt::NoModifier, - QPoint(tv.horizontalHeader()->sectionViewportPosition(8) + 5, 5)); + QPoint(tv.horizontalHeader()->sectionViewportPosition(8) + tv.horizontalHeader()->sectionSize(0)/2, 5)); QCOMPARE(clickedSpy.count(), 2); QCOMPARE(pressedSpy.count(), 2); @@ -2050,7 +2055,7 @@ void tst_QHeaderView::QTBUG7833_sectionClicked() QCOMPARE(pressedSpy.at(1).at(0).toInt(), 8); QTest::mouseClick(tv.horizontalHeader()->viewport(), Qt::LeftButton, Qt::NoModifier, - QPoint(tv.horizontalHeader()->sectionViewportPosition(0) + 5, 5)); + QPoint(tv.horizontalHeader()->sectionViewportPosition(0) + tv.horizontalHeader()->sectionSize(0)/2, 5)); QCOMPARE(clickedSpy.count(), 3); QCOMPARE(pressedSpy.count(), 3); diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index 4b4bdd6..d213e8e 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -55,6 +55,8 @@ #include <QTcpServer> #include <QTimer> +#include "../platformquirks.h" + #if defined(Q_OS_SYMBIAN) # define SRCDIR "." #endif @@ -315,23 +317,27 @@ void tst_QImageReader::jpegRgbCmyk() QImage image1(prefix + QLatin1String("YCbCr_cmyk.jpg")); QImage image2(prefix + QLatin1String("YCbCr_cmyk.png")); - // first, do some obvious tests - QCOMPARE(image1.height(), image2.height()); - QCOMPARE(image1.width(), image2.width()); - QCOMPARE(image1.format(), image2.format()); - QCOMPARE(image1.format(), QImage::Format_RGB32); - - // compare all the pixels with a slack of 3. This ignores rounding errors in libjpeg/libpng - for (int h = 0; h < image1.height(); ++h) { - const uchar *s1 = image1.constScanLine(h); - const uchar *s2 = image2.constScanLine(h); - for (int w = 0; w < image1.width() * 4; ++w) { - if (*s1 != *s2) { - QVERIFY2(qAbs(*s1 - *s2) <= 3, qPrintable(QString("images differ in line %1, col %2 (image1: %3, image2: %4)").arg(h).arg(w).arg(*s1, 0, 16).arg(*s2, 0, 16))); + if (PlatformQuirks::isImageLoaderImprecise()) { + // first, do some obvious tests + QCOMPARE(image1.height(), image2.height()); + QCOMPARE(image1.width(), image2.width()); + QCOMPARE(image1.format(), image2.format()); + QCOMPARE(image1.format(), QImage::Format_RGB32); + + // compare all the pixels with a slack of 3. This ignores rounding errors in libjpeg/libpng + for (int h = 0; h < image1.height(); ++h) { + const uchar *s1 = image1.constScanLine(h); + const uchar *s2 = image2.constScanLine(h); + for (int w = 0; w < image1.width() * 4; ++w) { + if (*s1 != *s2) { + QVERIFY2(qAbs(*s1 - *s2) <= 3, qPrintable(QString("images differ in line %1, col %2 (image1: %3, image2: %4)").arg(h).arg(w).arg(*s1, 0, 16).arg(*s2, 0, 16))); + } + s1++; + s2++; } - s1++; - s2++; } + } else { + QCOMPARE(image1, image2); } } diff --git a/tests/auto/qinputdialog/tst_qinputdialog.cpp b/tests/auto/qinputdialog/tst_qinputdialog.cpp index 5d03142..580c644 100644 --- a/tests/auto/qinputdialog/tst_qinputdialog.cpp +++ b/tests/auto/qinputdialog/tst_qinputdialog.cpp @@ -147,9 +147,10 @@ void testInvalidateAndRestore( QVERIFY(sbox->hasAcceptableInput()); QVERIFY(okButton->isEnabled()); QCOMPARE(sbox->value(), lastValidValue); + QLocale loc; QCOMPARE( normalizeNumericString(ledit->text()), - normalizeNumericString(QString("%1").arg(sbox->value()))); + normalizeNumericString(loc.toString(sbox->value()))); } template <typename SpinBoxType, typename ValueType> @@ -169,9 +170,10 @@ void testGetNumeric(QInputDialog *dialog, SpinBoxType * = 0, ValueType * = 0) QVERIFY(sbox->value() >= sbox->minimum()); QVERIFY(sbox->value() <= sbox->maximum()); QVERIFY(sbox->hasAcceptableInput()); + QLocale loc; QCOMPARE( normalizeNumericString(ledit->selectedText()), - normalizeNumericString(QString("%1").arg(sbox->value()))); + normalizeNumericString(loc.toString(sbox->value()))); QVERIFY(okButton->isEnabled()); const ValueType origValue = sbox->value(); @@ -185,7 +187,7 @@ void testGetNumeric(QInputDialog *dialog, SpinBoxType * = 0, ValueType * = 0) testTypingValue<SpinBoxType>(sbox, okButton, "0.0"); testTypingValue<SpinBoxType>(sbox, okButton, "foobar"); - testTypingValue<SpinBoxType>(sbox, okButton, QString("%1").arg(origValue)); + testTypingValue<SpinBoxType>(sbox, okButton, loc.toString(origValue)); } void testGetText(QInputDialog *dialog) diff --git a/tests/auto/qlayout/tst_qlayout.cpp b/tests/auto/qlayout/tst_qlayout.cpp index c6fe3f0..a974a42 100644 --- a/tests/auto/qlayout/tst_qlayout.cpp +++ b/tests/auto/qlayout/tst_qlayout.cpp @@ -133,12 +133,13 @@ void tst_QLayout::geometry() // For QWindowsStyle we know that QWidgetItem::geometry() and QWidget::geometry() // should be the same. QApplication::setStyle(new QWindowsStyle); - QWidget w; + QWidget topLevel; + QWidget w(&topLevel); QVBoxLayout layout(&w); SizeHinterFrame widget(QSize(100,100)); layout.addWidget(&widget); QLayoutItem *item = layout.itemAt(0); - w.show(); + topLevel.show(); QApplication::processEvents(); QCOMPARE(item->geometry().size(), QSize(100,100)); diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 425ac89..523a3ab 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -334,7 +334,8 @@ void tst_QListView::cursorMove() int columns = 6; QStandardItemModel model(rows, columns); - QListView view; + QWidget topLevel; + QListView view(&topLevel); view.setModel(&model); for (int j = 0; j < columns; ++j) { @@ -358,7 +359,7 @@ void tst_QListView::cursorMove() view.setGridSize(cellsize); view.setViewMode(QListView::IconMode); view.doItemsLayout(); - view.show(); + topLevel.show(); QVector<Qt::Key> keymoves; keymoves << Qt::Key_Up << Qt::Key_Up << Qt::Key_Right << Qt::Key_Right << Qt::Key_Up @@ -1108,7 +1109,8 @@ void tst_QListView::selection() QFETCH(QRect, selectionRect); QFETCH(IntList, expectedItems); - PublicListView v; + QWidget topLevel; + PublicListView v(&topLevel); QtTestModel model; model.colCount = 1; model.rCount = itemCount; @@ -1142,7 +1144,7 @@ void tst_QListView::selection() v.resize(525,525); #endif - v.show(); + topLevel.show(); QTest::qWaitForWindowShown(&v); QApplication::processEvents(); @@ -1158,7 +1160,8 @@ void tst_QListView::selection() void tst_QListView::scrollTo() { - QListView lv; + QWidget topLevel; + QListView lv(&topLevel); QStringListModel model(&lv); QStringList list; list << "Short item 1"; @@ -1194,8 +1197,8 @@ void tst_QListView::scrollTo() model.setStringList(list); lv.setModel(&model); lv.setFixedSize(100, 200); - lv.show(); - QTest::qWaitForWindowShown(&lv); + topLevel.show(); + QTest::qWaitForWindowShown(&topLevel); //by default, the list view scrolls per item and has no wrapping QModelIndex index = model.index(6,0); @@ -1266,7 +1269,8 @@ void tst_QListView::scrollBarRanges() const int rowCount = 10; const int rowHeight = 20; - QListView lv; + QWidget topLevel; + QListView lv(&topLevel); QStringListModel model(&lv); QStringList list; for (int i = 0; i < rowCount; ++i) @@ -1278,7 +1282,7 @@ void tst_QListView::scrollBarRanges() TestDelegate *delegate = new TestDelegate(&lv); delegate->m_sizeHint = QSize(100, rowHeight); lv.setItemDelegate(delegate); - lv.show(); + topLevel.show(); for (int h = 30; h <= 210; ++h) { lv.resize(250, h); @@ -1354,14 +1358,15 @@ void tst_QListView::scrollBarAsNeeded() const int rowCounts[3] = {0, 1, 20}; - QListView lv; + QWidget topLevel; + QListView lv(&topLevel); lv.setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); lv.setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); lv.setFlow((QListView::Flow)flow); QStringListModel model(&lv); lv.setModel(&model); lv.resize(size); - lv.show(); + topLevel.show(); for (uint r = 0; r < sizeof(rowCounts)/sizeof(int); ++r) { QStringList list; @@ -1631,6 +1636,7 @@ void tst_QListView::task254449_draggingItemToNegativeCoordinates() list.setViewMode(QListView::IconMode); list.show(); QTest::qWaitForWindowShown(&list); + list.activateWindow(); class MyItemDelegate : public QStyledItemDelegate { @@ -1815,7 +1821,8 @@ void tst_QListView::taskQTBUG_2233_scrollHiddenItems() QFETCH(int, flow); const int rowCount = 200; - QListView view; + QWidget topLevel; + QListView view(&topLevel); QStringListModel model(&view); QStringList list; for (int i = 0; i < rowCount; ++i) @@ -1839,8 +1846,8 @@ void tst_QListView::taskQTBUG_2233_scrollHiddenItems() } //QTBUG-7929 should not crash - view.show(); - QTest::qWaitForWindowShown(&view); + topLevel.show(); + QTest::qWaitForWindowShown(&topLevel); QScrollBar *bar = view.flow() == QListView::TopToBottom ? view.verticalScrollBar() : view.horizontalScrollBar(); diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp index eb3fb6b..6cfd6c5 100644 --- a/tests/auto/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp @@ -1499,6 +1499,11 @@ void tst_QListWidget::itemWidget() class MyListWidget : public QListWidget { public: + MyListWidget(QWidget *parent=0) + : QListWidget(parent) + { + } + void paintEvent(QPaintEvent *e) { painted += e->region(); QListWidget::paintEvent(e); @@ -1513,14 +1518,17 @@ void tst_QListWidget::fastScroll() QSKIP("S60 style doesn't support fast scrolling", SkipAll); } - MyListWidget widget; + QWidget topLevel; + MyListWidget widget(&topLevel); for (int i = 0; i < 50; ++i) widget.addItem(QString("Item %1").arg(i)); - widget.show(); + topLevel.resize(300, 300); // toplevel needs to be wide enough for the item + topLevel.show(); // Make sure the widget gets the first full repaint. On // some WMs, we'll get two (first inactive exposure, then // active exposure. + QTest::qWaitForWindowShown(&widget); #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&widget); #endif @@ -1531,6 +1539,7 @@ void tst_QListWidget::fastScroll() QVERIFY(!itemSize.isEmpty()); QScrollBar *sbar = widget.verticalScrollBar(); + widget.setVerticalScrollMode(QAbstractItemView::ScrollPerItem); widget.painted = QRegion(); sbar->setValue(sbar->value() + sbar->singleStep()); QApplication::processEvents(); diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp index c82c566..e3122c4 100644 --- a/tests/auto/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp @@ -55,6 +55,7 @@ #include <qtextedit.h> #include <private/qmainwindowlayout_p.h> #include <private/qdockarealayout_p.h> +#include "../platformquirks.h" //TESTED_FILES= @@ -1679,6 +1680,9 @@ void tst_QMainWindow::addToolbarAfterShow() void tst_QMainWindow::centralWidgetSize() { + if(PlatformQuirks::isAutoMaximizing()) + QSKIP("The platform is auto maximizing, so the test makes no sense", SkipAll);; + QMainWindow mainWindow; mainWindow.menuBar()->addMenu("menu"); diff --git a/tests/auto/qmdiarea/tst_qmdiarea.cpp b/tests/auto/qmdiarea/tst_qmdiarea.cpp index f865738..6483f75 100644 --- a/tests/auto/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/qmdiarea/tst_qmdiarea.cpp @@ -63,6 +63,7 @@ #include <QMacStyle> #include "../../shared/util.h" +#include "../platformquirks.h" static const Qt::WindowFlags DefaultWindowFlags = Qt::SubWindow | Qt::WindowSystemMenuHint @@ -468,6 +469,8 @@ void tst_QMdiArea::subWindowActivated2() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&mdiArea); #endif + QTest::qWaitForWindowShown(&mdiArea); + mdiArea.activateWindow(); QTest::qWait(100); QTRY_COMPARE(spy.count(), 5); @@ -510,6 +513,9 @@ void tst_QMdiArea::subWindowActivated2() QCOMPARE(mdiArea.activeSubWindow(), activeSubWindow); spy.clear(); + if (PlatformQuirks::isAutoMaximizing()) + QSKIP("Platform is auto maximizing, so no showMinimized()", SkipAll); + // Check that we only emit _one_ signal and the active window // is unchanged after showMinimized/showNormal. mdiArea.showMinimized(); @@ -1119,9 +1125,10 @@ void tst_QMdiArea::currentSubWindow() void tst_QMdiArea::addAndRemoveWindows() { - QMdiArea workspace; + QWidget topLevel; + QMdiArea workspace(&topLevel); workspace.resize(800, 600); - workspace.show(); + topLevel.show(); #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&workspace); #endif @@ -1594,6 +1601,8 @@ void tst_QMdiArea::tileSubWindows() { QMdiArea workspace; workspace.resize(600,480); + if (PlatformQuirks::isAutoMaximizing()) + workspace.setWindowFlags(workspace.windowFlags() | Qt::X11BypassWindowManagerHint); workspace.show(); #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&workspace); @@ -1848,8 +1857,9 @@ void tst_QMdiArea::resizeMaximizedChildWindows() QFETCH(int, increment); QFETCH(int, windowCount); - QMdiArea workspace; - workspace.show(); + QWidget topLevel; + QMdiArea workspace(&topLevel); + topLevel.show(); #if defined(Q_WS_X11) qt_x11_wait_for_window_manager(&workspace); #endif @@ -2094,6 +2104,7 @@ void tst_QMdiArea::resizeTimer() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&mdiArea); #endif + QTest::qWaitForWindowShown(&mdiArea); #ifndef Q_OS_WINCE int time = 250; diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 7065b13..84f1b94 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -298,15 +298,17 @@ void tst_QMenu::mouseActivation() #ifdef Q_OS_WINCE_WM QSKIP("We have a separate mouseActivation test for Windows mobile.", SkipAll); #endif - QMenu menu; + QWidget topLevel; + QMenu menu(&topLevel); + topLevel.show(); menu.addAction("Menu Action"); menu.show(); - QTest::mouseClick(&menu, Qt::LeftButton, 0, QPoint(5, 5), 300); + QTest::mouseClick(&menu, Qt::LeftButton, 0, menu.rect().center(), 300); QVERIFY(!menu.isVisible()); //context menus can allways be accessed with right click except on windows menu.show(); - QTest::mouseClick(&menu, Qt::RightButton, 0, QPoint(5, 5), 300); + QTest::mouseClick(&menu, Qt::RightButton, 0, menu.rect().center(), 300); QVERIFY(!menu.isVisible()); #ifdef Q_OS_WIN @@ -466,9 +468,9 @@ void tst_QMenu::overrideMenuAction() m->addAction(aQuit); w.show(); + QTest::qWaitForWindowShown(&w); QApplication::setActiveWindow(&w); w.setFocus(); - QTest::qWaitForWindowShown(&w); QTRY_VERIFY(w.hasFocus()); //test of the action inside the menu @@ -504,6 +506,7 @@ void tst_QMenu::statusTip() w.addToolBar(&tb); w.show(); + QTest::qWaitForWindowShown(&w); QRect rect1 = tb.actionGeometry(&a); QToolButton *btn = qobject_cast<QToolButton*>(tb.childAt(rect1.center())); @@ -589,6 +592,8 @@ void tst_QMenu::tearOff() QVERIFY(menu->isTearOffEnabled()); widget.show(); + QTest::qWaitForWindowShown(&widget); + widget.activateWindow(); menu->popup(QPoint(0,0)); QTest::qWait(50); QVERIFY(!menu->isTearOffMenuVisible()); diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index cc9fb0c..8dfb976 100644 --- a/tests/auto/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/qmenubar/tst_qmenubar.cpp @@ -338,6 +338,8 @@ void tst_QMenuBar::initTestCase_noQt3() initSimpleMenubar_noQt3(); mw->show(); + QTest::qWaitForWindowShown(mw); + mw->activateWindow(); menu1 = new QtTestSlot( mw ); menu2 = new QtTestSlot( mw ); @@ -1700,8 +1702,8 @@ void tst_QMenuBar::taskQTBUG11823_crashwithInvisibleActions() QAction * a = menubar.addAction( "&a" ); menubar.show(); - QApplication::setActiveWindow(&menubar); QTest::qWaitForWindowShown(&menubar); + QApplication::setActiveWindow(&menubar); menubar.setActiveAction(m); QCOMPARE(menubar.activeAction(), m); QTest::keyClick(0, Qt::Key_Right); diff --git a/tests/auto/qmouseevent_modal/tst_qmouseevent_modal.cpp b/tests/auto/qmouseevent_modal/tst_qmouseevent_modal.cpp index 99a8913..694d65d 100644 --- a/tests/auto/qmouseevent_modal/tst_qmouseevent_modal.cpp +++ b/tests/auto/qmouseevent_modal/tst_qmouseevent_modal.cpp @@ -147,12 +147,14 @@ void tst_qmouseevent_modal::mousePressRelease() QVERIFY( w->d->count() == 0 ); QTest::mousePress( w->pb, Qt::LeftButton ); + QTest::qWait(200); QVERIFY( !w->d->isVisible() ); QVERIFY( w->d->count() == 1 ); QVERIFY( !w->pb->isDown() ); QTest::mousePress( w->pb, Qt::LeftButton ); + QTest::qWait(200); QVERIFY( !w->d->isVisible() ); QVERIFY( w->d->count() == 2 ); @@ -161,12 +163,14 @@ void tst_qmouseevent_modal::mousePressRelease() // With the current QWS mouse handling, the 3rd press would fail... QTest::mousePress( w->pb, Qt::LeftButton ); + QTest::qWait(200); QVERIFY( !w->d->isVisible() ); QVERIFY( w->d->count() == 3 ); QVERIFY( !w->pb->isDown() ); QTest::mousePress( w->pb, Qt::LeftButton ); + QTest::qWait(200); QVERIFY( !w->d->isVisible() ); QVERIFY( w->d->count() == 4 ); diff --git a/tests/auto/qpathclipper/tst_qpathclipper.cpp b/tests/auto/qpathclipper/tst_qpathclipper.cpp index 4dc12cb..98c67d0 100644 --- a/tests/auto/qpathclipper/tst_qpathclipper.cpp +++ b/tests/auto/qpathclipper/tst_qpathclipper.cpp @@ -1300,6 +1300,9 @@ void tst_QPathClipper::task251909() void tst_QPathClipper::qtbug3778() { + if (sizeof(double) != sizeof(qreal)) { + QSKIP("This test only works for qreal=double, otherwise ends in rounding errors", SkipAll); + } QPainterPath path1; path1.moveTo(200, 3.22409e-5); // e-5 and higher leads to a bug diff --git a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp index a6dd8be..99d11cc 100644 --- a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp @@ -880,6 +880,7 @@ void tst_QPlainTextEdit::lineWrapModes() // We thus need to make it wide enough to show something visible. int minimumWidth = 2 * ed->document()->documentMargin(); minimumWidth += ed->fontMetrics().width(QLatin1Char('a')); + minimumWidth += ed->frameWidth(); ed->resize(minimumWidth, 1000); QCOMPARE(lineCount(), 26); ed->setParent(0); diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/qprinter/tst_qprinter.cpp index e908961..fb9f8f0 100644 --- a/tests/auto/qprinter/tst_qprinter.cpp +++ b/tests/auto/qprinter/tst_qprinter.cpp @@ -596,12 +596,12 @@ void tst_QPrinter::testPageMargins_data() QTest::addColumn<qreal>("bottom"); QTest::addColumn<int>("unit"); - QTest::newRow("data0") << 5.5 << 6.5 << 7.5 << 8.5 << static_cast<int>(QPrinter::Millimeter); - QTest::newRow("data1") << 5.5 << 6.5 << 7.5 << 8.5 << static_cast<int>(QPrinter::Point); - QTest::newRow("data2") << 5.5 << 6.5 << 7.5 << 8.5 << static_cast<int>(QPrinter::Inch); - QTest::newRow("data3") << 5.5 << 6.5 << 7.5 << 8.5 << static_cast<int>(QPrinter::Pica); - QTest::newRow("data4") << 5.5 << 6.5 << 7.5 << 8.5 << static_cast<int>(QPrinter::Didot); - QTest::newRow("data5") << 5.5 << 6.5 << 7.5 << 8.5 << static_cast<int>(QPrinter::Cicero); + QTest::newRow("data0") << qreal(5.5) << qreal(6.5) << qreal(7.5) << qreal(8.5) << static_cast<int>(QPrinter::Millimeter); + QTest::newRow("data1") << qreal(5.5) << qreal(6.5) << qreal(7.5) << qreal(8.5) << static_cast<int>(QPrinter::Point); + QTest::newRow("data2") << qreal(5.5) << qreal(6.5) << qreal(7.5) << qreal(8.5) << static_cast<int>(QPrinter::Inch); + QTest::newRow("data3") << qreal(5.5) << qreal(6.5) << qreal(7.5) << qreal(8.5) << static_cast<int>(QPrinter::Pica); + QTest::newRow("data4") << qreal(5.5) << qreal(6.5) << qreal(7.5) << qreal(8.5) << static_cast<int>(QPrinter::Didot); + QTest::newRow("data5") << qreal(5.5) << qreal(6.5) << qreal(7.5) << qreal(8.5) << static_cast<int>(QPrinter::Cicero); } void tst_QPrinter::testPageMargins() diff --git a/tests/auto/qsplitter/tst_qsplitter.cpp b/tests/auto/qsplitter/tst_qsplitter.cpp index e7b5dc7..7cb2b65 100644 --- a/tests/auto/qsplitter/tst_qsplitter.cpp +++ b/tests/auto/qsplitter/tst_qsplitter.cpp @@ -1230,7 +1230,8 @@ void tst_QSplitter::testShowHide() QSplitter *split = new QSplitter(Qt::Horizontal); - QWidget widget; + QWidget topLevel; + QWidget widget(&topLevel); widget.resize(400 + split->handleWidth(), 200); QVBoxLayout *lay=new QVBoxLayout(&widget); lay->setMargin(0); @@ -1240,7 +1241,7 @@ void tst_QSplitter::testShowHide() split->setSizes(QList<int>() << 200 << 200); lay->addWidget(split); widget.setLayout(lay); - widget.show(); + topLevel.show(); QTest::qWait(100); @@ -1378,8 +1379,9 @@ class MyTextEdit : public QTextEdit void tst_QSplitter::task169702_sizes() { + QWidget topLevel; // Create two nested (non-collapsible) splitters - QSplitter* outerSplitter = new QSplitter(Qt::Vertical); + QSplitter* outerSplitter = new QSplitter(Qt::Vertical, &topLevel); outerSplitter->setChildrenCollapsible(false); QSplitter* splitter = new QSplitter(Qt::Horizontal, outerSplitter); splitter->setChildrenCollapsible(false); @@ -1396,12 +1398,12 @@ void tst_QSplitter::task169702_sizes() splitter->addWidget(new QTextEdit("Bar")); outerSplitter->setGeometry(100, 100, 500, 500); - outerSplitter->show(); + topLevel.show(); QTest::qWait(100); testW->m_iFactor++; testW->updateGeometry(); - QTest::qWait(100); + QTest::qWait(500);//100 is too fast for Maemo //Make sure the minimimSizeHint is respected QCOMPARE(testW->size().height(), testW->minimumSizeHint().height()); diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp index 9df2a4d..16cf872 100644 --- a/tests/auto/qstring/tst_qstring.cpp +++ b/tests/auto/qstring/tst_qstring.cpp @@ -4433,8 +4433,10 @@ void tst_QString::nanAndInf() CHECK_NAN("nan ", true, true) CHECK_NAN("\t NAN", true, true) CHECK_NAN("\t NAN ", true, true) +#ifndef QT_QLOCALE_USES_FCVT //In case we use glibc this tests will fail CHECK_NAN("-nan", false, false) CHECK_NAN("+NAN", false, false) +#endif CHECK_NAN("NaN", true, true) CHECK_NAN("nAn", true, true) CHECK_NAN("NANe-10", false, false) diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp index 04b1e79..0396408 100644 --- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -48,6 +48,7 @@ #endif #include <private/qstylesheetstyle_p.h> +#include "../platformquirks.h" //TESTED_CLASS= //TESTED_FILES= @@ -822,6 +823,8 @@ void tst_QStyleSheetStyle::focusColors() void tst_QStyleSheetStyle::hoverColors() { + if (!PlatformQuirks::haveMouseCursor()) + QSKIP("No mouse Cursor on this platform",SkipAll); QList<QWidget *> widgets; widgets << new QPushButton("TESTING"); widgets << new QLineEdit("TESTING"); @@ -979,10 +982,11 @@ void tst_QStyleSheetStyle::background() void tst_QStyleSheetStyle::tabAlignement() { - QTabWidget tabWidget; + QWidget topLevel; + QTabWidget tabWidget(&topLevel); tabWidget.addTab(new QLabel("tab1"),"tab1"); tabWidget.resize(QSize(400,400)); - tabWidget.show(); + topLevel.show(); QTest::qWaitForWindowShown(&tabWidget); QTest::qWait(50); QTabBar *bar = qFindChild<QTabBar*>(&tabWidget); diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index 3e5d077..6c920c9 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -2591,9 +2591,10 @@ void tst_QTableView::scrollTo() QFETCH(int, expectedVerticalScroll); QtTestTableModel model(rowCount, columnCount); - QtTestTableView view; + QWidget toplevel; + QtTestTableView view(&toplevel); - view.show(); + toplevel.show(); // 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); @@ -2748,10 +2749,11 @@ void tst_QTableView::indexAt() QFETCH(int, expectedColumn); QtTestTableModel model(rowCount, columnCount); - QtTestTableView view; + QWidget toplevel; + QtTestTableView view(&toplevel); - view.show(); - QTest::qWaitForWindowShown(&view); + toplevel.show(); + QTest::qWaitForWindowShown(&toplevel); //some styles change the scroll mode in their polish view.setHorizontalScrollMode(QAbstractItemView::ScrollPerItem); @@ -3657,20 +3659,23 @@ void tst_QTableView::mouseWheel() #ifdef Q_OS_WINCE QSKIP("Since different Windows CE versions sport different taskbars, we skip this test", SkipAll); #endif + QFETCH(int, scrollMode); QFETCH(int, delta); QFETCH(int, horizontalPositon); QFETCH(int, verticalPosition); QtTestTableModel model(100, 100); - QtTestTableView view; + QWidget topLevel; + QtTestTableView view(&topLevel); view.resize(500, 500); for (int r = 0; r < 100; ++r) view.setRowHeight(r, 50); for (int c = 0; c < 100; ++c) view.setColumnWidth(c, 100); - view.show(); - QTest::qWaitForWindowShown(&view); + topLevel.show(); + + QTest::qWaitForWindowShown(&topLevel); view.setModel(&model); @@ -3772,7 +3777,7 @@ void tst_QTableView::task191545_dragSelectRows() QRect cellRect = table.visualRect(model.index(3, 0)); QHeaderView *vHeader = table.verticalHeader(); QWidget *vHeaderVp = vHeader->viewport(); - QPoint rowPos(5, (cellRect.top() + cellRect.bottom()) / 2); + QPoint rowPos(cellRect.center()); QMouseEvent rowPressEvent(QEvent::MouseButtonPress, rowPos, Qt::LeftButton, Qt::NoButton, Qt::ControlModifier); qApp->sendEvent(vHeaderVp, &rowPressEvent); @@ -3851,6 +3856,7 @@ void tst_QTableView::task191545_dragSelectRows() QMouseEvent cellReleaseEvent(QEvent::MouseButtonRelease, cellPos, Qt::LeftButton, Qt::NoButton, Qt::ControlModifier); qApp->sendEvent(tableVp, &cellReleaseEvent); + QTest::qWait(200); for (int i = 0; i < 6; ++i) for (int j = 0; j < 6; ++j) { QModelIndex index = model.index(3 + i, 3 + j, table.rootIndex()); diff --git a/tests/auto/qtextedit/tst_qtextedit.cpp b/tests/auto/qtextedit/tst_qtextedit.cpp index 101baa5..878579b 100644 --- a/tests/auto/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/qtextedit/tst_qtextedit.cpp @@ -2111,6 +2111,7 @@ void tst_QTextEdit::setDocumentPreservesPalette() QPalette whitePal = ed->palette(); whitePal.setColor(QPalette::Active, QPalette::Text, "white"); + QVERIFY(whitePal != ed->palette()); ed->setPalette(whitePal); QVERIFY(whitePal.color(QPalette::Active, QPalette::Text) @@ -2155,7 +2156,8 @@ void tst_QTextEdit::pasteFromQt3RichText() void tst_QTextEdit::noWrapBackgrounds() { - QTextEdit edit; + QWidget topLevel; + QTextEdit edit(&topLevel); edit.setLineWrapMode(QTextEdit::NoWrap); QTextFrame *root = edit.document()->rootFrame(); @@ -2169,6 +2171,7 @@ void tst_QTextEdit::noWrapBackgrounds() edit.textCursor().setBlockFormat(format); edit.insertPlainText(QLatin1String(" \n \n \n \n")); edit.setFixedSize(100, 200); + topLevel.show(); QImage img = QPixmap::grabWidget(edit.viewport()).toImage(); QCOMPARE(img, img.mirrored(true, false)); diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index c7b53e9..3c2bf15 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -2379,11 +2379,12 @@ void tst_QTreeView::extendedSelection() QFETCH(int, selectedCount); QStandardItemModel model(5, 2); - QTreeView view; + QWidget topLevel; + QTreeView view(&topLevel); view.resize(qMax(mousePressPos.x() * 2, 200), qMax(mousePressPos.y() * 2, 200)); view.setModel(&model); view.setSelectionMode(QAbstractItemView::ExtendedSelection); - view.show(); + topLevel.show(); QTest::mousePress(view.viewport(), Qt::LeftButton, 0, mousePressPos); QCOMPARE(view.selectionModel()->selectedIndexes().count(), selectedCount); } @@ -3280,9 +3281,10 @@ void tst_QTreeView::task220298_selectColumns() void tst_QTreeView::task224091_appendColumns() { QStandardItemModel *model = new QStandardItemModel(); - QTreeView *treeView = new QTreeView(); + QWidget* topLevel= new QWidget; + QTreeView *treeView = new QTreeView(topLevel); treeView->setModel(model); - treeView->show(); + topLevel->show(); treeView->resize(50,50); QTest::qWaitForWindowShown(treeView); @@ -3299,7 +3301,7 @@ void tst_QTreeView::task224091_appendColumns() QTRY_VERIFY(treeView->verticalScrollBar()->isVisible()); - delete treeView; + delete topLevel; delete model; } @@ -3758,7 +3760,8 @@ void tst_QTreeView::taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint() void tst_QTreeView::keyboardNavigationWithDisabled() { - QTreeView view; + QWidget topLevel; + QTreeView view(&topLevel); QStandardItemModel model(90, 0); for (int i = 0; i < 90; i ++) { model.setItem(i, new QStandardItem(QString::number(i))); @@ -3767,10 +3770,10 @@ void tst_QTreeView::keyboardNavigationWithDisabled() 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()); + topLevel.show(); + QApplication::setActiveWindow(&topLevel); + QTest::qWaitForWindowShown(&topLevel); + QTRY_VERIFY(topLevel.isActiveWindow()); view.setCurrentIndex(model.index(1, 0)); QTest::keyClick(view.viewport(), Qt::Key_Up); diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp index 1e37384..32bf557 100644 --- a/tests/auto/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp @@ -464,6 +464,7 @@ void tst_QTreeWidget::editItem() QTreeWidget tree; populate(&tree, topLevelItems, new TreeItem(QStringList() << "1" << "2")); tree.show(); + QTest::qWaitForWindowShown(&tree); QSignalSpy itemChangedSpy( &tree, SIGNAL(itemChanged(QTreeWidgetItem*,int))); @@ -3098,8 +3099,9 @@ void tst_QTreeWidget::task253109_itemHeight() void tst_QTreeWidget::task206367_duplication() { - QTreeWidget treeWidget; - treeWidget.show(); + QWidget topLevel; + QTreeWidget treeWidget(&topLevel); + topLevel.show(); treeWidget.resize(200, 200); treeWidget.setSortingEnabled(true); diff --git a/tests/auto/qwaitcondition/tst_qwaitcondition.cpp b/tests/auto/qwaitcondition/tst_qwaitcondition.cpp index 5391591..ffc4730 100644 --- a/tests/auto/qwaitcondition/tst_qwaitcondition.cpp +++ b/tests/auto/qwaitcondition/tst_qwaitcondition.cpp @@ -76,7 +76,7 @@ private slots: static const int iterations = 10; // Note: some tests rely on ThreadCount being multiple of 2 -#ifdef Q_OS_SOLARIS +#if defined(Q_OS_SOLARIS) || ( defined(Q_OS_LINUX) && defined(QT_ARCH_ARMV6) ) static const int ThreadCount = 4; #else static const int ThreadCount = 10; diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp index 2187aeb..e6c40b8 100644 --- a/tests/auto/qxmlquery/tst_qxmlquery.cpp +++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp @@ -1197,9 +1197,15 @@ void tst_QXmlQuery::basicXQueryToQtTypeCheck() const expectedValues.append(QVariant()); /* xs:dayTimeDuration */ expectedValues.append(QVariant()); /* xs:yearMonthDuration */ - expectedValues.append(QVariant(double(3e3))); /* xs:float */ - expectedValues.append(QVariant(double(4e4))); /* xs:double */ - expectedValues.append(QVariant(double(2))); /* xs:decimal */ + if(sizeof(qreal) == sizeof(float)) {//ARM casts to Float not to double + expectedValues.append(QVariant(float(3e3))); /* xs:float */ + expectedValues.append(QVariant(float(4e4))); /* xs:double */ + expectedValues.append(QVariant(float(2))); /* xs:decimal */ + } else { + expectedValues.append(QVariant(double(3e3))); /* xs:float */ + expectedValues.append(QVariant(double(4e4))); /* xs:double */ + expectedValues.append(QVariant(double(2))); /* xs:decimal */ + } /* xs:integer and its sub-types. */ expectedValues.append(QVariant(qlonglong(16))); @@ -1347,10 +1353,17 @@ void tst_QXmlQuery::basicQtToXQueryTypeCheck() const QVERIFY(!item.isNull()); QVERIFY(item.isAtomicValue()); - QCOMPARE(item.toAtomicValue().toString(), - QLatin1String("4 true 3 654 7 41414141 C 2000-10-11Z 2001-09-10T01:02:03 " - "A QString http://example.com/ 5 6 true true true true true true true true true true " - "true true true")); + if(sizeof(qreal) == sizeof(float)) //ARM casts to Float not to double + QCOMPARE(item.toAtomicValue().toString(), + QLatin1String("4 true 3 654 7 41414141 C 2000-10-11Z 2001-09-10T01:02:03 " + "A QString http://example.com/ 5 6 true false false true true true true true true true " + "true true true")); + else + QCOMPARE(item.toAtomicValue().toString(), + QLatin1String("4 true 3 654 7 41414141 C 2000-10-11Z 2001-09-10T01:02:03 " + "A QString http://example.com/ 5 6 true true true true true true true true true true " + "true true true")); + } void tst_QXmlQuery::bindNode() const |