summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2018-07-27 11:22:57 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2018-07-31 13:33:14 +0200
commit23c9d4c98f3c6729b56700edc1d7144b444b16db (patch)
tree27b20ccbf3c101dbc7bcb1e509882b6c7fc75962 /tests
parentf69a5857d115786f44d053e68c36f74526020e82 (diff)
parent0ef66e98ccf4946a0e4513ab5fc157df0f0aca4e (diff)
Merge branch '5.11' into dev
Conflicts: qmake/library/qmakebuiltins.cpp src/plugins/platforms/windows/qwindowstabletsupport.h src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/styles/qstylesheetstyle.cpp tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp Done-With: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I000b0eb3cea2a5c7a99b95732bfdd41507cf916e
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/io/largefile/tst_largefile.cpp6
-rw-r--r--tests/auto/corelib/io/qdir/tst_qdir.cpp44
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp48
-rw-r--r--tests/auto/corelib/plugin/plugin.pro1
-rw-r--r--tests/auto/corelib/plugin/qplugin/invalidplugin/invalidplugin.pro5
-rw-r--r--tests/auto/corelib/plugin/qplugin/invalidplugin/main.cpp49
-rw-r--r--tests/auto/corelib/plugin/qplugin/qplugin.pro4
-rw-r--r--tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp108
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp2
-rw-r--r--tests/auto/corelib/tools/qcollator/tst_qcollator.cpp3
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp12
11 files changed, 261 insertions, 21 deletions
diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp
index 2d13e6166d..dca7672b8e 100644
--- a/tests/auto/corelib/io/largefile/tst_largefile.cpp
+++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp
@@ -510,7 +510,7 @@ void tst_LargeFile::mapFile()
//Mac: memory-mapping beyond EOF may succeed but it could generate bus error on access
//FreeBSD: same
//Linux: memory-mapping beyond EOF usually succeeds, but depends on the filesystem
-// 32-bit: limited to 44-bit offsets
+// 32-bit: limited to 44-bit offsets (when sizeof(off_t) == 8)
//Windows: memory-mapping beyond EOF is not allowed
void tst_LargeFile::mapOffsetOverflow()
{
@@ -521,9 +521,9 @@ void tst_LargeFile::mapOffsetOverflow()
#else
Succeeds = true,
# if (defined(Q_OS_LINUX) || defined(Q_OS_ANDROID)) && Q_PROCESSOR_WORDSIZE == 4
- MaxOffset = 43
+ MaxOffset = sizeof(QT_OFF_T) > 4 ? 43 : 30
# else
- MaxOffset = 63
+ MaxOffset = 8 * sizeof(QT_OFF_T) - 1
# endif
#endif
};
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp
index 83492188a9..afa15fe895 100644
--- a/tests/auto/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp
@@ -56,6 +56,12 @@
#define Q_NO_SYMLINKS
#endif
+#ifdef Q_OS_WIN
+#define DRIVE "Q:"
+#else
+#define DRIVE
+#endif
+
#ifdef QT_BUILD_INTERNAL
QT_BEGIN_NAMESPACE
@@ -1385,14 +1391,12 @@ void tst_QDir::absoluteFilePath_data()
QTest::addColumn<QString>("expectedFilePath");
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
- QTest::newRow("UNC") << "//machine" << "share" << "//machine/share";
- QTest::newRow("Drive") << "c:/side/town" << "/my/way/home" << "c:/my/way/home";
-#endif
-
-#ifdef Q_OS_WIN
-#define DRIVE "Q:"
-#else
-#define DRIVE
+ QTest::newRow("UNC-rel") << "//machine/share" << "dir" << "//machine/share/dir";
+ QTest::newRow("UNC-abs") << "//machine/share/path/to/blah" << "/dir" << "//machine/share/dir";
+ QTest::newRow("UNC-UNC") << "//machine/share/path/to/blah" << "//host/share/path" << "//host/share/path";
+ QTest::newRow("Drive-UNC") << "c:/side/town" << "//host/share/path" << "//host/share/path";
+ QTest::newRow("Drive-LTUNC") << "c:/side/town" << "\\/leaning\\toothpick/path" << "\\/leaning\\toothpick/path";
+ QTest::newRow("Drive-abs") << "c:/side/town" << "/my/way/home" << "c:/my/way/home";
#endif
QTest::newRow("0") << DRIVE "/etc" << "/passwd" << DRIVE "/passwd";
@@ -1401,8 +1405,10 @@ void tst_QDir::absoluteFilePath_data()
QTest::newRow("3") << "relative" << "path" << QDir::currentPath() + "/relative/path";
QTest::newRow("4") << "" << "" << QDir::currentPath();
- QTest::newRow("resource") << ":/prefix" << "foo.bar" << ":/prefix/foo.bar";
-#undef DRIVE
+ // Resource paths are absolute:
+ QTest::newRow("resource-rel") << ":/prefix" << "foo.bar" << ":/prefix/foo.bar";
+ QTest::newRow("abs-res-res") << ":/prefix" << ":/abc.txt" << ":/abc.txt";
+ QTest::newRow("abs-res-path") << DRIVE "/etc" << ":/abc.txt" << ":/abc.txt";
}
void tst_QDir::absoluteFilePath()
@@ -1517,12 +1523,17 @@ void tst_QDir::filePath_data()
QTest::addColumn<QString>("fileName");
QTest::addColumn<QString>("expectedFilePath");
- QTest::newRow("0") << "/etc" << "/passwd" << "/passwd";
- QTest::newRow("1") << "/etc" << "passwd" << "/etc/passwd";
- QTest::newRow("2") << "/" << "passwd" << "/passwd";
- QTest::newRow("3") << "relative" << "path" << "relative/path";
- QTest::newRow("4") << "" << "" << ".";
+ QTest::newRow("abs-abs") << DRIVE "/etc" << DRIVE "/passwd" << DRIVE "/passwd";
+ QTest::newRow("abs-rel") << DRIVE "/etc" << "passwd" << DRIVE "/etc/passwd";
+ QTest::newRow("root-rel") << DRIVE "/" << "passwd" << DRIVE "/passwd";
+ QTest::newRow("rel-rel") << "relative" << "path" << "relative/path";
+ QTest::newRow("empty-empty") << "" << "" << ".";
QTest::newRow("resource") << ":/prefix" << "foo.bar" << ":/prefix/foo.bar";
+#ifdef Q_OS_WIN
+ QTest::newRow("abs-LTUNC") << "Q:/path" << "\\/leaning\\tooth/pick" << "\\/leaning\\tooth/pick";
+ QTest::newRow("LTUNC-slash") << "\\/leaning\\tooth/pick" << "/path" << "//leaning/tooth/path";
+ QTest::newRow("LTUNC-abs") << "\\/leaning\\tooth/pick" << "Q:/path" << "Q:/path";
+#endif
}
void tst_QDir::filePath()
@@ -1588,6 +1599,9 @@ void tst_QDir::exists2_data()
QTest::newRow("2") << "" << false;
QTest::newRow("3") << "testData" << true;
QTest::newRow("4") << "/testData" << false;
+#ifdef Q_OS_WIN
+ QTest::newRow("abs") << "Q:/testData" << false;
+#endif
QTest::newRow("5") << "tst_qdir.cpp" << true;
QTest::newRow("6") << "/resources.cpp" << false;
QTest::newRow("resource0") << ":/prefix/foo.bar" << false;
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index a9138a6505..b3431bcc7a 100644
--- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -1904,6 +1904,8 @@ void tst_QSortFilterProxyModel::changeSourceData_data()
QTest::addColumn<QString>("newValue");
QTest::addColumn<IntPairList>("removeIntervals");
QTest::addColumn<IntPairList>("insertIntervals");
+ QTest::addColumn<int>("expectedDataChangedRow"); // -1 if no dataChanged signal expected
+ QTest::addColumn<bool>("expectedLayoutChanged");
QTest::addColumn<QStringList>("proxyItems");
QTest::newRow("move_to_end_ascending")
@@ -1916,6 +1918,8 @@ void tst_QSortFilterProxyModel::changeSourceData_data()
<< "z" // newValue
<< IntPairList() // removeIntervals
<< IntPairList() // insertIntervals
+ << 2 // dataChanged(row 2) is emitted, see comment "Make sure we also emit dataChanged for the rows" in the source code (unclear why, though)
+ << true // layoutChanged
<< (QStringList() << "b" << "c" << "z") // proxyItems
;
@@ -1929,6 +1933,8 @@ void tst_QSortFilterProxyModel::changeSourceData_data()
<< "a" // newValue
<< IntPairList() // removeIntervals
<< IntPairList() // insertIntervals
+ << 2 // dataChanged(row 2) is emitted, see comment "Make sure we also emit dataChanged for the rows" in the source code (unclear why, though)
+ << true // layoutChanged
<< (QStringList() << "z" << "b" << "a") // proxyItems
;
@@ -1942,9 +1948,26 @@ void tst_QSortFilterProxyModel::changeSourceData_data()
<< "a" // newValue
<< IntPairList() // removeIntervals
<< IntPairList() // insertIntervals
+ << -1 // no dataChanged signal
+ << false // layoutChanged
<< (QStringList() << "b" << "a") // proxyItems
;
+ QTest::newRow("no_effect_on_filtering")
+ << (QStringList() << "a" << "b") // sourceItems
+ << static_cast<int>(Qt::AscendingOrder) // sortOrder
+ << "" // filter
+ << (QStringList() << "a" << "b") // expectedInitialProxyItems
+ << true // dynamic
+ << 1 // row
+ << "z" // newValue
+ << IntPairList() // removeIntervals
+ << IntPairList() // insertIntervals
+ << 1 // expectedDataChangedRow
+ << false // layoutChanged
+ << (QStringList() << "a" << "z") // proxyItems
+ ;
+
QTest::newRow("filtered_out_value_stays_out")
<< (QStringList() << "a" << "b" << "c" << "d") // sourceItems
<< static_cast<int>(Qt::AscendingOrder) // sortOrder
@@ -1955,6 +1978,8 @@ void tst_QSortFilterProxyModel::changeSourceData_data()
<< "x" // newValue
<< IntPairList() // removeIntervals
<< IntPairList() // insertIntervals
+ << -1 // no dataChanged signal
+ << false // layoutChanged
<< (QStringList() << "a" << "c") // proxyItems
;
@@ -1968,6 +1993,8 @@ void tst_QSortFilterProxyModel::changeSourceData_data()
<< "x" // newValue
<< IntPairList() // removeIntervals
<< (IntPairList() << IntPair(2, 2)) // insertIntervals
+ << -1 // no dataChanged signal
+ << false // layoutChanged
<< (QStringList() << "a" << "c" << "x") // proxyItems
;
@@ -1981,6 +2008,8 @@ void tst_QSortFilterProxyModel::changeSourceData_data()
<< "x" // newValue
<< (IntPairList() << IntPair(1, 1)) // removeIntervals
<< IntPairList() // insertIntervals
+ << -1 // no dataChanged signal
+ << false // layoutChanged
<< (QStringList() << "a") // proxyItems
;
@@ -1994,6 +2023,8 @@ void tst_QSortFilterProxyModel::changeSourceData_data()
<< "x" // newValue
<< IntPairList() // removeIntervals
<< IntPairList() // insertIntervals
+ << 0 // expectedDataChangedRow
+ << false // layoutChanged
<< (QStringList() << "x" << "b" << "c") // proxyItems
;
}
@@ -2009,6 +2040,8 @@ void tst_QSortFilterProxyModel::changeSourceData()
QFETCH(QString, newValue);
QFETCH(IntPairList, removeIntervals);
QFETCH(IntPairList, insertIntervals);
+ QFETCH(int, expectedDataChangedRow);
+ QFETCH(bool, expectedLayoutChanged);
QFETCH(QStringList, proxyItems);
QStandardItemModel model;
@@ -2037,9 +2070,13 @@ void tst_QSortFilterProxyModel::changeSourceData()
QSignalSpy removeSpy(&proxy, &QSortFilterProxyModel::rowsRemoved);
QSignalSpy insertSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
+ QSignalSpy dataChangedSpy(&proxy, &QSortFilterProxyModel::dataChanged);
+ QSignalSpy layoutChangedSpy(&proxy, &QSortFilterProxyModel::layoutChanged);
QVERIFY(removeSpy.isValid());
QVERIFY(insertSpy.isValid());
+ QVERIFY(dataChangedSpy.isValid());
+ QVERIFY(layoutChangedSpy.isValid());
{
QModelIndex index = model.index(row, 0, QModelIndex());
@@ -2069,6 +2106,17 @@ void tst_QSortFilterProxyModel::changeSourceData()
QModelIndex index = proxy.index(i, 0, QModelIndex());
QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), proxyItems.at(i));
}
+
+ if (expectedDataChangedRow == -1) {
+ QCOMPARE(dataChangedSpy.count(), 0);
+ } else {
+ QCOMPARE(dataChangedSpy.count(), 1);
+ const QModelIndex idx = dataChangedSpy.at(0).at(0).value<QModelIndex>();
+ QCOMPARE(idx.row(), expectedDataChangedRow);
+ QCOMPARE(idx.column(), 0);
+ }
+
+ QCOMPARE(layoutChangedSpy.count(), expectedLayoutChanged ? 1 : 0);
}
// Checks that the model is a table, and that each and every row is like this:
diff --git a/tests/auto/corelib/plugin/plugin.pro b/tests/auto/corelib/plugin/plugin.pro
index 774edc655a..b094c24e55 100644
--- a/tests/auto/corelib/plugin/plugin.pro
+++ b/tests/auto/corelib/plugin/plugin.pro
@@ -11,5 +11,6 @@ qtConfig(library): SUBDIRS += \
contains(CONFIG, static) {
message(Disabling tests requiring shared build of Qt)
SUBDIRS -= qfactoryloader \
+ qplugin \
qpluginloader
}
diff --git a/tests/auto/corelib/plugin/qplugin/invalidplugin/invalidplugin.pro b/tests/auto/corelib/plugin/qplugin/invalidplugin/invalidplugin.pro
new file mode 100644
index 0000000000..d953c6d367
--- /dev/null
+++ b/tests/auto/corelib/plugin/qplugin/invalidplugin/invalidplugin.pro
@@ -0,0 +1,5 @@
+QT = core
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = main.cpp
+DESTDIR = ../plugins
diff --git a/tests/auto/corelib/plugin/qplugin/invalidplugin/main.cpp b/tests/auto/corelib/plugin/qplugin/invalidplugin/main.cpp
new file mode 100644
index 0000000000..e6603ec89f
--- /dev/null
+++ b/tests/auto/corelib/plugin/qplugin/invalidplugin/main.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Intel Corporation.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qplugin.h>
+
+QT_PLUGIN_METADATA_SECTION
+static const char pluginMetaData[512] = {
+ 'q', 'p', 'l', 'u', 'g', 'i', 'n', ' ',
+ 't', 'e', 's', 't', 'f', 'i', 'l', 'e'
+};
+
+extern "C" {
+
+const void *qt_plugin_query_metadata()
+{
+ return pluginMetaData;
+}
+
+Q_DECL_EXPORT void *qt_plugin_instance()
+{
+ return nullptr;
+}
+
+}
diff --git a/tests/auto/corelib/plugin/qplugin/qplugin.pro b/tests/auto/corelib/plugin/qplugin/qplugin.pro
index 5283c2d52b..96fc704c07 100644
--- a/tests/auto/corelib/plugin/qplugin/qplugin.pro
+++ b/tests/auto/corelib/plugin/qplugin/qplugin.pro
@@ -1,5 +1,5 @@
TEMPLATE = subdirs
-TESTPLUGINS =
+TESTPLUGINS = invalidplugin
win32 {
contains(QT_CONFIG, debug): TESTPLUGINS += debugplugin
@@ -8,7 +8,7 @@ win32 {
CONFIG(debug, debug|release): TESTPLUGINS += debugplugin
CONFIG(release, debug|release): TESTPLUGINS += releaseplugin
} else {
- TESTPLUGINS = debugplugin releaseplugin
+ TESTPLUGINS += debugplugin releaseplugin
}
SUBDIRS += main $$TESTPLUGINS
diff --git a/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp b/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp
index ee7cf7ded8..d285ed79c0 100644
--- a/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp
+++ b/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp
@@ -37,6 +37,7 @@ class tst_QPlugin : public QObject
Q_OBJECT
QDir dir;
+ QString invalidPluginName;
public:
tst_QPlugin();
@@ -45,6 +46,8 @@ private slots:
void initTestCase();
void loadDebugPlugin();
void loadReleasePlugin();
+ void scanInvalidPlugin_data();
+ void scanInvalidPlugin();
};
tst_QPlugin::tst_QPlugin()
@@ -57,6 +60,10 @@ void tst_QPlugin::initTestCase()
QVERIFY2(dir.exists(),
qPrintable(QString::fromLatin1("Cannot find the 'plugins' directory starting from '%1'").
arg(QDir::toNativeSeparators(QDir::currentPath()))));
+
+ const auto fileNames = dir.entryList({"*invalid*"}, QDir::Files);
+ if (!fileNames.isEmpty())
+ invalidPluginName = dir.absoluteFilePath(fileNames.first());
}
void tst_QPlugin::loadDebugPlugin()
@@ -90,6 +97,7 @@ void tst_QPlugin::loadReleasePlugin()
{
const auto fileNames = dir.entryList(QStringList() << "*release*", QDir::Files);
for (const QString &fileName : fileNames) {
+ if (!QLibrary::isLibrary(fileName))
continue;
QPluginLoader loader(dir.filePath(fileName));
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
@@ -112,5 +120,105 @@ void tst_QPlugin::loadReleasePlugin()
}
}
+void tst_QPlugin::scanInvalidPlugin_data()
+{
+ QTest::addColumn<QByteArray>("metadata");
+ QTest::addColumn<bool>("loads");
+
+ QByteArray prefix = "QTMETADATA ";
+
+ {
+ QJsonObject obj;
+ obj.insert("IID", "org.qt-project.tst_qplugin");
+ obj.insert("className", "tst");
+ obj.insert("version", int(QT_VERSION));
+#ifdef QT_NO_DEBUG
+ obj.insert("debug", false);
+#else
+ obj.insert("debug", true);
+#endif
+ obj.insert("MetaData", QJsonObject());
+ QTest::newRow("control") << (prefix + QJsonDocument(obj).toBinaryData()) << true;
+ }
+
+ QTest::newRow("zeroes") << prefix << false;
+
+ prefix += "qbjs";
+ QTest::newRow("bad-json-version0") << prefix << false;
+ QTest::newRow("bad-json-version2") << (prefix + QByteArray("\2\0\0\0", 4)) << false;
+
+ // valid qbjs version 1
+ prefix += QByteArray("\1\0\0\0");
+
+ // too large for the file (100 MB)
+ QTest::newRow("bad-json-size-large1") << (prefix + QByteArray("\0\0\x40\x06")) << false;
+
+ // too large for binary JSON (512 MB)
+ QTest::newRow("bad-json-size-large2") << (prefix + QByteArray("\0\0\0\x20")) << false;
+
+ // could overflow
+ QTest::newRow("bad-json-size-large3") << (prefix + "\xff\xff\xff\x7f") << false;
+
+}
+
+static const char invalidPluginSignature[] = "qplugin testfile";
+static qsizetype locateMetadata(const uchar *data, qsizetype len)
+{
+ const uchar *dataend = data + len - strlen(invalidPluginSignature);
+
+ for (const uchar *ptr = data; ptr < dataend; ++ptr) {
+ if (*ptr != invalidPluginSignature[0])
+ continue;
+
+ int r = memcmp(ptr, invalidPluginSignature, strlen(invalidPluginSignature));
+ if (r)
+ continue;
+
+ return ptr - data;
+ }
+
+ return -1;
+}
+
+void tst_QPlugin::scanInvalidPlugin()
+{
+ QVERIFY(!invalidPluginName.isEmpty());
+
+ // copy the file
+ QFileInfo fn(invalidPluginName);
+ QTemporaryDir tmpdir;
+ QVERIFY(tmpdir.isValid());
+
+ QString newName = tmpdir.path() + '/' + fn.fileName();
+ QVERIFY(QFile::copy(invalidPluginName, newName));
+
+ {
+ QFile f(newName);
+ QVERIFY(f.open(QIODevice::ReadWrite | QIODevice::Unbuffered));
+ QVERIFY(f.size() > qint64(strlen(invalidPluginSignature)));
+ uchar *data = f.map(0, f.size());
+ QVERIFY(data);
+
+ static const qsizetype offset = locateMetadata(data, f.size());
+ QVERIFY(offset > 0);
+
+ QFETCH(QByteArray, metadata);
+
+ // sanity check
+ QVERIFY(metadata.size() < 512);
+
+ // replace the data
+ memcpy(data + offset, metadata.constData(), metadata.size());
+ memset(data + offset + metadata.size(), 0, 512 - metadata.size());
+ }
+
+ // now try to load this
+ QFETCH(bool, loads);
+ QPluginLoader loader(newName);
+ QCOMPARE(loader.load(), loads);
+ if (loads)
+ loader.unload();
+}
+
QTEST_MAIN(tst_QPlugin)
#include "tst_qplugin.moc"
diff --git a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp
index a496ed318b..f34741281c 100644
--- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp
+++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp
@@ -186,7 +186,7 @@ void tst_QPluginLoader::errorString()
QVERIFY(!unloaded);
}
-#if !defined Q_OS_WIN && !defined Q_OS_MAC && !defined Q_OS_HPUX
+#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) && !defined(Q_OS_HPUX)
{
QPluginLoader loader( sys_qualifiedLibraryName("almostplugin")); //a plugin with unresolved symbols
loader.setLoadHints(QLibrary::ResolveAllSymbolsHint);
diff --git a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp
index 480e723f44..00b22dab6c 100644
--- a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp
+++ b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp
@@ -72,6 +72,9 @@ void tst_QCollator::moveSemantics()
QCOMPARE(c2.locale(), de_AT);
QVERIFY(dpointer_is_null(c1));
+ QCollator c3(c1);
+ QVERIFY(dpointer_is_null(c3));
+
c1 = std::move(c2);
QCOMPARE(c1.locale(), de_AT);
QVERIFY(dpointer_is_null(c2));
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
index 6a4d972baf..43aec651fe 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -99,6 +99,7 @@ private slots:
void appStyle();
void QTBUG11658_cachecrash();
void styleSheetTargetAttribute();
+ void unpolish();
private:
QColor COLOR(const QWidget& w) {
@@ -2054,6 +2055,17 @@ void tst_QStyleSheetStyle::styleSheetTargetAttribute()
QCOMPARE(pb.testAttribute(Qt::WA_StyleSheetTarget), false);
}
+void tst_QStyleSheetStyle::unpolish()
+{
+ QWidget w;
+ QCOMPARE(w.minimumWidth(), 0);
+ w.setStyleSheet("QWidget { min-width: 100; }");
+ w.ensurePolished();
+ QCOMPARE(w.minimumWidth(), 100);
+ w.setStyleSheet("");
+ QCOMPARE(w.minimumWidth(), 0);
+}
+
QTEST_MAIN(tst_QStyleSheetStyle)
#include "tst_qstylesheetstyle.moc"