summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-01-19 13:49:52 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-01-21 11:10:14 +0100
commitb6191b16d41459ed73cea738dfaf8e25e81ae22b (patch)
tree6ad0952af507bf1ab8df9612023d6e224db8d7e2 /tests
parentb2883a6acc7a8d8372a815cc91dd1a8449f25723 (diff)
parent9087df6bd2dd5198ccf101a237aadee331e51ec3 (diff)
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts: src/corelib/global/global.pri src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.h src/corelib/tools/qdatetime.cpp src/plugins/platforms/xcb/qxcbscreen.h src/plugins/platforms/xcb/qxcbwindow.h src/widgets/dialogs/qcolordialog.cpp src/widgets/dialogs/qcolordialog_p.h tools/configure/configureapp.cpp Change-Id: Ie9d6e9df13e570da0a90a67745a0d05f46c532af
Diffstat (limited to 'tests')
-rwxr-xr-xtests/auto/android/runtests_androiddeployqt.pl41
-rw-r--r--tests/auto/corelib/io/qdatastream/qdatastream.pro5
-rw-r--r--tests/auto/corelib/io/qdatastream/testdata.qrc5
-rw-r--r--tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp8
-rw-r--r--tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc6
-rw-r--r--tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro6
-rw-r--r--tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp45
-rw-r--r--tests/auto/corelib/kernel/qtranslator/android_testdata.qrc7
-rw-r--r--tests/auto/corelib/kernel/qtranslator/qtranslator.pro4
-rw-r--r--tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp20
-rw-r--r--tests/auto/corelib/tools/qbytearray/android_testdata.qrc5
-rw-r--r--tests/auto/corelib/tools/qbytearray/qbytearray.pro5
-rw-r--r--tests/auto/corelib/tools/qchar/qchar.pro5
-rw-r--r--tests/auto/corelib/tools/qchar/testdata.qrc5
-rw-r--r--tests/auto/corelib/tools/qcollator/tst_qcollator.cpp5
-rw-r--r--tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp9
-rw-r--r--tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro5
-rw-r--r--tests/auto/corelib/tools/qcryptographichash/testdata.qrc6
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp8
-rw-r--r--tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro5
-rw-r--r--tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc8
-rw-r--r--tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp60
-rw-r--r--tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp23
-rw-r--r--tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp10
-rw-r--r--tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp22
-rw-r--r--tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp23
-rw-r--r--tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp10
-rw-r--r--tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp22
-rw-r--r--tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp9
-rw-r--r--tests/auto/dbus/qdbusmarshall/common.h4
-rw-r--r--tests/auto/dbus/qdbusmarshall/qpong/qpong.cpp5
-rw-r--r--tests/auto/dbus/qdbusmarshall/test/test.pro9
-rw-r--r--tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp82
-rw-r--r--tests/auto/dbus/qdbustype/qdbustype.pro9
-rw-r--r--tests/auto/dbus/qdbustype/tst_qdbustype.cpp26
-rw-r--r--tests/auto/gui/image/qimage/images/jpeg_exif_orientation_value_6_motorola.jpgbin0 -> 911 bytes
-rw-r--r--tests/auto/gui/image/qimage/qimage.pro2
-rw-r--r--tests/auto/gui/image/qimage/qimage.qrc22
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp33
-rw-r--r--tests/auto/gui/image/qimagereader/android_testdata.qrc6
-rw-r--r--tests/auto/gui/image/qimagereader/qimagereader.pro4
-rw-r--r--tests/auto/gui/image/qimagewriter/qimagewriter.pro2
-rw-r--r--tests/auto/gui/image/qimagewriter/qimagewriter.qrc16
-rw-r--r--tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp30
-rw-r--r--tests/auto/gui/image/qpixmap/qpixmap.qrc28
-rw-r--r--tests/auto/gui/painting/qpainter/qpainter.pro5
-rw-r--r--tests/auto/gui/painting/qpainter/testdata.qrc186
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp18
-rw-r--r--tests/auto/gui/text/qrawfont/tst_qrawfont.cpp42
-rw-r--r--tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp62
-rw-r--r--tests/auto/network-settings.h1
-rw-r--r--tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp18
-rw-r--r--tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp6
-rw-r--r--tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp4
-rw-r--r--tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp12
-rw-r--r--tests/auto/sql/kernel/qsqldatabase/tst_databases.h2
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp102
-rwxr-xr-xtests/auto/test.pl41
-rw-r--r--tests/auto/testlib/selftests/datetime/tst_datetime.cpp2
-rw-r--r--tests/auto/testlib/selftests/expected_datetime.lightxml2
-rw-r--r--tests/auto/testlib/selftests/expected_datetime.txt2
-rw-r--r--tests/auto/testlib/selftests/expected_datetime.xml2
-rw-r--r--tests/auto/testlib/selftests/expected_datetime.xunitxml2
-rw-r--r--tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp4
-rw-r--r--tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp6
-rw-r--r--tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro6
-rw-r--r--tests/auto/widgets/itemviews/qdirmodel/testdata.qrc11
-rw-r--r--tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp34
-rw-r--r--tests/auto/widgets/kernel/qlayout/qlayout.pro5
-rw-r--r--tests/auto/widgets/kernel/qlayout/testdata.qrc5
-rw-r--r--tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp4
-rw-r--r--tests/auto/widgets/styles/qstyle/qstyle.pro5
-rw-r--r--tests/auto/widgets/styles/qstyle/testdata.qrc20
-rw-r--r--tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp33
-rw-r--r--tests/benchmarks/benchmarks.pro2
-rw-r--r--tests/benchmarks/dbus/qdbustype/main.cpp12
-rw-r--r--tests/benchmarks/dbus/qdbustype/qdbustype.pro11
-rw-r--r--tests/manual/diaglib/eventfilter.cpp74
-rw-r--r--tests/manual/qscreen/main.cpp5
-rw-r--r--tests/manual/qscreen/propertyfield.cpp7
-rw-r--r--tests/manual/qscreen/propertyfield.h1
-rw-r--r--tests/manual/windowflags/controllerwindow.cpp5
82 files changed, 1217 insertions, 212 deletions
diff --git a/tests/auto/android/runtests_androiddeployqt.pl b/tests/auto/android/runtests_androiddeployqt.pl
index fe67257b4b..8e9376da35 100755
--- a/tests/auto/android/runtests_androiddeployqt.pl
+++ b/tests/auto/android/runtests_androiddeployqt.pl
@@ -40,6 +40,8 @@ use File::Temp 'tempdir';
use File::Path 'remove_tree';
use Getopt::Long;
use Pod::Usage;
+use XML::Simple;
+use Term::ANSIColor;
### default options
my @stack = cwd;
@@ -53,6 +55,7 @@ my $testsubset = "";
my $man = 0;
my $help = 0;
my $make_clean = 0;
+my $stop_on_fail = 0;
my $time_out=400;
my $android_toolchain_version = "4.8";
my $host_arch = "linux-x86";
@@ -89,6 +92,7 @@ GetOptions('h|help' => \$help
, 'strip=s' => \$strip_tool
, 'readelf=s' => \$readelf_tool
, 'testcase=s' => \$testcase
+ , 'f|fail' => sub { $stop_on_fail = 1 }
, 'silent' => sub { $silent = 1 }
, 'ci' => sub { $ci_use = 1 }
, 'uninstall' => sub { $uninstall = 1 }
@@ -311,6 +315,37 @@ if ($output =~ m/.*\[ro.build.version.sdk\]: \[(\d+)\]/)
$sdk_api=9 if ($sdk_api>9);
}
+sub checkXMLOutput
+{
+ print color 'bold red';
+ my $fileName = shift;
+ my $XMLOutput = eval { XMLin($fileName, ForceArray => 1) };
+ if (!defined($XMLOutput)) {
+ print "Can't parse the $fileName file, probably the test crased.\n";
+ print color 'reset';
+ die "Stopping\n" if $stop_on_fail;
+ return;
+ }
+ my $testName = $XMLOutput->{name};
+ my $fail = 0;
+ while (my($node_key, $node_valule) = each (%{$XMLOutput})) {
+ next if $node_key ne "TestFunction";
+ while (my($function_key, $function_valule) = each (%{$node_valule})) {
+ while (my($test_key, $test_valule) = each (%{$function_valule})) {
+ next if $test_key ne "Incident";
+ for my $incident (@{$test_valule}) {
+ if ($incident->{type} ne "pass") {
+ print "test $testName::$function_key failed $incident->{file}:$incident->{line}\n";
+ $fail = 1;
+ }
+ }
+ }
+ }
+ }
+ print color 'reset';
+ die "Stopping\n" if $stop_on_fail and $fail;
+}
+
sub startTest
{
my $testName = shift;
@@ -352,6 +387,7 @@ sub startTest
sleep(3);
system("$adb_tool $device_serial pull /data/data/$packageName/output.xml $output_dir/$output_file.xml") if ($get_xml);
+
system("$adb_tool $device_serial pull /data/data/$packageName/output.txt $output_dir/$output_file.txt") if ($get_txt);
if ($get_txt){
print "Tesresults for $packageName:\n";
@@ -359,6 +395,8 @@ sub startTest
print_output("$output_dir/$output_file.txt", $packageName, $insignificance);
}
system("$adb_tool $device_serial uninstall $packageName") if ($uninstall);
+
+ checkXMLOutput("$output_dir/$output_file.xml") if ($get_xml);
return 1;
}
@@ -439,6 +477,9 @@ runtests.pl [options]
=head1 OPTIONS
=over 8
+=item B<-f --fail>
+
+Stop the script when test fails. Default 0
=item B<-s --serial = serial>
diff --git a/tests/auto/corelib/io/qdatastream/qdatastream.pro b/tests/auto/corelib/io/qdatastream/qdatastream.pro
index 25c29b83ee..9ab2b0948d 100644
--- a/tests/auto/corelib/io/qdatastream/qdatastream.pro
+++ b/tests/auto/corelib/io/qdatastream/qdatastream.pro
@@ -5,3 +5,8 @@ SOURCES = tst_qdatastream.cpp
TESTDATA += datastream.q42
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+android: !android-no-sdk {
+ RESOURCES += \
+ testdata.qrc
+}
diff --git a/tests/auto/corelib/io/qdatastream/testdata.qrc b/tests/auto/corelib/io/qdatastream/testdata.qrc
new file mode 100644
index 0000000000..fb63cb3438
--- /dev/null
+++ b/tests/auto/corelib/io/qdatastream/testdata.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>datastream.q42</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp
index e4b5d9ab8f..5d1a743dd9 100644
--- a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp
+++ b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp
@@ -50,10 +50,10 @@ int main(int argc, char *argv[])
option = QString::fromLocal8Bit(argv[2]);
if (option == "-crash") {
- QLockFile *lockFile = new QLockFile(lockName);
- lockFile->lock();
- // leak the lockFile on purpose, so that the lock remains!
- return 0;
+ QLockFile lockFile(lockName);
+ lockFile.lock();
+ // exit on purpose, so that the lock remains!
+ exit(0);
} else if (option == "-busy") {
QLockFile lockFile(lockName);
lockFile.lock();
diff --git a/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc b/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc
new file mode 100644
index 0000000000..f30290c262
--- /dev/null
+++ b/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/android_testdata">
+ <file>tst_qtemporaryfile.cpp</file>
+ <file>resources/test.txt</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro
index 8a91340e5f..c16a729ad0 100644
--- a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro
+++ b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro
@@ -5,4 +5,8 @@ QT = core testlib
SOURCES = tst_qtemporaryfile.cpp
TESTDATA += tst_qtemporaryfile.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
-RESOURCES += qtemporaryfile.qrc \ No newline at end of file
+RESOURCES += qtemporaryfile.qrc
+
+android:!android-no-sdk {
+ RESOURCES += android_testdata.qrc
+}
diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
index a08a0ae777..29a3c4e18a 100644
--- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -92,6 +92,24 @@ void tst_QTemporaryFile::initTestCase()
// For QTBUG_4796
QVERIFY(QDir("test-XXXXXX").exists() || QDir().mkdir("test-XXXXXX"));
QCoreApplication::setApplicationName("tst_qtemporaryfile");
+
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QString sourceDir(":/android_testdata/");
+ QDirIterator it(sourceDir, QDirIterator::Subdirectories);
+ while (it.hasNext()) {
+ it.next();
+
+ QFileInfo sourceFileInfo = it.fileInfo();
+ if (!sourceFileInfo.isDir()) {
+ QFileInfo destinationFileInfo(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1Char('/') + sourceFileInfo.filePath().mid(sourceDir.length()));
+
+ if (!destinationFileInfo.exists()) {
+ QVERIFY(QDir().mkpath(destinationFileInfo.path()));
+ QVERIFY(QFile::copy(sourceFileInfo.filePath(), destinationFileInfo.filePath()));
+ }
+ }
+ }
+#endif
}
void tst_QTemporaryFile::cleanupTestCase()
@@ -253,20 +271,21 @@ void tst_QTemporaryFile::autoRemove()
QVERIFY(!QFile::exists(fileName));
}
+struct ChdirOnReturn
+{
+ ChdirOnReturn(const QString& d) : dir(d) {}
+ ~ChdirOnReturn() {
+ QDir::setCurrent(dir);
+ }
+ QString dir;
+};
+
void tst_QTemporaryFile::nonWritableCurrentDir()
{
#ifdef Q_OS_UNIX
if (::geteuid() == 0)
QSKIP("not valid running this test as root");
- struct ChdirOnReturn
- {
- ChdirOnReturn(const QString& d) : dir(d) {}
- ~ChdirOnReturn() {
- QDir::setCurrent(dir);
- }
- QString dir;
- };
ChdirOnReturn cor(QDir::currentPath());
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
@@ -443,6 +462,12 @@ void tst_QTemporaryFile::rename()
void tst_QTemporaryFile::renameFdLeak()
{
#ifdef Q_OS_UNIX
+
+# if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ ChdirOnReturn cor(QDir::currentPath());
+ QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
+# endif
+
const QByteArray sourceFile = QFile::encodeName(QFINDTESTDATA(__FILE__));
QVERIFY(!sourceFile.isEmpty());
// Test this on Unix only
@@ -646,7 +671,11 @@ void tst_QTemporaryFile::createNativeFile_data()
QTest::addColumn<bool>("valid");
QTest::addColumn<QByteArray>("content");
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ const QString nativeFilePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/resources/test.txt");
+#else
const QString nativeFilePath = QFINDTESTDATA("resources/test.txt");
+#endif
QTest::newRow("nativeFile") << nativeFilePath << (qint64)-1 << false << QByteArray();
QTest::newRow("nativeFileWithPos") << nativeFilePath << (qint64)5 << false << QByteArray();
diff --git a/tests/auto/corelib/kernel/qtranslator/android_testdata.qrc b/tests/auto/corelib/kernel/qtranslator/android_testdata.qrc
new file mode 100644
index 0000000000..b33995ef21
--- /dev/null
+++ b/tests/auto/corelib/kernel/qtranslator/android_testdata.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/android_testdata">
+ <file>hellotr_la.qm</file>
+ <file>msgfmt_from_po.qm</file>
+ <file>dependencies_la.qm</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro
index 41c3dea924..e588f44370 100644
--- a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro
+++ b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro
@@ -4,4 +4,6 @@ QT = core testlib
SOURCES = tst_qtranslator.cpp
RESOURCES += qtranslator.qrc
-TESTDATA += hellotr_la.qm msgfmt_from_po.qm
+android:!android-no-sdk: RESOURCES += android_testdata.qrc
+else: TESTDATA += hellotr_la.qm msgfmt_from_po.qm
+
diff --git a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp
index 802d649496..077da6fce8 100644
--- a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp
+++ b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp
@@ -68,6 +68,26 @@ tst_QTranslator::tst_QTranslator()
void tst_QTranslator::initTestCase()
{
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QString sourceDir(":/android_testdata/");
+ QDirIterator it(sourceDir, QDirIterator::Subdirectories);
+ while (it.hasNext()) {
+ it.next();
+
+ QFileInfo sourceFileInfo = it.fileInfo();
+ if (!sourceFileInfo.isDir()) {
+ QFileInfo destinationFileInfo(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1Char('/') + sourceFileInfo.filePath().mid(sourceDir.length()));
+
+ if (!destinationFileInfo.exists()) {
+ QVERIFY(QDir().mkpath(destinationFileInfo.path()));
+ QVERIFY(QFile::copy(sourceFileInfo.filePath(), destinationFileInfo.filePath()));
+ }
+ }
+ }
+
+ QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
+#endif
+
// chdir into the directory containing our testdata,
// to make the code simpler (load testdata via relative paths)
QString testdata_dir = QFileInfo(QFINDTESTDATA("hellotr_la.qm")).absolutePath();
diff --git a/tests/auto/corelib/tools/qbytearray/android_testdata.qrc b/tests/auto/corelib/tools/qbytearray/android_testdata.qrc
new file mode 100644
index 0000000000..5d42f0f627
--- /dev/null
+++ b/tests/auto/corelib/tools/qbytearray/android_testdata.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>rfc3252.txt</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/corelib/tools/qbytearray/qbytearray.pro b/tests/auto/corelib/tools/qbytearray/qbytearray.pro
index 8d2efce0be..22104f817f 100644
--- a/tests/auto/corelib/tools/qbytearray/qbytearray.pro
+++ b/tests/auto/corelib/tools/qbytearray/qbytearray.pro
@@ -10,3 +10,8 @@ mac {
OBJECTIVE_SOURCES += tst_qbytearray_mac.mm
LIBS += -framework Foundation
}
+
+android: !android-no-sdk {
+ RESOURCES += \
+ android_testdata.qrc
+}
diff --git a/tests/auto/corelib/tools/qchar/qchar.pro b/tests/auto/corelib/tools/qchar/qchar.pro
index 0738abad3a..a72f16fa49 100644
--- a/tests/auto/corelib/tools/qchar/qchar.pro
+++ b/tests/auto/corelib/tools/qchar/qchar.pro
@@ -5,3 +5,8 @@ SOURCES = tst_qchar.cpp
TESTDATA += data/NormalizationTest.txt
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+android: !android-no-sdk {
+ RESOURCES += \
+ testdata.qrc
+}
diff --git a/tests/auto/corelib/tools/qchar/testdata.qrc b/tests/auto/corelib/tools/qchar/testdata.qrc
new file mode 100644
index 0000000000..7b3fb2461c
--- /dev/null
+++ b/tests/auto/corelib/tools/qchar/testdata.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>data/NormalizationTest.txt</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp
index f55e2eac42..96c7064d23 100644
--- a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp
+++ b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp
@@ -170,6 +170,11 @@ void tst_QCollator::compare()
QCollator collator(locale);
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ if (collator.locale() != QLocale())
+ QSKIP("Posix implementation of collation only supports default locale");
+#endif
+
if (numericMode)
collator.setNumericMode(true);
diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
index 7062d4cad9..ff9b63703c 100644
--- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
+++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
@@ -472,6 +472,10 @@ void tst_QCommandLineParser::testVersionOption()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE");
#endif
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QSKIP("Deploying executable applications to file system on Android not supported.");
+#endif
+
QCoreApplication app(empty_argc, empty_argv);
QProcess process;
process.start("testhelper/qcommandlineparser_test_helper", QStringList() << "0" << "--version");
@@ -537,6 +541,9 @@ void tst_QCommandLineParser::testHelpOption()
#ifdef Q_OS_WINCE
QSKIP("Reading and writing to a process is not supported on Qt/CE");
#endif
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QSKIP("Deploying executable applications to file system on Android not supported.");
+#endif
QFETCH(QCommandLineParser::SingleDashWordOptionMode, parsingMode);
QFETCH(QString, expectedHelpOutput);
@@ -581,6 +588,8 @@ void tst_QCommandLineParser::testQuoteEscaping()
{
#ifdef QT_NO_PROCESS
QSKIP("This test requires QProcess support");
+#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QSKIP("Deploying executable applications to file system on Android not supported.");
#else
QCoreApplication app(empty_argc, empty_argv);
QProcess process;
diff --git a/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro
index f7725ab188..941a068f8e 100644
--- a/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro
+++ b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro
@@ -5,3 +5,8 @@ SOURCES = tst_qcryptographichash.cpp
TESTDATA += data/*
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+android: !android-no-sdk {
+ RESOURCES += \
+ testdata.qrc
+}
diff --git a/tests/auto/corelib/tools/qcryptographichash/testdata.qrc b/tests/auto/corelib/tools/qcryptographichash/testdata.qrc
new file mode 100644
index 0000000000..8f7bcea63c
--- /dev/null
+++ b/tests/auto/corelib/tools/qcryptographichash/testdata.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>data/2c1517dad3678f03917f15849b052fd5.md5</file>
+ <file>data/d41d8cd98f00b204e9800998ecf8427e.md5</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index 8876bb3d34..e992c41bc1 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -1903,6 +1903,14 @@ void tst_QDateTime::fromStringDateFormat_data()
<< Qt::ISODate << QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34), Qt::UTC);
QTest::newRow("ISO +00:00") << QString::fromLatin1("1970-01-01T00:12:34+00:00")
<< Qt::ISODate << QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34), Qt::UTC);
+ QTest::newRow("ISO -03") << QString::fromLatin1("2014-12-15T12:37:09-03")
+ << Qt::ISODate << QDateTime(QDate(2014, 12, 15), QTime(15, 37, 9), Qt::UTC);
+ QTest::newRow("ISO zzz-03") << QString::fromLatin1("2014-12-15T12:37:09.745-03")
+ << Qt::ISODate << QDateTime(QDate(2014, 12, 15), QTime(15, 37, 9, 745), Qt::UTC);
+ QTest::newRow("ISO -3") << QString::fromLatin1("2014-12-15T12:37:09-3")
+ << Qt::ISODate << QDateTime(QDate(2014, 12, 15), QTime(15, 37, 9), Qt::UTC);
+ QTest::newRow("ISO zzz-3") << QString::fromLatin1("2014-12-15T12:37:09.745-3")
+ << Qt::ISODate << QDateTime(QDate(2014, 12, 15), QTime(15, 37, 9, 745), Qt::UTC);
// No time specified - defaults to Qt::LocalTime.
QTest::newRow("ISO data3") << QString::fromLatin1("2002-10-01")
<< Qt::ISODate << QDateTime(QDate(2002, 10, 1), QTime(0, 0, 0, 0), Qt::LocalTime);
diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro
index 498d8f9c40..29b9854ebb 100644
--- a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro
+++ b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro
@@ -5,3 +5,8 @@ SOURCES = tst_qtextboundaryfinder.cpp
TESTDATA += data
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+android: !android-no-sdk {
+ RESOURCES += \
+ testdata.qrc
+}
diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc b/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc
new file mode 100644
index 0000000000..0cc4ccaa57
--- /dev/null
+++ b/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc
@@ -0,0 +1,8 @@
+<RCC>
+ <qresource prefix="/">
+ <file>data/GraphemeBreakTest.txt</file>
+ <file>data/LineBreakTest.txt</file>
+ <file>data/SentenceBreakTest.txt</file>
+ <file>data/WordBreakTest.txt</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
index f97b8a4df8..0f7c42c122 100644
--- a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
+++ b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
@@ -109,14 +109,35 @@ void tst_QVersionNumber::singleInstanceData()
QTest::newRow("0.1.2alpha") << (QVector<int>() << 0 << 1 << 2) << QVersionNumber(0, 1, 2) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2alpha") << 5 << false;
QTest::newRow("0.1.2-alpha") << (QVector<int>() << 0 << 1 << 2) << QVersionNumber(0, 1, 2) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2-alpha") << 5 << false;
QTest::newRow("0.1.2.alpha") << (QVector<int>() << 0 << 1 << 2) << QVersionNumber(0, 1, 2) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2.alpha") << 5 << false;
+ QTest::newRow("0.1.2.3alpha") << (QVector<int>() << 0 << 1 << 2 << 3) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3) << QStringLiteral("0.1.2.3") << QStringLiteral("0.1.2.3alpha") << 7 << false;
+ QTest::newRow("0.1.2.3.alpha") << (QVector<int>() << 0 << 1 << 2 << 3) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3) << QStringLiteral("0.1.2.3") << QStringLiteral("0.1.2.3.alpha") << 7 << false;
QTest::newRow("0.1.2.3.4.alpha") << (QVector<int>() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4.alpha") << 9 << false;
QTest::newRow("0.1.2.3.4 alpha") << (QVector<int>() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4 alpha") << 9 << false;
QTest::newRow("0.1.2.3.4 alp ha") << (QVector<int>() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4 alp ha") << 9 << false;
QTest::newRow("0.1.2.3.4alp ha") << (QVector<int>() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4alp ha") << 9 << false;
QTest::newRow("0.1.2.3.4alpha ") << (QVector<int>() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4alpha ") << 9 << false;
+ QTest::newRow("0.1.2.3.4.5alpha ") << (QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5) << QStringLiteral("0.1.2.3.4.5") << QStringLiteral("0.1.2.3.4.5alpha ") << 11 << false;
+ QTest::newRow("0.1.2.3.4.5.6alpha ") << (QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6) << QStringLiteral("0.1.2.3.4.5.6") << QStringLiteral("0.1.2.3.4.5.6alpha ") << 13 << false;
+ QTest::newRow("0.1.2.3.4.5.6.7alpha ") << (QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7) << QStringLiteral("0.1.2.3.4.5.6.7") << QStringLiteral("0.1.2.3.4.5.6.7alpha ") << 15 << false;
+ QTest::newRow("0.1.2.3.4.5.6.7.8alpha ") << (QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8alpha ") << 17 << false;
+ QTest::newRow("0.1.2.3.4.5.6.7.8.alpha") << (QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8.alpha") << 17 << false;
+ QTest::newRow("0.1.2.3.4.5.6.7.8 alpha") << (QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8 alpha") << 17 << false;
+ QTest::newRow("0.1.2.3.4.5.6.7.8 alp ha") << (QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8 alp ha") << 17 << false;
+ QTest::newRow("0.1.2.3.4.5.6.7.8alp ha") << (QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8alp ha") << 17 << false;
QTest::newRow("10.09") << (QVector<int>() << 10 << 9) << QVersionNumber(QVector<int>() << 10 << 9) << QStringLiteral("10.9") << QStringLiteral("10.09") << 5 << false;
QTest::newRow("10.0x") << (QVector<int>() << 10 << 0) << QVersionNumber(QVector<int>() << 10 << 0) << QStringLiteral("10.0") << QStringLiteral("10.0x") << 4 << false;
QTest::newRow("10.0xTest") << (QVector<int>() << 10 << 0) << QVersionNumber(QVector<int>() << 10 << 0) << QStringLiteral("10.0") << QStringLiteral("10.0xTest") << 4 << false;
+ QTest::newRow("127.09") << (QVector<int>() << 127 << 9) << QVersionNumber(QVector<int>() << 127 << 9) << QStringLiteral("127.9") << QStringLiteral("127.09") << 6 << false;
+ QTest::newRow("127.0x") << (QVector<int>() << 127 << 0) << QVersionNumber(QVector<int>() << 127 << 0) << QStringLiteral("127.0") << QStringLiteral("127.0x") << 5 << false;
+ QTest::newRow("127.0xTest") << (QVector<int>() << 127 << 0) << QVersionNumber(QVector<int>() << 127 << 0) << QStringLiteral("127.0") << QStringLiteral("127.0xTest") << 5 << false;
+ QTest::newRow("128.09") << (QVector<int>() << 128 << 9) << QVersionNumber(QVector<int>() << 128 << 9) << QStringLiteral("128.9") << QStringLiteral("128.09") << 6 << false;
+ QTest::newRow("128.0x") << (QVector<int>() << 128 << 0) << QVersionNumber(QVector<int>() << 128 << 0) << QStringLiteral("128.0") << QStringLiteral("128.0x") << 5 << false;
+ QTest::newRow("128.0xTest") << (QVector<int>() << 128 << 0) << QVersionNumber(QVector<int>() << 128 << 0) << QStringLiteral("128.0") << QStringLiteral("128.0xTest") << 5 << false;
+}
+
+namespace UglyOperator {
+// ugh, but the alternative (operator <<) is even worse...
+static inline QVector<int> operator+(QVector<int> v, int i) { v.push_back(i); return qMove(v); }
}
void tst_QVersionNumber::comparisonData()
@@ -141,6 +162,7 @@ void tst_QVersionNumber::comparisonData()
QTest::newRow("1.0, 1.0") << QVersionNumber(1, 0) << QVersionNumber(1, 0) << true << false << false << true << false << true << 0 << true << QVersionNumber(1, 0);
QTest::newRow("1, 1.0") << QVersionNumber(1) << QVersionNumber(1, 0) << false << true << true << true << false << false << -1 << true << QVersionNumber(1);
QTest::newRow("1.0, 1") << QVersionNumber(1, 0) << QVersionNumber(1) << false << true << false << false << true << true << 1 << false << QVersionNumber(1);
+
QTest::newRow("0.1.2, 0.1") << QVersionNumber(0, 1, 2) << QVersionNumber(0, 1) << false << true << false << false << true << true << 2 << false << QVersionNumber(0, 1);
QTest::newRow("0.1, 0.1.2") << QVersionNumber(0, 1) << QVersionNumber(0, 1, 2) << false << true << true << true << false << false << -2 << true << QVersionNumber(0, 1);
QTest::newRow("0.1.2, 0.1.2") << QVersionNumber(0, 1, 2) << QVersionNumber(0, 1, 2) << true << false << false << true << false << true << 0 << true << QVersionNumber(0, 1, 2);
@@ -152,6 +174,44 @@ void tst_QVersionNumber::comparisonData()
QTest::newRow("0.-1, 0.1") << QVersionNumber(0, -1) << QVersionNumber(0, 1) << false << true << true << true << false << false << -2 << false << QVersionNumber(0);
QTest::newRow("0.-1, 0") << QVersionNumber(0, -1) << QVersionNumber(0) << false << true << true << true << false << false << -1 << false << QVersionNumber(0);
QTest::newRow("0, 0.-1") << QVersionNumber(0) << QVersionNumber(0, -1) << false << true << false << false << true << true << 1 << true << QVersionNumber(0);
+
+ QTest::newRow("0.127.2, 0.127") << QVersionNumber(0, 127, 2) << QVersionNumber(0, 127) << false << true << false << false << true << true << 2 << false << QVersionNumber(0, 127);
+ QTest::newRow("0.127, 0.127.2") << QVersionNumber(0, 127) << QVersionNumber(0, 127, 2) << false << true << true << true << false << false << -2 << true << QVersionNumber(0, 127);
+ QTest::newRow("0.127.2, 0.127.2") << QVersionNumber(0, 127, 2) << QVersionNumber(0, 127, 2) << true << false << false << true << false << true << 0 << true << QVersionNumber(0, 127, 2);
+ QTest::newRow("0.127.2, 127.127.2") << QVersionNumber(0, 127, 2) << QVersionNumber(127, 127, 2) << false << true << true << true << false << false << -127 << false << QVersionNumber();
+ QTest::newRow("127.127.2, 0.127.2") << QVersionNumber(127, 127, 2) << QVersionNumber(0, 127, 2) << false << true << false << false << true << true << 127 << false << QVersionNumber();
+ QTest::newRow("127, -128") << QVersionNumber(127) << QVersionNumber(-128) << false << true << false << false << true << true << 255 << false << QVersionNumber();
+ QTest::newRow("-128, 127") << QVersionNumber(-128) << QVersionNumber(127) << false << true << true << true << false << false << -255 << false << QVersionNumber();
+ QTest::newRow("0.127, 0.-128") << QVersionNumber(0, 127) << QVersionNumber(0, -128) << false << true << false << false << true << true << 255 << false << QVersionNumber(0);
+ QTest::newRow("0.-128, 0.127") << QVersionNumber(0, -128) << QVersionNumber(0, 127) << false << true << true << true << false << false << -255 << false << QVersionNumber(0);
+ QTest::newRow("0.-128, 0") << QVersionNumber(0, -128) << QVersionNumber(0) << false << true << true << true << false << false << -128 << false << QVersionNumber(0);
+ QTest::newRow("0, 0.-128") << QVersionNumber(0) << QVersionNumber(0, -128) << false << true << false << false << true << true << 128 << true << QVersionNumber(0);
+
+ QTest::newRow("0.128.2, 0.128") << QVersionNumber(0, 128, 2) << QVersionNumber(0, 128) << false << true << false << false << true << true << 2 << false << QVersionNumber(0, 128);
+ QTest::newRow("0.128, 0.128.2") << QVersionNumber(0, 128) << QVersionNumber(0, 128, 2) << false << true << true << true << false << false << -2 << true << QVersionNumber(0, 128);
+ QTest::newRow("0.128.2, 0.128.2") << QVersionNumber(0, 128, 2) << QVersionNumber(0, 128, 2) << true << false << false << true << false << true << 0 << true << QVersionNumber(0, 128, 2);
+ QTest::newRow("0.128.2, 128.128.2") << QVersionNumber(0, 128, 2) << QVersionNumber(128, 128, 2) << false << true << true << true << false << false << -128 << false << QVersionNumber();
+ QTest::newRow("128.128.2, 0.128.2") << QVersionNumber(128, 128, 2) << QVersionNumber(0, 128, 2) << false << true << false << false << true << true << 128 << false << QVersionNumber();
+ QTest::newRow("128, -129") << QVersionNumber(128) << QVersionNumber(-129) << false << true << false << false << true << true << 257 << false << QVersionNumber();
+ QTest::newRow("-129, 128") << QVersionNumber(-129) << QVersionNumber(128) << false << true << true << true << false << false << -257 << false << QVersionNumber();
+ QTest::newRow("0.128, 0.-129") << QVersionNumber(0, 128) << QVersionNumber(0, -129) << false << true << false << false << true << true << 257 << false << QVersionNumber(0);
+ QTest::newRow("0.-129, 0.128") << QVersionNumber(0, -129) << QVersionNumber(0, 128) << false << true << true << true << false << false << -257 << false << QVersionNumber(0);
+ QTest::newRow("0.-129, 0") << QVersionNumber(0, -129) << QVersionNumber(0) << false << true << true << true << false << false << -129 << false << QVersionNumber(0);
+ QTest::newRow("0, 0.-129") << QVersionNumber(0) << QVersionNumber(0, -129) << false << true << false << false << true << true << 129 << true << QVersionNumber(0);
+
+ const QVector<int> common = QVector<int>() << 0 << 1 << 2 << 3 << 4 << 5 << 6;
+ using namespace UglyOperator;
+ QTest::newRow("0.1.2.3.4.5.6.0.1.2, 0.1.2.3.4.5.6.0.1") << QVersionNumber(common + 0 + 1 + 2) << QVersionNumber(common + 0 + 1) << false << true << false << false << true << true << 2 << false << QVersionNumber(common + 0 + 1);
+ QTest::newRow("0.1.2.3.4.5.6.0.1, 0.1.2.3.4.5.6.0.1.2") << QVersionNumber(common + 0 + 1) << QVersionNumber(common + 0 + 1 + 2) << false << true << true << true << false << false << -2 << true << QVersionNumber(common + 0 + 1);
+ QTest::newRow("0.1.2.3.4.5.6.0.1.2, 0.1.2.3.4.5.6.0.1.2") << QVersionNumber(common + 0 + 1 + 2) << QVersionNumber(common + 0 + 1 + 2) << true << false << false << true << false << true << 0 << true << QVersionNumber(common + 0 + 1 + 2);
+ QTest::newRow("0.1.2.3.4.5.6.0.1.2, 0.1.2.3.4.5.6.1.1.2") << QVersionNumber(common + 0 + 1 + 2) << QVersionNumber(common + 1 + 1 + 2) << false << true << true << true << false << false << -1 << false << QVersionNumber(common);
+ QTest::newRow("0.1.2.3.4.5.6.1.1.2, 0.1.2.3.4.5.6.0.1.2") << QVersionNumber(common + 1 + 1 + 2) << QVersionNumber(common + 0 + 1 + 2) << false << true << false << false << true << true << 1 << false << QVersionNumber(common);
+ QTest::newRow("0.1.2.3.4.5.6.1, 0.1.2.3.4.5.6.-1") << QVersionNumber(common + 1) << QVersionNumber(common + -1) << false << true << false << false << true << true << 2 << false << QVersionNumber(common);
+ QTest::newRow("0.1.2.3.4.5.6.-1, 0.1.2.3.4.5.6.1") << QVersionNumber(common + -1) << QVersionNumber(common + 1) << false << true << true << true << false << false << -2 << false << QVersionNumber(common);
+ QTest::newRow("0.1.2.3.4.5.6.0.1, 0.1.2.3.4.5.6.0.-1") << QVersionNumber(common + 0 + 1) << QVersionNumber(common + 0 + -1) << false << true << false << false << true << true << 2 << false << QVersionNumber(common + 0);
+ QTest::newRow("0.1.2.3.4.5.6.0.-1, 0.1.2.3.4.5.6.0.1") << QVersionNumber(common + 0 + -1) << QVersionNumber(common + 0 + 1) << false << true << true << true << false << false << -2 << false << QVersionNumber(common + 0);
+ QTest::newRow("0.1.2.3.4.5.6.0.-1, 0.1.2.3.4.5.6.0") << QVersionNumber(common + 0 + -1) << QVersionNumber(common + 0) << false << true << true << true << false << false << -1 << false << QVersionNumber(common + 0);
+ QTest::newRow("0.1.2.3.4.5.6.0, 0.1.2.3.4.5.6.0.-1") << QVersionNumber(common + 0) << QVersionNumber(common + 0 + -1) << false << true << false << false << true << true << 1 << true << QVersionNumber(common + 0);
}
void tst_QVersionNumber::initTestCase()
diff --git a/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp b/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp
index c680d93dab..2f39857d2d 100644
--- a/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp
+++ b/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp
@@ -72,9 +72,17 @@ public slots:
return QDBusServer::address();
}
- bool isConnected() const
+ void waitForConnected()
{
- return m_conn.isConnected();
+ if (callPendingReply.type() != QDBusMessage::InvalidMessage) {
+ sendErrorReply(QDBusError::NotSupported, "One call already pending!");
+ return;
+ }
+ if (m_conn.isConnected())
+ return;
+ // not connected, we'll reply later
+ setDelayedReply(true);
+ callPendingReply = message();
}
Q_NOREPLY void requestSync(const QString &seq)
@@ -133,6 +141,11 @@ public slots:
valueSpy.clear();
}
+ void quit()
+ {
+ qApp->quit();
+ }
+
signals:
Q_SCRIPTABLE void syncReceived(const QString &sequence);
@@ -141,10 +154,16 @@ private slots:
{
m_conn = con;
con.registerObject(objectPath, this, QDBusConnection::ExportScriptableSignals);
+
+ if (callPendingReply.type() != QDBusMessage::InvalidMessage) {
+ QDBusConnection::sessionBus().send(callPendingReply.createReply());
+ callPendingReply = QDBusMessage();
+ }
}
private:
QDBusConnection m_conn;
+ QDBusMessage callPendingReply;
MyObject* obj;
};
diff --git a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
index 971c939aad..b7ecdef16e 100644
--- a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
+++ b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
@@ -496,6 +496,7 @@ void tst_QDBusAbstractAdaptor::initTestCase()
#else
# define EXE ""
#endif
+ proc.setProcessChannelMode(QProcess::ForwardedErrorChannel);
proc.start(QFINDTESTDATA("qmyserver/qmyserver" EXE));
QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString()));
QVERIFY(proc.waitForReadyRead());
@@ -513,16 +514,17 @@ void tst_QDBusAbstractAdaptor::initTestCase()
QDBusConnection peercon = QDBusConnection::connectToPeer(address, "peer");
QVERIFY(peercon.isConnected());
- QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "isConnected");
+ QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "waitForConnected");
QDBusMessage rpl2 = QDBusConnection::sessionBus().call(req2);
- QVERIFY(rpl2.type() == QDBusMessage::ReplyMessage);
- QVERIFY(rpl2.arguments().at(0).toBool());
+ QVERIFY2(rpl2.type() == QDBusMessage::ReplyMessage, rpl2.errorMessage().toLatin1());
}
void tst_QDBusAbstractAdaptor::cleanupTestCase()
{
+ QDBusMessage msg = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "quit");
+ QDBusConnection::sessionBus().call(msg);
+ proc.waitForFinished(200);
proc.close();
- proc.kill();
}
void tst_QDBusAbstractAdaptor::methodCalls_data()
diff --git a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp
index 49462d388c..e681d06102 100644
--- a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp
+++ b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp
@@ -59,9 +59,17 @@ public slots:
return QDBusServer::address();
}
- bool isConnected() const
+ void waitForConnected()
{
- return m_conn.isConnected();
+ if (callPendingReply.type() != QDBusMessage::InvalidMessage) {
+ sendErrorReply(QDBusError::NotSupported, "One call already pending!");
+ return;
+ }
+ if (m_conn.isConnected())
+ return;
+ // not connected, we'll reply later
+ setDelayedReply(true);
+ callPendingReply = message();
}
void reset()
@@ -87,16 +95,26 @@ public slots:
emit targetObj.complexSignal(reg);
}
+ void quit()
+ {
+ qApp->quit();
+ }
+
private slots:
void handleConnection(const QDBusConnection& con)
{
m_conn = con;
m_conn.registerObject("/", &targetObj, QDBusConnection::ExportScriptableContents);
+ if (callPendingReply.type() != QDBusMessage::InvalidMessage) {
+ QDBusConnection::sessionBus().send(callPendingReply.createReply());
+ callPendingReply = QDBusMessage();
+ }
}
private:
Interface targetObj;
QDBusConnection m_conn;
+ QDBusMessage callPendingReply;
};
int main(int argc, char *argv[])
diff --git a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp
index 0cb29d121b..0b33f9b1cf 100644
--- a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp
+++ b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp
@@ -236,6 +236,7 @@ void tst_QDBusAbstractInterface::initTestCase()
#else
# define EXE ""
#endif
+ proc.setProcessChannelMode(QProcess::ForwardedErrorChannel);
proc.start(QFINDTESTDATA("qpinger/qpinger" EXE));
QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString()));
QVERIFY(proc.waitForReadyRead());
@@ -252,19 +253,10 @@ void tst_QDBusAbstractInterface::initTestCase()
void tst_QDBusAbstractInterface::cleanupTestCase()
{
- // Kill peer, resetting the object exported by a separate process
-#ifdef Q_OS_WIN
- proc.kill(); // non-GUI processes don't respond to QProcess::terminate()
-#else
- proc.terminate();
-#endif
- QVERIFY(proc.waitForFinished() || proc.state() == QProcess::NotRunning);
-
- // Wait until the service is certainly not registered
- QDBusConnection con = QDBusConnection::sessionBus();
- if (con.isConnected()) {
- QTRY_VERIFY(!con.interface()->isServiceRegistered(serviceName));
- }
+ QDBusMessage msg = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "quit");
+ QDBusConnection::sessionBus().call(msg);
+ proc.waitForFinished(200);
+ proc.close();
}
void tst_QDBusAbstractInterface::init()
@@ -276,10 +268,9 @@ void tst_QDBusAbstractInterface::init()
QDBusConnection peercon = QDBusConnection::connectToPeer(peerAddress, "peer");
QVERIFY(peercon.isConnected());
- QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "isConnected");
+ QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "waitForConnected");
QDBusMessage rpl2 = con.call(req2);
- QVERIFY(rpl2.type() == QDBusMessage::ReplyMessage);
- QVERIFY(rpl2.arguments().at(0).toBool());
+ QVERIFY2(rpl2.type() == QDBusMessage::ReplyMessage, rpl2.errorMessage().toLatin1());
}
void tst_QDBusAbstractInterface::cleanup()
diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
index 7e6e742e28..70794a52f5 100644
--- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
+++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
@@ -246,7 +246,7 @@ void tst_QDBusConnection::connectToBus()
QDBusConnection con2("foo");
QVERIFY(!con2.isConnected());
- QVERIFY(!con2.lastError().isValid());
+ QVERIFY(con2.lastError().isValid());
con2 = con;
QVERIFY(con.isConnected());
@@ -274,7 +274,7 @@ void tst_QDBusConnection::connectToBus()
{
QDBusConnection con("bubu");
QVERIFY(!con.isConnected());
- QVERIFY(!con.lastError().isValid());
+ QVERIFY(con.lastError().isValid());
}
QByteArray address = qgetenv("DBUS_SESSION_BUS_ADDRESS");
@@ -294,6 +294,7 @@ void tst_QDBusConnection::connectToPeer()
"", "newconn");
QVERIFY(!con.isConnected());
QVERIFY(con.lastError().isValid());
+ QDBusConnection::disconnectFromPeer("newconn");
}
QDBusServer server;
@@ -303,6 +304,7 @@ void tst_QDBusConnection::connectToPeer()
"unix:abstract=/tmp/dbus-XXXXXXXXXX,guid=00000000000000000000000000000000", "newconn2");
QVERIFY(!con.isConnected());
QVERIFY(con.lastError().isValid());
+ QDBusConnection::disconnectFromPeer("newconn2");
}
{
@@ -314,7 +316,7 @@ void tst_QDBusConnection::connectToPeer()
QDBusConnection con2("foo");
QVERIFY(!con2.isConnected());
- QVERIFY(!con2.lastError().isValid());
+ QVERIFY(con2.lastError().isValid());
con2 = con;
QVERIFY(con.isConnected());
@@ -342,7 +344,7 @@ void tst_QDBusConnection::connectToPeer()
{
QDBusConnection con("bubu");
QVERIFY(!con.isConnected());
- QVERIFY(!con.lastError().isValid());
+ QVERIFY(con.lastError().isValid());
}
}
diff --git a/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp b/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp
index 7a22fe90ad..8da9068541 100644
--- a/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp
+++ b/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp
@@ -63,9 +63,17 @@ public slots:
return QDBusServer::address();
}
- bool isConnected() const
+ void waitForConnected()
{
- return m_conn.isConnected();
+ if (callPendingReply.type() != QDBusMessage::InvalidMessage) {
+ sendErrorReply(QDBusError::NotSupported, "One call already pending!");
+ return;
+ }
+ if (m_conn.isConnected())
+ return;
+ // not connected, we'll reply later
+ setDelayedReply(true);
+ callPendingReply = message();
}
void emitSignal(const QString &interface, const QString &name, const QString &arg)
@@ -88,7 +96,6 @@ public slots:
QVariantList callArgs()
{
- qDebug() << "callArgs" << MyObject::callArgs.count();
return MyObject::callArgs;
}
@@ -112,6 +119,10 @@ public slots:
return obj.m_complexProp;
}
+ void quit()
+ {
+ qApp->quit();
+ }
private slots:
void handleConnection(const QDBusConnection& con)
@@ -120,10 +131,15 @@ private slots:
m_conn.registerObject("/", &obj, QDBusConnection::ExportAllProperties
| QDBusConnection::ExportAllSlots
| QDBusConnection::ExportAllInvokables);
+ if (callPendingReply.type() != QDBusMessage::InvalidMessage) {
+ QDBusConnection::sessionBus().send(callPendingReply.createReply());
+ callPendingReply = QDBusMessage();
+ }
}
private:
QDBusConnection m_conn;
+ QDBusMessage callPendingReply;
MyObject obj;
};
diff --git a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp
index 04992c9f28..fce5868980 100644
--- a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp
+++ b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp
@@ -271,6 +271,7 @@ void tst_QDBusInterface::initTestCase()
#else
# define EXE ""
#endif
+ proc.setProcessChannelMode(QProcess::ForwardedErrorChannel);
proc.start(QFINDTESTDATA("qmyserver/qmyserver" EXE));
QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString()));
QVERIFY(proc.waitForReadyRead());
@@ -289,16 +290,18 @@ void tst_QDBusInterface::initTestCase()
QDBusConnection peercon = QDBusConnection::connectToPeer(address, "peer");
QVERIFY(peercon.isConnected());
- QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "isConnected");
+ QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "waitForConnected");
QDBusMessage rpl2 = con.call(req2);
QVERIFY(rpl2.type() == QDBusMessage::ReplyMessage);
- QVERIFY(rpl2.arguments().at(0).toBool());
+ QVERIFY2(rpl2.type() == QDBusMessage::ReplyMessage, rpl2.errorMessage().toLatin1());
}
void tst_QDBusInterface::cleanupTestCase()
{
+ QDBusMessage msg = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "quit");
+ QDBusConnection::sessionBus().call(msg);
+ proc.waitForFinished(200);
proc.close();
- proc.kill();
}
void tst_QDBusInterface::notConnected()
diff --git a/tests/auto/dbus/qdbusmarshall/common.h b/tests/auto/dbus/qdbusmarshall/common.h
index 76fe0e4bfb..323b54a137 100644
--- a/tests/auto/dbus/qdbusmarshall/common.h
+++ b/tests/auto/dbus/qdbusmarshall/common.h
@@ -30,7 +30,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <math.h> // isnan
+#include <qmath.h> // qIsNan
#include <qvariant.h>
#ifdef Q_OS_UNIX
@@ -320,7 +320,7 @@ bool compare(const QVariant &v1, const QVariant &v2);
bool compare(double d1, double d2)
{
- if (isnan(d1) && isnan(d2))
+ if (qIsNaN(d1) && qIsNaN(d2))
return true;
return d1 == d2;
}
diff --git a/tests/auto/dbus/qdbusmarshall/qpong/qpong.cpp b/tests/auto/dbus/qdbusmarshall/qpong/qpong.cpp
index bb8aab3d21..11cd4f05ce 100644
--- a/tests/auto/dbus/qdbusmarshall/qpong/qpong.cpp
+++ b/tests/auto/dbus/qdbusmarshall/qpong/qpong.cpp
@@ -49,6 +49,11 @@ public slots:
if (!QDBusConnection::sessionBus().send(msg.createReply(msg.arguments())))
exit(1);
}
+
+ void quit()
+ {
+ qApp->quit();
+ }
};
int main(int argc, char *argv[])
diff --git a/tests/auto/dbus/qdbusmarshall/test/test.pro b/tests/auto/dbus/qdbusmarshall/test/test.pro
index 658cc52fde..4999080453 100644
--- a/tests/auto/dbus/qdbusmarshall/test/test.pro
+++ b/tests/auto/dbus/qdbusmarshall/test/test.pro
@@ -5,8 +5,13 @@ DESTDIR = ./
QT = core-private dbus-private testlib
-LIBS += $$QT_LIBS_DBUS
-QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
+contains(QT_CONFIG, dbus-linked) {
+ DEFINES += QT_LINKED_LIBDBUS
+ LIBS += $$QT_LIBS_DBUS
+ QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
+} else {
+ SOURCES += ../../../../../src/dbus/qdbus_symbols.cpp
+}
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
macx:CONFIG += insignificant_test # QTBUG-37469
diff --git a/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp b/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp
index 4d12522a68..6507b34c97 100644
--- a/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp
+++ b/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp
@@ -37,7 +37,8 @@
#include "common.h"
#include <limits>
-#include <dbus/dbus.h>
+#include <QtDBus/private/qdbusutil_p.h>
+#include <QtDBus/private/qdbusconnection_p.h>
#define QT_LINKED_LIBDBUS
#include <QtDBus/private/qdbusutil_p.h>
@@ -136,6 +137,7 @@ void tst_QDBusMarshall::initTestCase()
#else
# define EXE ""
#endif
+ proc.setProcessChannelMode(QProcess::ForwardedErrorChannel);
proc.start(QFINDTESTDATA("qpong/qpong" EXE));
QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString()));
QVERIFY(proc.waitForReadyRead());
@@ -143,9 +145,10 @@ void tst_QDBusMarshall::initTestCase()
void tst_QDBusMarshall::cleanupTestCase()
{
- proc.close();
- proc.terminate();
+ QDBusMessage msg = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "quit");
+ QDBusConnection::sessionBus().call(msg);
proc.waitForFinished(200);
+ proc.close();
}
int tst_QDBusMarshall::fileDescriptorForTest()
@@ -1031,23 +1034,31 @@ struct DisconnectRawDBus {
{
if (!connection)
return;
- dbus_connection_close(connection);
- dbus_connection_unref(connection);
+ q_dbus_connection_close(connection);
+ q_dbus_connection_unref(connection);
+ }
+};
+struct UnrefDBusMessage
+{
+ static void cleanup(DBusMessage *type)
+ {
+ if (!type) return;
+ q_dbus_message_unref(type);
}
};
-template <typename T, void (*unref)(T *)> struct GenericUnref
+struct UnrefDBusPendingCall
{
- static void cleanup(T *type)
+ static void cleanup(DBusPendingCall *type)
{
if (!type) return;
- unref(type);
+ q_dbus_pending_call_unref(type);
}
};
// use these scoped types to avoid memory leaks if QVERIFY or QCOMPARE fails
typedef QScopedPointer<DBusConnection, DisconnectRawDBus> ScopedDBusConnection;
-typedef QScopedPointer<DBusMessage, GenericUnref<DBusMessage, dbus_message_unref> > ScopedDBusMessage;
-typedef QScopedPointer<DBusPendingCall, GenericUnref<DBusPendingCall, dbus_pending_call_unref> > ScopedDBusPendingCall;
+typedef QScopedPointer<DBusMessage, UnrefDBusMessage> ScopedDBusMessage;
+typedef QScopedPointer<DBusPendingCall, UnrefDBusPendingCall> ScopedDBusPendingCall;
template <typename T> struct SetResetValue
{
@@ -1072,12 +1083,12 @@ void tst_QDBusMarshall::receiveUnknownType()
// this needs to be implemented in raw
// open a new connection to the bus daemon
DBusError error;
- dbus_error_init(&error);
- ScopedDBusConnection rawcon(dbus_bus_get_private(DBUS_BUS_SESSION, &error));
+ q_dbus_error_init(&error);
+ ScopedDBusConnection rawcon(q_dbus_bus_get_private(DBUS_BUS_SESSION, &error));
QVERIFY2(rawcon.data(), error.name);
// check if this bus supports passing file descriptors
- if (!dbus_connection_can_send_type(rawcon.data(), DBUS_TYPE_UNIX_FD))
+ if (!q_dbus_connection_can_send_type(rawcon.data(), DBUS_TYPE_UNIX_FD))
QSKIP("Your session bus does not allow sending Unix file descriptors");
// make sure this QDBusConnection won't handle Unix file descriptors
@@ -1088,18 +1099,20 @@ void tst_QDBusMarshall::receiveUnknownType()
// create a call back to us containing a file descriptor
QDBusMessageSpy spy;
con.registerObject("/spyObject", &spy, QDBusConnection::ExportAllSlots);
- ScopedDBusMessage msg(dbus_message_new_method_call(con.baseService().toLatin1(), "/spyObject", NULL, "theSlot"));
+ ScopedDBusMessage msg(q_dbus_message_new_method_call(con.baseService().toLatin1(), "/spyObject", NULL, "theSlot"));
int fd = fileno(stdout);
- dbus_message_append_args(msg.data(), DBUS_TYPE_UNIX_FD, &fd, DBUS_TYPE_INVALID);
+ DBusMessageIter iter;
+ q_dbus_message_iter_init_append(msg.data(), &iter);
+ q_dbus_message_iter_append_basic(&iter, DBUS_TYPE_UNIX_FD, &fd);
// try to send to us
DBusPendingCall *pending_ptr;
- dbus_connection_send_with_reply(rawcon.data(), msg.data(), &pending_ptr, 1000);
+ q_dbus_connection_send_with_reply(rawcon.data(), msg.data(), &pending_ptr, 1000);
ScopedDBusPendingCall pending(pending_ptr);
// check that it got sent
- while (dbus_connection_dispatch(rawcon.data()) == DBUS_DISPATCH_DATA_REMAINS)
+ while (q_dbus_connection_dispatch(rawcon.data()) == DBUS_DISPATCH_DATA_REMAINS)
;
// now spin our event loop. We don't catch this call, so let's get the reply
@@ -1108,7 +1121,7 @@ void tst_QDBusMarshall::receiveUnknownType()
loop.exec();
// now try to receive the reply
- dbus_pending_call_block(pending.data());
+ q_dbus_pending_call_block(pending.data());
// check that the spy received what it was supposed to receive
QCOMPARE(spy.list.size(), 1);
@@ -1116,48 +1129,49 @@ void tst_QDBusMarshall::receiveUnknownType()
QFETCH(int, receivedTypeId);
QCOMPARE(spy.list.at(0).arguments().at(0).userType(), receivedTypeId);
- msg.reset(dbus_pending_call_steal_reply(pending.data()));
+ msg.reset(q_dbus_pending_call_steal_reply(pending.data()));
QVERIFY(msg);
- QCOMPARE(dbus_message_get_type(msg.data()), DBUS_MESSAGE_TYPE_METHOD_RETURN);
- QCOMPARE(dbus_message_get_signature(msg.data()), DBUS_TYPE_INT32_AS_STRING);
+ QCOMPARE(q_dbus_message_get_type(msg.data()), DBUS_MESSAGE_TYPE_METHOD_RETURN);
+ QCOMPARE(q_dbus_message_get_signature(msg.data()), DBUS_TYPE_INT32_AS_STRING);
int retval;
- QVERIFY(dbus_message_get_args(msg.data(), &error, DBUS_TYPE_INT32, &retval, DBUS_TYPE_INVALID));
+ QVERIFY(q_dbus_message_iter_init(msg.data(), &iter));
+ q_dbus_message_iter_get_basic(&iter, &retval);
QCOMPARE(retval, 42);
} else {
// create a signal that we'll emit
static const char signalName[] = "signalName";
static const char interfaceName[] = "local.interface.name";
- ScopedDBusMessage msg(dbus_message_new_signal("/", interfaceName, signalName));
- con.connect(dbus_bus_get_unique_name(rawcon.data()), QString(), interfaceName, signalName, &QTestEventLoop::instance(), SLOT(exitLoop()));
+ ScopedDBusMessage msg(q_dbus_message_new_signal("/", interfaceName, signalName));
+ con.connect(q_dbus_bus_get_unique_name(rawcon.data()), QString(), interfaceName, signalName, &QTestEventLoop::instance(), SLOT(exitLoop()));
QDBusMessageSpy spy;
- con.connect(dbus_bus_get_unique_name(rawcon.data()), QString(), interfaceName, signalName, &spy, SLOT(theSlot(QDBusMessage)));
+ con.connect(q_dbus_bus_get_unique_name(rawcon.data()), QString(), interfaceName, signalName, &spy, SLOT(theSlot(QDBusMessage)));
DBusMessageIter iter;
- dbus_message_iter_init_append(msg.data(), &iter);
+ q_dbus_message_iter_init_append(msg.data(), &iter);
int fd = fileno(stdout);
if (qstrcmp(QTest::currentDataTag(), "type-naked") == 0) {
// send naked
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_UNIX_FD, &fd);
+ q_dbus_message_iter_append_basic(&iter, DBUS_TYPE_UNIX_FD, &fd);
} else {
DBusMessageIter subiter;
if (qstrcmp(QTest::currentDataTag(), "type-variant") == 0)
- dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT, DBUS_TYPE_UNIX_FD_AS_STRING, &subiter);
+ q_dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT, DBUS_TYPE_UNIX_FD_AS_STRING, &subiter);
else if (qstrcmp(QTest::currentDataTag(), "type-array") == 0)
- dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_UNIX_FD_AS_STRING, &subiter);
+ q_dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_UNIX_FD_AS_STRING, &subiter);
else if (qstrcmp(QTest::currentDataTag(), "type-struct") == 0)
- dbus_message_iter_open_container(&iter, DBUS_TYPE_STRUCT, 0, &subiter);
- dbus_message_iter_append_basic(&subiter, DBUS_TYPE_UNIX_FD, &fd);
- dbus_message_iter_close_container(&iter, &subiter);
+ q_dbus_message_iter_open_container(&iter, DBUS_TYPE_STRUCT, 0, &subiter);
+ q_dbus_message_iter_append_basic(&subiter, DBUS_TYPE_UNIX_FD, &fd);
+ q_dbus_message_iter_close_container(&iter, &subiter);
}
// send it
- dbus_connection_send(rawcon.data(), msg.data(), 0);
+ q_dbus_connection_send(rawcon.data(), msg.data(), 0);
// check that it got sent
- while (dbus_connection_dispatch(rawcon.data()) == DBUS_DISPATCH_DATA_REMAINS)
+ while (q_dbus_connection_dispatch(rawcon.data()) == DBUS_DISPATCH_DATA_REMAINS)
;
// now let's see what happens
diff --git a/tests/auto/dbus/qdbustype/qdbustype.pro b/tests/auto/dbus/qdbustype/qdbustype.pro
index 1e6335aa3b..21df33d2c7 100644
--- a/tests/auto/dbus/qdbustype/qdbustype.pro
+++ b/tests/auto/dbus/qdbustype/qdbustype.pro
@@ -2,6 +2,11 @@ CONFIG += testcase
TARGET = tst_qdbustype
QT = core-private dbus-private testlib
SOURCES += tst_qdbustype.cpp
-QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
-LIBS_PRIVATE += $$QT_LIBS_DBUS
+contains(QT_CONFIG, dbus-linked) {
+ DEFINES += QT_LINKED_LIBDBUS
+ LIBS += $$QT_LIBS_DBUS
+ QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
+} else {
+ SOURCES += ../../../../src/dbus/qdbus_symbols.cpp
+}
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/dbus/qdbustype/tst_qdbustype.cpp b/tests/auto/dbus/qdbustype/tst_qdbustype.cpp
index 791a42dcc4..e674b6d686 100644
--- a/tests/auto/dbus/qdbustype/tst_qdbustype.cpp
+++ b/tests/auto/dbus/qdbustype/tst_qdbustype.cpp
@@ -35,8 +35,18 @@
#include <QtCore/QCoreApplication>
#include <QtDBus/private/qdbusutil_p.h>
-
-#include <dbus/dbus.h>
+#include <QtDBus/private/qdbus_symbols_p.h>
+
+DEFINEFUNC(dbus_bool_t, dbus_signature_validate, (const char *signature,
+ DBusError *error),
+ (signature, error), return)
+DEFINEFUNC(dbus_bool_t, dbus_signature_validate_single, (const char *signature,
+ DBusError *error),
+ (signature, error), return)
+DEFINEFUNC(dbus_bool_t, dbus_type_is_basic, (int typecode),
+ (typecode), return)
+DEFINEFUNC(dbus_bool_t, dbus_type_is_fixed, (int typecode),
+ (typecode), return)
class tst_QDBusType : public QObject
{
@@ -182,7 +192,7 @@ void tst_QDBusType::isValidFixedType()
int type = data.at(0).unicode();
if (isValid)
- QCOMPARE(bool(dbus_type_is_fixed(type)), result);
+ QCOMPARE(bool(q_dbus_type_is_fixed(type)), result);
QCOMPARE(QDBusUtil::isValidFixedType(type), result);
}
@@ -204,7 +214,7 @@ void tst_QDBusType::isValidBasicType()
int type = data.at(0).unicode();
if (isValid)
- QCOMPARE(bool(dbus_type_is_basic(type)), result);
+ QCOMPARE(bool(q_dbus_type_is_basic(type)), result);
QCOMPARE(QDBusUtil::isValidBasicType(type), result);
}
@@ -220,7 +230,7 @@ void tst_QDBusType::isValidSingleSignature()
QFETCH(QString, data);
QFETCH(bool, result);
- QCOMPARE(bool(dbus_signature_validate_single(data.toLatin1(), 0)), result);
+ QCOMPARE(bool(q_dbus_signature_validate_single(data.toLatin1(), 0)), result);
QCOMPARE(QDBusUtil::isValidSingleSignature(data), result);
}
@@ -236,11 +246,11 @@ void tst_QDBusType::isValidArray()
QFETCH(bool, result);
data.prepend("a");
- QCOMPARE(bool(dbus_signature_validate_single(data.toLatin1(), 0)), result);
+ QCOMPARE(bool(q_dbus_signature_validate_single(data.toLatin1(), 0)), result);
QCOMPARE(QDBusUtil::isValidSingleSignature(data), result);
data.prepend("a");
- QCOMPARE(bool(dbus_signature_validate_single(data.toLatin1(), 0)), result);
+ QCOMPARE(bool(q_dbus_signature_validate_single(data.toLatin1(), 0)), result);
QCOMPARE(QDBusUtil::isValidSingleSignature(data), result);
}
@@ -256,7 +266,7 @@ void tst_QDBusType::isValidSignature()
data.append(data);
if (data.at(0).unicode())
- QCOMPARE(bool(dbus_signature_validate(data.toLatin1(), 0)), result);
+ QCOMPARE(bool(q_dbus_signature_validate(data.toLatin1(), 0)), result);
QCOMPARE(QDBusUtil::isValidSignature(data), result);
}
diff --git a/tests/auto/gui/image/qimage/images/jpeg_exif_orientation_value_6_motorola.jpg b/tests/auto/gui/image/qimage/images/jpeg_exif_orientation_value_6_motorola.jpg
new file mode 100644
index 0000000000..0aa164b78b
--- /dev/null
+++ b/tests/auto/gui/image/qimage/images/jpeg_exif_orientation_value_6_motorola.jpg
Binary files differ
diff --git a/tests/auto/gui/image/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro
index 117e34653d..42280d3bd4 100644
--- a/tests/auto/gui/image/qimage/qimage.pro
+++ b/tests/auto/gui/image/qimage/qimage.pro
@@ -6,4 +6,6 @@ SOURCES += tst_qimage.cpp
QT += core-private gui-private testlib
contains(QT_CONFIG, c++11): CONFIG += c++11
+android:!android-no-sdk:RESOURCES+=qimage.qrc
+
TESTDATA += images/*
diff --git a/tests/auto/gui/image/qimage/qimage.qrc b/tests/auto/gui/image/qimage/qimage.qrc
new file mode 100644
index 0000000000..e5de27faf8
--- /dev/null
+++ b/tests/auto/gui/image/qimage/qimage.qrc
@@ -0,0 +1,22 @@
+<RCC>
+ <qresource prefix="/">
+ <file>images/image.bmp</file>
+ <file>images/image.gif</file>
+ <file>images/image.ico</file>
+ <file>images/image.jpg</file>
+ <file>images/image.pbm</file>
+ <file>images/image.pgm</file>
+ <file>images/image.png</file>
+ <file>images/image.ppm</file>
+ <file>images/image.xbm</file>
+ <file>images/image.xpm</file>
+ <file>images/jpeg_exif_orientation_value_1.jpg</file>
+ <file>images/jpeg_exif_orientation_value_2.jpg</file>
+ <file>images/jpeg_exif_orientation_value_3.jpg</file>
+ <file>images/jpeg_exif_orientation_value_4.jpg</file>
+ <file>images/jpeg_exif_orientation_value_5.jpg</file>
+ <file>images/jpeg_exif_orientation_value_6.jpg</file>
+ <file>images/jpeg_exif_orientation_value_7.jpg</file>
+ <file>images/jpeg_exif_orientation_value_8.jpg</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 676f8084a1..c61f5f38ca 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -173,6 +173,7 @@ private slots:
void invertPixelsRGB_data();
void invertPixelsRGB();
+ void exifOrientation_data();
void exifOrientation();
void cleanupFunctions();
@@ -2641,20 +2642,34 @@ void tst_QImage::invertPixelsRGB()
QCOMPARE(qBlue(pixel) >> 4, (255 - 96) >> 4);
}
+void tst_QImage::exifOrientation_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::newRow("Orientation 1, Intel format") << m_prefix + "jpeg_exif_orientation_value_1.jpg";
+ QTest::newRow("Orientation 2, Intel format") << m_prefix + "jpeg_exif_orientation_value_2.jpg";
+ QTest::newRow("Orientation 3, Intel format") << m_prefix + "jpeg_exif_orientation_value_3.jpg";
+ QTest::newRow("Orientation 4, Intel format") << m_prefix + "jpeg_exif_orientation_value_4.jpg";
+ QTest::newRow("Orientation 5, Intel format") << m_prefix + "jpeg_exif_orientation_value_5.jpg";
+ QTest::newRow("Orientation 6, Intel format") << m_prefix + "jpeg_exif_orientation_value_6.jpg";
+ QTest::newRow("Orientation 6, Motorola format") << m_prefix + "jpeg_exif_orientation_value_6_motorola.jpg";
+ QTest::newRow("Orientation 7, Intel format") << m_prefix + "jpeg_exif_orientation_value_7.jpg";
+ QTest::newRow("Orientation 8, Intel format") << m_prefix + "jpeg_exif_orientation_value_8.jpg";
+}
+
void tst_QImage::exifOrientation()
{
- for (unsigned int i = 1; i <= 8; ++i) {
- QImage img;
- QRgb px;
+ QFETCH(QString, fileName);
- QVERIFY(img.load(m_prefix + QString::fromLatin1("jpeg_exif_orientation_value_%1.jpg").arg(i)));
+ QImage img;
+ QRgb px;
- px = img.pixel(0, 0);
- QVERIFY(qRed(px) > 250 && qGreen(px) < 5 && qBlue(px) < 5);
+ QVERIFY(img.load(fileName));
- px = img.pixel(img.width() - 1, 0);
- QVERIFY(qRed(px) < 5 && qGreen(px) < 5 && qBlue(px) > 250);
- }
+ px = img.pixel(0, 0);
+ QVERIFY(qRed(px) > 250 && qGreen(px) < 5 && qBlue(px) < 5);
+
+ px = img.pixel(img.width() - 1, 0);
+ QVERIFY(qRed(px) < 5 && qGreen(px) < 5 && qBlue(px) > 250);
}
static void cleanupFunction(void* info)
diff --git a/tests/auto/gui/image/qimagereader/android_testdata.qrc b/tests/auto/gui/image/qimagereader/android_testdata.qrc
new file mode 100644
index 0000000000..bba32781fa
--- /dev/null
+++ b/tests/auto/gui/image/qimagereader/android_testdata.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>images/trans.gif</file>
+ <file>images/kollada-noext</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/gui/image/qimagereader/qimagereader.pro b/tests/auto/gui/image/qimagereader/qimagereader.pro
index 7686643b3a..76fb4d8bfc 100644
--- a/tests/auto/gui/image/qimagereader/qimagereader.pro
+++ b/tests/auto/gui/image/qimagereader/qimagereader.pro
@@ -5,6 +5,10 @@ MOC_DIR=tmp
QT += core-private gui-private network testlib
RESOURCES += qimagereader.qrc
+android: !android-no-sdk {
+ RESOURCES += android_testdata.qrc
+}
+
win32-msvc:QMAKE_CXXFLAGS -= -Zm200
win32-msvc:QMAKE_CXXFLAGS += -Zm800
win32-msvc.net:QMAKE_CXXFLAGS -= -Zm300
diff --git a/tests/auto/gui/image/qimagewriter/qimagewriter.pro b/tests/auto/gui/image/qimagewriter/qimagewriter.pro
index f77ff0659b..ce6707ec92 100644
--- a/tests/auto/gui/image/qimagewriter/qimagewriter.pro
+++ b/tests/auto/gui/image/qimagewriter/qimagewriter.pro
@@ -5,5 +5,5 @@ SOURCES += tst_qimagewriter.cpp
MOC_DIR=tmp
win32-msvc:QMAKE_CXXFLAGS -= -Zm200
win32-msvc:QMAKE_CXXFLAGS += -Zm800
-
+android:!android-no-sdk:RESOURCES+= qimagewriter.qrc
TESTDATA += images/*
diff --git a/tests/auto/gui/image/qimagewriter/qimagewriter.qrc b/tests/auto/gui/image/qimagewriter/qimagewriter.qrc
new file mode 100644
index 0000000000..29b036e303
--- /dev/null
+++ b/tests/auto/gui/image/qimagewriter/qimagewriter.qrc
@@ -0,0 +1,16 @@
+<RCC>
+ <qresource prefix="/">
+ <file>images/beavis.jpg</file>
+ <file>images/colorful.bmp</file>
+ <file>images/earth.gif</file>
+ <file>images/font.bmp</file>
+ <file>images/gnus.xbm</file>
+ <file>images/kollada.png</file>
+ <file>images/marble.xpm</file>
+ <file>images/ship63.pbm</file>
+ <file>images/teapot.ppm</file>
+ <file>images/trolltech.gif</file>
+ <file>images/YCbCr_cmyk.jpg</file>
+ <file>images/YCbCr_rgb.jpg</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
index 7e826310a1..f1045a8cf7 100644
--- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
+++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
@@ -90,6 +90,7 @@ private slots:
void saveToTemporaryFile();
private:
QString prefix;
+ QString writePrefix;
};
// helper to skip an autotest when the given image format is not supported
@@ -114,6 +115,11 @@ void tst_QImageWriter::initTestCase()
prefix = QFINDTESTDATA("images/");
if (prefix.isEmpty())
QFAIL("Can't find images directory!");
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ writePrefix = QDir::homePath();
+#else
+ writePrefix = prefix;
+#endif
}
// Testing get/set functions
@@ -212,7 +218,7 @@ void tst_QImageWriter::writeImage()
QVERIFY2(!image.isNull(), qPrintable(reader.errorString()));
}
{
- QImageWriter writer(prefix + "gen-" + fileName, format);
+ QImageWriter writer(writePrefix + "gen-" + fileName, format);
QVERIFY(writer.write(image));
}
@@ -224,11 +230,11 @@ void tst_QImageWriter::writeImage()
#endif
if (!skip) {
// Shouldn't be able to write to read-only file
- QFile sourceFile(prefix + "gen-" + fileName);
+ QFile sourceFile(writePrefix + "gen-" + fileName);
QFile::Permissions permissions = sourceFile.permissions();
QVERIFY(sourceFile.setPermissions(QFile::ReadOwner | QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther));
- QImageWriter writer(prefix + "gen-" + fileName, format);
+ QImageWriter writer(writePrefix + "gen-" + fileName, format);
QVERIFY(!writer.write(image));
QVERIFY(sourceFile.setPermissions(permissions));
@@ -237,7 +243,7 @@ void tst_QImageWriter::writeImage()
QImage image2;
{
- QImageReader reader(prefix + "gen-" + fileName);
+ QImageReader reader(writePrefix + "gen-" + fileName);
image2 = reader.read();
QVERIFY(!image2.isNull());
}
@@ -456,7 +462,7 @@ void tst_QImageWriter::supportsOption()
<< QImageIOHandler::Animation
<< QImageIOHandler::BackgroundColor;
- QImageWriter writer(prefix + fileName);
+ QImageWriter writer(writePrefix + fileName);
for (int i = 0; i < options.size(); ++i) {
QVERIFY(writer.supportsOption(QImageIOHandler::ImageOption(options.at(i))));
allOptions.remove(QImageIOHandler::ImageOption(options.at(i)));
@@ -472,13 +478,13 @@ void tst_QImageWriter::saveWithNoFormat_data()
QTest::addColumn<QByteArray>("format");
QTest::addColumn<QImageWriter::ImageWriterError>("error");
- QTest::newRow("garble") << prefix + QString("gen-out.garble") << QByteArray("jpeg") << QImageWriter::UnsupportedFormatError;
- QTest::newRow("bmp") << prefix + QString("gen-out.bmp") << QByteArray("bmp") << QImageWriter::ImageWriterError(0);
- QTest::newRow("xbm") << prefix + QString("gen-out.xbm") << QByteArray("xbm") << QImageWriter::ImageWriterError(0);
- QTest::newRow("xpm") << prefix + QString("gen-out.xpm") << QByteArray("xpm") << QImageWriter::ImageWriterError(0);
- QTest::newRow("png") << prefix + QString("gen-out.png") << QByteArray("png") << QImageWriter::ImageWriterError(0);
- QTest::newRow("ppm") << prefix + QString("gen-out.ppm") << QByteArray("ppm") << QImageWriter::ImageWriterError(0);
- QTest::newRow("pbm") << prefix + QString("gen-out.pbm") << QByteArray("pbm") << QImageWriter::ImageWriterError(0);
+ QTest::newRow("garble") << writePrefix + QString("gen-out.garble") << QByteArray("jpeg") << QImageWriter::UnsupportedFormatError;
+ QTest::newRow("bmp") << writePrefix + QString("gen-out.bmp") << QByteArray("bmp") << QImageWriter::ImageWriterError(0);
+ QTest::newRow("xbm") << writePrefix + QString("gen-out.xbm") << QByteArray("xbm") << QImageWriter::ImageWriterError(0);
+ QTest::newRow("xpm") << writePrefix + QString("gen-out.xpm") << QByteArray("xpm") << QImageWriter::ImageWriterError(0);
+ QTest::newRow("png") << writePrefix + QString("gen-out.png") << QByteArray("png") << QImageWriter::ImageWriterError(0);
+ QTest::newRow("ppm") << writePrefix + QString("gen-out.ppm") << QByteArray("ppm") << QImageWriter::ImageWriterError(0);
+ QTest::newRow("pbm") << writePrefix + QString("gen-out.pbm") << QByteArray("pbm") << QImageWriter::ImageWriterError(0);
}
void tst_QImageWriter::saveWithNoFormat()
diff --git a/tests/auto/gui/image/qpixmap/qpixmap.qrc b/tests/auto/gui/image/qpixmap/qpixmap.qrc
index 99fde61a29..3965622dba 100644
--- a/tests/auto/gui/image/qpixmap/qpixmap.qrc
+++ b/tests/auto/gui/image/qpixmap/qpixmap.qrc
@@ -1,5 +1,27 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
+<RCC>
+ <qresource>
+ <file>loadFromData/designer_argb32.png</file>
+ <file>loadFromData/designer_indexed8_no_alpha_animated.gif</file>
+ <file>loadFromData/designer_indexed8_no_alpha.gif</file>
+ <file>loadFromData/designer_indexed8_no_alpha.png</file>
+ <file>loadFromData/designer_indexed8_with_alpha_animated.gif</file>
+ <file>loadFromData/designer_indexed8_with_alpha.gif</file>
+ <file>loadFromData/designer_indexed8_with_alpha.png</file>
+ <file>loadFromData/designer_rgb32.jpg</file>
+ <file>loadFromData/designer_rgb32.png</file>
+ <file>convertFromImage/task31722_1/img1.png</file>
+ <file>convertFromImage/task31722_1/img2.png</file>
+ <file>convertFromToHICON/icon_8bpp_16x16.png</file>
+ <file>convertFromToHICON/icon_8bpp_32x32.png</file>
+ <file>convertFromToHICON/icon_8bpp_48x48.png</file>
+ <file>convertFromToHICON/icon_8bpp.ico</file>
+ <file>convertFromToHICON/icon_32bpp_16x16.png</file>
+ <file>convertFromToHICON/icon_32bpp_32x32.png</file>
+ <file>convertFromToHICON/icon_32bpp_48x48.png</file>
+ <file>convertFromToHICON/icon_32bpp_256x256.png</file>
+ <file>convertFromToHICON/icon_32bpp.ico</file>
+ <file>convertFromImage/task31722_0/img1.png</file>
+ <file>convertFromImage/task31722_0/img2.png</file>
<file>images/designer.png</file>
<file>images/dx_0_dy_0_50_50_100_100.png</file>
<file>images/dx_0_dy_0_null.png</file>
@@ -25,5 +47,5 @@
<file>images/dx_-128_dy_-128_x_y_w_h.png</file>
<file>images/dx_128_dy_128_x_y_w_h.png</file>
<file>images/dx_1_dy_0_null.png</file>
-</qresource>
+ </qresource>
</RCC>
diff --git a/tests/auto/gui/painting/qpainter/qpainter.pro b/tests/auto/gui/painting/qpainter/qpainter.pro
index 752f9be1f4..7e9d438e1b 100644
--- a/tests/auto/gui/painting/qpainter/qpainter.pro
+++ b/tests/auto/gui/painting/qpainter/qpainter.pro
@@ -10,3 +10,8 @@ SOURCES += tst_qpainter.cpp
TESTDATA += drawEllipse/* drawLine_rop_bitmap/* drawPixmap_rop/* drawPixmap_rop_bitmap/* \
task217400.png
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+android: !android-no-sdk {
+ RESOURCES += \
+ testdata.qrc
+}
diff --git a/tests/auto/gui/painting/qpainter/testdata.qrc b/tests/auto/gui/painting/qpainter/testdata.qrc
new file mode 100644
index 0000000000..a7b8c222e5
--- /dev/null
+++ b/tests/auto/gui/painting/qpainter/testdata.qrc
@@ -0,0 +1,186 @@
+<RCC>
+ <qresource prefix="/">
+ <file>task217400.png</file>
+ <file>drawEllipse/10x10SizeAt0x0.png</file>
+ <file>drawEllipse/10x10SizeAt100x100.png</file>
+ <file>drawEllipse/10x10SizeAt200x200.png</file>
+ <file>drawEllipse/13x100SizeAt0x0.png</file>
+ <file>drawEllipse/13x100SizeAt100x100.png</file>
+ <file>drawEllipse/13x100SizeAt200x200.png</file>
+ <file>drawEllipse/200x200SizeAt0x0.png</file>
+ <file>drawEllipse/200x200SizeAt100x100.png</file>
+ <file>drawEllipse/200x200SizeAt200x200.png</file>
+ <file>drawLine_rop_bitmap/dst.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_AndNotROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_AndROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_ClearROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_CopyROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_NandROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_NopROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_NorROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_NotAndROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_NotCopyROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_NotOrROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_NotROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_NotXorROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_OrNotROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_OrROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_SetROP.xbm</file>
+ <file>drawLine_rop_bitmap/res/res_XorROP.xbm</file>
+ <file>drawPixmap_rop/dst1.png</file>
+ <file>drawPixmap_rop/dst2.png</file>
+ <file>drawPixmap_rop/dst3.png</file>
+ <file>drawPixmap_rop/src1.xbm</file>
+ <file>drawPixmap_rop/src2-mask.xbm</file>
+ <file>drawPixmap_rop/src2.xbm</file>
+ <file>drawPixmap_rop/src3.xbm</file>
+ <file>drawPixmap_rop/res/res_AndNotROP0.png</file>
+ <file>drawPixmap_rop/res/res_AndNotROP1.png</file>
+ <file>drawPixmap_rop/res/res_AndNotROP2.png</file>
+ <file>drawPixmap_rop/res/res_AndNotROP3.png</file>
+ <file>drawPixmap_rop/res/res_AndNotROP4.png</file>
+ <file>drawPixmap_rop/res/res_AndNotROP5.png</file>
+ <file>drawPixmap_rop/res/res_AndNotROP6.png</file>
+ <file>drawPixmap_rop/res/res_AndNotROP7.png</file>
+ <file>drawPixmap_rop/res/res_AndROP0.png</file>
+ <file>drawPixmap_rop/res/res_AndROP1.png</file>
+ <file>drawPixmap_rop/res/res_AndROP2.png</file>
+ <file>drawPixmap_rop/res/res_AndROP3.png</file>
+ <file>drawPixmap_rop/res/res_AndROP4.png</file>
+ <file>drawPixmap_rop/res/res_AndROP5.png</file>
+ <file>drawPixmap_rop/res/res_AndROP6.png</file>
+ <file>drawPixmap_rop/res/res_AndROP7.png</file>
+ <file>drawPixmap_rop/res/res_ClearROP0.png</file>
+ <file>drawPixmap_rop/res/res_ClearROP1.png</file>
+ <file>drawPixmap_rop/res/res_ClearROP2.png</file>
+ <file>drawPixmap_rop/res/res_ClearROP3.png</file>
+ <file>drawPixmap_rop/res/res_ClearROP4.png</file>
+ <file>drawPixmap_rop/res/res_ClearROP5.png</file>
+ <file>drawPixmap_rop/res/res_ClearROP6.png</file>
+ <file>drawPixmap_rop/res/res_ClearROP7.png</file>
+ <file>drawPixmap_rop/res/res_CopyROP0.png</file>
+ <file>drawPixmap_rop/res/res_CopyROP1.png</file>
+ <file>drawPixmap_rop/res/res_CopyROP2.png</file>
+ <file>drawPixmap_rop/res/res_CopyROP3.png</file>
+ <file>drawPixmap_rop/res/res_CopyROP4.png</file>
+ <file>drawPixmap_rop/res/res_CopyROP5.png</file>
+ <file>drawPixmap_rop/res/res_CopyROP6.png</file>
+ <file>drawPixmap_rop/res/res_CopyROP7.png</file>
+ <file>drawPixmap_rop/res/res_NandROP0.png</file>
+ <file>drawPixmap_rop/res/res_NandROP1.png</file>
+ <file>drawPixmap_rop/res/res_NandROP2.png</file>
+ <file>drawPixmap_rop/res/res_NandROP3.png</file>
+ <file>drawPixmap_rop/res/res_NandROP4.png</file>
+ <file>drawPixmap_rop/res/res_NandROP5.png</file>
+ <file>drawPixmap_rop/res/res_NandROP6.png</file>
+ <file>drawPixmap_rop/res/res_NandROP7.png</file>
+ <file>drawPixmap_rop/res/res_NopROP0.png</file>
+ <file>drawPixmap_rop/res/res_NopROP1.png</file>
+ <file>drawPixmap_rop/res/res_NopROP2.png</file>
+ <file>drawPixmap_rop/res/res_NopROP3.png</file>
+ <file>drawPixmap_rop/res/res_NopROP4.png</file>
+ <file>drawPixmap_rop/res/res_NopROP5.png</file>
+ <file>drawPixmap_rop/res/res_NopROP6.png</file>
+ <file>drawPixmap_rop/res/res_NopROP7.png</file>
+ <file>drawPixmap_rop/res/res_NorROP0.png</file>
+ <file>drawPixmap_rop/res/res_NorROP1.png</file>
+ <file>drawPixmap_rop/res/res_NorROP2.png</file>
+ <file>drawPixmap_rop/res/res_NorROP3.png</file>
+ <file>drawPixmap_rop/res/res_NorROP4.png</file>
+ <file>drawPixmap_rop/res/res_NorROP5.png</file>
+ <file>drawPixmap_rop/res/res_NorROP6.png</file>
+ <file>drawPixmap_rop/res/res_NorROP7.png</file>
+ <file>drawPixmap_rop/res/res_NotAndROP0.png</file>
+ <file>drawPixmap_rop/res/res_NotAndROP1.png</file>
+ <file>drawPixmap_rop/res/res_NotAndROP2.png</file>
+ <file>drawPixmap_rop/res/res_NotAndROP3.png</file>
+ <file>drawPixmap_rop/res/res_NotAndROP4.png</file>
+ <file>drawPixmap_rop/res/res_NotAndROP5.png</file>
+ <file>drawPixmap_rop/res/res_NotAndROP6.png</file>
+ <file>drawPixmap_rop/res/res_NotAndROP7.png</file>
+ <file>drawPixmap_rop/res/res_NotCopyROP0.png</file>
+ <file>drawPixmap_rop/res/res_NotCopyROP1.png</file>
+ <file>drawPixmap_rop/res/res_NotCopyROP2.png</file>
+ <file>drawPixmap_rop/res/res_NotCopyROP3.png</file>
+ <file>drawPixmap_rop/res/res_NotCopyROP4.png</file>
+ <file>drawPixmap_rop/res/res_NotCopyROP5.png</file>
+ <file>drawPixmap_rop/res/res_NotCopyROP6.png</file>
+ <file>drawPixmap_rop/res/res_NotCopyROP7.png</file>
+ <file>drawPixmap_rop/res/res_NotOrROP0.png</file>
+ <file>drawPixmap_rop/res/res_NotOrROP1.png</file>
+ <file>drawPixmap_rop/res/res_NotOrROP2.png</file>
+ <file>drawPixmap_rop/res/res_NotOrROP3.png</file>
+ <file>drawPixmap_rop/res/res_NotOrROP4.png</file>
+ <file>drawPixmap_rop/res/res_NotOrROP5.png</file>
+ <file>drawPixmap_rop/res/res_NotOrROP6.png</file>
+ <file>drawPixmap_rop/res/res_NotOrROP7.png</file>
+ <file>drawPixmap_rop/res/res_NotROP0.png</file>
+ <file>drawPixmap_rop/res/res_NotROP1.png</file>
+ <file>drawPixmap_rop/res/res_NotROP2.png</file>
+ <file>drawPixmap_rop/res/res_NotROP3.png</file>
+ <file>drawPixmap_rop/res/res_NotROP4.png</file>
+ <file>drawPixmap_rop/res/res_NotROP5.png</file>
+ <file>drawPixmap_rop/res/res_NotROP6.png</file>
+ <file>drawPixmap_rop/res/res_NotROP7.png</file>
+ <file>drawPixmap_rop/res/res_NotXorROP0.png</file>
+ <file>drawPixmap_rop/res/res_NotXorROP1.png</file>
+ <file>drawPixmap_rop/res/res_NotXorROP2.png</file>
+ <file>drawPixmap_rop/res/res_NotXorROP3.png</file>
+ <file>drawPixmap_rop/res/res_NotXorROP4.png</file>
+ <file>drawPixmap_rop/res/res_NotXorROP5.png</file>
+ <file>drawPixmap_rop/res/res_NotXorROP6.png</file>
+ <file>drawPixmap_rop/res/res_NotXorROP7.png</file>
+ <file>drawPixmap_rop/res/res_OrNotROP0.png</file>
+ <file>drawPixmap_rop/res/res_OrNotROP1.png</file>
+ <file>drawPixmap_rop/res/res_OrNotROP2.png</file>
+ <file>drawPixmap_rop/res/res_OrNotROP3.png</file>
+ <file>drawPixmap_rop/res/res_OrNotROP4.png</file>
+ <file>drawPixmap_rop/res/res_OrNotROP5.png</file>
+ <file>drawPixmap_rop/res/res_OrNotROP6.png</file>
+ <file>drawPixmap_rop/res/res_OrNotROP7.png</file>
+ <file>drawPixmap_rop/res/res_OrROP0.png</file>
+ <file>drawPixmap_rop/res/res_OrROP1.png</file>
+ <file>drawPixmap_rop/res/res_OrROP2.png</file>
+ <file>drawPixmap_rop/res/res_OrROP3.png</file>
+ <file>drawPixmap_rop/res/res_OrROP4.png</file>
+ <file>drawPixmap_rop/res/res_OrROP5.png</file>
+ <file>drawPixmap_rop/res/res_OrROP6.png</file>
+ <file>drawPixmap_rop/res/res_OrROP7.png</file>
+ <file>drawPixmap_rop/res/res_SetROP0.png</file>
+ <file>drawPixmap_rop/res/res_SetROP1.png</file>
+ <file>drawPixmap_rop/res/res_SetROP2.png</file>
+ <file>drawPixmap_rop/res/res_SetROP3.png</file>
+ <file>drawPixmap_rop/res/res_SetROP4.png</file>
+ <file>drawPixmap_rop/res/res_SetROP5.png</file>
+ <file>drawPixmap_rop/res/res_SetROP6.png</file>
+ <file>drawPixmap_rop/res/res_SetROP7.png</file>
+ <file>drawPixmap_rop/res/res_XorROP0.png</file>
+ <file>drawPixmap_rop/res/res_XorROP1.png</file>
+ <file>drawPixmap_rop/res/res_XorROP2.png</file>
+ <file>drawPixmap_rop/res/res_XorROP3.png</file>
+ <file>drawPixmap_rop/res/res_XorROP4.png</file>
+ <file>drawPixmap_rop/res/res_XorROP5.png</file>
+ <file>drawPixmap_rop/res/res_XorROP6.png</file>
+ <file>drawPixmap_rop/res/res_XorROP7.png</file>
+ <file>drawPixmap_rop_bitmap/dst.xbm</file>
+ <file>drawPixmap_rop_bitmap/src1-mask.xbm</file>
+ <file>drawPixmap_rop_bitmap/src1.xbm</file>
+ <file>drawPixmap_rop_bitmap/src2.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_AndNotROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_AndROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_ClearROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_CopyROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_NandROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_NopROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_NorROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_NotAndROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_NotCopyROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_NotOrROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_NotROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_NotXorROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_OrNotROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_OrROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_SetROP.xbm</file>
+ <file>drawPixmap_rop_bitmap/res/res_XorROP.xbm</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 5072aa96c3..e23f7d41c5 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -289,7 +289,7 @@ private slots:
void blendARGBonRGB();
void RasterOp_NotDestination();
-
+ void drawTextNoHinting();
private:
void fillData();
void setPenColor(QPainter& p);
@@ -730,6 +730,7 @@ void tst_QPainter::initFrom()
pal.setColor(QPalette::Foreground, QColor(255, 0, 0));
pal.setBrush(QPalette::Background, QColor(0, 255, 0));
widget->setPalette(pal);
+ widget->show();
QFont font = widget->font();
font.setPointSize(26);
@@ -4813,6 +4814,21 @@ void tst_QPainter::RasterOp_NotDestination()
QCOMPARE(pixel, 0xff00ffff);
}
+void tst_QPainter::drawTextNoHinting()
+{
+ {
+ QImage image(250, 250, QImage::Format_RGB32);
+ QPainter p(&image);
+ QFont font("Arial", 8);
+ font.setHintingPreference(QFont::PreferNoHinting);
+ font.setStyleStrategy(QFont::PreferAntialias);
+ p.setFont(font);
+ p.drawText(image.rect(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz");
+ }
+ // Testing for a crash when DirectWrite is used on Windows
+ QVERIFY(true);
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"
diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
index df7de2b3b7..8cb32dabd1 100644
--- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
+++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
@@ -307,24 +307,22 @@ void tst_QRawFont::advances()
bool supportsSubPixelPositions = font_d->fontEngine->supportsSubPixelPositions();
QVector<QPointF> advances = font.advancesForGlyphIndexes(glyphIndices);
- // On Windows and QNX, freetype engine returns advance of 9 for some of the glyphs
- // when full hinting is used (default on Windows).
- bool mayFail = false;
-#if defined (Q_OS_WIN)
- mayFail = font_d->fontEngine->type() == QFontEngine::Freetype
- && (hintingPreference == QFont::PreferFullHinting
- || hintingPreference == QFont::PreferDefaultHinting);
-#elif defined(Q_OS_QNX)
- mayFail = font_d->fontEngine->type() == QFontEngine::Freetype
- && hintingPreference == QFont::PreferFullHinting;
-#endif
+ bool mayDiffer = font_d->fontEngine->type() == QFontEngine::Freetype
+ && (hintingPreference == QFont::PreferFullHinting
+ || hintingPreference == QFont::PreferDefaultHinting);
for (int i = 0; i < glyphIndices.size(); ++i) {
- if (mayFail && (i == 0 || i == 5)) {
- QEXPECT_FAIL("", "FreeType engine reports unexpected advance "
- "for some glyphs (9 instead of 8)", Continue);
+ if ((i == 0 || i == 5) && mayDiffer) {
+ QVERIFY2(qRound(advances.at(i).x()) == 8
+ || qRound(advances.at(i).x()) == 9,
+ qPrintable(QStringLiteral("%1 != %2 && %1 != %3")
+ .arg(qRound(advances.at(i).x()))
+ .arg(8)
+ .arg(9)));
+ } else {
+ QCOMPARE(qRound(advances.at(i).x()), 8);
}
- QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0));
+
if (supportsSubPixelPositions)
QVERIFY(advances.at(i).x() > 8.0);
@@ -342,11 +340,17 @@ void tst_QRawFont::advances()
QVERIFY(font.advancesForGlyphIndexes(glyphIndices.constData(), advances.data(), numGlyphs));
for (int i = 0; i < glyphIndices.size(); ++i) {
- if (mayFail && (i == 0 || i == 5)) {
- QEXPECT_FAIL("", "FreeType engine reports unexpected advance "
- "for some glyphs (9 instead of 8)", Continue);
+ if ((i == 0 || i == 5) && mayDiffer) {
+ QVERIFY2(qRound(advances.at(i).x()) == 8
+ || qRound(advances.at(i).x()) == 9,
+ qPrintable(QStringLiteral("%1 != %2 && %1 != %3")
+ .arg(qRound(advances.at(i).x()))
+ .arg(8)
+ .arg(9)));
+ } else {
+ QCOMPARE(qRound(advances.at(i).x()), 8);
}
- QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0));
+
if (supportsSubPixelPositions)
QVERIFY(advances.at(i).x() > 8.0);
diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
index 4b2970cd17..4fa8575153 100644
--- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
@@ -1280,6 +1280,13 @@ void tst_QTextLayout::smallTextLengthWrapAtWordBoundaryOrAnywhere()
void tst_QTextLayout::testDefaultTabs()
{
QTextLayout layout("Foo\tBar\ta slightly longer text\tend.", testFont);
+
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
layout.setCacheEnabled(true);
layout.beginLayout();
QTextLine line = layout.createLine();
@@ -1322,6 +1329,13 @@ void tst_QTextLayout::testDefaultTabs()
void tst_QTextLayout::testTabs()
{
QTextLayout layout("Foo\tBar.", testFont);
+
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
layout.setCacheEnabled(true);
QTextOption option = layout.textOption();
option.setTabStop(150);
@@ -1339,6 +1353,13 @@ void tst_QTextLayout::testTabs()
void tst_QTextLayout::testMultilineTab()
{
QTextLayout layout("Lorem ipsum dolor sit\tBar.", testFont);
+
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
layout.setCacheEnabled(true);
// test if this works on the second line.
layout.beginLayout();
@@ -1348,12 +1369,20 @@ void tst_QTextLayout::testMultilineTab()
line.setLineWidth(220.);
layout.endLayout();
+
QCOMPARE(line.cursorToX(22), 80.);
}
void tst_QTextLayout::testMultiTab()
{
QTextLayout layout("Foo\t\t\tBar.", testFont);
+
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
layout.setCacheEnabled(true);
layout.beginLayout();
QTextLine line = layout.createLine();
@@ -1367,6 +1396,13 @@ void tst_QTextLayout::testTabsInAlignedParag()
{
QTextLayout layout("Foo\tsome more words", testFont);
layout.setCacheEnabled(true);
+
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
QTextOption option = layout.textOption();
// right
option.setAlignment(Qt::AlignRight);
@@ -1426,6 +1462,12 @@ void tst_QTextLayout::testRightTab()
*/
layout.setCacheEnabled(true);
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
QTextOption option = layout.textOption();
QList<QTextOption::Tab> tabs;
QTextOption::Tab tab;
@@ -1463,6 +1505,13 @@ void tst_QTextLayout::testRightTab()
void tst_QTextLayout::testCenteredTab()
{
QTextLayout layout("Foo\tBar", testFont);
+
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
layout.setCacheEnabled(true);
// test if centering the tab works. We expect the center of 'Bar.' to be at the tab point.
QTextOption option = layout.textOption();
@@ -1484,6 +1533,13 @@ void tst_QTextLayout::testCenteredTab()
void tst_QTextLayout::testDelimiterTab()
{
QTextLayout layout("Foo\tBar. Barrabas", testFont);
+
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
layout.setCacheEnabled(true);
// try the different delimiter characters to see if the alignment works there.
QTextOption option = layout.textOption();
@@ -1537,6 +1593,12 @@ void tst_QTextLayout::tabsForRtl()
*/
layout.setCacheEnabled(true);
+ QFont font = layout.font();
+ QFontPrivate *fd = QFontPrivate::get(font);
+ qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY());
+ if (!qFuzzyCompare(dpiScale, 1.0))
+ QSKIP("Test logic does not work when tabs are scaled by dpi");
+
QTextOption option = layout.textOption();
QList<QTextOption::Tab> tabs;
QTextOption::Tab tab;
diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h
index e06744b44e..e46189dd7d 100644
--- a/tests/auto/network-settings.h
+++ b/tests/auto/network-settings.h
@@ -116,6 +116,7 @@ public:
return false;
}
}
+ ::close(s);
#endif
return true;
}
diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp
index cc8dd2105f..e7f30f8940 100644
--- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp
+++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp
@@ -200,6 +200,12 @@ void tst_QDnsLookup::lookup()
lookup.lookup();
QVERIFY(waitForDone(&lookup));
QVERIFY(lookup.isFinished());
+
+#if defined(Q_OS_ANDROID)
+ if (lookup.errorString() == QStringLiteral("Not yet supported on Android"))
+ QEXPECT_FAIL("", "Not yet supported on Android", Abort);
+#endif
+
QVERIFY2(int(lookup.error()) == error, qPrintable(lookup.errorString()));
if (error == QDnsLookup::NoError)
QVERIFY(lookup.errorString().isEmpty());
@@ -295,6 +301,12 @@ void tst_QDnsLookup::lookupReuse()
lookup.lookup();
QVERIFY(waitForDone(&lookup));
QVERIFY(lookup.isFinished());
+
+#if defined(Q_OS_ANDROID)
+ if (lookup.errorString() == QStringLiteral("Not yet supported on Android"))
+ QEXPECT_FAIL("", "Not yet supported on Android", Abort);
+#endif
+
QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError));
QVERIFY(!lookup.hostAddressRecords().isEmpty());
QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("a-single"));
@@ -333,6 +345,12 @@ void tst_QDnsLookup::lookupAbortRetry()
lookup.lookup();
QVERIFY(waitForDone(&lookup));
QVERIFY(lookup.isFinished());
+
+#if defined(Q_OS_ANDROID)
+ if (lookup.errorString() == QStringLiteral("Not yet supported on Android"))
+ QEXPECT_FAIL("", "Not yet supported on Android", Abort);
+#endif
+
QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError));
QVERIFY(!lookup.hostAddressRecords().isEmpty());
QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("aaaa-single"));
diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
index 60ac54856c..db09ec4486 100644
--- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
@@ -1062,7 +1062,7 @@ void tst_QUdpSocket::multicastTtlOption_data()
QTest::addColumn<int>("expected");
QList<QHostAddress> addresses;
- addresses += QHostAddress(QHostAddress::Any);
+ addresses += QHostAddress(QHostAddress::AnyIPv4);
addresses += QHostAddress(QHostAddress::AnyIPv6);
foreach (const QHostAddress &address, addresses) {
@@ -1103,7 +1103,7 @@ void tst_QUdpSocket::multicastLoopbackOption_data()
QTest::addColumn<int>("expected");
QList<QHostAddress> addresses;
- addresses += QHostAddress(QHostAddress::Any);
+ addresses += QHostAddress(QHostAddress::AnyIPv4);
addresses += QHostAddress(QHostAddress::AnyIPv6);
foreach (const QHostAddress &address, addresses) {
@@ -1216,7 +1216,7 @@ void tst_QUdpSocket::setMulticastInterface()
// bind initializes the socket
bool bound = udpSocket.bind((address.protocol() == QAbstractSocket::IPv6Protocol
? QHostAddress(QHostAddress::AnyIPv6)
- : QHostAddress(QHostAddress::Any)),
+ : QHostAddress(QHostAddress::AnyIPv4)),
0);
if (!bound)
QTest::ignoreMessage(QtWarningMsg, "QUdpSocket::setMulticastInterface() called on a QUdpSocket when not in QUdpSocket::BoundState");
diff --git a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp
index 8321f4fee1..a44afcbe8f 100644
--- a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp
+++ b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp
@@ -45,6 +45,10 @@ private slots:
void tst_QProcess_and_GuiEventLoop::waitForAndEventLoop()
{
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QSKIP("Not supported on Android");
+#endif
+
// based on testcase provided in QTBUG-39488
QByteArray msg = "Hello World";
diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
index 78aa0af43d..62bd9828ba 100644
--- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
+++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
@@ -526,7 +526,7 @@ void tst_QPrinter::testCustomPageSizes()
{
QPrinter p;
- QSizeF customSize(8.5, 11.0);
+ QSizeF customSize(7.0, 11.0);
p.setPaperSize(customSize, QPrinter::Inch);
QSizeF paperSize = p.paperSize(QPrinter::Inch);
@@ -538,6 +538,16 @@ void tst_QPrinter::testCustomPageSizes()
paperSize = p.paperSize(QPrinter::Inch);
QCOMPARE(paperSize.width(), customSize.width());
QCOMPARE(paperSize.height(), customSize.height());
+
+ const QSizeF sizeInPixels = p.paperSize(QPrinter::DevicePixel);
+ QPrinter p3;
+ p3.setPaperSize(sizeInPixels, QPrinter::DevicePixel);
+ paperSize = p3.paperSize(QPrinter::Inch);
+ QCOMPARE(paperSize.width(), customSize.width());
+ QCOMPARE(paperSize.height(), customSize.height());
+ QPageSize pageSize = p3.pageLayout().pageSize();
+ QCOMPARE(pageSize.key(), QString("Custom.504x792"));
+ QCOMPARE(pageSize.name(), QString("Custom (504pt x 792pt)"));
}
void tst_QPrinter::customPaperSizeAndMargins_data()
diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
index af6dc6b9f4..8b080324d5 100644
--- a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
+++ b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
@@ -493,7 +493,7 @@ public:
{
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType == QSqlDriver::PostgreSQL)
- return QLatin1String("timestamp");
+ return QLatin1String("timestamptz");
if (dbType == QSqlDriver::Oracle && getOraVersion(db) >= 9)
return QLatin1String("timestamp(0)");
return QLatin1String("datetime");
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
index f5d71a75cf..ecf3a9b050 100644
--- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
@@ -147,6 +147,8 @@ private slots:
void invalidQuery();
void batchExec_data() { generic_data(); }
void batchExec();
+ void QTBUG_43874_data() { generic_data(); }
+ void QTBUG_43874();
void oraArrayBind_data() { generic_data(); }
void oraArrayBind();
void lastInsertId_data() { generic_data(); }
@@ -224,6 +226,9 @@ private slots:
void QTBUG_2192_data() { generic_data(); }
void QTBUG_2192();
+ void QTBUG_36211_data() { generic_data("QPSQL"); }
+ void QTBUG_36211();
+
void sqlite_constraint_data() { generic_data("QSQLITE"); }
void sqlite_constraint();
@@ -335,6 +340,7 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db )
<< qTableName("blobstest", __FILE__, db)
<< qTableName("oraRowId", __FILE__, db)
<< qTableName("qtest_batch", __FILE__, db)
+ << qTableName("bug43874", __FILE__, db)
<< qTableName("bug6421", __FILE__, db).toUpper()
<< qTableName("bug5765", __FILE__, db)
<< qTableName("bug6852", __FILE__, db)
@@ -2182,6 +2188,33 @@ void tst_QSqlQuery::batchExec()
QVERIFY( q.value( 3 ).isNull() );
}
+void tst_QSqlQuery::QTBUG_43874()
+{
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
+
+ QSqlQuery q(db);
+ const QString tableName = qTableName("bug43874", __FILE__, db);
+
+ QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id INT)"));
+ QVERIFY_SQL(q, prepare("INSERT INTO " + tableName + " (id) VALUES (?)"));
+
+ for (int i = 0; i < 2; ++i) {
+ QVariantList ids;
+ ids << i;
+ q.addBindValue(ids);
+ QVERIFY_SQL(q, execBatch());
+ }
+ QVERIFY_SQL(q, exec("SELECT id FROM " + tableName + " ORDER BY id"));
+
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toInt(), 0);
+
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toInt(), 1);
+}
+
void tst_QSqlQuery::oraArrayBind()
{
QFETCH( QString, dbName );
@@ -3558,6 +3591,45 @@ void tst_QSqlQuery::QTBUG_2192()
}
}
+void tst_QSqlQuery::QTBUG_36211()
+{
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database( dbName );
+ CHECK_DATABASE( db );
+ if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL) {
+ const QString tableName(qTableName("bug36211", __FILE__, db));
+ tst_Databases::safeDropTable( db, tableName );
+
+ QSqlQuery q(db);
+ QVERIFY_SQL(q, exec(QString("CREATE TABLE %1 (dtwtz timestamptz, dtwotz timestamp)").arg(tableName)));
+
+ QTimeZone l_tzBrazil("BRT");
+ QTimeZone l_tzChina("CST");
+ QDateTime dt = QDateTime(QDate(2014, 10, 30), QTime(14, 12, 02, 357));
+ QVERIFY_SQL(q, prepare("INSERT INTO " + tableName + " (dtwtz, dtwotz) VALUES (:dt, :dt)"));
+ q.bindValue(":dt", dt);
+ QVERIFY_SQL(q, exec());
+ q.bindValue(":dt", dt.toTimeZone(l_tzBrazil));
+ QVERIFY_SQL(q, exec());
+ q.bindValue(":dt", dt.toTimeZone(l_tzChina));
+ QVERIFY_SQL(q, exec());
+
+ QVERIFY_SQL(q, exec("SELECT dtwtz, dtwotz FROM " + tableName));
+
+ for (int i = 0; i < 3; ++i) {
+ QVERIFY_SQL(q, next());
+
+ for (int j = 0; j < 2; ++j) {
+ // Check if retrieved value preserves reported precision
+ int precision = qMax(0, q.record().field(j).precision());
+ int diff = qAbs(q.value(j).toDateTime().msecsTo(dt));
+ int keep = qMin(1000, (int)qPow(10.0, precision));
+ QVERIFY(diff <= 1000 - keep);
+ }
+ }
+ }
+}
+
void tst_QSqlQuery::oraOCINumber()
{
QFETCH( QString, dbName );
@@ -3822,21 +3894,25 @@ void tst_QSqlQuery::aggregateFunctionTypes()
QCOMPARE(q.value(0).toDouble(), 2.5);
QCOMPARE(q.record().field(0).type(), QVariant::Double);
- // PSQL does not have support for the round() function
- if (dbType != QSqlDriver::PostgreSQL) {
- QVERIFY_SQL(q, exec("SELECT ROUND(id, 1) FROM " + tableName + " WHERE id=1.5"));
- QVERIFY(q.next());
- QCOMPARE(q.value(0).toDouble(), 1.5);
- QCOMPARE(q.record().field(0).type(), QVariant::Double);
+ QString field = "id";
- QVERIFY_SQL(q, exec("SELECT ROUND(id, 0) FROM " + tableName + " WHERE id=2.5"));
- QVERIFY(q.next());
- if (dbType == QSqlDriver::MySqlServer)
- QCOMPARE(q.value(0).toDouble(), 2.0);
- else
- QCOMPARE(q.value(0).toDouble(), 3.0);
- QCOMPARE(q.record().field(0).type(), QVariant::Double);
+ // PSQL does not have the round() function with real type
+ if (dbType == QSqlDriver::PostgreSQL) {
+ field += "::NUMERIC";
}
+
+ QVERIFY_SQL(q, exec("SELECT ROUND(" + field + ", 1) FROM " + tableName + " WHERE id=1.5"));
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toDouble(), 1.5);
+ QCOMPARE(q.record().field(0).type(), QVariant::Double);
+
+ QVERIFY_SQL(q, exec("SELECT ROUND(" + field + ", 0) FROM " + tableName + " WHERE id=2.5"));
+ QVERIFY(q.next());
+ if (dbType == QSqlDriver::MySqlServer)
+ QCOMPARE(q.value(0).toDouble(), 2.0);
+ else
+ QCOMPARE(q.value(0).toDouble(), 3.0);
+ QCOMPARE(q.record().field(0).type(), QVariant::Double);
}
{
const QString tableName(qTableName("stringFunctions", __FILE__, db));
diff --git a/tests/auto/test.pl b/tests/auto/test.pl
index 7c3708472c..48166e1c30 100755
--- a/tests/auto/test.pl
+++ b/tests/auto/test.pl
@@ -138,35 +138,22 @@ sub handleDir {
my ($dir) = @_;
my $currentDir = getcwd();
- chdir($dir) || die("Could not chdir to $dir");
- my @components;
- my $command;
- @components = split(/\//, $dir);
- my $component = $components[$#components];
-
- $command = "tst_".$component;
-
- if ( -e $command.$EXE_SUFFIX )
- {
- executeTestCurrentDir($command);
- } else {
- 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)
- }
-
+ 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);
}
}
- chdir($currentDir);
}
sub executeTestCurrentDir {
diff --git a/tests/auto/testlib/selftests/datetime/tst_datetime.cpp b/tests/auto/testlib/selftests/datetime/tst_datetime.cpp
index d684f46f16..95bc72298e 100644
--- a/tests/auto/testlib/selftests/datetime/tst_datetime.cpp
+++ b/tests/auto/testlib/selftests/datetime/tst_datetime.cpp
@@ -52,7 +52,7 @@ private slots:
void tst_DateTime::dateTime() const
{
const QDateTime utc(QDate(2000, 5, 3), QTime(4, 3, 4), Qt::UTC);
- const QDateTime local(QDate(2000, 5, 3), QTime(4, 3, 4), Qt::LocalTime);
+ const QDateTime local(QDate(2000, 5, 3), QTime(4, 3, 4), Qt::OffsetFromUTC, 120 /* 2 minutes */);
QCOMPARE(local, utc);
}
diff --git a/tests/auto/testlib/selftests/expected_datetime.lightxml b/tests/auto/testlib/selftests/expected_datetime.lightxml
index 48ad0933f7..1aeac37e42 100644
--- a/tests/auto/testlib/selftests/expected_datetime.lightxml
+++ b/tests/auto/testlib/selftests/expected_datetime.lightxml
@@ -10,7 +10,7 @@
<TestFunction name="dateTime">
<Incident type="fail" file="tst_datetime.cpp" line="65">
<Description><![CDATA[Compared values are not the same
- Actual (local): 2000/05/03 04:03:04.000[local time]
+ Actual (local): 2000/05/03 04:03:04.000[UTC+00:02]
Expected (utc) : 2000/05/03 04:03:04.000[UTC]]]></Description>
</Incident>
<Duration msecs="0"/>
diff --git a/tests/auto/testlib/selftests/expected_datetime.txt b/tests/auto/testlib/selftests/expected_datetime.txt
index 1139c70ab8..c29fa050a1 100644
--- a/tests/auto/testlib/selftests/expected_datetime.txt
+++ b/tests/auto/testlib/selftests/expected_datetime.txt
@@ -2,7 +2,7 @@
Config: Using QtTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
PASS : tst_DateTime::initTestCase()
FAIL! : tst_DateTime::dateTime() Compared values are not the same
- Actual (local): 2000/05/03 04:03:04.000[local time]
+ Actual (local): 2000/05/03 04:03:04.000[UTC+00:02]
Expected (utc) : 2000/05/03 04:03:04.000[UTC]
Loc: [tst_datetime.cpp(65)]
PASS : tst_DateTime::qurl(empty urls)
diff --git a/tests/auto/testlib/selftests/expected_datetime.xml b/tests/auto/testlib/selftests/expected_datetime.xml
index 30afde60ec..4c5bb0525b 100644
--- a/tests/auto/testlib/selftests/expected_datetime.xml
+++ b/tests/auto/testlib/selftests/expected_datetime.xml
@@ -12,7 +12,7 @@
<TestFunction name="dateTime">
<Incident type="fail" file="tst_datetime.cpp" line="65">
<Description><![CDATA[Compared values are not the same
- Actual (local): 2000/05/03 04:03:04.000[local time]
+ Actual (local): 2000/05/03 04:03:04.000[UTC+00:02]
Expected (utc) : 2000/05/03 04:03:04.000[UTC]]]></Description>
</Incident>
<Duration msecs="0"/>
diff --git a/tests/auto/testlib/selftests/expected_datetime.xunitxml b/tests/auto/testlib/selftests/expected_datetime.xunitxml
index 901462b6bf..6fc95719f3 100644
--- a/tests/auto/testlib/selftests/expected_datetime.xunitxml
+++ b/tests/auto/testlib/selftests/expected_datetime.xunitxml
@@ -8,7 +8,7 @@
<testcase result="pass" name="initTestCase"/>
<testcase result="fail" name="dateTime">
<failure message="Compared values are not the same
- Actual (local): 2000/05/03 04:03:04.000[local time]
+ Actual (local): 2000/05/03 04:03:04.000[UTC+00:02]
Expected (utc) : 2000/05/03 04:03:04.000[UTC]" result="fail"/>
</testcase>
<testcase result="fail" name="qurl">
diff --git a/tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp b/tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp
index f6e4e3bdd9..c850da4629 100644
--- a/tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp
+++ b/tests/auto/tools/qdbusxml2cpp/tst_qdbusxml2cpp.cpp
@@ -34,7 +34,9 @@
#include <QtTest/QtTest>
#include <QtCore/QProcess>
#include <QtCore/QRegularExpression>
-#include <dbus/dbus.h>
+
+// We just need the DBUS_TYPE_* constants, so use our own copy
+#include "../../../../src/dbus/dbus_minimal_p.h"
class tst_qdbusxml2cpp : public QObject
{
diff --git a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp
index 3ed8e1e88e..273be1d9c3 100644
--- a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp
+++ b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp
@@ -113,6 +113,12 @@ void tst_QSidebar::addUrls()
QAbstractItemModel *model = qsidebar.model();
QDir testDir = QDir::home();
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ // temp and home is the same directory on Android
+ testDir.mkdir(QStringLiteral("test"));
+ QVERIFY(testDir.cd(QStringLiteral("test")));
+#endif
+
// default
QCOMPARE(model->rowCount(), 0);
diff --git a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro
index 680286d1e4..79848ac22c 100644
--- a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro
+++ b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro
@@ -13,9 +13,13 @@ wince* {
DEPLOYMENT += addit tests sourceFile
}
-wince*: {
+android|wince*: {
DEFINES += SRCDIR=\\\"./\\\"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
+android: !android-no-sdk {
+ RESOURCES += \
+ testdata.qrc
+}
diff --git a/tests/auto/widgets/itemviews/qdirmodel/testdata.qrc b/tests/auto/widgets/itemviews/qdirmodel/testdata.qrc
new file mode 100644
index 0000000000..e0ef4203fe
--- /dev/null
+++ b/tests/auto/widgets/itemviews/qdirmodel/testdata.qrc
@@ -0,0 +1,11 @@
+<RCC>
+ <qresource prefix="/android_testdata">
+ <file>dirtest/test1/dummy</file>
+ <file>dirtest/test1/test</file>
+ <file>test/file01.tst</file>
+ <file>test/file02.tst</file>
+ <file>test/file03.tst</file>
+ <file>test/file04.tst</file>
+ <file>tst_qdirmodel.cpp</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp
index 4fee5fb1e5..56a8d1f1f4 100644
--- a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp
+++ b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp
@@ -42,6 +42,7 @@ class tst_QDirModel : public QObject
{
Q_OBJECT
public slots:
+ void initTestCase();
void cleanupTestCase();
void init();
private slots:
@@ -113,6 +114,29 @@ void tst_QDirModel::getSetCheck()
QCOMPARE(true, obj1.lazyChildCount());
}
+void tst_QDirModel::initTestCase()
+{
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QString dataPath = SRCDIR;
+ QString resourceSourcePath = QStringLiteral(":/android_testdata");
+ QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories);
+ while (it.hasNext()) {
+ it.next();
+
+ QFileInfo fileInfo = it.fileInfo();
+ if (!fileInfo.isDir()) {
+ QString destination = dataPath + QLatin1Char('/') + fileInfo.filePath().mid(resourceSourcePath.length());
+ QFileInfo destinationFileInfo(destination);
+ if (!destinationFileInfo.exists()) {
+ QDir().mkpath(destinationFileInfo.path());
+ if (!QFile::copy(fileInfo.filePath(), destination))
+ qWarning("Failed to copy %s", qPrintable(fileInfo.filePath()));
+ }
+ }
+ }
+#endif
+}
+
void tst_QDirModel::cleanupTestCase()
{
QDir current;
@@ -556,10 +580,12 @@ void tst_QDirModel::filePath()
model.setResolveSymlinks(false);
QModelIndex index = model.index(SRCDIR "test.lnk");
QVERIFY(index.isValid());
-#ifndef Q_OS_WINCE
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_ANDROID)
QString path = SRCDIR;
#else
- QString path = QFileInfo(SRCDIR).absoluteFilePath() + "/";
+ QString path = QFileInfo(SRCDIR).absoluteFilePath();
+ if (!path.endsWith("/"))
+ path += "/";
#endif
QCOMPARE(model.filePath(index), path + QString( "test.lnk"));
model.setResolveSymlinks(true);
@@ -592,6 +618,10 @@ void tst_QDirModel::task196768_sorting()
view.setSortingEnabled(true);
index2 = model.index(path);
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QEXPECT_FAIL("", "QTBUG-43818", Continue);
+#endif
+
QCOMPARE(index.data(), index2.data());
}
diff --git a/tests/auto/widgets/kernel/qlayout/qlayout.pro b/tests/auto/widgets/kernel/qlayout/qlayout.pro
index 4a5db512c8..8bdbde9282 100644
--- a/tests/auto/widgets/kernel/qlayout/qlayout.pro
+++ b/tests/auto/widgets/kernel/qlayout/qlayout.pro
@@ -11,3 +11,8 @@ wince* {
} else {
TESTDATA += baseline/*
}
+
+android: !android-no-sdk {
+ RESOURCES += \
+ testdata.qrc
+}
diff --git a/tests/auto/widgets/kernel/qlayout/testdata.qrc b/tests/auto/widgets/kernel/qlayout/testdata.qrc
new file mode 100644
index 0000000000..24e8e56263
--- /dev/null
+++ b/tests/auto/widgets/kernel/qlayout/testdata.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>baseline/smartmaxsize</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
index c889643524..0bdc71e55b 100644
--- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
+++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
@@ -345,6 +345,10 @@ void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated()
void tst_QLayout::testRetainSizeWhenHidden()
{
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ QSKIP("Test does not work on platforms which default to showMaximized()");
+#endif
+
QWidget widget;
QBoxLayout layout(QBoxLayout::TopToBottom, &widget);
diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro
index 4d18971cc6..b4546aa760 100644
--- a/tests/auto/widgets/styles/qstyle/qstyle.pro
+++ b/tests/auto/widgets/styles/qstyle/qstyle.pro
@@ -10,3 +10,8 @@ wince* {
addPixmap.path = .
DEPLOYMENT += addPixmap
}
+
+android: !android-no-sdk {
+ RESOURCES += \
+ testdata.qrc
+}
diff --git a/tests/auto/widgets/styles/qstyle/testdata.qrc b/tests/auto/widgets/styles/qstyle/testdata.qrc
new file mode 100644
index 0000000000..c16b9be775
--- /dev/null
+++ b/tests/auto/widgets/styles/qstyle/testdata.qrc
@@ -0,0 +1,20 @@
+<RCC>
+ <qresource prefix="/">
+ <file>images/mac/button.png</file>
+ <file>images/mac/combobox.png</file>
+ <file>images/mac/lineedit.png</file>
+ <file>images/mac/mdi.png</file>
+ <file>images/mac/menu.png</file>
+ <file>images/mac/radiobutton.png</file>
+ <file>images/mac/slider.png</file>
+ <file>images/mac/spinbox.png</file>
+ <file>images/vista/button.png</file>
+ <file>images/vista/combobox.png</file>
+ <file>images/vista/lineedit.png</file>
+ <file>images/vista/menu.png</file>
+ <file>images/vista/radiobutton.png</file>
+ <file>images/vista/slider.png</file>
+ <file>images/vista/spinbox.png</file>
+ <file>task_25863.png</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp
index d8e7fb7a99..cf495e2238 100644
--- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp
+++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp
@@ -148,6 +148,7 @@ private slots:
#endif
void layoutAfterMultiLineRemove();
void undoCommandRemovesAndReinsertsBlock();
+ void taskQTBUG_43562_lineCountCrash();
private:
void createSelection();
@@ -1629,5 +1630,37 @@ void tst_QPlainTextEdit::undoCommandRemovesAndReinsertsBlock()
}
+class ContentsChangedFunctor {
+public:
+ ContentsChangedFunctor(QPlainTextEdit *t) : textEdit(t) {}
+ void operator()(int, int, int)
+ {
+ QTextCursor c(textEdit->textCursor());
+ c.beginEditBlock();
+ c.movePosition(QTextCursor::Start);
+ c.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
+ c.setCharFormat(QTextCharFormat());
+ c.endEditBlock();
+ }
+
+private:
+ QPlainTextEdit *textEdit;
+};
+
+void tst_QPlainTextEdit::taskQTBUG_43562_lineCountCrash()
+{
+ connect(ed->document(), &QTextDocument::contentsChange, ContentsChangedFunctor(ed));
+ // Don't crash
+ QTest::keyClicks(ed, "Some text");
+ QTest::keyClick(ed, Qt::Key_Left);
+ QTest::keyClick(ed, Qt::Key_Right);
+ QTest::keyClick(ed, Qt::Key_A);
+ QTest::keyClick(ed, Qt::Key_Left);
+ QTest::keyClick(ed, Qt::Key_Right);
+ QTest::keyClick(ed, Qt::Key_Space);
+ QTest::keyClicks(ed, "nd some more");
+ disconnect(ed->document(), SIGNAL(contentsChange(int, int, int)), 0, 0);
+}
+
QTEST_MAIN(tst_QPlainTextEdit)
#include "tst_qplaintextedit.moc"
diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro
index e5a6f5d7d2..8ee8d017ab 100644
--- a/tests/benchmarks/benchmarks.pro
+++ b/tests/benchmarks/benchmarks.pro
@@ -1,12 +1,12 @@
TEMPLATE = subdirs
SUBDIRS = \
corelib \
- gui \
sql \
# removed-by-refactor qtHaveModule(opengl): SUBDIRS += opengl
qtHaveModule(dbus): SUBDIRS += dbus
qtHaveModule(network): SUBDIRS += network
+qtHaveModule(gui): SUBDIRS += gui
check-trusted.CONFIG += recursive
QMAKE_EXTRA_TARGETS += check-trusted
diff --git a/tests/benchmarks/dbus/qdbustype/main.cpp b/tests/benchmarks/dbus/qdbustype/main.cpp
index b405df99d5..ae7eb6582a 100644
--- a/tests/benchmarks/dbus/qdbustype/main.cpp
+++ b/tests/benchmarks/dbus/qdbustype/main.cpp
@@ -35,8 +35,11 @@
#include <QtCore/QCoreApplication>
#include <QtDBus/private/qdbusutil_p.h>
+#include <QtDBus/private/qdbus_symbols_p.h>
-#include <dbus/dbus.h>
+DEFINEFUNC(dbus_bool_t, dbus_signature_validate, (const char *signature,
+ DBusError *error),
+ (signature, error), return)
class tst_QDBusType: public QObject
{
@@ -48,7 +51,8 @@ private Q_SLOTS:
static inline void benchmarkAddRow(const char *name, const char *data)
{
- QTest::newRow(QByteArray(QByteArray("native-") + name)) << data << true;
+ if (qdbus_loadLibDBus())
+ QTest::newRow(QByteArray(QByteArray("native-") + name)) << data << true;
QTest::newRow(name) << data << false;
}
@@ -84,9 +88,9 @@ void tst_QDBusType::benchmarkSignature()
bool result;
if (useNative) {
- dbus_signature_validate(data.toLatin1(), 0);
+ q_dbus_signature_validate(data.toLatin1(), 0);
QBENCHMARK {
- result = dbus_signature_validate(data.toLatin1(), 0);
+ result = q_dbus_signature_validate(data.toLatin1(), 0);
}
} else {
QDBusUtil::isValidSignature(data);
diff --git a/tests/benchmarks/dbus/qdbustype/qdbustype.pro b/tests/benchmarks/dbus/qdbustype/qdbustype.pro
index 0307dda4a0..1437e4d9eb 100644
--- a/tests/benchmarks/dbus/qdbustype/qdbustype.pro
+++ b/tests/benchmarks/dbus/qdbustype/qdbustype.pro
@@ -1,8 +1,13 @@
TARGET = tst_bench_qdbustype
QT -= gui
-QT += dbus dbus-private testlib
-QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
-LIBS_PRIVATE += $$QT_LIBS_DBUS
+QT += core-private dbus-private testlib
+contains(QT_CONFIG, dbus-linked) {
+ DEFINES += QT_LINKED_LIBDBUS
+ LIBS += $$QT_LIBS_DBUS
+ QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
+} else {
+ SOURCES += ../../../../src/dbus/qdbus_symbols.cpp
+}
SOURCES += main.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/manual/diaglib/eventfilter.cpp b/tests/manual/diaglib/eventfilter.cpp
index 23a6d44fef..0a815fd883 100644
--- a/tests/manual/diaglib/eventfilter.cpp
+++ b/tests/manual/diaglib/eventfilter.cpp
@@ -36,6 +36,28 @@
#include <QtCore/QDebug>
#include <QtCore/QTextStream>
+#if QT_VERSION >= 0x050000
+# if defined(QT_WIDGETS_LIB)
+# define HAVE_APPLICATION
+# endif
+# if defined(QT_GUI_LIB)
+# define HAVE_GUI_APPLICATION
+# endif
+#else // Qt 5
+# if defined(QT_GUI_LIB)
+# define HAVE_APPLICATION
+# endif
+#endif
+
+#ifdef HAVE_APPLICATION
+# include <QApplication>
+# include <QWidget>
+#endif
+#ifdef HAVE_GUI_APPLICATION
+# include <QtGui/QGuiApplication>
+# include <QtGui/QWindow>
+#endif
+
namespace QtDiag {
EventFilter::EventFilter(EventCategories eventCategories, QObject *p)
@@ -131,16 +153,60 @@ static inline bool matchesType(const QObject *o, EventFilter::ObjectTypes types)
return types & EventFilter::OtherType;
}
+static void formatObject(const QObject *o, QDebug debug)
+{
+ if (o) {
+ debug << o->metaObject()->className();
+ const QString on = o->objectName();
+ if (!on.isEmpty())
+ debug << '/' << on;
+ } else {
+ debug << "null";
+ }
+}
+
+static void formatApplicationState(QDebug debug)
+{
+#if defined(HAVE_APPLICATION)
+ if (const QWidget *mw = QApplication::activeModalWidget()) {
+ debug << "\n QApplication::activeModalWidget = ";
+ formatObject(mw, debug);
+ }
+ if (const QWidget *pw = QApplication::activePopupWidget()) {
+ debug << "\n QApplication::activePopupWidget = ";
+ formatObject(pw, debug);
+ }
+ debug << "\n QApplication::activeWindow = ";
+ formatObject(QApplication::activeWindow(), debug);
+#endif // HAVE_APPLICATION
+#if defined(HAVE_GUI_APPLICATION)
+ if (const QWindow *mw = QGuiApplication::modalWindow()) {
+ debug << "\n QGuiApplication::modalWindow = ";
+ formatObject(mw, debug);
+ }
+ debug << "\n QGuiApplication::focusWindow = ";
+ formatObject(QGuiApplication::focusWindow(), debug);
+#endif // HAVE_GUI_APPLICATION
+}
+
bool EventFilter::eventFilter(QObject *o, QEvent *e)
{
static int n = 0;
if (matchesType(o, m_objectTypes) && m_eventTypes.contains(e->type())) {
QDebug debug = qDebug().nospace();
- const QString on = o->objectName();
- debug << '#' << n++ << ' ' << o->metaObject()->className();
- if (!on.isEmpty())
- debug << '/' << on;
+ debug << '#' << n++ << ' ';
+ formatObject(o, debug);
debug << ' ' << e;
+ switch (e->type()) {
+#if QT_VERSION >= 0x050000
+ case QEvent::FocusAboutToChange:
+#endif
+ case QEvent::FocusIn:
+ formatApplicationState(debug);
+ break;
+ default:
+ break;
+ }
}
return false;
}
diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp
index 487e95266b..dc1e0e08c0 100644
--- a/tests/manual/qscreen/main.cpp
+++ b/tests/manual/qscreen/main.cpp
@@ -80,8 +80,11 @@ void screenAdded(QScreen* screen)
// But this works as long as the screens are all virtual siblings
w->show();
QRect geom = w->geometry();
+ geom.setSize(w->sizeHint());
+ if (geom.height() > screen->geometry().height())
+ geom.setHeight(screen->geometry().height() * 9 / 10);
geom.moveCenter(screen->geometry().center());
- w->move(geom.topLeft());
+ w->setGeometry(geom);
props->insert(screen, w);
diff --git a/tests/manual/qscreen/propertyfield.cpp b/tests/manual/qscreen/propertyfield.cpp
index e6392465f2..f1e5e22ec9 100644
--- a/tests/manual/qscreen/propertyfield.cpp
+++ b/tests/manual/qscreen/propertyfield.cpp
@@ -34,8 +34,9 @@
#include "propertyfield.h"
#include <QDebug>
-PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidget *parent) :
- QLineEdit(parent), m_subject(subject), m_lastChangeTime(QTime::currentTime()), m_prop(prop)
+PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidget *parent)
+ : QLineEdit(parent), m_subject(subject), m_lastChangeTime(QTime::currentTime()), m_prop(prop)
+ , m_defaultBrush(palette().brush(QPalette::Active, QPalette::Text))
{
setReadOnly(true);
if (prop.hasNotifySignal()) {
@@ -99,7 +100,7 @@ void PropertyField::propertyChanged()
setText(text);
m_lastText = text;
m_lastTextShowing = text;
- modPalette.setBrush(QPalette::Text, Qt::black);
+ modPalette.setBrush(QPalette::Text, m_defaultBrush);
}
setPalette(modPalette);
}
diff --git a/tests/manual/qscreen/propertyfield.h b/tests/manual/qscreen/propertyfield.h
index 2738a215a6..f76ac7fc6b 100644
--- a/tests/manual/qscreen/propertyfield.h
+++ b/tests/manual/qscreen/propertyfield.h
@@ -63,6 +63,7 @@ private:
QString m_lastTextShowing;
QTime m_lastChangeTime;
const QMetaProperty m_prop;
+ QBrush m_defaultBrush;
};
#endif // PROPERTYFIELD_H
diff --git a/tests/manual/windowflags/controllerwindow.cpp b/tests/manual/windowflags/controllerwindow.cpp
index 2981bb9bf1..9975bc9673 100644
--- a/tests/manual/windowflags/controllerwindow.cpp
+++ b/tests/manual/windowflags/controllerwindow.cpp
@@ -137,7 +137,10 @@ void ControllerWindow::updatePreview()
parentWindow->hide();
}
- previewWidget->setWindowFlags(flags);
+ if (previewWidgetButton->isChecked())
+ previewWindow->setWindowFlags(flags);
+ else
+ previewDialog->setWindowFlags(flags);
if (fixedSizeWindowCheckBox->isChecked()) {
previewWidget->setFixedSize(300, 300);