summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-12-18 08:37:31 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2015-12-18 08:37:31 +0100
commitbeb65dcd79f8c354dab7bb4a8d08157bd9d69329 (patch)
tree4632a0ff0df8462f8913f347042cf8378de03268 /tests
parent3fc1002489d5861d4f7cc2e1e8800881d6593c9d (diff)
parente3288f246b44ba2b6d90b90eb99ab61f496d8d57 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: src/gui/painting/painting.pri src/plugins/platforms/xcb/qxcbconnection.cpp tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro tests/auto/corelib/tools/qlocale/test/test.pro tests/auto/gui/kernel/qwindow/tst_qwindow.cpp tools/configure/environment.cpp Change-Id: I9c40f458b89b2c206de2d2c24e90b5f679c93495
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/global/qlogging/qlogging.pro6
-rw-r--r--tests/auto/corelib/global/qlogging/test/test.pro2
-rw-r--r--tests/auto/corelib/io/qsettings/BLACKLIST1
-rw-r--r--tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp2
-rw-r--r--tests/auto/corelib/kernel/qobject/qobject.pro6
-rw-r--r--tests/auto/corelib/kernel/qobject/test/test.pro2
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp41
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro4
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/test/test.pro2
-rw-r--r--tests/auto/corelib/tools/qlocale/qlocale.pro4
-rw-r--r--tests/auto/corelib/tools/qlocale/test/test.pro2
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp50
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp66
-rw-r--r--tests/auto/gui/kernel/qclipboard/qclipboard.pro2
-rw-r--r--tests/auto/gui/kernel/qclipboard/test/test.pro2
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp67
-rw-r--r--tests/auto/network/access/qnetworkreply/qnetworkreply.pro2
-rw-r--r--tests/auto/network/access/qnetworkreply/test/test.pro2
-rw-r--r--tests/auto/network/bearer/qnetworksession/qnetworksession.pro2
-rw-r--r--tests/auto/network/bearer/qnetworksession/test/test.pro2
-rw-r--r--tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp19
-rw-r--r--tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp4
-rw-r--r--tests/auto/other/toolsupport/tst_toolsupport.cpp2
-rw-r--r--tests/auto/testlib/selftests/selftests.pro2
-rw-r--r--tests/auto/testlib/selftests/test/test.pro2
-rw-r--r--tests/auto/tools/qmake/testdata/findDeps/findDeps.pro5
-rw-r--r--tests/auto/tools/qmake/testdata/findDeps/main.cpp50
-rw-r--r--tests/auto/tools/qmake/testdata/findDeps/objecta.h41
-rw-r--r--tests/auto/tools/qmake/testdata/findDeps/objectf.h41
-rw-r--r--tests/auto/tools/qmake/testdata/findMocs/findMocs.pro3
-rw-r--r--tests/auto/tools/qmake/testdata/findMocs/main.cpp5
-rw-r--r--tests/auto/tools/qmake/testdata/findMocs/object1.h4
-rw-r--r--tests/auto/tools/qmake/testdata/findMocs/object2.h4
-rw-r--r--tests/auto/tools/qmake/testdata/findMocs/object3.h4
-rw-r--r--tests/auto/tools/qmake/testdata/findMocs/object4.h3
-rw-r--r--tests/auto/tools/qmake/testdata/findMocs/object7.h1
-rw-r--r--tests/auto/tools/qmake/testdata/findMocs/object8.h50
-rw-r--r--tests/auto/tools/qmake/testdata/findMocs/object9.h41
-rw-r--r--tests/auto/tools/qmake/testdata/rawString/main.cpp38
-rw-r--r--tests/auto/tools/qmake/testdata/rawString/object1.h40
-rw-r--r--tests/auto/tools/qmake/testdata/rawString/rawString.pro4
-rw-r--r--tests/auto/tools/qmake/tst_qmake.cpp19
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp37
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp92
-rw-r--r--tests/auto/widgets/kernel/qapplication/qapplication.pro2
-rw-r--r--tests/auto/widgets/kernel/qapplication/test/test.pro9
-rw-r--r--tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp16
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp24
48 files changed, 755 insertions, 74 deletions
diff --git a/tests/auto/corelib/global/qlogging/qlogging.pro b/tests/auto/corelib/global/qlogging/qlogging.pro
index 4d3823cdbe..f1ca6570a0 100644
--- a/tests/auto/corelib/global/qlogging/qlogging.pro
+++ b/tests/auto/corelib/global/qlogging/qlogging.pro
@@ -1,6 +1,6 @@
TEMPLATE = subdirs
CONFIG += ordered
-SUBDIRS += \
- app \
- test
+!winrt: SUBDIRS += app
+
+SUBDIRS += test
diff --git a/tests/auto/corelib/global/qlogging/test/test.pro b/tests/auto/corelib/global/qlogging/test/test.pro
index df002c5728..b5b75be3a6 100644
--- a/tests/auto/corelib/global/qlogging/test/test.pro
+++ b/tests/auto/corelib/global/qlogging/test/test.pro
@@ -7,5 +7,5 @@ QT = core testlib
SOURCES = ../tst_qlogging.cpp
DEFINES += QT_MESSAGELOGCONTEXT
-TEST_HELPER_INSTALLS = ../app/app
+!winrt: TEST_HELPER_INSTALLS = ../app/app
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/io/qsettings/BLACKLIST b/tests/auto/corelib/io/qsettings/BLACKLIST
index 1cba99b66c..317e97730e 100644
--- a/tests/auto/corelib/io/qsettings/BLACKLIST
+++ b/tests/auto/corelib/io/qsettings/BLACKLIST
@@ -1,2 +1,3 @@
[isWritable:native]
osx-10.10
+osx-10.11
diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
index 24cde14459..7ebccbc252 100644
--- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
@@ -2729,7 +2729,7 @@ void tst_QTextStream::readBomSeekBackReadBomAgain()
QFile::remove("utf8bom");
QFile file("utf8bom");
QVERIFY(file.open(QFile::ReadWrite));
- file.write("\xef\xbb\xbf" "Andreas");
+ file.write("\xef\xbb\xbf""Andreas");
file.seek(0);
QCOMPARE(file.pos(), qint64(0));
diff --git a/tests/auto/corelib/kernel/qobject/qobject.pro b/tests/auto/corelib/kernel/qobject/qobject.pro
index 6a7cf07f51..bd83396ca0 100644
--- a/tests/auto/corelib/kernel/qobject/qobject.pro
+++ b/tests/auto/corelib/kernel/qobject/qobject.pro
@@ -1,6 +1,6 @@
TEMPLATE = subdirs
CONFIG += ordered
-SUBDIRS += \
- signalbug \
- test
+!winrt: SUBDIRS+= signalbug
+
+SUBDIRS += test
diff --git a/tests/auto/corelib/kernel/qobject/test/test.pro b/tests/auto/corelib/kernel/qobject/test/test.pro
index e9c1537fa7..f3bc045455 100644
--- a/tests/auto/corelib/kernel/qobject/test/test.pro
+++ b/tests/auto/corelib/kernel/qobject/test/test.pro
@@ -3,5 +3,5 @@ TARGET = ../tst_qobject
QT = core-private network testlib
SOURCES = ../tst_qobject.cpp
-TEST_HELPER_INSTALLS = ../signalbug/signalbug
+!winrt: TEST_HELPER_INSTALLS = ../signalbug/signalbug
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index 0c4efcd0c2..846f560214 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -2,6 +2,7 @@
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com>
+** Copyright (C) 2015 Intel Corporation.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -2516,14 +2517,26 @@ void tst_QVariant::variantMap()
QVariant v = map;
QVariantMap map2 = qvariant_cast<QVariantMap>(v);
+ QCOMPARE(map2.value("test").toInt(), 42);
+ QCOMPARE(map2, map);
+ map2 = v.toMap();
QCOMPARE(map2.value("test").toInt(), 42);
+ QCOMPARE(map2, map);
QVariant v2 = QVariant(QMetaType::type("QVariantMap"), &map);
QCOMPARE(qvariant_cast<QVariantMap>(v2).value("test").toInt(), 42);
QVariant v3 = QVariant(QMetaType::type("QMap<QString, QVariant>"), &map);
QCOMPARE(qvariant_cast<QVariantMap>(v3).value("test").toInt(), 42);
+
+ // multi-keys
+ map.insertMulti("test", 47);
+ v = map;
+ map2 = qvariant_cast<QVariantMap>(v);
+ QCOMPARE(map2, map);
+ map2 = v.toMap();
+ QCOMPARE(map2, map);
}
void tst_QVariant::variantHash()
@@ -2533,14 +2546,26 @@ void tst_QVariant::variantHash()
QVariant v = hash;
QVariantHash hash2 = qvariant_cast<QVariantHash>(v);
+ QCOMPARE(hash2.value("test").toInt(), 42);
+ QCOMPARE(hash2, hash);
+ hash2 = v.toHash();
QCOMPARE(hash2.value("test").toInt(), 42);
+ QCOMPARE(hash2, hash);
QVariant v2 = QVariant(QMetaType::type("QVariantHash"), &hash);
QCOMPARE(qvariant_cast<QVariantHash>(v2).value("test").toInt(), 42);
QVariant v3 = QVariant(QMetaType::type("QHash<QString, QVariant>"), &hash);
QCOMPARE(qvariant_cast<QVariantHash>(v3).value("test").toInt(), 42);
+
+ // multi-keys
+ hash.insertMulti("test", 47);
+ v = hash;
+ hash2 = qvariant_cast<QVariantHash>(v);
+ QCOMPARE(hash2, hash);
+ hash2 = v.toHash();
+ QCOMPARE(hash2, hash);
}
class CustomQObject : public QObject {
@@ -3258,24 +3283,40 @@ void tst_QVariant::convertIterables() const
map.insert("3", 4);
QCOMPARE(QVariant::fromValue(map).value<QVariantHash>().count(), map.count());
QCOMPARE(QVariant::fromValue(map).value<QVariantMap>().count(), map.count());
+
+ map.insertMulti("3", 5);
+ QCOMPARE(QVariant::fromValue(map).value<QVariantHash>().count(), map.count());
+ QCOMPARE(QVariant::fromValue(map).value<QVariantMap>().count(), map.count());
}
{
QVariantMap map;
map.insert("3", 4);
QCOMPARE(QVariant::fromValue(map).value<QVariantHash>().count(), map.count());
QCOMPARE(QVariant::fromValue(map).value<QVariantMap>().count(), map.count());
+
+ map.insertMulti("3", 5);
+ QCOMPARE(QVariant::fromValue(map).value<QVariantHash>().count(), map.count());
+ QCOMPARE(QVariant::fromValue(map).value<QVariantMap>().count(), map.count());
}
{
QHash<QString, int> hash;
hash.insert("3", 4);
QCOMPARE(QVariant::fromValue(hash).value<QVariantHash>().count(), hash.count());
QCOMPARE(QVariant::fromValue(hash).value<QVariantMap>().count(), hash.count());
+
+ hash.insertMulti("3", 5);
+ QCOMPARE(QVariant::fromValue(hash).value<QVariantHash>().count(), hash.count());
+ QCOMPARE(QVariant::fromValue(hash).value<QVariantMap>().count(), hash.count());
}
{
QVariantHash hash;
hash.insert("3", 4);
QCOMPARE(QVariant::fromValue(hash).value<QVariantHash>().count(), hash.count());
QCOMPARE(QVariant::fromValue(hash).value<QVariantMap>().count(), hash.count());
+
+ hash.insertMulti("3", 5);
+ QCOMPARE(QVariant::fromValue(hash).value<QVariantHash>().count(), hash.count());
+ QCOMPARE(QVariant::fromValue(hash).value<QVariantMap>().count(), hash.count());
}
}
diff --git a/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro b/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro
index d821e56366..b9bc456dcf 100644
--- a/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro
+++ b/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro
@@ -1,5 +1,7 @@
TEMPLATE = subdirs
SUBDIRS = \
- crashonexit \
test
+
+!winrt: SUBDIRS += crashonexit
+
CONFIG += ordered
diff --git a/tests/auto/corelib/thread/qthreadstorage/test/test.pro b/tests/auto/corelib/thread/qthreadstorage/test/test.pro
index 729241f891..b9d661a9af 100644
--- a/tests/auto/corelib/thread/qthreadstorage/test/test.pro
+++ b/tests/auto/corelib/thread/qthreadstorage/test/test.pro
@@ -5,5 +5,5 @@ CONFIG += console
QT = core testlib
SOURCES = ../tst_qthreadstorage.cpp
-TEST_HELPER_INSTALLS = ../crashonexit/crashonexit
+!winrt: TEST_HELPER_INSTALLS = ../crashonexit/crashonexit
diff --git a/tests/auto/corelib/tools/qlocale/qlocale.pro b/tests/auto/corelib/tools/qlocale/qlocale.pro
index abbe31d1ef..5161200260 100644
--- a/tests/auto/corelib/tools/qlocale/qlocale.pro
+++ b/tests/auto/corelib/tools/qlocale/qlocale.pro
@@ -1,4 +1,4 @@
TEMPLATE = subdirs
-SUBDIRS += test \
- syslocaleapp
+SUBDIRS += test
+!winrt: SUBDIRS+=syslocaleapp
diff --git a/tests/auto/corelib/tools/qlocale/test/test.pro b/tests/auto/corelib/tools/qlocale/test/test.pro
index 4777030dd7..d9004d1eb6 100644
--- a/tests/auto/corelib/tools/qlocale/test/test.pro
+++ b/tests/auto/corelib/tools/qlocale/test/test.pro
@@ -17,4 +17,4 @@ win32 {
}
}
-TEST_HELPER_INSTALLS = ../syslocaleapp/syslocaleapp
+!winrt: TEST_HELPER_INSTALLS = ../syslocaleapp/syslocaleapp
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index d88a70c1e5..76341db701 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -95,18 +95,18 @@ private slots:
void creatingQObject();
void mixTrackingPointerCode();
void reentrancyWhileDestructing();
+ void map();
+ void hash();
+ void qvariantCast();
+ void sharedFromThis();
void threadStressTest_data();
void threadStressTest();
- void map();
- void hash();
void validConstructs();
void invalidConstructs_data();
void invalidConstructs();
-
- void qvariantCast();
- void sharedFromThis();
-
+ // let invalidConstructs be the last test, because it's the slowest;
+ // add new tests above this block
public slots:
void cleanup() { safetyCheck(); }
@@ -232,6 +232,14 @@ void tst_QSharedPointer::basics()
QCOMPARE(sizeof(weakref), 2*sizeof(void*));
}
+ {
+ QSharedPointer<const Data> ptr;
+ QWeakPointer<const Data> weakref;
+
+ QCOMPARE(sizeof(ptr), 2*sizeof(void*));
+ QCOMPARE(sizeof(weakref), 2*sizeof(void*));
+ }
+
QFETCH(bool, isNull);
Data *aData = 0;
if (!isNull)
@@ -2232,6 +2240,16 @@ void tst_QSharedPointer::sharedFromThis()
QVERIFY(const_scp.isNull());
QCOMPARE(Data::generationCounter, generations + 1);
QCOMPARE(Data::destructorCounter, destructions);
+
+ QWeakPointer<SomeClass> wcp = sc.sharedFromThis();
+ QVERIFY(wcp.isNull());
+ QCOMPARE(Data::generationCounter, generations + 1);
+ QCOMPARE(Data::destructorCounter, destructions);
+
+ QWeakPointer<const SomeClass> const_wcp = sc.sharedFromThis();
+ QVERIFY(const_wcp.isNull());
+ QCOMPARE(Data::generationCounter, generations + 1);
+ QCOMPARE(Data::destructorCounter, destructions);
}
QCOMPARE(Data::generationCounter, generations + 1);
@@ -2243,6 +2261,11 @@ void tst_QSharedPointer::sharedFromThis()
QVERIFY(const_scp.isNull());
QCOMPARE(Data::generationCounter, generations + 2);
QCOMPARE(Data::destructorCounter, destructions + 1);
+
+ QWeakPointer<const SomeClass> const_wcp = sc.sharedFromThis();
+ QVERIFY(const_wcp.isNull());
+ QCOMPARE(Data::generationCounter, generations + 2);
+ QCOMPARE(Data::destructorCounter, destructions + 1);
}
QCOMPARE(Data::generationCounter, generations + 2);
@@ -2434,6 +2457,21 @@ void tst_QSharedPointer::sharedFromThis()
QCOMPARE(Data::generationCounter, generations + 5);
QCOMPARE(Data::destructorCounter, destructions + 5);
+
+ {
+ QSharedPointer<const SomeClass> scp2(new SomeClass());
+ QVERIFY(!scp2.isNull());
+ QCOMPARE(Data::generationCounter, generations + 6);
+ QCOMPARE(Data::destructorCounter, destructions + 5);
+
+ QWeakPointer<const SomeClass> wcp2(scp2.constCast<SomeClass>());
+ QVERIFY(!wcp2.isNull());
+ QCOMPARE(Data::generationCounter, generations + 6);
+ QCOMPARE(Data::destructorCounter, destructions + 5);
+ }
+
+ QCOMPARE(Data::generationCounter, generations + 6);
+ QCOMPARE(Data::destructorCounter, destructions + 6);
}
namespace ReentrancyWhileDestructing {
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 9556dfbd51..f8a4d8a00a 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -583,6 +583,7 @@ private slots:
void compareQLatin1Strings();
void fromQLatin1StringWithLength();
void assignQLatin1String();
+ void assignQChar();
void isRightToLeft_data();
void isRightToLeft();
void unicodeStrings();
@@ -6623,6 +6624,71 @@ void tst_QString::assignQLatin1String()
QCOMPARE(foo.size(), latin1subfoo.size());
QCOMPARE(foo, QString::fromLatin1("foo"));
+ // check capacity re-use:
+ QString s;
+ QCOMPARE(s.capacity(), 0);
+
+ // assign to null QString:
+ s = latin1foo;
+ QCOMPARE(s, QString::fromLatin1("foo"));
+ QCOMPARE(s.capacity(), 3);
+
+ // assign to non-null QString with enough capacity:
+ s = QString::fromLatin1("foofoo");
+ const int capacity = s.capacity();
+ s = latin1foo;
+ QCOMPARE(s, QString::fromLatin1("foo"));
+ QCOMPARE(s.capacity(), capacity);
+
+ // assign to shared QString (enough capacity, but can't use):
+ s = QString::fromLatin1("foofoo");
+ QString s2 = s;
+ s = latin1foo;
+ QCOMPARE(s, QString::fromLatin1("foo"));
+ QCOMPARE(s.capacity(), 3);
+
+ // assign to QString with too little capacity:
+ s = QString::fromLatin1("fo");
+ QCOMPARE(s.capacity(), 2);
+ s = latin1foo;
+ QCOMPARE(s, QString::fromLatin1("foo"));
+ QCOMPARE(s.capacity(), 3);
+
+}
+
+void tst_QString::assignQChar()
+{
+ const QChar sp = QLatin1Char(' ');
+ QString s;
+ QCOMPARE(s.capacity(), 0);
+
+ // assign to null QString:
+ s = sp;
+ QCOMPARE(s, QString(sp));
+ QCOMPARE(s.capacity(), 1);
+
+ // assign to non-null QString with enough capacity:
+ s = QLatin1String("foo");
+ const int capacity = s.capacity();
+ QCOMPARE(capacity, 3);
+ s = sp;
+ QCOMPARE(s, QString(sp));
+ QCOMPARE(s.capacity(), capacity);
+
+ // assign to shared QString (enough capacity, but can't use):
+ s = QLatin1String("foo");
+ QString s2 = s;
+ s = sp;
+ QCOMPARE(s, QString(sp));
+ QCOMPARE(s.capacity(), 1);
+
+ // assign to empty QString:
+ s = QString("");
+ s.detach();
+ QCOMPARE(s.capacity(), 0);
+ s = sp;
+ QCOMPARE(s, QString(sp));
+ QCOMPARE(s.capacity(), 1);
}
void tst_QString::isRightToLeft_data()
diff --git a/tests/auto/gui/kernel/qclipboard/qclipboard.pro b/tests/auto/gui/kernel/qclipboard/qclipboard.pro
index d97c58dea0..b9fd2080e7 100644
--- a/tests/auto/gui/kernel/qclipboard/qclipboard.pro
+++ b/tests/auto/gui/kernel/qclipboard/qclipboard.pro
@@ -1,4 +1,4 @@
TEMPLATE = subdirs
-SUBDIRS = copier paster
+!winrt: SUBDIRS = copier paster
test.depends += $$SUBDIRS
SUBDIRS += test
diff --git a/tests/auto/gui/kernel/qclipboard/test/test.pro b/tests/auto/gui/kernel/qclipboard/test/test.pro
index 586404871f..f27c582de2 100644
--- a/tests/auto/gui/kernel/qclipboard/test/test.pro
+++ b/tests/auto/gui/kernel/qclipboard/test/test.pro
@@ -15,6 +15,6 @@ wince* {
DEPLOYMENT += rsc reg_resource
}
-TEST_HELPER_INSTALLS = \
+!winrt: TEST_HELPER_INSTALLS = \
../copier/copier \
../paster/paster
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index aa7dced0ab..d764b88ef7 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -100,6 +100,8 @@ private slots:
void windowsTransientChildren();
void requestUpdate();
void initTestCase();
+ void stateChange_data();
+ void stateChange();
void cleanup();
private:
@@ -390,6 +392,18 @@ static inline bool qFuzzyCompareWindowPosition(const QPoint &p1, const QPoint p2
return (p1 - p2).manhattanLength() <= fuzz;
}
+static inline bool qFuzzyCompareWindowSize(const QSize &s1, const QSize &s2, int fuzz)
+{
+ const int manhattanLength = qAbs(s1.width() - s2.width()) + qAbs(s1.height() - s2.height());
+ return manhattanLength <= fuzz;
+}
+
+static inline bool qFuzzyCompareWindowGeometry(const QRect &r1, const QRect &r2, int fuzz)
+{
+ return qFuzzyCompareWindowPosition(r1.topLeft(), r2.topLeft(), fuzz)
+ && qFuzzyCompareWindowSize(r1.size(), r2.size(), fuzz);
+}
+
static QString msgPointMismatch(const QPoint &p1, const QPoint p2)
{
QString result;
@@ -397,6 +411,13 @@ static QString msgPointMismatch(const QPoint &p1, const QPoint p2)
return result;
}
+static QString msgRectMismatch(const QRect &r1, const QRect &r2)
+{
+ QString result;
+ QDebug(&result) << r1 << "!=" << r2;
+ return result;
+}
+
void tst_QWindow::positioning()
{
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(
@@ -561,6 +582,52 @@ void tst_QWindow::childWindowPositioning()
QCOMPARE(childWindowAfter.framePosition(), topLeftOrigin);
}
+// QTBUG-49709: Verify that the normal geometry is correctly restored
+// when executing a sequence of window state changes. So far, Windows
+// only where state changes have immediate effect.
+
+typedef QList<Qt::WindowState> WindowStateList;
+
+Q_DECLARE_METATYPE(WindowStateList)
+
+void tst_QWindow::stateChange_data()
+{
+ QTest::addColumn<WindowStateList>("stateSequence");
+
+ QTest::newRow("normal->min->normal") <<
+ (WindowStateList() << Qt::WindowMinimized << Qt::WindowNoState);
+ QTest::newRow("normal->maximized->normal") <<
+ (WindowStateList() << Qt::WindowMaximized << Qt::WindowNoState);
+ QTest::newRow("normal->fullscreen->normal") <<
+ (WindowStateList() << Qt::WindowFullScreen << Qt::WindowNoState);
+ QTest::newRow("normal->maximized->fullscreen->normal") <<
+ (WindowStateList() << Qt::WindowMaximized << Qt::WindowFullScreen << Qt::WindowNoState);
+}
+
+void tst_QWindow::stateChange()
+{
+ QFETCH(WindowStateList, stateSequence);
+
+ if (QGuiApplication::platformName().compare(QLatin1String("windows"), Qt::CaseInsensitive))
+ QSKIP("Windows-only test");
+
+ Window window;
+ window.setTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1Char(' ') + QLatin1String(QTest::currentDataTag()));
+ const QRect normalGeometry(m_availableTopLeft + QPoint(40, 40), m_testWindowSize);
+ window.setGeometry(normalGeometry);
+ // explicitly use non-fullscreen show. show() can be fullscreen on some platforms
+ window.showNormal();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+ foreach (Qt::WindowState state, stateSequence) {
+ window.setWindowState(state);
+ QCoreApplication::processEvents();
+ }
+ const QRect geometry = window.geometry();
+ const int fuzz = int(QHighDpiScaling::factor(&window));
+ QVERIFY2(qFuzzyCompareWindowGeometry(geometry, normalGeometry, fuzz),
+ qPrintable(msgRectMismatch(geometry, normalGeometry)));
+}
+
class PlatformWindowFilter : public QObject
{
Q_OBJECT
diff --git a/tests/auto/network/access/qnetworkreply/qnetworkreply.pro b/tests/auto/network/access/qnetworkreply/qnetworkreply.pro
index 7cb6fddbaf..bd10c77252 100644
--- a/tests/auto/network/access/qnetworkreply/qnetworkreply.pro
+++ b/tests/auto/network/access/qnetworkreply/qnetworkreply.pro
@@ -1,5 +1,5 @@
TEMPLATE = subdirs
-!wince: SUBDIRS += echo
+!winrt:!wince: SUBDIRS += echo
test.depends += $$SUBDIRS
SUBDIRS += test
diff --git a/tests/auto/network/access/qnetworkreply/test/test.pro b/tests/auto/network/access/qnetworkreply/test/test.pro
index b683f620df..772bb55990 100644
--- a/tests/auto/network/access/qnetworkreply/test/test.pro
+++ b/tests/auto/network/access/qnetworkreply/test/test.pro
@@ -13,4 +13,4 @@ TESTDATA += ../empty ../rfc3252.txt ../resource ../bigfile ../*.jpg ../certs \
contains(QT_CONFIG,xcb): CONFIG+=insignificant_test # unstable, QTBUG-21102
win32:CONFIG += insignificant_test # QTBUG-24226
-TEST_HELPER_INSTALLS = ../echo/echo
+!winrt: TEST_HELPER_INSTALLS = ../echo/echo
diff --git a/tests/auto/network/bearer/qnetworksession/qnetworksession.pro b/tests/auto/network/bearer/qnetworksession/qnetworksession.pro
index f1cb47d14e..cd480fb73b 100644
--- a/tests/auto/network/bearer/qnetworksession/qnetworksession.pro
+++ b/tests/auto/network/bearer/qnetworksession/qnetworksession.pro
@@ -1,4 +1,4 @@
TEMPLATE = subdirs
-SUBDIRS = lackey
+!winrt:SUBDIRS = lackey
test.depends = $$SUBDIRS
SUBDIRS += test
diff --git a/tests/auto/network/bearer/qnetworksession/test/test.pro b/tests/auto/network/bearer/qnetworksession/test/test.pro
index dd7618b4ad..c95baa2b81 100644
--- a/tests/auto/network/bearer/qnetworksession/test/test.pro
+++ b/tests/auto/network/bearer/qnetworksession/test/test.pro
@@ -15,4 +15,4 @@ CONFIG(debug_and_release) {
DESTDIR = ..
}
-TEST_HELPER_INSTALLS = ../lackey/lackey
+!winrt: TEST_HELPER_INSTALLS = ../lackey/lackey
diff --git a/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp
index 2a0552b770..cc3b99ff76 100644
--- a/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp
+++ b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp
@@ -55,6 +55,7 @@ private slots:
void initTestCase();
void cleanupTestCase();
void dump();
+ void consistencyCheck();
void loopbackIPv4();
void loopbackIPv6();
void localAddress();
@@ -148,6 +149,24 @@ void tst_QNetworkInterface::dump()
}
}
+void tst_QNetworkInterface::consistencyCheck()
+{
+ QList<QNetworkInterface> ifaces = QNetworkInterface::allInterfaces();
+ QSet<QString> interfaceNames;
+ QVector<int> interfaceIndexes;
+
+ foreach (const QNetworkInterface &iface, ifaces) {
+ QVERIFY2(!interfaceNames.contains(iface.name()),
+ "duplicate name = " + iface.name().toLocal8Bit());
+ interfaceNames << iface.name();
+
+ QVERIFY2(!interfaceIndexes.contains(iface.index()),
+ "duplicate index = " + QByteArray::number(iface.index()));
+ if (iface.index())
+ interfaceIndexes << iface.index();
+ }
+}
+
void tst_QNetworkInterface::loopbackIPv4()
{
QList<QHostAddress> all = QNetworkInterface::allAddresses();
diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
index fc2848e488..3e127e8111 100644
--- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -461,7 +461,9 @@ void tst_QSslSocket::constructing()
QCOMPARE(socket.peerAddress(), QHostAddress());
QVERIFY(socket.peerName().isEmpty());
QCOMPARE(socket.peerPort(), quint16(0));
+#ifndef QT_NO_NETWORKPROXY
QCOMPARE(socket.proxy().type(), QNetworkProxy::DefaultProxy);
+#endif
QCOMPARE(socket.readBufferSize(), qint64(0));
QCOMPARE(socket.socketDescriptor(), (qintptr)-1);
QCOMPARE(socket.socketType(), QAbstractSocket::TcpSocket);
@@ -2182,6 +2184,7 @@ void tst_QSslSocket::disconnectFromHostWhenConnected()
void tst_QSslSocket::resetProxy()
{
+#ifndef QT_NO_NETWORKPROXY
QFETCH_GLOBAL(bool, setProxy);
if (setProxy)
return;
@@ -2221,6 +2224,7 @@ void tst_QSslSocket::resetProxy()
socket2.setProxy(goodProxy);
socket2.connectToHostEncrypted(QtNetworkSettings::serverName(), 443);
QVERIFY2(socket2.waitForConnected(10000), qPrintable(socket.errorString()));
+#endif // QT_NO_NETWORKPROXY
}
void tst_QSslSocket::ignoreSslErrorsList_data()
diff --git a/tests/auto/other/toolsupport/tst_toolsupport.cpp b/tests/auto/other/toolsupport/tst_toolsupport.cpp
index a5b85ef221..fdbb6e13d4 100644
--- a/tests/auto/other/toolsupport/tst_toolsupport.cpp
+++ b/tests/auto/other/toolsupport/tst_toolsupport.cpp
@@ -124,7 +124,7 @@ void tst_toolsupport::offsets_data()
if (sizeof(void *) == 8) {
QTestData &data = QTest::newRow("QFilePrivate::fileName")
<< pmm_to_offsetof(&QFilePrivate::fileName);
- data << -1 << 248;
+ data << 168 << 248;
}
#endif
diff --git a/tests/auto/testlib/selftests/selftests.pro b/tests/auto/testlib/selftests/selftests.pro
index 32d66c019d..7a61916535 100644
--- a/tests/auto/testlib/selftests/selftests.pro
+++ b/tests/auto/testlib/selftests/selftests.pro
@@ -1,6 +1,6 @@
TEMPLATE = subdirs
-include(selftests.pri)
+!winrt: include(selftests.pri)
SUBDIRS = $$SUBPROGRAMS test
diff --git a/tests/auto/testlib/selftests/test/test.pro b/tests/auto/testlib/selftests/test/test.pro
index 106787b64d..a2a1dd3f0b 100644
--- a/tests/auto/testlib/selftests/test/test.pro
+++ b/tests/auto/testlib/selftests/test/test.pro
@@ -15,5 +15,5 @@ win32 {
RESOURCES += ../selftests.qrc
include(../selftests.pri)
-for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../$${file}/$${file}"
+!winrt: for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../$${file}/$${file}"
diff --git a/tests/auto/tools/qmake/testdata/findDeps/findDeps.pro b/tests/auto/tools/qmake/testdata/findDeps/findDeps.pro
index 2713296f5b..afb3f65297 100644
--- a/tests/auto/tools/qmake/testdata/findDeps/findDeps.pro
+++ b/tests/auto/tools/qmake/testdata/findDeps/findDeps.pro
@@ -1,4 +1,5 @@
DESTDIR = ./
+gcc: QMAKE_CXXFLAGS += -Wno-comment
HEADERS += object1.h \
object2.h \
@@ -8,5 +9,7 @@ HEADERS += object1.h \
object6.h \
object7.h \
object8.h \
- object9.h
+ object9.h \
+ objecta.h \
+ objectf.h
SOURCES += main.cpp needed.cpp
diff --git a/tests/auto/tools/qmake/testdata/findDeps/main.cpp b/tests/auto/tools/qmake/testdata/findDeps/main.cpp
index 0df3f9b7c3..3f4f5def3c 100644
--- a/tests/auto/tools/qmake/testdata/findDeps/main.cpp
+++ b/tests/auto/tools/qmake/testdata/findDeps/main.cpp
@@ -35,24 +35,56 @@
/ #include "needed.cpp"
// if not ignored, symbol needed() won't be available ...
- #include <moc_object1.cpp>
-/**/ #include <moc_object2.cpp>
-/**//**/ #include <moc_object3.cpp>
-/*'*/ #include <moc_object4.cpp>
-/*
-*/ #include <moc_object5.cpp>
+// Check we're not confused by string juxtaposition:
+static const char text[] = "lorem ""ipsum /*";
-//
+ #include <moc_object1.cpp>
+/**/ #include "\
+moc_object2.cpp\
+"
+/**//**/ #include <moc_\
+o\
+b\
+j\
+e\
+c\
+t\
+3\
+.cpp>
+/*'"*/ #include <moc_object4.cpp>
+/*"'
+*/ #include <moc_object5.cpp> /*
+#include "missing.cpp"
+*/// a backslash newline does make the next line part of this comment \
+/* so this text is in last line's C++-style comment, not a C-comment !
#include <moc_object6.cpp>
+#if 0
+#pragma "ignore me" '&' L"me"
+#line 4321 "main.cpp" more /* preprocessing */ tokens
+#endif
static void function1();
-#include <moc_object7.cpp>
+#include/* every comment
+gets replaced (in phase 3) by a single
+space */<moc_object7.cpp>
static void function2(); /**/
-#include <moc_object8.cpp>
+#include \
+<moc_object8.cpp>
static void function3(); //
#include <moc_object9.cpp>
+/* backslash-newline elimination happens in phase 2 *\
+/ # /* and that's valid here, too. *\
+/ include/* and, of course, here *\
+/<moc_objecta.cpp>// while we're here, ... \
+#include "needed.cpp"
int main () {
extern int needed(void);
return needed();
}
+
+/*
+ Deliberately end file in a #include, with nothing after it but the mandatory
+ (unescaped) newline at the end of every source file.
+*/
+#include "moc_objectf.cpp"
diff --git a/tests/auto/tools/qmake/testdata/findDeps/objecta.h b/tests/auto/tools/qmake/testdata/findDeps/objecta.h
new file mode 100644
index 0000000000..b9813b9e18
--- /dev/null
+++ b/tests/auto/tools/qmake/testdata/findDeps/objecta.h
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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.
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QObject>
+
+class ObjectA : public QObject
+{
+ Q_OBJECT
+};
+
diff --git a/tests/auto/tools/qmake/testdata/findDeps/objectf.h b/tests/auto/tools/qmake/testdata/findDeps/objectf.h
new file mode 100644
index 0000000000..5dead815a0
--- /dev/null
+++ b/tests/auto/tools/qmake/testdata/findDeps/objectf.h
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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.
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QObject>
+
+class ObjectF : public QObject
+{
+ Q_OBJECT
+};
+
diff --git a/tests/auto/tools/qmake/testdata/findMocs/findMocs.pro b/tests/auto/tools/qmake/testdata/findMocs/findMocs.pro
index a4a7dc987d..af672c2621 100644
--- a/tests/auto/tools/qmake/testdata/findMocs/findMocs.pro
+++ b/tests/auto/tools/qmake/testdata/findMocs/findMocs.pro
@@ -1,4 +1,5 @@
DESTDIR = ./
-HEADERS += object1.h object2.h object3.h object4.h object5.h object6.h object7.h
+HEADERS += object1.h object2.h object3.h object4.h \
+ object5.h object6.h object7.h object8.h object9.h
SOURCES += main.cpp
diff --git a/tests/auto/tools/qmake/testdata/findMocs/main.cpp b/tests/auto/tools/qmake/testdata/findMocs/main.cpp
index 8e0ef9fc41..3f566c4af4 100644
--- a/tests/auto/tools/qmake/testdata/findMocs/main.cpp
+++ b/tests/auto/tools/qmake/testdata/findMocs/main.cpp
@@ -39,6 +39,7 @@
#include <moc_object5.cpp>
#include <moc_object6.cpp>
#include <moc_object7.cpp>
+#include "object8.h"
+#include <moc_object9.cpp>
-int main () {}
-
+int main() { return 0; }
diff --git a/tests/auto/tools/qmake/testdata/findMocs/object1.h b/tests/auto/tools/qmake/testdata/findMocs/object1.h
index e0857f4297..1fcac5f511 100644
--- a/tests/auto/tools/qmake/testdata/findMocs/object1.h
+++ b/tests/auto/tools/qmake/testdata/findMocs/object1.h
@@ -37,6 +37,6 @@
class Object1 : public QObject
{
- Q_OBJECT
+ Q\
+_OBJECT
};
-
diff --git a/tests/auto/tools/qmake/testdata/findMocs/object2.h b/tests/auto/tools/qmake/testdata/findMocs/object2.h
index cc60269cd3..a52489b44c 100644
--- a/tests/auto/tools/qmake/testdata/findMocs/object2.h
+++ b/tests/auto/tools/qmake/testdata/findMocs/object2.h
@@ -36,6 +36,6 @@
class Object2 : public QObject
{
- Q_OBJECT
+ Q_\
+OBJECT
};
-
diff --git a/tests/auto/tools/qmake/testdata/findMocs/object3.h b/tests/auto/tools/qmake/testdata/findMocs/object3.h
index c66edee6e1..c481a0796d 100644
--- a/tests/auto/tools/qmake/testdata/findMocs/object3.h
+++ b/tests/auto/tools/qmake/testdata/findMocs/object3.h
@@ -37,6 +37,6 @@
class Object3 : public QObject
{
- Q_OBJECT
+ Q_OBJ\
+ECT
};
-
diff --git a/tests/auto/tools/qmake/testdata/findMocs/object4.h b/tests/auto/tools/qmake/testdata/findMocs/object4.h
index 73bf9cdaa3..eb38652f14 100644
--- a/tests/auto/tools/qmake/testdata/findMocs/object4.h
+++ b/tests/auto/tools/qmake/testdata/findMocs/object4.h
@@ -44,10 +44,9 @@ class Object4 : public QObject
Comment ends there --> /*/
// Now we poison moc, just to make sure this doesn't get moc'ed :)
-class NonMocObject
+class NonMocObject4
/* : QObject */
{
/* qmake ignore Q_OBJECT */
Q_OBJECT
};
-
diff --git a/tests/auto/tools/qmake/testdata/findMocs/object7.h b/tests/auto/tools/qmake/testdata/findMocs/object7.h
index 92b4672d6b..3922a542e0 100644
--- a/tests/auto/tools/qmake/testdata/findMocs/object7.h
+++ b/tests/auto/tools/qmake/testdata/findMocs/object7.h
@@ -33,6 +33,7 @@
/**//*'*/
#include <QObject>
+#define bogon /"/*"
class Object7 : public QObject
{
diff --git a/tests/auto/tools/qmake/testdata/findMocs/object8.h b/tests/auto/tools/qmake/testdata/findMocs/object8.h
new file mode 100644
index 0000000000..51096e4c27
--- /dev/null
+++ b/tests/auto/tools/qmake/testdata/findMocs/object8.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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.
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QObject>
+#define Q_OBJECTOID_THING // empty
+
+class Object8 : public QObject
+{
+ Q_OBJECT\
+OID_THING
+};
+
+// Now we poison moc, just to make sure this doesn't get moc'ed :)
+class NonMocObject8
+/* : QObject */
+{
+ /* qmake ignore Q_OBJECT */
+ Q_OBJECT
+};
diff --git a/tests/auto/tools/qmake/testdata/findMocs/object9.h b/tests/auto/tools/qmake/testdata/findMocs/object9.h
new file mode 100644
index 0000000000..bda50355d9
--- /dev/null
+++ b/tests/auto/tools/qmake/testdata/findMocs/object9.h
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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.
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QObject>
+#define juxtaposed "lorem ""ipsum /*"
+
+class Object9 : public QObject
+{
+ Q_OBJECT
+};
diff --git a/tests/auto/tools/qmake/testdata/rawString/main.cpp b/tests/auto/tools/qmake/testdata/rawString/main.cpp
new file mode 100644
index 0000000000..604986666a
--- /dev/null
+++ b/tests/auto/tools/qmake/testdata/rawString/main.cpp
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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.
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+static const char raw[] = R"blah(lorem " ipsum /*)blah"\
+;
+#include <moc_object1.cpp>
+
+int main () { return 0; }
diff --git a/tests/auto/tools/qmake/testdata/rawString/object1.h b/tests/auto/tools/qmake/testdata/rawString/object1.h
new file mode 100644
index 0000000000..1435624f7b
--- /dev/null
+++ b/tests/auto/tools/qmake/testdata/rawString/object1.h
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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.
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#define rawstring R"blah(lorem " ipsum /*)blah";
+#include <QObject>
+
+class Object1 : public QObject
+{
+ Q_OBJECT
+};
diff --git a/tests/auto/tools/qmake/testdata/rawString/rawString.pro b/tests/auto/tools/qmake/testdata/rawString/rawString.pro
new file mode 100644
index 0000000000..d2d8132ceb
--- /dev/null
+++ b/tests/auto/tools/qmake/testdata/rawString/rawString.pro
@@ -0,0 +1,4 @@
+DESTDIR = ./
+
+HEADERS += object1.h
+SOURCES += main.cpp
diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp
index bd6fc63701..a891e2c20d 100644
--- a/tests/auto/tools/qmake/tst_qmake.cpp
+++ b/tests/auto/tools/qmake/tst_qmake.cpp
@@ -72,6 +72,7 @@ private slots:
void one_space();
void findMocs();
void findDeps();
+ void rawString();
#if defined(Q_OS_MAC)
void bundle_spaces();
#endif
@@ -386,6 +387,24 @@ void tst_qmake::findDeps()
QVERIFY( test_compiler.removeMakefile(workDir) );
}
+void tst_qmake::rawString()
+{
+#ifdef Q_COMPILER_RAW_STRINGS
+ QString workDir = base_path + "/testdata/rawString";
+
+ QVERIFY( test_compiler.qmake(workDir, "rawString") );
+ QVERIFY( test_compiler.make(workDir) );
+ QVERIFY( test_compiler.exists(workDir, "rawString", Exe, "1.0.0" ) );
+ QVERIFY( test_compiler.makeClean(workDir) );
+ QVERIFY( test_compiler.exists(workDir, "rawString", Exe, "1.0.0" ) );
+ QVERIFY( test_compiler.makeDistClean(workDir ) );
+ QVERIFY( !test_compiler.exists(workDir, "rawString", Exe, "1.0.0" ) );
+ QVERIFY( test_compiler.removeMakefile(workDir) );
+#else
+ QSKIP("Test for C++11 raw strings depends on compiler support for them");
+#endif
+}
+
struct TempFile
: QFile
{
diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
index 35f4e406e0..e36c44db17 100644
--- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
@@ -128,6 +128,7 @@ private slots:
#endif
void completionOnLevelAfterRoot();
void task233037_selectingDirectory();
+ void task235069_hideOnEscape_data();
void task235069_hideOnEscape();
void task203703_returnProperSeparator();
void task228844_ensurePreviousSorting();
@@ -764,26 +765,38 @@ void tst_QFileDialog2::task233037_selectingDirectory()
current.rmdir("test");
}
+void tst_QFileDialog2::task235069_hideOnEscape_data()
+{
+ QTest::addColumn<QString>("childName");
+ QTest::addColumn<QFileDialog::ViewMode>("viewMode");
+ QTest::newRow("listView") << QStringLiteral("listView") << QFileDialog::List;
+ QTest::newRow("fileNameEdit") << QStringLiteral("fileNameEdit") << QFileDialog::List;
+ QTest::newRow("treeView") << QStringLiteral("treeView") << QFileDialog::Detail;
+}
+
void tst_QFileDialog2::task235069_hideOnEscape()
{
+ QFETCH(QString, childName);
+ QFETCH(QFileDialog::ViewMode, viewMode);
QDir current = QDir::currentPath();
+
QNonNativeFileDialog fd;
- fd.setViewMode(QFileDialog::List);
+ QSignalSpy spyFinished(&fd, &QDialog::finished);
+ QVERIFY(spyFinished.isValid());
+ QSignalSpy spyRejected(&fd, &QDialog::rejected);
+ QVERIFY(spyRejected.isValid());
+ fd.setViewMode(viewMode);
fd.setDirectory(current.absolutePath());
- fd.setAcceptMode( QFileDialog::AcceptSave);
+ fd.setAcceptMode(QFileDialog::AcceptSave);
fd.show();
- QListView *list = fd.findChild<QListView*>("listView");
- list->setFocus();
+ QWidget *child = fd.findChild<QWidget *>(childName);
+ QVERIFY(child);
+ child->setFocus();
QTest::qWait(200);
- QTest::keyClick(list, Qt::Key_Escape);
+ QTest::keyClick(child, Qt::Key_Escape);
QCOMPARE(fd.isVisible(), false);
- QNonNativeFileDialog fd2;
- fd2.setDirectory(current.absolutePath());
- fd2.setAcceptMode( QFileDialog::AcceptSave);
- fd2.show();
- QLineEdit *edit = fd2.findChild<QLineEdit*>("fileNameEdit");
- QTest::keyClick(edit, Qt::Key_Escape);
- QCOMPARE(fd2.isVisible(), false);
+ QCOMPARE(spyFinished.count(), 1); // QTBUG-7690
+ QCOMPARE(spyRejected.count(), 1); // reject(), don't hide()
}
#ifdef QT_BUILD_INTERNAL
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 260aa25512..b0bf395f6b 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -123,6 +123,9 @@ private slots:
void permissions_data();
void permissions();
+ void doNotUnwatchOnFailedRmdir();
+ void specialFiles();
+
protected:
bool createFiles(const QString &test_path, const QStringList &initial_files, int existingFileCount = 0, const QStringList &intial_dirs = QStringList());
@@ -821,18 +824,21 @@ void tst_QFileSystemModel::sort()
QModelIndex parent = myModel->index(dirPath, 0);
QList<QString> expectedOrder;
expectedOrder << tempFile2.fileName() << tempFile.fileName() << dirPath + QChar('/') + ".." << dirPath + QChar('/') + ".";
- //File dialog Mode means sub trees are not sorted, only the current root
+
if (fileDialogMode) {
- // FIXME: we were only able to disableRecursiveSort in developer builds, so we can only
- // stably perform this test for developer builds
-#ifdef QT_BUILD_INTERNAL
- QList<QString> actualRows;
+ // File dialog Mode means sub trees are not sorted, only the current root.
+ // There's no way we can check that the sub tree is "not sorted"; just check if it
+ // has the same contents of the expected list
+ QList<QString> actualRows;
for(int i = 0; i < myModel->rowCount(parent); ++i)
{
actualRows << dirPath + QChar('/') + myModel->index(i, 1, parent).data(QFileSystemModel::FileNameRole).toString();
}
- QVERIFY(actualRows != expectedOrder);
-#endif
+
+ std::sort(expectedOrder.begin(), expectedOrder.end());
+ std::sort(actualRows.begin(), actualRows.end());
+
+ QCOMPARE(actualRows, expectedOrder);
} else {
for(int i = 0; i < myModel->rowCount(parent); ++i)
{
@@ -1044,6 +1050,78 @@ void tst_QFileSystemModel::permissions() // checks QTBUG-20503
QCOMPARE(fileInfoPermissions, modelPermissions);
}
+void tst_QFileSystemModel::doNotUnwatchOnFailedRmdir()
+{
+ const QString tmp = flatDirTestPath;
+
+ QFileSystemModel model;
+
+ const QTemporaryDir tempDir(tmp + '/' + QStringLiteral("doNotUnwatchOnFailedRmdir-XXXXXX"));
+ QVERIFY(tempDir.isValid());
+
+ const QModelIndex rootIndex = model.setRootPath(tempDir.path());
+
+ // create a file in the directory so to prevent it from deletion
+ {
+ QFile file(tempDir.path() + '/' + QStringLiteral("file1"));
+ QVERIFY(file.open(QIODevice::WriteOnly));
+ }
+
+ QCOMPARE(model.rmdir(rootIndex), false);
+
+ // create another file
+ {
+ QFile file(tempDir.path() + '/' + QStringLiteral("file2"));
+ QVERIFY(file.open(QIODevice::WriteOnly));
+ }
+
+ // the model must now detect this second file
+ QTRY_COMPARE(model.rowCount(rootIndex), 2);
+}
+
+static QSet<QString> fileListUnderIndex(const QFileSystemModel *model, const QModelIndex &parent)
+{
+ QSet<QString> fileNames;
+ const int rowCount = model->rowCount(parent);
+ for (int i = 0; i < rowCount; ++i)
+ fileNames.insert(model->index(i, 0, parent).data(QFileSystemModel::FileNameRole).toString());
+ return fileNames;
+}
+
+void tst_QFileSystemModel::specialFiles()
+{
+ QFileSystemModel model;
+
+ model.setFilter(QDir::AllEntries | QDir::System | QDir::Hidden);
+
+ // Can't simply verify if the model returns a valid model index for a special file
+ // as it will always return a valid index for existing files,
+ // even if the file is not visible with the given filter.
+
+#if defined(Q_OS_UNIX)
+ const QModelIndex rootIndex = model.setRootPath(QStringLiteral("/dev/"));
+ const QString testFileName = QStringLiteral("null");
+#elif defined(Q_OS_WIN)
+ const QModelIndex rootIndex = model.setRootPath(flatDirTestPath);
+
+ const QString testFileName = QStringLiteral("linkSource.lnk");
+
+ QFile file(flatDirTestPath + QLatin1String("/linkTarget.txt"));
+ QVERIFY(file.open(QIODevice::WriteOnly));
+ file.close();
+ QVERIFY(file.link(flatDirTestPath + '/' + testFileName));
+#else
+ QSKIP("Not implemented");
+ QModelIndex rootIndex;
+ QString testFileName;
+#endif
+
+ QTRY_VERIFY(fileListUnderIndex(&model, rootIndex).contains(testFileName));
+
+ model.setFilter(QDir::AllEntries | QDir::Hidden);
+
+ QTRY_VERIFY(!fileListUnderIndex(&model, rootIndex).contains(testFileName));
+}
QTEST_MAIN(tst_QFileSystemModel)
#include "tst_qfilesystemmodel.moc"
diff --git a/tests/auto/widgets/kernel/qapplication/qapplication.pro b/tests/auto/widgets/kernel/qapplication/qapplication.pro
index 5154c915cd..21bfb50aee 100644
--- a/tests/auto/widgets/kernel/qapplication/qapplication.pro
+++ b/tests/auto/widgets/kernel/qapplication/qapplication.pro
@@ -1,6 +1,6 @@
TEMPLATE = subdirs
-SUBDIRS = desktopsettingsaware modal
+!winrt: SUBDIRS = desktopsettingsaware modal
test.depends += $$SUBDIRS
SUBDIRS += test
diff --git a/tests/auto/widgets/kernel/qapplication/test/test.pro b/tests/auto/widgets/kernel/qapplication/test/test.pro
index b617c228ac..908aa846c0 100644
--- a/tests/auto/widgets/kernel/qapplication/test/test.pro
+++ b/tests/auto/widgets/kernel/qapplication/test/test.pro
@@ -9,7 +9,10 @@ TARGET = ../tst_qapplication
TESTDATA = ../test/test.pro ../tmp/README
-SUBPROGRAMS = desktopsettingsaware modal
-win32:!wince: SUBPROGRAMS += wincmdline
+!winrt {
+ SUBPROGRAMS = desktopsettingsaware modal
+ win32:!wince: SUBPROGRAMS += wincmdline
+
+ for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../$${file}/$${file}"
+}
-for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../$${file}/$${file}"
diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
index 4819f621ea..7d84f43131 100644
--- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
+++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
@@ -761,6 +761,9 @@ void tst_QDockWidget::restoreDockWidget()
{
QByteArray geometry;
QByteArray state;
+
+ const bool isXcb = !QGuiApplication::platformName().compare("xcb", Qt::CaseInsensitive);
+
const QString name = QStringLiteral("main");
const QRect availableGeometry = QApplication::desktop()->availableGeometry();
const QSize size = availableGeometry.size() / 5;
@@ -785,11 +788,22 @@ void tst_QDockWidget::restoreDockWidget()
QVERIFY(dock->isFloating());
state = saveWindow.saveState();
geometry = saveWindow.saveGeometry();
+
+ // QTBUG-49832: Delete and recreate the dock; it should be restored to the same position.
+ delete dock;
+ dock = createTestDock(saveWindow);
+ QVERIFY(saveWindow.restoreDockWidget(dock));
+ dock->show();
+ QVERIFY(QTest::qWaitForWindowExposed(dock));
+ QTRY_VERIFY(dock->isFloating());
+ if (!isXcb) // Avoid Window manager positioning issues
+ QTRY_COMPARE(dock->pos(), dockPos);
}
QVERIFY(!geometry.isEmpty());
QVERIFY(!state.isEmpty());
+ // QTBUG-45780: Completely recreate the dock widget from the saved state.
{
QMainWindow restoreWindow;
restoreWindow.setObjectName(name);
@@ -804,7 +818,7 @@ void tst_QDockWidget::restoreDockWidget()
restoreWindow.show();
QVERIFY(QTest::qWaitForWindowExposed(&restoreWindow));
QTRY_VERIFY(dock->isFloating());
- if (!QGuiApplication::platformName().compare("xcb", Qt::CaseInsensitive))
+ if (isXcb)
QSKIP("Skip due to Window manager positioning issues", Abort);
QTRY_COMPARE(dock->pos(), dockPos);
}
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index c919d4ca79..db42ed3119 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -229,6 +229,7 @@ private slots:
void isModified();
void edited();
+ void fixupDoesNotModify_QTBUG_49295();
void insert();
void setSelection_data();
@@ -2845,6 +2846,29 @@ void tst_QLineEdit::edited()
QVERIFY(testWidget->isModified());
}
+void tst_QLineEdit::fixupDoesNotModify_QTBUG_49295()
+{
+ QLineEdit *testWidget = ensureTestWidget();
+
+ ValidatorWithFixup val;
+ testWidget->setValidator(&val);
+ testWidget->setText("foo");
+ QVERIFY(!testWidget->isModified());
+ QVERIFY(!testWidget->hasAcceptableInput());
+
+ QTest::keyClicks(testWidget, QStringLiteral("bar"));
+ QVERIFY(testWidget->isModified());
+ QVERIFY(!testWidget->hasAcceptableInput());
+
+ // trigger a fixup, which should not reset the modified flag
+ QFocusEvent lostFocus(QEvent::FocusOut);
+ qApp->sendEvent(testWidget, &lostFocus);
+
+ QVERIFY(testWidget->hasAcceptableInput());
+ QEXPECT_FAIL("", "QTBUG-49295: a fixup of a line edit should keep it modified", Continue);
+ QVERIFY(testWidget->isModified());
+}
+
void tst_QLineEdit::insert()
{
QLineEdit *testWidget = ensureTestWidget();