summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-10-24 12:48:39 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-10-24 12:48:42 +0200
commit840f6a40e6218992b5b9d451ee3c0886a4846c89 (patch)
tree2b808decc7adf5218b810d2de6b45c5a8b4cfc42 /tests
parent109bf980b37fed405c6c1eb14cb9c83ff897e389 (diff)
parent2e3870fe37d36ccf4bd84eb90e1d5e08ad00c1bc (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'tests')
-rwxr-xr-xtests/auto/android/runtests.pl2
-rwxr-xr-xtests/auto/android/runtests_androiddeployqt.pl323
-rw-r--r--tests/auto/auto.pro1
-rw-r--r--tests/auto/corelib/animation/qparallelanimationgroup/qparallelanimationgroup.pro2
-rw-r--r--tests/auto/corelib/animation/qpauseanimation/qpauseanimation.pro2
-rw-r--r--tests/auto/corelib/codecs/qtextcodec/test/test.pro2
-rw-r--r--tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp57
-rw-r--r--tests/auto/corelib/codecs/utf8/tst_utf8.cpp20
-rw-r--r--tests/auto/corelib/codecs/utf8/utf8data.cpp4
-rw-r--r--tests/auto/corelib/global/qlogging/app/main.cpp4
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp17
-rw-r--r--tests/auto/corelib/io/io.pro4
-rw-r--r--tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp32
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp10
-rw-r--r--tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp7
-rw-r--r--tests/auto/corelib/itemmodels/itemmodels.pro4
-rw-r--r--tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro2
-rw-r--r--tests/auto/corelib/json/tst_qtjson.cpp24
-rw-r--r--tests/auto/corelib/kernel/kernel.pro3
-rw-r--r--tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro2
-rw-r--r--tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp16
-rw-r--r--tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro2
-rw-r--r--tests/auto/corelib/kernel/qpointer/qpointer.pro2
-rw-r--r--tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro2
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro1
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro1
-rw-r--r--tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro1
-rw-r--r--tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro2
-rw-r--r--tests/auto/corelib/tools/qbytedatabuffer/qbytedatabuffer.pro2
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp25
-rw-r--r--tests/auto/corelib/tools/qmargins/tst_qmargins.cpp6
-rw-r--r--tests/auto/corelib/tools/qtimezone/qtimezone.pro2
-rw-r--r--tests/auto/dbus/qdbusmarshall/qdbusmarshall.pro2
-rw-r--r--tests/auto/gui/kernel/qguivariant/test/data/qpolygonf.binbin0 -> 103 bytes
-rw-r--r--tests/auto/gui/kernel/qguivariant/test/qguivariant.qrc5
-rw-r--r--tests/auto/gui/kernel/qguivariant/test/test.pro1
-rw-r--r--tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp43
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp2
-rw-r--r--tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp4
-rw-r--r--tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp48
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp2
-rw-r--r--tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp2
-rw-r--r--tests/auto/other/modeltest/modeltest.cpp4
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp135
-rw-r--r--tests/auto/testlib/selftests/cmptest/cmptest.pro3
-rw-r--r--tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp6
-rw-r--r--tests/auto/tools/qmake/testdata/json/json.pro26
-rw-r--r--tests/auto/tools/qmake/testdata/json/test.json9
-rw-r--r--tests/auto/tools/qmake/tst_qmake.cpp29
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp17
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp20
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp4
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp4
-rw-r--r--tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp62
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp20
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp12
-rw-r--r--tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp27
-rw-r--r--tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp99
-rw-r--r--tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/170.xml.ref2
-rw-r--r--tests/benchmarks/corelib/tools/qstring/main.cpp18
60 files changed, 966 insertions, 224 deletions
diff --git a/tests/auto/android/runtests.pl b/tests/auto/android/runtests.pl
index 55e1a224d8..365257aace 100755
--- a/tests/auto/android/runtests.pl
+++ b/tests/auto/android/runtests.pl
@@ -164,7 +164,7 @@ if ($output =~ m/.*\[ro.build.version.sdk\]: \[(\d+)\]/)
sub reinstallQuadruplor
{
pushd($quadruplor_dir);
- system("$android_sdk_dir/tools/android update project -p . -t android-4")==0 or die "Can't update project ...\n";
+ system("$android_sdk_dir/tools/android update project -p . -t android-10")==0 or die "Can't update project ...\n";
system("$ant_tool uninstall clean debug install")==0 or die "Can't install Quadruplor\n";
system("$adb_tool $device_serial shell am start -n $intentName"); # create application folders
waitForProcess($packageName,1,10);
diff --git a/tests/auto/android/runtests_androiddeployqt.pl b/tests/auto/android/runtests_androiddeployqt.pl
new file mode 100755
index 0000000000..d3c9a7bc11
--- /dev/null
+++ b/tests/auto/android/runtests_androiddeployqt.pl
@@ -0,0 +1,323 @@
+#!/usr/bin/perl -w
+#############################################################################
+##
+## Copyright (C) 2012-2013 BogDan Vatra <bogdan@kde.org>
+## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+## Contact: http://www.qt-project.org/legal
+##
+## This file is part of the test suite of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and Digia. For licensing terms and
+## conditions see http://qt.digia.com/licensing. For further information
+## use the contact form at http://qt.digia.com/contact-us.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 2.1 requirements
+## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+##
+## In addition, as a special exception, Digia gives you certain additional
+## rights. These rights are described in the Digia Qt LGPL Exception
+## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3.0 as published by the Free Software
+## Foundation and appearing in the file LICENSE.GPL included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU General Public License version 3.0 requirements will be
+## met: http://www.gnu.org/copyleft/gpl.html.
+##
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+use Cwd;
+use Cwd 'abs_path';
+use File::Basename;
+use File::Temp 'tempdir';
+use File::Path 'remove_tree';
+use Getopt::Long;
+use Pod::Usage;
+
+### default options
+my @stack = cwd;
+my $device_serial=""; # "-s device_serial";
+my $deployqt_device_serial=""; # "-device device_serial";
+my $className="org.qtproject.qt5.android.bindings.QtActivity";
+my $jobs = 4;
+my $testsubset = "";
+my $man = 0;
+my $help = 0;
+my $make_clean = 0;
+my $time_out=400;
+my $android_toolchain_version = "4.8";
+my $host_arch = "linux-x86";
+my $android_sdk_dir = "$ENV{'ANDROID_SDK_ROOT'}";
+my $android_ndk_dir = "$ENV{'ANDROID_NDK_ROOT'}";
+my $android_to_connect = "$ENV{'ANDROID_DEVICE'}";
+my $ant_tool = `which ant`;
+chomp $ant_tool;
+my $strip_tool="";
+my $readelf_tool="";
+GetOptions('h|help' => \$help
+ , man => \$man
+ , 's|serial=s' => \$device_serial
+ , 't|test=s' => \$testsubset
+ , 'c|clean' => \$make_clean
+ , 'j|jobs=i' => \$jobs
+ , 'sdk=s' => \$android_sdk_dir
+ , 'ndk=s' => \$android_ndk_dir
+ , 'toolchain=s' => \$android_toolchain_version
+ , 'host=s' => \$host_arch
+ , 'ant=s' => \$ant_tool
+ , 'strip=s' => \$strip_tool
+ , 'readelf=s' => \$readelf_tool
+ , 'testcase=s' => \$testcase
+ ) or pod2usage(2);
+pod2usage(1) if $help;
+pod2usage(-verbose => 2) if $man;
+
+my $adb_tool="$android_sdk_dir/platform-tools/adb";
+
+# For CI. Nodes are connecting to test devices over IP, which is stored to env variable
+if ($android_to_connect ne ""){
+ print " Found device to be connected from env: $android_to_connect \n";
+ system("$adb_tool disconnect $android_to_connect");
+ system("$adb_tool connect $android_to_connect");
+ sleep(2);# let it connect
+ system("$adb_tool -s $android_to_connect reboot &");# adb bug, it blocks forever
+ sleep(15); # wait for the device to come up again
+ system("$adb_tool disconnect $android_to_connect");# cleans up the left adb reboot process
+ system("$adb_tool connect $android_to_connect");
+ $device_serial =$android_to_connect;
+}
+
+
+system("$adb_tool devices") == 0 or die "No device found, please plug/start at least one device/emulator\n"; # make sure we have at least on device attached
+
+$deployqt_device_serial = "--device $device_serial" if ($device_serial);
+$device_serial = "-s $device_serial" if ($device_serial);
+$testsubset="/$testsubset" if ($testsubset);
+
+$strip_tool="$android_ndk_dir/toolchains/arm-linux-androideabi-$android_toolchain_version/prebuilt/$host_arch/bin/arm-linux-androideabi-strip" unless($strip_tool);
+$readelf_tool="$android_ndk_dir/toolchains/arm-linux-androideabi-$android_toolchain_version/prebuilt/$host_arch/bin/arm-linux-androideabi-readelf" unless($readelf_tool);
+$readelf_tool="$readelf_tool -d -w ";
+
+sub dir
+{
+# print "@stack\n";
+}
+
+sub pushd ($)
+{
+ unless ( chdir $_[0] )
+ {
+ warn "Error: $!\n";
+ return;
+ }
+ unshift @stack, cwd;
+ dir;
+}
+
+sub popd ()
+{
+ @stack > 1 and shift @stack;
+ chdir $stack[0];
+ dir;
+}
+
+
+sub waitForProcess
+{
+ my $process=shift;
+ my $action=shift;
+ my $timeout=shift;
+ my $sleepPeriod=shift;
+ $sleepPeriod=1 if !defined($sleepPeriod);
+ print "Waiting for $process ".$timeout*$sleepPeriod." seconds to";
+ print $action?" start...\n":" die...\n";
+ while ($timeout--)
+ {
+ my $output = `$adb_tool $device_serial shell ps 2>&1`; # get current processes
+ #FIXME check why $output is not matching m/.*S $process\n/ or m/.*S $process$/ (eol)
+ my $res=($output =~ m/.*S $process/)?1:0; # check the procress
+ if ($action == $res)
+ {
+ print "... succeed\n";
+ return 1;
+ }
+ sleep($sleepPeriod);
+ print "timeount in ".$timeout*$sleepPeriod." seconds\n"
+ }
+ print "... failed\n";
+ return 0;
+}
+
+my $src_dir_qt=abs_path(dirname($0)."/../../..");
+my $quadruplor_dir="$src_dir_qt/tests/auto/android";
+my $qmake_path="$src_dir_qt/bin/qmake";
+my $tests_dir="$src_dir_qt/tests$testsubset";
+my $temp_dir=tempdir(CLEANUP => 1);
+my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
+my $output_dir=$stack[0]."/".(1900+$year)."-$mon-$mday-$hour:$min";
+mkdir($output_dir);
+my $sdk_api=0;
+my $output = `$adb_tool $device_serial shell getprop`; # get device properties
+if ($output =~ m/.*\[ro.build.version.sdk\]: \[(\d+)\]/)
+{
+ $sdk_api=int($1);
+ $sdk_api=5 if ($sdk_api>5 && $sdk_api<8);
+ $sdk_api=9 if ($sdk_api>9);
+}
+
+sub startTest
+{
+ my $testName = shift;
+ my $packageName = "org.qtproject.example.tst_$testName";
+ my $intentName = "$packageName/org.qtproject.qt5.android.bindings.QtActivity";
+ my $output_file = shift;
+
+ system("$adb_tool $device_serial shell am start -e applicationArguments \"-o /data/data/$packageName/output.xml\" -n $intentName"); # start intent
+ #wait to start (if it has not started and quit already)
+ waitForProcess($packageName,1,10);
+
+ #wait to stop
+ unless(waitForProcess($packageName,0,$time_out,5))
+ {
+ #killProcess($packageName);
+ print "Someone should kill $packageName\n";
+ return 1;
+ }
+ system("$adb_tool $device_serial pull /data/data/$packageName/output.xml $output_dir/$output_file");
+ return 1;
+}
+
+########### build qt tests and benchmarks ###########
+pushd($tests_dir);
+print "Building $tests_dir \n";
+system("make distclean") if ($make_clean);
+system("$qmake_path -r") == 0 or die "Can't run qmake\n"; #exec qmake
+system("make -j$jobs") == 0 or warn "Can't build all tests\n"; #exec make
+
+my $testsFiles = "";
+if ($testcase) {
+ $testsFiles=`find . -name libtst_$testcase.so`; # only tests
+} else {
+ $testsFiles=`find . -name libtst_*.so`; # only tests
+}
+
+foreach (split("\n",$testsFiles))
+{
+ chomp; #remove white spaces
+ pushd(abs_path(dirname($_))); # cd to application dir
+ system("make INSTALL_ROOT=$temp_dir install"); # install the application to temp dir
+ my $application=basename(cwd);
+ system("androiddeployqt --install $deployqt_device_serial --output $temp_dir --deployment debug --verbose --input android-libtst_$application.so-deployment-settings.json");
+ my $output_name=dirname($_);
+ $output_name =~ s/\.//; # remove first "." character
+ $output_name =~ s/\///; # remove first "/" character
+ $output_name =~ s/\//_/g; # replace all "/" with "_"
+ $output_name=$application unless($output_name);
+ $time_out=5*60/5; # 5 minutes time out for a normal test
+
+ $applicationLibrary = `find $temp_dir -name libtst_bench_$application.so`;
+
+ if ($applicationLibrary)
+ {
+ $time_out=5*60/5; # 10 minutes for a benchmark
+ $application = "bench_$application";
+ }
+ else
+ {
+ $applicationLibrary = `find $temp_dir -name libtst_$application.so`;
+ }
+
+ if (!$applicationLibrary)
+ {
+ print "Can't find application binary libtst_$application.so in $temp_dir!\n";
+ }
+ else
+ {
+ startTest($application, "$output_name.xml") or warn "Can't run $application ...\n";
+ }
+
+ popd();
+ remove_tree( $temp_dir, {keep_root => 1} );
+}
+popd();
+
+__END__
+
+=head1 NAME
+
+Script to run all qt tests/benchmarks to an android device/emulator
+
+=head1 SYNOPSIS
+
+runtests.pl [options]
+
+=head1 OPTIONS
+
+=over 8
+
+=item B<-s --serial = serial>
+
+Device serial number. May be empty if only one device is attached.
+
+=item B<-t --test = test_subset>
+
+Tests subset (e.g. benchmarks, auto, auto/qbuffer, etc.).
+
+=item B<-c --clean>
+
+Clean tests before building them.
+
+=item B<-j --jobs = number>
+
+Make jobs when building tests.
+
+=item B<--sdk = sdk_path>
+
+Android SDK path.
+
+=item B<--ndk = ndk_path>
+
+Android NDK path.
+
+=item B<--ant = ant_tool_path>
+
+Ant tool path.
+
+=item B<--strip = strip_tool_path>
+
+Android strip tool path, used to deploy qt libs.
+
+=item B<--readelf = readelf_tool_path>
+
+Android readelf tool path, used to check if a test application uses qt OpenGL.
+
+=item B<-h --help>
+
+Print a brief help message and exits.
+
+=item B<--man>
+
+Prints the manual page and exits.
+
+=back
+
+=head1 DESCRIPTION
+
+B<This program> will run all qt tests/benchmarks to an android device/emulator.
+
+=cut
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index e16f229c4e..3ff78a955f 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -23,6 +23,7 @@ wince*: SUBDIRS -= printsupport
cross_compile: SUBDIRS -= tools
!qtHaveModule(opengl): SUBDIRS -= opengl
!unix|embedded|!qtHaveModule(dbus): SUBDIRS -= dbus
+!qtHaveModule(gui): SUBDIRS -= gui cmake
!qtHaveModule(widgets): SUBDIRS -= widgets
!qtHaveModule(printsupport): SUBDIRS -= printsupport
!qtHaveModule(concurrent): SUBDIRS -= concurrent
diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/qparallelanimationgroup.pro b/tests/auto/corelib/animation/qparallelanimationgroup/qparallelanimationgroup.pro
index 4383c44259..23343f27f5 100644
--- a/tests/auto/corelib/animation/qparallelanimationgroup/qparallelanimationgroup.pro
+++ b/tests/auto/corelib/animation/qparallelanimationgroup/qparallelanimationgroup.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qparallelanimationgroup
-QT = core gui testlib
+QT = core testlib
SOURCES = tst_qparallelanimationgroup.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/animation/qpauseanimation/qpauseanimation.pro b/tests/auto/corelib/animation/qpauseanimation/qpauseanimation.pro
index 812c98f8f0..4c2dd02951 100644
--- a/tests/auto/corelib/animation/qpauseanimation/qpauseanimation.pro
+++ b/tests/auto/corelib/animation/qpauseanimation/qpauseanimation.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qpauseanimation
-QT = core-private gui-private testlib
+QT = core-private testlib
SOURCES = tst_qpauseanimation.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/codecs/qtextcodec/test/test.pro b/tests/auto/corelib/codecs/qtextcodec/test/test.pro
index ba16a75604..35b2b34690 100644
--- a/tests/auto/corelib/codecs/qtextcodec/test/test.pro
+++ b/tests/auto/corelib/codecs/qtextcodec/test/test.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
CONFIG += parallel_test
-QT += testlib
+QT = core testlib
SOURCES = ../tst_qtextcodec.cpp
TARGET = ../tst_qtextcodec
diff --git a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
index 6329160998..8e1b3cf3b2 100644
--- a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
@@ -44,7 +44,6 @@
#include <qtextcodec.h>
#include <qfile.h>
-#include <qtextdocument.h>
#include <time.h>
#include <qprocess.h>
#include <QThreadPool>
@@ -67,9 +66,9 @@ private slots:
void codecForLocale();
void asciiToIscii() const;
- void flagCodepointFFFF() const;
+ void nonFlaggedCodepointFFFF() const;
void flagF7808080() const;
- void flagEFBFBF() const;
+ void nonFlaggedEFBFBF() const;
void decode0D() const;
void aliasForUTF16() const;
void mibForTSCII() const;
@@ -288,7 +287,7 @@ void tst_QTextCodec::toUnicode_codecForHtml()
QVERIFY(file.open(QFile::ReadOnly));
QByteArray data = file.readAll();
- QTextCodec *codec = Qt::codecForHtml(data);
+ QTextCodec *codec = QTextCodec::codecForHtml(data);
codec->toUnicode(data); // this line crashes
}
@@ -410,9 +409,9 @@ void tst_QTextCodec::asciiToIscii() const
}
}
-void tst_QTextCodec::flagCodepointFFFF() const
+void tst_QTextCodec::nonFlaggedCodepointFFFF() const
{
- // This is an invalid Unicode codepoint.
+ //Check that the code point 0xFFFF (=non-character code 0xEFBFBF) is not flagged
const QChar ch(0xFFFF);
QString input(ch);
@@ -420,12 +419,11 @@ void tst_QTextCodec::flagCodepointFFFF() const
QVERIFY(codec);
const QByteArray asDecoded(codec->fromUnicode(input));
- QCOMPARE(asDecoded, QByteArray("?"));
+ QCOMPARE(asDecoded, QByteArray("\357\277\277"));
QByteArray ffff("\357\277\277");
QTextCodec::ConverterState state(QTextCodec::ConvertInvalidToNull);
- QVERIFY(codec->toUnicode(ffff.constData(), ffff.length(), &state) == QChar(0));
- QVERIFY(codec->toUnicode(ffff) == QChar(0xfffd));
+ QVERIFY(codec->toUnicode(ffff.constData(), ffff.length(), &state) == QByteArray::fromHex("EFBFBF"));
}
void tst_QTextCodec::flagF7808080() const
@@ -461,13 +459,16 @@ void tst_QTextCodec::flagF7808080() const
QVERIFY(codec->toUnicode(input.constData(), input.length(), &state) == QChar(0));
}
-void tst_QTextCodec::flagEFBFBF() const
+void tst_QTextCodec::nonFlaggedEFBFBF() const
{
- QByteArray invalidInput;
- invalidInput.resize(3);
- invalidInput[0] = char(0xEF);
- invalidInput[1] = char(0xBF);
- invalidInput[2] = char(0xBF);
+ /* Check that the codec does NOT flag EFBFBF.
+ * This is a regression test; see QTBUG-33229
+ */
+ QByteArray validInput;
+ validInput.resize(3);
+ validInput[0] = char(0xEF);
+ validInput[1] = char(0xBF);
+ validInput[2] = char(0xBF);
const QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8
QVERIFY(codec);
@@ -475,21 +476,20 @@ void tst_QTextCodec::flagEFBFBF() const
{
//QVERIFY(!codec->canEncode(QChar(0xFFFF)));
QTextCodec::ConverterState state(QTextCodec::ConvertInvalidToNull);
- QVERIFY(codec->toUnicode(invalidInput.constData(), invalidInput.length(), &state) == QChar(0));
+ QVERIFY(codec->toUnicode(validInput.constData(), validInput.length(), &state) == QByteArray::fromHex("EFBFBF"));
QByteArray start("<?pi ");
- start.append(invalidInput);
+ start.append(validInput);
start.append("?>");
}
- /* When 0xEFBFBF is preceded by what seems to be an arbitrary character,
- * QTextCodec fails to flag it. */
+ // Check that 0xEFBFBF is correctly decoded when preceded by an arbitrary character
{
QByteArray start("B");
- start.append(invalidInput);
+ start.append(validInput);
QTextCodec::ConverterState state(QTextCodec::ConvertInvalidToNull);
- QVERIFY(codec->toUnicode(start.constData(), start.length(), &state) == QString::fromLatin1("B\0", 2));
+ QVERIFY(codec->toUnicode(start.constData(), start.length(), &state) == QByteArray("B").append(QByteArray::fromHex("EFBFBF")));
}
}
@@ -675,13 +675,12 @@ void tst_QTextCodec::utf8Codec_data()
str = QChar(0x7ff);
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 2.2.2") << utf8 << str << -1;
- // 2.2.3 U+000FFFF
+ // 2.2.3 U+000FFFF - non-character code
utf8.clear();
utf8 += char(0xef);
utf8 += char(0xbf);
utf8 += char(0xbf);
- str.clear();
- str += QChar::ReplacementCharacter;
+ str = QString::fromUtf8(utf8);
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 2.2.3") << utf8 << str << -1;
// 2.2.4 U+001FFFFF
@@ -1536,20 +1535,22 @@ void tst_QTextCodec::utf8Codec_data()
str += QChar(QChar::ReplacementCharacter);
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 5.2.8") << utf8 << str << -1;
- // 5.3.1
+ // 5.3.1 - non-character code
utf8.clear();
utf8 += char(0xef);
utf8 += char(0xbf);
utf8 += char(0xbe);
- str = QChar(QChar::ReplacementCharacter);
+ //str = QChar(QChar::ReplacementCharacter);
+ str = QString::fromUtf8(utf8);
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 5.3.1") << utf8 << str << -1;
- // 5.3.2
+ // 5.3.2 - non-character code
utf8.clear();
utf8 += char(0xef);
utf8 += char(0xbf);
utf8 += char(0xbf);
- str = QChar(QChar::ReplacementCharacter);
+ //str = QChar(QChar::ReplacementCharacter);
+ str = QString::fromUtf8(utf8);
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 5.3.2") << utf8 << str << -1;
}
diff --git a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
index 99147f3aff..e18f6f73b9 100644
--- a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
+++ b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
@@ -233,8 +233,9 @@ void tst_Utf8::nonCharacters_data()
QTest::addColumn<QByteArray>("utf8");
QTest::addColumn<QString>("utf16");
- // Unicode has a couple of "non-characters" that one can use internally,
- // but are not allowed to be used for text interchange.
+ // Unicode has a couple of "non-characters" that one can use internally
+ // These characters may be used for interchange;
+ // see: http://www.unicode.org/versions/corrigendum9.html
//
// Those are the last two entries each Unicode Plane (U+FFFE, U+FFFF,
// U+1FFFE, U+1FFFF, etc.) as well as the entries between U+FDD0 and
@@ -279,20 +280,17 @@ void tst_Utf8::nonCharacters()
decoder->toUnicode(utf8);
// Only enforce correctness on our UTF-8 decoder
- // The system's UTF-8 codec is sometimes buggy
- // GNU libc's iconv is known to accept U+FFFF and U+FFFE encoded as UTF-8
- // OS X's iconv is known to accept those, plus surrogates and codepoints above U+10FFFF
if (!useLocale)
- QVERIFY(decoder->hasFailure());
- else if (!decoder->hasFailure())
- qWarning("System codec does not report failure when it should. Should report bug upstream.");
+ QVERIFY(!decoder->hasFailure());
+ else if (decoder->hasFailure())
+ qWarning("System codec reports failure when it shouldn't. Should report bug upstream.");
QSharedPointer<QTextEncoder> encoder(codec->makeEncoder());
encoder->fromUnicode(utf16);
if (!useLocale)
- QVERIFY(encoder->hasFailure());
- else if (!encoder->hasFailure())
- qWarning("System codec does not report failure when it should. Should report bug upstream.");
+ QVERIFY(!encoder->hasFailure());
+ else if (encoder->hasFailure())
+ qWarning("System codec reports failure when it shouldn't. Should report bug upstream.");
}
QTEST_MAIN(tst_Utf8)
diff --git a/tests/auto/corelib/codecs/utf8/utf8data.cpp b/tests/auto/corelib/codecs/utf8/utf8data.cpp
index 2516cc9734..a41b0772e6 100644
--- a/tests/auto/corelib/codecs/utf8/utf8data.cpp
+++ b/tests/auto/corelib/codecs/utf8/utf8data.cpp
@@ -129,8 +129,8 @@ void loadInvalidUtf8Rows()
void loadNonCharactersRows()
{
- // Unicode has a couple of "non-characters" that one can use internally,
- // but are not allowed to be used for text interchange.
+ // Unicode has a couple of "non-characters" that one can use internally
+ // These characters are allowed for text-interchange (see http://www.unicode.org/versions/corrigendum9.html)
//
// Those are the last two entries each Unicode Plane (U+FFFE, U+FFFF,
// U+1FFFE, U+1FFFF, etc.) as well as the entries between U+FDD0 and
diff --git a/tests/auto/corelib/global/qlogging/app/main.cpp b/tests/auto/corelib/global/qlogging/app/main.cpp
index 14416a914d..621059caad 100644
--- a/tests/auto/corelib/global/qlogging/app/main.cpp
+++ b/tests/auto/corelib/global/qlogging/app/main.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include <QCoreApplication>
+#include <QLoggingCategory>
struct T {
T() { qDebug("static constructor"); }
@@ -57,6 +58,9 @@ int main(int argc, char **argv)
qWarning("qWarning");
qCritical("qCritical");
+ QLoggingCategory cat("category");
+ qCWarning(cat) << "qDebug with category";
+
qSetMessagePattern(QString());
qDebug("qDebug2");
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
index 94387704f6..31a4254344 100644
--- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
+++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
@@ -666,13 +666,14 @@ void tst_qmessagehandler::qMessagePattern()
// qDebug() << output;
QVERIFY(!output.isEmpty());
- QVERIFY(output.contains("debug 45 T::T static constructor"));
+ QVERIFY(output.contains("debug 46 T::T static constructor"));
// we can't be sure whether the QT_MESSAGE_PATTERN is already destructed
QVERIFY(output.contains("static destructor"));
- QVERIFY(output.contains("debug tst_qlogging 56 main qDebug"));
- QVERIFY(output.contains("warning tst_qlogging 57 main qWarning"));
- QVERIFY(output.contains("critical tst_qlogging 58 main qCritical"));
- QVERIFY(output.contains("debug tst_qlogging 62 main qDebug2"));
+ QVERIFY(output.contains("debug tst_qlogging 57 main qDebug"));
+ QVERIFY(output.contains("warning tst_qlogging 58 main qWarning"));
+ QVERIFY(output.contains("critical tst_qlogging 59 main qCritical"));
+ QVERIFY(output.contains("warning tst_qlogging 62 main qDebug with category "));
+ QVERIFY(output.contains("debug tst_qlogging 66 main qDebug2"));
environment = m_baseEnvironment;
environment.prepend("QT_MESSAGE_PATTERN=\"PREFIX: %{unknown} %{message}\"");
@@ -710,7 +711,8 @@ void tst_qmessagehandler::qMessagePattern()
QByteArray expected = "static constructor\n"
"[debug] qDebug\n"
"[warning] qWarning\n"
- "[critical] qCritical\n";
+ "[critical] qCritical\n"
+ "[warning] qDebug with category \n";
#ifdef Q_OS_WIN
output.replace("\r\n", "\n");
#endif
@@ -727,7 +729,7 @@ void tst_qmessagehandler::qMessagePatternIf()
const QString appExe = m_appDir + "/app";
QStringList environment = m_baseEnvironment;
- environment.prepend("QT_MESSAGE_PATTERN=\"[%{if-debug}D%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{message}\"");
+ environment.prepend("QT_MESSAGE_PATTERN=\"[%{if-debug}D%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{if-category}%{category}: %{endif}%{message}\"");
process.setEnvironment(environment);
process.start(appExe);
QVERIFY2(process.waitForStarted(), qPrintable(
@@ -745,6 +747,7 @@ void tst_qmessagehandler::qMessagePatternIf()
QVERIFY(output.contains("[D] qDebug"));
QVERIFY(output.contains("[W] qWarning"));
QVERIFY(output.contains("[C] qCritical"));
+ QVERIFY(output.contains("[W] category: qDebug with category"));
QVERIFY(output.contains("[D] qDebug2"));
//
diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro
index d70737a53f..11815c6160 100644
--- a/tests/auto/corelib/io/io.pro
+++ b/tests/auto/corelib/io/io.pro
@@ -38,6 +38,10 @@ SUBDIRS=\
qwinoverlappedionotifier
}
+!qtHaveModule(gui): SUBDIRS -= \
+ qdatastream \
+ qsettings
+
!qtHaveModule(network): SUBDIRS -= \
qfile \
qiodevice \
diff --git a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
index df93262d93..a49793c3d4 100644
--- a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
+++ b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
@@ -226,7 +226,7 @@ private slots:
void QLoggingCategory_categoryName()
{
logMessage.clear();
- QCOMPARE(QString::fromLatin1(QLoggingCategory::defaultCategory().categoryName()),
+ QCOMPARE(QString::fromLatin1(QLoggingCategory::defaultCategory()->categoryName()),
QStringLiteral("default"));
QLoggingCategory defaultCategory("default");
@@ -237,7 +237,7 @@ private slots:
QCOMPARE(QByteArray(nullCategory.categoryName()), QByteArray("default"));
// we rely on the same pointer for any "default" category
- QCOMPARE(QLoggingCategory::defaultCategory().categoryName(),
+ QCOMPARE(QLoggingCategory::defaultCategory()->categoryName(),
defaultCategory.categoryName());
QCOMPARE(defaultCategory.categoryName(),
nullCategory.categoryName());
@@ -256,12 +256,12 @@ private slots:
{
logMessage.clear();
- QCOMPARE(QLoggingCategory::defaultCategory().isDebugEnabled(), true);
- QCOMPARE(QLoggingCategory::defaultCategory().isEnabled(QtDebugMsg), true);
- QCOMPARE(QLoggingCategory::defaultCategory().isWarningEnabled(), true);
- QCOMPARE(QLoggingCategory::defaultCategory().isEnabled(QtWarningMsg), true);
- QCOMPARE(QLoggingCategory::defaultCategory().isCriticalEnabled(), true);
- QCOMPARE(QLoggingCategory::defaultCategory().isEnabled(QtCriticalMsg), true);
+ QCOMPARE(QLoggingCategory::defaultCategory()->isDebugEnabled(), true);
+ QCOMPARE(QLoggingCategory::defaultCategory()->isEnabled(QtDebugMsg), true);
+ QCOMPARE(QLoggingCategory::defaultCategory()->isWarningEnabled(), true);
+ QCOMPARE(QLoggingCategory::defaultCategory()->isEnabled(QtWarningMsg), true);
+ QCOMPARE(QLoggingCategory::defaultCategory()->isCriticalEnabled(), true);
+ QCOMPARE(QLoggingCategory::defaultCategory()->isEnabled(QtCriticalMsg), true);
QLoggingCategory defaultCategory("default");
QCOMPARE(defaultCategory.isDebugEnabled(), true);
@@ -287,11 +287,11 @@ private slots:
{
logMessage.clear();
- QCOMPARE(QLoggingCategory::defaultCategory().isDebugEnabled(), true);
+ QCOMPARE(QLoggingCategory::defaultCategory()->isDebugEnabled(), true);
- QLoggingCategory::defaultCategory().setEnabled(QtDebugMsg, false);
- QCOMPARE(QLoggingCategory::defaultCategory().isDebugEnabled(), false);
- QLoggingCategory::defaultCategory().setEnabled(QtDebugMsg, true);
+ QLoggingCategory::defaultCategory()->setEnabled(QtDebugMsg, false);
+ QCOMPARE(QLoggingCategory::defaultCategory()->isDebugEnabled(), false);
+ QLoggingCategory::defaultCategory()->setEnabled(QtDebugMsg, true);
// make sure nothing has printed warnings
QVERIFY(logMessage.isEmpty());
@@ -300,13 +300,13 @@ private slots:
void QLoggingCategory_installFilter()
{
- QVERIFY(QLoggingCategory::defaultCategory().isDebugEnabled());
+ QVERIFY(QLoggingCategory::defaultCategory()->isDebugEnabled());
QLoggingCategory::CategoryFilter defaultFilter =
QLoggingCategory::installFilter(customCategoryFilter);
QVERIFY(defaultFilter);
customCategoryFilterArgs.clear();
- QVERIFY(!QLoggingCategory::defaultCategory().isDebugEnabled());
+ QVERIFY(!QLoggingCategory::defaultCategory()->isDebugEnabled());
QLoggingCategory cat("custom");
QCOMPARE(customCategoryFilterArgs, QStringList() << "custom");
@@ -319,7 +319,7 @@ private slots:
QCOMPARE((void*)currentFilter, (void*)customCategoryFilter);
QCOMPARE(customCategoryFilterArgs.size(), 0);
- QVERIFY(QLoggingCategory::defaultCategory().isDebugEnabled());
+ QVERIFY(QLoggingCategory::defaultCategory()->isDebugEnabled());
QVERIFY(!cat.isDebugEnabled());
// install default filter
@@ -328,7 +328,7 @@ private slots:
QCOMPARE((void*)defaultFilter, (void*)currentFilter);
QCOMPARE(customCategoryFilterArgs.size(), 0);
- QVERIFY(QLoggingCategory::defaultCategory().isDebugEnabled());
+ QVERIFY(QLoggingCategory::defaultCategory()->isDebugEnabled());
QVERIFY(!cat.isDebugEnabled());
}
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index d9a0f51f3e..b020a50346 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -514,20 +514,20 @@ void tst_QSettings::ctor()
QSettings settings5(format, QSettings::UserScope, "SoftWare.ORG", "killerApp");
if (format == QSettings::NativeFormat) {
#if defined(Q_OS_WIN) || defined(Q_OS_DARWIN)
-# ifdef Q_OS_MACX
+# ifdef Q_OS_OSX
if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8)
QEXPECT_FAIL("native", "See QTBUG-32655", Continue);
-# endif // Q_OS_MACX
+# endif // Q_OS_OSX
QCOMPARE(settings5.value("key 1").toString(), QString("gurgle"));
#else
QVERIFY(!settings5.contains("key 1"));
#endif
} else {
#if defined(Q_OS_WIN) || defined(Q_OS_DARWIN)
-# ifdef Q_OS_MACX
+# ifdef Q_OS_OSX
if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8)
QEXPECT_FAIL("", "See QTBUG-32655", Continue);
-# endif // Q_OS_MACX
+# endif // Q_OS_OSX
QCOMPARE(settings5.value("key 1").toString(), QString("gurgle"));
#else
QVERIFY(!settings5.contains("key 1"));
@@ -3183,7 +3183,7 @@ void tst_QSettings::rainersSyncBugOnMac()
{
QSettings s3(format, QSettings::UserScope, "software.org", "KillerAPP");
-#ifdef Q_OS_MACX
+#ifdef Q_OS_OSX
if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8)
QEXPECT_FAIL("native", "See QTBUG-32655", Continue);
#endif
diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
index 75b17df759..d3a8bcfd13 100644
--- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
+++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
@@ -964,8 +964,10 @@ void tst_QUrlInternal::encodingRecode_data()
addUtf8Data("utf8-string-2", "\xDF\xBF\xE0\xA0\x80""A");
addUtf8Data("utf8-string-3", "\xE0\xA0\x80\xDF\xBF...");
+ QTest::newRow("encode-unicode-noncharacter") << QString(QChar(0xffff)) << F(QUrl::FullyEncoded) << "%EF%BF%BF";
+ QTest::newRow("decode-unicode-noncharacter") << QString(QChar(0xffff)) << F(QUrl::PrettyDecoded) << QString::fromUtf8("\xEF\xBF\xBF");
+
// special cases: stuff we can encode, but not decode
- QTest::newRow("unicode-noncharacter") << QString(QChar(0xffff)) << F(QUrl::FullyEncoded) << "%EF%BF%BF";
QTest::newRow("unicode-lo-surrogate") << QString(QChar(0xD800)) << F(QUrl::FullyEncoded) << "%ED%A0%80";
QTest::newRow("unicode-hi-surrogate") << QString(QChar(0xDC00)) << F(QUrl::FullyEncoded) << "%ED%B0%80";
@@ -1011,9 +1013,6 @@ void tst_QUrlInternal::encodingRecodeInvalidUtf8_data()
extern void loadInvalidUtf8Rows();
loadInvalidUtf8Rows();
- extern void loadNonCharactersRows();
- loadNonCharactersRows();
-
QTest::newRow("utf8-mix-4") << QByteArray("\xE0.A2\x80");
QTest::newRow("utf8-mix-5") << QByteArray("\xE0\xA2.80");
QTest::newRow("utf8-mix-6") << QByteArray("\xE0\xA2\x33");
diff --git a/tests/auto/corelib/itemmodels/itemmodels.pro b/tests/auto/corelib/itemmodels/itemmodels.pro
index 3f726692ff..7e0e3a0944 100644
--- a/tests/auto/corelib/itemmodels/itemmodels.pro
+++ b/tests/auto/corelib/itemmodels/itemmodels.pro
@@ -1,10 +1,12 @@
TEMPLATE=subdirs
SUBDIRS = qabstractitemmodel \
+ qstringlistmodel \
+
+qtHaveModule(gui): SUBDIRS += \
qabstractproxymodel \
qidentityproxymodel \
qitemselectionmodel \
- qstringlistmodel \
qtHaveModule(widgets): SUBDIRS += \
qitemmodel \
diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro b/tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro
index ef36f8d7fc..ef571de192 100644
--- a/tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro
+++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qabstractitemmodel
-QT += testlib
+QT = core testlib
mtdir = ../../../other/modeltest
INCLUDEPATH += $$PWD/$${mtdir}
diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp
index 9dbd6414ad..c79e7273c0 100644
--- a/tests/auto/corelib/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/json/tst_qtjson.cpp
@@ -47,7 +47,8 @@
#include "qjsondocument.h"
#include <limits>
-#define INVALID_UNICODE "\357\277\277" // "\uffff"
+#define INVALID_UNICODE "\xCE\xBA\xE1"
+#define UNICODE_NON_CHARACTER "\xEF\xBF\xBF"
#define UNICODE_DJE "\320\202" // Character from the Serbian Cyrillic alphabet
class tst_QtJson: public QObject
@@ -1306,6 +1307,19 @@ void tst_QtJson::fromJson()
QCOMPARE(doc.toJson(), json);
}
{
+ //regression test: test if unicode_control_characters are correctly decoded
+ QByteArray json = "[\n \"" UNICODE_NON_CHARACTER "\"\n]\n";
+ QJsonDocument doc = QJsonDocument::fromJson(json);
+ QVERIFY(!doc.isEmpty());
+ QCOMPARE(doc.isArray(), true);
+ QCOMPARE(doc.isObject(), false);
+ QJsonArray array = doc.array();
+ QCOMPARE(array.size(), 1);
+ QCOMPARE(array.at(0).type(), QJsonValue::String);
+ QCOMPARE(array.at(0).toString(), QString::fromUtf8(UNICODE_NON_CHARACTER));
+ QCOMPARE(doc.toJson(), json);
+ }
+ {
QByteArray json = "[]";
QJsonDocument doc = QJsonDocument::fromJson(json);
QVERIFY(!doc.isEmpty());
@@ -1532,7 +1546,7 @@ void tst_QtJson::fromJsonErrors()
QJsonDocument doc = QJsonDocument::fromJson(json, &error);
QVERIFY(doc.isEmpty());
QCOMPARE(error.error, QJsonParseError::IllegalUTF8String);
- QCOMPARE(error.offset, 13);
+ QCOMPARE(error.offset, 14);
}
{
QJsonParseError error;
@@ -1556,7 +1570,7 @@ void tst_QtJson::fromJsonErrors()
QJsonDocument doc = QJsonDocument::fromJson(json, &error);
QVERIFY(doc.isEmpty());
QCOMPARE(error.error, QJsonParseError::IllegalUTF8String);
- QCOMPARE(error.offset, 14);
+ QCOMPARE(error.offset, 15);
}
{
QJsonParseError error;
@@ -1702,6 +1716,7 @@ void tst_QtJson::parseStrings()
"abc\\tabc",
"abc\\u0019abc",
"abc" UNICODE_DJE "abc",
+ UNICODE_NON_CHARACTER
};
int size = sizeof(strings)/sizeof(const char *);
@@ -1728,7 +1743,8 @@ void tst_QtJson::parseStrings()
Pairs pairs [] = {
{ "abc\\/abc", "abc/abc" },
{ "abc\\u0402abc", "abc" UNICODE_DJE "abc" },
- { "abc\\u0065abc", "abceabc" }
+ { "abc\\u0065abc", "abceabc" },
+ { "abc\\uFFFFabc", "abc" UNICODE_NON_CHARACTER "abc" }
};
size = sizeof(pairs)/sizeof(Pairs);
diff --git a/tests/auto/corelib/kernel/kernel.pro b/tests/auto/corelib/kernel/kernel.pro
index 2f3c02332d..c1b867e6eb 100644
--- a/tests/auto/corelib/kernel/kernel.pro
+++ b/tests/auto/corelib/kernel/kernel.pro
@@ -21,6 +21,9 @@ SUBDIRS=\
qvariant \
qwineventnotifier
+!qtHaveModule(gui): SUBDIRS -= \
+ qmimedata
+
!qtHaveModule(network): SUBDIRS -= \
qeventloop \
qobject \
diff --git a/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro b/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro
index 0800b71c22..509ade6e2a 100644
--- a/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro
+++ b/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qmetaobject
-QT = core-private gui testlib
+QT = core-private testlib
SOURCES = tst_qmetaobject.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
index 4f1320e375..870e65f0cc 100644
--- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
@@ -43,7 +43,7 @@
#include <qobject.h>
#include <qmetaobject.h>
-#include <qwindow.h>
+#include <qabstractproxymodel.h>
#include <private/qmetaobject_p.h>
Q_DECLARE_METATYPE(const QMetaObject *)
@@ -746,13 +746,13 @@ void tst_QMetaObject::invokeBlockingQueuedMetaMember()
void tst_QMetaObject::qtMetaObjectInheritance()
{
QVERIFY(QObject::staticMetaObject.superClass() == 0);
- QCOMPARE(QWindow::staticMetaObject.indexOfEnumerator("Qt::ScreenOrientation"), -1);
- QCOMPARE(QWindow::staticMetaObject.indexOfEnumerator("ScreenOrientation"), -1);
- int indexOfContentOrientation = QWindow::staticMetaObject.indexOfProperty("contentOrientation");
- QVERIFY(indexOfContentOrientation != -1);
- QMetaProperty contentOrientation = QWindow::staticMetaObject.property(indexOfContentOrientation);
- QVERIFY(contentOrientation.isValid());
- QCOMPARE(contentOrientation.enumerator().name(), "ScreenOrientation");
+ QCOMPARE(QSortFilterProxyModel::staticMetaObject.indexOfEnumerator("Qt::CaseSensitivity"), -1);
+ QCOMPARE(QSortFilterProxyModel::staticMetaObject.indexOfEnumerator("CaseSensitivity"), -1);
+ int indexOfSortCaseSensitivity = QSortFilterProxyModel::staticMetaObject.indexOfProperty("sortCaseSensitivity");
+ QVERIFY(indexOfSortCaseSensitivity != -1);
+ QMetaProperty sortCaseSensitivity = QSortFilterProxyModel::staticMetaObject.property(indexOfSortCaseSensitivity);
+ QVERIFY(sortCaseSensitivity.isValid());
+ QCOMPARE(sortCaseSensitivity.enumerator().name(), "CaseSensitivity");
}
struct MyType
diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro b/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro
index 9e2d3519e6..68d3b48086 100644
--- a/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro
+++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro
@@ -1,6 +1,6 @@
CONFIG += testcase parallel_test
TARGET = tst_qmetaobjectbuilder
-QT = core-private gui-private testlib
+QT = core-private testlib
SOURCES = tst_qmetaobjectbuilder.cpp
mac:CONFIG -= app_bundle
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/kernel/qpointer/qpointer.pro b/tests/auto/corelib/kernel/qpointer/qpointer.pro
index 8786d07292..4b573cb6a5 100644
--- a/tests/auto/corelib/kernel/qpointer/qpointer.pro
+++ b/tests/auto/corelib/kernel/qpointer/qpointer.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qpointer
-QT += testlib
+QT = core testlib
qtHaveModule(widgets): QT += widgets
SOURCES = tst_qpointer.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro b/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro
index 59660d4b07..526db5eef3 100644
--- a/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro
+++ b/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qsignalmapper
-QT += testlib
+QT = core testlib
SOURCES = tst_qsignalmapper.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro
index 66fe844b21..2496cd2f1e 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro
@@ -1,4 +1,5 @@
TEMPLATE = lib
+QT = core
CONFIG += plugin
HEADERS = plugin1.h
SOURCES = plugin1.cpp
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro
index aec057e80c..e70ed4fb25 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro
@@ -1,4 +1,5 @@
TEMPLATE = lib
+QT = core
CONFIG += plugin
HEADERS = plugin2.h
SOURCES = plugin2.cpp
diff --git a/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro b/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro
index 9ce1ef3dcf..b2f7aaf2d3 100644
--- a/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro
+++ b/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro
@@ -1,4 +1,5 @@
SOURCES = main.cpp
+QT = core
CONFIG += console
DESTDIR = ./
diff --git a/tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro b/tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro
index b830efe3a5..f6fbbc83c6 100644
--- a/tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro
+++ b/tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qstatemachine
-QT = core-private testlib gui
+QT = core-private testlib
qtHaveModule(widgets): QT += widgets
SOURCES = tst_qstatemachine.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/tools/qbytedatabuffer/qbytedatabuffer.pro b/tests/auto/corelib/tools/qbytedatabuffer/qbytedatabuffer.pro
index 135b1ff8c4..e23018f96a 100644
--- a/tests/auto/corelib/tools/qbytedatabuffer/qbytedatabuffer.pro
+++ b/tests/auto/corelib/tools/qbytedatabuffer/qbytedatabuffer.pro
@@ -1,4 +1,4 @@
TARGET = tst_qbytedatabuffer
CONFIG += testcase
-QT += core-private testlib
+QT = core-private testlib
SOURCES += tst_qbytedatabuffer.cpp
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index ffc4baa55d..8c0f32bb74 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -150,6 +150,8 @@ private slots:
void daylightTransitions() const;
void timeZones() const;
+ void invalid() const;
+
private:
bool europeanTimeZone;
QDate defDate() const { return QDate(1900, 1, 1); }
@@ -779,7 +781,11 @@ void tst_QDateTime::toString_rfcDate()
QFETCH(QDateTime, dt);
QFETCH(QString, formatted);
+ // Set to non-English locale to confirm still uses English
+ QLocale oldLocale;
+ QLocale::setDefault(QLocale("de_DE"));
QCOMPARE(dt.toString(Qt::RFC2822Date), formatted);
+ QLocale::setDefault(oldLocale);
}
void tst_QDateTime::toString_enumformat()
@@ -2902,5 +2908,24 @@ void tst_QDateTime::timeZones() const
QCOMPARE(hourAfterStd.toMSecsSinceEpoch(), dstToStdMSecs + 3600000);
}
+void tst_QDateTime::invalid() const
+{
+ QDateTime invalidDate = QDateTime(QDate(0, 0, 0), QTime(-1, -1, -1));
+ QCOMPARE(invalidDate.isValid(), false);
+ QCOMPARE(invalidDate.timeSpec(), Qt::LocalTime);
+
+ QDateTime utcDate = invalidDate.toUTC();
+ QCOMPARE(utcDate.isValid(), false);
+ QCOMPARE(utcDate.timeSpec(), Qt::UTC);
+
+ QDateTime offsetDate = invalidDate.toOffsetFromUtc(3600);
+ QCOMPARE(offsetDate.isValid(), false);
+ QCOMPARE(offsetDate.timeSpec(), Qt::OffsetFromUTC);
+
+ QDateTime tzDate = invalidDate.toTimeZone(QTimeZone("Europe/Oslo"));
+ QCOMPARE(tzDate.isValid(), false);
+ QCOMPARE(tzDate.timeSpec(), Qt::TimeZone);
+}
+
QTEST_APPLESS_MAIN(tst_QDateTime)
#include "tst_qdatetime.moc"
diff --git a/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp b/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp
index d22e771b79..ec83740196 100644
--- a/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp
+++ b/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp
@@ -93,6 +93,12 @@ void tst_QMargins::operators()
a -= m2;
QCOMPARE(a, subtracted);
+ QMargins h = m1;
+ h += 2;
+ QCOMPARE(h, QMargins(14, 16, 18, 20));
+ h -= 2;
+ QCOMPARE(h, m1);
+
const QMargins doubled = m1 * 2;
QCOMPARE(doubled, QMargins(24, 28, 32, 36));
QCOMPARE(2 * m1, doubled);
diff --git a/tests/auto/corelib/tools/qtimezone/qtimezone.pro b/tests/auto/corelib/tools/qtimezone/qtimezone.pro
index 2c53100857..fa2397a6bb 100644
--- a/tests/auto/corelib/tools/qtimezone/qtimezone.pro
+++ b/tests/auto/corelib/tools/qtimezone/qtimezone.pro
@@ -1,6 +1,6 @@
CONFIG += testcase parallel_test
TARGET = tst_qtimezone
-QT += core-private testlib
+QT = core-private testlib
SOURCES = tst_qtimezone.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
contains(QT_CONFIG,icu) {
diff --git a/tests/auto/dbus/qdbusmarshall/qdbusmarshall.pro b/tests/auto/dbus/qdbusmarshall/qdbusmarshall.pro
index 0578433d58..dfbb206324 100644
--- a/tests/auto/dbus/qdbusmarshall/qdbusmarshall.pro
+++ b/tests/auto/dbus/qdbusmarshall/qdbusmarshall.pro
@@ -4,6 +4,6 @@ TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS = qpong test
-QT += core-private testlib
+QT = core-private testlib
requires(contains(QT_CONFIG,private_tests))
diff --git a/tests/auto/gui/kernel/qguivariant/test/data/qpolygonf.bin b/tests/auto/gui/kernel/qguivariant/test/data/qpolygonf.bin
new file mode 100644
index 0000000000..02e749b83f
--- /dev/null
+++ b/tests/auto/gui/kernel/qguivariant/test/data/qpolygonf.bin
Binary files differ
diff --git a/tests/auto/gui/kernel/qguivariant/test/qguivariant.qrc b/tests/auto/gui/kernel/qguivariant/test/qguivariant.qrc
new file mode 100644
index 0000000000..576d9cda1c
--- /dev/null
+++ b/tests/auto/gui/kernel/qguivariant/test/qguivariant.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>data</file>
+</qresource>
+</RCC>
diff --git a/tests/auto/gui/kernel/qguivariant/test/test.pro b/tests/auto/gui/kernel/qguivariant/test/test.pro
index 86ab17d9cd..c4123797d2 100644
--- a/tests/auto/gui/kernel/qguivariant/test/test.pro
+++ b/tests/auto/gui/kernel/qguivariant/test/test.pro
@@ -5,3 +5,4 @@ SOURCES += tst_qguivariant.cpp
RESOURCES = tst_qguivariant.qrc
INCLUDEPATH += $$PWD/../../../../other/qvariant_common
QT += testlib
+RESOURCES += qguivariant.qrc
diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
index d5ec9fcfaa..1220ce3b23 100644
--- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
+++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
@@ -114,6 +114,7 @@ private slots:
void writeToReadFromDataStream_data();
void writeToReadFromDataStream();
+ void writeToReadFromOldDataStream();
void colorInteger();
void invalidQColor();
@@ -527,6 +528,8 @@ void tst_QGuiVariant::writeToReadFromDataStream_data()
QTest::newRow( "pointarray_valid" ) << QVariant::fromValue( QPolygon( QRect( 10, 10, 20, 20 ) ) ) << false;
QTest::newRow( "region_invalid" ) << QVariant::fromValue( QRegion() ) << true;
QTest::newRow( "region_valid" ) << QVariant::fromValue( QRegion( 10, 10, 20, 20 ) ) << false;
+ QTest::newRow("polygonf_invalid") << QVariant::fromValue(QPolygonF()) << true;
+ QTest::newRow("polygonf_valid") << QVariant::fromValue(QPolygonF(QRectF(10, 10, 20, 20))) << false;
}
void tst_QGuiVariant::invalidQColor()
@@ -611,6 +614,46 @@ void tst_QGuiVariant::writeToReadFromDataStream()
}
}
+void tst_QGuiVariant::writeToReadFromOldDataStream()
+{
+ QPolygonF polyF(QRectF(10, 10, 50, 50));
+ QVariant testVariant(polyF);
+ {
+ // Read into a variant and compare
+ QFile file(":/data/qpolygonf.bin");
+ QVERIFY(file.open(QIODevice::ReadOnly));
+ QDataStream dataFileStream(&file);
+ dataFileStream.setVersion(QDataStream::Qt_4_9);
+ QVariant readVariant;
+ dataFileStream >> readVariant;
+ QVERIFY(readVariant.type() == QMetaType::QPolygonF);
+ QCOMPARE(testVariant, readVariant);
+ file.close();
+ }
+ {
+ QByteArray variantData;
+ {
+ QDataStream varDataStream(&variantData, QIODevice::WriteOnly);
+ varDataStream << testVariant;
+ }
+ // Read into a bytearray and compare
+ QFile file(":/data/qpolygonf.bin");
+ QVERIFY(file.open(QIODevice::ReadOnly));
+ QDataStream dataFileStream(&file);
+ dataFileStream.setVersion(QDataStream::Qt_4_9);
+ int dummy;
+ dataFileStream >> dummy;
+ QByteArray polyData49;
+ dataFileStream >> polyData49;
+ file.close();
+ QByteArray polyData50;
+ QDataStream readVarData(variantData);
+ readVarData >> dummy;
+ readVarData >> polyData50;
+ QVERIFY(polyData49 == polyData50);
+ }
+}
+
void tst_QGuiVariant::debugStream_data()
{
QTest::addColumn<QVariant>("variant");
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index 7ad7880330..c4983f4462 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -223,7 +223,7 @@ void tst_QWindow::positioning()
window.setWindowState(Qt::WindowFullScreen);
QCoreApplication::processEvents();
-#ifdef Q_OS_MACX
+#ifdef Q_OS_OSX
QEXPECT_FAIL("", "Multiple failures in this test on Mac OS X, see QTBUG-23059", Abort);
#endif
QTRY_COMPARE(window.received(QEvent::Resize), 2);
diff --git a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp
index 3f6eaae89b..3d2cde5fd3 100644
--- a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp
+++ b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp
@@ -502,10 +502,10 @@ void tst_QGlyphRun::drawMultiScriptText2()
drawGlyphs.save("drawMultiScriptText2_drawGlyphIndexes.png");
#endif
-#ifdef Q_OS_MACX
+#ifdef Q_OS_OSX
if (drawGlyphs.toImage() != textLayoutDraw.toImage())
QEXPECT_FAIL("", "See QTBUG-32690", Continue);
-#endif // Q_OS_MACX
+#endif // Q_OS_OSX
QCOMPARE(drawGlyphs, textLayoutDraw);
}
diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
index 10e79065ee..b065f537f7 100644
--- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
@@ -54,6 +54,7 @@
#include <qabstracttextdocumentlayout.h>
#include <qtextlist.h>
#include <qtextcodec.h>
+#include <qguiapplication.h>
#include <qurl.h>
#include <qpainter.h>
#include <qfontmetrics.h>
@@ -113,6 +114,7 @@ private slots:
void toHtmlBodyBgColorRgba();
void toHtmlBodyBgColorTransparent();
void toHtmlRootFrameProperties();
+ void toHtmlLineHeightProperties();
void capitalizationHtmlInExport();
void wordspacingHtmlExport();
@@ -186,6 +188,9 @@ private slots:
void QTBUG27354_spaceAndSoftSpace();
void cssInheritance();
+
+ void QTBUG28998_linkColor();
+
private:
void backgroundImage_checkExpectedHtml(const QTextDocument &doc);
@@ -1856,6 +1861,25 @@ void tst_QTextDocument::toHtmlRootFrameProperties()
QCOMPARE(doc.toHtml(), expectedOutput);
}
+void tst_QTextDocument::toHtmlLineHeightProperties()
+{
+ CREATE_DOC_AND_CURSOR();
+
+ QTextBlock block = doc.firstBlock();
+ QTextBlockFormat blockFormat = block.blockFormat();
+ blockFormat.setLineHeight(200, QTextBlockFormat::ProportionalHeight);
+ cursor.setBlockFormat(blockFormat);
+
+ cursor.insertText("Blah");
+ QString expectedOutput("<p DEFAULTBLOCKSTYLE line-height:200%;\">Blah</p>");
+
+ expectedOutput.prepend(htmlHead);
+ expectedOutput.replace("DEFAULTBLOCKSTYLE", "style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;");
+ expectedOutput.append(htmlTail);
+
+ QCOMPARE(doc.toHtml(), expectedOutput);
+}
+
void tst_QTextDocument::capitalizationHtmlInExport()
{
doc->setPlainText("Test");
@@ -2954,5 +2978,29 @@ void tst_QTextDocument::cssInheritance()
}
}
+void tst_QTextDocument::QTBUG28998_linkColor()
+{
+ QPalette pal;
+ pal.setColor(QPalette::Link, QColor("tomato"));
+ QGuiApplication::setPalette(pal);
+
+ QTextDocument doc;
+ doc.setHtml("<a href=\"http://www.qt-project.org\">Qt</a>");
+
+ QCOMPARE(doc.blockCount(), 1);
+ QTextBlock block = doc.firstBlock();
+ QVERIFY(block.isValid());
+
+ QTextFragment fragment = block.begin().fragment();
+ QVERIFY(fragment.isValid());
+
+ QTextCharFormat format = fragment.charFormat();
+ QVERIFY(format.isValid());
+ QVERIFY(format.isAnchor());
+ QCOMPARE(format.anchorHref(), QStringLiteral("http://www.qt-project.org"));
+
+ QCOMPARE(format.foreground(), pal.link());
+}
+
QTEST_MAIN(tst_QTextDocument)
#include "tst_qtextdocument.moc"
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 0e8d9fa2a3..2826c497df 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -7588,7 +7588,7 @@ void tst_QNetworkReply::backgroundRequestInterruption()
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.data()), original);
QVERIFY(reply->isFinished());
-#ifdef Q_OS_MACX
+#ifdef Q_OS_OSX
if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8)
QEXPECT_FAIL("ftp, bg, nobg", "See QTBUG-32435", Abort);
#endif
diff --git a/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
index 9e03884e4e..1271bf38ca 100644
--- a/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
+++ b/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
@@ -380,7 +380,7 @@ void tst_QNetworkProxyFactory::genericSystemProxy()
QFETCH(int, port);
// The generic system proxy is only available on the following platforms
-#if (!defined Q_OS_BLACKBERRY) && (!defined Q_OS_WIN) && (!defined Q_OS_MACX)
+#if (!defined Q_OS_BLACKBERRY) && (!defined Q_OS_WIN) && (!defined Q_OS_OSX)
qputenv(envVar, url);
const QList<QNetworkProxy> systemProxy = QNetworkProxyFactory::systemProxyForQuery();
QCOMPARE(systemProxy.size(), 1);
diff --git a/tests/auto/other/modeltest/modeltest.cpp b/tests/auto/other/modeltest/modeltest.cpp
index d356b26c54..a5233c4c3a 100644
--- a/tests/auto/other/modeltest/modeltest.cpp
+++ b/tests/auto/other/modeltest/modeltest.cpp
@@ -39,11 +39,9 @@
**
****************************************************************************/
-
-#include <QtGui/QtGui>
-
#include "modeltest.h"
+#include <QtCore/QtCore>
#include <QtTest/QtTest>
/*!
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index 092995c0aa..73bf4aab6a 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -3056,60 +3056,127 @@ void tst_QAccessibility::dockWidgetTest()
mw->setMenuBar(mb);
QDockWidget *dock1 = new QDockWidget(mw);
+ dock1->setWindowTitle("Dock 1");
mw->addDockWidget(Qt::LeftDockWidgetArea, dock1);
QPushButton *pb1 = new QPushButton(tr("Push me"), dock1);
dock1->setWidget(pb1);
QDockWidget *dock2 = new QDockWidget(mw);
+ dock2->setWindowTitle("Dock 2");
mw->addDockWidget(Qt::BottomDockWidgetArea, dock2);
QPushButton *pb2 = new QPushButton(tr("Push me"), dock2);
dock2->setWidget(pb2);
+ dock2->setFeatures(QDockWidget::DockWidgetClosable);
mw->resize(600,400);
mw->show();
-#if defined(Q_OS_UNIX)
- QCoreApplication::processEvents();
- QTest::qWait(100);
-#endif
+ QTest::qWaitForWindowExposed(mw);
QAccessibleInterface *accMainWindow = QAccessible::queryAccessibleInterface(mw);
// 4 children: menu bar, dock1, dock2, and central widget
QCOMPARE(accMainWindow->childCount(), 4);
QAccessibleInterface *accDock1 = 0;
+ QAccessibleInterface *accDock2 = 0;
for (int i = 0; i < 4; ++i) {
- accDock1 = accMainWindow->child(i);
- if (accMainWindow->role() == QAccessible::Window) {
- if (accDock1 && qobject_cast<QDockWidget*>(accDock1->object()) == dock1) {
- break;
- }
- }
+ QAccessibleInterface *child = accMainWindow->child(i);
+ if (child && child->object() == dock1)
+ accDock1 = child;
+ if (child && child->object() == dock2)
+ accDock2 = child;
}
+
+ // Dock widgets consist of
+ // 0 contents
+ // 1 close button
+ // 2 float button
QVERIFY(accDock1);
QCOMPARE(accDock1->role(), QAccessible::Window);
+ QCOMPARE(accDock1->text(QAccessible::Name), dock1->windowTitle());
+ QCOMPARE(accDock1->childCount(), 3);
+
+ QAccessibleInterface *dock1Widget = accDock1->child(0);
+ QCOMPARE(dock1Widget->role(), QAccessible::Button);
+ QCOMPARE(dock1Widget->text(QAccessible::Name), pb1->text());
+
+#ifdef Q_OS_MAC
+ QEXPECT_FAIL("", "Dock Widget geometry on Mac seems broken.", Continue);
+#endif
+ QVERIFY(accDock1->rect().contains(dock1Widget->rect()));
+ QCOMPARE(accDock1->indexOfChild(dock1Widget), 0);
+ QCOMPARE(dock1Widget->parent()->object(), dock1);
+
+ QAccessibleInterface *dock1Close = accDock1->child(1);
+ QCOMPARE(dock1Close->role(), QAccessible::Button);
+ QCOMPARE(dock1Close->text(QAccessible::Name), QDockWidget::tr("Close"));
+ QVERIFY(accDock1->rect().contains(dock1Close->rect()));
+ QCOMPARE(accDock1->indexOfChild(dock1Close), 1);
+ QCOMPARE(dock1Close->parent()->object(), dock1);
+
+ QAccessibleInterface *dock1Float = accDock1->child(2);
+ QCOMPARE(dock1Float->role(), QAccessible::Button);
+ QCOMPARE(dock1Float->text(QAccessible::Name), QDockWidget::tr("Float"));
+ QVERIFY(accDock1->rect().contains(dock1Float->rect()));
+ QCOMPARE(accDock1->indexOfChild(dock1Float), 2);
+ QVERIFY(!dock1Float->state().invisible);
+
+ QVERIFY(accDock2);
+ QCOMPARE(accDock2->role(), QAccessible::Window);
+ QCOMPARE(accDock2->text(QAccessible::Name), dock2->windowTitle());
+ QCOMPARE(accDock2->childCount(), 3);
+
+ QAccessibleInterface *dock2Widget = accDock2->child(0);
+ QCOMPARE(dock2Widget->role(), QAccessible::Button);
+ QCOMPARE(dock2Widget->text(QAccessible::Name), pb1->text());
+#ifdef Q_OS_MAC
+ QEXPECT_FAIL("", "Dock Widget geometry on Mac seems broken.", Continue);
+#endif
+ QVERIFY(accDock2->rect().contains(dock2Widget->rect()));
+ QCOMPARE(accDock2->indexOfChild(dock2Widget), 0);
+
+ QAccessibleInterface *dock2Close = accDock2->child(1);
+ QCOMPARE(dock2Close->role(), QAccessible::Button);
+ QCOMPARE(dock2Close->text(QAccessible::Name), QDockWidget::tr("Close"));
+ QVERIFY(accDock2->rect().contains(dock2Close->rect()));
+ QCOMPARE(accDock2->indexOfChild(dock2Close), 1);
+ QVERIFY(!dock2Close->state().invisible);
+
+ QAccessibleInterface *dock2Float = accDock2->child(2);
+ QCOMPARE(dock2Float->role(), QAccessible::Button);
+ QCOMPARE(dock2Float->text(QAccessible::Name), QDockWidget::tr("Float"));
+ QCOMPARE(accDock2->indexOfChild(dock2Float), 2);
+ QVERIFY(dock2Float->state().invisible);
+
+ QPoint buttonPoint = pb2->mapToGlobal(QPoint(pb2->width()/2, pb2->height()/2));
+ QAccessibleInterface *childAt = accDock2->childAt(buttonPoint.x(), buttonPoint.y());
+ QVERIFY(childAt);
+ QVERIFY(childAt->object() == pb2);
+
+ QWidget *close1 = qobject_cast<QWidget*>(dock1Close->object());
+ QPoint close1ButtonPoint = close1->mapToGlobal(QPoint(close1->width()/2, close1->height()/2));
+ QAccessibleInterface *childAt2 = accDock1->childAt(close1ButtonPoint.x(), close1ButtonPoint.y());
+ QVERIFY(childAt2);
+ QVERIFY(childAt2->object() == close1);
+
+ // custom title bar widget
+ QDockWidget *dock3 = new QDockWidget(mw);
+ dock3->setWindowTitle("Dock 3");
+ mw->addDockWidget(Qt::LeftDockWidgetArea, dock3);
+ QPushButton *pb3 = new QPushButton(tr("Push me"), dock3);
+ dock3->setWidget(pb3);
+ QLabel *titleLabel = new QLabel("I am a title widget");
+ dock3->setTitleBarWidget(titleLabel);
+
+ QAccessibleInterface *accDock3 = accMainWindow->child(4);
+ QVERIFY(accDock3);
+ QCOMPARE(accDock3->role(), QAccessible::Window);
+ QCOMPARE(accDock3->text(QAccessible::Name), dock3->windowTitle());
+ QCOMPARE(accDock3->childCount(), 2);
+ QAccessibleInterface *titleWidget = accDock3->child(1);
+ QVERIFY(titleWidget);
+ QCOMPARE(titleWidget->text(QAccessible::Name), titleLabel->text());
+ QAccessibleInterface *dock3Widget = accDock3->child(0);
+ QCOMPARE(dock3Widget->text(QAccessible::Name), pb3->text());
- QAccessibleInterface *dock1TitleBar = accDock1->child(0);
- QCOMPARE(dock1TitleBar->role(), QAccessible::TitleBar);
- QVERIFY(accDock1->rect().contains(dock1TitleBar->rect()));
-
- QPoint globalPos = dock1->mapToGlobal(QPoint(0,0));
- globalPos.rx()+=5; //### query style
- globalPos.ry()+=5;
- QAccessibleInterface *childAt = accDock1->childAt(globalPos.x(), globalPos.y()); //###
- QCOMPARE(childAt->role(), QAccessible::TitleBar);
- int index = accDock1->indexOfChild(childAt);
- QAccessibleInterface *accTitleBar = accDock1->child(index);
-
- QCOMPARE(accTitleBar->role(), QAccessible::TitleBar);
- QCOMPARE(accDock1->indexOfChild(accTitleBar), 0);
- QAccessibleInterface *acc;
- acc = accTitleBar->parent();
- QVERIFY(acc);
- QCOMPARE(acc->role(), QAccessible::Window);
-
- delete pb1;
- delete pb2;
- delete dock1;
- delete dock2;
delete mw;
QTestAccessibility::clearEvents();
#endif // QT_NO_DOCKWIDGET
@@ -3228,7 +3295,7 @@ void tst_QAccessibility::labelTest()
QCOMPARE(imageInterface->imageSize(), testPixmap.size());
QCOMPARE(imageInterface->imageDescription(), QString::fromLatin1("Test Description"));
const QPoint labelPos = imageLabel.mapToGlobal(QPoint(0,0));
- QCOMPARE(imageInterface->imagePosition().topLeft(), labelPos);
+ QCOMPARE(imageInterface->imagePosition(), labelPos);
QTestAccessibility::clearEvents();
}
diff --git a/tests/auto/testlib/selftests/cmptest/cmptest.pro b/tests/auto/testlib/selftests/cmptest/cmptest.pro
index a793c203dd..2d5dd071a9 100644
--- a/tests/auto/testlib/selftests/cmptest/cmptest.pro
+++ b/tests/auto/testlib/selftests/cmptest/cmptest.pro
@@ -1,5 +1,6 @@
SOURCES += tst_cmptest.cpp
-QT = core gui testlib
+QT = core testlib
+qtHaveModule(gui): QT += gui
mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
diff --git a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
index e9ad1778fa..9f8343b57a 100644
--- a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
+++ b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
@@ -42,8 +42,10 @@
#include <QtCore/QCoreApplication>
#include <QtTest/QtTest>
+#ifdef QT_GUI_LIB
#include <QtGui/QImage>
#include <QtGui/QPixmap>
+#endif
/* XPM test data for QPixmap, QImage tests (use drag cursors as example) */
@@ -138,10 +140,12 @@ private slots:
void compareQStringLists_data();
void compareQListInt();
void compareQListDouble();
+#ifdef QT_GUI_LIB
void compareQPixmaps();
void compareQPixmaps_data();
void compareQImages();
void compareQImages_data();
+#endif
};
static bool boolfunc() { return true; }
@@ -323,6 +327,7 @@ void tst_Cmptest::compareQListDouble()
QCOMPARE(double1, double2);
}
+#ifdef QT_GUI_LIB
void tst_Cmptest::compareQPixmaps_data()
{
QTest::addColumn<QPixmap>("opA");
@@ -374,6 +379,7 @@ void tst_Cmptest::compareQImages()
QCOMPARE(opA, opB);
}
+#endif
QTEST_MAIN(tst_Cmptest)
#include "tst_cmptest.moc"
diff --git a/tests/auto/tools/qmake/testdata/json/json.pro b/tests/auto/tools/qmake/testdata/json/json.pro
new file mode 100644
index 0000000000..33440b3209
--- /dev/null
+++ b/tests/auto/tools/qmake/testdata/json/json.pro
@@ -0,0 +1,26 @@
+jsontext = $$cat($$PWD/test.json)
+parseJson(jsontext, json)
+
+# print all keys
+message(json._KEYS_ $${json._KEYS_})
+
+# print array
+message(json.array._KEYS_ $${json.array._KEYS_})
+for(key, json.array._KEYS_): \
+ message(json.array.$${key} $$eval(json.array.$${key}))
+
+# print object
+message(json.object._KEYS_ $${json.object._KEYS_})
+for(key, json.object._KEYS_): \
+ message(json.object.$${key} $$eval(json.object.$${key}))
+
+# print value tyes
+message(json.string: $${json.string})
+message(json.number: $${json.number})
+message(json.true: $${json.true})
+message(json.false: $${json.false})
+message(json.null: $${json.null})
+
+# check that booleans work
+$${json.true}: message(json.true is true)
+!$${json.false}: message(json.false is false)
diff --git a/tests/auto/tools/qmake/testdata/json/test.json b/tests/auto/tools/qmake/testdata/json/test.json
new file mode 100644
index 0000000000..cc82908eba
--- /dev/null
+++ b/tests/auto/tools/qmake/testdata/json/test.json
@@ -0,0 +1,9 @@
+{
+ "array" : ["arrayItem1", "arrayItem2", "arrayItem3"],
+ "object" : { "key1" : "objectValue1", "key2" : "objectValue2" },
+ "string" : "test string",
+ "number" : 999,
+ "true" : true,
+ "false" :false,
+ "null" : null
+}
diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp
index cf5c75a66b..87e86406b8 100644
--- a/tests/auto/tools/qmake/tst_qmake.cpp
+++ b/tests/auto/tools/qmake/tst_qmake.cpp
@@ -92,6 +92,7 @@ private slots:
void substitutes();
void project();
void proFileCache();
+ void json();
private:
TestCompiler test_compiler;
@@ -556,5 +557,33 @@ void tst_qmake::proFileCache()
QVERIFY( test_compiler.qmake( workDir, "pro_file_cache" ));
}
+void tst_qmake::json()
+{
+ QString workDir = base_path + "/testdata/json";
+ QVERIFY( test_compiler.qmake( workDir, "json.pro" ));
+ QString output = test_compiler.commandOutput();
+
+ // all keys
+ QVERIFY(output.contains("json._KEYS_ array false null number object string true"));
+ // array
+ QVERIFY(output.contains("json.array._KEYS_ 0 1 2"));
+ QVERIFY(output.contains("json.array.0 arrayItem1"));
+ QVERIFY(output.contains("json.array.1 arrayItem2"));
+ QVERIFY(output.contains("json.array.2 arrayItem3"));
+ // object
+ QVERIFY(output.contains("json.object._KEYS_ key1 key2"));
+ QVERIFY(output.contains("json.object.key1 objectValue1"));
+ QVERIFY(output.contains("json.object.key1 objectValue1"));
+ // value types
+ QVERIFY(output.contains("json.string: test string"));
+ QVERIFY(output.contains("json.number: 999"));
+ QVERIFY(output.contains("json.true: true"));
+ QVERIFY(output.contains("json.false: false"));
+ QVERIFY(output.contains("json.null:"));
+ // functional booleans
+ QVERIFY(output.contains("json.true is true"));
+ QVERIFY(output.contains("json.false is false"));
+}
+
QTEST_MAIN(tst_qmake)
#include "tst_qmake.moc"
diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
index 81b69f6b89..8bad4bb176 100644
--- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
@@ -66,6 +66,8 @@
#include <private/qfilesystemmodel_p.h>
#include <private/qfiledialog_p.h>
#endif
+#include <private/qguiapplication_p.h>
+#include <qpa/qplatformtheme.h>
#include <QFileDialog>
#include <QFileSystemModel>
@@ -145,6 +147,7 @@ private slots:
void clearLineEdit();
void enableChooseButton();
void hooks();
+ void widgetlessNativeDialog();
#ifdef Q_OS_UNIX
#ifdef QT_BUILD_INTERNAL
void tildeExpansion_data();
@@ -1396,6 +1399,20 @@ void tst_QFiledialog::hooks()
QCOMPARE(QFileDialog::getSaveFileUrl(), QUrl("http://saveUrl"));
}
+void tst_QFiledialog::widgetlessNativeDialog()
+{
+ if (!QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::FileDialog))
+ QSKIP("This platform always uses widgets to realize its QFileDialog, instead of the native file dialog.");
+ QFileDialog fd;
+ fd.setWindowModality(Qt::ApplicationModal);
+ fd.show();
+ QTRY_VERIFY(fd.isVisible());
+ QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model");
+ QVERIFY(!model);
+ QPushButton *button = fd.findChild<QPushButton*>();
+ QVERIFY(!button);
+}
+
#ifdef Q_OS_UNIX
#ifdef QT_BUILD_INTERNAL
void tst_QFiledialog::tildeExpansion_data()
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index e24a1dfc96..816d375b97 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -115,6 +115,7 @@ private slots:
void sort();
void mkdir();
+ void deleteFile();
void caseSensitivity();
@@ -934,6 +935,25 @@ void tst_QFileSystemModel::mkdir()
QCOMPARE(oldRow, idx.row());
}
+void tst_QFileSystemModel::deleteFile()
+{
+ QString newFilePath = QDir::temp().filePath("NewFileDeleteTest");
+ QFile newFile(newFilePath);
+ if (newFile.exists()) {
+ if (!newFile.remove())
+ qWarning() << "unable to remove" << newFilePath;
+ QTest::qWait(WAITTIME);
+ }
+ if (!newFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
+ qWarning() << "unable to create" << newFilePath;
+ }
+ newFile.close();
+ QModelIndex idx = model->index(newFilePath);
+ QVERIFY(idx.isValid());
+ QVERIFY(model->remove(idx));
+ QVERIFY(!newFile.exists());
+}
+
void tst_QFileSystemModel::caseSensitivity()
{
QString tmp = flatDirTestPath;
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
index c240b5eb35..4506d0af14 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
@@ -439,7 +439,7 @@ void tst_QWizard::setPixmap()
QVERIFY(wizard.pixmap(QWizard::BannerPixmap).isNull());
QVERIFY(wizard.pixmap(QWizard::LogoPixmap).isNull());
QVERIFY(wizard.pixmap(QWizard::WatermarkPixmap).isNull());
-#ifdef Q_OS_MACX
+#ifdef Q_OS_OSX
QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull() == false);
#else
QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull());
@@ -448,7 +448,7 @@ void tst_QWizard::setPixmap()
QVERIFY(page->pixmap(QWizard::BannerPixmap).isNull());
QVERIFY(page->pixmap(QWizard::LogoPixmap).isNull());
QVERIFY(page->pixmap(QWizard::WatermarkPixmap).isNull());
-#ifdef Q_OS_MACX
+#ifdef Q_OS_OSX
QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull() == false);
#else
QVERIFY(page->pixmap(QWizard::BackgroundPixmap).isNull());
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 70cfbc8856..4f25aab32a 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -5089,6 +5089,10 @@ public:
void tst_QGraphicsItem::paint()
{
+#ifdef Q_OS_MACX
+ if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_7)
+ QSKIP("QTBUG-31454 - Unstable auto-test");
+#endif
QGraphicsScene scene;
PaintTester paintTester;
diff --git a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
index 2d9cb98e27..c17a03e058 100644
--- a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
+++ b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
@@ -68,8 +68,6 @@ public:
int numberOfObscures;
};
-
-
class tst_QWindowContainer: public QObject
{
Q_OBJECT
@@ -81,6 +79,7 @@ private slots:
void testBehindTheScenesDeletion();
void testUnparenting();
void testActivation();
+ void testAncestorChange();
};
@@ -188,6 +187,7 @@ void tst_QWindowContainer::testActivation()
root.show();
root.activateWindow();
+ QVERIFY(QTest::qWaitForWindowExposed(&root));
QVERIFY(QTest::qWaitForWindowActive(root.windowHandle()));
QVERIFY(QGuiApplication::focusWindow() == root.windowHandle());
@@ -204,8 +204,7 @@ void tst_QWindowContainer::testActivation()
QTest::qWait(100);
window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
- QVERIFY(QGuiApplication::focusWindow() == window);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == window);
// Verify that all states in the root widget still indicate it is active
QVERIFY(root.windowHandle()->isActive());
@@ -231,6 +230,61 @@ void tst_QWindowContainer::testUnparenting()
QVERIFY(!window->isVisible());
}
+void tst_QWindowContainer::testAncestorChange()
+{
+ QWidget root;
+ QWidget *left = new QWidget(&root);
+ QWidget *right = new QWidget(&root);
+
+ root.setGeometry(0, 0, 200, 100);
+ left->setGeometry(0, 0, 100, 100);
+ right->setGeometry(100, 0, 100, 100);
+
+ QWindow *window = new QWindow();
+ QWidget *container = QWidget::createWindowContainer(window, left);
+ container->setGeometry(0, 0, 100, 100);
+
+ // Root
+ // + left
+ // | + container
+ // | + window
+ // + right
+ root.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&root));
+ QCOMPARE(window->geometry(), QRect(0, 0, 100, 100));
+
+ container->setParent(right);
+ // Root
+ // + left
+ // + right
+ // + container
+ // + window
+ QCOMPARE(window->geometry(), QRect(100, 0, 100, 100));
+
+ QWidget *newRoot = new QWidget(&root);
+ newRoot->setGeometry(50, 50, 200, 200);
+ right->setParent(newRoot);
+ // Root
+ // + left
+ // + newRoot
+ // + right
+ // + container
+ // + window
+ QCOMPARE(window->geometry(), QRect(150, 50, 100, 100));
+ newRoot->move(0, 0);
+ QCOMPARE(window->geometry(), QRect(100, 0, 100, 100));
+
+ newRoot->setParent(0);
+ newRoot->setGeometry(100, 100, 200, 200);
+ newRoot->show();
+ QVERIFY(QTest::qWaitForWindowExposed(newRoot));
+ // newRoot
+ // + right
+ // + container
+ // + window
+ QCOMPARE(window->geometry(), QRect(100, 0, 100, 100));
+}
+
QTEST_MAIN(tst_QWindowContainer)
#include "tst_qwindowcontainer.moc"
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index 4631154230..eabb7aaa17 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -2587,6 +2587,18 @@ void tst_QComboBox::resetModel()
}
+static inline void centerCursor(const QWidget *w)
+{
+#ifndef QT_NO_CURSOR
+ // Force cursor movement to prevent QCursor::setPos() from returning prematurely on QPA:
+ const QPoint target(w->mapToGlobal(w->rect().center()));
+ QCursor::setPos(QPoint(target.x() + 1, target.y()));
+ QCursor::setPos(target);
+#else // !QT_NO_CURSOR
+ Q_UNUSED(w)
+#endif
+}
+
void tst_QComboBox::keyBoardNavigationWithMouse()
{
QComboBox combo;
@@ -2597,6 +2609,7 @@ void tst_QComboBox::keyBoardNavigationWithMouse()
combo.addItem( QString::number(i));
combo.show();
+ centerCursor(&combo); // QTBUG-33973, cursor needs to be within view from start on Mac.
QApplication::setActiveWindow(&combo);
QVERIFY(QTest::qWaitForWindowActive(&combo));
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&combo));
@@ -2617,10 +2630,7 @@ void tst_QComboBox::keyBoardNavigationWithMouse()
// When calling cursor function, Windows CE responds with: This function is not supported on this system.
#ifndef Q_OS_WINCE
// Force cursor movement to prevent QCursor::setPos() from returning prematurely on QPA:
- const QPoint target(combo.view()->mapToGlobal(combo.view()->rect().center()));
- QCursor::setPos(QPoint(target.x() + 1, target.y()));
- QCursor::setPos(target);
-
+ centerCursor(combo.view());
QTest::qWait(200);
#define GET_SELECTION(SEL) \
@@ -2632,7 +2642,7 @@ void tst_QComboBox::keyBoardNavigationWithMouse()
GET_SELECTION(selection);
//since we moved the mouse is in the middle it should even be around 5;
- QVERIFY(selection > 3);
+ QVERIFY2(selection > 3, (QByteArrayLiteral("selection=") + QByteArray::number(selection)).constData());
static const int final = 40;
for (int i = selection + 1; i <= final; i++)
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 3c32b8a476..7c1bb957d6 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -764,14 +764,20 @@ void tst_QMenu::task258920_mouseBorder()
menu.setMouseTracking(true);
QAction *action = menu.addAction("test");
- menu.popup(QApplication::desktop()->availableGeometry().center());
+ const QPoint center = QApplication::desktop()->availableGeometry().center();
+#ifndef QT_NO_CURSOR
+ QCursor::setPos(center - QPoint(100, 100)); // Mac: Ensure cursor is outside
+#endif
+ menu.popup(center);
QVERIFY(QTest::qWaitForWindowExposed(&menu));
QTest::qWait(100);
QRect actionRect = menu.actionGeometry(action);
- QTest::mouseMove(&menu, actionRect.center());
+ const QPoint actionCenter = actionRect.center();
+ QTest::mouseMove(&menu, actionCenter - QPoint(-10, 0));
QTest::qWait(30);
- QTest::mouseMove(&menu, actionRect.center() + QPoint(10, 0));
+ QTest::mouseMove(&menu, actionCenter);
QTest::qWait(30);
+ QTest::mouseMove(&menu, actionCenter + QPoint(10, 0));
QTRY_COMPARE(action, menu.activeAction());
menu.painted = false;
QTest::mouseMove(&menu, QPoint(actionRect.center().x(), actionRect.bottom() + 1));
diff --git a/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp b/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp
index 3bdf583153..a301d51c4c 100644
--- a/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp
+++ b/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp
@@ -74,6 +74,7 @@ private slots:
void task194017_hiddenWidget();
void QTBUG4334_hiddenOnMaximizedWindow();
void QTBUG25492_msgtimeout();
+ void messageChangedSignal();
private:
QStatusBar *testWidget;
@@ -95,6 +96,8 @@ void tst_QStatusBar::init()
QWidget *item1 = new QWidget(testWidget);
testWidget->addWidget(item1);
+ // currentMessage needs to be null as the code relies on this
+ currentMessage = QString();
}
void tst_QStatusBar::cleanup()
@@ -316,6 +319,30 @@ void tst_QStatusBar::QTBUG25492_msgtimeout()
QCOMPARE(testWidget->currentMessage(), currentMessage);
}
+void tst_QStatusBar::messageChangedSignal()
+{
+ QVERIFY(testWidget->currentMessage().isNull());
+ QVERIFY(currentMessage.isNull());
+ testWidget->show();
+
+ QSignalSpy spy(testWidget, SIGNAL(messageChanged(QString)));
+ testWidget->showMessage("Ready", 0);
+ QCOMPARE(testWidget->currentMessage(), QString("Ready"));
+ QCOMPARE(testWidget->currentMessage(), currentMessage);
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.takeFirst().at(0).toString(), currentMessage);
+ testWidget->clearMessage();
+ QCOMPARE(testWidget->currentMessage(), QString());
+ QCOMPARE(testWidget->currentMessage(), currentMessage);
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.takeFirst().at(0).toString(), currentMessage);
+ testWidget->showMessage("Ready", 0);
+ testWidget->showMessage("Ready", 0);
+ QCOMPARE(testWidget->currentMessage(), QString("Ready"));
+ QCOMPARE(testWidget->currentMessage(), currentMessage);
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.takeFirst().at(0).toString(), currentMessage);
+}
QTEST_MAIN(tst_QStatusBar)
#include "tst_qstatusbar.moc"
diff --git a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp
index d4c0ff44ca..f09fbff6c4 100644
--- a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp
+++ b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp
@@ -315,9 +315,7 @@ void tst_QXmlSimpleReader::testGoodXmlFile()
QVERIFY(file.open(QIODevice::ReadOnly));
Parser parser;
-// static int i = 0;
-// qWarning("Test nr: " + QString::number(i)); ++i;
- QEXPECT_FAIL("xmldocs/valid/sa/089.xml", "", Continue);
+ QEXPECT_FAIL("xmldocs/valid/sa/089.xml", "a form feed character is not accepted in XML", Continue);
QVERIFY(parser.parseFile(&file));
QFile ref_file(file_name + ".ref");
@@ -326,7 +324,6 @@ void tst_QXmlSimpleReader::testGoodXmlFile()
ref_stream.setCodec("UTF-8");
QString ref_file_contents = ref_stream.readAll();
- QEXPECT_FAIL("xmldocs/valid/sa/089.xml", "", Continue);
QCOMPARE(parser.result(), ref_file_contents);
}
@@ -355,53 +352,46 @@ void tst_QXmlSimpleReader::testBadXmlFile()
QVERIFY(file.open(QIODevice::ReadOnly));
Parser parser;
-// static int i = 0;
-// qWarning("Test nr: " + QString::number(++i));
- QEXPECT_FAIL("xmldocs/not-wf/sa/030.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/031.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/032.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/033.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/038.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/072.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/073.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/074.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/076.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/077.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/078.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/085.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/086.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/087.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/101.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/102.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/104.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/116.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/117.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/119.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/122.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/132.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/142.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/143.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/144.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/145.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/146.xml", "", Abort);
- QEXPECT_FAIL("xmldocs/not-wf/sa/160.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/162.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/166.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/167.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/168.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/169.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/170.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/171.xml", "", Abort);
- QEXPECT_FAIL("xmldocs/not-wf/sa/172.xml", "", Abort);
- QEXPECT_FAIL("xmldocs/not-wf/sa/173.xml", "", Abort);
- QEXPECT_FAIL("xmldocs/not-wf/sa/174.xml", "", Abort);
- QEXPECT_FAIL("xmldocs/not-wf/sa/175.xml", "", Abort);
- QEXPECT_FAIL("xmldocs/not-wf/sa/177.xml", "", Abort);
- QEXPECT_FAIL("xmldocs/not-wf/sa/180.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/181.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/182.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/185.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/186.xml", "", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/030.xml", "a form feed character is not accepted in XML", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/031.xml", "a form feed character is not accepted in a processing instruction", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/032.xml", "a form feed character is not accepted in a comment", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/033.xml", "overlong sequence - small latin letter d should be rejected", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/038.xml", "attribute x redefined; should be rejected", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/072.xml", "entity foo not defined", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/073.xml", "entity f not defined", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/074.xml", "entity e is not well-formed (</foo><foo>)", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/076.xml", "entity foo is not defined", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/077.xml", "entity bar is not defined within the definition of entity foo", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/078.xml", "entity foo not defined", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/085.xml", "Unfinished Public or System Id", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/086.xml", "Unfinished Public or System Id", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/087.xml", "Unfinished Public or System Id", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/101.xml", "Invalid XML encoding name (space before utf-8)", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/102.xml", "Invalid version specification (1.0 followed by space)", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/104.xml", "Premature end of data in tag foo", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/116.xml", "Invalid decimal value", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/117.xml", "No name", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/119.xml", "No name", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/122.xml", "; expected in declaration of element", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/132.xml", "; expected in declaration of element", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/142.xml", "Invalid value '0'", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/143.xml", "Invalid value '31'", Continue);
+
+ QEXPECT_FAIL("xmldocs/not-wf/sa/144.xml", "noncharacter code 0xFFFF should be rejected", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/145.xml", "surrogate code point 0xD800 should be rejected", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/146.xml", "code point out-of-range 0x110000 (must be < 0x10FFFE)", Abort);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/160.xml", "Parameter references forbidden in internal subset", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/162.xml", "Parameter references forbidden in internal subset", Continue);
+
+ QEXPECT_FAIL("xmldocs/not-wf/sa/168.xml", "Surrogate code point 0xEDA080 should be rejected", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/169.xml", "Surrogate code point 0xEDB080 should be rejected", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/170.xml", "Code point 0xF7808080 should be rejected", Continue);
+
+ QEXPECT_FAIL("xmldocs/not-wf/sa/180.xml", "Entity e is not defined", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/181.xml", "Unregistered error message", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/182.xml", "Comment not terminated", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/185.xml", "Entity e not defined", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/186.xml", "Attributes constructs error", Continue);
QVERIFY(!parser.parseFile(&file));
@@ -411,12 +401,7 @@ void tst_QXmlSimpleReader::testBadXmlFile()
ref_stream.setCodec("UTF-8");
QString ref_file_contents = ref_stream.readAll();
- QEXPECT_FAIL("xmldocs/not-wf/sa/144.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/145.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/146.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/167.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/166.xml", "", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/170.xml", "", Continue);
+ QEXPECT_FAIL("xmldocs/not-wf/sa/145.xml", "Surrogate code point 0xD800 should be rejected", Continue);
QCOMPARE(parser.result(), ref_file_contents);
}
diff --git a/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/170.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/170.xml.ref
index 0508ee88c7..eca786f688 100644
--- a/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/170.xml.ref
+++ b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/170.xml.ref
@@ -1,6 +1,6 @@
setDocumentLocator(locator={columnNumber=1, lineNumber=1})
startDocument()
startElement(namespaceURI="", localName="doc", qName="doc", atts=[])
- characters(ch="í»€í°€")
+ characters(ch="�")
endElement(namespaceURI="", localName="doc", qName="doc")
endDocument()
diff --git a/tests/benchmarks/corelib/tools/qstring/main.cpp b/tests/benchmarks/corelib/tools/qstring/main.cpp
index 67ed4c32b9..6101cfe8fb 100644
--- a/tests/benchmarks/corelib/tools/qstring/main.cpp
+++ b/tests/benchmarks/corelib/tools/qstring/main.cpp
@@ -1980,16 +1980,15 @@ int fromUtf8_qt47(ushort *dst, const char *chars, int len)
--need;
if (!need) {
// utf-8 bom composes into 0xfeff code point
- bool nonCharacter;
if (!headerdone && uc == 0xfeff) {
// don't do anything, just skip the BOM
- } else if (!(nonCharacter = QChar::isNonCharacter(uc)) && QChar::requiresSurrogates(uc) && uc <= QChar::LastValidCodePoint) {
+ } else if (QChar::requiresSurrogates(uc) && uc <= QChar::LastValidCodePoint) {
// surrogate pair
//Q_ASSERT((qch - (ushort*)result.unicode()) + 2 < result.length());
*qch++ = QChar::highSurrogate(uc);
*qch++ = QChar::lowSurrogate(uc);
- } else if ((uc < min_uc) || QChar::isSurrogate(uc) || nonCharacter || uc > QChar::LastValidCodePoint) {
- // error: overlong sequence, UTF16 surrogate or non-character
+ } else if ((uc < min_uc) || QChar::isSurrogate(uc) || uc > QChar::LastValidCodePoint) {
+ // error: overlong sequence or UTF16 surrogate
*qch++ = replacement;
++invalid;
} else {
@@ -2086,16 +2085,15 @@ int fromUtf8_qt47_stateless(ushort *dst, const char *chars, int len)
--need;
if (!need) {
// utf-8 bom composes into 0xfeff code point
- bool nonCharacter;
if (!headerdone && uc == 0xfeff) {
// don't do anything, just skip the BOM
- } else if (!(nonCharacter = QChar::isNonCharacter(uc)) && QChar::requiresSurrogates(uc) && uc <= QChar::LastValidCodePoint) {
+ } else if (QChar::requiresSurrogates(uc) && uc <= QChar::LastValidCodePoint) {
// surrogate pair
//Q_ASSERT((qch - (ushort*)result.unicode()) + 2 < result.length());
*qch++ = QChar::highSurrogate(uc);
*qch++ = QChar::lowSurrogate(uc);
- } else if ((uc < min_uc) || QChar::isSurrogate(uc) || nonCharacter || uc > QChar::LastValidCodePoint) {
- // error: overlong sequence, UTF16 surrogate or non-character
+ } else if ((uc < min_uc) || QChar::isSurrogate(uc) || uc > QChar::LastValidCodePoint) {
+ // error: overlong sequence or UTF16 surrogate
*qch++ = replacement;
++invalid;
} else {
@@ -2214,7 +2212,7 @@ static inline void extract_utf8_multibyte(ushort *&dst, const char *&chars, qptr
chars += 2;
len -= 2;
if (!trusted &&
- (ucs < 0x800 || QChar::isNonCharacter(ucs) || QChar::isSurrogate(ucs)))
+ (ucs < 0x800 || QChar::isSurrogate(ucs)))
dst[counter] = QChar::ReplacementCharacter;
else
dst[counter] = ucs;
@@ -2245,7 +2243,7 @@ static inline void extract_utf8_multibyte(ushort *&dst, const char *&chars, qptr
// dst[counter] will correspond to chars[counter..counter+2], so adjust
chars += 3;
len -= 3;
- if (trusted || (QChar::requiresSurrogates(ucs) && ucs <= QChar::LastValidCodePoint && !QChar::isNonCharacter(ucs))) {
+ if (trusted || (QChar::requiresSurrogates(ucs) && ucs <= QChar::LastValidCodePoint)) {
dst[counter + 0] = QChar::highSurrogate(ucs);
dst[counter + 1] = QChar::lowSurrogate(ucs);
counter += 2;