diff options
Diffstat (limited to 'tests')
38 files changed, 286 insertions, 47 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index dd70d78ae5..c40e3d1140 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -24,7 +24,7 @@ ios: SUBDIRS = corelib gui wince: SUBDIRS -= printsupport cross_compile: SUBDIRS -= tools cmake installed_cmake !qtHaveModule(opengl): SUBDIRS -= opengl -!qtHaveModule(gui): SUBDIRS -= gui cmake installed_cmake +!qtHaveModule(gui): SUBDIRS -= gui !qtHaveModule(widgets): SUBDIRS -= widgets !qtHaveModule(printsupport): SUBDIRS -= printsupport !qtHaveModule(concurrent): SUBDIRS -= concurrent diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt index 1abbef0d68..c780096854 100644 --- a/tests/auto/cmake/CMakeLists.txt +++ b/tests/auto/cmake/CMakeLists.txt @@ -116,13 +116,18 @@ endif() set(qt_module_includes Core QObject - Gui QImage Network QHostInfo Sql QSqlError Test QTestEventList Xml QDomDocument ) +if (NOT NO_GUI) + list(APPEND qt_module_includes + Gui QImage + ) +endif() + if (NOT NO_WIDGETS) list(APPEND qt_module_includes Widgets QWidget diff --git a/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt b/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt index cc54bf5bc3..6fe7e56d24 100644 --- a/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt +++ b/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt @@ -34,7 +34,9 @@ macro(test_testlib_project _module) endmacro() add_subdirectory(core_only) -add_subdirectory(gui) +if(NOT NO_GUI) + add_subdirectory(gui) +endif() if(NOT NO_WIDGETS) add_subdirectory(widgets) endif() diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index f608a36214..ce227a6c8b 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -774,6 +774,17 @@ void tst_qmessagehandler::qMessagePattern_data() << true << (QList<QByteArray>() << ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toUtf8() + "/qDebug")); + QTest::newRow("time-time") << "/%{time yyyy - MM - d}/%{time dd-MM-yy}/%{message}" + << true << (QList<QByteArray>() + << ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toUtf8() + + '/' + QDateTime::currentDateTime().toString("dd-MM-yy").toUtf8() + + "/qDebug")); + + QTest::newRow("skipped-time-shown-time") + << "/%{if-warning}%{time yyyy - MM - d}%{endif}%{if-debug}%{time dd-MM-yy}%{endif}/%{message}" + << true << (QList<QByteArray>() + << ('/' + QDateTime::currentDateTime().toString("dd-MM-yy").toUtf8() + "/qDebug")); + // %{time} should have a padding of 6 so if it takes less than 10 seconds to show // the first message, there should be 5 spaces QTest::newRow("time-process") << "<%{time process}>%{message}" << true << (QList<QByteArray>() diff --git a/tests/auto/corelib/io/qstandardpaths/BLACKLIST b/tests/auto/corelib/io/qstandardpaths/BLACKLIST deleted file mode 100644 index 8496a620b3..0000000000 --- a/tests/auto/corelib/io/qstandardpaths/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[testRuntimeDirectory] -rhel-7.1 diff --git a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp index 838120bb68..914f9e2b9b 100644 --- a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp +++ b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp @@ -54,6 +54,7 @@ private slots: void qvariantCast(); void constPointer(); + void constQPointer(); }; void tst_QPointer::constructors() @@ -397,6 +398,21 @@ void tst_QPointer::constPointer() delete fp.data(); } +void tst_QPointer::constQPointer() +{ + // Check that const QPointers work. It's a bit weird to mark a pointer + // const if its value can change, but the shallow-const principle in C/C++ + // allows this, and people use it, so document it with a test. + // + // It's unlikely that this test will fail in and out of itself, but it + // presents the use-case to static and dynamic checkers that can raise + // a warning (hopefully) should this become an issue. + QObject *o = new QObject(this); + const QPointer<QObject> p = o; + delete o; + QVERIFY(!p); +} + QTEST_MAIN(tst_QPointer) #include "tst_qpointer.moc" diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 32c2154da6..7f6e26eecb 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -276,6 +276,8 @@ private slots: void compareSanity_data(); void compareSanity(); + void accessSequentialContainerKey(); + private: void dataStream_data(QDataStream::Version version); void loadQVariantFromDataStream(QDataStream::Version version); @@ -4763,5 +4765,30 @@ void tst_QVariant::compareSanity() } } +void tst_QVariant::accessSequentialContainerKey() +{ + QString nameResult; + + { + QMap<QString, QObject*> mapping; + QString name = QString::fromLatin1("Seven"); + mapping.insert(name, Q_NULLPTR); + + QVariant variant = QVariant::fromValue(mapping); + + QAssociativeIterable iterable = variant.value<QAssociativeIterable>(); + QAssociativeIterable::const_iterator iit = iterable.begin(); + const QAssociativeIterable::const_iterator end = iterable.end(); + for ( ; iit != end; ++iit) { + nameResult += iit.key().toString(); + } + } // Destroy mapping + // Regression test for QTBUG-52246 - no memory corruption/double deletion + // of the string key. + + QCOMPARE(nameResult, QStringLiteral("Seven")); +} + + QTEST_MAIN(tst_QVariant) #include "tst_qvariant.moc" diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index d8fb39f77f..91df1ca520 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -193,6 +193,7 @@ private slots: void metadataPassthrough(); void pixelColor(); + void pixel(); private: const QString m_prefix; @@ -3085,5 +3086,33 @@ void tst_QImage::pixelColor() QCOMPARE(t.pixel(0,0), argb32pm.pixel(0,0)); } +void tst_QImage::pixel() +{ + { + QImage mono(1, 1, QImage::Format_Mono); + QImage monolsb(1, 1, QImage::Format_MonoLSB); + QImage indexed(1, 1, QImage::Format_Indexed8); + + mono.fill(0); + monolsb.fill(0); + indexed.fill(0); + + QCOMPARE(QColor(mono.pixel(0, 0)), QColor(Qt::black)); + QCOMPARE(QColor(monolsb.pixel(0, 0)), QColor(Qt::black)); + indexed.pixel(0, 0); // Don't crash + } + + { + uchar a = 0; + QImage mono(&a, 1, 1, QImage::Format_Mono); + QImage monolsb(&a, 1, 1, QImage::Format_MonoLSB); + QImage indexed(&a, 1, 1, QImage::Format_Indexed8); + + QCOMPARE(QColor(mono.pixel(0, 0)), QColor(Qt::black)); + QCOMPARE(QColor(monolsb.pixel(0, 0)), QColor(Qt::black)); + indexed.pixel(0, 0); // Don't crash + } +} + QTEST_GUILESS_MAIN(tst_QImage) #include "tst_qimage.moc" diff --git a/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_16x16.png b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_16x16.png Binary files differindex e9a995e19e..03b1a65f70 100644 --- a/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_16x16.png +++ b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_16x16.png diff --git a/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_32x32.png b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_32x32.png Binary files differindex 41ef57f94d..0ef47c556d 100644 --- a/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_32x32.png +++ b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_32x32.png diff --git a/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_48x48.png b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_48x48.png Binary files differindex 35d60d138b..2060854802 100644 --- a/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_48x48.png +++ b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_48x48.png diff --git a/tests/auto/gui/image/qpixmap/loadFromData/designer_argb32.png b/tests/auto/gui/image/qpixmap/loadFromData/designer_argb32.png Binary files differindex 55d8247cfc..a35316b9c9 100644 --- a/tests/auto/gui/image/qpixmap/loadFromData/designer_argb32.png +++ b/tests/auto/gui/image/qpixmap/loadFromData/designer_argb32.png diff --git a/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_no_alpha.png b/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_no_alpha.png Binary files differindex 28cd2f06d1..3dd2115df1 100644 --- a/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_no_alpha.png +++ b/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_no_alpha.png diff --git a/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_with_alpha.png b/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_with_alpha.png Binary files differindex 09735a9752..99cbf4f13a 100644 --- a/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_with_alpha.png +++ b/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_with_alpha.png diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST index 0622ba30b7..0cf16b043e 100644 --- a/tests/auto/gui/kernel/qwindow/BLACKLIST +++ b/tests/auto/gui/kernel/qwindow/BLACKLIST @@ -1,5 +1,3 @@ -[testInputEvents] -rhel-7.1 [positioning:default] ubuntu-14.04 [modalWindowPosition] diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index d553854cb2..b5032c8c35 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -603,7 +603,7 @@ void tst_QLocalSocket::readBufferOverflow() serverSocket->write(buffer, dataBufferSize); #ifndef Q_OS_WIN // The data is not immediately sent, but buffered. - // On Windows, the flushing is done asynchronously by a separate thread. + // On Windows, the flushing is done by an asynchronous write operation. // However, this operation will never complete as long as the data is not // read by the other end, so the call below always times out. // On Unix, the flushing is synchronous and thus needs to be done before diff --git a/tests/auto/opengl/qgl/BLACKLIST b/tests/auto/opengl/qgl/BLACKLIST index 547a9a2a73..fa7c829b30 100644 --- a/tests/auto/opengl/qgl/BLACKLIST +++ b/tests/auto/opengl/qgl/BLACKLIST @@ -1,5 +1,3 @@ -[] -rhel-7.1 [glWidgetRendering] windows [glFBORendering] diff --git a/tests/auto/other/lancelot/images/alpha2x2.png b/tests/auto/other/lancelot/images/alpha2x2.png Binary files differindex 67ecc04286..8e99feb4cc 100644 --- a/tests/auto/other/lancelot/images/alpha2x2.png +++ b/tests/auto/other/lancelot/images/alpha2x2.png diff --git a/tests/auto/other/lancelot/images/solid2x2.png b/tests/auto/other/lancelot/images/solid2x2.png Binary files differindex ad67cd3e12..f34562f964 100644 --- a/tests/auto/other/lancelot/images/solid2x2.png +++ b/tests/auto/other/lancelot/images/solid2x2.png diff --git a/tests/auto/other/lancelot/scripts/statictext.qps b/tests/auto/other/lancelot/scripts/statictext.qps index c5ddda197f..6b7b97d8fa 100644 --- a/tests/auto/other/lancelot/scripts/statictext.qps +++ b/tests/auto/other/lancelot/scripts/statictext.qps @@ -9,7 +9,7 @@ save setFont "sansserif" 12 normal drawStaticText 0 40 "sansserif 12pt, normal" - setFont "sansserif" 10 bold + setFont "sansserif" 12 bold drawStaticText 0 60 "sansserif 12pt, bold" setFont "sansserif" 10 bold italic @@ -25,7 +25,7 @@ save setFont "sansserif" 12 normal drawStaticText 0 40 "alpha sansserif 12pt, normal" - setFont "sansserif" 10 bold + setFont "sansserif" 12 bold drawStaticText 0 60 "alpha sansserif 12pt, bold" setFont "sansserif" 10 bold italic @@ -43,7 +43,7 @@ save setFont "sansserif" 12 normal drawStaticText 0 40 "scaled sansserif 12pt, normal" - setFont "sansserif" 10 bold + setFont "sansserif" 12 bold drawStaticText 0 60 "scaled sansserif 12pt, bold" setFont "sansserif" 10 bold italic @@ -61,7 +61,7 @@ save setFont "sansserif" 12 normal drawStaticText 0 40 "flipped sansserif 12pt, normal" - setFont "sansserif" 10 bold + setFont "sansserif" 12 bold drawStaticText 0 60 "flipped sansserif 12pt, bold" setFont "sansserif" 10 bold italic @@ -75,16 +75,16 @@ save rotate 185 setFont "sansserif" 10 normal - drawStaticText 0 20 "scaled sansserif 10pt, normal" + drawStaticText 0 20 "rotated sansserif 10pt, normal" setFont "sansserif" 12 normal - drawStaticText 0 40 "scaled sansserif 12pt, normal" + drawStaticText 0 40 "rotated sansserif 12pt, normal" - setFont "sansserif" 10 bold - drawStaticText 0 60 "scaled sansserif 12pt, bold" + setFont "sansserif" 12 bold + drawStaticText 0 60 "rotated sansserif 12pt, bold" setFont "sansserif" 10 bold italic - drawStaticText 0 80 "scaled sansserif 10pt, bold italic" + drawStaticText 0 80 "rotated sansserif 10pt, bold italic" restore translate 0 100 @@ -100,7 +100,7 @@ save setFont "sansserif" 12 normal drawStaticText 0 20 "gradient sansserif 12pt, normal" - setFont "sansserif" 10 bold + setFont "sansserif" 12 bold drawStaticText 0 40 "gradient sansserif 12pt, bold" setFont "sansserif" 10 bold italic diff --git a/tests/auto/other/lancelot/scripts/text.qps b/tests/auto/other/lancelot/scripts/text.qps index 169549a5bd..1b4fe4f064 100644 --- a/tests/auto/other/lancelot/scripts/text.qps +++ b/tests/auto/other/lancelot/scripts/text.qps @@ -77,16 +77,16 @@ save rotate 185 setFont "sansserif" 10 normal - drawText 0 20 "scaled sansserif 10pt, normal" + drawText 0 20 "rotated sansserif 10pt, normal" setFont "sansserif" 12 normal - drawText 0 40 "scaled sansserif 12pt, normal" + drawText 0 40 "rotated sansserif 12pt, normal" setFont "sansserif" 12 bold - drawText 0 60 "scaled sansserif 12pt, bold" + drawText 0 60 "rotated sansserif 12pt, bold" setFont "sansserif" 10 bold italic - drawText 0 80 "scaled sansserif 10pt, bold italic" + drawText 0 80 "rotated sansserif 10pt, bold italic" restore translate 0 100 diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 5154351bb1..4a423b036c 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -622,6 +622,8 @@ private slots: void unnamedNamespaceObjectsAndGadgets(); void veryLongStringData(); void gadgetHierarchy(); + void optionsFileError_data(); + void optionsFileError(); signals: void sigWithUnsignedArg(unsigned foo); @@ -3497,6 +3499,31 @@ void tst_Moc::gadgetHierarchy() QCOMPARE(GrandParentGadget::DerivedGadget::staticMetaObject.superClass(), &GrandParentGadget::BaseGadget::staticMetaObject); } +void tst_Moc::optionsFileError_data() +{ + QTest::addColumn<QString>("optionsArgument"); + QTest::newRow("no filename") << QStringLiteral("@"); + QTest::newRow("nonexistent file") << QStringLiteral("@letshuntasnark"); +} + +void tst_Moc::optionsFileError() +{ +#ifdef MOC_CROSS_COMPILED + QSKIP("Not tested when cross-compiled"); +#endif +#if !defined(QT_NO_PROCESS) + QFETCH(QString, optionsArgument); + QProcess p; + p.start(m_moc, QStringList(optionsArgument)); + QVERIFY(p.waitForFinished()); + QCOMPARE(p.exitCode(), 1); + QVERIFY(p.readAllStandardOutput().isEmpty()); + const QByteArray err = p.readAllStandardError(); + QVERIFY(err.contains("moc: ")); + QVERIFY(!err.contains("QCommandLineParser")); +#endif +} + QTEST_MAIN(tst_Moc) // the generated code must compile with QT_NO_KEYWORDS diff --git a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST index 5fd026537e..669ec50978 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST +++ b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST @@ -1,7 +1,3 @@ [task256466_wrongStyle] opensuse-13.1 rhel-7.1 -[setFont] -ubuntu-14.04 -redhatenterpriselinuxworkstation-6.6 -rhel-7.1 diff --git a/tests/auto/widgets/effects/qpixmapfilter/noise.png b/tests/auto/widgets/effects/qpixmapfilter/noise.png Binary files differindex 1bebaf528e..c8433602b2 100644 --- a/tests/auto/widgets/effects/qpixmapfilter/noise.png +++ b/tests/auto/widgets/effects/qpixmapfilter/noise.png diff --git a/tests/auto/widgets/gestures/qgesturerecognizer/BLACKLIST b/tests/auto/widgets/gestures/qgesturerecognizer/BLACKLIST index 14c41711ac..7f55c2dae0 100644 --- a/tests/auto/widgets/gestures/qgesturerecognizer/BLACKLIST +++ b/tests/auto/widgets/gestures/qgesturerecognizer/BLACKLIST @@ -1,8 +1,2 @@ [panGesture:Two finger] xcb -[swipeGesture:SmallDirectionChange] -rhel-7.1 -[swipeGesture:Line] -rhel-7.1 -[pinchGesture:Standard] -rhel-7.1 diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 8d18d40e05..4563da8d48 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -32,7 +32,6 @@ osx osx [widgetAt] osx -rhel-7.1 [sheetOpacity] osx [resizeEvent] @@ -65,10 +64,8 @@ osx osx [taskQTBUG_4055_sendSyntheticEnterLeave] osx -rhel-7.1 [syntheticEnterLeave] osx -rhel-7.1 [maskedUpdate] osx [hideWhenFocusWidgetIsChild] diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index ae48445363..1a9d7ec4d2 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -456,6 +456,8 @@ private slots: void qmlSetParentHelper(); + void testForOutsideWSRangeFlag(); + private: bool ensureScreenSize(int width, int height); QWidget *testWidget; @@ -10544,5 +10546,69 @@ void tst_QWidget::qmlSetParentHelper() #endif } +void tst_QWidget::testForOutsideWSRangeFlag() +{ + // QTBUG-49445 + { + QWidget widget; + widget.resize(0, 0); + widget.show(); + QTest::qWait(100); // Wait for a while... + QVERIFY(!widget.windowHandle()->isExposed()); // The window should not be visible + QVERIFY(widget.isVisible()); // The widget should be in visible state + } + { + QWidget widget; + + QWidget native(&widget); + native.setAttribute(Qt::WA_NativeWindow); + native.resize(0, 0); + + widget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); + QVERIFY(!native.windowHandle()->isExposed()); + } + { + QWidget widget; + QWidget native(&widget); + + widget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); + QVERIFY(native.isVisible()); + + native.resize(0, 0); + native.setAttribute(Qt::WA_NativeWindow); + QTest::qWait(100); // Wait for a while... + QVERIFY(!native.windowHandle()->isExposed()); + } + + // QTBUG-48321 + { + QWidget widget; + + QWidget native(&widget); + native.setAttribute(Qt::WA_NativeWindow); + + widget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); + QVERIFY(native.windowHandle()->isExposed()); + + native.resize(0, 0); + QTest::qWait(100); // Wait for a while... + QVERIFY(!native.windowHandle()->isExposed()); + } + + // QTBUG-51788 + { + QWidget widget; + widget.setLayout(new QGridLayout); + widget.layout()->addWidget(new QLineEdit); + widget.resize(0, 0); + widget.show(); + // The layout should change the size, so the widget must be visible! + QVERIFY(QTest::qWaitForWindowExposed(&widget)); + } +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index f667d6f8fb..37b72cc99c 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp @@ -124,6 +124,8 @@ private slots: void defaultFont(); void testDrawingShortcuts(); void testFrameOnlyAroundContents(); + + void testProxyCalled(); private: void lineUpLayoutTest(QStyle *); QWidget *testWidget; @@ -789,5 +791,51 @@ void tst_QStyle::testFrameOnlyAroundContents() } +class ProxyTest: public QProxyStyle +{ + Q_OBJECT +public: + ProxyTest(QStyle *style = 0) + :QProxyStyle(style) + , called(false) + {} + + void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const Q_DECL_OVERRIDE { + called = true; + return QProxyStyle::drawPrimitive(pe, opt, p, w); + } + mutable bool called; +}; + + +void tst_QStyle::testProxyCalled() +{ + QToolButton b; + b.setArrowType(Qt::DownArrow); + QStyleOptionToolButton opt; + opt.init(&b); + opt.features |= QStyleOptionToolButton::Arrow; + QPixmap surface(QSize(200, 200)); + QPainter painter(&surface); + + QStringList keys = QStyleFactory::keys(); + QVector<QStyle*> styles; + styles.reserve(keys.size() + 1); + + styles << new QCommonStyle(); + + Q_FOREACH (const QString &key, keys) { + styles << QStyleFactory::create(key); + } + + Q_FOREACH (QStyle *style, styles) { + ProxyTest testStyle; + testStyle.setBaseStyle(style); + style->drawControl(QStyle::CE_ToolButtonLabel, &opt, &painter, &b); + QVERIFY(testStyle.called); + delete style; + } +} + QTEST_MAIN(tst_QStyle) #include "tst_qstyle.moc" diff --git a/tests/auto/widgets/widgets/qcombobox/qtlogoinverted.png b/tests/auto/widgets/widgets/qcombobox/qtlogoinverted.png Binary files differindex 61efb2f001..af150a697b 100644 --- a/tests/auto/widgets/widgets/qcombobox/qtlogoinverted.png +++ b/tests/auto/widgets/widgets/qcombobox/qtlogoinverted.png diff --git a/tests/auto/widgets/widgets/qmdisubwindow/BLACKLIST b/tests/auto/widgets/widgets/qmdisubwindow/BLACKLIST deleted file mode 100644 index a10cf663d0..0000000000 --- a/tests/auto/widgets/widgets/qmdisubwindow/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[setSystemMenu] -rhel-7.1 diff --git a/tests/auto/widgets/widgets/qmenu/BLACKLIST b/tests/auto/widgets/widgets/qmenu/BLACKLIST index dbc3e26837..de49d5ff45 100644 --- a/tests/auto/widgets/widgets/qmenu/BLACKLIST +++ b/tests/auto/widgets/widgets/qmenu/BLACKLIST @@ -1,5 +1,2 @@ [task258920_mouseBorder] osx -rhel-7.1 -[pushButtonPopulateOnAboutToShow] -rhel-7.1 diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp index 63f3522214..6ad13cd781 100644 --- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp @@ -149,6 +149,7 @@ private slots: #ifndef QT_NO_CONTEXTMENU void contextMenu(); #endif + void inputMethodCursorRect(); private: void createSelection(); @@ -1722,5 +1723,17 @@ void tst_QPlainTextEdit::contextMenu() } #endif // QT_NO_CONTEXTMENU +// QTBUG-51923: Verify that the cursor rectangle returned by the input +// method query correctly reflects the viewport offset. +void tst_QPlainTextEdit::inputMethodCursorRect() +{ + ed->setPlainText("Line1\nLine2Line3\nLine3"); + ed->moveCursor(QTextCursor::End); + const QRectF cursorRect = ed->cursorRect(); + const QVariant cursorRectV = ed->inputMethodQuery(Qt::ImCursorRectangle); + QCOMPARE(cursorRectV.type(), QVariant::RectF); + QCOMPARE(cursorRectV.toRect(), cursorRect.toRect()); +} + QTEST_MAIN(tst_QPlainTextEdit) #include "tst_qplaintextedit.moc" diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index 26ccc08f9b..f1ebfda88b 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -186,6 +186,7 @@ private slots: void inputMethodQuery(); void inputMethodQueryImHints_data(); void inputMethodQueryImHints(); + void inputMethodCursorRect(); void highlightLongLine(); @@ -2468,6 +2469,18 @@ void tst_QTextEdit::inputMethodQueryImHints() QCOMPARE(static_cast<Qt::InputMethodHints>(value.toInt()), hints); } +// QTBUG-51923: Verify that the cursor rectangle returned by the input +// method query correctly reflects the viewport offset. +void tst_QTextEdit::inputMethodCursorRect() +{ + ed->setPlainText("Line1\nLine2Line3\nLine3"); + ed->moveCursor(QTextCursor::End); + const QRectF cursorRect = ed->cursorRect(); + const QVariant cursorRectV = ed->inputMethodQuery(Qt::ImCursorRectangle); + QCOMPARE(cursorRectV.type(), QVariant::RectF); + QCOMPARE(cursorRectV.toRect(), cursorRect.toRect()); +} + void tst_QTextEdit::highlightLongLine() { QTextEdit edit; diff --git a/tests/benchmarks/corelib/kernel/qcoreapplication/qcoreapplication.pro b/tests/benchmarks/corelib/kernel/qcoreapplication/qcoreapplication.pro index 6896b3ff55..8bf8487a5f 100644 --- a/tests/benchmarks/corelib/kernel/qcoreapplication/qcoreapplication.pro +++ b/tests/benchmarks/corelib/kernel/qcoreapplication/qcoreapplication.pro @@ -1,4 +1,4 @@ -QT += testlib +QT = core testlib TEMPLATE = app TARGET = tst_bench_qcoreapplication diff --git a/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro b/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro index 8ea7200d53..8a8e9f25d3 100644 --- a/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro +++ b/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro @@ -1,5 +1,6 @@ TARGET = tst_bench_qvariant QT += testlib +!qtHaveModule(gui): QT -= gui CONFIG += release #CONFIG += debug diff --git a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp index 1d4d840ec1..9abb9466df 100644 --- a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp @@ -27,7 +27,9 @@ ****************************************************************************/ #include <QtCore> -#include <QtGui/QPixmap> +#ifdef QT_GUI_LIB +# include <QtGui/QPixmap> +#endif #include <qtest.h> #define ITERATION_COUNT 1e5 @@ -42,7 +44,9 @@ private slots: void floatVariantCreation(); void rectVariantCreation(); void stringVariantCreation(); +#ifdef QT_GUI_LIB void pixmapVariantCreation(); +#endif void stringListVariantCreation(); void bigClassVariantCreation(); void smallClassVariantCreation(); @@ -153,10 +157,12 @@ void tst_qvariant::stringVariantCreation() variantCreation<QString>(QString()); } +#ifdef QT_GUI_LIB void tst_qvariant::pixmapVariantCreation() { variantCreation<QPixmap>(QPixmap()); } +#endif void tst_qvariant::stringListVariantCreation() { diff --git a/tests/benchmarks/network/access/qnetworkdiskcache/qnetworkdiskcache.pro b/tests/benchmarks/network/access/qnetworkdiskcache/qnetworkdiskcache.pro index 9de05b5e65..a9e040bf1e 100644 --- a/tests/benchmarks/network/access/qnetworkdiskcache/qnetworkdiskcache.pro +++ b/tests/benchmarks/network/access/qnetworkdiskcache/qnetworkdiskcache.pro @@ -1,8 +1,7 @@ TEMPLATE = app TARGET = tst_bench_qnetworkdiskcache -QT += gui # for QDesktopServices -QT += network testlib +QT = core network testlib CONFIG += release diff --git a/tests/benchmarks/network/access/qnetworkreply_from_cache/qnetworkreply_from_cache.pro b/tests/benchmarks/network/access/qnetworkreply_from_cache/qnetworkreply_from_cache.pro index bd3b34473f..e1fabffe4d 100644 --- a/tests/benchmarks/network/access/qnetworkreply_from_cache/qnetworkreply_from_cache.pro +++ b/tests/benchmarks/network/access/qnetworkreply_from_cache/qnetworkreply_from_cache.pro @@ -1,3 +1,3 @@ TARGET = tst_bench_qnetworkreply_from_cache -QT += network testlib +QT = core network testlib SOURCES += tst_qnetworkreply_from_cache.cpp |