summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rwxr-xr-xtests/auto/android/runtests_androiddeployqt.pl176
-rw-r--r--tests/auto/cmake/test_opengl_lib/CMakeLists.txt4
-rw-r--r--tests/auto/cmake/test_opengl_lib/main.cpp4
-rw-r--r--tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp42
-rw-r--r--tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp9
-rw-r--r--tests/auto/corelib/kernel/kernel.pro1
-rw-r--r--tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp15
-rw-r--r--tests/auto/corelib/tools/qlist/tst_qlist.cpp28
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp9
-rw-r--r--tests/auto/corelib/tools/qstringref/tst_qstringref.cpp48
-rw-r--r--tests/auto/corelib/tools/qvector/tst_qvector.cpp1
-rw-r--r--tests/auto/gui/gui.pro2
-rw-r--r--tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp4
-rw-r--r--tests/auto/gui/painting/qpagesize/tst_qpagesize.cpp3
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp67
-rw-r--r--tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp67
-rw-r--r--tests/auto/opengl/qgl/tst_qgl.cpp30
-rw-r--r--tests/auto/other/lancelot/paintcommands.cpp11
-rw-r--r--tests/auto/other/other.pro2
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp42
-rw-r--r--tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp13
-rw-r--r--tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h6
-rw-r--r--tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm107
-rw-r--r--tests/auto/other/qcomplextext/qcomplextext.pro2
-rw-r--r--tests/auto/other/qcomplextext/tst_qcomplextext.cpp41
-rw-r--r--tests/auto/sql/kernel/qsql/tst_qsql.cpp11
-rw-r--r--tests/auto/sql/kernel/qsqldatabase/tst_databases.h34
-rw-r--r--tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp5
-rw-r--r--tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp4
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp4
-rw-r--r--tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp4
-rw-r--r--tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp4
-rw-r--r--tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp4
-rw-r--r--tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp5
-rw-r--r--tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp4
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp35
-rw-r--r--tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp14
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp6
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp31
-rw-r--r--tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp17
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp8
-rw-r--r--tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp8
-rw-r--r--tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp5
-rw-r--r--tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp4
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp13
-rw-r--r--tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp2
-rw-r--r--tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp13
-rw-r--r--tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp16
48 files changed, 838 insertions, 147 deletions
diff --git a/tests/auto/android/runtests_androiddeployqt.pl b/tests/auto/android/runtests_androiddeployqt.pl
index 3d57dcfd65..c949e1cf87 100755
--- a/tests/auto/android/runtests_androiddeployqt.pl
+++ b/tests/auto/android/runtests_androiddeployqt.pl
@@ -68,9 +68,18 @@ 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`;
+my $silent = 0;
chomp $ant_tool;
my $strip_tool="";
my $readelf_tool="";
+# for ci usage
+my @failures = '';
+my $total_tests = 0;
+my $total_failed = 0;
+my $failed_insignificants = 0;
+my $ci_use = 0;
+my $start = time();
+
GetOptions('h|help' => \$help
, man => \$man
, 's|serial=s' => \$device_serial
@@ -87,10 +96,15 @@ GetOptions('h|help' => \$help
, 'strip=s' => \$strip_tool
, 'readelf=s' => \$readelf_tool
, 'testcase=s' => \$testcase
+ , 'silent' => sub { $silent = 1 }
+ , 'ci' => sub { $ci_use = 1 }
) or pod2usage(2);
pod2usage(1) if $help;
pod2usage(-verbose => 2) if $man;
+if ($ci_use){
+ use QMake::Project;
+}
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
@@ -139,6 +153,123 @@ sub popd ()
dir;
}
+##############################
+# Read possible insignificance
+# from pro file
+##############################
+sub check_if_insignificant
+{
+ return 0 if ( !$ci_use );
+ my $case = shift;
+ my $insignificant = 0;
+ my $prj = QMake::Project->new( 'Makefile' );
+ $insignificant = $prj->test( 'insignificant_test' );
+ return $insignificant;
+}
+
+##############################
+# Print output from given
+# $testresult.txt file
+##############################
+sub print_output
+{
+ my $res_file = shift;
+ my $case = shift;
+ my $insignificant = shift;
+ my $print_all = 0;
+ $total_tests++;
+ if (-e $res_file) {
+ open my $file, $res_file or die "Could not open $res_file: $!";
+ while (my $line = <$file>) {
+ if ($line =~ m/^FAIL/) {
+ print "$line";
+ # Pretend to be like the "real" testrunner and print out
+ # all steps
+ $print_all = 1;
+ }
+ }
+ close $file;
+ if ($print_all) {
+ # In case we are printing all, the test failed
+ system("cat $res_file");
+ if ($insignificant) {
+ print " Testrunner: $case failed, but it is marked with insignificant_test\n";
+ push (@failures ,(basename($case)." [insignificant]"));
+ $failed_insignificants++;
+ } else {
+ $total_failed++;
+ push (@failures ,(basename($case)));
+ }
+ } else {
+ my $cmd = "sed -n 'x;\$p' ${res_file}";
+ my $summary = qx(${cmd});
+ if ($summary =~ m/^Totals/) {
+ print "$summary";
+ } else {
+ print "Error: The log is incomplete. Looks like you have to increase the timeout.";
+ # The test log seems inclomplete, considering the test as failed.
+ if ($insignificant) {
+ print " Testrunner: $case failed, but it is marked with insignificant_test\n";
+ push (@failures ,(basename($case)." [insignificant]"));
+ $failed_insignificants++;
+ } else {
+ $total_failed++;
+ push (@failures ,(basename($case)));
+ }
+ }
+ }
+ } else {
+ if ($insignificant) {
+ print " Failed to execute $case, but it is marked with insignificant_test\n";
+ push (@failures ,(basename($case)." [insignificant]"));
+ $failed_insignificants++;
+ } else {
+ print "Failed to execute $case \n";
+ $total_failed++;
+ push (@failures ,(basename($case)));
+ }
+ }
+}
+
+##############################
+# Print summary of test run
+##############################
+
+sub print_summary
+{
+ my $total = time()-$start;
+ my $h = 0;
+ my $m = 0;
+ my $s = 0;
+ my $exit = 0;
+ print "=== Timing: =================== TEST RUN COMPLETED! ============================\n";
+ if ($total > 60*60) {
+ $h = int($total/60/60);
+ $s = int($total - $h*60*60);
+
+ $m = int($s/60);
+ $s = 0;
+ print "Total: $h hours $m minutes\n";
+ } elsif ($total > 60) {
+ $m = int($total/60);
+ $s = int($total - $m*60);
+ print "Total: $m minutes $s seconds\n";
+ } else {
+ $s = int($total);
+ print "Total: $s seconds\n";
+ }
+
+ print "=== Failures: ==================================================================";
+ foreach my $failed (@failures) {
+ print $failed."\n";
+ $exit = 1;
+ }
+ print "=== Totals: ".$total_tests." tests, ".($total_tests-$total_failed).
+ " passes, ".$failed_insignificants.
+ " insignificant fails ======================\n";
+ return $exit;
+}
+
sub waitForProcess
{
@@ -147,8 +278,8 @@ sub waitForProcess
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";
+ print "Waiting for $process ".$timeout*$sleepPeriod." seconds to" if (!$silent);
+ print $action?" start...\n":" die...\n" if (!$silent);
while ($timeout--)
{
my $output = `$adb_tool $device_serial shell ps 2>&1`; # get current processes
@@ -156,13 +287,13 @@ sub waitForProcess
my $res=($output =~ m/.*S $process/)?1:0; # check the procress
if ($action == $res)
{
- print "... succeed\n";
+ print "... succeed\n" if (!$silent);
return 1;
}
sleep($sleepPeriod);
- print "timeount in ".$timeout*$sleepPeriod." seconds\n"
+ print "timeount in ".$timeout*$sleepPeriod." seconds\n" if (!$silent);
}
- print "... failed\n";
+ print "... failed\n" if (!$silent);
return 0;
}
@@ -191,6 +322,7 @@ sub startTest
my $packageName = "org.qtproject.example.tst_$testName";
my $intentName = "$packageName/org.qtproject.qt5.android.bindings.QtActivity";
my $output_file = shift;
+ my $insignificance = shift;
my $get_xml= 0;
my $get_txt= 0;
my $testLib ="";
@@ -206,7 +338,9 @@ sub startTest
$get_txt = 1;
}
- system("$adb_tool $device_serial shell am start -e applicationArguments \"$testLib\" -n $intentName"); # start intent
+ my $cmd="${adb_tool} ${device_serial} shell am start -e applicationArguments \"${testLib}\" -n ${intentName}";
+ my $res = qx(${cmd});
+ print $res if (!$silent);
#wait to start (if it has not started and quit already)
waitForProcess($packageName,1,10);
@@ -223,6 +357,11 @@ sub startTest
system("$adb_tool $device_serial pull /data/data/$packageName/output.xml $output_dir/$output_file.xml") if ($get_xml);
system("$adb_tool $device_serial pull /data/data/$packageName/output.txt $output_dir/$output_file.txt") if ($get_txt);
+ if ($get_txt){
+ print "Tesresults for $packageName:\n";
+ my $insig =
+ print_output("$output_dir/$output_file.txt", $packageName, $insignificance);
+ }
return 1;
}
@@ -244,9 +383,18 @@ 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 $insig = check_if_insignificant();
+ my $cmd="make INSTALL_ROOT=${temp_dir} install";
+ my $res = qx(${cmd});
+ print $res if (!$silent);
my $application=basename(cwd);
- system("androiddeployqt --install $deployqt_device_serial --output $temp_dir --deployment debug --verbose --input android-libtst_$application.so-deployment-settings.json");
+ if ($silent) {
+ $cmd="androiddeployqt --install ${deployqt_device_serial} --output ${temp_dir} --deployment debug --verbose --input android-libtst_${application}.so-deployment-settings.json >/dev/null 2>&1";
+ } else {
+ $cmd="androiddeployqt --install ${deployqt_device_serial} --output ${temp_dir} --deployment debug --verbose --input android-libtst_${application}.so-deployment-settings.json";
+ }
+ $res = qx(${cmd});
+ print $res if (!$silent);
my $output_name=dirname($_);
$output_name =~ s/\.//; # remove first "." character
$output_name =~ s/\///; # remove first "/" character
@@ -272,12 +420,13 @@ foreach (split("\n",$testsFiles))
}
else
{
- startTest($application, "$output_name") or warn "Can't run $application ...\n";
+ startTest($application, "$output_name", $insig) or warn "Can't run $application ...\n";
}
popd();
remove_tree( $temp_dir, {keep_root => 1} );
}
+print_summary() if ($ci_use);
popd();
__END__
@@ -338,6 +487,15 @@ The format of log file, default is xml.
The timeout period before stopping individual tests from running.
+=item B<-silent>
+
+Suppress output of system commands.
+
+=item B<-ci>
+
+Enables checking if test is insignificant or not. Also prints test
+summary after all tests has been executed.
+
=item B<-h --help>
Print a brief help message and exits.
diff --git a/tests/auto/cmake/test_opengl_lib/CMakeLists.txt b/tests/auto/cmake/test_opengl_lib/CMakeLists.txt
index d602bcda9b..d9adb5a980 100644
--- a/tests/auto/cmake/test_opengl_lib/CMakeLists.txt
+++ b/tests/auto/cmake/test_opengl_lib/CMakeLists.txt
@@ -10,9 +10,7 @@ add_definitions(${Qt5Gui_DEFINITIONS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Gui_EXECUTABLE_COMPILE_FLAGS}")
-if (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL GLES)
- add_definitions(-DGL_IMPLEMENTATION_GLES1)
-elseif (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL GLESv2)
+if (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL GLESv2)
add_definitions(-DGL_IMPLEMENTATION_GLES2)
elseif (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL GL)
add_definitions(-DGL_IMPLEMENTATION_GL)
diff --git a/tests/auto/cmake/test_opengl_lib/main.cpp b/tests/auto/cmake/test_opengl_lib/main.cpp
index 450b759bc8..1e874ed4fc 100644
--- a/tests/auto/cmake/test_opengl_lib/main.cpp
+++ b/tests/auto/cmake/test_opengl_lib/main.cpp
@@ -40,9 +40,7 @@
****************************************************************************/
-#if GL_IMPLEMENTATION_GLES1
-#include <GLES/gl.h>
-#elif GL_IMPLEMENTATION_GLES2
+#if GL_IMPLEMENTATION_GLES2
#include <GLES2/gl2.h>
#elif GL_IMPLEMENTATION_GL
diff --git a/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp b/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp
index 33133e876f..1ca900fa27 100644
--- a/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp
+++ b/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp
@@ -151,7 +151,9 @@ void tst_QtConcurrentIterateKernel::cancel()
f.cancel();
f.waitForFinished();
QVERIFY(f.isCanceled());
- QVERIFY(iterations.load() <= QThread::idealThreadCount()); // the threads might run one iteration each before they are canceled.
+ // the threads might run one iteration each before they are canceled.
+ QVERIFY2(iterations.load() <= QThread::idealThreadCount(),
+ (QByteArray::number(iterations.load()) + ' ' + QByteArray::number(QThread::idealThreadCount())));
}
}
@@ -251,26 +253,48 @@ void tst_QtConcurrentIterateKernel::throttling()
QCOMPARE(threads.count(), 1);
}
-
-int peakBlockSize = 0;
class BlockSizeRecorder : public IterateKernel<TestIterator, void>
{
public:
- BlockSizeRecorder(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, void>(begin, end) { }
+ BlockSizeRecorder(TestIterator begin, TestIterator end)
+ : IterateKernel<TestIterator, void>(begin, end)
+ , peakBlockSize(0)
+ , peakBegin(0)
+ {}
+
inline bool runIterations(TestIterator, int begin, int end, void *)
{
- peakBlockSize = qMax(peakBlockSize, end - begin);
+ const int blockSize = end - begin;
+ if (blockSize > peakBlockSize) {
+ peakBlockSize = blockSize;
+ peakBegin = begin;
+ }
return false;
}
+ int peakBlockSize;
+ int peakBegin;
};
+static QByteArray msgBlockSize(const BlockSizeRecorder &recorder, int expectedMinimumBlockSize)
+{
+ return QByteArrayLiteral("peakBlockSize=") + QByteArray::number(recorder.peakBlockSize)
+ + QByteArrayLiteral(" is less than expectedMinimumBlockSize=")
+ + QByteArray::number(expectedMinimumBlockSize)
+ + QByteArrayLiteral(", reached at: ") + QByteArray::number(recorder.peakBegin)
+ + QByteArrayLiteral(" (ideal thread count: ") + QByteArray::number(QThread::idealThreadCount())
+ + ')';
+}
+
void tst_QtConcurrentIterateKernel::blockSize()
{
const int expectedMinimumBlockSize = 1024 / QThread::idealThreadCount();
- BlockSizeRecorder(0, 10000).startBlocking();
- if (peakBlockSize < expectedMinimumBlockSize)
- qDebug() << "block size" << peakBlockSize;
- QVERIFY(peakBlockSize >= expectedMinimumBlockSize);
+ BlockSizeRecorder recorder(0, 10000);
+ recorder.startBlocking();
+#ifdef Q_OS_WIN
+ if (recorder.peakBlockSize < expectedMinimumBlockSize)
+ QEXPECT_FAIL("", msgBlockSize(recorder, expectedMinimumBlockSize).constData(), Abort);
+#endif // Q_OS_WIN
+ QVERIFY2(recorder.peakBlockSize >= expectedMinimumBlockSize, msgBlockSize(recorder, expectedMinimumBlockSize));
}
class MultipleResultsFor : public IterateKernel<TestIterator, int>
diff --git a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp
index 3064fd1320..5623990bd1 100644
--- a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp
+++ b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp
@@ -306,10 +306,13 @@ private slots:
void QLoggingRegistry_checkErrors()
{
QLoggingSettingsParser parser;
- QString warnMsg = QString("Ignoring malformed logging rule: '***=false'");
- QTest::ignoreMessage(QtWarningMsg, warnMsg.toLocal8Bit().constData());
+ QTest::ignoreMessage(QtWarningMsg, "Ignoring malformed logging rule: '***=false'");
+ QTest::ignoreMessage(QtWarningMsg, "Ignoring malformed logging rule: '*=0'");
+ QTest::ignoreMessage(QtWarningMsg, "Ignoring malformed logging rule: '*=TRUE'");
parser.setContent("[Rules]\n"
- "***=false\n");
+ "***=false\n"
+ "*=0\n"
+ "*=TRUE\n");
QVERIFY(parser.rules().isEmpty());
}
};
diff --git a/tests/auto/corelib/kernel/kernel.pro b/tests/auto/corelib/kernel/kernel.pro
index 604a0f4fd8..4b3b2e824e 100644
--- a/tests/auto/corelib/kernel/kernel.pro
+++ b/tests/auto/corelib/kernel/kernel.pro
@@ -8,6 +8,7 @@ SUBDIRS=\
qmetaobjectbuilder \
qmetamethod \
qmetaproperty \
+ qmetatype \
qmimedata \
qobject \
qpointer \
diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
index b06741b23e..6e183f3212 100644
--- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
@@ -1855,6 +1855,21 @@ void tst_QByteArray::reserve()
QVERIFY(data == qba.data());
}
+ qba.resize(capacity);
+
+ QByteArray copy = qba;
+ qba.reserve(capacity / 2);
+ QCOMPARE(qba.size(), capacity); // we didn't shrink the size!
+ QCOMPARE(qba.capacity(), capacity);
+ QCOMPARE(copy.capacity(), capacity);
+
+ copy = qba;
+ qba.reserve(capacity * 2);
+ QCOMPARE(qba.size(), capacity);
+ QCOMPARE(qba.capacity(), capacity * 2);
+ QCOMPARE(copy.capacity(), capacity);
+ QVERIFY(qba.constData() != data);
+
QByteArray nil1, nil2;
nil1.reserve(0);
nil2.squeeze();
diff --git a/tests/auto/corelib/tools/qlist/tst_qlist.cpp b/tests/auto/corelib/tools/qlist/tst_qlist.cpp
index 2c9bf9d4c9..d77cc4a37c 100644
--- a/tests/auto/corelib/tools/qlist/tst_qlist.cpp
+++ b/tests/auto/corelib/tools/qlist/tst_qlist.cpp
@@ -278,6 +278,8 @@ private slots:
void setSharableComplex() const;
void eraseValidIteratorsOnSharedList() const;
void insertWithValidIteratorsOnSharedList() const;
+
+ void reserve() const;
private:
template<typename T> void length() const;
template<typename T> void append() const;
@@ -1669,5 +1671,31 @@ void tst_QList::insertWithValidIteratorsOnSharedList() const
QCOMPARE(a.at(1), 15);
}
+void tst_QList::reserve() const
+{
+ // Note:
+ // This test depends on QList's current behavior that ints are stored in the array itself.
+ // This test would not work for QList<Complex>.
+ int capacity = 100;
+ QList<int> list;
+ list.reserve(capacity);
+ list << 0;
+ int *data = &list[0];
+
+ for (int i = 1; i < capacity; i++) {
+ list << i;
+ QCOMPARE(&list.at(0), data);
+ }
+
+ QList<int> copy = list;
+ list.reserve(capacity / 2);
+ QCOMPARE(list.size(), capacity); // we didn't shrink the size!
+
+ copy = list;
+ list.reserve(capacity * 2);
+ QCOMPARE(list.size(), capacity);
+ QVERIFY(&list.at(0) != data);
+}
+
QTEST_APPLESS_MAIN(tst_QList)
#include "tst_qlist.moc"
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 5655d9f529..d9d6b985b7 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -4277,14 +4277,23 @@ void tst_QString::capacity()
QVERIFY( (int)s2.capacity() >= res );
QCOMPARE( s2, s1 );
+ s2 = s1; // share again
s2.reserve( res * 2 );
QVERIFY( (int)s2.capacity() >= res * 2 );
+ QVERIFY(s2.constData() != s1.constData());
QCOMPARE( s2, s1 );
+ // don't share again -- s2 must be detached for squeeze() to do anything
s2.squeeze();
QVERIFY( (int)s2.capacity() == res );
QCOMPARE( s2, s1 );
+ s2 = s1; // share again
+ int oldsize = s1.size();
+ s2.reserve( res / 2 );
+ QVERIFY( (int)s2.capacity() >= res / 2 );
+ QVERIFY( (int)s2.capacity() >= oldsize );
+ QCOMPARE( s2, s1 );
}
void tst_QString::section_data()
diff --git a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp
index 7bbcee8ab2..342abb7ea8 100644
--- a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp
+++ b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp
@@ -68,6 +68,8 @@ private slots:
void isEmpty();
void compare_data();
void compare();
+ void compare2_data();
+ void compare2();
void operator_eqeq_nullstring();
void toNum();
void toDouble_data();
@@ -792,11 +794,17 @@ void tst_QStringRef::compare_data()
QTest::newRow("data3") << QString("abc") << QString("abc") << 0 << 0;
QTest::newRow("data4") << QString("abC") << QString("abc") << -1 << 0;
QTest::newRow("data5") << QString("abc") << QString("abC") << 1 << 0;
+ QTest::newRow("data10") << QString("abcdefgh") << QString("abcdefgh") << 0 << 0;
+ QTest::newRow("data11") << QString("abcdefgh") << QString("abCdefgh") << 1 << 0;
+ QTest::newRow("data12") << QString("0123456789012345") << QString("0123456789012345") << 0 << 0;
+ QTest::newRow("data13") << QString("0123556789012345") << QString("0123456789012345") << 1 << 1;
// different length
QTest::newRow("data6") << QString("abcdef") << QString("abc") << 1 << 1;
QTest::newRow("data7") << QString("abCdef") << QString("abc") << -1 << 1;
QTest::newRow("data8") << QString("abc") << QString("abcdef") << -1 << -1;
+ QTest::newRow("data14") << QString("abcdefgh") << QString("abcdefghi") << -1 << -1;
+ QTest::newRow("data15") << QString("01234567890123456") << QString("0123456789012345") << 1 << 1;
QString upper;
upper += QChar(QChar::highSurrogate(0x10400));
@@ -862,6 +870,46 @@ void tst_QStringRef::compare()
}
}
+void tst_QStringRef::compare2_data()
+{
+ compare_data();
+}
+
+void tst_QStringRef::compare2()
+{
+ QFETCH(QString, s1);
+ QFETCH(QString, s2);
+ QFETCH(int, csr);
+ QFETCH(int, cir);
+
+ // prepend and append data
+ // we only use Latin1 here so isLatin1 still results true
+ s1.prepend("xyz").append("zyx");
+ s2.prepend("foobar").append("raboof");
+
+ QStringRef r1(&s1, 3, s1.length() - 6);
+ QStringRef r2(&s2, 6, s2.length() - 12);
+
+ QCOMPARE(sign(QStringRef::compare(r1, r2)), csr);
+ QCOMPARE(sign(r1.compare(r2)), csr);
+
+ QCOMPARE(sign(r1.compare(r2, Qt::CaseSensitive)), csr);
+ QCOMPARE(sign(r1.compare(r2, Qt::CaseInsensitive)), cir);
+
+ QCOMPARE(sign(QStringRef::compare(r1, r2, Qt::CaseSensitive)), csr);
+ QCOMPARE(sign(QStringRef::compare(r1, r2, Qt::CaseInsensitive)), cir);
+
+ if (isLatin(s2)) {
+ QCOMPARE(sign(QStringRef::compare(r1, QLatin1String(r2.toLatin1()))), csr);
+ QCOMPARE(sign(QStringRef::compare(r1, QLatin1String(r2.toLatin1()), Qt::CaseInsensitive)), cir);
+ }
+
+ if (isLatin(s1)) {
+ QCOMPARE(sign(QStringRef::compare(r2, QLatin1String(r1.toLatin1()))), -csr);
+ QCOMPARE(sign(QStringRef::compare(r2, QLatin1String(r1.toLatin1()), Qt::CaseInsensitive)), -cir);
+ }
+}
+
void tst_QStringRef::toNum()
{
#define TEST_TO_INT(num, func, type) \
diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
index bd0ed06382..f85d2dee0c 100644
--- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp
+++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
@@ -2015,6 +2015,7 @@ void tst_QVector::reserve()
a.resize(2);
QVector<Foo> b(a);
b.reserve(1);
+ QCOMPARE(b.size(), a.size());
}
QCOMPARE(fooCtor, fooDtor);
}
diff --git a/tests/auto/gui/gui.pro b/tests/auto/gui/gui.pro
index d250e45a4e..78386cc0b1 100644
--- a/tests/auto/gui/gui.pro
+++ b/tests/auto/gui/gui.pro
@@ -12,4 +12,4 @@ SUBDIRS = \
util \
itemmodels \
-!contains(QT_CONFIG, opengl(es1|es2)?): SUBDIRS -= qopengl
+!contains(QT_CONFIG, opengl(es2)?): SUBDIRS -= qopengl
diff --git a/tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp b/tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp
index 30d25f00d2..5f452b5602 100644
--- a/tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp
+++ b/tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp
@@ -83,8 +83,12 @@ void tst_QPageLayout::basics()
QCOMPARE(simple.paintRectPoints(), QRect(0, 0, 595, 842));
QCOMPARE(simple.paintRectPixels(72), QRect(0, 0, 595, 842));
+ const QPageLayout a4portrait = simple;
+ QVERIFY(a4portrait == simple);
+
// Change orientation
simple.setOrientation(QPageLayout::Landscape);
+ QVERIFY(simple != a4portrait);
QCOMPARE(simple.orientation(), QPageLayout::Landscape);
QCOMPARE(simple.margins(), QMarginsF(0, 0, 0, 0));
QCOMPARE(simple.minimumMargins(), QMarginsF(0, 0, 0, 0));
diff --git a/tests/auto/gui/painting/qpagesize/tst_qpagesize.cpp b/tests/auto/gui/painting/qpagesize/tst_qpagesize.cpp
index 968c5ff617..c54f2350e5 100644
--- a/tests/auto/gui/painting/qpagesize/tst_qpagesize.cpp
+++ b/tests/auto/gui/painting/qpagesize/tst_qpagesize.cpp
@@ -137,10 +137,13 @@ void tst_QPageSize::basics()
// Comparisons
QCOMPARE((a4 == folio), false);
+ QCOMPARE((a4 != folio), true);
QCOMPARE((a4.isEquivalentTo(folio)), false);
QCOMPARE((a4 == a4b), true);
+ QCOMPARE((a4 != a4b), false);
QCOMPARE((a4.isEquivalentTo(a4b)), true);
QCOMPARE((folio == folio2), false); // Name different
+ QCOMPARE((folio != folio2), true); // Name different
QCOMPARE((folio.isEquivalentTo(folio2)), true);
// Simple QSize in Millimeters
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 11ea8aebc8..0509eb9a77 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 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.
@@ -177,6 +177,7 @@ public Q_SLOTS:
void authenticationRequired(QNetworkReply*,QAuthenticator*);
void proxyAuthenticationRequired(const QNetworkProxy &,QAuthenticator*);
void pipeliningHelperSlot();
+ void emitErrorForAllRepliesSlot();
#ifndef QT_NO_SSL
void sslErrors(QNetworkReply*,const QList<QSslError> &);
@@ -449,6 +450,8 @@ private Q_SLOTS:
void ftpAuthentication_data();
void ftpAuthentication();
+ void emitErrorForAllReplies(); // QTBUG-36890
+
#ifdef QT_BUILD_INTERNAL
void backgroundRequest_data();
void backgroundRequest();
@@ -4873,6 +4876,7 @@ void tst_QNetworkReply::ioPostToHttpUploadProgress()
//test file must be larger than OS socket buffers (~830kB on MacOS 10.6)
QFile sourceFile(testDataDir + "/image1.jpg");
QVERIFY(sourceFile.open(QIODevice::ReadOnly));
+ const qint64 sourceFileSize = sourceFile.size();
// emulate a minimal http server
QTcpServer server;
@@ -4897,24 +4901,32 @@ void tst_QNetworkReply::ioPostToHttpUploadProgress()
QTestEventLoop::instance().enterLoop(5);
// some progress should have been made
QVERIFY(!spy.isEmpty());
- QList<QVariant> args = spy.last();
+ const QList<QVariant> args = spy.last();
QVERIFY(!args.isEmpty());
- QVERIFY(args.at(0).toLongLong() > 0);
- // but not everything!
- QVERIFY(args.at(0).toLongLong() != sourceFile.size());
+ const qint64 bufferedUploadProgress = args.at(0).toLongLong();
+ QVERIFY(bufferedUploadProgress > 0);
+ // but not everything? - Note however, that under CI virtualization,
+ // particularly on Windows, it frequently happens that the whole file
+ // is uploaded in one chunk.
+ if (bufferedUploadProgress == sourceFileSize) {
+ qWarning() << QDir::toNativeSeparators(sourceFile.fileName())
+ << "of" << sourceFileSize << "bytes was uploaded in one go.";
+ }
// set the read buffer to unlimited
incomingSocket->setReadBufferSize(0);
QTestEventLoop::instance().enterLoop(10);
// progress should be finished
QVERIFY(!spy.isEmpty());
- QList<QVariant> args3 = spy.last();
+ const QList<QVariant> args3 = spy.last();
QVERIFY(!args3.isEmpty());
// More progress than before
- QVERIFY(args3.at(0).toLongLong() > args.at(0).toLongLong());
- QCOMPARE(args3.at(0).toLongLong(), args3.at(1).toLongLong());
+ const qint64 unbufferedUploadProgress = args3.at(0).toLongLong();
+ if (bufferedUploadProgress < sourceFileSize)
+ QVERIFY(unbufferedUploadProgress > bufferedUploadProgress);
+ QCOMPARE(unbufferedUploadProgress, args3.at(1).toLongLong());
// And actually finished..
- QCOMPARE(args3.at(0).toLongLong(), sourceFile.size());
+ QCOMPARE(unbufferedUploadProgress, sourceFileSize);
// after sending this, the QNAM should emit finished()
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
@@ -7465,6 +7477,12 @@ void tst_QNetworkReply::pipeliningHelperSlot() {
}
}
+void tst_QNetworkReply::emitErrorForAllRepliesSlot() {
+ static int a = 0;
+ if (++a == 3)
+ QTestEventLoop::instance().exitLoop();
+}
+
void tst_QNetworkReply::closeDuringDownload_data()
{
QTest::addColumn<QUrl>("url");
@@ -7513,6 +7531,37 @@ void tst_QNetworkReply::ftpAuthentication()
QCOMPARE(reply->error(), QNetworkReply::NetworkError(error));
}
+void tst_QNetworkReply::emitErrorForAllReplies() // QTBUG-36890
+{
+ // port 100 is not well-known and should be closed
+ QList<QUrl> urls = QList<QUrl>() << QUrl("http://localhost:100/request1")
+ << QUrl("http://localhost:100/request2")
+ << QUrl("http://localhost:100/request3");
+ QList<QNetworkReply *> replies;
+ QList<QSignalSpy *> errorSpies;
+ QList<QSignalSpy *> finishedSpies;
+ for (int a = 0; a < urls.count(); ++a) {
+ QNetworkRequest request(urls.at(a));
+ QNetworkReply *reply = manager.get(request);
+ replies.append(reply);
+ QSignalSpy *errorSpy = new QSignalSpy(reply, SIGNAL(error(QNetworkReply::NetworkError)));
+ errorSpies.append(errorSpy);
+ QSignalSpy *finishedSpy = new QSignalSpy(reply, SIGNAL(finished()));
+ finishedSpies.append(finishedSpy);
+ QObject::connect(reply, SIGNAL(finished()), SLOT(emitErrorForAllRepliesSlot()));
+ }
+ QTestEventLoop::instance().enterLoop(10);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ for (int a = 0; a < urls.count(); ++a) {
+ QVERIFY(replies.at(a)->isFinished());
+ QCOMPARE(errorSpies.at(a)->count(), 1);
+ errorSpies.at(a)->deleteLater();
+ QCOMPARE(finishedSpies.at(a)->count(), 1);
+ finishedSpies.at(a)->deleteLater();
+ replies.at(a)->deleteLater();
+ }
+}
+
#ifdef QT_BUILD_INTERNAL
void tst_QNetworkReply::backgroundRequest_data()
{
diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
index ded3966992..baaf21e6bb 100644
--- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -192,6 +192,8 @@ private slots:
void resume();
void qtbug18498_peek();
void qtbug18498_peek2();
+ void dhServer();
+ void ecdhServer();
void setEmptyDefaultConfiguration(); // this test should be last
static void exitLoop()
@@ -1004,6 +1006,7 @@ public:
QString m_keyFile;
QString m_certFile;
QString m_interFile;
+ QString ciphers;
protected:
void incomingConnection(qintptr socketDescriptor)
@@ -1037,6 +1040,10 @@ protected:
socket->setLocalCertificateChain(localCert + interCert);
}
+ if (!ciphers.isEmpty()) {
+ socket->setCiphers(ciphers);
+ }
+
QVERIFY(socket->setSocketDescriptor(socketDescriptor, QAbstractSocket::ConnectedState));
QVERIFY(!socket->peerAddress().isNull());
QVERIFY(socket->peerPort() != 0);
@@ -2665,6 +2672,66 @@ void tst_QSslSocket::qtbug18498_peek2()
QVERIFY(client->waitForDisconnected(5000));
}
+void tst_QSslSocket::dhServer()
+{
+ if (!QSslSocket::supportsSsl()) {
+ qWarning("SSL not supported, skipping test");
+ return;
+ }
+
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ SslServer server;
+ server.ciphers = QLatin1String("DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA");
+ QVERIFY(server.listen());
+
+ QEventLoop loop;
+ QTimer::singleShot(5000, &loop, SLOT(quit()));
+
+ QSslSocketPtr client(new QSslSocket);
+ socket = client.data();
+ connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
+ connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
+ connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
+
+ client->connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
+
+ loop.exec();
+ QVERIFY(client->state() == QAbstractSocket::ConnectedState);
+}
+
+void tst_QSslSocket::ecdhServer()
+{
+ if (!QSslSocket::supportsSsl()) {
+ qWarning("SSL not supported, skipping test");
+ return;
+ }
+
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ SslServer server;
+ server.ciphers = QLatin1String("ECDHE-RSA-AES128-SHA");
+ QVERIFY(server.listen());
+
+ QEventLoop loop;
+ QTimer::singleShot(5000, &loop, SLOT(quit()));
+
+ QSslSocketPtr client(new QSslSocket);
+ socket = client.data();
+ connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
+ connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
+ connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
+
+ client->connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
+
+ loop.exec();
+ QVERIFY(client->state() == QAbstractSocket::ConnectedState);
+}
+
void tst_QSslSocket::setEmptyDefaultConfiguration() // this test should be last, as it has some side effects
{
// used to produce a crash in QSslConfigurationPrivate::deepCopyDefaultConfiguration, QTBUG-13265
diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp
index 22f284e365..5831b33974 100644
--- a/tests/auto/opengl/qgl/tst_qgl.cpp
+++ b/tests/auto/opengl/qgl/tst_qgl.cpp
@@ -1064,6 +1064,12 @@ void tst_QGL::glWidgetRendering()
QVERIFY(w.beginOk);
QVERIFY(w.engineType == QPaintEngine::OpenGL || w.engineType == QPaintEngine::OpenGL2);
+#if defined(Q_OS_QNX)
+ // glReadPixels reads from the back buffer. On QNX the buffer is not preserved
+ // after a buffer swap. This is why we have to swap the buffer explicitly before calling
+ // grabFrameBuffer to retrieve the content of the front buffer.
+ w.swapBuffers();
+#endif
QImage fb = w.grabFrameBuffer(false);
qt_opengl_check_test_pattern(fb);
}
@@ -1104,6 +1110,9 @@ void tst_QGL::glFBOSimpleRendering()
// buffer is actually missing. But that's probably ok anyway.
void tst_QGL::glFBORendering()
{
+#if defined(Q_OS_QNX)
+ QSKIP("Reading the QGLFramebufferObject is unsupported on this platform");
+#endif
if (!QGLFramebufferObject::hasOpenGLFramebufferObjects())
QSKIP("QGLFramebufferObject not supported on this platform");
@@ -1280,7 +1289,7 @@ protected:
fboPainter.end();
fboImage = fbo->toImage();
- widgetPainter.fillRect(-1, -1, width()+2, width()+2, Qt::blue);
+ widgetPainter.fillRect(-1, -1, width()+2, height()+2, Qt::blue);
delete fbo;
}
@@ -1301,6 +1310,13 @@ void tst_QGL::glFBOUseInGLWidget()
QVERIFY(w.widgetPainterBeginOk);
QVERIFY(w.fboPainterBeginOk);
+#if defined(Q_OS_QNX)
+ // glReadPixels reads from the back buffer. On QNX the buffer is not preserved
+ // after a buffer swap. This is why we have to swap the buffer explicitly before calling
+ // grabFrameBuffer to retrieve the content of the front buffer
+ w.swapBuffers();
+#endif
+
QImage widgetFB = w.grabFrameBuffer(false);
QImage widgetReference(widgetFB.size(), widgetFB.format());
widgetReference.fill(0xff0000ff);
@@ -1691,6 +1707,12 @@ void tst_QGL::replaceClipping()
glw.paint(&referencePainter);
referencePainter.end();
+#if defined(Q_OS_QNX)
+ // glReadPixels reads from the back buffer. On QNX the buffer is not preserved
+ // after a buffer swap. This is why we have to swap the buffer explicitly before calling
+ // grabFrameBuffer to retrieve the content of the front buffer
+ glw.swapBuffers();
+#endif
const QImage widgetFB = glw.grabFrameBuffer(false).convertToFormat(QImage::Format_RGB32);
// Sample pixels in a grid pattern which avoids false failures due to
@@ -1802,6 +1824,12 @@ void tst_QGL::clipTest()
glw.paint(&referencePainter);
referencePainter.end();
+#if defined(Q_OS_QNX)
+ // glReadPixels reads from the back buffer. On QNX the buffer is not preserved
+ // after a buffer swap. This is why we have to swap the buffer explicitly before calling
+ // grabFrameBuffer to retrieve the content of the front buffer
+ glw.swapBuffers();
+#endif
const QImage widgetFB = glw.grabFrameBuffer(false).convertToFormat(QImage::Format_RGB32);
// Sample pixels in a grid pattern which avoids false failures due to
diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp
index 91cda9b4aa..4449b75e46 100644
--- a/tests/auto/other/lancelot/paintcommands.cpp
+++ b/tests/auto/other/lancelot/paintcommands.cpp
@@ -2430,11 +2430,6 @@ void PaintCommands::command_surface_end(QRegExp)
if (m_type == OpenGLType || m_type == OpenGLBufferType) {
#ifndef QT_NO_OPENGL
QImage new_image = m_surface_glbuffer->toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied);
- m_default_glcontext->makeCurrent(m_default_glcontext->surface());
- m_painter->drawImage(m_surface_rect, new_image);
- // Flush the pipeline:
- m_painter->beginNativePainting();
- m_painter->endNativePainting();
delete m_surface_glpaintdevice;
m_surface_glpaintdevice = 0;
@@ -2442,6 +2437,12 @@ void PaintCommands::command_surface_end(QRegExp)
m_surface_glbuffer = 0;
delete m_surface_glcontext;
m_surface_glcontext = 0;
+
+ m_default_glcontext->makeCurrent(m_default_glcontext->surface());
+ m_painter->drawImage(m_surface_rect, new_image);
+ // Flush the pipeline:
+ m_painter->beginNativePainting();
+ m_painter->endNativePainting();
#endif
#ifdef Q_WS_X11
} else if (m_type == WidgetType) {
diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro
index 2bddc8d127..e6017168d0 100644
--- a/tests/auto/other/other.pro
+++ b/tests/auto/other/other.pro
@@ -16,6 +16,7 @@ SUBDIRS=\
networkselftest \
qaccessibility \
qaccessibilitylinux \
+ qaccessibilitymac \
qcomplextext \
qfocusevent \
qnetworkaccessmanager_and_qprogressdialog \
@@ -33,7 +34,6 @@ SUBDIRS=\
languagechange \
modeltest \
qaccessibility \
- qcomplextext \
qfocusevent \
qnetworkaccessmanager_and_qprogressdialog \
qsharedpointer_and_qwidget \
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index 9f0540173a..fcc5581bea 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -1711,6 +1711,48 @@ void tst_QAccessibility::textEditTest()
QCOMPARE(textIface->textAtOffset(28, QAccessible::CharBoundary, &start, &end), QLatin1String("\n"));
QCOMPARE(start, 28);
QCOMPARE(end, 29);
+
+ edit.clear();
+ QTestAccessibility::clearEvents();
+
+ // make sure we get notifications when typing text
+ QTestEventList keys;
+ keys.addKeyClick('A');
+ keys.simulate(&edit);
+ keys.clear();
+ QAccessibleTextInsertEvent insertA(&edit, 0, "A");
+ QVERIFY_EVENT(&insertA);
+ QAccessibleTextCursorEvent move1(&edit, 1);
+ QVERIFY_EVENT(&move1);
+
+
+ keys.addKeyClick('c');
+ keys.simulate(&edit);
+ keys.clear();
+ QAccessibleTextInsertEvent insertC(&edit, 1, "c");
+ QVERIFY_EVENT(&insertC);
+ QAccessibleTextCursorEvent move2(&edit, 2);
+ QVERIFY_EVENT(&move2);
+
+ keys.addKeyClick(Qt::Key_Backspace);
+ keys.simulate(&edit);
+ keys.clear();
+
+ // FIXME this should get a proper string instead of space
+ QAccessibleTextRemoveEvent del(&edit, 1, " ");
+ QVERIFY_EVENT(&del);
+ QVERIFY_EVENT(&move1);
+
+ // it would be nicer to get a text update event, but the current implementation
+ // instead does remove and insert which is also fine
+ edit.setText(QStringLiteral("Accessibility rocks"));
+ QAccessibleTextRemoveEvent remove(&edit, 0, " ");
+ QVERIFY_EVENT(&remove);
+
+ // FIXME the new text is not there yet
+ QEXPECT_FAIL("", "Inserting should always contain the new text", Continue);
+ QAccessibleTextInsertEvent insert(&edit, 0, "Accessibility rocks");
+ QVERIFY_EVENT(&insert);
}
QTestAccessibility::clearEvents();
}
diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp
index 25b47ee836..f521b64bed 100644
--- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp
+++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 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.
@@ -82,6 +82,8 @@ private slots:
void singleWidgetTest();
void lineEditTest();
void hierarchyTest();
+ void notificationsTest();
+
private:
AccessibleTestWindow *m_window;
};
@@ -123,6 +125,7 @@ void tst_QAccessibilityMac::lineEditTest()
m_window->addWidget(lineEdit);
QVERIFY(QTest::qWaitForWindowExposed(m_window));
QCoreApplication::processEvents();
+
QVERIFY(testLineEdit());
}
@@ -148,5 +151,13 @@ void tst_QAccessibilityMac::hierarchyTest()
QVERIFY(testHierarchy(w));
}
+void tst_QAccessibilityMac::notificationsTest()
+{
+ if (!macNativeAccessibilityEnabled())
+ return;
+
+ QVERIFY(notifications(m_window));
+}
+
QTEST_MAIN(tst_QAccessibilityMac)
#include "tst_qaccessibilitymac.moc"
diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h
index 635b6383ab..818cabb000 100644
--- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h
+++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 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.
@@ -42,11 +42,13 @@
#include <QtCore/QPair>
#include <QtWidgets/QWidget>
-
#pragma once // Yeah, it's deprecated in general, but it's standard practice for Mac OS X.
+QT_USE_NAMESPACE
+
bool macNativeAccessibilityEnabled();
bool trusted();
bool testLineEdit();
bool testHierarchy(QWidget *w);
bool singleWidget();
+bool notifications(QWidget *w);
diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm
index bc89ac858b..a0dfe5446e 100644
--- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm
+++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 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.
@@ -46,12 +46,15 @@
#include <QtWidgets/qapplication.h>
#include <QtWidgets/qlineedit.h>
#include <QtWidgets/qpushbutton.h>
+#include <QtWidgets>
#include <QtTest>
#include <unistd.h>
#import <Cocoa/Cocoa.h>
#import <ApplicationServices/ApplicationServices.h>
+QT_USE_NAMESPACE
+
bool macNativeAccessibilityEnabled()
{
bool enabled = AXAPIEnabled();
@@ -76,6 +79,10 @@ bool trusted()
@interface TestAXObject : NSObject
{
AXUIElementRef reference;
+ NSString *_role;
+ NSString *_description;
+ NSString *_value;
+ CGRect _rect;
}
@property (readonly) NSString *role;
@property (readonly) NSString *description;
@@ -84,7 +91,14 @@ bool trusted()
@end
@implementation TestAXObject
+
+ @synthesize role = _role;
+ @synthesize description = _description;
+ @synthesize value = _value;
+ @synthesize rect = _rect;
+
- (id) initWithAXUIElementRef: (AXUIElementRef) ref {
+
if ( self = [super init] ) {
reference = ref;
AXUIElementCopyAttributeValue(ref, kAXRoleAttribute, (CFTypeRef*)&_role);
@@ -103,7 +117,7 @@ bool trusted()
- (AXUIElementRef) ref { return reference; }
- (void) print {
NSLog(@"Accessible Object role: '%@', description: '%@', value: '%@', rect: '%@'", self.role, self.description, self.value, NSStringFromRect(self.rect));
- NSLog(@" Children: %ld", [self.childList count]);
+ NSLog(@" Children: %ld", [[self childList] count]);
}
- (NSArray*) windowList
@@ -163,10 +177,10 @@ bool trusted()
bool singleWidget()
{
- QLineEdit le;
- le.setText("button");
- le.show();
- EXPECT(QTest::qWaitForWindowExposed(&le));
+ QLineEdit *le = new QLineEdit();
+ le->setText("button");
+ le->show();
+ EXPECT(QTest::qWaitForWindowExposed(le));
QCoreApplication::processEvents();
TestAXObject *appObject = [TestAXObject getApplicationAXObject];
@@ -179,8 +193,16 @@ bool singleWidget()
EXPECT(windowRef != nil);
TestAXObject *window = [[TestAXObject alloc] initWithAXUIElementRef: windowRef];
- AXUIElementRef lineEdit = [window findDirectChildByRole: kAXTextFieldRole];
- EXPECT(lineEdit != nil);
+ AXUIElementRef lineEditRef = [window findDirectChildByRole: kAXTextFieldRole];
+ EXPECT(lineEditRef != nil);
+ TestAXObject *lineEdit = [[TestAXObject alloc] initWithAXUIElementRef: lineEditRef];
+ EXPECT([[lineEdit value] isEqualToString:@"button"]);
+
+ // Access invalid reference, should return empty value
+ delete le;
+ QCoreApplication::processEvents();
+ TestAXObject *lineEditInvalid = [[TestAXObject alloc] initWithAXUIElementRef: lineEditRef];
+ EXPECT([[lineEditInvalid value] length] == 0);
return true;
}
@@ -207,6 +229,10 @@ bool testLineEdit()
// height of window includes title bar
EXPECT([window rect].size.height >= 400);
+ NSString *windowTitle;
+ AXUIElementCopyAttributeValue(windowRef, kAXTitleAttribute, (CFTypeRef*)&windowTitle);
+ EXPECT([windowTitle isEqualToString:@"Test window"]);
+
// children of window:
AXUIElementRef lineEdit = [window findDirectChildByRole: kAXTextFieldRole];
EXPECT(lineEdit != nil);
@@ -270,3 +296,68 @@ bool testHierarchy(QWidget *w)
return true;
}
+
+QVector<int> notificationList;
+
+void observerCallback(AXObserverRef /*observer*/, AXUIElementRef /*element*/, CFStringRef notification, void *)
+{
+ if ([(NSString*)notification isEqualToString: NSAccessibilityFocusedUIElementChangedNotification])
+ notificationList.append(QAccessible::Focus);
+ else if ([(NSString*)notification isEqualToString: NSAccessibilityValueChangedNotification])
+ notificationList.append(QAccessible::ValueChanged);
+ else
+ notificationList.append(-1);
+}
+
+
+bool notifications(QWidget *w)
+{
+ QLineEdit *le1 = new QLineEdit(w);
+ QLineEdit *le2 = new QLineEdit(w);
+ w->layout()->addWidget(le1);
+ w->layout()->addWidget(le2);
+
+ QCoreApplication::processEvents();
+ QTest::qWait(100);
+
+ TestAXObject *appObject = [TestAXObject getApplicationAXObject];
+ EXPECT(appObject);
+
+ NSArray *windowList = [appObject windowList];
+ // one window
+ EXPECT([windowList count] == 1);
+ AXUIElementRef windowRef = (AXUIElementRef) [windowList objectAtIndex: 0];
+ EXPECT(windowRef != nil);
+ TestAXObject *window = [[TestAXObject alloc] initWithAXUIElementRef: windowRef];
+
+ AXUIElementRef lineEdit1 = [window findDirectChildByRole: kAXTextFieldRole];
+ EXPECT(lineEdit1 != nil);
+
+ AXObserverRef observer = 0;
+ AXError err = AXObserverCreate(getpid(), observerCallback, &observer);
+ EXPECT(!err);
+ AXObserverAddNotification(observer, appObject.ref, kAXFocusedUIElementChangedNotification, 0);
+ AXObserverAddNotification(observer, lineEdit1, kAXValueChangedNotification, 0);
+
+ CFRunLoopAddSource( [[NSRunLoop currentRunLoop] getCFRunLoop], AXObserverGetRunLoopSource(observer), kCFRunLoopDefaultMode);
+
+ EXPECT(notificationList.length() == 0);
+ le2->setFocus();
+ QCoreApplication::processEvents();
+ EXPECT(notificationList.length() == 1);
+ EXPECT(notificationList.at(0) == QAccessible::Focus);
+ le1->setFocus();
+ QCoreApplication::processEvents();
+ EXPECT(notificationList.length() == 2);
+ EXPECT(notificationList.at(1) == QAccessible::Focus);
+ le1->setText("hello");
+ QCoreApplication::processEvents();
+ EXPECT(notificationList.length() == 3);
+ EXPECT(notificationList.at(2) == QAccessible::ValueChanged);
+ le1->setText("foo");
+ QCoreApplication::processEvents();
+ EXPECT(notificationList.length() == 4);
+ EXPECT(notificationList.at(3) == QAccessible::ValueChanged);
+
+ return true;
+}
diff --git a/tests/auto/other/qcomplextext/qcomplextext.pro b/tests/auto/other/qcomplextext/qcomplextext.pro
index 7848028134..28acc397bf 100644
--- a/tests/auto/other/qcomplextext/qcomplextext.pro
+++ b/tests/auto/other/qcomplextext/qcomplextext.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qcomplextext
-QT += widgets widgets-private testlib
+QT += testlib
QT += core-private gui-private
SOURCES += tst_qcomplextext.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/other/qcomplextext/tst_qcomplextext.cpp b/tests/auto/other/qcomplextext/tst_qcomplextext.cpp
index 7eb8479372..03c51d9d6e 100644
--- a/tests/auto/other/qcomplextext/tst_qcomplextext.cpp
+++ b/tests/auto/other/qcomplextext/tst_qcomplextext.cpp
@@ -39,11 +39,6 @@
**
****************************************************************************/
-
-// Horrible hack, but this get this out of the way for now
-// Carlos Duclos, 2007-12-11
-#if !defined(Q_OS_MAC)
-
#include <QtTest/QtTest>
#include <QtGui/QtGui>
#include <private/qtextengine_p.h>
@@ -71,6 +66,8 @@ private slots:
void bidiCursorMovement();
void bidiCursorLogicalMovement_data();
void bidiCursorLogicalMovement();
+ void bidiInvalidCursorNoMovement_data();
+ void bidiInvalidCursorNoMovement();
};
tst_QComplexText::tst_QComplexText()
@@ -272,6 +269,37 @@ void tst_QComplexText::bidiCursorLogicalMovement()
} while (moved);
}
+void tst_QComplexText::bidiInvalidCursorNoMovement_data()
+{
+ bidiCursorMovement_data();
+}
+
+void tst_QComplexText::bidiInvalidCursorNoMovement()
+{
+ QFETCH(QString, logical);
+ QFETCH(int, basicDir);
+
+ QTextLayout layout(logical);
+
+ QTextOption option = layout.textOption();
+ option.setTextDirection(basicDir == QChar::DirL ? Qt::LeftToRight : Qt::RightToLeft);
+ layout.setTextOption(option);
+
+ // visual
+ QCOMPARE(layout.rightCursorPosition(-1000), -1000);
+ QCOMPARE(layout.rightCursorPosition(1000), 1000);
+
+ QCOMPARE(layout.leftCursorPosition(-1000), -1000);
+ QCOMPARE(layout.leftCursorPosition(1000), 1000);
+
+ // logical
+ QCOMPARE(layout.nextCursorPosition(-1000), -1000);
+ QCOMPARE(layout.nextCursorPosition(1000), 1000);
+
+ QCOMPARE(layout.previousCursorPosition(-1000), -1000);
+ QCOMPARE(layout.previousCursorPosition(1000), 1000);
+}
+
void tst_QComplexText::bidiCursor_PDF()
{
QString str = QString::fromUtf8("\342\200\252hello\342\200\254");
@@ -289,6 +317,3 @@ void tst_QComplexText::bidiCursor_PDF()
QTEST_MAIN(tst_QComplexText)
#include "tst_qcomplextext.moc"
-
-#endif // Q_OS_MAC
-
diff --git a/tests/auto/sql/kernel/qsql/tst_qsql.cpp b/tests/auto/sql/kernel/qsql/tst_qsql.cpp
index 24f418af26..2dcd75427b 100644
--- a/tests/auto/sql/kernel/qsql/tst_qsql.cpp
+++ b/tests/auto/sql/kernel/qsql/tst_qsql.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 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.
@@ -117,7 +117,7 @@ void tst_QSql::basicDriverTest()
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv, false);
tst_Databases dbs;
- dbs.open();
+ QVERIFY(dbs.open());
foreach (const QString& dbName, dbs.dbNames) {
QSqlDatabase db = QSqlDatabase::database(dbName);
@@ -161,7 +161,7 @@ void tst_QSql::open()
QCoreApplication app(argc, argv, false);
tst_Databases dbs;
- dbs.open();
+ QVERIFY(dbs.open());
if (count == -1)
// first iteration: see how many dbs are open
count = (int) dbs.dbNames.count();
@@ -188,7 +188,7 @@ void tst_QSql::concurrentAccess()
QCoreApplication app(argc, argv, false);
tst_Databases dbs;
- dbs.open();
+ QVERIFY(dbs.open());
foreach (const QString& dbName, dbs.dbNames) {
QSqlDatabase db = QSqlDatabase::database(dbName);
QVERIFY(db.isValid());
@@ -204,6 +204,7 @@ void tst_QSql::concurrentAccess()
QVERIFY_SQL(ndb, open());
QCOMPARE(db.tables(), ndb.tables());
+ ndb.close();
}
// no database servers installed - don't fail
QVERIFY(1);
@@ -217,7 +218,7 @@ void tst_QSql::openErrorRecovery()
QCoreApplication app(argc, argv, false);
tst_Databases dbs;
- dbs.addDbs();
+ QVERIFY(dbs.addDbs());
if (dbs.dbNames.isEmpty())
QSKIP("No database drivers installed");
foreach (const QString& dbName, dbs.dbNames) {
diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
index 5c8b3ef728..db01135230 100644
--- a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
+++ b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 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.
@@ -49,6 +49,7 @@
#include <QSqlQuery>
#include <QRegExp>
#include <QDir>
+#include <QScopedPointer>
#include <QVariant>
#include <QDebug>
#include <QSqlTableModel>
@@ -248,7 +249,7 @@ public:
dbNames.append( cName );
}
- void addDbs()
+ bool addDbs()
{
//addDb("QOCI", "localhost", "system", "penandy");
// addDb( "QOCI8", "//horsehead.qt-project.org:1521/pony.troll.no", "scott", "tiger" ); // Oracle 9i on horsehead
@@ -302,7 +303,10 @@ public:
// use in-memory database to prevent local files
// addDb("QSQLITE", ":memory:");
- addDb( "QSQLITE", QDir::toNativeSeparators(dbDir.path() + "/foo.db") );
+ QTemporaryDir *sqLiteDir = dbDir();
+ if (!sqLiteDir)
+ return false;
+ addDb( QStringLiteral("QSQLITE"), QDir::toNativeSeparators(sqLiteDir->path() + QStringLiteral("/foo.db")) );
// addDb( "QSQLITE2", QDir::toNativeSeparators(dbDir.path() + "/foo2.db") );
// addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=iceblink.qt-project.org\\ICEBLINK", "troll", "trond", "" );
// addDb( "QODBC3", "DRIVER={SQL Native Client};SERVER=silence.qt-project.org\\SQLEXPRESS", "troll", "trond", "" );
@@ -319,11 +323,14 @@ public:
// addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=bq-winserv2008-x86-01.qt-project.org;DATABASE=testdb;PORT=1433", "testuser", "Ee4Gabf6_", "" );
// addDb( "QODBC", "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\dbs\\access\\testdb.mdb", "", "", "" );
// addDb( "QODBC", "DRIVER={Postgresql};SERVER=bq-pgsql84.qt-project.org;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" );
+ return true;
}
- void open()
+ // 'false' return indicates a system error, for example failure to create a temporary directory.
+ bool open()
{
- addDbs();
+ if (!addDbs())
+ return false;
QStringList::Iterator it = dbNames.begin();
@@ -341,6 +348,7 @@ public:
}
}
}
+ return true;
}
void close()
@@ -589,7 +597,21 @@ public:
QStringList dbNames;
int counter;
- QTemporaryDir dbDir;
+
+private:
+ QTemporaryDir *dbDir()
+ {
+ if (m_dbDir.isNull()) {
+ m_dbDir.reset(new QTemporaryDir);
+ if (!m_dbDir->isValid()) {
+ qWarning() << Q_FUNC_INFO << "Unable to create a temporary directory: " << QDir::toNativeSeparators(m_dbDir->path());
+ m_dbDir.reset();
+ }
+ }
+ return m_dbDir.data();
+ }
+
+ QScopedPointer<QTemporaryDir> m_dbDir;
};
#endif
diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp
index 6e199d5a71..fa5db999d4 100644
--- a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 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.
@@ -394,7 +394,7 @@ void tst_QSqlDatabase::populateTestTables(QSqlDatabase db)
void tst_QSqlDatabase::initTestCase()
{
qRegisterMetaType<QSqlDriver::NotificationSource>("QSqlDriver::NotificationSource");
- dbs.open();
+ QVERIFY(dbs.open());
for (QStringList::ConstIterator it = dbs.dbNames.begin(); it != dbs.dbNames.end(); ++it) {
QSqlDatabase db = QSqlDatabase::database((*it));
@@ -2229,6 +2229,7 @@ void tst_QSqlDatabase::sqlite_enable_cache_mode()
QSqlQuery q(db), q2(db2);
QVERIFY_SQL(q, exec("select * from " + qTableName("qtest", __FILE__, db)));
QVERIFY_SQL(q2, exec("select * from " + qTableName("qtest", __FILE__, db)));
+ db2.close();
}
QTEST_MAIN(tst_QSqlDatabase)
diff --git a/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp b/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp
index 53e5451e06..1775aecb20 100644
--- a/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp
+++ b/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 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.
@@ -69,7 +69,7 @@ private slots:
void tst_QSqlDriver::initTestCase_data()
{
- dbs.open();
+ QVERIFY(dbs.open());
if (dbs.fillTestTable() == 0)
QSKIP("No database drivers are available in this Qt configuration");
}
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
index a497fac79a..55cb67eed9 100644
--- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 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.
@@ -257,7 +257,7 @@ tst_QSqlQuery::~tst_QSqlQuery()
void tst_QSqlQuery::initTestCase()
{
- dbs.open();
+ QVERIFY(dbs.open());
for ( QStringList::ConstIterator it = dbs.dbNames.begin(); it != dbs.dbNames.end(); ++it ) {
QSqlDatabase db = QSqlDatabase::database(( *it ) );
diff --git a/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp b/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp
index 1be74dc5fa..e85c64db8e 100644
--- a/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp
+++ b/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 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.
@@ -350,7 +350,7 @@ void tst_QSqlThread::recreateTestTables()
void tst_QSqlThread::initTestCase()
{
- dbs.open();
+ QVERIFY(dbs.open());
recreateTestTables();
}
diff --git a/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp
index fe0f6abd9d..1e4ef73198 100644
--- a/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp
+++ b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 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.
@@ -124,7 +124,7 @@ tst_QSqlQueryModel::~tst_QSqlQueryModel()
void tst_QSqlQueryModel::initTestCase()
{
- dbs.open();
+ QVERIFY(dbs.open());
for (QStringList::ConstIterator it = dbs.dbNames.begin(); it != dbs.dbNames.end(); ++it) {
QSqlDatabase db = QSqlDatabase::database((*it));
CHECK_DATABASE(db);
diff --git a/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
index 37c08e5101..75a403e4b6 100644
--- a/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
+++ b/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 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.
@@ -98,7 +98,7 @@ private:
void tst_QSqlRelationalTableModel::initTestCase_data()
{
- dbs.open();
+ QVERIFY(dbs.open());
if (dbs.fillTestTable() == 0)
QSKIP("No database drivers are available in this Qt configuration");
}
diff --git a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
index 628a34f6f4..61583f0e20 100644
--- a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
+++ b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 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.
@@ -157,7 +157,7 @@ private:
tst_QSqlTableModel::tst_QSqlTableModel()
{
- dbs.open();
+ QVERIFY(dbs.open());
}
tst_QSqlTableModel::~tst_QSqlTableModel()
@@ -1968,6 +1968,7 @@ void tst_QSqlTableModel::sqlite_attachedDatabase()
QCOMPARE(model.rowCount(), 1);
QCOMPARE(model.data(model.index(0, 0), Qt::DisplayRole).toInt(), 3);
QCOMPARE(model.data(model.index(0, 1), Qt::DisplayRole).toString(), QLatin1String("main"));
+ attachedDb.close();
}
diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
index d8833e232d..c3d2c4a9e7 100644
--- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
+++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
@@ -276,7 +276,7 @@ void tst_QDialog::showMaximized()
QVERIFY(dialog.isMaximized());
QVERIFY(!dialog.isVisible());
- dialog.show();
+ dialog.setVisible(true);
QVERIFY(dialog.isMaximized());
QVERIFY(dialog.isVisible());
@@ -309,7 +309,7 @@ void tst_QDialog::showMinimized()
QVERIFY(dialog.isMinimized());
QVERIFY(!dialog.isVisible());
- dialog.show();
+ dialog.setVisible(true);
QVERIFY(dialog.isMinimized());
QVERIFY(dialog.isVisible());
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 37cc6522a2..c8f76c36ff 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -274,6 +274,11 @@ private slots:
public slots:
void dummySlot() {}
+
+private:
+#if defined Q_OS_BLACKBERRY
+ QScopedPointer<QWidget> rootWindow;
+#endif
};
void tst_QGraphicsView::initTestCase()
@@ -281,6 +286,13 @@ void tst_QGraphicsView::initTestCase()
#ifdef Q_OS_WINCE_WM
qApp->setAutoMaximizeThreshold(-1);
#endif
+
+#if defined Q_OS_BLACKBERRY
+ // On BlackBerry first window is always shown full screen. However, many tests rely on specific
+ // window sizes. Create a dummy full screen window, so subsequent windows have correct size.
+ rootWindow.reset(new QWidget);
+ rootWindow->show();
+#endif
}
void tst_QGraphicsView::cleanup()
@@ -1300,7 +1312,7 @@ void tst_QGraphicsView::fitInView()
view.setFixedSize(400, 200);
#endif
- view.show();
+ view.showNormal();
view.fitInView(scene.itemsBoundingRect(), Qt::IgnoreAspectRatio);
qApp->processEvents();
@@ -1412,7 +1424,7 @@ void tst_QGraphicsView::itemsAtPosition()
view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view.setScene(&scene);
- view.show();
+ view.showNormal();
QVERIFY(QTest::qWaitForWindowExposed(&view));
QPoint screenPos = view.viewport()->mapToGlobal(viewPos);
@@ -1530,7 +1542,7 @@ void tst_QGraphicsView::itemsInRect_cosmeticAdjust()
view.setRenderHint(QPainter::Antialiasing, adjustForAntialiasing);
view.setFrameStyle(0);
view.resize(300, 300);
- view.show();
+ view.showNormal();
QVERIFY(QTest::qWaitForWindowActive(&view));
QTRY_VERIFY(rect->numPaints > 0);
@@ -2524,9 +2536,9 @@ public:
bool dirtyPainter;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *w)
{
- dirtyPainter = (painter->pen().color() != Qt::black);
+ dirtyPainter = (painter->pen().color() != w->palette().color(w->foregroundRole()));
painter->setPen(Qt::red);
}
};
@@ -2801,7 +2813,7 @@ void tst_QGraphicsView::scrollBarRanges()
view.setHorizontalScrollBarPolicy(hbarpolicy);
view.setVerticalScrollBarPolicy(vbarpolicy);
- view.show();
+ view.showNormal();
QVERIFY(QTest::qWaitForWindowExposed(&view));
const int offset = view.style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, 0);
@@ -3529,7 +3541,7 @@ void tst_QGraphicsView::moveItemWhileScrolling()
view.setOptimizationFlag(QGraphicsView::DontAdjustForAntialiasing);
view.resize(200, 200);
view.painted = false;
- view.show();
+ view.showNormal();
if (changedConnected)
QObject::connect(view.scene(), SIGNAL(changed(QList<QRectF>)), this, SLOT(dummySlot()));
QVERIFY(QTest::qWaitForWindowExposed(&view));
@@ -4622,7 +4634,7 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect()
QGraphicsView view(&scene);
view.scale(4.15, 4.15);
- view.show();
+ view.showNormal();
qApp->setActiveWindow(&view);
QVERIFY(QTest::qWaitForWindowActive(&view));
@@ -4699,12 +4711,17 @@ void tst_QGraphicsView::hoverLeave()
const QPoint outOfWindow = view.geometry().topRight() + QPoint(50, 0);
QCursor::setPos(outOfWindow);
- view.show();
+ view.showNormal();
qApp->setActiveWindow(&view);
QVERIFY(QTest::qWaitForWindowActive(&view));
QPoint pos = view.viewport()->mapToGlobal(view.mapFromScene(item->mapToScene(10, 10)));
QCursor::setPos(pos);
+
+#if defined(Q_OS_QNX)
+ QEXPECT_FAIL("", "QCursor does not set native cursor on QNX", Abort);
+#endif
+
QTRY_VERIFY(item->receivedEnterEvent);
QCOMPARE(item->enterWidget, view.viewport());
diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
index 1005bf6b3c..83c4582645 100644
--- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
@@ -1246,7 +1246,7 @@ void tst_QAbstractItemView::task250754_fontChange()
vLayout->addWidget(&tree);
QStandardItemModel *m = new QStandardItemModel(this);
- for (int i=0; i<5; ++i) {
+ for (int i=0; i<20; ++i) {
QStandardItem *item = new QStandardItem(QString("Item number %1").arg(i));
for (int j=0; j<5; ++j) {
QStandardItem *child = new QStandardItem(QString("Child Item number %1").arg(j));
@@ -1256,10 +1256,11 @@ void tst_QAbstractItemView::task250754_fontChange()
}
tree.setModel(m);
- w.resize(160, 240); // Minimum width for windows with frame on Windows 8
+ tree.setHeaderHidden(true); // The header is (in certain styles) dpi dependent
+ w.resize(160, 300); // Minimum width for windows with frame on Windows 8
centerOnScreen(&w);
moveCursorAway(&w);
- w.show();
+ w.showNormal();
QVERIFY(QTest::qWaitForWindowExposed(&w));
QFont font = tree.font();
font.setPixelSize(10);
@@ -1579,11 +1580,16 @@ void tst_QAbstractItemView::testDelegateDestroyEditor()
void tst_QAbstractItemView::testClickedSignal()
{
+#if defined Q_OS_BLACKBERRY
+ QWidget rootWindow;
+ rootWindow.show();
+ QTest::qWaitForWindowExposed(&rootWindow);
+#endif
QTableWidget view(5, 5);
centerOnScreen(&view);
moveCursorAway(&view);
- view.show();
+ view.showNormal();
QApplication::setActiveWindow(&view);
QVERIFY(QTest::qWaitForWindowActive(&view));
QCOMPARE(static_cast<QWidget *>(&view), QApplication::activeWindow());
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index 3e6df0f136..869b335a95 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -621,6 +621,9 @@ void tst_QHeaderView::sectionSize_data()
void tst_QHeaderView::sectionSize()
{
+#if defined Q_OS_QNX
+ QSKIP("The section size is dpi dependent on QNX");
+#endif
QFETCH(QList<int>, boundsCheck);
QFETCH(QList<int>, defaultSizes);
QFETCH(int, initialDefaultSize);
@@ -734,6 +737,9 @@ void tst_QHeaderView::visualIndexAt_data()
void tst_QHeaderView::visualIndexAt()
{
+#if defined Q_OS_QNX
+ QSKIP("The section size is dpi dependent on QNX");
+#endif
QFETCH(QList<int>, hidden);
QFETCH(QList<int>, from);
QFETCH(QList<int>, to);
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index 9f5484983d..78a3ad021b 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -1468,15 +1468,16 @@ void tst_QListView::wordWrap()
model.setStringList(list);
lv.setModel(&model);
lv.setWordWrap(true);
- lv.setFixedSize(150, 150);
-#ifdef Q_OS_BLACKBERRY
- // BB standard font size is too big, triggering
- // a horizontal scrollbar even when word-wrapping
- // is enabled
+ lv.setFixedSize(400, 150);
+
+#if defined Q_OS_BLACKBERRY
QFont font = lv.font();
- font.setPointSize(5);
+ // On BB10 the root window is stretched over the whole screen
+ // This makes sure that the text will be long enough to produce
+ // a vertical scrollbar
+ font.setPixelSize(50);
lv.setFont(font);
-#endif // Q_OS_BLACKBERRY
+#endif
lv.showNormal();
QApplication::processEvents();
@@ -2019,7 +2020,7 @@ void tst_QListView::taskQTBUG_9455_wrongScrollbarRanges()
w.setViewMode(QListView::IconMode);
w.resize(116, 132);
w.setMovement(QListView::Static);
- const int spacing = 40;
+ const int spacing = 200;
w.setSpacing(spacing);
w.showNormal();
QVERIFY(QTest::qWaitForWindowExposed(&w));
@@ -2113,6 +2114,12 @@ void tst_QListView::taskQTBUG_21115_scrollToAndHiddenItems_data()
void tst_QListView::taskQTBUG_21115_scrollToAndHiddenItems()
{
+#if defined Q_OS_BLACKBERRY
+ // On BB10 we need to create a root window which is automatically stretched
+ // over the whole screen
+ QWindow rootWindow;
+ rootWindow.show();
+#endif
QFETCH(int, flow);
QListView lv;
@@ -2309,6 +2316,12 @@ void tst_QListView::spacing()
void tst_QListView::testScrollToWithHidden()
{
+#if defined Q_OS_BLACKBERRY
+ // On BB10 we need to create a root window which is automatically stretched
+ // over the whole screen
+ QWindow rootWindow;
+ rootWindow.show();
+#endif
QListView lv;
QStringListModel model;
@@ -2321,7 +2334,7 @@ void tst_QListView::testScrollToWithHidden()
lv.setRowHidden(1, true);
lv.setSpacing(5);
- lv.show();
+ lv.showNormal();
QTest::qWaitForWindowExposed(&lv);
QCOMPARE(lv.verticalScrollBar()->value(), 0);
diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
index 8147ed7885..5474043cf6 100644
--- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
+++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 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.
@@ -43,7 +43,6 @@
#include <QtTest/QtTest>
#include <QtGui/QtGui>
#include <QtWidgets/QtWidgets>
-#include <qeventloop.h>
#include <qlist.h>
#include <qlistwidget.h>
@@ -209,14 +208,7 @@ void tst_QListWidget::cleanupTestCase()
void tst_QListWidget::init()
{
testWidget->clear();
-
- if (testWidget->viewport()->children().count() > 0) {
- QEventLoop eventLoop;
- for (int i=0; i < testWidget->viewport()->children().count(); ++i)
- connect(testWidget->viewport()->children().at(i), SIGNAL(destroyed()), &eventLoop, SLOT(quit()));
- QTimer::singleShot(100, &eventLoop, SLOT(quit()));
- eventLoop.exec();
- }
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
}
void tst_QListWidget::checkDefaultValues()
@@ -317,7 +309,8 @@ void tst_QListWidget::closePersistentEditor()
// actual test
childCount = testWidget->viewport()->children().count();
testWidget->closePersistentEditor(item);
- QTRY_COMPARE(testWidget->viewport()->children().count(), childCount - 1);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCOMPARE(testWidget->viewport()->children().count(), childCount - 1);
}
void tst_QListWidget::setItemHidden()
@@ -1582,7 +1575,7 @@ void tst_QListWidget::task217070_scrollbarsAdjusted()
for(int f=150; f>90 ; f--) {
v.resize(f,100);
QTest::qWait(30);
- QVERIFY(vbar->style()->styleHint(QStyle::SH_ScrollBar_Transient) || vbar->isVisible());
+ QVERIFY(vbar->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, vbar) || vbar->isVisible());
//the horizontal scrollbar must not be visible.
QVERIFY(!hbar->isVisible());
}
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
index b07009aa3c..0579914940 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -3047,7 +3047,13 @@ void tst_QTreeView::styleOptionViewItem()
static const char* s_pos[] = { "Invalid", "Beginning", "Middle", "End", "OnlyOne" };
return s_pos[pos];
}
- public:
+ public:
+ MyDelegate()
+ : QStyledItemDelegate(),
+ count(0),
+ allCollapsed(false)
+ {}
+
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const
{
QVERIFY(qstyleoption_cast<const QStyleOptionViewItemV4 *>(&option));
diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
index dfa7592813..390858ac5b 100644
--- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
+++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
@@ -3092,9 +3092,14 @@ void tst_QTreeWidget::task253109_itemHeight()
void tst_QTreeWidget::task206367_duplication()
{
QWidget topLevel;
+ // Explicitly set the font size because it is dpi dependent on some platforms
+ QFont font;
+ font.setPixelSize(40);
+ topLevel.setFont(font);
QTreeWidget treeWidget(&topLevel);
topLevel.show();
treeWidget.resize(200, 200);
+ treeWidget.setHeaderHidden(true);
treeWidget.setSortingEnabled(true);
QTreeWidgetItem* rootItem = new QTreeWidgetItem( &treeWidget, QStringList("root") );
@@ -3105,10 +3110,9 @@ void tst_QTreeWidget::task206367_duplication()
itemFile->setExpanded(true);
}
rootItem->setExpanded(true);
- QTest::qWait(2000);
//there should be enough room for 2x2 items. If there is a scrollbar, it means the items are duplicated
- QVERIFY(!treeWidget.verticalScrollBar()->isVisible());
+ QTRY_VERIFY(!treeWidget.verticalScrollBar()->isVisible());
}
diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
index 1003a9fb1f..3b7c2ac14d 100644
--- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
+++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
@@ -713,7 +713,7 @@ void tst_QGridLayout::spacingsAndMargins()
grid1.setColumnStretch(columns-1, 1);
grid1.setRowStretch(rows-1, 1);
- toplevel.show();
+ toplevel.showNormal();
toplevel.adjustSize();
QApplication::processEvents();
QVERIFY(QTest::qWaitForWindowExposed(&toplevel));
@@ -1230,6 +1230,9 @@ void tst_QGridLayout::layoutSpacing_data()
style->reimplementSubelementRect = true;
QApplication::setStyle(style);
QWidget *w = new QWidget();
+ QFont font;
+ font.setPixelSize(10);
+ w->setFont(font);
setFrameless(w);
QGridLayout *layout = new QGridLayout();
QPushButton *pb1 = new QPushButton(QLatin1String("Push 1"), w);
diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
index 4ba4cffb78..fd2a82886c 100644
--- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
@@ -611,7 +611,7 @@ void tst_QCompleter::directoryModel_data()
QTest::newRow("(/u)") << "/u" << "" << "Users" << "/Users";
#else
QTest::newRow("()") << "" << "" << "/" << "/";
-#if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_OS_HPUX)
+#if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_OS_HPUX) && !defined(Q_OS_QNX)
QTest::newRow("(/h)") << "/h" << "" << "home" << "/home";
#endif
QTest::newRow("(/et)") << "/et" << "" << "etc" << "/etc";
@@ -657,7 +657,7 @@ void tst_QCompleter::fileSystemModel_data()
// QTest::newRow("(/d)") << "/d" << "" << "Developer" << "/Developer";
#else
QTest::newRow("()") << "" << "" << "/" << "/";
-#if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_OS_HPUX)
+#if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_OS_HPUX) && !defined(Q_OS_QNX)
QTest::newRow("(/h)") << "/h" << "" << "home" << "/home";
#endif
QTest::newRow("(/et)") << "/et" << "" << "etc" << "/etc";
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 45167bac60..077e1aa1df 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -3903,7 +3903,7 @@ void tst_QLineEdit::bidiVisualMovement()
do {
oldPos = newPos;
- QVERIFY(oldPos == positionList[i]);
+ QCOMPARE(oldPos, positionList[i]);
if (basicDir == QChar::DirL) {
QTest::keyClick(&le, Qt::Key_Right);
} else
@@ -3913,12 +3913,12 @@ void tst_QLineEdit::bidiVisualMovement()
i++;
} while (moved);
- QVERIFY(i == positionList.size());
+ QCOMPARE(i, positionList.size());
do {
i--;
oldPos = newPos;
- QVERIFY(oldPos == positionList[i]);
+ QCOMPARE(oldPos, positionList[i]);
if (basicDir == QChar::DirL) {
QTest::keyClick(&le, Qt::Key_Left);
} else
@@ -3939,6 +3939,7 @@ void tst_QLineEdit::bidiLogicalMovement()
{
QFETCH(QString, logical);
QFETCH(int, basicDir);
+ QFETCH(IntList, positionList);
QLineEdit le;
le.setText(logical);
@@ -3951,7 +3952,7 @@ void tst_QLineEdit::bidiLogicalMovement()
do {
oldPos = newPos;
- QVERIFY(oldPos == i);
+ QCOMPARE(oldPos, i);
if (basicDir == QChar::DirL) {
QTest::keyClick(&le, Qt::Key_Right);
} else
@@ -3961,10 +3962,12 @@ void tst_QLineEdit::bidiLogicalMovement()
i++;
} while (moved);
+ QCOMPARE(i, positionList.size());
+
do {
i--;
oldPos = newPos;
- QVERIFY(oldPos == i);
+ QCOMPARE(oldPos, i);
if (basicDir == QChar::DirL) {
QTest::keyClick(&le, Qt::Key_Left);
} else
diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
index 1eccdd768b..1030f0cfbd 100644
--- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
+++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
@@ -633,7 +633,7 @@ void tst_QPushButton::sizeHint()
tabWidget->addTab(tab2, "2");
QVBoxLayout *mainLayout = new QVBoxLayout(dialog);
mainLayout->addWidget(tabWidget);
- dialog->show();
+ dialog->showNormal();
tabWidget->setCurrentWidget(tab2);
tabWidget->setCurrentWidget(tab1);
QTest::qWait(100);
diff --git a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp
index 0dac7d85e4..345b8d82ad 100644
--- a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp
+++ b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp
@@ -316,12 +316,17 @@ void tst_QTabBar::sizeHints()
tabBar.setUsesScrollButtons(false);
tabBar.setElideMode(Qt::ElideRight);
// qDebug() << tabBar.minimumSizeHint() << tabBar.sizeHint();
- QVERIFY(tabBar.minimumSizeHint().width() < 500);
- QVERIFY(tabBar.sizeHint().width() > 700); // unchanged
+
+ // The sizeHint is very much dependent on the screen DPI value
+ // so we can not really predict it.
+ int tabBarMinSizeHintWidth = tabBar.minimumSizeHint().width();
+ int tabBarSizeHintWidth = tabBar.sizeHint().width();
+ QVERIFY(tabBarMinSizeHintWidth < tabBarSizeHintWidth);
+ QVERIFY(tabBarSizeHintWidth > 700); // unchanged
tabBar.addTab("This is tab10 with a very long title");
- QVERIFY(tabBar.minimumSizeHint().width() < 600);
- QVERIFY(tabBar.sizeHint().width() > 700); // unchanged
+ QVERIFY(tabBar.minimumSizeHint().width() > tabBarMinSizeHintWidth);
+ QVERIFY(tabBar.sizeHint().width() > tabBarSizeHintWidth);
}
void tst_QTabBar::setUsesScrollButtons_data()
diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
index 53c76a0da6..fbd8b46466 100644
--- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
+++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
@@ -2018,6 +2018,7 @@ void tst_QTextEdit::fullWidthSelection2()
QPalette myPalette;
myPalette.setColor(QPalette::All, QPalette::HighlightedText, QColor(0,0,0,0));
myPalette.setColor(QPalette::All, QPalette::Highlight, QColor(239,221,85));
+ myPalette.setColor(QPalette::All, QPalette::Base, QColor(255,255,255));
QTextEdit widget;
widget.setPalette(myPalette);
@@ -2218,7 +2219,7 @@ void tst_QTextEdit::twoSameInputMethodEvents()
QInputMethodEvent event("PreEditText", attributes);
QApplication::sendEvent(ed, &event);
- QCOMPARE(ed->document()->firstBlock().layout()->lineCount(), 1);
+ QTRY_COMPARE(ed->document()->firstBlock().layout()->lineCount(), 1);
QApplication::sendEvent(ed, &event);
QCOMPARE(ed->document()->firstBlock().layout()->lineCount(), 1);
}
@@ -2303,7 +2304,7 @@ void tst_QTextEdit::bidiVisualMovement()
do {
oldPos = newPos;
- QVERIFY(oldPos == positionList[i]);
+ QCOMPARE(oldPos, positionList[i]);
if (basicDir == QChar::DirL) {
ed->moveCursor(QTextCursor::Right);
} else
@@ -2315,12 +2316,12 @@ void tst_QTextEdit::bidiVisualMovement()
i++;
} while (moved);
- QVERIFY(i == positionList.size());
+ QCOMPARE(i, positionList.size());
do {
i--;
oldPos = newPos;
- QVERIFY(oldPos == positionList[i]);
+ QCOMPARE(oldPos, positionList[i]);
if (basicDir == QChar::DirL) {
ed->moveCursor(QTextCursor::Left);
} else
@@ -2341,6 +2342,7 @@ void tst_QTextEdit::bidiLogicalMovement()
{
QFETCH(QString, logical);
QFETCH(int, basicDir);
+ QFETCH(QList<int>, positionList);
ed->setText(logical);
@@ -2357,7 +2359,7 @@ void tst_QTextEdit::bidiLogicalMovement()
do {
oldPos = newPos;
- QVERIFY(oldPos == i);
+ QCOMPARE(oldPos, i);
if (basicDir == QChar::DirL) {
ed->moveCursor(QTextCursor::Right);
} else
@@ -2369,10 +2371,12 @@ void tst_QTextEdit::bidiLogicalMovement()
i++;
} while (moved);
+ QCOMPARE(i, positionList.size());
+
do {
i--;
oldPos = newPos;
- QVERIFY(oldPos == i);
+ QCOMPARE(oldPos, i);
if (basicDir == QChar::DirL) {
ed->moveCursor(QTextCursor::Left);
} else