summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-03-02 09:04:38 +0100
committerLiang Qi <liang.qi@qt.io>2017-03-02 09:04:38 +0100
commit71264bae08d81bdeceb96133fdb01c370504dfcc (patch)
treed5dadaac8209d5ef1857a4d65197b9ee12b39848 /tests/auto
parent5e785c0b83c9908c665f253c131629ac325a21f5 (diff)
parent6d10f739cd750968d0dd0e9d8fa4b64353a86c6c (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro3
-rw-r--r--tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp74
-rw-r--r--tests/auto/concurrent/qtconcurrentrun/qtconcurrentrun.pro3
-rw-r--r--tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp104
-rw-r--r--tests/auto/corelib/io/qdir/tst_qdir.cpp2
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp74
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp1
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro2
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro2
-rw-r--r--tests/auto/corelib/tools/qdate/tst_qdate.cpp3
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp28
-rw-r--r--tests/auto/corelib/tools/qtime/tst_qtime.cpp16
-rw-r--r--tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp2
-rw-r--r--tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp17
-rw-r--r--tests/auto/gui/text/qtextformat/tst_qtextformat.cpp28
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp70
-rw-r--r--tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp4
-rw-r--r--tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp27
-rw-r--r--tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp23
-rw-r--r--tests/auto/network/ssl/qsslsocket/qsslsocket.pro6
-rw-r--r--tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp5
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp106
-rw-r--r--tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp37
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm34
24 files changed, 535 insertions, 136 deletions
diff --git a/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro b/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro
index 3af207ae5a..fd8fd0a74a 100644
--- a/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro
+++ b/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro
@@ -3,3 +3,6 @@ TARGET = tst_qtconcurrentmap
QT = core testlib concurrent
SOURCES = tst_qtconcurrentmap.cpp
DEFINES += QT_STRICT_ITERATORS
+
+# Force C++17 if available
+contains(QT_CONFIG, c++1z): CONFIG += c++1z
diff --git a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
index 25ac952396..96656a6dff 100644
--- a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
+++ b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
@@ -48,6 +48,7 @@ private slots:
void blocking_mappedReduced();
void assignResult();
void functionOverloads();
+ void noExceptFunctionOverloads();
#ifndef QT_NO_EXCEPTIONS
void exceptions();
#endif
@@ -2025,6 +2026,16 @@ int fn(int &i)
return i;
}
+int fnConstNoExcept(const int &i) Q_DECL_NOTHROW
+{
+ return i;
+}
+
+int fnNoExcept(int &i) Q_DECL_NOTHROW
+{
+ return i;
+}
+
QString changeTypeConst(const int &)
{
return QString();
@@ -2035,6 +2046,16 @@ QString changeType(int &)
return QString();
}
+QString changeTypeConstNoExcept(const int &) Q_DECL_NOTHROW
+{
+ return QString();
+}
+
+QString changeTypeNoExcept(int &) Q_DECL_NOTHROW
+{
+ return QString();
+}
+
int changeTypeQStringListConst(const QStringList &)
{
return 0;
@@ -2045,6 +2066,16 @@ int changeTypeQStringList(QStringList &)
return 0;
}
+int changeTypeQStringListConstNoExcept(const QStringList &) Q_DECL_NOTHROW
+{
+ return 0;
+}
+
+int changeTypeQStringListNoExcept(QStringList &) Q_DECL_NOTHROW
+{
+ return 0;
+}
+
class MemFnTester
{
public:
@@ -2069,6 +2100,26 @@ public:
{
return QString();
}
+
+ MemFnTester fnNoExcept() Q_DECL_NOTHROW
+ {
+ return MemFnTester();
+ }
+
+ MemFnTester fnConstNoExcept() const Q_DECL_NOTHROW
+ {
+ return MemFnTester();
+ }
+
+ QString changeTypeNoExcept() Q_DECL_NOTHROW
+ {
+ return QString();
+ }
+
+ QString changeTypeConstNoExcept() const Q_DECL_NOTHROW
+ {
+ return QString();
+ }
};
Q_DECLARE_METATYPE(QVector<MemFnTester>);
@@ -2097,6 +2148,29 @@ void tst_QtConcurrentMap::functionOverloads()
QtConcurrent::blockingMapped<QList<QString> >(constMemFnTesterList, &MemFnTester::changeTypeConst);
}
+void tst_QtConcurrentMap::noExceptFunctionOverloads()
+{
+ QList<int> intList;
+ const QList<int> constIntList;
+ QList<MemFnTester> classList;
+ const QList<MemFnTester> constMemFnTesterList;
+
+ QtConcurrent::mapped(intList, fnConstNoExcept);
+ QtConcurrent::mapped(constIntList, fnConstNoExcept);
+ QtConcurrent::mapped(classList, &MemFnTester::fnConstNoExcept);
+ QtConcurrent::mapped(constMemFnTesterList, &MemFnTester::fnConstNoExcept);
+
+ QtConcurrent::blockingMapped<QVector<int> >(intList, fnConstNoExcept);
+ QtConcurrent::blockingMapped<QVector<int> >(constIntList, fnConstNoExcept);
+ QtConcurrent::blockingMapped<QVector<MemFnTester> >(classList, &MemFnTester::fnConstNoExcept);
+ QtConcurrent::blockingMapped<QVector<MemFnTester> >(constMemFnTesterList, &MemFnTester::fnConstNoExcept);
+
+ QtConcurrent::blockingMapped<QList<QString> >(intList, changeTypeConstNoExcept);
+ QtConcurrent::blockingMapped<QList<QString> >(constIntList, changeTypeConstNoExcept);
+ QtConcurrent::blockingMapped<QList<QString> >(classList, &MemFnTester::changeTypeConstNoExcept);
+ QtConcurrent::blockingMapped<QList<QString> >(constMemFnTesterList, &MemFnTester::changeTypeConstNoExcept);
+}
+
QAtomicInt currentInstanceCount;
QAtomicInt peakInstanceCount;
class InstanceCounter
diff --git a/tests/auto/concurrent/qtconcurrentrun/qtconcurrentrun.pro b/tests/auto/concurrent/qtconcurrentrun/qtconcurrentrun.pro
index f60462f9ed..44891b7ba5 100644
--- a/tests/auto/concurrent/qtconcurrentrun/qtconcurrentrun.pro
+++ b/tests/auto/concurrent/qtconcurrentrun/qtconcurrentrun.pro
@@ -2,3 +2,6 @@ CONFIG += testcase
TARGET = tst_qtconcurrentrun
QT = core testlib concurrent
SOURCES = tst_qtconcurrentrun.cpp
+
+# Force C++17 if available
+contains(QT_CONFIG, c++1z): CONFIG += c++1z
diff --git a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
index bd53aa69fe..4e3668d72e 100644
--- a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
+++ b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
@@ -123,6 +123,28 @@ public:
int operator()(int in) const { return in; }
};
+class ANoExcept
+{
+public:
+ int member0() Q_DECL_NOTHROW { return 10; }
+ int member1(int in) Q_DECL_NOTHROW { return in; }
+
+ typedef int result_type;
+ int operator()() Q_DECL_NOTHROW { return 10; }
+ int operator()(int in) Q_DECL_NOTHROW { return in; }
+};
+
+class AConstNoExcept
+{
+public:
+ int member0() const Q_DECL_NOTHROW { return 10; }
+ int member1(int in) const Q_DECL_NOTHROW { return in; }
+
+ typedef int result_type;
+ int operator()() const Q_DECL_NOTHROW { return 10; }
+ int operator()(int in) const Q_DECL_NOTHROW { return in; }
+};
+
void tst_QtConcurrentRun::returnValue()
{
QThreadPool pool;
@@ -214,6 +236,88 @@ void tst_QtConcurrentRun::returnValue()
QCOMPARE(f.result(), 20);
f = run(&pool, &aConst, 20);
QCOMPARE(f.result(), 20);
+
+ ANoExcept aNoExcept;
+ f = run(&aNoExcept, &ANoExcept::member0);
+ QCOMPARE(f.result(), 10);
+ f = run(&pool, &aNoExcept, &ANoExcept::member0);
+ QCOMPARE(f.result(), 10);
+
+ f = run(&aNoExcept, &ANoExcept::member1, 20);
+ QCOMPARE(f.result(), 20);
+ f = run(&pool, &aNoExcept, &ANoExcept::member1, 20);
+ QCOMPARE(f.result(), 20);
+
+ f = run(aNoExcept, &ANoExcept::member0);
+ QCOMPARE(f.result(), 10);
+ f = run(&pool, aNoExcept, &ANoExcept::member0);
+ QCOMPARE(f.result(), 10);
+
+ f = run(aNoExcept, &ANoExcept::member1, 20);
+ QCOMPARE(f.result(), 20);
+ f = run(&pool, aNoExcept, &ANoExcept::member1, 20);
+ QCOMPARE(f.result(), 20);
+
+ f = run(aNoExcept);
+ QCOMPARE(f.result(), 10);
+ f = run(&pool, aNoExcept);
+ QCOMPARE(f.result(), 10);
+
+ f = run(&aNoExcept);
+ QCOMPARE(f.result(), 10);
+ f = run(&pool, &aNoExcept);
+ QCOMPARE(f.result(), 10);
+
+ f = run(aNoExcept, 20);
+ QCOMPARE(f.result(), 20);
+ f = run(&pool, aNoExcept, 20);
+ QCOMPARE(f.result(), 20);
+
+ f = run(&aNoExcept, 20);
+ QCOMPARE(f.result(), 20);
+ f = run(&pool, &aNoExcept, 20);
+ QCOMPARE(f.result(), 20);
+
+ const AConstNoExcept aConstNoExcept = AConstNoExcept();
+ f = run(&aConstNoExcept, &AConstNoExcept::member0);
+ QCOMPARE(f.result(), 10);
+ f = run(&pool, &aConstNoExcept, &AConstNoExcept::member0);
+ QCOMPARE(f.result(), 10);
+
+ f = run(&aConstNoExcept, &AConstNoExcept::member1, 20);
+ QCOMPARE(f.result(), 20);
+ f = run(&pool, &aConstNoExcept, &AConstNoExcept::member1, 20);
+ QCOMPARE(f.result(), 20);
+
+ f = run(aConstNoExcept, &AConstNoExcept::member0);
+ QCOMPARE(f.result(), 10);
+ f = run(&pool, aConstNoExcept, &AConstNoExcept::member0);
+ QCOMPARE(f.result(), 10);
+
+ f = run(aConstNoExcept, &AConstNoExcept::member1, 20);
+ QCOMPARE(f.result(), 20);
+ f = run(&pool, aConstNoExcept, &AConstNoExcept::member1, 20);
+ QCOMPARE(f.result(), 20);
+
+ f = run(aConstNoExcept);
+ QCOMPARE(f.result(), 10);
+ f = run(&pool, aConstNoExcept);
+ QCOMPARE(f.result(), 10);
+
+ f = run(&aConstNoExcept);
+ QCOMPARE(f.result(), 10);
+ f = run(&pool, &aConstNoExcept);
+ QCOMPARE(f.result(), 10);
+
+ f = run(aConstNoExcept, 20);
+ QCOMPARE(f.result(), 20);
+ f = run(&pool, aConstNoExcept, 20);
+ QCOMPARE(f.result(), 20);
+
+ f = run(&aConstNoExcept, 20);
+ QCOMPARE(f.result(), 20);
+ f = run(&pool, &aConstNoExcept, 20);
+ QCOMPARE(f.result(), 20);
}
struct TestClass
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp
index 49ee8eb32c..b64de488ed 100644
--- a/tests/auto/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp
@@ -353,7 +353,7 @@ void tst_QDir::mkdir_data()
<< QDir::currentPath() + "/testdir/two/three";
QTest::newRow("data0") << dirs.at(0) << true;
QTest::newRow("data1") << dirs.at(1) << false;
- QTest::newRow("data2") << dirs.at(2) << false;
+ QTest::newRow("data2") << dirs.at(2) << false; // note: requires data1 to have been run!
// Ensure that none of these directories already exist
QDir dir;
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index 71a0c943d2..e1a999abfb 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -46,6 +46,7 @@ class tst_QUrl : public QObject
Q_OBJECT
private slots:
+ void initTestCase();
void effectiveTLDs_data();
void effectiveTLDs();
void getSetCheck();
@@ -182,8 +183,15 @@ private slots:
private:
void testThreadingHelper();
+
+ QTemporaryDir m_tempDir;
};
+void tst_QUrl::initTestCase()
+{
+ QVERIFY2(m_tempDir.isValid(), qPrintable(m_tempDir.errorString()));
+}
+
// Testing get/set functions
void tst_QUrl::getSetCheck()
{
@@ -3045,49 +3053,59 @@ void tst_QUrl::fromUserInputWithCwd_data()
// Null
QTest::newRow("null") << QString() << QString() << QUrl() << QUrl();
- // Existing file
- QDirIterator it(QDir::currentPath(), QDir::NoDotDot | QDir::AllEntries);
- int c = 0;
- while (it.hasNext()) {
- it.next();
- QUrl url = QUrl::fromLocalFile(it.filePath());
- if (it.fileName() == QLatin1String(".")) {
- url = QUrl::fromLocalFile(QDir::currentPath()
+ // Use a tempdir with files, for testing specific file names
+ // We use canonicalPath() on the dir path because ::getcwd() canonicalizes,
+ // so we get a canonical base path for URLs with "." as working directory.
+ const QString base = QDir(m_tempDir.path()).canonicalPath();
+ QDir::setCurrent(base); // for the tests that use "." as working dir
+
+ // "."
+ {
+ const QUrl url = QUrl::fromLocalFile(base
#ifdef Q_OS_WINRT
+ QLatin1Char('/')
#endif
); // fromUserInput cleans the path
- }
- QTest::newRow(("file-" + QByteArray::number(c)).constData())
- << it.fileName() << QDir::currentPath() << url << url;
- QTest::newRow(("file-" + QByteArray::number(c) + "-dot").constData())
- << it.fileName() << QStringLiteral(".") << url << url;
- ++c;
+ QTest::newRow("dot-in-path") << "." << base << url << url;
+ QTest::newRow("dot-in-dot") << "." << QStringLiteral(".") << url << url;
+ }
+
+ // Existing files
+ for (const char *fileName : {"file.txt", "file#a.txt", "file .txt", "file.txt "}) {
+ const QString filePath = base + '/' + fileName;
+ QFile file(filePath);
+ QVERIFY2(file.open(QIODevice::WriteOnly), qPrintable(filePath));
+ file.write("Hello world\n");
+
+ const QUrl url = QUrl::fromLocalFile(filePath);
+ QTest::newRow(fileName) << fileName << base << url << url;
+ QTest::newRow(QByteArray(fileName) + "-in-dot") << fileName << QStringLiteral(".") << url << url;
}
+
#ifndef Q_OS_WINRT // WinRT cannot cd outside current / sandbox
- QDir parent = QDir::current();
+ QDir parent(base);
QVERIFY(parent.cdUp());
QUrl parentUrl = QUrl::fromLocalFile(parent.path());
- QTest::newRow("dotdot") << ".." << QDir::currentPath() << parentUrl << parentUrl;
+ QTest::newRow("dotdot") << ".." << base << parentUrl << parentUrl;
#endif
- QTest::newRow("nonexisting") << "nonexisting" << QDir::currentPath() << QUrl("http://nonexisting") << QUrl::fromLocalFile(QDir::currentPath() + "/nonexisting");
- QTest::newRow("short-url") << "example.org" << QDir::currentPath() << QUrl("http://example.org") << QUrl::fromLocalFile(QDir::currentPath() + "/example.org");
- QTest::newRow("full-url") << "http://example.org" << QDir::currentPath() << QUrl("http://example.org") << QUrl("http://example.org");
- QTest::newRow("absolute") << "/doesnotexist.txt" << QDir::currentPath() << QUrl("file:///doesnotexist.txt") << QUrl("file:///doesnotexist.txt");
+ QTest::newRow("nonexisting") << "nonexisting" << base << QUrl("http://nonexisting") << QUrl::fromLocalFile(base + "/nonexisting");
+ QTest::newRow("short-url") << "example.org" << base << QUrl("http://example.org") << QUrl::fromLocalFile(base + "/example.org");
+ QTest::newRow("full-url") << "http://example.org" << base << QUrl("http://example.org") << QUrl("http://example.org");
+ QTest::newRow("absolute") << "/doesnotexist.txt" << base << QUrl("file:///doesnotexist.txt") << QUrl("file:///doesnotexist.txt");
#ifdef Q_OS_WIN
- QTest::newRow("windows-absolute") << "c:/doesnotexist.txt" << QDir::currentPath() << QUrl("file:///c:/doesnotexist.txt") << QUrl("file:///c:/doesnotexist.txt");
+ QTest::newRow("windows-absolute") << "c:/doesnotexist.txt" << base << QUrl("file:///c:/doesnotexist.txt") << QUrl("file:///c:/doesnotexist.txt");
#endif
// IPv4 & IPv6
// same as fromUserInput, but needs retesting
- QTest::newRow("ipv4-1") << "127.0.0.1" << QDir::currentPath() << QUrl("http://127.0.0.1") << QUrl::fromLocalFile(QDir::currentPath() + "/127.0.0.1");
- QTest::newRow("ipv6-0") << "::" << QDir::currentPath() << QUrl("http://[::]") << QUrl("http://[::]");
- QTest::newRow("ipv6-1") << "::1" << QDir::currentPath() << QUrl("http://[::1]") << QUrl("http://[::1]");
- QTest::newRow("ipv6-2") << "1::1" << QDir::currentPath() << QUrl("http://[1::1]") << QUrl("http://[1::1]");
- QTest::newRow("ipv6-3") << "1::" << QDir::currentPath() << QUrl("http://[1::]") << QUrl("http://[1::]");
- QTest::newRow("ipv6-4") << "c::" << QDir::currentPath() << QUrl("http://[c::]") << QUrl("http://[c::]");
- QTest::newRow("ipv6-5") << "c:f00:ba4::" << QDir::currentPath() << QUrl("http://[c:f00:ba4::]") << QUrl("http://[c:f00:ba4::]");
+ QTest::newRow("ipv4-1") << "127.0.0.1" << base << QUrl("http://127.0.0.1") << QUrl::fromLocalFile(base + "/127.0.0.1");
+ QTest::newRow("ipv6-0") << "::" << base << QUrl("http://[::]") << QUrl("http://[::]");
+ QTest::newRow("ipv6-1") << "::1" << base << QUrl("http://[::1]") << QUrl("http://[::1]");
+ QTest::newRow("ipv6-2") << "1::1" << base << QUrl("http://[1::1]") << QUrl("http://[1::1]");
+ QTest::newRow("ipv6-3") << "1::" << base << QUrl("http://[1::]") << QUrl("http://[1::]");
+ QTest::newRow("ipv6-4") << "c::" << base << QUrl("http://[c::]") << QUrl("http://[c::]");
+ QTest::newRow("ipv6-5") << "c:f00:ba4::" << base << QUrl("http://[c:f00:ba4::]") << QUrl("http://[c:f00:ba4::]");
}
void tst_QUrl::fromUserInputWithCwd()
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
index 8058d3c897..2edb94d542 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
@@ -307,6 +307,7 @@ void tst_QMimeDatabase::mimeTypesForFileName_data()
QTest::newRow("txtfoobar, 0 hit") << "foo.foobar" << QStringList();
QTest::newRow("m, 2 hits") << "foo.m" << (QStringList() << "text/x-matlab" << "text/x-objcsrc");
QTest::newRow("sub, 3 hits") << "foo.sub" << (QStringList() << "text/x-microdvd" << "text/x-mpsub" << "text/x-subviewer");
+ QTest::newRow("non_ascii") << QString::fromUtf8("AİİA.pdf") << (QStringList() << "application/pdf");
}
void tst_QMimeDatabase::mimeTypesForFileName()
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro
index 132f01092a..44ef12db29 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro
@@ -7,6 +7,8 @@ TARGET = $$qtLibraryTarget(plugin1)
DESTDIR = ../bin
winrt:include(../winrt.pri)
+!qtConfig(library): DEFINES += QT_STATICPLUGIN
+
# This is testdata for the tst_qpluginloader test.
target.path = $$[QT_INSTALL_TESTS]/tst_qfactoryloader/bin
INSTALLS += target
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro
index b47ed91535..5689919108 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro
@@ -7,6 +7,8 @@ TARGET = $$qtLibraryTarget(plugin2)
DESTDIR = ../bin
winrt:include(../winrt.pri)
+!qtConfig(library): DEFINES += QT_STATICPLUGIN
+
# This is testdata for the tst_qpluginloader test.
target.path = $$[QT_INSTALL_TESTS]/tst_qfactoryloader/bin
INSTALLS += target
diff --git a/tests/auto/corelib/tools/qdate/tst_qdate.cpp b/tests/auto/corelib/tools/qdate/tst_qdate.cpp
index 0e189ba7aa..f88eac1a9f 100644
--- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp
+++ b/tests/auto/corelib/tools/qdate/tst_qdate.cpp
@@ -1033,7 +1033,8 @@ void tst_QDate::fromStringFormat_data()
QTest::addColumn<QString>("format");
QTest::addColumn<QDate>("expected");
- //get localized names
+ // Undo this (inline the C-locale versions) for ### Qt 6
+ // Get localized names:
QString january = QDate::longMonthName(1);
QString february = QDate::longMonthName(2);
QString march = QDate::longMonthName(3);
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index b81f3d356d..5eec44dffd 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -31,6 +31,9 @@
#include <time.h>
#include <qdatetime.h>
#include <private/qdatetime_p.h>
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+# include <locale.h>
+#endif
#ifdef Q_OS_WIN
# include <qt_windows.h>
@@ -185,6 +188,14 @@ Q_DECLARE_METATYPE(Qt::DateFormat)
tst_QDateTime::tst_QDateTime()
{
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ // Some tests depend on C locale - BF&I it with belt *and* braces:
+ qputenv("LC_ALL", "C");
+ setlocale(LC_ALL, "C");
+ // Need to do this as early as possible, before anything accesses the
+ // QSystemLocale singleton; once it exists, there's no changing it.
+#endif // remove for ### Qt 6
+
/*
Due to some jurisdictions changing their zones and rules, it's possible
for a non-CET zone to accidentally match CET at a few tested moments but
@@ -2332,13 +2343,6 @@ void tst_QDateTime::fromStringStringFormat_data()
QTest::addColumn<QString>("format");
QTest::addColumn<QDateTime>("expected");
- QString january = QDate::longMonthName(1);
- QString oct = QDate::shortMonthName(10);
- QString december = QDate::longMonthName(12);
- QString thu = QDate::shortDayName(4);
- QString fri = QDate::shortDayName(5);
- QString date = "10 " + oct + " 10";
-
QTest::newRow("data0") << QString("101010") << QString("dMyy") << QDateTime(QDate(1910, 10, 10), QTime());
QTest::newRow("data1") << QString("1020") << QString("sss") << invalidDateTime();
QTest::newRow("data2") << QString("1010") << QString("sss") << QDateTime(defDate(), QTime(0, 0, 10));
@@ -2349,16 +2353,14 @@ void tst_QDateTime::fromStringStringFormat_data()
QTest::newRow("data7") << QString("foo") << QString("ap") << invalidDateTime();
// Day non-conflict should not hide earlier year conflict (1963-03-01 was a
// Friday; asking for Thursday moves this, without conflict, to the 7th):
- QTest::newRow("data8") << QString("77 03 1963 " + thu) << QString("yy MM yyyy ddd") << invalidDateTime();
+ QTest::newRow("data8") << QString("77 03 1963 Thu") << QString("yy MM yyyy ddd") << invalidDateTime();
QTest::newRow("data9") << QString("101010") << QString("dMyy") << QDateTime(QDate(1910, 10, 10), QTime());
QTest::newRow("data10") << QString("101010") << QString("dMyy") << QDateTime(QDate(1910, 10, 10), QTime());
- QTest::newRow("data11") << date << QString("dd MMM yy") << QDateTime(QDate(1910, 10, 10), QTime());
- date = fri + QLatin1Char(' ') + december + " 3 2004";
- QTest::newRow("data12") << date << QString("ddd MMMM d yyyy") << QDateTime(QDate(2004, 12, 3), QTime());
+ QTest::newRow("data11") << QString("10 Oct 10") << QString("dd MMM yy") << QDateTime(QDate(1910, 10, 10), QTime());
+ QTest::newRow("data12") << QString("Fri December 3 2004") << QString("ddd MMMM d yyyy") << QDateTime(QDate(2004, 12, 3), QTime());
QTest::newRow("data13") << QString("30.02.2004") << QString("dd.MM.yyyy") << invalidDateTime();
QTest::newRow("data14") << QString("32.01.2004") << QString("dd.MM.yyyy") << invalidDateTime();
- date = thu + QLatin1Char(' ') + january + " 2004";
- QTest::newRow("data15") << date << QString("ddd MMMM yyyy") << QDateTime(QDate(2004, 1, 1), QTime());
+ QTest::newRow("data15") << QString("Thu January 2004") << QString("ddd MMMM yyyy") << QDateTime(QDate(2004, 1, 1), QTime());
QTest::newRow("data16") << QString("2005-06-28T07:57:30.001Z")
<< QString("yyyy-MM-ddThh:mm:ss.zZ")
<< QDateTime(QDate(2005, 06, 28), QTime(07, 57, 30, 1));
diff --git a/tests/auto/corelib/tools/qtime/tst_qtime.cpp b/tests/auto/corelib/tools/qtime/tst_qtime.cpp
index 059e1e519b..71bf39fc4e 100644
--- a/tests/auto/corelib/tools/qtime/tst_qtime.cpp
+++ b/tests/auto/corelib/tools/qtime/tst_qtime.cpp
@@ -28,10 +28,26 @@
#include <QtTest/QtTest>
#include "qdatetime.h"
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+# include <locale.h>
+#endif
class tst_QTime : public QObject
{
Q_OBJECT
+
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+public:
+ tst_QTime()
+ {
+ // Some tests depend on C locale - BF&I it with belt *and* braces:
+ qputenv("LC_ALL", "C");
+ setlocale(LC_ALL, "C");
+ // Need to instantiate as early as possible, before anything accesses
+ // the QSystemLocale singleton; once it exists, there's no changing it.
+ }
+#endif // remove for ### Qt 6
+
private slots:
void msecsTo_data();
void msecsTo();
diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
index abb5b50229..c1f2822b74 100644
--- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
+++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
@@ -346,6 +346,7 @@ void tst_QTimeZone::isTimeZoneIdAvailable()
foreach (const QByteArray &id, available)
QVERIFY(QTimeZone::isTimeZoneIdAvailable(id));
+#ifdef QT_BUILD_INTERNAL
// a-z, A-Z, 0-9, '.', '-', '_' are valid chars
// Can't start with '-'
// Parts separated by '/', each part min 1 and max of 14 chars
@@ -368,6 +369,7 @@ void tst_QTimeZone::isTimeZoneIdAvailable()
QCOMPARE(QTimeZonePrivate::isValidId("123456789012345"), false);
QCOMPARE(QTimeZonePrivate::isValidId("123456789012345/12345678901234"), false);
QCOMPARE(QTimeZonePrivate::isValidId("12345678901234/123456789012345"), false);
+#endif // QT_BUILD_INTERNAL
}
void tst_QTimeZone::transitionEachZone_data()
diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
index 280305ddd8..3971353cbb 100644
--- a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
+++ b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
@@ -75,8 +75,21 @@ struct Foo
void tst_QVarLengthArray::append()
{
- QVarLengthArray<QString> v;
- v.append(QString("hello"));
+ QVarLengthArray<QString, 2> v;
+ v.append(QString("1"));
+ v.append(v.front());
+ QCOMPARE(v.capacity(), 2);
+ // transition from prealloc to heap:
+ v.append(v.front());
+ QVERIFY(v.capacity() > 2);
+ QCOMPARE(v.front(), v.back());
+ while (v.size() < v.capacity())
+ v.push_back(v[0]);
+ QCOMPARE(v.back(), v.front());
+ QCOMPARE(v.size(), v.capacity());
+ // transition from heap to larger heap:
+ v.push_back(v.front());
+ QCOMPARE(v.back(), v.front());
QVarLengthArray<int> v2; // rocket!
v2.append(5);
diff --git a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp
index 71ee980de1..b8afd6a447 100644
--- a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp
+++ b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp
@@ -60,6 +60,7 @@ private slots:
void setFont();
void setFont_collection_data();
void setFont_collection();
+ void clearCollection();
};
/*! \internal
@@ -640,5 +641,32 @@ void tst_QTextFormat::setFont_collection()
}
}
+void tst_QTextFormat::clearCollection()
+{
+ QTextFormatCollection collection;
+ QFont f;
+ f.setUnderline(true);
+ collection.setDefaultFont(f);
+ QTextCharFormat charFormat;
+ charFormat.setFontStyleHint(QFont::SansSerif);
+ int formatIndex = collection.indexForFormat(charFormat);
+ QCOMPARE(formatIndex, 0);
+ QTextCharFormat charFormat2;
+ charFormat2.setUnderlineStyle(QTextCharFormat::SingleUnderline);
+ int formatIndex2 = collection.indexForFormat(charFormat2);
+ QCOMPARE(formatIndex2, 1);
+ QCOMPARE(collection.formats.count(), 2);
+ QCOMPARE(collection.hashes.count(), 2);
+ QCOMPARE(collection.defaultFont(), f);
+
+ collection.clear();
+ QCOMPARE(collection.formats.count(), 0);
+ QCOMPARE(collection.hashes.count(), 0);
+ QCOMPARE(collection.indexForFormat(charFormat2), 0);
+ QCOMPARE(collection.formats.count(), 1);
+ QCOMPARE(collection.hashes.count(), 1);
+ QCOMPARE(collection.defaultFont(), f); // kept, QTextDocument::clear or setPlainText should not reset the font set by setDefaultFont
+}
+
QTEST_MAIN(tst_QTextFormat)
#include "tst_qtextformat.moc"
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index f19ce4ac75..4dcce8509c 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -8194,22 +8194,22 @@ struct SameOriginRedirector : MiniHttpServer
void tst_QNetworkReply::ioHttpRedirectPolicy_data()
{
- QTest::addColumn<QNetworkRequest::RedirectsPolicy>("policy");
+ QTest::addColumn<QNetworkRequest::RedirectPolicy>("policy");
QTest::addColumn<bool>("ssl");
QTest::addColumn<int>("redirectCount");
QTest::addColumn<int>("statusCode");
- QTest::newRow("manual-nossl") << QNetworkRequest::ManualRedirectsPolicy << false << 0 << 307;
- QTest::newRow("manual-ssl") << QNetworkRequest::ManualRedirectsPolicy << true << 0 << 307;
- QTest::newRow("nolesssafe-nossl") << QNetworkRequest::NoLessSafeRedirectsPolicy << false << 1 << 200;
- QTest::newRow("nolesssafe-ssl") << QNetworkRequest::NoLessSafeRedirectsPolicy << true << 1 << 200;
- QTest::newRow("same-origin-nossl") << QNetworkRequest::SameOriginRedirectsPolicy << false << 1 << 200;
- QTest::newRow("same-origin-ssl") << QNetworkRequest::SameOriginRedirectsPolicy << true << 1 << 200;
+ QTest::newRow("manual-nossl") << QNetworkRequest::ManualRedirectPolicy << false << 0 << 307;
+ QTest::newRow("manual-ssl") << QNetworkRequest::ManualRedirectPolicy << true << 0 << 307;
+ QTest::newRow("nolesssafe-nossl") << QNetworkRequest::NoLessSafeRedirectPolicy << false << 1 << 200;
+ QTest::newRow("nolesssafe-ssl") << QNetworkRequest::NoLessSafeRedirectPolicy << true << 1 << 200;
+ QTest::newRow("same-origin-nossl") << QNetworkRequest::SameOriginRedirectPolicy << false << 1 << 200;
+ QTest::newRow("same-origin-ssl") << QNetworkRequest::SameOriginRedirectPolicy << true << 1 << 200;
}
void tst_QNetworkReply::ioHttpRedirectPolicy()
{
- QFETCH(const QNetworkRequest::RedirectsPolicy, policy);
+ QFETCH(const QNetworkRequest::RedirectPolicy, policy);
QFETCH(const bool, ssl);
#ifdef QT_NO_SSL
@@ -8234,16 +8234,16 @@ void tst_QNetworkReply::ioHttpRedirectPolicy()
redirectServer.responses.push_back(tempRedirectReplyStr().arg(QString(url.toEncoded())).toLatin1());
// This is the default one we preserve between tests.
- QCOMPARE(manager.redirectsPolicy(), QNetworkRequest::ManualRedirectsPolicy);
+ QCOMPARE(manager.redirectPolicy(), QNetworkRequest::ManualRedirectPolicy);
- manager.setRedirectsPolicy(policy);
- QCOMPARE(manager.redirectsPolicy(), policy);
+ manager.setRedirectPolicy(policy);
+ QCOMPARE(manager.redirectPolicy(), policy);
QNetworkReplyPtr reply(manager.get(QNetworkRequest(url)));
if (ssl)
reply->ignoreSslErrors();
// Restore default:
- manager.setRedirectsPolicy(QNetworkRequest::ManualRedirectsPolicy);
+ manager.setRedirectPolicy(QNetworkRequest::ManualRedirectPolicy);
QSignalSpy redirectSpy(reply.data(), SIGNAL(redirected(QUrl)));
QSignalSpy finishedSpy(reply.data(), SIGNAL(finished()));
QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply));
@@ -8254,43 +8254,43 @@ void tst_QNetworkReply::ioHttpRedirectPolicy()
void tst_QNetworkReply::ioHttpRedirectPolicyErrors_data()
{
- QTest::addColumn<QNetworkRequest::RedirectsPolicy>("policy");
+ QTest::addColumn<QNetworkRequest::RedirectPolicy>("policy");
QTest::addColumn<bool>("ssl");
QTest::addColumn<QString>("location");
QTest::addColumn<int>("maxRedirects");
QTest::addColumn<QNetworkReply::NetworkError>("expectedError");
// 1. NoLessSafeRedirectsPolicy
- QTest::newRow("nolesssafe-nossl-nossl-too-many") << QNetworkRequest::NoLessSafeRedirectsPolicy
+ QTest::newRow("nolesssafe-nossl-nossl-too-many") << QNetworkRequest::NoLessSafeRedirectPolicy
<< false << QString("http://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError;
- QTest::newRow("nolesssafe-ssl-ssl-too-many") << QNetworkRequest::NoLessSafeRedirectsPolicy
+ QTest::newRow("nolesssafe-ssl-ssl-too-many") << QNetworkRequest::NoLessSafeRedirectPolicy
<< true << QString("https:/localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError;
- QTest::newRow("nolesssafe-ssl-nossl-insecure-redirect") << QNetworkRequest::NoLessSafeRedirectsPolicy
+ QTest::newRow("nolesssafe-ssl-nossl-insecure-redirect") << QNetworkRequest::NoLessSafeRedirectPolicy
<< true << QString("http://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError;
// 2. SameOriginRedirectsPolicy
- QTest::newRow("same-origin-nossl-nossl-too-many") << QNetworkRequest::SameOriginRedirectsPolicy
+ QTest::newRow("same-origin-nossl-nossl-too-many") << QNetworkRequest::SameOriginRedirectPolicy
<< false << QString("http://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError;
- QTest::newRow("same-origin-ssl-ssl-too-many") << QNetworkRequest::SameOriginRedirectsPolicy
+ QTest::newRow("same-origin-ssl-ssl-too-many") << QNetworkRequest::SameOriginRedirectPolicy
<< true << QString("https://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError;
- QTest::newRow("same-origin-https-http-wrong-protocol") << QNetworkRequest::SameOriginRedirectsPolicy
+ QTest::newRow("same-origin-https-http-wrong-protocol") << QNetworkRequest::SameOriginRedirectPolicy
<< true << QString("http://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError;
- QTest::newRow("same-origin-http-https-wrong-protocol") << QNetworkRequest::SameOriginRedirectsPolicy
+ QTest::newRow("same-origin-http-https-wrong-protocol") << QNetworkRequest::SameOriginRedirectPolicy
<< false << QString("https://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError;
- QTest::newRow("same-origin-http-http-wrong-host") << QNetworkRequest::SameOriginRedirectsPolicy
+ QTest::newRow("same-origin-http-http-wrong-host") << QNetworkRequest::SameOriginRedirectPolicy
<< false << QString("http://not-so-localhost:%1") << 50 << QNetworkReply::InsecureRedirectError;
- QTest::newRow("same-origin-https-https-wrong-host") << QNetworkRequest::SameOriginRedirectsPolicy
+ QTest::newRow("same-origin-https-https-wrong-host") << QNetworkRequest::SameOriginRedirectPolicy
<< true << QString("https://not-so-localhost:%1") << 50 << QNetworkReply::InsecureRedirectError;
- QTest::newRow("same-origin-http-http-wrong-port") << QNetworkRequest::SameOriginRedirectsPolicy
+ QTest::newRow("same-origin-http-http-wrong-port") << QNetworkRequest::SameOriginRedirectPolicy
<< false << QString("http://localhost/%1") << 50 << QNetworkReply::InsecureRedirectError;
- QTest::newRow("same-origin-https-https-wrong-port") << QNetworkRequest::SameOriginRedirectsPolicy
+ QTest::newRow("same-origin-https-https-wrong-port") << QNetworkRequest::SameOriginRedirectPolicy
<< true << QString("https://localhost/%1") << 50 << QNetworkReply::InsecureRedirectError;
}
void tst_QNetworkReply::ioHttpRedirectPolicyErrors()
{
- QFETCH(const QNetworkRequest::RedirectsPolicy, policy);
+ QFETCH(const QNetworkRequest::RedirectPolicy, policy);
// This should never happen:
- QVERIFY(policy != QNetworkRequest::ManualRedirectsPolicy);
+ QVERIFY(policy != QNetworkRequest::ManualRedirectPolicy);
QFETCH(const bool, ssl);
QFETCH(const QString, location);
@@ -8317,13 +8317,13 @@ void tst_QNetworkReply::ioHttpRedirectPolicyErrors()
request.setMaximumRedirectsAllowed(maxRedirects);
// We always reset the policy to the default one ('Manual') after any related
// test is finished:
- QCOMPARE(manager.redirectsPolicy(), QNetworkRequest::ManualRedirectsPolicy);
- manager.setRedirectsPolicy(policy);
- QCOMPARE(manager.redirectsPolicy(), policy);
+ QCOMPARE(manager.redirectPolicy(), QNetworkRequest::ManualRedirectPolicy);
+ manager.setRedirectPolicy(policy);
+ QCOMPARE(manager.redirectPolicy(), policy);
QNetworkReplyPtr reply(manager.get(request));
// Set it back to default:
- manager.setRedirectsPolicy(QNetworkRequest::ManualRedirectsPolicy);
+ manager.setRedirectPolicy(QNetworkRequest::ManualRedirectPolicy);
if (ssl)
reply->ignoreSslErrors();
@@ -8358,9 +8358,9 @@ void tst_QNetworkReply::ioHttpUserVerifiedRedirect()
redirectServer.setDataToTransmit(tempRedirectReplyStr().arg(QString(url.toEncoded())).toLatin1());
url.setPort(redirectServer.serverPort());
- QCOMPARE(manager.redirectsPolicy(), QNetworkRequest::ManualRedirectsPolicy);
- manager.setRedirectsPolicy(QNetworkRequest::UserVerifiedRedirectsPolicy);
- QCOMPARE(manager.redirectsPolicy(), QNetworkRequest::UserVerifiedRedirectsPolicy);
+ QCOMPARE(manager.redirectPolicy(), QNetworkRequest::ManualRedirectPolicy);
+ manager.setRedirectPolicy(QNetworkRequest::UserVerifiedRedirectPolicy);
+ QCOMPARE(manager.redirectPolicy(), QNetworkRequest::UserVerifiedRedirectPolicy);
QNetworkReplyPtr reply(manager.get(QNetworkRequest(url)));
reply->connect(reply.data(), &QNetworkReply::redirected,
@@ -8376,8 +8376,8 @@ void tst_QNetworkReply::ioHttpUserVerifiedRedirect()
});
// Before any test failed, reset the policy to default:
- manager.setRedirectsPolicy(QNetworkRequest::ManualRedirectsPolicy);
- QCOMPARE(manager.redirectsPolicy(), QNetworkRequest::ManualRedirectsPolicy);
+ manager.setRedirectPolicy(QNetworkRequest::ManualRedirectPolicy);
+ QCOMPARE(manager.redirectPolicy(), QNetworkRequest::ManualRedirectPolicy);
QSignalSpy finishedSpy(reply.data(), SIGNAL(finished()));
waitForFinish(reply);
diff --git a/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp b/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp
index 3295580432..5eedd1043b 100644
--- a/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp
+++ b/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
** Copyright (C) 2016 Intel Corporation.
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
-** This file is part of the QtNetwork module of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
diff --git a/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp b/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp
index cf15e60531..89a1430948 100644
--- a/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp
+++ b/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** 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 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
diff --git a/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp b/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp
index ddf503eed6..60add4a51c 100644
--- a/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp
+++ b/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp
@@ -1,11 +1,11 @@
/****************************************************************************
**
** Copyright (C) 2015 Mikkel Krautz <mikkel@krautz.dk>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
-** This file is part of the QtNetwork module of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $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
@@ -14,24 +14,13 @@
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/auto/network/ssl/qsslsocket/qsslsocket.pro b/tests/auto/network/ssl/qsslsocket/qsslsocket.pro
index 5c92ca833a..4ccf0f24b0 100644
--- a/tests/auto/network/ssl/qsslsocket/qsslsocket.pro
+++ b/tests/auto/network/ssl/qsslsocket/qsslsocket.pro
@@ -14,12 +14,6 @@ win32 {
}
}
-# OpenSSL support
-qtConfig(openssl)|qtConfig(openssl-linked) {
- # Add optional SSL libs
- LIBS += $$OPENSSL_LIBS
-}
-
DEFINES += SRCDIR=\\\"$$PWD/\\\"
requires(qtConfig(private_tests))
diff --git a/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp b/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp
index 4ae1f02ce2..d50f46cc16 100644
--- a/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp
+++ b/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp
@@ -114,7 +114,10 @@ void tst_QSizePolicy::constExpr()
{ Q_CONSTEXPR QSizePolicy sp; Q_UNUSED(sp); }
{ Q_CONSTEXPR QSizePolicy sp = QSizePolicy(); Q_UNUSED(sp); }
{ Q_CONSTEXPR QSizePolicy sp = QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); Q_UNUSED(sp); }
- { Q_CONSTEXPR QSizePolicy sp = QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding, QSizePolicy::DefaultType); Q_UNUSED(sp); }
+ { Q_CONSTEXPR QSizePolicy sp = QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding, QSizePolicy::DefaultType);
+ Q_CONSTEXPR QSizePolicy tp = sp.transposed(); Q_UNUSED(tp); }
+ { Q_RELAXED_CONSTEXPR auto sp = QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, QSizePolicy::CheckBox);
+ Q_RELAXED_CONSTEXPR auto tp = sp.transposed(); Q_UNUSED(tp); }
#else
QSKIP("QSizePolicy cannot be constexpr with this version of the compiler.");
#endif
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 2657b28d30..7afa7ca42b 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -407,6 +407,8 @@ private slots:
void testForOutsideWSRangeFlag();
+ void tabletTracking();
+
private:
bool ensureScreenSize(int width, int height);
@@ -10529,5 +10531,109 @@ void tst_QWidget::testForOutsideWSRangeFlag()
}
}
+class TabletWidget : public QWidget
+{
+public:
+ TabletWidget(QWidget *parent) : QWidget(parent) { }
+
+ int tabletEventCount = 0;
+ int pressEventCount = 0;
+ int moveEventCount = 0;
+ int releaseEventCount = 0;
+ int trackingChangeEventCount = 0;
+ qint64 uid = -1;
+
+protected:
+ void tabletEvent(QTabletEvent *event) override {
+ ++tabletEventCount;
+ uid = event->uniqueId();
+ switch (event->type()) {
+ case QEvent::TabletMove:
+ ++moveEventCount;
+ break;
+ case QEvent::TabletPress:
+ ++pressEventCount;
+ break;
+ case QEvent::TabletRelease:
+ ++releaseEventCount;
+ break;
+ default:
+ break;
+ }
+ }
+
+ bool event(QEvent *ev) override {
+ if (ev->type() == QEvent::TabletTrackingChange)
+ ++trackingChangeEventCount;
+ return QWidget::event(ev);
+ }
+};
+
+void tst_QWidget::tabletTracking()
+{
+ QWidget parent;
+ parent.resize(200,200);
+ // QWidgetWindow::handleTabletEvent doesn't deliver tablet events to the window's widget, only to a child.
+ // So it doesn't do any good to show a TabletWidget directly: it needs a parent.
+ TabletWidget widget(&parent);
+ widget.resize(200,200);
+ parent.showNormal();
+ QVERIFY(QTest::qWaitForWindowExposed(&parent));
+ widget.setAttribute(Qt::WA_TabletTracking);
+ QTRY_COMPARE(widget.trackingChangeEventCount, 1);
+ QVERIFY(widget.hasTabletTracking());
+
+ QWindow *window = parent.windowHandle();
+ QPointF local(10, 10);
+ QPointF global = window->mapToGlobal(local.toPoint());
+ QPointF deviceLocal = QHighDpi::toNativeLocalPosition(local, window);
+ QPointF deviceGlobal = QHighDpi::toNativePixels(global, window->screen());
+ qint64 uid = 1234UL;
+
+ QWindowSystemInterface::handleTabletEvent(window, QDateTime::currentMSecsSinceEpoch(), deviceLocal, deviceGlobal,
+ QTabletEvent::Stylus, QTabletEvent::Pen, Qt::NoButton, 0, 0, 0, 0, 0, 0, uid, Qt::NoModifier);
+ QCoreApplication::processEvents();
+ QTRY_COMPARE(widget.moveEventCount, 1);
+ QCOMPARE(widget.uid, uid);
+
+ local += QPoint(10, 10);
+ deviceLocal += QPoint(10, 10);
+ deviceGlobal += QPoint(10, 10);
+ QWindowSystemInterface::handleTabletEvent(window, QDateTime::currentMSecsSinceEpoch(), deviceLocal, deviceGlobal,
+ QTabletEvent::Stylus, QTabletEvent::Pen, Qt::NoButton, 0, 0, 0, 0, 0, 0, uid, Qt::NoModifier);
+ QCoreApplication::processEvents();
+ QTRY_COMPARE(widget.moveEventCount, 2);
+
+ widget.setTabletTracking(false);
+ QCoreApplication::processEvents();
+ QTRY_COMPARE(widget.trackingChangeEventCount, 2);
+
+ QWindowSystemInterface::handleTabletEvent(window, QDateTime::currentMSecsSinceEpoch(), deviceLocal, deviceGlobal,
+ QTabletEvent::Stylus, QTabletEvent::Pen, Qt::LeftButton, 0, 0, 0, 0, 0, 0, uid, Qt::NoModifier);
+ QCoreApplication::processEvents();
+ QTRY_COMPARE(widget.pressEventCount, 1);
+
+ local += QPoint(10, 10);
+ deviceLocal += QPoint(10, 10);
+ deviceGlobal += QPoint(10, 10);
+ QWindowSystemInterface::handleTabletEvent(window, QDateTime::currentMSecsSinceEpoch(), deviceLocal, deviceGlobal,
+ QTabletEvent::Stylus, QTabletEvent::Pen, Qt::LeftButton, 0, 0, 0, 0, 0, 0, uid, Qt::NoModifier);
+ QCoreApplication::processEvents();
+ QTRY_COMPARE(widget.moveEventCount, 3);
+
+ QWindowSystemInterface::handleTabletEvent(window, QDateTime::currentMSecsSinceEpoch(), deviceLocal, deviceGlobal,
+ QTabletEvent::Stylus, QTabletEvent::Pen, Qt::NoButton, 0, 0, 0, 0, 0, 0, uid, Qt::NoModifier);
+ QCoreApplication::processEvents();
+ QTRY_COMPARE(widget.releaseEventCount, 1);
+
+ local += QPoint(10, 10);
+ deviceLocal += QPoint(10, 10);
+ deviceGlobal += QPoint(10, 10);
+ QWindowSystemInterface::handleTabletEvent(window, QDateTime::currentMSecsSinceEpoch(), deviceLocal, deviceGlobal,
+ QTabletEvent::Stylus, QTabletEvent::Pen, Qt::NoButton, 0, 0, 0, 0, 0, 0, uid, Qt::NoModifier);
+ QCoreApplication::processEvents();
+ QTRY_COMPARE(widget.moveEventCount, 3);
+}
+
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"
diff --git a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
index 5e3868ea8f..6ec1b754d0 100644
--- a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
+++ b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
@@ -37,6 +37,7 @@
#include <qmainwindow.h>
#include <qscreen.h>
#include <qscopedpointer.h>
+#include <qevent.h>
class Window : public QWindow
@@ -77,6 +78,7 @@ private slots:
void testAncestorChange();
void testDockWidget();
void testNativeContainerParent();
+ void testPlatformSurfaceEvent();
void cleanup();
private:
@@ -343,6 +345,41 @@ void tst_QWindowContainer::testNativeContainerParent()
QTRY_COMPARE(window->parent(), container->windowHandle());
}
+class EventWindow : public QWindow
+{
+public:
+ EventWindow(bool *surfaceDestroyFlag) : m_surfaceDestroyFlag(surfaceDestroyFlag) { }
+ bool event(QEvent *e) override;
+
+private:
+ bool *m_surfaceDestroyFlag;
+};
+
+bool EventWindow::event(QEvent *e)
+{
+ if (e->type() == QEvent::PlatformSurface) {
+ if (static_cast<QPlatformSurfaceEvent *>(e)->surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed)
+ *m_surfaceDestroyFlag = true;
+ }
+ return QWindow::event(e);
+}
+
+void tst_QWindowContainer::testPlatformSurfaceEvent()
+{
+ // Verify that SurfaceAboutToBeDestroyed is delivered and the
+ // window subclass still gets a chance to process it.
+
+ bool ok = false;
+ QPointer<EventWindow> window(new EventWindow(&ok));
+ window->create();
+ QWidget *container = QWidget::createWindowContainer(window);
+
+ delete container;
+
+ QCOMPARE(window.data(), nullptr);
+ QVERIFY(ok);
+}
+
QTEST_MAIN(tst_QWindowContainer)
#include "tst_qwindowcontainer.moc"
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm
index 4645de4d7a..af93c18712 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm
@@ -1,31 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** 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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** 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 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** 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-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**