From 45f66384c560f75477f0554fa0dd5a48d0d8f503 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 22 Jul 2010 14:35:05 +0200 Subject: Added Maemo 6 to the X11 desktopEnvironment list DE_MAEMO6 is set when the rootwindow is MCompositor --- src/gui/kernel/qapplication_x11.cpp | 34 ++++++++++++++++++++++++++++++++++ src/gui/kernel/qt_x11_p.h | 1 + 2 files changed, 35 insertions(+) diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index a4cc5a3..a9fccb0 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -2334,6 +2334,40 @@ void qt_init(QApplicationPrivate *priv, int, X11->desktopEnvironment = DE_4DWM; break; } + + Window windowManagerWindow = XNone; + Atom typeReturned; + int formatReturned; + unsigned long nitemsReturned; + unsigned long unused; + unsigned char *data = 0; + if (XGetWindowProperty(QX11Info::display(), QX11Info::appRootWindow(), + ATOM(_NET_SUPPORTING_WM_CHECK), + 0, 1024, False, XA_WINDOW, &typeReturned, + &formatReturned, &nitemsReturned, &unused, &data) + == Success) { + if (typeReturned == XA_WINDOW && formatReturned == 32) + windowManagerWindow = *((Window*) data); + if (data) + XFree(data); + + if (windowManagerWindow != XNone) { + QString wmName; + Atom utf8atom = ATOM(UTF8_STRING); + if (XGetWindowProperty(QX11Info::display(), windowManagerWindow, ATOM(_NET_WM_NAME), + 0, 1024, False, utf8atom, &typeReturned, + &formatReturned, &nitemsReturned, &unused, &data) + == Success) { + if (typeReturned == utf8atom && formatReturned == 8) + wmName = QString::fromUtf8((const char*)data); + if (data) + XFree(data); + if (wmName == QLatin1String("MCompositor")) + X11->desktopEnvironment = DE_MAEMO6; + } + } + } + } while(0); if (data) diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h index d62d9c3..60bcc51 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_MAEMO6, DE_4DWM }; -- cgit v0.12 From 7e8495a3d14bb5770fd2bdb81616d19e2e1d94af Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Tue, 2 Nov 2010 14:20:00 +0100 Subject: Cleanup Meego Compositor detection Make the code friendlier and rename the enum value to DE_MEEGO_COMPOSITOR Reviewed-by: Robert Griebl --- src/gui/kernel/qapplication_x11.cpp | 44 ++++++++++++++----------------------- src/gui/kernel/qt_x11_p.h | 2 +- 2 files changed, 18 insertions(+), 28 deletions(-) diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index a9fccb0..7c68170 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -2335,35 +2335,25 @@ void qt_init(QApplicationPrivate *priv, int, break; } - Window windowManagerWindow = XNone; - Atom typeReturned; - int formatReturned; - unsigned long nitemsReturned; - unsigned long unused; - unsigned char *data = 0; - if (XGetWindowProperty(QX11Info::display(), QX11Info::appRootWindow(), + if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(_NET_SUPPORTING_WM_CHECK), - 0, 1024, False, XA_WINDOW, &typeReturned, - &formatReturned, &nitemsReturned, &unused, &data) - == Success) { - if (typeReturned == XA_WINDOW && formatReturned == 32) - windowManagerWindow = *((Window*) data); - if (data) + 0, 1024, False, XA_WINDOW, &type, + &format, &length, &after, &data) == Success) { + if (type == XA_WINDOW && format == 32) { + Window windowManagerWindow = *((Window*) data); XFree(data); - - if (windowManagerWindow != XNone) { - QString wmName; - Atom utf8atom = ATOM(UTF8_STRING); - if (XGetWindowProperty(QX11Info::display(), windowManagerWindow, ATOM(_NET_WM_NAME), - 0, 1024, False, utf8atom, &typeReturned, - &formatReturned, &nitemsReturned, &unused, &data) - == Success) { - if (typeReturned == utf8atom && formatReturned == 8) - wmName = QString::fromUtf8((const char*)data); - if (data) - XFree(data); - if (wmName == QLatin1String("MCompositor")) - X11->desktopEnvironment = DE_MAEMO6; + 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; + } + } } } } diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h index 60bcc51..56c8094 100644 --- a/src/gui/kernel/qt_x11_p.h +++ b/src/gui/kernel/qt_x11_p.h @@ -338,7 +338,7 @@ enum DesktopEnvironment { DE_KDE, DE_GNOME, DE_CDE, - DE_MAEMO6, + DE_MEEGO_COMPOSITOR, DE_4DWM }; -- cgit v0.12 From f7048f6dc67d81ea557c43b61192aef0eafd9d98 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 22 Jul 2010 14:42:23 +0200 Subject: Added environment variable for style overriding. This is needed to run all autotests in a specified style by default. Reviewed By: Harald Fernengel --- src/gui/kernel/qapplication.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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); -- cgit v0.12 From 72b5609eb62125dcf9e5c83edb4dc743a255e964 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 22 Jul 2010 14:47:11 +0200 Subject: Added new auto test helper PlatformQuirks. In Future all autotests should use this class to determine, whether the platform has the capabilities needed for this test --- tests/auto/platformquirks.h | 122 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 tests/auto/platformquirks.h diff --git a/tests/auto/platformquirks.h b/tests/auto/platformquirks.h new file mode 100644 index 0000000..cdfe793 --- /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 + +#ifdef QT_GUI_LIB +#include +#endif + +#ifdef Q_WS_X11 +#include +#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; +#endif +#ifdef Q_WS_X11 + if (X11->desktopEnvironment == DE_MAEMO6) + return true; +#endif + return false; + } + + /* 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; +#endif +#ifdef Q_WS_X11 + if (X11->desktopEnvironment == DE_MAEMO6) + return true; +#endif + return false; + } + + static inline bool haveMouseCursor() + { +#ifdef Q_WS_MAEMO_5 + return false; +#endif +#ifdef Q_WS_X11 + if (X11->desktopEnvironment == DE_MAEMO6) + return false; +#endif + return true; + } + + /* 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 + if (X11->desktopEnvironment == DE_MAEMO6) + return PlatformQuirks::mp3; +#endif + return PlatformQuirks::ogg; + } +}; + +#endif + -- cgit v0.12 From b375f4c0fd88c92e76c265198e55c7698c07a505 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Tue, 2 Nov 2010 14:46:02 +0100 Subject: Small cleanup of platformquirks header --- tests/auto/platformquirks.h | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/auto/platformquirks.h b/tests/auto/platformquirks.h index cdfe793..06d23d7 100644 --- a/tests/auto/platformquirks.h +++ b/tests/auto/platformquirks.h @@ -54,12 +54,13 @@ struct PlatformQuirks { - enum MediaFileTypes { - mp3, - wav, - ogg + 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. @@ -68,12 +69,12 @@ struct PlatformQuirks { #ifdef Q_WS_MAEMO_5 return true; -#endif -#ifdef Q_WS_X11 - if (X11->desktopEnvironment == DE_MAEMO6) - return true; -#endif +#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) @@ -83,26 +84,24 @@ struct PlatformQuirks { #ifdef Q_WS_MAEMO_5 return true; -#endif -#ifdef Q_WS_X11 - if (X11->desktopEnvironment == DE_MAEMO6) - return true; -#endif +#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; -#endif -#ifdef Q_WS_X11 - if (X11->desktopEnvironment == DE_MAEMO6) - return false; -#endif +#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() @@ -111,7 +110,8 @@ struct PlatformQuirks return PlatformQuirks::mp3; #endif #ifdef Q_WS_X11 - if (X11->desktopEnvironment == DE_MAEMO6) + // ### very bad assumption + if (X11->desktopEnvironment == DE_MEEGO_COMPOSITOR) return PlatformQuirks::mp3; #endif return PlatformQuirks::ogg; -- cgit v0.12 From 85467f12bae6d748ba5643f4eb518bd63cd80352 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Tue, 2 Nov 2010 14:52:28 +0100 Subject: use PlatformQuirks class for better testing --- tests/auto/qimagereader/tst_qimagereader.cpp | 36 ++++++++++++++++------------ 1 file changed, 21 insertions(+), 15 deletions(-) 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 #include +#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); } } -- cgit v0.12 From 1b103adc6cb443428c5ca7833cafa6ab9da0fa37 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 22 Jul 2010 15:07:21 +0200 Subject: Fixed QColumnView autotests to use a dummy top level widget. This is needed for all platforms which are autoMaximizing top level widgets --- tests/auto/qcolumnview/tst_qcolumnview.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/auto/qcolumnview/tst_qcolumnview.cpp b/tests/auto/qcolumnview/tst_qcolumnview.cpp index 1da8c5d..fbfdf87 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); @@ -718,13 +719,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 +743,9 @@ void tst_QColumnView::moveGrip() QAbstractItemView *column = qobject_cast(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 +891,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); -- cgit v0.12 From 185cf9f10500dc26a5fda44ca38ebeb470218cf3 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 22 Jul 2010 16:30:52 +0200 Subject: Fixed QWaitCondition autotest to use only 2 threads when running on linux and arm --- tests/auto/qwaitcondition/tst_qwaitcondition.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit v0.12 From affe4a42dea9c72bf220e7e57d427a79b6fd099f Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 22 Jul 2010 16:37:07 +0200 Subject: Fixed QTreeWidget autotest, to use a top level dummy widget --- tests/auto/qtreewidget/tst_qtreewidget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp index 1e37384..77d353d 100644 --- a/tests/auto/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp @@ -3098,8 +3098,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); -- cgit v0.12 From 978c1c612aacde31cc294f5ba2ad1af6feeae61c Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 22 Jul 2010 16:43:17 +0200 Subject: Fixed QTextEdit autotest, to use top level dummy widgets --- tests/auto/qtextedit/tst_qtextedit.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)); -- cgit v0.12 From de9a3a8c71079e89173bea8029bbb4d0f3876bd5 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 22 Jul 2010 16:48:19 +0200 Subject: Fixed QTableView autotest to use a dummy toplevel widget. - Fixed some timing problems - Fixed mouseClick center --- tests/auto/qtableview/tst_qtableview.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) 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()); -- cgit v0.12 From b10d49dde4e793f380401900fddfc939d5ff20ba Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 23 Jul 2010 08:41:08 +0200 Subject: Fixed QSplitter autotest to use a dummy toplevel widget. --- tests/auto/qsplitter/tst_qsplitter.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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() << 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()); -- cgit v0.12 From 5034f1774413c78e1d99f4c5e18a6ff8acd8915f Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 23 Jul 2010 08:59:28 +0200 Subject: Fixed QPrinter autotest, to use qreals for the margintest --- tests/auto/qprinter/tst_qprinter.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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("bottom"); QTest::addColumn("unit"); - QTest::newRow("data0") << 5.5 << 6.5 << 7.5 << 8.5 << static_cast(QPrinter::Millimeter); - QTest::newRow("data1") << 5.5 << 6.5 << 7.5 << 8.5 << static_cast(QPrinter::Point); - QTest::newRow("data2") << 5.5 << 6.5 << 7.5 << 8.5 << static_cast(QPrinter::Inch); - QTest::newRow("data3") << 5.5 << 6.5 << 7.5 << 8.5 << static_cast(QPrinter::Pica); - QTest::newRow("data4") << 5.5 << 6.5 << 7.5 << 8.5 << static_cast(QPrinter::Didot); - QTest::newRow("data5") << 5.5 << 6.5 << 7.5 << 8.5 << static_cast(QPrinter::Cicero); + QTest::newRow("data0") << qreal(5.5) << qreal(6.5) << qreal(7.5) << qreal(8.5) << static_cast(QPrinter::Millimeter); + QTest::newRow("data1") << qreal(5.5) << qreal(6.5) << qreal(7.5) << qreal(8.5) << static_cast(QPrinter::Point); + QTest::newRow("data2") << qreal(5.5) << qreal(6.5) << qreal(7.5) << qreal(8.5) << static_cast(QPrinter::Inch); + QTest::newRow("data3") << qreal(5.5) << qreal(6.5) << qreal(7.5) << qreal(8.5) << static_cast(QPrinter::Pica); + QTest::newRow("data4") << qreal(5.5) << qreal(6.5) << qreal(7.5) << qreal(8.5) << static_cast(QPrinter::Didot); + QTest::newRow("data5") << qreal(5.5) << qreal(6.5) << qreal(7.5) << qreal(8.5) << static_cast(QPrinter::Cicero); } void tst_QPrinter::testPageMargins() -- cgit v0.12 From 8a74d2041e24a17e70e1a00d0cc3794250a13fed Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 23 Jul 2010 09:01:27 +0200 Subject: Fixed QPlainTextEdit autotest to use the right size in the linewrap testcase. The framewith has to be also added to the minimum with, otherwise the test will fail when the current style has a bigger border. --- tests/auto/qplaintextedit/tst_qplaintextedit.cpp | 1 + 1 file changed, 1 insertion(+) 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); -- cgit v0.12 From 46115a0b8d3de85170a2600b5abb81458dc263bf Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 23 Jul 2010 09:05:31 +0200 Subject: Fixed the QMouseEvent_modal autotest. Added some waits, needed on slower platforms, like maemo --- tests/auto/qmouseevent_modal/tst_qmouseevent_modal.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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 ); -- cgit v0.12 From 8b68c73d1fe916fafa1e0aa0c59ba3131ebd77cc Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 23 Jul 2010 09:21:38 +0200 Subject: Fixed QMainWindow autotests, to skip an test, that makes no sense on maemo --- tests/auto/qmainwindow/tst_qmainwindow.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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 #include #include +#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"); -- cgit v0.12 From 4280dd6bf4831379eea17e145df1fabc6a9fb901 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 23 Jul 2010 09:29:12 +0200 Subject: Fixed QLayout autotest to use a dummy toplevel widget. --- tests/auto/qlayout/tst_qlayout.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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)); -- cgit v0.12 From b5e984e2d220596dcc3770969c942bbcf6fdc9a5 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 23 Jul 2010 09:32:08 +0200 Subject: Fixed QInputDialog autotest, to compare with the separator defined by the current locale --- tests/auto/qinputdialog/tst_qinputdialog.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 @@ -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(sbox, okButton, "0.0"); testTypingValue(sbox, okButton, "foobar"); - testTypingValue(sbox, okButton, QString("%1").arg(origValue)); + testTypingValue(sbox, okButton, loc.toString(origValue)); } void testGetText(QInputDialog *dialog) -- cgit v0.12 From cb98eee3069549023973b422c5e32929d3a65c6d Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 23 Jul 2010 09:38:05 +0200 Subject: Fixe QHeaderView autotest to use a dummy toplevel widget. --- tests/auto/qheaderview/tst_qheaderview.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) 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, 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); -- cgit v0.12 From 410d46b1cd4da7efc87a9d7cac47f509e1658f03 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 23 Jul 2010 10:04:09 +0200 Subject: Fixed QGripLayout autotest to use a dummy toplevel widget. --- tests/auto/qgridlayout/tst_qgridlayout.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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 #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() -- cgit v0.12 From f7fe120e5cad8329f4b4a9bf9bc7fee0d5fbaf9a Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 23 Jul 2010 10:27:19 +0200 Subject: Fixed QEventLoop autotest. Add a restriction in exec(). Only execute when NO_EVENTLOOP_EXCEPTIONS is not set --- tests/auto/qeventloop/tst_qeventloop.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v0.12 From af082b6b515d45f905aab29e1b685e91bc6f50cf Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 23 Jul 2010 10:49:32 +0200 Subject: Fixed QCalendarWidget autotest to use a dummy toplevel widget. Fixed the MousePress to the right position --- tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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(&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(&object, "qt_calendar_yearedit"); QTest::qWait(500); -- cgit v0.12 From 08864c3ec88abf5fdb782ffe972e2576fc703e8c Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 23 Jul 2010 10:51:20 +0200 Subject: Fixed QBoxLayout autotest to use a dummy toplevel widget --- tests/auto/qboxlayout/tst_qboxlayout.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); -- cgit v0.12 From d16b01310af4f9f1ec8b82eb883863745a7c9204 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 23 Jul 2010 10:53:47 +0200 Subject: Fixed QAbstractSlider autotest to use a dummy toplevel widget --- tests/auto/qabstractslider/tst_qabstractslider.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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; -- cgit v0.12 From 162ff4f01c5700da270f80f3e0decae11f42f6df Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 23 Jul 2010 10:54:38 +0200 Subject: Fixed QAbstractScrollArea autotest to use a dummy toplevel widget --- tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); -- cgit v0.12 From 65bad8e2c8894f23f47ff2b7418bcd1fc71d4602 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 4 Mar 2010 15:34:22 +0100 Subject: Fixed QFileInfo autotest to skip on NFS. Exported the isLikelyToBeNfs() function to skip the fileInfo Test on NFS. Otherwise the Test will fail, because the FileSystemTimes are not synchronized. --- src/corelib/io/qsettings.cpp | 8 ++++---- tests/auto/qfileinfo/tst_qfileinfo.cpp | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 8ee42e7..e5d182e 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -134,7 +134,7 @@ QT_BEGIN_INCLUDE_NAMESPACE # include QT_END_INCLUDE_NAMESPACE -static bool isLikelyToBeNfs(int handle) +Q_AUTOTEST_EXPORT bool isLikelyToBeNfs(int handle) { struct statfs buf; if (fstatfs(handle, &buf) != 0) @@ -160,7 +160,7 @@ QT_END_INCLUDE_NAMESPACE # define AUTOFSNG_SUPER_MAGIC 0x7d92b1a0 # endif -static bool isLikelyToBeNfs(int handle) +Q_AUTOTEST_EXPORT bool isLikelyToBeNfs(int handle) { struct statfs buf; if (fstatfs(handle, &buf) != 0) @@ -177,7 +177,7 @@ QT_BEGIN_INCLUDE_NAMESPACE # include QT_END_INCLUDE_NAMESPACE -static bool isLikelyToBeNfs(int handle) +Q_AUTOTEST_EXPORT bool isLikelyToBeNfs(int handle) { struct statvfs buf; if (fstatvfs(handle, &buf) != 0) @@ -189,7 +189,7 @@ static bool isLikelyToBeNfs(int handle) #endif } #else -static inline bool isLikelyToBeNfs(int /* handle */) +Q_AUTOTEST_EXPORT inline bool isLikelyToBeNfs(int /* handle */) { return true; } diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp index 208110a..0306bb6 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp @@ -70,6 +70,8 @@ # define SRCDIR "" #endif +extern bool isLikelyToBeNfs(int /* handle */); + //TESTED_CLASS= //TESTED_FILES= @@ -939,6 +941,8 @@ 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)); + if(isLikelyToBeNfs(file.handle())) + QSKIP("This Test doesn't work on NFS", SkipAll); QTextStream ts(&file); ts << fileName << endl; } -- cgit v0.12 From efc4e9c3602d569a8437db52c09edd7fb6a6dc34 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Mon, 26 Jul 2010 15:45:54 +0200 Subject: Fixed QXmlQuery autotest to pass when qreal != double --- tests/auto/qxmlquery/tst_qxmlquery.cpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) 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 -- cgit v0.12 From 9967695bf224d6518fa411f0441e0605e61e0bf5 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Mon, 26 Jul 2010 16:15:47 +0200 Subject: Fixed QGraphicsEffect autotest to use platform quirks --- tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 +#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); -- cgit v0.12 From 7a763f19996bc892a63d021e64c570cbfb13f391 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Tue, 27 Jul 2010 09:33:13 +0200 Subject: Fixed QTreeWidget autotest. Added qWaitForWindowShown() --- tests/auto/qtreewidget/tst_qtreewidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp index 77d353d..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))); -- cgit v0.12 From 2eb6556bac03bde101e2135be1114d6835341678 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Tue, 27 Jul 2010 09:43:10 +0200 Subject: Fixed QTreeView autotest to use a dummy toplevel widget --- tests/auto/qtreeview/tst_qtreeview.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) 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); -- cgit v0.12 From 28b4eb0a10b922581f4f7c6a7cdc60383a35a578 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Tue, 27 Jul 2010 10:52:56 +0200 Subject: Fixed QListWidget autotest to use a dummy toplevel widget --- tests/auto/qlistwidget/tst_qlistwidget.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp index eb3fb6b..990945d 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,16 @@ 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.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 +1538,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(); -- cgit v0.12 From 1409261805af661c0f19d109027d44ec04ddbfc4 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Tue, 27 Jul 2010 11:32:28 +0200 Subject: Fixed QGraphicsWidget autotest to use PlatformQuirks. --- tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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 #include #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); -- cgit v0.12 From 27e6214401970b809e0e594cccaa3b3bddad151a Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Tue, 27 Jul 2010 13:47:10 +0200 Subject: Fixed QButtonGroup autotest to run on Maemo --- tests/auto/qbuttongroup/tst_qbuttongroup.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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*"); 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(&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); -- cgit v0.12 From 4dabd36fe0cd52dc297d2fa56c50917314c385a2 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Tue, 27 Jul 2010 14:20:53 +0200 Subject: Fixed QString autotest when QT_QLOCALE_USES_FCVT is set +/-nan tests fail when QT_QLOCALE_USES_FCVT is set Because the behavior of qstrtod and strtod of glibc differs --- tests/auto/qstring/tst_qstring.cpp | 2 ++ 1 file changed, 2 insertions(+) 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) -- cgit v0.12 From 09800d84d99c51941df8b15c2979af79ac750ee3 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Wed, 28 Jul 2010 10:24:18 +0200 Subject: Fixed QMenuBar autotest. Added mainwindow activation --- tests/auto/qmenubar/tst_qmenubar.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index cc9fb0c..392a4a0 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 ); -- cgit v0.12 From 07dfb4618fca86314334f331fe788f9a480ef6db Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Wed, 28 Jul 2010 13:18:50 +0200 Subject: Fixed QMenu autotest to use a dummy toplevel widget Added some waits --- tests/auto/qmenu/tst_qmenu.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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(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()); -- cgit v0.12 From 7c0b56d38541443657b8f99792830c0a06b4d558 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Wed, 28 Jul 2010 13:24:15 +0200 Subject: Fixed QListView autotest to use a dummy toplevel widget --- tests/auto/qlistview/tst_qlistview.cpp | 35 ++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) 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 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(); -- cgit v0.12 From 8c14359f0a43e3a7d196b39cb197d41ff6e4fbea Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 30 Jul 2010 09:25:12 +0200 Subject: Fixed QGraphicsItem autotest to use a dummy toplevel widget --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 67 ++++++++++++++++++-------- 1 file changed, 48 insertions(+), 19 deletions(-) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index a3bd0b0..bfa634f 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,10 @@ void tst_QGraphicsItem::update() { QGraphicsScene scene; scene.setSceneRect(-100, -100, 200, 200); - MyGraphicsView view(&scene); + QWidget topLevel; + MyGraphicsView view(&scene,&topLevel); - view.show(); + topLevel.show(); #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&view); #endif @@ -7776,10 +7790,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 +7995,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 +8033,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 +8132,12 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem() QGraphicsScene scene; scene.setSceneRect(-100, -100, 200, 200); - QGraphicsView view(&scene); - view.show(); + QWidget toplevel; + + QGraphicsView view(&scene, &toplevel); + 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 +10741,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 +10792,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 +10980,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); -- cgit v0.12 From eac4fdc9becea59573a945dff0294e7c3d17ea5b Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 30 Jul 2010 10:37:40 +0200 Subject: Fixed QGraphicsScene autotest to use a dummy toplevel widget --- tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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); -- cgit v0.12 From 8c696e362851c8d98e5895c8f7302f02a1ba685a Mon Sep 17 00:00:00 2001 From: Ralf Engels Date: Tue, 3 Aug 2010 14:31:11 +0200 Subject: Fix QGraphicsItems autotest --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index bfa634f..0b29410 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -7511,6 +7511,7 @@ void tst_QGraphicsItem::update() QWidget topLevel; MyGraphicsView view(&scene,&topLevel); + topLevel.resize(300, 300); topLevel.show(); #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&view); @@ -8135,6 +8136,7 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem() QWidget toplevel; QGraphicsView view(&scene, &toplevel); + toplevel.resize(300, 300); toplevel.show(); #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&toplevel); -- cgit v0.12 From 01956f9244bf6da45745a836333a9baf134c4075 Mon Sep 17 00:00:00 2001 From: Ralf Engels Date: Thu, 5 Aug 2010 14:07:55 +0200 Subject: Fix QListWidget test --- tests/auto/qlistwidget/tst_qlistwidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp index 990945d..6cfd6c5 100644 --- a/tests/auto/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp @@ -1523,6 +1523,7 @@ void tst_QListWidget::fastScroll() for (int i = 0; i < 50; ++i) widget.addItem(QString("Item %1").arg(i)); + 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 -- cgit v0.12 From 193e4fccf1f472a2ff9f6d914d4a27d1e39e568f Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 5 Aug 2010 13:16:44 +0200 Subject: Fixed QAccessability autotest to use a dummy toplevel widget --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 -- cgit v0.12 From 145126c11d71648fa5eeb1abcd023e418fde8022 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 5 Aug 2010 13:20:38 +0200 Subject: Fixed QColumnView autotest. Added an QApplication::processEvents --- tests/auto/qcolumnview/tst_qcolumnview.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qcolumnview/tst_qcolumnview.cpp b/tests/auto/qcolumnview/tst_qcolumnview.cpp index fbfdf87..d4caede 100644 --- a/tests/auto/qcolumnview/tst_qcolumnview.cpp +++ b/tests/auto/qcolumnview/tst_qcolumnview.cpp @@ -429,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; -- cgit v0.12 From 4e063a7c79caf77cff9748ef4e799dbbc1c1346f Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 5 Aug 2010 13:25:35 +0200 Subject: Fixed QComboBox autotest to use a dummy toplevel widget --- tests/auto/qcombobox/tst_qcombobox.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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(); -- cgit v0.12 From 565db9695dc62038e25cd5207731ac4ad59c4a05 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 5 Aug 2010 13:40:08 +0200 Subject: Fixed QPathCliper autotest, to skip a test when qreal != double --- tests/auto/qpathclipper/tst_qpathclipper.cpp | 3 +++ 1 file changed, 3 insertions(+) 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 -- cgit v0.12 From ead0c87a27a48881cb8fcf8319eb14f53e8a9bb1 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 5 Aug 2010 13:43:13 +0200 Subject: Fixed QStyleSheetStyle autotest to use a dummy toplevel widget -use platform quirks to skip tests --- tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 +#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 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(&tabWidget); -- cgit v0.12 From a29718ed16885fd97caa8bdde9e949dd95b11e4b Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 5 Aug 2010 14:58:39 +0200 Subject: Fixed QMenuBar autotest. Changed window activation order. --- tests/auto/qmenubar/tst_qmenubar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index 392a4a0..8dfb976 100644 --- a/tests/auto/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/qmenubar/tst_qmenubar.cpp @@ -1702,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); -- cgit v0.12 From fde9330d0bf8031159df524bba3e5baba339408b Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 6 Aug 2010 09:54:58 +0200 Subject: Fixed QMdiArea autotest to use a dummy toplevel widget. --- tests/auto/qmdiarea/tst_qmdiarea.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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 #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; -- cgit v0.12 From e8544e43a200d769cef1f1c8f9fe3d728192a5f9 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 6 Aug 2010 14:49:09 +0200 Subject: Fixed QGraphicsView autotest to use a dummy toplevel widget Fixed some conversion problems using qreal --- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 148 +++++++++++++++++-------- 1 file changed, 102 insertions(+), 46 deletions(-) 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 #include #include +#include #include #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 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(&view)); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(&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(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("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); -- cgit v0.12 From 3923448118240a21cc169ea54d21f7ae1b324af8 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Tue, 2 Nov 2010 15:56:10 +0100 Subject: Export isLikelyToBeNfs only if we have an internal build --- src/corelib/io/qsettings.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index e5d182e..c94ec7b 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -88,6 +88,12 @@ #define CSIDL_APPDATA 0x001a // \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 QT_END_INCLUDE_NAMESPACE -Q_AUTOTEST_EXPORT 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 -Q_AUTOTEST_EXPORT 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 QT_END_INCLUDE_NAMESPACE -Q_AUTOTEST_EXPORT bool isLikelyToBeNfs(int handle) +Q_AUTOTEST_EXPORT_HELPER bool isLikelyToBeNfs(int handle) { struct statvfs buf; if (fstatvfs(handle, &buf) != 0) @@ -189,7 +195,7 @@ Q_AUTOTEST_EXPORT bool isLikelyToBeNfs(int handle) #endif } #else -Q_AUTOTEST_EXPORT inline bool isLikelyToBeNfs(int /* handle */) +Q_AUTOTEST_EXPORT_HELPER inline bool isLikelyToBeNfs(int /* handle */) { return true; } -- cgit v0.12 From c76f883b9c48acea35fe04cfe6dbf5036b224dd2 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Tue, 2 Nov 2010 15:58:09 +0100 Subject: fix isLikelyToBeNfs usage --- tests/auto/qfileinfo/tst_qfileinfo.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp index 0306bb6..910ed97 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp @@ -70,7 +70,7 @@ # define SRCDIR "" #endif -extern bool isLikelyToBeNfs(int /* handle */); +extern Q_AUTOTEST_EXPORT bool isLikelyToBeNfs(int /* handle */); //TESTED_CLASS= //TESTED_FILES= @@ -941,8 +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)); - if(isLikelyToBeNfs(file.handle())) +#ifdef Q_OS_UNIX + if (isLikelyToBeNfs(file.handle())) QSKIP("This Test doesn't work on NFS", SkipAll); +#endif QTextStream ts(&file); ts << fileName << endl; } -- cgit v0.12 From 561aeb6b8f7bc4ddb5e6d3e5cbc0ddc9cd344aa9 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Tue, 2 Nov 2010 16:53:38 +0100 Subject: Fix crash check the global network proxy for 0 before dereferencing Reviewed-by: Robert Griebl --- src/network/kernel/qnetworkproxy.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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::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(); } /*! -- cgit v0.12