summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro1
-rw-r--r--tests/auto/corelib/global/qlogging/test/test.pro2
-rw-r--r--tests/auto/corelib/io/qfile/test/test.pro2
-rw-r--r--tests/auto/corelib/io/qlockfile/tst_qlockfile.pro1
-rw-r--r--tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication.pro2
-rw-r--r--tests/auto/corelib/io/qprocess/test/test.pro2
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp73
-rw-r--r--tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp2
-rw-r--r--tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp25
-rw-r--r--tests/auto/corelib/json/json.pro1
-rw-r--r--tests/auto/corelib/kernel/qmetamethod/qmetamethod.pro1
-rw-r--r--tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro1
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp2
-rw-r--r--tests/auto/corelib/kernel/qsharedmemory/test/test.pro1
-rw-r--r--tests/auto/corelib/kernel/qsystemsemaphore/test/test.pro1
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/test/test.pro2
-rw-r--r--tests/auto/corelib/plugin/qlibrary/tst/tst.pro1
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pro11
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/tst/tst.pro1
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/test/test.pro2
-rw-r--r--tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp50
-rw-r--r--tests/auto/corelib/tools/qlocale/test/test.pro1
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp24
-rw-r--r--tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp143
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp24
-rw-r--r--tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp11
-rw-r--r--tests/auto/network/access/qnetworkreply/test/test.pro2
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp252
-rw-r--r--tests/auto/network/kernel/qnetworkdatagram/qnetworkdatagram.pro1
-rw-r--r--tests/auto/other/atwrapper/.gitignore1
-rw-r--r--tests/auto/other/atwrapper/TODO17
-rw-r--r--tests/auto/other/atwrapper/atWrapper.cpp636
-rw-r--r--tests/auto/other/atwrapper/atWrapper.h80
-rw-r--r--tests/auto/other/atwrapper/atWrapper.pro21
-rw-r--r--tests/auto/other/atwrapper/atWrapperAutotest.cpp65
-rw-r--r--tests/auto/other/atwrapper/desert.ini14
-rw-r--r--tests/auto/other/atwrapper/ephron.ini14
-rw-r--r--tests/auto/other/atwrapper/gullgubben.ini12
-rw-r--r--tests/auto/other/atwrapper/honshu.ini16
-rw-r--r--tests/auto/other/atwrapper/kramer.ini12
-rw-r--r--tests/auto/other/atwrapper/scruffy.ini15
-rw-r--r--tests/auto/other/atwrapper/spareribs.ini14
-rw-r--r--tests/auto/other/atwrapper/titan.ini13
-rw-r--r--tests/auto/other/lancelot/lancelot.pro1
-rw-r--r--tests/auto/other/macplist/tst_macplist.cpp3
-rw-r--r--tests/auto/other/other.pro1
-rwxr-xr-xtests/auto/test.pl223
-rw-r--r--tests/auto/widgets/kernel/qapplication/test/test.pro2
-rw-r--r--tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro1
-rw-r--r--tests/auto/widgets/widgets/qmenubar/BLACKLIST2
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp40
51 files changed, 535 insertions, 1310 deletions
diff --git a/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro b/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro
index 056d940da7..21bb040b8d 100644
--- a/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro
+++ b/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro
@@ -5,7 +5,6 @@ QT -= gui
TARGET = tst_qglobalstatic
CONFIG += console
-CONFIG -= app_bundle
CONFIG += exceptions
SOURCES += tst_qglobalstatic.cpp
diff --git a/tests/auto/corelib/global/qlogging/test/test.pro b/tests/auto/corelib/global/qlogging/test/test.pro
index 93eee7307a..7c46ae9d16 100644
--- a/tests/auto/corelib/global/qlogging/test/test.pro
+++ b/tests/auto/corelib/global/qlogging/test/test.pro
@@ -1,5 +1,5 @@
CONFIG += testcase
-CONFIG -= app_bundle debug_and_release_target
+CONFIG -= debug_and_release_target
qtConfig(c++11): CONFIG += c++11
qtConfig(c++14): CONFIG += c++14
TARGET = ../tst_qlogging
diff --git a/tests/auto/corelib/io/qfile/test/test.pro b/tests/auto/corelib/io/qfile/test/test.pro
index c0c4b9d5d2..5f1963cf5f 100644
--- a/tests/auto/corelib/io/qfile/test/test.pro
+++ b/tests/auto/corelib/io/qfile/test/test.pro
@@ -1,5 +1,5 @@
CONFIG += testcase
-CONFIG -= app_bundle debug_and_release_target
+CONFIG -= debug_and_release_target
QT = core-private core testlib
qtHaveModule(network): QT += network
else: DEFINES += QT_NO_NETWORK
diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro b/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro
index 7b83d5dbe8..7a304fe779 100644
--- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro
+++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro
@@ -1,5 +1,4 @@
CONFIG += testcase
-CONFIG -= app_bundle
TARGET = tst_qlockfile
SOURCES += tst_qlockfile.cpp
diff --git a/tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication.pro b/tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication.pro
index e46e7e1100..8e46320e0c 100644
--- a/tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication.pro
+++ b/tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication.pro
@@ -1,4 +1,4 @@
CONFIG += testcase
-CONFIG -= app_bundle debug_and_release_target
+CONFIG -= debug_and_release_target
QT = core testlib
SOURCES = tst_qprocessnoapplication.cpp
diff --git a/tests/auto/corelib/io/qprocess/test/test.pro b/tests/auto/corelib/io/qprocess/test/test.pro
index 96d105a4b4..7d6a7973dc 100644
--- a/tests/auto/corelib/io/qprocess/test/test.pro
+++ b/tests/auto/corelib/io/qprocess/test/test.pro
@@ -1,5 +1,5 @@
CONFIG += testcase
-CONFIG -= app_bundle debug_and_release_target
+CONFIG -= debug_and_release_target
QT = core-private testlib network
SOURCES = ../tst_qprocess.cpp
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index dadf4b612e..fcff13b416 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -183,6 +183,7 @@ private slots:
void embeddedZeroByte_data();
void embeddedZeroByte();
+ void testXdg();
private:
void cleanupTestFiles();
@@ -3557,5 +3558,77 @@ void tst_QSettings::consistentRegistryStorage()
}
#endif
+#if defined(QT_BUILD_INTERNAL) && defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID) && !defined(QT_NO_STANDARDPATHS)
+QT_BEGIN_NAMESPACE
+extern void clearDefaultPaths();
+QT_END_NAMESPACE
+#endif
+void tst_QSettings::testXdg()
+{
+#if defined(QT_BUILD_INTERNAL) && defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID) && !defined(QT_NO_STANDARDPATHS)
+ // Note: The XDG_CONFIG_DIRS test must be done before overriding the system path
+ // by QSettings::setPath/setSystemIniPath (used in cleanupTestFiles()).
+ clearDefaultPaths();
+
+ // Initialize the env. variable & populate testing files.
+ const QStringList config_dirs = { settingsPath("xdg_1st"), settingsPath("xdg_2nd"), settingsPath("xdg_3rd") };
+ qputenv("XDG_CONFIG_DIRS", config_dirs.join(':').toUtf8());
+ QList<QSettings *> xdg_orgs, xdg_apps;
+ for (const auto & dir : config_dirs) {
+ xdg_orgs << new QSettings{dir + "/software.org.conf", QSettings::NativeFormat};
+ xdg_apps << new QSettings{dir + "/software.org/KillerAPP.conf", QSettings::NativeFormat};
+ }
+ Q_ASSERT(config_dirs.size() == 3 && xdg_orgs.size() == 3 && xdg_apps.size() == 3);
+ for (int i = 0; i < 3; ++i) {
+ xdg_orgs[i]->setValue("all", QString{"all_org%1"}.arg(i));
+ xdg_apps[i]->setValue("all", QString{"all_app%1"}.arg(i));
+ xdg_orgs[i]->setValue("all_only_org", QString{"all_only_org%1"}.arg(i));
+ xdg_apps[i]->setValue("all_only_app", QString{"all_only_app%1"}.arg(i));
+
+ if (i > 0) {
+ xdg_orgs[i]->setValue("from2nd", QString{"from2nd_org%1"}.arg(i));
+ xdg_apps[i]->setValue("from2nd", QString{"from2nd_app%1"}.arg(i));
+ xdg_orgs[i]->setValue("from2nd_only_org", QString{"from2nd_only_org%1"}.arg(i));
+ xdg_apps[i]->setValue("from2nd_only_app", QString{"from2nd_only_app%1"}.arg(i));
+ }
+
+ if (i > 1) {
+ xdg_orgs[i]->setValue("from3rd", QString{"from3rd_org%1"}.arg(i));
+ xdg_apps[i]->setValue("from3rd", QString{"from3rd_app%1"}.arg(i));
+ xdg_orgs[i]->setValue("from3rd_only_org", QString{"from3rd_only_org%1"}.arg(i));
+ xdg_apps[i]->setValue("from3rd_only_app", QString{"from3rd_only_app%1"}.arg(i));
+ }
+ }
+ qDeleteAll(xdg_apps);
+ qDeleteAll(xdg_orgs);
+
+ // Do the test.
+ QSettings app{QSettings::SystemScope, "software.org", "KillerAPP"}, org{QSettings::SystemScope, "software.org"};
+
+ QVERIFY(app.value("all").toString() == "all_app0");
+ QVERIFY(org.value("all").toString() == "all_org0");
+ QVERIFY(app.value("all_only_org").toString() == "all_only_org0");
+ QVERIFY(org.value("all_only_org").toString() == "all_only_org0");
+ QVERIFY(app.value("all_only_app").toString() == "all_only_app0");
+ QVERIFY(org.value("all_only_app").toString() == QString{});
+
+ QVERIFY(app.value("from2nd").toString() == "from2nd_app1");
+ QVERIFY(org.value("from2nd").toString() == "from2nd_org1");
+ QVERIFY(app.value("from2nd_only_org").toString() == "from2nd_only_org1");
+ QVERIFY(org.value("from2nd_only_org").toString() == "from2nd_only_org1");
+ QVERIFY(app.value("from2nd_only_app").toString() == "from2nd_only_app1");
+ QVERIFY(org.value("from2nd_only_app").toString() == QString{});
+
+ QVERIFY(app.value("from3rd").toString() == "from3rd_app2");
+ QVERIFY(org.value("from3rd").toString() == "from3rd_org2");
+ QVERIFY(app.value("from3rd_only_org").toString() == "from3rd_only_org2");
+ QVERIFY(org.value("from3rd_only_org").toString() == "from3rd_only_org2");
+ QVERIFY(app.value("from3rd_only_app").toString() == "from3rd_only_app2");
+ QVERIFY(org.value("from3rd_only_app").toString() == QString{});
+#else
+ QSKIP("This test is performed in QT_BUILD_INTERNAL on Q_XDG_PLATFORM with use of standard paths only.");
+#endif
+}
+
QTEST_MAIN(tst_QSettings)
#include "tst_qsettings.moc"
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
index 5b18ab9d68..0b536f26de 100644
--- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
+++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
@@ -372,7 +372,7 @@ void tst_qstandardpaths::testFindExecutable_data()
QTest::newRow("win-cmd-nosuffix")
<< QString() << QString::fromLatin1("cmd") << cmdPath;
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS8) {
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows8) {
// The logo executable on Windows 8 is perfectly suited for testing that the
// suffix mechanism is not thrown off by dots in the name.
const QString logo = QLatin1String("microsoft.windows.softwarelogo.showdesktop");
diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
index 487c13be94..758bbead84 100644
--- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
+++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
@@ -57,6 +57,8 @@ private slots:
void fileTemplate_data();
void getSetCheck();
void fileName();
+ void filePath_data();
+ void filePath();
void autoRemove();
void nonWritableCurrentDir();
void openOnRootDrives();
@@ -204,6 +206,29 @@ void tst_QTemporaryDir::fileName()
QCOMPARE(absoluteFilePath, absoluteTempPath);
}
+void tst_QTemporaryDir::filePath_data()
+{
+ QTest::addColumn<QString>("templatePath");
+ QTest::addColumn<QString>("fileName");
+
+ QTest::newRow("0") << QString() << "/tmpfile";
+ QTest::newRow("1") << QString() << "tmpfile";
+ QTest::newRow("2") << "XXXXX" << "tmpfile";
+ QTest::newRow("3") << "YYYYY" << "subdir/file";
+}
+
+void tst_QTemporaryDir::filePath()
+{
+ QFETCH(QString, templatePath);
+ QFETCH(QString, fileName);
+
+ QTemporaryDir dir(templatePath);
+ const QString filePath = dir.filePath(fileName);
+ const QString expectedFilePath = QDir::isAbsolutePath(fileName) ?
+ QString() : dir.path() + QLatin1Char('/') + fileName;
+ QCOMPARE(filePath, expectedFilePath);
+}
+
void tst_QTemporaryDir::autoRemove()
{
// Test auto remove
diff --git a/tests/auto/corelib/json/json.pro b/tests/auto/corelib/json/json.pro
index 16c2ae2fb7..8fa17c5c38 100644
--- a/tests/auto/corelib/json/json.pro
+++ b/tests/auto/corelib/json/json.pro
@@ -1,6 +1,5 @@
TARGET = tst_json
QT = core-private testlib
-CONFIG -= app_bundle
CONFIG += testcase
!android:TESTDATA += bom.json test.json test.bjson test3.json test2.json
diff --git a/tests/auto/corelib/kernel/qmetamethod/qmetamethod.pro b/tests/auto/corelib/kernel/qmetamethod/qmetamethod.pro
index a42cd60236..9dfa29b0fc 100644
--- a/tests/auto/corelib/kernel/qmetamethod/qmetamethod.pro
+++ b/tests/auto/corelib/kernel/qmetamethod/qmetamethod.pro
@@ -2,4 +2,3 @@ CONFIG += testcase
TARGET = tst_qmetamethod
QT = core testlib
SOURCES = tst_qmetamethod.cpp
-mac:CONFIG -= app_bundle
diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro b/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro
index f3153b3fd4..4da90c1096 100644
--- a/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro
+++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro
@@ -2,4 +2,3 @@ CONFIG += testcase
TARGET = tst_qmetaobjectbuilder
QT = core-private testlib
SOURCES = tst_qmetaobjectbuilder.cpp
-mac:CONFIG -= app_bundle
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 0f7f75fb2e..fea185c48f 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -3401,14 +3401,12 @@ void tst_QObject::dumpObjectInfo()
QObject a, b;
QObject::connect(&a, SIGNAL(destroyed(QObject*)), &b, SLOT(deleteLater()));
a.disconnect(&b);
-#ifdef QT_DEBUG
QTest::ignoreMessage(QtDebugMsg, "OBJECT QObject::unnamed");
QTest::ignoreMessage(QtDebugMsg, " SIGNALS OUT");
QTest::ignoreMessage(QtDebugMsg, " signal: destroyed(QObject*)");
QTest::ignoreMessage(QtDebugMsg, " <Disconnected receiver>");
QTest::ignoreMessage(QtDebugMsg, " SIGNALS IN");
QTest::ignoreMessage(QtDebugMsg, " <None>");
-#endif
a.dumpObjectInfo(); // should not crash
}
diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/test.pro b/tests/auto/corelib/kernel/qsharedmemory/test/test.pro
index fabd2cf7a3..61124c27ee 100644
--- a/tests/auto/corelib/kernel/qsharedmemory/test/test.pro
+++ b/tests/auto/corelib/kernel/qsharedmemory/test/test.pro
@@ -2,7 +2,6 @@ CONFIG += testcase
QT = core-private testlib
-mac:CONFIG -= app_bundle
linux:LIBS += -lrt
SOURCES += tst_qsharedmemory.cpp
diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/test/test.pro b/tests/auto/corelib/kernel/qsystemsemaphore/test/test.pro
index a0f63741d3..f60207eb01 100644
--- a/tests/auto/corelib/kernel/qsystemsemaphore/test/test.pro
+++ b/tests/auto/corelib/kernel/qsystemsemaphore/test/test.pro
@@ -2,7 +2,6 @@ CONFIG += testcase
QT = core testlib
win32: CONFIG += console
-mac:CONFIG -= app_bundle
SOURCES += tst_qsystemsemaphore.cpp
TARGET = tst_qsystemsemaphore
diff --git a/tests/auto/corelib/plugin/qfactoryloader/test/test.pro b/tests/auto/corelib/plugin/qfactoryloader/test/test.pro
index 3345651730..9338f4ecc9 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/test/test.pro
+++ b/tests/auto/corelib/plugin/qfactoryloader/test/test.pro
@@ -17,8 +17,6 @@ win32 {
}
}
-mac: CONFIG -= app_bundle
-
!qtConfig(library) {
LIBS += -L ../bin/ -lplugin1 -lplugin2
}
diff --git a/tests/auto/corelib/plugin/qlibrary/tst/tst.pro b/tests/auto/corelib/plugin/qlibrary/tst/tst.pro
index d59cd738bf..6e71ec8ff9 100644
--- a/tests/auto/corelib/plugin/qlibrary/tst/tst.pro
+++ b/tests/auto/corelib/plugin/qlibrary/tst/tst.pro
@@ -1,5 +1,4 @@
CONFIG += testcase
-CONFIG -= app_bundle
TARGET = ../tst_qlibrary
QT = core testlib
SOURCES = ../tst_qlibrary.cpp
diff --git a/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pro b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pro
index e3d5bff5ff..7f7caa7f76 100644
--- a/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pro
+++ b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pro
@@ -6,11 +6,16 @@ OTHER_FILES += \
# Needs explicit load()ing due to aux template. Relies on QT being non-empty.
load(qt)
+i386_d.target = good.i386.dylib
+i386_d.depends = EXPORT_VALID_ARCHS=i386
i386.target = good.i386.dylib
-i386.commands = $(CXX) $(CXXFLAGS) -shared -arch i386 -o $@ -I$(INCPATH) $<
+i386.commands = $(CXX) $(CXXFLAGS) -shared -o $@ -I$(INCPATH) $<
i386.depends += $$PWD/../fakeplugin.cpp
+
+x86_64_d.target = good.x86_64.dylib
+x86_64_d.depends = EXPORT_VALID_ARCHS=x86_64
x86_64.target = good.x86_64.dylib
-x86_64.commands = $(CXX) $(CXXFLAGS) -shared -arch x86_64 -o $@ -I$(INCPATH) $<
+x86_64.commands = $(CXX) $(CXXFLAGS) -shared -o $@ -I$(INCPATH) $<
x86_64.depends += $$PWD/../fakeplugin.cpp
# Current Mac OS X toolchains have no compiler for PPC anymore
@@ -49,7 +54,7 @@ bad.depends += $$PWD/generate-bad.pl
MYTARGETS = $$fat_all.depends fat_all fat_no_x86_64 fat_no_i386 \
fat_stub_i386 fat_stub_x86_64 bad
all.depends += $$MYTARGETS
-QMAKE_EXTRA_TARGETS += $$MYTARGETS all
+QMAKE_EXTRA_TARGETS += i386_d x86_64_d $$MYTARGETS all
QMAKE_CLEAN += $$i386.target $$x86_64.target $$ppc64.target $$fat_all.target \
$$fat_no_i386.target $$fat_no_x86_64.target \
diff --git a/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro b/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro
index 5f9fa6664b..c20e56ba4c 100644
--- a/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro
+++ b/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro
@@ -4,7 +4,6 @@ QT = core testlib
qtConfig(private_tests): QT += core-private
SOURCES = ../tst_qpluginloader.cpp ../fakeplugin.cpp
HEADERS = ../theplugin/plugininterface.h
-CONFIG -= app_bundle
win32 {
CONFIG(debug, debug|release) {
diff --git a/tests/auto/corelib/thread/qthreadstorage/test/test.pro b/tests/auto/corelib/thread/qthreadstorage/test/test.pro
index b9d661a9af..1a1fede186 100644
--- a/tests/auto/corelib/thread/qthreadstorage/test/test.pro
+++ b/tests/auto/corelib/thread/qthreadstorage/test/test.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
TARGET = ../tst_qthreadstorage
-CONFIG -= app_bundle debug_and_release_target
+CONFIG -= debug_and_release_target
CONFIG += console
QT = core testlib
SOURCES = ../tst_qthreadstorage.cpp
diff --git a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
index 0c41f66357..65887e50d3 100644
--- a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
+++ b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
@@ -65,6 +65,8 @@ private slots:
void simpleVectorReserve();
void allocate_data();
void allocate();
+ void reallocate_data() { allocate_data(); }
+ void reallocate();
void alignment_data();
void alignment();
void typedData();
@@ -742,6 +744,54 @@ void tst_QArrayData::allocate()
}
}
+void tst_QArrayData::reallocate()
+{
+ QFETCH(size_t, objectSize);
+ QFETCH(size_t, alignment);
+ QFETCH(QArrayData::AllocationOptions, allocateOptions);
+ QFETCH(bool, isCapacityReserved);
+ QFETCH(const QArrayData *, commonEmpty);
+
+ // Maximum alignment that can be requested is that of QArrayData,
+ // otherwise, we can't use reallocate().
+ Q_ASSERT(alignment <= Q_ALIGNOF(QArrayData));
+
+ // Minimum alignment that can be requested is that of QArrayData.
+ // Typically, this alignment is sizeof(void *) and ensured by malloc.
+ size_t minAlignment = qMax(alignment, Q_ALIGNOF(QArrayData));
+
+ int capacity = 10;
+ Deallocator keeper(objectSize, minAlignment);
+ QArrayData *data = QArrayData::allocate(objectSize, minAlignment, capacity,
+ QArrayData::AllocationOptions(allocateOptions) & ~QArrayData::Grow);
+ keeper.headers.append(data);
+
+ memset(data->data(), 'A', objectSize * capacity);
+ data->size = capacity;
+
+ // now try to reallocate
+ int newCapacity = 40;
+ data = QArrayData::reallocateUnaligned(data, objectSize, newCapacity,
+ QArrayData::AllocationOptions(allocateOptions));
+ QVERIFY(data);
+ keeper.headers.clear();
+ keeper.headers.append(data);
+
+ QCOMPARE(data->size, capacity);
+ if (allocateOptions & QArrayData::Grow)
+ QVERIFY(data->alloc > uint(newCapacity));
+ else
+ QCOMPARE(data->alloc, uint(newCapacity));
+ QCOMPARE(data->capacityReserved, uint(isCapacityReserved));
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
+ QFETCH(bool, isSharable);
+ QCOMPARE(data->ref.isSharable(), isSharable);
+#endif
+
+ for (int i = 0; i < capacity; ++i)
+ QCOMPARE(static_cast<char *>(data->data())[i], 'A');
+}
+
class Unaligned
{
char dummy[8];
diff --git a/tests/auto/corelib/tools/qlocale/test/test.pro b/tests/auto/corelib/tools/qlocale/test/test.pro
index 595ee258e7..c87e29e764 100644
--- a/tests/auto/corelib/tools/qlocale/test/test.pro
+++ b/tests/auto/corelib/tools/qlocale/test/test.pro
@@ -1,5 +1,4 @@
CONFIG += console testcase
-CONFIG -= app_bundle
QT = core testlib core-private
embedded: QT += gui
SOURCES = ../tst_qlocale.cpp
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index 8d9a789507..7681f4755c 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -1754,6 +1754,30 @@ void tst_QLocale::numberOptions()
QVERIFY(ok);
locale.toDouble(QString("1.24e+01"), &ok);
QVERIFY(!ok);
+
+ QCOMPARE(locale.toString(12.4, 'g', 5), QString("12.4"));
+ locale.setNumberOptions(QLocale::IncludeTrailingZeroesAfterDot);
+ QCOMPARE(locale.numberOptions(), QLocale::IncludeTrailingZeroesAfterDot);
+ QCOMPARE(locale.toString(12.4, 'g', 5), QString("12.400"));
+
+ locale.toDouble(QString("1.24e+01"), &ok);
+ QVERIFY(ok);
+ locale.toDouble(QString("1.2400e+01"), &ok);
+ QVERIFY(ok);
+ locale.toDouble(QString("12.4"), &ok);
+ QVERIFY(ok);
+ locale.toDouble(QString("12.400"), &ok);
+ QVERIFY(ok);
+ locale.setNumberOptions(QLocale::RejectTrailingZeroesAfterDot);
+ QCOMPARE(locale.numberOptions(), QLocale::RejectTrailingZeroesAfterDot);
+ locale.toDouble(QString("1.24e+01"), &ok);
+ QVERIFY(ok);
+ locale.toDouble(QString("1.2400e+01"), &ok);
+ QVERIFY(!ok);
+ locale.toDouble(QString("12.4"), &ok);
+ QVERIFY(ok);
+ locale.toDouble(QString("12.400"), &ok);
+ QVERIFY(!ok);
}
void tst_QLocale::negativeNumbers()
diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
index e6fd67e3a8..a3de9ee5b5 100644
--- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
+++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
@@ -36,6 +36,7 @@
#include <qpa/qwindowsysteminterface.h>
#include <qpa/qwindowsysteminterface_p.h>
#include <private/qhighdpiscaling_p.h>
+#include <private/qtouchdevice_p.h>
class tst_QTouchEventWidget : public QWidget
{
@@ -199,6 +200,7 @@ private slots:
void touchBeginPropagatesWhenIgnored();
void touchUpdateAndEndNeverPropagate();
void basicRawEventTranslation();
+ void basicRawEventTranslationOfIds();
void multiPointRawEventTranslationOnTouchScreen();
void multiPointRawEventTranslationOnTouchPad();
void deleteInEventHandler();
@@ -602,7 +604,8 @@ void tst_QTouchEvent::basicRawEventTranslation()
QCOMPARE(touchWidget.touchBeginPoints.count(), 1);
QCOMPARE(touchWidget.timestamp, timestamp);
QTouchEvent::TouchPoint touchBeginPoint = touchWidget.touchBeginPoints.first();
- QCOMPARE(touchBeginPoint.id(), rawTouchPoint.id());
+ const int touchPointId = (QTouchDevicePrivate::get(touchScreenDevice)->id << 24) + 1;
+ QCOMPARE(touchBeginPoint.id(), touchPointId);
QCOMPARE(touchBeginPoint.state(), rawTouchPoint.state());
QCOMPARE(touchBeginPoint.pos(), pos);
QCOMPARE(touchBeginPoint.startPos(), pos);
@@ -637,7 +640,7 @@ void tst_QTouchEvent::basicRawEventTranslation()
QVERIFY(!touchWidget.seenTouchEnd);
QCOMPARE(touchWidget.touchUpdatePoints.count(), 1);
QTouchEvent::TouchPoint touchUpdatePoint = touchWidget.touchUpdatePoints.first();
- QCOMPARE(touchUpdatePoint.id(), rawTouchPoint.id());
+ QCOMPARE(touchUpdatePoint.id(), touchPointId);
QCOMPARE(touchUpdatePoint.state(), rawTouchPoint.state());
QCOMPARE(touchUpdatePoint.pos(), pos + delta);
QCOMPARE(touchUpdatePoint.startPos(), pos);
@@ -669,7 +672,7 @@ void tst_QTouchEvent::basicRawEventTranslation()
QVERIFY(touchWidget.seenTouchEnd);
QCOMPARE(touchWidget.touchEndPoints.count(), 1);
QTouchEvent::TouchPoint touchEndPoint = touchWidget.touchEndPoints.first();
- QCOMPARE(touchEndPoint.id(), rawTouchPoint.id());
+ QCOMPARE(touchEndPoint.id(), touchPointId);
QCOMPARE(touchEndPoint.state(), rawTouchPoint.state());
QCOMPARE(touchEndPoint.pos(), pos + delta + delta);
QCOMPARE(touchEndPoint.startPos(), pos);
@@ -745,9 +748,11 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QVERIFY(!rightWidget.seenTouchEnd);
QCOMPARE(leftWidget.touchBeginPoints.count(), 1);
QCOMPARE(rightWidget.touchBeginPoints.count(), 1);
+ const int touchPointId0 = (QTouchDevicePrivate::get(touchScreenDevice)->id << 24) + 1;
+ const int touchPointId1 = touchPointId0 + 1;
{
QTouchEvent::TouchPoint leftTouchPoint = leftWidget.touchBeginPoints.first();
- QCOMPARE(leftTouchPoint.id(), rawTouchPoints[0].id());
+ QCOMPARE(leftTouchPoint.id(), touchPointId0);
QCOMPARE(leftTouchPoint.state(), rawTouchPoints[0].state());
QCOMPARE(leftTouchPoint.pos(), leftPos);
QCOMPARE(leftTouchPoint.startPos(), leftPos);
@@ -767,7 +772,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QCOMPARE(leftTouchPoint.pressure(), qreal(1.));
QTouchEvent::TouchPoint rightTouchPoint = rightWidget.touchBeginPoints.first();
- QCOMPARE(rightTouchPoint.id(), rawTouchPoints[1].id());
+ QCOMPARE(rightTouchPoint.id(), touchPointId1);
QCOMPARE(rightTouchPoint.state(), rawTouchPoints[1].state());
QCOMPARE(rightTouchPoint.pos(), rightPos);
QCOMPARE(rightTouchPoint.startPos(), rightPos);
@@ -811,7 +816,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QCOMPARE(rightWidget.touchUpdatePoints.count(), 1);
{
QTouchEvent::TouchPoint leftTouchPoint = leftWidget.touchUpdatePoints.first();
- QCOMPARE(leftTouchPoint.id(), rawTouchPoints[0].id());
+ QCOMPARE(leftTouchPoint.id(), touchPointId0);
QCOMPARE(leftTouchPoint.state(), rawTouchPoints[0].state());
QCOMPARE(leftTouchPoint.pos(), QPointF(leftWidget.mapFromParent(centerPos.toPoint())));
QCOMPARE(leftTouchPoint.startPos(), leftPos);
@@ -831,7 +836,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QCOMPARE(leftTouchPoint.pressure(), qreal(1.));
QTouchEvent::TouchPoint rightTouchPoint = rightWidget.touchUpdatePoints.first();
- QCOMPARE(rightTouchPoint.id(), rawTouchPoints[1].id());
+ QCOMPARE(rightTouchPoint.id(), touchPointId1);
QCOMPARE(rightTouchPoint.state(), rawTouchPoints[1].state());
QCOMPARE(rightTouchPoint.pos(), QPointF(rightWidget.mapFromParent(centerPos.toPoint())));
QCOMPARE(rightTouchPoint.startPos(), rightPos);
@@ -875,7 +880,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QCOMPARE(rightWidget.touchEndPoints.count(), 1);
{
QTouchEvent::TouchPoint leftTouchPoint = leftWidget.touchEndPoints.first();
- QCOMPARE(leftTouchPoint.id(), rawTouchPoints[0].id());
+ QCOMPARE(leftTouchPoint.id(), touchPointId0);
QCOMPARE(leftTouchPoint.state(), rawTouchPoints[0].state());
QCOMPARE(leftTouchPoint.pos(), QPointF(leftWidget.mapFromParent(centerPos.toPoint())));
QCOMPARE(leftTouchPoint.startPos(), leftPos);
@@ -895,7 +900,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QCOMPARE(leftTouchPoint.pressure(), qreal(0.));
QTouchEvent::TouchPoint rightTouchPoint = rightWidget.touchEndPoints.first();
- QCOMPARE(rightTouchPoint.id(), rawTouchPoints[1].id());
+ QCOMPARE(rightTouchPoint.id(), touchPointId1);
QCOMPARE(rightTouchPoint.state(), rawTouchPoints[1].state());
QCOMPARE(rightTouchPoint.pos(), QPointF(rightWidget.mapFromParent(centerPos.toPoint())));
QCOMPARE(rightTouchPoint.startPos(), rightPos);
@@ -1145,6 +1150,126 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
}
}
+void tst_QTouchEvent::basicRawEventTranslationOfIds()
+{
+ if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
+ QSKIP("Wayland: This fails. Figure out why.");
+
+ tst_QTouchEventWidget touchWidget;
+ touchWidget.setWindowTitle(QTest::currentTestFunction());
+ touchWidget.setAttribute(Qt::WA_AcceptTouchEvents);
+ touchWidget.setGeometry(100, 100, 400, 300);
+ touchWidget.show();
+ QVERIFY(QTest::qWaitForWindowActive(&touchWidget));
+
+ QVarLengthArray<QPointF, 2> pos;
+ QVarLengthArray<QPointF, 2> screenPos;
+ for (int i = 0; i < 2; ++i) {
+ pos << touchWidget.rect().center() + QPointF(20*i, 20*i);
+ screenPos << touchWidget.mapToGlobal(pos[i].toPoint());
+ }
+ QPointF delta(10, 10);
+ QRectF screenGeometry = QApplication::desktop()->screenGeometry(&touchWidget);
+
+ QVector<QPointF> rawPosList;
+ rawPosList << QPointF(12, 34) << QPointF(56, 78);
+
+ QList<QTouchEvent::TouchPoint> rawTouchPoints;
+
+ // Press both points, this should be translated to a TouchBegin
+ for (int i = 0; i < 2; ++i) {
+ QTouchEvent::TouchPoint rawTouchPoint;
+ rawTouchPoint.setId(i);
+ rawTouchPoint.setState(Qt::TouchPointPressed);
+ rawTouchPoint.setScreenPos(screenPos[i]);
+ rawTouchPoint.setNormalizedPos(normalized(rawTouchPoint.pos(), screenGeometry));
+ rawTouchPoint.setRawScreenPositions(rawPosList);
+ rawTouchPoints << rawTouchPoint;
+ }
+ QTouchEvent::TouchPoint &p0 = rawTouchPoints[0];
+ QTouchEvent::TouchPoint &p1 = rawTouchPoints[1];
+
+ const ulong timestamp = 1234;
+ QWindow *window = touchWidget.windowHandle();
+ QList<QWindowSystemInterface::TouchPoint> nativeTouchPoints =
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(rawTouchPoints, window);
+ QWindowSystemInterface::handleTouchEvent(window, timestamp, touchScreenDevice, nativeTouchPoints);
+ QCoreApplication::processEvents();
+ QVERIFY(touchWidget.seenTouchBegin);
+ QVERIFY(!touchWidget.seenTouchUpdate);
+ QVERIFY(!touchWidget.seenTouchEnd);
+ QCOMPARE(touchWidget.touchBeginPoints.count(), 2);
+
+ const int initialTouchPointId = (QTouchDevicePrivate::get(touchScreenDevice)->id << 24) + 1;
+
+ for (int i = 0; i < touchWidget.touchBeginPoints.count(); ++i) {
+ QTouchEvent::TouchPoint touchBeginPoint = touchWidget.touchBeginPoints.at(i);
+ QCOMPARE(touchBeginPoint.id(), initialTouchPointId + i);
+ QCOMPARE(touchBeginPoint.state(), rawTouchPoints[i].state());
+ }
+
+ // moving the point should translate to TouchUpdate
+ for (int i = 0; i < rawTouchPoints.count(); ++i) {
+ QTouchEvent::TouchPoint &p = rawTouchPoints[i];
+ p.setState(Qt::TouchPointMoved);
+ p.setScreenPos(p.screenPos() + delta);
+ p.setNormalizedPos(normalized(p.pos(), screenGeometry));
+ }
+ nativeTouchPoints =
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(rawTouchPoints, window);
+ QWindowSystemInterface::handleTouchEvent(window, 0, touchScreenDevice, nativeTouchPoints);
+ QCoreApplication::processEvents();
+ QVERIFY(touchWidget.seenTouchBegin);
+ QVERIFY(touchWidget.seenTouchUpdate);
+ QVERIFY(!touchWidget.seenTouchEnd);
+ QCOMPARE(touchWidget.touchUpdatePoints.count(), 2);
+ QCOMPARE(touchWidget.touchUpdatePoints.at(0).id(), initialTouchPointId);
+ QCOMPARE(touchWidget.touchUpdatePoints.at(1).id(), initialTouchPointId + 1);
+
+ // release last point
+ p0.setState(Qt::TouchPointStationary);
+ p1.setState(Qt::TouchPointReleased);
+
+ nativeTouchPoints =
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(rawTouchPoints, window);
+ QWindowSystemInterface::handleTouchEvent(window, 0, touchScreenDevice, nativeTouchPoints);
+ QCoreApplication::processEvents();
+ QVERIFY(touchWidget.seenTouchBegin);
+ QVERIFY(touchWidget.seenTouchUpdate);
+ QVERIFY(!touchWidget.seenTouchEnd);
+ QCOMPARE(touchWidget.touchUpdatePoints.count(), 2);
+ QCOMPARE(touchWidget.touchUpdatePoints[0].id(), initialTouchPointId);
+ QCOMPARE(touchWidget.touchUpdatePoints[1].id(), initialTouchPointId + 1);
+
+ // Press last point again, id should increase
+ p1.setState(Qt::TouchPointPressed);
+ p1.setId(42); // new id
+ nativeTouchPoints =
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(rawTouchPoints, window);
+ QWindowSystemInterface::handleTouchEvent(window, 0, touchScreenDevice, nativeTouchPoints);
+ QCoreApplication::processEvents();
+ QVERIFY(touchWidget.seenTouchBegin);
+ QVERIFY(touchWidget.seenTouchUpdate);
+ QVERIFY(!touchWidget.seenTouchEnd);
+ QCOMPARE(touchWidget.touchUpdatePoints.count(), 2);
+ QCOMPARE(touchWidget.touchUpdatePoints[0].id(), initialTouchPointId);
+ QCOMPARE(touchWidget.touchUpdatePoints[1].id(), initialTouchPointId + 2);
+
+ // release everything
+ p0.setState(Qt::TouchPointReleased);
+ p1.setState(Qt::TouchPointReleased);
+ nativeTouchPoints =
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(rawTouchPoints, window);
+ QWindowSystemInterface::handleTouchEvent(window, 0, touchScreenDevice, nativeTouchPoints);
+ QCoreApplication::processEvents();
+ QVERIFY(touchWidget.seenTouchBegin);
+ QVERIFY(touchWidget.seenTouchUpdate);
+ QVERIFY(touchWidget.seenTouchEnd);
+ QCOMPARE(touchWidget.touchUpdatePoints.count(), 2);
+ QCOMPARE(touchWidget.touchUpdatePoints[0].id(), initialTouchPointId);
+ QCOMPARE(touchWidget.touchUpdatePoints[1].id(), initialTouchPointId + 2);
+}
+
void tst_QTouchEvent::deleteInEventHandler()
{
if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index 6ec0268d96..a08f1896bb 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -65,6 +65,7 @@ private slots:
void positioningDuringMinimized();
void childWindowPositioning_data();
void childWindowPositioning();
+ void childWindowLevel();
void platformSurface();
void isExposed();
void isActive();
@@ -596,6 +597,29 @@ void tst_QWindow::childWindowPositioning()
QCOMPARE(childWindowAfter.framePosition(), topLeftOrigin);
}
+void tst_QWindow::childWindowLevel()
+{
+ ColoredWindow topLevel(Qt::green);
+ topLevel.setObjectName("topLevel");
+ ColoredWindow yellowChild(Qt::yellow, &topLevel);
+ yellowChild.setObjectName("yellowChild");
+ ColoredWindow redChild(Qt::red, &topLevel);
+ redChild.setObjectName("redChild");
+ ColoredWindow blueChild(Qt::blue, &topLevel);
+ blueChild.setObjectName("blueChild");
+
+ const QObjectList &siblings = topLevel.children();
+
+ QCOMPARE(siblings.constFirst(), &yellowChild);
+ QCOMPARE(siblings.constLast(), &blueChild);
+
+ yellowChild.raise();
+ QCOMPARE(siblings.constLast(), &yellowChild);
+
+ blueChild.lower();
+ QCOMPARE(siblings.constFirst(), &blueChild);
+}
+
// 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.
diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
index de5b2a8676..ef1ad76161 100644
--- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
@@ -135,6 +135,7 @@ private slots:
void setPlainText();
void toPlainText();
+ void toRawText();
void deleteTextObjectsOnClear();
@@ -2396,6 +2397,16 @@ void tst_QTextDocument::toPlainText()
QCOMPARE(doc->toPlainText(), QLatin1String("Hello World"));
}
+void tst_QTextDocument::toRawText()
+{
+ doc->setHtml("&nbsp;");
+
+ QString rawText = doc->toRawText();
+ QCOMPARE(rawText.size(), 1);
+ QCOMPARE(rawText.at(0).unicode(), ushort(QChar::Nbsp));
+}
+
+
void tst_QTextDocument::deleteTextObjectsOnClear()
{
QPointer<QTextTable> table = cursor.insertTable(2, 2);
diff --git a/tests/auto/network/access/qnetworkreply/test/test.pro b/tests/auto/network/access/qnetworkreply/test/test.pro
index 45a5734305..8aeec88fd2 100644
--- a/tests/auto/network/access/qnetworkreply/test/test.pro
+++ b/tests/auto/network/access/qnetworkreply/test/test.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
testcase.timeout = 600 # this test is slow
-CONFIG -= app_bundle debug_and_release_target
+CONFIG -= debug_and_release_target
SOURCES += ../tst_qnetworkreply.cpp
TARGET = ../tst_qnetworkreply
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 649278d48b..b3c8a4f66b 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -104,10 +104,10 @@ class tst_QNetworkReply: public QObject
Q_OBJECT
#ifndef QT_NO_NETWORKPROXY
- struct ProxyData {
+ struct ProxyData
+ {
ProxyData(const QNetworkProxy &p, const QByteArray &t, bool auth)
- : tag(t), proxy(p), requiresAuthentication(auth)
- { }
+ : tag(t), proxy(p), requiresAuthentication(auth) {}
QByteArray tag;
QNetworkProxy proxy;
bool requiresAuthentication;
@@ -115,7 +115,8 @@ class tst_QNetworkReply: public QObject
#endif // !QT_NO_NETWORKPROXY
static bool seedCreated;
- static QString createUniqueExtension() {
+ static QString createUniqueExtension()
+ {
if (!seedCreated) {
qsrand(QTime(0,0,0).msecsTo(QTime::currentTime()) + QCoreApplication::applicationPid());
seedCreated = true; // not thread-safe, but who cares
@@ -495,7 +496,7 @@ bool tst_QNetworkReply::seedCreated = false;
QString errorMsg = call; \
if (!errorMsg.isEmpty()) \
QFAIL(qPrintable(errorMsg)); \
- } while (0);
+ } while (0)
#ifndef QT_NO_SSL
static void setupSslServer(QSslSocket* serverSocket)
@@ -507,6 +508,7 @@ static void setupSslServer(QSslSocket* serverSocket)
serverSocket->setProtocol(QSsl::AnyProtocol);
serverSocket->setLocalCertificate(testDataDir + "/certs/server.pem");
serverSocket->setPrivateKey(testDataDir + "/certs/server.key");
+ serverSocket->startServerEncryption();
}
#endif
@@ -553,31 +555,30 @@ protected:
void incomingConnection(qintptr socketDescriptor)
{
//qDebug() << "incomingConnection" << socketDescriptor << "doSsl:" << doSsl << "ipv6:" << ipv6;
- if (!doSsl) {
- client = new QTcpSocket;
- client->setSocketDescriptor(socketDescriptor);
- connectSocketSignals();
- } else {
#ifndef QT_NO_SSL
- QSslSocket *serverSocket = new QSslSocket;
- serverSocket->setParent(this);
- if (serverSocket->setSocketDescriptor(socketDescriptor)) {
- connect(serverSocket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(slotSslErrors(QList<QSslError>)));
- setupSslServer(serverSocket);
- serverSocket->startServerEncryption();
- client = serverSocket;
- connectSocketSignals();
- } else {
+ if (doSsl) {
+ QSslSocket *serverSocket = new QSslSocket(this);
+ if (!serverSocket->setSocketDescriptor(socketDescriptor)) {
delete serverSocket;
return;
}
+ connect(serverSocket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(slotSslErrors(QList<QSslError>)));
+ // connect(serverSocket, &QSslSocket::encrypted, this, &SslServer::ready); ?
+ setupSslServer(serverSocket);
+ client = serverSocket;
+ } else
#endif
+ {
+ client = new QTcpSocket;
+ client->setSocketDescriptor(socketDescriptor);
}
+ connectSocketSignals();
client->setParent(this);
++totalConnections;
}
- virtual void reply() {
+ virtual void reply()
+ {
Q_ASSERT(!client.isNull());
// we need to emulate the bytesWrittenSlot call if the data is empty.
if (dataToTransmit.size() == 0) {
@@ -634,7 +635,8 @@ public slots:
}
}
- void bytesWrittenSlot() {
+ void bytesWrittenSlot()
+ {
Q_ASSERT(!client.isNull());
// Disconnect and delete in next cycle (else Windows clients will fail with RemoteHostClosedError).
if (doClose && client->bytesToWrite() == 0) {
@@ -879,7 +881,8 @@ class BlockingTcpServer : public QTcpServer
public:
BlockingTcpServer(bool ssl) : doSsl(ssl), sslSocket(0) {}
- QTcpSocket* waitForNextConnectionSocket() {
+ QTcpSocket* waitForNextConnectionSocket()
+ {
waitForNewConnection(-1);
if (doSsl) {
if (!sslSocket)
@@ -900,7 +903,6 @@ public:
serverSocket->setSocketDescriptor(socketDescriptor);
connect(serverSocket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(slotSslErrors(QList<QSslError>)));
setupSslServer(serverSocket);
- serverSocket->startServerEncryption();
sslSocket = serverSocket;
} else
#endif
@@ -1381,14 +1383,12 @@ static QByteArray msgWaitForFinished(QNetworkReplyPtr &reply)
QString result;
QDebug debug(&result);
debug << reply->url();
- if (reply->isFinished()) {
- if (reply->error() == QNetworkReply::NoError)
- debug << "finished.";
- else
- debug << "failed: #" << reply->error() << reply->errorString();
- } else {
+ if (!reply->isFinished())
debug << "timed out.";
- }
+ else if (reply->error() == QNetworkReply::NoError)
+ debug << "finished.";
+ else
+ debug << "failed: #" << reply->error() << reply->errorString();
return result.toLocal8Bit();
}
@@ -1403,7 +1403,7 @@ int tst_QNetworkReply::waitForFinish(QNetworkReplyPtr &reply)
QSignalSpy spy(reply.data(), SIGNAL(downloadProgress(qint64,qint64)));
while (!reply->isFinished()) {
QTimer::singleShot(5000, loop, SLOT(quit()));
- if ( loop->exec() == Timeout && count == spy.count() && !reply->isFinished()) {
+ if (loop->exec() == Timeout && count == spy.count() && !reply->isFinished()) {
returnCode = Timeout;
break;
}
@@ -1417,12 +1417,14 @@ int tst_QNetworkReply::waitForFinish(QNetworkReplyPtr &reply)
void tst_QNetworkReply::finished()
{
- loop->exit(returnCode = Success);
+ if (loop)
+ loop->exit(returnCode = Success);
}
void tst_QNetworkReply::gotError()
{
- loop->exit(returnCode = Failure);
+ if (loop)
+ loop->exit(returnCode = Failure);
disconnect(QObject::sender(), SIGNAL(finished()), this, 0);
}
@@ -4725,11 +4727,13 @@ void tst_QNetworkReply::ioPostToHttpNoBufferFlag()
}
#ifndef QT_NO_SSL
-class SslServer : public QTcpServer {
+class SslServer : public QTcpServer
+{
Q_OBJECT
public:
SslServer() : socket(0), m_ssl(true) {}
- void incomingConnection(qintptr socketDescriptor) {
+ void incomingConnection(qintptr socketDescriptor)
+ {
QSslSocket *serverSocket = new QSslSocket;
serverSocket->setParent(this);
@@ -4739,16 +4743,9 @@ public:
emit newPlainConnection(serverSocket);
return;
}
- QString testDataDir = QFileInfo(QFINDTESTDATA("rfc3252.txt")).absolutePath();
- if (testDataDir.isEmpty())
- testDataDir = QCoreApplication::applicationDirPath();
-
connect(serverSocket, SIGNAL(encrypted()), this, SLOT(encryptedSlot()));
- serverSocket->setProtocol(QSsl::AnyProtocol);
connect(serverSocket, SIGNAL(sslErrors(QList<QSslError>)), serverSocket, SLOT(ignoreSslErrors()));
- serverSocket->setLocalCertificate(testDataDir + "/certs/server.pem");
- serverSocket->setPrivateKey(testDataDir + "/certs/server.key");
- serverSocket->startServerEncryption();
+ setupSslServer(serverSocket);
} else {
delete serverSocket;
}
@@ -4757,11 +4754,13 @@ signals:
void newEncryptedConnection(QSslSocket *s);
void newPlainConnection(QSslSocket *s);
public slots:
- void encryptedSlot() {
+ void encryptedSlot()
+ {
socket = (QSslSocket*) sender();
emit newEncryptedConnection(socket);
}
- void readyReadSlot() {
+ void readyReadSlot()
+ {
// for the incoming sockets, not the server socket
//qDebug() << static_cast<QSslSocket*>(sender())->bytesAvailable() << static_cast<QSslSocket*>(sender())->encryptedBytesAvailable();
}
@@ -4807,7 +4806,7 @@ void tst_QNetworkReply::ioPostToHttpsUploadProgress()
disconnect(&server, SIGNAL(newEncryptedConnection(QSslSocket*)), &QTestEventLoop::instance(), SLOT(exitLoop()));
- incomingSocket->setReadBufferSize(1*1024);
+ incomingSocket->setReadBufferSize(1024);
// some progress should have been made
QTRY_VERIFY(!spy.isEmpty());
QList<QVariant> args = spy.last();
@@ -4911,7 +4910,7 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp()
QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), (qint64)testData.size());
if (reader.data.size() < testData.size()) { // oops?
- QCOMPARE(reader.data, testData.mid(0, reader.data.size()));
+ QCOMPARE(reader.data, testData.left(reader.data.size()));
qDebug() << "The data is incomplete, the last" << testData.size() - reader.data.size() << "bytes are missing";
}
QCOMPARE(reader.data.size(), testData.size());
@@ -4958,7 +4957,7 @@ void tst_QNetworkReply::ioPostToHttpUploadProgress()
QVERIFY(incomingSocket);
disconnect(&server, SIGNAL(newConnection()), &QTestEventLoop::instance(), SLOT(exitLoop()));
- incomingSocket->setReadBufferSize(1*1024);
+ incomingSocket->setReadBufferSize(1024);
QTestEventLoop::instance().enterLoop(5);
// some progress should have been made
QVERIFY(!spy.isEmpty());
@@ -5660,12 +5659,14 @@ void tst_QNetworkReply::httpProxyCommands()
QCOMPARE(uaheader, QByteArray("User-Agent: QNetworkReplyAutoTest/1.0"));
}
-class ProxyChangeHelper : public QObject {
+class ProxyChangeHelper : public QObject
+{
Q_OBJECT
public:
ProxyChangeHelper() : QObject(), signalCount(0) {};
public slots:
- void finishedSlot() {
+ void finishedSlot()
+ {
signalCount++;
if (signalCount == 2)
QMetaObject::invokeMethod(&QTestEventLoop::instance(), "exitLoop", Qt::QueuedConnection);
@@ -5911,7 +5912,8 @@ void tst_QNetworkReply::httpReUsingConnectionSequential()
reply2->deleteLater();
}
-class HttpReUsingConnectionFromFinishedSlot : public QObject {
+class HttpReUsingConnectionFromFinishedSlot : public QObject
+{
Q_OBJECT
public:
QNetworkReply* reply1;
@@ -5919,7 +5921,8 @@ public:
QUrl url;
QNetworkAccessManager manager;
public slots:
- void finishedSlot() {
+ void finishedSlot()
+ {
QVERIFY(!reply1->error());
QFETCH(bool, doDeleteLater);
@@ -5967,7 +5970,8 @@ void tst_QNetworkReply::httpReUsingConnectionFromFinishedSlot()
QCOMPARE(server.totalConnections, 1);
}
-class HttpRecursiveCreationHelper : public QObject {
+class HttpRecursiveCreationHelper : public QObject
+{
Q_OBJECT
public:
@@ -5983,7 +5987,8 @@ public:
int requestsStartedCount_readyRead;
int requestsFinishedCount;
public slots:
- void finishedSlot() {
+ void finishedSlot()
+ {
requestsFinishedCount++;
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
@@ -6002,7 +6007,8 @@ public slots:
reply->deleteLater();
}
- void readyReadSlot() {
+ void readyReadSlot()
+ {
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
QVERIFY(!reply->error());
@@ -6011,7 +6017,8 @@ public slots:
requestsStartedCount_readyRead++;
}
}
- void startOne() {
+ void startOne()
+ {
QUrl url = "http://" + QtNetworkSettings::serverName() + "/qtest/fluke.gif";
QNetworkRequest request(url);
QNetworkReply *reply = manager.get(request);
@@ -6380,7 +6387,8 @@ void tst_QNetworkReply::getFromHttpIntoBuffer()
}
// FIXME we really need to consolidate all those server implementations
-class GetFromHttpIntoBuffer2Server : QObject {
+class GetFromHttpIntoBuffer2Server : QObject
+{
Q_OBJECT
qint64 dataSize;
qint64 dataSent;
@@ -6390,26 +6398,28 @@ class GetFromHttpIntoBuffer2Server : QObject {
bool chunkedEncoding;
public:
- GetFromHttpIntoBuffer2Server (qint64 ds, bool sscl, bool ce) : dataSize(ds), dataSent(0),
- client(0), serverSendsContentLength(sscl), chunkedEncoding(ce) {
+ GetFromHttpIntoBuffer2Server (qint64 ds, bool sscl, bool ce)
+ : dataSize(ds), dataSent(0), client(0),
+ serverSendsContentLength(sscl), chunkedEncoding(ce)
+ {
server.listen();
connect(&server, SIGNAL(newConnection()), this, SLOT(newConnectionSlot()));
}
- int serverPort() {
- return server.serverPort();
- }
+ int serverPort() { return server.serverPort(); }
public slots:
- void newConnectionSlot() {
+ void newConnectionSlot()
+ {
client = server.nextPendingConnection();
client->setParent(this);
connect(client, SIGNAL(readyRead()), this, SLOT(readyReadSlot()));
connect(client, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot(qint64)));
}
- void readyReadSlot() {
+ void readyReadSlot()
+ {
client->readAll();
client->write("HTTP/1.0 200 OK\n");
if (serverSendsContentLength)
@@ -6419,7 +6429,8 @@ public slots:
client->write("Connection: close\n\n");
}
- void bytesWrittenSlot(qint64 amount) {
+ void bytesWrittenSlot(qint64 amount)
+ {
Q_UNUSED(amount);
if (dataSent == dataSize && client) {
// close eventually
@@ -6453,7 +6464,8 @@ public slots:
}
};
-class GetFromHttpIntoBuffer2Client : QObject {
+class GetFromHttpIntoBuffer2Client : QObject
+{
Q_OBJECT
private:
bool useDownloadBuffer;
@@ -6470,7 +6482,8 @@ public:
}
public slots:
- void metaDataChangedSlot() {
+ void metaDataChangedSlot()
+ {
if (useDownloadBuffer) {
QSharedPointer<char> sharedPointer = qvariant_cast<QSharedPointer<char> >(reply->attribute(QNetworkRequest::DownloadBufferAttribute));
QVERIFY(!sharedPointer.isNull()); // It will be 0 if it failed
@@ -6480,7 +6493,8 @@ public:
QVERIFY(bytesAvailableList.isEmpty());
}
- void readyReadSlot() {
+ void readyReadSlot()
+ {
QVERIFY(!reply->isFinished());
qint64 bytesAvailable = reply->bytesAvailable();
@@ -6502,7 +6516,8 @@ public:
// Add bytesAvailable to a list an parse
}
- void finishedSlot() {
+ void finishedSlot()
+ {
// We should have already received all readyRead
QVERIFY(!bytesAvailableList.isEmpty());
QCOMPARE(bytesAvailableList.last(), uploadSize);
@@ -6908,17 +6923,17 @@ void tst_QNetworkReply::authenticationWithDifferentRealm()
}
#endif // !QT_NO_NETWORKPROXY
-class QtBug13431Helper : public QObject {
+class QtBug13431Helper : public QObject
+{
Q_OBJECT
public:
QNetworkReply* m_reply;
QTimer m_dlTimer;
public slots:
- void replyFinished(QNetworkReply*) {
- QTestEventLoop::instance().exitLoop();
- }
+ void replyFinished(QNetworkReply*) { QTestEventLoop::instance().exitLoop(); }
- void onReadAndReschedule() {
+ void onReadAndReschedule()
+ {
const qint64 bytesReceived = m_reply->bytesAvailable();
if (bytesReceived && m_reply->readBufferSize()) {
QByteArray data = m_reply->read(bytesReceived);
@@ -7066,7 +7081,8 @@ void tst_QNetworkReply::qtbug22660gzipNoContentLengthEmptyContent()
QCOMPARE(reply->readAll(), QByteArray());
}
-class QtBug27161Helper : public QObject {
+class QtBug27161Helper : public QObject
+{
Q_OBJECT
public:
QtBug27161Helper(MiniHttpServer & server, const QByteArray & data):
@@ -7076,16 +7092,19 @@ public:
connect(&m_server, SIGNAL(newConnection()), this, SLOT(newConnectionSlot()));
}
public slots:
- void newConnectionSlot(){
+ void newConnectionSlot()
+ {
connect(m_server.client, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot()));
}
- void bytesWrittenSlot(){
+ void bytesWrittenSlot()
+ {
disconnect(m_server.client, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot()));
m_Timer.singleShot(100, this, SLOT(timeoutSlot()));
}
- void timeoutSlot(){
+ void timeoutSlot()
+ {
m_server.doClose = true;
// we need to emulate the bytesWrittenSlot call if the data is empty.
if (m_data.size() == 0)
@@ -7514,10 +7533,12 @@ void tst_QNetworkReply::httpUserAgent()
void tst_QNetworkReply::synchronousAuthenticationCache()
{
- class MiniAuthServer : public MiniHttpServer {
+ class MiniAuthServer : public MiniHttpServer
+ {
public:
- MiniAuthServer(QThread *thread) : MiniHttpServer(QByteArray(), false, thread) {};
- virtual void reply() {
+ MiniAuthServer(QThread *thread) : MiniHttpServer(QByteArray(), false, thread) {}
+ virtual void reply()
+ {
dataToTransmit =
"HTTP/1.0 401 Unauthorized\r\n"
@@ -7929,7 +7950,8 @@ public:
qint64 bandwidthQuota;
QTimer timer;
- RateLimitedUploadDevice(QByteArray d) : QIODevice(),data(d),read(0),bandwidthQuota(0) {
+ RateLimitedUploadDevice(QByteArray d) : QIODevice(),data(d),read(0),bandwidthQuota(0)
+ {
buffer.setData(data);
buffer.open(QIODevice::ReadOnly);
timer.setInterval(200);
@@ -7937,12 +7959,14 @@ public:
timer.start();
}
- virtual qint64 writeData(const char* , qint64 ) {
+ virtual qint64 writeData(const char* , qint64 )
+ {
Q_ASSERT(false);
return 0;
}
- virtual qint64 readData(char* data, qint64 maxlen) {
+ virtual qint64 readData(char* data, qint64 maxlen)
+ {
//qDebug() << Q_FUNC_INFO << maxlen << bandwidthQuota;
maxlen = qMin(maxlen, buffer.bytesAvailable());
maxlen = qMin(maxlen, bandwidthQuota);
@@ -7959,24 +7983,17 @@ public:
//qDebug() << Q_FUNC_INFO << maxlen << bandwidthQuota << read << ret << buffer.bytesAvailable();
return ret;
}
- virtual bool atEnd() const {
- return buffer.atEnd();
- }
- virtual qint64 size() const{
- return data.length();
- }
+ virtual bool atEnd() const { return buffer.atEnd(); }
+ virtual qint64 size() const { return data.length(); }
qint64 bytesAvailable() const
{
return buffer.bytesAvailable() + QIODevice::bytesAvailable();
}
- virtual bool isSequential() const{ // random access, we can seek
- return false;
- }
- virtual bool seek ( qint64 pos ) {
- return buffer.seek(pos);
- }
+ virtual bool isSequential() const { return false; } // random access, we can seek
+ virtual bool seek (qint64 pos) { return buffer.seek(pos); }
protected slots:
- void timeoutSlot() {
+ void timeoutSlot()
+ {
//qDebug() << Q_FUNC_INFO;
bandwidthQuota = 8*1024; // fill quota
emit readyRead();
@@ -8166,9 +8183,7 @@ signals:
void corruptFileUploadReceived();
public slots:
- void closeDelayed() {
- m_socket->close();
- }
+ void closeDelayed() { m_socket->close(); }
void readyReadSlot()
{
@@ -8193,17 +8208,18 @@ public slots:
// We had received some data but it is corrupt!
qDebug() << "CORRUPT" << m_receivedData.count();
- // Use this to track down the pattern of the corruption and conclude the source
-// QFile a("/tmp/corrupt");
-// a.open(QIODevice::WriteOnly);
-// a.write(m_receivedData);
-// a.close();
+#if 0 // Use this to track down the pattern of the corruption and conclude the source
+ QFile a("/tmp/corrupt");
+ a.open(QIODevice::WriteOnly);
+ a.write(m_receivedData);
+ a.close();
-// QFile b("/tmp/correct");
-// b.open(QIODevice::WriteOnly);
-// b.write(m_expectedData);
-// b.close();
+ QFile b("/tmp/correct");
+ b.open(QIODevice::WriteOnly);
+ b.write(m_expectedData);
+ b.close();
//exit(1);
+#endif
emit corruptFileUploadReceived();
} else {
emit correctFileUploadReceived();
@@ -8220,26 +8236,26 @@ public:
int m_repliesFinished;
int m_expectedReplies;
QByteArray m_expectedData;
- PutWithServerClosingConnectionImmediatelyServer() : SslServer(), m_correctUploads(0), m_corruptUploads(0), m_repliesFinished(0), m_expectedReplies(0)
+ PutWithServerClosingConnectionImmediatelyServer()
+ : SslServer(), m_correctUploads(0), m_corruptUploads(0),
+ m_repliesFinished(0), m_expectedReplies(0)
{
QObject::connect(this, SIGNAL(newEncryptedConnection(QSslSocket*)), this, SLOT(createHandlerForConnection(QSslSocket*)));
QObject::connect(this, SIGNAL(newPlainConnection(QSslSocket*)), this, SLOT(createHandlerForConnection(QSslSocket*)));
}
public slots:
- void createHandlerForConnection(QSslSocket* s) {
+ void createHandlerForConnection(QSslSocket* s)
+ {
PutWithServerClosingConnectionImmediatelyHandler *handler = new PutWithServerClosingConnectionImmediatelyHandler(s, m_expectedData);
handler->setParent(this);
QObject::connect(handler, SIGNAL(correctFileUploadReceived()), this, SLOT(increaseCorrect()));
QObject::connect(handler, SIGNAL(corruptFileUploadReceived()), this, SLOT(increaseCorrupt()));
}
- void increaseCorrect() {
- m_correctUploads++;
- }
- void increaseCorrupt() {
- m_corruptUploads++;
- }
- void replyFinished() {
+ void increaseCorrect() { m_correctUploads++; }
+ void increaseCorrupt() { m_corruptUploads++; }
+ void replyFinished()
+ {
m_repliesFinished++;
if (m_repliesFinished == m_expectedReplies) {
QTestEventLoop::instance().exitLoop();
diff --git a/tests/auto/network/kernel/qnetworkdatagram/qnetworkdatagram.pro b/tests/auto/network/kernel/qnetworkdatagram/qnetworkdatagram.pro
index a2fe44060e..23d57f3fbf 100644
--- a/tests/auto/network/kernel/qnetworkdatagram/qnetworkdatagram.pro
+++ b/tests/auto/network/kernel/qnetworkdatagram/qnetworkdatagram.pro
@@ -1,5 +1,4 @@
CONFIG += testcase console
-CONFIG -= app_bundle
TARGET = tst_qnetworkdatagram
SOURCES += tst_qnetworkdatagram.cpp
QT = core network testlib
diff --git a/tests/auto/other/atwrapper/.gitignore b/tests/auto/other/atwrapper/.gitignore
deleted file mode 100644
index 162ad53af6..0000000000
--- a/tests/auto/other/atwrapper/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-tst_atwrapper
diff --git a/tests/auto/other/atwrapper/TODO b/tests/auto/other/atwrapper/TODO
deleted file mode 100644
index 23a70c3c9e..0000000000
--- a/tests/auto/other/atwrapper/TODO
+++ /dev/null
@@ -1,17 +0,0 @@
-* Get rid of "Keep baseline" on test failure page (Lars) !! DONE !!
-* Make to autotest (Simon) !! DONE !!
-* Add visual diff (Everyone ;)) !! DONE !!
-* Add flicker (Simon/Jesper) !! DONE !!
-* Add third image -- base-baseline (Lars) !! DONE !!
-* Add "view baselines" gallery, including the "base base line" (Lars) !! DONE !!
-* Add PS printer driver engine test thingy (Eskil) !! DONE !!
-* Add platform by platform comparison perl script. (Morton)
-* Fix the QDateTime.fromString() weirdness on win32 in xmldata.cpp (Jesper)
-* Have one result per page view (Lars) !! DONE !!
-* Have "platform - hostname" on test overview (Lars) !! DONE !!
-* Have the links on the overview page only show failures for that host.(All)!! DONE !!
-* "onion skin" diff. (Jesper)
-* Promote all to baseline
-* Switch all to flicker/onion/whatever
-* Add javascript confirmation for "make baseline"
-* Make "single view" more stable
diff --git a/tests/auto/other/atwrapper/atWrapper.cpp b/tests/auto/other/atwrapper/atWrapper.cpp
deleted file mode 100644
index 8f623538f9..0000000000
--- a/tests/auto/other/atwrapper/atWrapper.cpp
+++ /dev/null
@@ -1,636 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <atWrapper.h>
-#include <datagenerator/datagenerator.h>
-
-#include <QString>
-#include <QHash>
-#include <QFile>
-#include <QFtp>
-#include <QObject>
-#include <QHostInfo>
-#include <QWidget>
-#include <QImage>
-#include <QtTest/QSignalSpy>
-#include <QLibraryInfo>
-
-static const char *ArthurDir = "../../arthur";
-
-#include <string.h>
-
-atWrapper::atWrapper()
-{
-
- // initTests();
-
-}
-
-bool atWrapper::initTests(bool *haveBaseline)
-{
- qDebug() << "Running test on buildkey:" << QLibraryInfo::buildKey() << " qt version:" << qVersion();
-
- qDebug( "Initializing tests..." );
-
- if (!loadConfig( QHostInfo::localHostName().split( "." ).first() + ".ini" ))
- return false;
-
- //Reset the FTP environment where the results are stored
- *haveBaseline = setupFTP();
-
- // Retrieve the latest test result baseline from the FTP server.
- downloadBaseline();
- return true;
-}
-
-void atWrapper::downloadBaseline()
-{
-
- qDebug() << "Now downloading baseline...";
-
- QFtp ftp;
-
- QObject::connect( &ftp, SIGNAL(listInfo(QUrlInfo)), this, SLOT(ftpMgetAddToList(QUrlInfo)) );
-
- //Making sure that the needed local directories exist.
-
- QHashIterator<QString, QString> j(enginesToTest);
-
- while ( j.hasNext() )
- {
- j.next();
-
- QDir dir( output );
-
- if ( !dir.cd( j.key() + ".baseline" ) )
- dir.mkdir( j.key() + ".baseline" );
-
- }
-
- //FTP to the host specified in the config file, and retrieve the test result baseline.
- ftp.connectToHost( ftpHost );
- ftp.login( ftpUser, ftpPass );
-
- ftp.cd( ftpBaseDir );
-
- QHashIterator<QString, QString> i(enginesToTest);
- while ( i.hasNext() )
- {
- i.next();
- mgetDirList.clear();
- mgetDirList << i.key() + ".baseline";
- ftp.cd( i.key() + ".baseline" );
- ftp.list();
- ftp.cd( ".." );
-
- while ( ftp.hasPendingCommands() )
- QCoreApplication::instance()->processEvents();
-
- ftpMgetDone( true );
- }
-
- ftp.close();
- ftp.close();
-
- while ( ftp.hasPendingCommands() )
- QCoreApplication::instance()->processEvents();
-
-}
-
-void atWrapper::ftpMgetAddToList( const QUrlInfo &urlInfo )
-{
- //Simply adding to the list of files to download.
- mgetDirList << urlInfo.name();
-
-}
-
-void atWrapper::ftpMgetDone( bool error)
-{
- Q_UNUSED( error );
-
- //Downloading the files listed in mgetDirList...
- QFtp ftp;
- ftp.connectToHost( ftpHost );
- ftp.login( ftpUser, ftpPass );
-
- QFile* file;
-
- if ( mgetDirList.size() > 1 )
- for ( int i = 1; i < mgetDirList.size(); ++i )
- {
- file = new QFile( QString( output ) + QLatin1Char('/') + mgetDirList.at( 0 )
- + QLatin1Char('/') + mgetDirList.at( i ) );
- if (file->open(QIODevice::WriteOnly)) {
- ftp.get( ftpBaseDir + QLatin1Char('/') + mgetDirList.at( 0 ) + QLatin1Char('/') + mgetDirList.at( i ), file );
- ftp.list(); //Only there to fill up a slot in the pendingCommands queue.
- while ( ftp.hasPendingCommands() )
- QCoreApplication::instance()->processEvents();
- file->close();
- } else {
- qDebug() << "Couldn't open file for writing: " << file->fileName();
- }
- }
-
-
- while ( ftp.hasPendingCommands() )
- QCoreApplication::instance()->processEvents();
-}
-
-void atWrapper::uploadFailed( QString dir, QString filename, QByteArray filedata )
-{
- //Upload a failed test case image to the FTP server.
- QFtp ftp;
- ftp.connectToHost( ftpHost );
- ftp.login( ftpUser, ftpPass );
-
- ftp.cd( ftpBaseDir );
- ftp.cd( dir );
-
- ftp.put( filedata, filename, QFtp::Binary );
-
- ftp.close();
-
- while ( ftp.hasPendingCommands() )
- QCoreApplication::instance()->processEvents();
-}
-
-// returns false if no baseline exists
-bool atWrapper::setupFTP()
-{
- qDebug( "Setting up FTP environment" );
-
- QString dir = "";
- ftpMkDir( ftpBaseDir );
-
- ftpBaseDir += QLatin1Char('/') + QLibraryInfo::buildKey();
-
- ftpMkDir( ftpBaseDir );
-
- ftpBaseDir += QLatin1Char('/') + QString( qVersion() );
-
- ftpMkDir( ftpBaseDir );
-
- QHashIterator<QString, QString> i(enginesToTest);
- QHashIterator<QString, QString> j(enginesToTest);
-
- bool haveBaseline = true;
- //Creating the baseline directories for each engine
- while ( i.hasNext() )
- {
- i.next();
- //qDebug() << "Creating dir with key:" << i.key();
- ftpMkDir( ftpBaseDir + QLatin1Char('/') + QString( i.key() ) + ".failed" );
- ftpMkDir( ftpBaseDir + QLatin1Char('/') + QString( i.key() ) + ".diff" );
- if (!ftpMkDir( ftpBaseDir + QLatin1Char('/') + QString( i.key() ) + ".baseline" ))
- haveBaseline = false;
- }
-
-
- QFtp ftp;
- ftp.connectToHost( ftpHost );
- ftp.login( ftpUser, ftpPass );
-
- ftp.cd( ftpBaseDir );
- //Deleting previous failed directory and all the files in it, then recreating it.
- while ( j.hasNext() )
- {
- j.next();
- rmDirList.clear();
- rmDirList << ftpBaseDir + QLatin1Char('/') + j.key() + ".failed/";
- ftpRmDir( j.key() + ".failed" );
- ftp.rmdir( j.key() + ".failed" );
- ftp.mkdir( j.key() + ".failed" );
- ftp.list();
-
- while ( ftp.hasPendingCommands() )
- QCoreApplication::instance()->processEvents();
-
- rmDirList.clear();
- rmDirList << ftpBaseDir + QLatin1Char('/') + j.key() + ".diff/";
- ftpRmDir( j.key() + ".diff" );
- ftp.rmdir( j.key() + ".diff" );
- ftp.mkdir( j.key() + ".diff" );
- ftp.list();
-
- while ( ftp.hasPendingCommands() )
- QCoreApplication::instance()->processEvents();
-
- }
-
- ftp.close();
-
- while ( ftp.hasPendingCommands() )
- QCoreApplication::instance()->processEvents();
-
- return haveBaseline;
-}
-
-void atWrapper::ftpRmDir( QString dir )
-{
- //Hack to remove a populated directory. (caveat: containing only files and empty dirs, not recursive!)
- qDebug() << "Now removing directory: " << dir;
- QFtp ftp;
- QObject::connect( &ftp, SIGNAL(listInfo(QUrlInfo)), this, SLOT(ftpRmDirAddToList(QUrlInfo)) );
- QObject::connect( &ftp, SIGNAL(done(bool)), this, SLOT(ftpRmDirDone(bool)) );
-
- ftp.connectToHost( ftpHost );
- ftp.login( ftpUser, ftpPass );
-
- ftp.list( ftpBaseDir + "/" + dir );
- ftp.close();
- ftp.close();
-
- while ( ftp.hasPendingCommands() )
- QCoreApplication::instance()->processEvents();
-}
-
-void atWrapper::ftpRmDirDone( bool error )
-{
- //Deleting each file in the directory listning, rmDirList.
- Q_UNUSED( error );
-
- QFtp ftp;
- ftp.connectToHost( ftpHost );
- ftp.login( ftpUser, ftpPass );
-
- if ( rmDirList.size() > 1 )
- for (int i = 1; i < rmDirList.size(); ++i)
- ftp.remove( rmDirList.at(0) + rmDirList.at( i ) );
-
- ftp.close();
-
- while ( ftp.hasPendingCommands() )
- QCoreApplication::instance()->processEvents();
-}
-
-// returns false if the directory already exists
-bool atWrapper::ftpMkDir( QString dir )
-{
- //Simply used to avoid QFTP from bailing out and loosing a queue of commands.
- // IE: conveniance.
- QFtp ftp;
-
- QSignalSpy commandSpy(&ftp, SIGNAL(commandFinished(int,bool)));
-
- ftp.connectToHost( ftpHost );
- ftp.login( ftpUser, ftpPass );
- const int command = ftp.mkdir( dir );
- ftp.close();
-
- while ( ftp.hasPendingCommands() )
- QCoreApplication::instance()->processEvents();
-
- for (int i = 0; i < commandSpy.count(); ++i)
- if (commandSpy.at(i).at(0) == command)
- return commandSpy.at(i).at(1).toBool();
-
- return false;
-}
-
-
-void atWrapper::ftpRmDirAddToList( const QUrlInfo &urlInfo )
-{
- //Just adding the file to the list for deletion
- rmDirList << urlInfo.name();
-}
-
-
-bool atWrapper::executeTests()
-{
- qDebug("Executing the tests...");
-
- QHashIterator<QString, QString> i(enginesToTest);
-
- DataGenerator generator;
-
- //Running datagenerator against all the frameworks specified in the config file.
- while ( i.hasNext() )
- {
-
- i.next();
-
- qDebug( "Now testing: " + i.key().toLatin1() );
-
- char* params[13];
- //./bin/datagenerator -framework data/framework.ini -engine OpenGL -suite 1.1 -output outtest
-
-
- QByteArray eng = i.key().toLatin1();
- QByteArray fwk = framework.toLatin1();
- QByteArray sut = suite.toLatin1();
- QByteArray out = output.toLatin1();
- QByteArray siz = size.toLatin1();
- QByteArray fill = fillColor.toLatin1();
-
- params[1] = "-framework";
- params[2] = fwk.data();
- params[3] = "-engine";
- params[4] = eng.data();
- params[5] = "-suite";
- params[6] = sut.data();
- params[7] = "-output";
- params[8] = out.data();
- params[9] = "-size";
- params[10] = siz.data();
- params[11] = "-fill";
- params[12] = fill.data();
-
- generator.run( 13, params );
- }
-
- return true;
-}
-
-void atWrapper::createBaseline()
-{
- qDebug( "Now uploading a baseline of only the latest test values" );
-
- QHashIterator<QString, QString> i(enginesToTest);
-
- QDir dir( output );
- QFtp ftp;
- ftp.connectToHost( ftpHost );
- ftp.login( ftpUser, ftpPass );
- ftp.cd( ftpBaseDir );
- //Upload all the latest test results to the FTP server's baseline directory.
- while ( i.hasNext() )
- {
-
- i.next();
- dir.cd( i.key() );
- ftp.cd( i.key() + ".baseline" );
- dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
- dir.setNameFilters( QStringList() << "*.png" );
- QFileInfoList list = dir.entryInfoList();
- dir.cd( ".." );
- for (int n = 0; n < list.size(); n++)
- {
- QFileInfo fileInfo = list.at( n );
- QFile file( QString( output ) + QLatin1Char('/') + i.key() + QLatin1Char('/') + fileInfo.fileName() );
- file.open( QIODevice::ReadOnly );
- QByteArray fileData = file.readAll();
- //qDebug() << "Sending up:" << fileInfo.fileName() << "with file size" << fileData.size();
- file.close();
- ftp.put( fileData, fileInfo.fileName(), QFtp::Binary );
- }
-
- ftp.cd( ".." );
- }
-
- ftp.close();
-
- while ( ftp.hasPendingCommands() )
- QCoreApplication::instance()->processEvents();
-}
-
-bool atWrapper::compare()
-{
- qDebug( "Now comparing the results to the baseline" );
-
- QHashIterator<QString, QString> i(enginesToTest);
-
- while ( i.hasNext() )
- {
- i.next();
-
- compareDirs( output , i.key() );
-
- }
-
- return true;
-}
-
-void atWrapper::compareDirs( QString basedir, QString target )
-{
-
- QDir dir( basedir );
-
- /* The following should be redundant now.
-
- if ( !dir.cd( target + ".failed" ) )
- dir.mkdir( target + ".failed" );
- else
- dir.cdUp();
-
- */
-
- if ( !dir.cd( target + ".diff" ) )
- dir.mkdir( target + ".diff" );
- else
- dir.cdUp();
-
-
-
- //Perform comparisons between the two directories.
-
- dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
- dir.setNameFilters( QStringList() << "*.png" );
- dir.cd( target + ".baseline" );
- QFileInfoList list = dir.entryInfoList();
-
- for (int i = 0; i < list.size(); ++i)
- {
- QFileInfo fileInfo = list.at(i);
- diff ( basedir, target, fileInfo.fileName() );
- }
-}
-
-bool atWrapper::diff( QString basedir, QString dir, QString target )
-{
- //Comparing the two specified files, and then uploading them to
- //the ftp server if they differ
-
- basedir += QLatin1Char('/') + dir;
- QString one = basedir + ".baseline/" + target;
- QString two = basedir + QLatin1Char('/') + target;
-
- QFile file( one );
-
- file.open( QIODevice::ReadOnly );
- QByteArray contentsOfOne = file.readAll();
- file.close();
-
- file.setFileName( two );
-
- file.open( QIODevice::ReadOnly );
- QByteArray contentsOfTwo = file.readAll();
- file.close();
-
- if ( contentsOfTwo.size() == 0 )
- {
- qDebug() << "No test result found for baseline: " << one;
- file.setFileName( one );
- file.open( QIODevice::ReadOnly );
- file.copy( basedir + ".failed/" + target + "_missing" );
- uploadFailed( dir + ".failed", target + "_missing", contentsOfTwo );
- return false;
- }
-
-
- if ( ( memcmp( contentsOfOne, contentsOfTwo, contentsOfOne.size() ) ) == 0 )
- return true;
- else
- {
- qDebug() << "Sorry, the result did not match: " << one;
- file.setFileName( two );
- file.open( QIODevice::ReadOnly );
- file.copy( basedir + ".failed/" + target );
- file.close();
- uploadFailed( dir + ".failed", target, contentsOfTwo );
- uploadDiff( basedir, dir, target );
- return false;
- }
-}
-
-void atWrapper::uploadDiff( QString basedir, QString dir, QString filename )
-{
-
- qDebug() << basedir;
- QImage im1( basedir + ".baseline/" + filename );
- QImage im2( basedir + QLatin1Char('/') + filename );
-
- QImage im3(im1.size(), QImage::Format_ARGB32);
-
- im1 = im1.convertToFormat(QImage::Format_ARGB32);
- im2 = im2.convertToFormat(QImage::Format_ARGB32);
-
- for ( int y=0; y<im1.height(); ++y )
- {
- uint *s = (uint *) im1.scanLine(y);
- uint *d = (uint *) im2.scanLine(y);
- uint *w = (uint *) im3.scanLine(y);
-
- for ( int x=0; x<im1.width(); ++x )
- {
- if (*s != *d)
- *w = 0xff000000;
- else
- *w = 0xffffffff;
- w++;
- s++;
- d++;
- }
- }
-
- im3.save( basedir + ".diff/" + filename ,"PNG");
-
- QFile file( basedir + ".diff/" + filename );
- file.open( QIODevice::ReadOnly );
- QByteArray contents = file.readAll();
- file.close();
-
- uploadFailed( dir + ".diff", filename, contents );
-
-}
-
-bool atWrapper::loadConfig( QString path )
-{
- qDebug() << "Loading config file from ... " << path;
- configPath = path;
- //If there is no config file, don't proceed;
- if ( !QFile::exists( path ) )
- {
- return false;
- }
-
-
- QSettings settings( path, QSettings::IniFormat, this );
-
-
- //FIXME: Switch to QStringList or something, hash is not needed!
- int numEngines = settings.beginReadArray("engines");
-
- for ( int i = 0; i < numEngines; ++i )
- {
- settings.setArrayIndex(i);
- enginesToTest.insert( settings.value( "engine" ).toString(), "Info here please :p" );
- }
-
- settings.endArray();
-
- framework = QString(ArthurDir) + QDir::separator() + settings.value( "framework" ).toString();
- suite = settings.value( "suite" ).toString();
- output = settings.value( "output" ).toString();
- size = settings.value( "size", "480,360" ).toString();
- fillColor = settings.value( "fill", "white" ).toString();
- ftpUser = settings.value( "ftpUser" ).toString();
- ftpPass = settings.value( "ftpPass" ).toString();
- ftpHost = settings.value( "ftpHost" ).toString();
- ftpBaseDir = settings.value( "ftpBaseDir" ).toString();
-
-
- QDir::current().mkdir( output );
-
- output += QLatin1Char('/') + QLibraryInfo::buildKey();
-
- QDir::current().mkdir( output );
-
- output += QLatin1Char('/') + QString( qVersion() );
-
- QDir::current().mkdir( output );
-
-
- ftpBaseDir += QLatin1Char('/') + QHostInfo::localHostName().split( QLatin1Char('.') ).first();
-
-
-/*
- framework = "data/framework.ini";
- suite = "1.1";
- output = "testresults";
- ftpUser = "anonymous";
- ftpPass = "anonymouspass";
- ftpHost = "kramer.troll.no";
- ftpBaseDir = "/arthurtest";
-*/
- return true;
-}
-
-bool atWrapper::runAutoTests()
-{
- //SVG needs this widget...
- QWidget dummy;
-
- bool haveBaseline = false;
-
- if (!initTests(&haveBaseline))
- return false;
- executeTests();
-
- if ( !haveBaseline )
- {
- qDebug( " First run! Creating baseline..." );
- createBaseline();
- }
- else
- {
- qDebug( " Comparing results..." );
- compare();
- }
- return true;
-}
diff --git a/tests/auto/other/atwrapper/atWrapper.h b/tests/auto/other/atwrapper/atWrapper.h
deleted file mode 100644
index dab2b579e3..0000000000
--- a/tests/auto/other/atwrapper/atWrapper.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef ATWRAPPER_H
-#define ATWRAPPER_H
-
-#include <QHash>
-#include <QString>
-#include <QUrlInfo>
-#include <QColor>
-
-class atWrapper : public QObject
-{
- Q_OBJECT
-
- public:
- atWrapper();
- bool runAutoTests();
-
- private:
- bool executeTests();
- bool initTests(bool *haveBaseline);
- bool compare();
- void createBaseline();
- bool loadConfig( QString );
- void compareDirs( QString, QString );
- bool diff( QString, QString, QString );
- void downloadBaseline();
- void uploadFailed( QString, QString, QByteArray );
- bool ftpMkDir( QString );
- void ftpRmDir( QString );
- bool setupFTP();
- void uploadDiff( QString, QString, QString );
-
- QHash<QString, QString> enginesToTest;
- QString framework;
- QString suite;
- QString output;
- QString size;
- QString ftpUser;
- QString ftpPass;
- QString ftpHost;
- QString ftpBaseDir;
- QList<QString> rmDirList;
- QList<QString> mgetDirList;
- QString configPath;
- QString fillColor;
-
- private slots:
- void ftpRmDirAddToList( const QUrlInfo &urlInfo );
- void ftpRmDirDone( bool );
- void ftpMgetAddToList( const QUrlInfo &urlInfo );
- void ftpMgetDone( bool );
-};
-
-#endif
diff --git a/tests/auto/other/atwrapper/atWrapper.pro b/tests/auto/other/atwrapper/atWrapper.pro
deleted file mode 100644
index 1617ae89d1..0000000000
--- a/tests/auto/other/atwrapper/atWrapper.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-ARTHUR=$$QT_SOURCE_TREE/tests/arthur
-COMMON_FOLDER = $$ARTHUR/common
-include($$ARTHUR/arthurtester.pri)
-INCLUDEPATH += $$ARTHUR
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
-QT += xml svg network testlib
-
-qtHaveModule(opengl): QT += opengl
-
-include($$ARTHUR/datagenerator/datagenerator.pri)
-
-CONFIG += testcase
-
-HEADERS += atWrapper.h
-SOURCES += atWrapperAutotest.cpp atWrapper.cpp
-
-TARGET = tst_atwrapper
-
-#include($$COMMON_FOLDER/common.pri)
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/other/atwrapper/atWrapperAutotest.cpp b/tests/auto/other/atwrapper/atWrapperAutotest.cpp
deleted file mode 100644
index ea40cc92b9..0000000000
--- a/tests/auto/other/atwrapper/atWrapperAutotest.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QtTest/QtTest>
-#include "atWrapper.h"
-#include <QApplication>
-
-class atWrapperAutotest: public QObject
-{
-
-Q_OBJECT
-
-public slots:
- void init();
-
-private slots:
- void runTest();
-};
-
-void atWrapperAutotest::init()
-{
-#ifndef Q_OS_IRIX
- QDir::setCurrent(SRCDIR);
-#endif
-}
-
-void atWrapperAutotest::runTest()
-{
-
- //QApplication app(argc, argv);
-
- atWrapper wrapper;
- if (!wrapper.runAutoTests())
- QSKIP("Arthur not tested on this machine");
- QVERIFY(true);
-}
-
-QTEST_MAIN(atWrapperAutotest)
-#include "atWrapperAutotest.moc"
diff --git a/tests/auto/other/atwrapper/desert.ini b/tests/auto/other/atwrapper/desert.ini
deleted file mode 100644
index 6d8605252d..0000000000
--- a/tests/auto/other/atwrapper/desert.ini
+++ /dev/null
@@ -1,14 +0,0 @@
-[General]
-framework=data/framework.ini
-ftpBaseDir=/arthurtest
-ftpHost=kramer.troll.no
-ftpPass=anonymouspass
-ftpUser=anonymous
-output=testresults
-suite=1.1
-
-[engines]
-1\engine=NativeXRender
-2\engine=PDF
-3\engine=Raster
-size=3
diff --git a/tests/auto/other/atwrapper/ephron.ini b/tests/auto/other/atwrapper/ephron.ini
deleted file mode 100644
index eeccb3b6ef..0000000000
--- a/tests/auto/other/atwrapper/ephron.ini
+++ /dev/null
@@ -1,14 +0,0 @@
-[General]
-framework=data/framework.ini
-ftpBaseDir=/arthurtest
-ftpHost=kramer.troll.no
-ftpPass=anonymouspass
-ftpUser=anonymous
-output=testresults
-suite=oxygen
-size=256
-fill=transparent
-
-[engines]
-1\engine=Raster
-size=1
diff --git a/tests/auto/other/atwrapper/gullgubben.ini b/tests/auto/other/atwrapper/gullgubben.ini
deleted file mode 100644
index 3a664dddd5..0000000000
--- a/tests/auto/other/atwrapper/gullgubben.ini
+++ /dev/null
@@ -1,12 +0,0 @@
-[General]
-framework=data/framework.ini
-ftpBaseDir=/arthurtest
-ftpHost=kramer.troll.no
-ftpPass=anonymouspass
-ftpUser=anonymous
-output=testresults
-suite=1.1
-
-[engines]
-1\engine=OpenGL
-size=1
diff --git a/tests/auto/other/atwrapper/honshu.ini b/tests/auto/other/atwrapper/honshu.ini
deleted file mode 100644
index 3b7751a128..0000000000
--- a/tests/auto/other/atwrapper/honshu.ini
+++ /dev/null
@@ -1,16 +0,0 @@
-[General]
-framework=data/framework.ini
-ftpBaseDir=/arthurtest
-ftpHost=kramer.troll.no
-ftpPass=anonymouspass
-ftpUser=anonymous
-output=testresults
-suite=1.1
-
-[engines]
-1\engine=NativeWin32
-2\engine=PDF
-3\engine=Raster
-4\engine=OpenGL
-5\engine=WinPrint
-size=5
diff --git a/tests/auto/other/atwrapper/kramer.ini b/tests/auto/other/atwrapper/kramer.ini
deleted file mode 100644
index 289d8a8b7e..0000000000
--- a/tests/auto/other/atwrapper/kramer.ini
+++ /dev/null
@@ -1,12 +0,0 @@
-[General]
-framework=data/framework.ini
-ftpBaseDir=/arthurtest
-ftpHost=kramer.troll.no
-ftpPass=anonymouspass
-ftpUser=anonymous
-output=testresults
-suite=1.1
-
-[engines]
-1\engine=Raster
-size=1
diff --git a/tests/auto/other/atwrapper/scruffy.ini b/tests/auto/other/atwrapper/scruffy.ini
deleted file mode 100644
index 329f537e6f..0000000000
--- a/tests/auto/other/atwrapper/scruffy.ini
+++ /dev/null
@@ -1,15 +0,0 @@
-[General]
-framework=data/framework.ini
-ftpBaseDir=/arthurtest
-ftpHost=kramer.nokia.troll.no
-ftpPass=anonymouspass
-ftpUser=anonymous
-output=testresults
-suite=1.1
-
-[engines]
-1\engine=NativeMac
-2\engine=PDF
-3\engine=Raster
-4\engine=OpenGL
-size=4
diff --git a/tests/auto/other/atwrapper/spareribs.ini b/tests/auto/other/atwrapper/spareribs.ini
deleted file mode 100644
index 78ff9e985f..0000000000
--- a/tests/auto/other/atwrapper/spareribs.ini
+++ /dev/null
@@ -1,14 +0,0 @@
-[General]
-framework=data/framework.ini
-ftpBaseDir=/arthurtest
-ftpHost=kramer.troll.no
-ftpPass=anonymouspass
-ftpUser=anonymous
-output=testresults
-suite=1.1
-
-[engines]
-1\engine=NativeWin32
-2\engine=PDF
-3\engine=Raster
-size=3
diff --git a/tests/auto/other/atwrapper/titan.ini b/tests/auto/other/atwrapper/titan.ini
deleted file mode 100644
index 3a0b0dfd31..0000000000
--- a/tests/auto/other/atwrapper/titan.ini
+++ /dev/null
@@ -1,13 +0,0 @@
-[General]
-framework=data/framework.ini
-ftpBaseDir=/arthurtest
-ftpHost=kramer.troll.no
-ftpPass=anonymouspass
-ftpUser=anonymous
-output=testresults
-suite=1.1
-
-[engines]
-1\engine=NativeXRender
-2\engine=OpenGL
-size=2
diff --git a/tests/auto/other/lancelot/lancelot.pro b/tests/auto/other/lancelot/lancelot.pro
index e9c9af7143..798482f02c 100644
--- a/tests/auto/other/lancelot/lancelot.pro
+++ b/tests/auto/other/lancelot/lancelot.pro
@@ -1,5 +1,4 @@
CONFIG += testcase
-CONFIG -= app_bundle
TARGET = tst_lancelot
QT += xml testlib
diff --git a/tests/auto/other/macplist/tst_macplist.cpp b/tests/auto/other/macplist/tst_macplist.cpp
index 0f07095b67..755cc462f5 100644
--- a/tests/auto/other/macplist/tst_macplist.cpp
+++ b/tests/auto/other/macplist/tst_macplist.cpp
@@ -155,9 +155,12 @@ void tst_MacPlist::test_plist()
QString infoPlist = QLatin1String("Info.plist");
QDir dir(QCoreApplication::applicationDirPath());
+#ifndef Q_OS_MACOS
+ // macOS builds tests as single executables, iOS/tvOS/watchOS does not
QVERIFY(dir.cdUp());
QVERIFY(dir.cdUp());
QVERIFY(dir.cdUp());
+#endif
QVERIFY(dir.cd(QLatin1String("app")));
QVERIFY(dir.cd(QLatin1String("app.app")));
QVERIFY(dir.cd(QLatin1String("Contents")));
diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro
index 0babac4b6f..a12f08488d 100644
--- a/tests/auto/other/other.pro
+++ b/tests/auto/other/other.pro
@@ -2,7 +2,6 @@ TEMPLATE=subdirs
QT_FOR_CONFIG += gui-private
SUBDIRS=\
- # atwrapper \ # QTBUG-19452
compiler \
gestures \
lancelot \
diff --git a/tests/auto/test.pl b/tests/auto/test.pl
deleted file mode 100755
index 4df8c40e9e..0000000000
--- a/tests/auto/test.pl
+++ /dev/null
@@ -1,223 +0,0 @@
-#!/usr/bin/env perl
-#############################################################################
-##
-## Copyright (C) 2016 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:GPL-EXCEPT$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-use strict;
-use Cwd;
-use warnings;
-
-# Usage: test.pl <SearchPath> <ExecutionMode> <TestResults> <Timeout [Default 300 seconds]>
-# Variable declarations to keep strict happy
-our $SEARCH_PATH;
-our $EXEC_MODE;
-our $EXE_PREFIX;
-our $EXE_SUFFIX;
-our $TIMEOUT;
-our $REPORTDIR;
-our $buryChildren;
-our $timeoutChildren;
-our $totalExecuted;
-our $totalStarted;
-our $totalTimedOut;
-our $currentDirectory;
-our $testRoot;
-
-# Where do we run this script? What directory?
-$SEARCH_PATH=$ARGV[0];
-if(!$SEARCH_PATH)
-{
- print "Please specify the search directory! \n";
- exit(0);
-}
-
-# We have four options:
-# 'U': Unix
-# 'W': Windows
-# 'M': Mac
-# 'E': Embedded
-$EXEC_MODE=$ARGV[1];
-if($EXEC_MODE =~ /^U$/)
-{
- print "Using Unix execution mode\n";
- $EXE_PREFIX="./";
- $EXE_SUFFIX="";
-} elsif($EXEC_MODE =~ /^W$/)
-{
- print "Using Windows execution mode\n";
- $EXE_PREFIX="";
- $EXE_SUFFIX=".exe";
-} elsif($EXEC_MODE =~ /^M$/)
-{
- print "Using OSX execution mode\n";
- $EXE_PREFIX="/Contents/MacOS/";
- $EXE_SUFFIX=".app";
-} elsif($EXEC_MODE =~ /^E$/)
-{
- print "Using embedded execution mode\n";
- $EXE_PREFIX="./";
- $EXE_SUFFIX="";
-} else {
- print "Unknown execution mode: $EXEC_MODE \n";
- print "Use: 'U' (Unix), 'W' (Windows), 'M' (MacOSX)\n";
- exit(0);
-}
-# We get the current directory, we 'll need it afterwards
-$currentDirectory = getcwd();
-
-$testRoot = Cwd::abs_path($SEARCH_PATH);
-
-# We assume that by default goes to "reports" unless the user specifies it.
-$REPORTDIR = $ARGV[2];
-if(!$REPORTDIR)
-{
- $REPORTDIR = $testRoot."/reports";
- mkdir $REPORTDIR;
-} else {
- mkdir $REPORTDIR;
- $REPORTDIR = Cwd::abs_path($REPORTDIR);
-}
-
-# If given we use it, otherwise we default to 300 seconds.
-$TIMEOUT = $ARGV[3];
-if(!$TIMEOUT)
-{
- $TIMEOUT=300;
-}
-print "Timeout value: $TIMEOUT\n";
-
-# Initialize 'global' variables
-$buryChildren = 0;
-$timeoutChildren = 0;
-$totalExecuted = 0;
-$totalStarted = 0;
-$totalTimedOut = 0;
-
-# Install signal handlers and pray for the best
-$SIG{'CHLD'} = 'handleDeath';
-$SIG{'ALRM'} = 'handleTimeout';
-
-handleDir($testRoot);
-
-print " ** Statistics ** \n";
-print " Tests started: $totalStarted \n";
-print " Tests executed: $totalExecuted \n";
-print " Tests timed out: $totalTimedOut \n";
-
-sub handleDir {
-
- my ($dir) = @_;
- my $currentDir = getcwd();
-
- opendir(DIR, $dir);
- my @files = readdir(DIR);
- closedir DIR;
- my $file;
- foreach $file (@files) {
- #skip hidden files
- next if (substr($file,0,1) eq ".");
-
- if ( -d $dir."/".$file) {
- handleDir($dir."/".$file)
- } elsif ( $file =~ /^tst_/ and -x $dir."/".$file ) {
- chdir($dir) || die("Could not chdir to $dir");
- executeTestCurrentDir($file);
- chdir($currentDir);
- }
- }
-}
-
-sub executeTestCurrentDir {
- my ($command) = @_;
- print "Executing $command \n";
- my $myPid;
- $myPid = fork();
- if($myPid == 0)
- {
- my $realCommand;
- if($EXEC_MODE =~/^M$/)
- {
- $realCommand = "./".$command.$EXE_SUFFIX.$EXE_PREFIX.$command;
- } else {
- $realCommand = $EXE_PREFIX.$command.$EXE_SUFFIX;
- }
- my $outputRedirection = $REPORTDIR."/".$command.$EXE_SUFFIX.".xml";
-
- if($EXEC_MODE =~ /^E$/)
- {
- exec($realCommand, "-qws", "-xml", "-o", $outputRedirection);
- } else {
- exec($realCommand, "-xml", "-o", $outputRedirection);
- }
- exit(0);
- } elsif($myPid > 0 )
- {
- $totalStarted++;
- alarm($TIMEOUT);
- while(!$buryChildren && !$timeoutChildren)
- {
- sleep 10;
- }
- if($buryChildren)
- {
- my $value;
- $value = waitpid($myPid , 0);
- $buryChildren = 0;
- $totalExecuted++;
- } elsif($timeoutChildren)
- {
- kill 'INT', $myPid;
- $timeoutChildren = 0;
- $totalTimedOut++;
- } else {
- # What?? If we get here we need to abort, this is totally unexpected
- print "Wrong condition evaluated, aborting to avoid damages\n";
- exit(0);
- }
- # We need to handle children killed because of timeout
- if($buryChildren)
- {
- my $value;
- $value = waitpid($myPid , 0);
- $buryChildren = 0;
- }
- } else {
- print "Problems trying to execute $command";
- }
-
-}
-
-# This procedure takes care of handling dead children on due time
-sub handleDeath {
- $buryChildren = 1;
-}
-
-# This takes care of timeouts
-sub handleTimeout {
- $timeoutChildren = 1;
-}
-
diff --git a/tests/auto/widgets/kernel/qapplication/test/test.pro b/tests/auto/widgets/kernel/qapplication/test/test.pro
index 92409e4bfe..7f75501474 100644
--- a/tests/auto/widgets/kernel/qapplication/test/test.pro
+++ b/tests/auto/widgets/kernel/qapplication/test/test.pro
@@ -1,5 +1,5 @@
CONFIG += testcase
-CONFIG -= app_bundle debug_and_release_target
+CONFIG -= debug_and_release_target
QT += widgets widgets-private testlib
QT += core-private gui-private
diff --git a/tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro b/tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro
index 17fc1d28b5..50069b7e3e 100644
--- a/tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro
+++ b/tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro
@@ -1,5 +1,4 @@
CONFIG += testcase
-mac:CONFIG -= app_bundle
TARGET = tst_qwindowcontainer
QT += widgets testlib
SOURCES += tst_qwindowcontainer.cpp
diff --git a/tests/auto/widgets/widgets/qmenubar/BLACKLIST b/tests/auto/widgets/widgets/qmenubar/BLACKLIST
index 4f9508266c..d5c3bdb93f 100644
--- a/tests/auto/widgets/widgets/qmenubar/BLACKLIST
+++ b/tests/auto/widgets/widgets/qmenubar/BLACKLIST
@@ -5,3 +5,5 @@ ubuntu-14.04
redhatenterpriselinuxworkstation-6.6
[task256322_highlight]
osx
+[taskQTBUG46812_doNotLeaveMenubarHighlighted]
+osx
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index 3a4c4545df..52e631ef57 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -130,6 +130,7 @@ private slots:
void cornerWidgets_data();
void cornerWidgets();
void taskQTBUG53205_crashReparentNested();
+ void taskQTBUG46812_doNotLeaveMenubarHighlighted();
#ifdef Q_OS_MACOS
void taskQTBUG56275_reinsertMenuInParentlessQMenuBar();
#endif
@@ -227,9 +228,14 @@ TestMenu tst_QMenuBar::initSimpleMenuBar(QMenuBar *mb)
menu = mb->addMenu(QStringLiteral("accel1"));
action = menu->addAction(QStringLiteral("&Open...") );
action->setShortcut(Qt::Key_O);
+ result.actions << action;
+
+ action = menu->addAction(QStringLiteral("action"));
+ action->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Z));
+ result.actions << action;
+
result.menus << menu;
connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(onSimpleActivated(QAction*)));
- result.actions << action;
m_lastSimpleAcceleratorId = 0;
m_simpleActivatedCount = 0;
@@ -1518,6 +1524,38 @@ void tst_QMenuBar::slotForTaskQTBUG53205()
taskQTBUG53205MenuBar->setParent(parent);
}
+void tst_QMenuBar::taskQTBUG46812_doNotLeaveMenubarHighlighted()
+{
+ QMainWindow mainWindow;
+ QWidget *centralWidget = new QWidget;
+ centralWidget->setFocusPolicy(Qt::StrongFocus);
+ mainWindow.setCentralWidget(centralWidget);
+ initWindowWithSimpleMenuBar(mainWindow);
+
+ mainWindow.show();
+ QApplication::setActiveWindow(&mainWindow);
+ QVERIFY(QTest::qWaitForWindowActive(&mainWindow));
+
+ QVERIFY(!mainWindow.menuBar()->hasFocus());
+ QCOMPARE(m_simpleActivatedCount, 0);
+
+ QTest::keyPress(&mainWindow, Qt::Key_Alt, Qt::AltModifier);
+ QVERIFY(!mainWindow.menuBar()->hasFocus());
+ QCOMPARE(m_simpleActivatedCount, 0);
+
+ QTest::keyPress(&mainWindow, Qt::Key_Z, Qt::AltModifier);
+ QVERIFY(!mainWindow.menuBar()->hasFocus());
+ QCOMPARE(m_simpleActivatedCount, 2); // the action AND the menu will activate
+
+ QTest::keyRelease(&mainWindow, Qt::Key_Alt, Qt::NoModifier);
+ QVERIFY(!mainWindow.menuBar()->hasFocus());
+ QCOMPARE(m_simpleActivatedCount, 2);
+
+ QTest::keyRelease(&mainWindow, Qt::Key_Z, Qt::NoModifier);
+ QVERIFY(!mainWindow.menuBar()->hasFocus());
+ QCOMPARE(m_simpleActivatedCount, 2);
+}
+
#ifdef Q_OS_MACOS
extern bool tst_qmenubar_taskQTBUG56275(QMenuBar *);