summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorIan Walters <ian.walters@nokia.com>2009-04-06 22:47:32 (GMT)
committerIan Walters <ian.walters@nokia.com>2009-04-06 22:47:32 (GMT)
commitbccb7b178c0255c74d648c3972895f66a70fd87b (patch)
treeead94cee89e2ffda4127201b734f1660f1389585 /tests/auto
parent423d6052844b2026c8acc8826d6546d3afc494d3 (diff)
parentcf42b485ebc1ab3e1f0a804b8c4e404fa99f1f6f (diff)
downloadQt-bccb7b178c0255c74d648c3972895f66a70fd87b.zip
Qt-bccb7b178c0255c74d648c3972895f66a70fd87b.tar.gz
Qt-bccb7b178c0255c74d648c3972895f66a70fd87b.tar.bz2
Merge branch 'master' into contiguouscache
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/auto.pro3
-rw-r--r--tests/auto/math3d/qfixedpt/tst_qfixedpt.cpp32
-rw-r--r--tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp32
-rw-r--r--tests/auto/math3d/qquaternion/tst_qquaternion.cpp32
-rw-r--r--tests/auto/math3d/qvectornd/tst_qvectornd.cpp32
-rw-r--r--tests/auto/math3d/shared/math3dincludes.cpp32
-rw-r--r--tests/auto/math3d/shared/math3dincludes.h32
-rw-r--r--tests/auto/moc/forgotten-qinterface.h2
-rw-r--r--tests/auto/moc/tst_moc.cpp56
-rw-r--r--tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp20
-rw-r--r--tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp12
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp56
-rw-r--r--tests/auto/qcompleter/tst_qcompleter.cpp91
-rw-r--r--tests/auto/qdir/testdir/dir/Makefile0
-rw-r--r--tests/auto/qfile/rename-fallback.qrc5
-rw-r--r--tests/auto/qfile/test/test.pro2
-rw-r--r--tests/auto/qfile/tst_qfile.cpp46
-rw-r--r--tests/auto/qfiledialog/tst_qfiledialog.cpp47
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp25
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp64
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp13
-rw-r--r--tests/auto/qlocale/tst_qlocale.cpp11
-rw-r--r--tests/auto/qmake/qmake.pro2
-rw-r--r--tests/auto/qmake/testcompiler.cpp305
-rw-r--r--tests/auto/qmake/testcompiler.h49
-rw-r--r--tests/auto/qmake/testdata/shadow_files_build/README2
-rw-r--r--tests/auto/qmake/tst_qmake.cpp34
-rw-r--r--tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp295
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp95
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp16
-rw-r--r--tests/auto/qprocess/tst_qprocess.cpp26
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp28
-rw-r--r--tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp112
-rw-r--r--tests/auto/qsplitter/qsplitter.pro3
-rw-r--r--tests/auto/qsplitter/tst_qsplitter.cpp2
-rw-r--r--tests/auto/qsqldatabase/tst_databases.h39
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp194
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp95
-rw-r--r--tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp12
-rw-r--r--tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp167
-rw-r--r--tests/auto/qsqlthread/tst_qsqlthread.cpp10
-rw-r--r--tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp23
-rw-r--r--tests/auto/qtableview/tst_qtableview.cpp5
-rw-r--r--tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp26
-rw-r--r--tests/auto/qtextobject/tst_qtextobject.cpp19
-rw-r--r--tests/auto/qtextstream/tst_qtextstream.cpp4
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp26
-rw-r--r--tests/auto/selftests/alive/alive.pro1
-rw-r--r--tests/auto/selftests/assert/assert.pro1
-rw-r--r--tests/auto/selftests/badxml/badxml.pro1
-rw-r--r--tests/auto/selftests/benchlibcallgrind/benchlibcallgrind.pro1
-rw-r--r--tests/auto/selftests/benchlibeventcounter/benchlibeventcounter.pro1
-rw-r--r--tests/auto/selftests/benchliboptions/benchliboptions.pro1
-rw-r--r--tests/auto/selftests/benchlibtickcounter/benchlibtickcounter.pro1
-rw-r--r--tests/auto/selftests/benchlibwalltime/benchlibwalltime.pro1
-rw-r--r--tests/auto/selftests/cmptest/cmptest.pro1
-rw-r--r--tests/auto/selftests/commandlinedata/commandlinedata.pro1
-rw-r--r--tests/auto/selftests/crashes/crashes.pro1
-rw-r--r--tests/auto/selftests/datatable/datatable.pro1
-rw-r--r--tests/auto/selftests/datetime/datetime.pro1
-rw-r--r--tests/auto/selftests/differentexec/differentexec.pro1
-rw-r--r--tests/auto/selftests/exception/exception.pro1
-rw-r--r--tests/auto/selftests/expectfail/expectfail.pro1
-rw-r--r--tests/auto/selftests/failinit/failinit.pro1
-rw-r--r--tests/auto/selftests/failinitdata/failinitdata.pro1
-rw-r--r--tests/auto/selftests/fetchbogus/fetchbogus.pro1
-rw-r--r--tests/auto/selftests/globaldata/globaldata.pro1
-rw-r--r--tests/auto/selftests/maxwarnings/maxwarnings.pro1
-rw-r--r--tests/auto/selftests/multiexec/multiexec.pro1
-rw-r--r--tests/auto/selftests/qexecstringlist/qexecstringlist.pro1
-rw-r--r--tests/auto/selftests/singleskip/singleskip.pro1
-rw-r--r--tests/auto/selftests/skip/skip.pro1
-rw-r--r--tests/auto/selftests/skipglobal/skipglobal.pro1
-rw-r--r--tests/auto/selftests/skipinit/skipinit.pro1
-rw-r--r--tests/auto/selftests/skipinitdata/skipinitdata.pro1
-rw-r--r--tests/auto/selftests/sleep/sleep.pro1
-rw-r--r--tests/auto/selftests/strcmp/strcmp.pro1
-rw-r--r--tests/auto/selftests/subtest/subtest.pro1
-rw-r--r--tests/auto/selftests/tst_selftests.cpp6
-rwxr-xr-xtests/auto/selftests/updateBaselines.sh34
-rw-r--r--tests/auto/selftests/waitwithoutgui/waitwithoutgui.pro1
-rw-r--r--tests/auto/selftests/warnings/warnings.pro1
-rw-r--r--tests/auto/selftests/xunit/xunit.pro3
-rw-r--r--tests/auto/uiloader/baseline/css_splitter.ui63
84 files changed, 1668 insertions, 705 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 5d71e79..cfd9525 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -408,8 +408,7 @@ SUBDIRS += checkxmlfiles \
xmlpatternsdiagnosticsts \
xmlpatternsview \
xmlpatternsxqts \
- xmlpatternsxslts \
- xmlpatterns
+ xmlpatternsxslts
xmlpatternsdiagnosticsts.depends = xmlpatternsxqts
xmlpatternsview.depends = xmlpatternsxqts
diff --git a/tests/auto/math3d/qfixedpt/tst_qfixedpt.cpp b/tests/auto/math3d/qfixedpt/tst_qfixedpt.cpp
index f8c8d09..ef333a6 100644
--- a/tests/auto/math3d/qfixedpt/tst_qfixedpt.cpp
+++ b/tests/auto/math3d/qfixedpt/tst_qfixedpt.cpp
@@ -5,7 +5,37 @@
**
** This file is part of the $MODULE$ of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
index 3d92adf..8a7dd49 100644
--- a/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
+++ b/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
@@ -5,7 +5,37 @@
**
** This file is part of the $MODULE$ of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/math3d/qquaternion/tst_qquaternion.cpp b/tests/auto/math3d/qquaternion/tst_qquaternion.cpp
index 252bdc7..325cb40 100644
--- a/tests/auto/math3d/qquaternion/tst_qquaternion.cpp
+++ b/tests/auto/math3d/qquaternion/tst_qquaternion.cpp
@@ -5,7 +5,37 @@
**
** This file is part of the $MODULE$ of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/math3d/qvectornd/tst_qvectornd.cpp b/tests/auto/math3d/qvectornd/tst_qvectornd.cpp
index 48a41b9..83bacdf 100644
--- a/tests/auto/math3d/qvectornd/tst_qvectornd.cpp
+++ b/tests/auto/math3d/qvectornd/tst_qvectornd.cpp
@@ -5,7 +5,37 @@
**
** This file is part of the $MODULE$ of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/math3d/shared/math3dincludes.cpp b/tests/auto/math3d/shared/math3dincludes.cpp
index c4e1533..725079d 100644
--- a/tests/auto/math3d/shared/math3dincludes.cpp
+++ b/tests/auto/math3d/shared/math3dincludes.cpp
@@ -5,7 +5,37 @@
**
** This file is part of the $MODULE$ of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/math3d/shared/math3dincludes.h b/tests/auto/math3d/shared/math3dincludes.h
index 9e406ee..23b0f16 100644
--- a/tests/auto/math3d/shared/math3dincludes.h
+++ b/tests/auto/math3d/shared/math3dincludes.h
@@ -5,7 +5,37 @@
**
** This file is part of the $MODULE$ of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/auto/moc/forgotten-qinterface.h b/tests/auto/moc/forgotten-qinterface.h
index a11793b..370a3d0 100644
--- a/tests/auto/moc/forgotten-qinterface.h
+++ b/tests/auto/moc/forgotten-qinterface.h
@@ -39,6 +39,8 @@
**
****************************************************************************/
+#include <QObject>
+
struct MyInterface
{
virtual ~MyInterface() {}
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp
index 39f4f23..4e4f6e7 100644
--- a/tests/auto/moc/tst_moc.cpp
+++ b/tests/auto/moc/tst_moc.cpp
@@ -466,6 +466,8 @@ public:
inline tst_Moc() {}
private slots:
+ void initTestCase();
+
void slotWithException() throw(MyStruct);
void dontStripNamespaces();
void oldStyleCasts();
@@ -519,8 +521,28 @@ private:
bool user2() { return false; };
bool user3() { return false; };
bool userFunction(){ return false; };
+
+private:
+ QString qtIncludePath;
};
+void tst_Moc::initTestCase()
+{
+#if defined(Q_OS_UNIX)
+ QProcess proc;
+ proc.start("qmake", QStringList() << "-query" << "QT_INSTALL_HEADERS");
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitCode(), 0);
+ QByteArray output = proc.readAllStandardOutput();
+ QVERIFY(!output.isEmpty());
+ QCOMPARE(proc.readAllStandardError(), QByteArray());
+ qtIncludePath = QString::fromLocal8Bit(output).trimmed();
+ QFileInfo fi(qtIncludePath);
+ QVERIFY(fi.exists());
+ QVERIFY(fi.isDir());
+#endif
+}
+
void tst_Moc::slotWithException() throw(MyStruct)
{
// be happy
@@ -552,8 +574,6 @@ void tst_Moc::oldStyleCasts()
QSKIP("Not tested when cross-compiled", SkipAll);
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
- QVERIFY(!qgetenv("QTDIR").isNull());
-
QProcess proc;
proc.start("moc", QStringList(srcify("/oldstyle-casts.h")));
QVERIFY(proc.waitForFinished());
@@ -564,7 +584,7 @@ void tst_Moc::oldStyleCasts()
QStringList args;
args << "-c" << "-x" << "c++" << "-Wold-style-cast" << "-I" << "."
- << "-I" << qgetenv("QTDIR") + "/include" << "-o" << "/dev/null" << "-";
+ << "-I" << qtIncludePath << "-o" << "/dev/null" << "-";
proc.start("gcc", args);
QVERIFY(proc.waitForStarted());
proc.write(mocOut);
@@ -584,8 +604,6 @@ void tst_Moc::warnOnExtraSignalSlotQualifiaction()
QSKIP("Not tested when cross-compiled", SkipAll);
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
- QVERIFY(!qgetenv("QTDIR").isNull());
-
QProcess proc;
proc.start("moc", QStringList(srcify("extraqualification.h")));
QVERIFY(proc.waitForFinished());
@@ -630,8 +648,6 @@ void tst_Moc::inputFileNameWithDotsButNoExtension()
QSKIP("Not tested when cross-compiled", SkipAll);
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
- QVERIFY(!qgetenv("QTDIR").isNull());
-
QProcess proc;
proc.setWorkingDirectory(QString(SRCDIR) + "/task71021");
proc.start("moc", QStringList("../Header"));
@@ -643,7 +659,7 @@ void tst_Moc::inputFileNameWithDotsButNoExtension()
QStringList args;
args << "-c" << "-x" << "c++" << "-I" << ".."
- << "-I" << qgetenv("QTDIR") + "/include" << "-o" << "/dev/null" << "-";
+ << "-I" << qtIncludePath << "-o" << "/dev/null" << "-";
proc.start("gcc", args);
QVERIFY(proc.waitForStarted());
proc.write(mocOut);
@@ -848,10 +864,11 @@ void tst_Moc::warnOnMultipleInheritance()
QSKIP("Not tested when cross-compiled", SkipAll);
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
- QVERIFY(!qgetenv("QTDIR").isNull());
-
QProcess proc;
- proc.start("moc", QStringList(srcify("warn-on-multiple-qobject-subclasses.h")));
+ QStringList args;
+ args << "-I" << qtIncludePath + "/QtGui"
+ << srcify("warn-on-multiple-qobject-subclasses.h");
+ proc.start("moc", args);
QVERIFY(proc.waitForFinished());
QCOMPARE(proc.exitCode(), 0);
QByteArray mocOut = proc.readAllStandardOutput();
@@ -870,17 +887,18 @@ void tst_Moc::forgottenQInterface()
QSKIP("Not tested when cross-compiled", SkipAll);
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
- QVERIFY(!qgetenv("QTDIR").isNull());
-
QProcess proc;
- proc.start("moc", QStringList(srcify("forgotten-qinterface.h")));
+ QStringList args;
+ args << "-I" << qtIncludePath + "/QtCore"
+ << srcify("forgotten-qinterface.h");
+ proc.start("moc", args);
QVERIFY(proc.waitForFinished());
QCOMPARE(proc.exitCode(), 0);
QByteArray mocOut = proc.readAllStandardOutput();
QVERIFY(!mocOut.isEmpty());
QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
QCOMPARE(mocWarning, QString(SRCDIR) +
- QString("/forgotten-qinterface.h:53: Warning: Class Test implements the interface MyInterface but does not list it in Q_INTERFACES. qobject_cast to MyInterface will not work!\n"));
+ QString("/forgotten-qinterface.h:55: Warning: Class Test implements the interface MyInterface but does not list it in Q_INTERFACES. qobject_cast to MyInterface will not work!\n"));
#else
QSKIP("Only tested on linux/gcc", SkipAll);
#endif
@@ -951,8 +969,6 @@ void tst_Moc::frameworkSearchPath()
QSKIP("Not tested when cross-compiled", SkipAll);
#endif
#if defined(Q_OS_UNIX)
- QVERIFY(!qgetenv("QTDIR").isNull());
-
QStringList args;
args << "-F" << srcify(".")
<< srcify("interface-from-framework.h")
@@ -991,8 +1007,6 @@ void tst_Moc::templateGtGt()
QSKIP("Not tested when cross-compiled", SkipAll);
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
- QVERIFY(!qgetenv("QTDIR").isNull());
-
QProcess proc;
proc.start("moc", QStringList(srcify("template-gtgt.h")));
QVERIFY(proc.waitForFinished());
@@ -1009,8 +1023,6 @@ void tst_Moc::templateGtGt()
void tst_Moc::defineMacroViaCmdline()
{
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
- QVERIFY(!qgetenv("QTDIR").isNull());
-
QProcess proc;
QStringList args;
@@ -1099,8 +1111,6 @@ void tst_Moc::warnOnPropertyWithoutREAD()
QSKIP("Not tested when cross-compiled", SkipAll);
#endif
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
- QVERIFY(!qgetenv("QTDIR").isNull());
-
QProcess proc;
proc.start("moc", QStringList(srcify("warn-on-property-without-read.h")));
QVERIFY(proc.waitForFinished());
diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
index c06485d..2d91186 100644
--- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
+++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
@@ -89,7 +89,7 @@ private slots:
void unicode();
void precision_data() { generic_data(); }
void precision();
- void insertORA_data();
+ void insertORA_data() { generic_data("QOCI"); }
void insertORA();
void batchInsert_data() { generic_data(); }
void batchInsert();
@@ -101,7 +101,7 @@ private slots:
void insertFieldNameContainsWS(); // For task 117996
private:
- void generic_data();
+ void generic_data(const QString &engine=QString());
void createTestTables( QSqlDatabase db );
void dropTestTables( QSqlDatabase db );
void populateTestTables( QSqlDatabase db );
@@ -117,10 +117,14 @@ tst_Q3SqlCursor::~tst_Q3SqlCursor()
{
}
-void tst_Q3SqlCursor::generic_data()
+void tst_Q3SqlCursor::generic_data(const QString &engine)
{
- if ( dbs.fillTestTable() == 0 )
- QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ if ( dbs.fillTestTable(engine) == 0 ) {
+ if(engine.isEmpty())
+ QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ else
+ QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll );
+ }
}
void tst_Q3SqlCursor::createTestTables( QSqlDatabase db )
@@ -429,12 +433,6 @@ static QString dumpUtf8( const QString& str )
return res;
}
-void tst_Q3SqlCursor::insertORA_data()
-{
- if ( dbs.fillTestTable( "QOCI" ) == 0 )
- QSKIP( "No Oracle database drivers are available in this Qt configuration", SkipAll );
-}
-
void tst_Q3SqlCursor::insertORA()
{
QFETCH( QString, dbName );
diff --git a/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp b/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp
index a8c5940..9ab74f0 100644
--- a/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp
+++ b/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp
@@ -76,7 +76,7 @@ private slots:
void _exec();
private:
- void generic_data();
+ void generic_data(const QString &engine=QString());
void createTestTables( QSqlDatabase db );
void dropTestTables( QSqlDatabase db );
void populateTestTables( QSqlDatabase db );
@@ -92,10 +92,14 @@ tst_Q3SqlSelectCursor::~tst_Q3SqlSelectCursor()
{
}
-void tst_Q3SqlSelectCursor::generic_data()
+void tst_Q3SqlSelectCursor::generic_data(const QString& engine)
{
- if ( dbs.fillTestTable() == 0 )
- QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ if ( dbs.fillTestTable(engine) == 0 ) {
+ if(engine.isEmpty())
+ QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ else
+ QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll );
+ }
}
void tst_Q3SqlSelectCursor::createTestTables( QSqlDatabase db )
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp
index 0db9fdf..70059f2 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -56,6 +56,7 @@
#include <qlistwidget.h>
#include <qtreewidget.h>
#include <qtablewidget.h>
+#include <qscrollbar.h>
#ifdef Q_WS_MAC
#include <qmacstyle_mac.h>
#elif defined Q_WS_X11
@@ -138,6 +139,8 @@ private slots:
void task248169_popupWithMinimalSize();
void task247863_keyBoardSelection();
void setModelColumn();
+ void noScrollbar_data();
+ void noScrollbar();
protected slots:
void onEditTextChanged( const QString &newString );
@@ -2129,7 +2132,7 @@ void tst_QComboBox::task248169_popupWithMinimalSize()
QFrame *container = qFindChild<QComboBoxPrivateContainer *>(&comboBox);
QVERIFY(container);
- QVERIFY(desktop.availableGeometry().contains(container->geometry()));
+ QVERIFY(desktop.screenGeometry(container).contains(container->geometry()));
}
void tst_QComboBox::task247863_keyBoardSelection()
@@ -2178,5 +2181,56 @@ void tst_QComboBox::setModelColumn()
QCOMPARE(box.currentText(), QString("zero"));
}
+void tst_QComboBox::noScrollbar_data()
+{
+ QTest::addColumn<QString>("stylesheet");
+
+ QTest::newRow("normal") << QString();
+ QTest::newRow("border") << QString::fromLatin1("QAbstractItemView { border: 12px solid blue;}");
+ QTest::newRow("margin") << QString::fromLatin1("QAbstractItemView { margin: 12px 15px 13px 10px; }");
+ QTest::newRow("padding") << QString::fromLatin1("QAbstractItemView { padding: 12px 15px 13px 10px;}");
+ QTest::newRow("everything") << QString::fromLatin1("QAbstractItemView { border: 12px solid blue; "
+ " padding: 12px 15px 13px 10px; margin: 12px 15px 13px 10px; }");
+ QTest::newRow("everything and more") << QString::fromLatin1("QAbstractItemView { border: 1px 3px 5px 1px solid blue; "
+ " padding: 2px 5px 3px 1px; margin: 2px 5px 3px 1px; } "
+ " QAbstractItemView::item { border: 2px solid green; "
+ " padding: 1px 1px 2px 2px margin: 1px; } " );
+}
+
+void tst_QComboBox::noScrollbar()
+{
+ QStringList initialContent;
+ initialContent << "foo" << "bar" << "foobar" << "moo";
+ QFETCH(QString, stylesheet);
+
+ {
+ QComboBox comboBox;
+ comboBox.setStyleSheet(stylesheet);
+ comboBox.addItems(initialContent);
+ comboBox.show();
+ comboBox.resize(200, comboBox.height());
+ QTest::qWait(100);
+ comboBox.showPopup();
+ QTest::qWait(100);
+ QVERIFY(!comboBox.view()->horizontalScrollBar()->isVisible());
+ QVERIFY(!comboBox.view()->verticalScrollBar()->isVisible());
+ }
+
+ {
+ QTableWidget *table = new QTableWidget(2,2);
+ QComboBox comboBox;
+ comboBox.setStyleSheet(stylesheet);
+ comboBox.setView(table);
+ comboBox.setModel(table->model());
+ comboBox.show();
+ QTest::qWait(100);
+ comboBox.resize(200, comboBox.height());
+ comboBox.showPopup();
+ QTest::qWait(100);
+ QVERIFY(!comboBox.view()->horizontalScrollBar()->isVisible());
+ QVERIFY(!comboBox.view()->verticalScrollBar()->isVisible());
+ }
+}
+
QTEST_MAIN(tst_QComboBox)
#include "tst_qcombobox.moc"
diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp
index 6434d49..656995a 100644
--- a/tests/auto/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/qcompleter/tst_qcompleter.cpp
@@ -140,6 +140,8 @@ private slots:
// task-specific tests below me
void task178797_activatedOnReturn();
void task189564_omitNonSelectableItems();
+ void task246056_setCompletionPrefix();
+ void task250064_lostFocus();
private:
void filter();
@@ -1093,5 +1095,94 @@ void tst_QCompleter::task189564_omitNonSelectableItems()
QVERIFY(matches2.isEmpty());
}
+class task246056_ComboBox : public QComboBox
+{
+ Q_OBJECT
+public:
+ task246056_ComboBox()
+ {
+ setEditable(true);
+ setInsertPolicy(NoInsert);
+ Q_ASSERT(completer());
+ completer()->setCompletionMode(QCompleter::PopupCompletion);
+ completer()->setCompletionRole(Qt::DisplayRole);
+ connect(lineEdit(), SIGNAL(editingFinished()), SLOT(setCompletionPrefix()));
+ }
+private slots:
+ void setCompletionPrefix() { completer()->setCompletionPrefix(lineEdit()->text()); }
+};
+
+void tst_QCompleter::task246056_setCompletionPrefix()
+{
+ task246056_ComboBox *comboBox = new task246056_ComboBox;
+ comboBox->addItem("");
+ comboBox->addItem("a1");
+ comboBox->addItem("a2");
+ comboBox->show();
+ comboBox->setFocus();
+ QTest::qWait(100);
+ QTest::keyPress(comboBox, 'a');
+ QTest::keyPress(comboBox->completer()->popup(), Qt::Key_Down);
+ QTest::keyPress(comboBox->completer()->popup(), Qt::Key_Down);
+ QTest::keyPress(comboBox->completer()->popup(), Qt::Key_Enter); // don't crash!
+}
+
+class task250064_TextEdit : public QTextEdit
+{
+public:
+ QCompleter *completer;
+
+ task250064_TextEdit()
+ {
+ completer = new QCompleter;
+ completer->setWidget(this);
+ }
+
+ void keyPressEvent (QKeyEvent *e)
+ {
+ completer->popup();
+ QTextEdit::keyPressEvent(e);
+ }
+};
+
+class task250064_Widget : public QWidget
+{
+ Q_OBJECT
+public:
+ task250064_TextEdit *textEdit;
+
+ task250064_Widget(task250064_TextEdit *textEdit)
+ : textEdit(textEdit)
+ {
+ QTabWidget *tabWidget = new QTabWidget;
+ tabWidget->setFocusPolicy(Qt::ClickFocus);
+ tabWidget->addTab(textEdit, "untitled");
+
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ layout->addWidget(tabWidget);
+
+ textEdit->setPlainText("bla bla bla");
+ textEdit->setFocus();
+ }
+
+ void setCompletionModel()
+ {
+ textEdit->completer->setModel(0);
+ }
+};
+
+void tst_QCompleter::task250064_lostFocus()
+{
+ task250064_TextEdit *textEdit = new task250064_TextEdit;
+ task250064_Widget *widget = new task250064_Widget(textEdit);
+ widget->show();
+ QTest::qWait(100);
+ QTest::keyPress(textEdit, 'a');
+ Qt::FocusPolicy origPolicy = textEdit->focusPolicy();
+ QVERIFY(origPolicy != Qt::NoFocus);
+ widget->setCompletionModel();
+ QCOMPARE(textEdit->focusPolicy(), origPolicy);
+}
+
QTEST_MAIN(tst_QCompleter)
#include "tst_qcompleter.moc"
diff --git a/tests/auto/qdir/testdir/dir/Makefile b/tests/auto/qdir/testdir/dir/Makefile
deleted file mode 100644
index e69de29..0000000
--- a/tests/auto/qdir/testdir/dir/Makefile
+++ /dev/null
diff --git a/tests/auto/qfile/rename-fallback.qrc b/tests/auto/qfile/rename-fallback.qrc
new file mode 100644
index 0000000..c8a894a
--- /dev/null
+++ b/tests/auto/qfile/rename-fallback.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>rename-fallback.qrc</file>
+</qresource>
+</RCC>
diff --git a/tests/auto/qfile/test/test.pro b/tests/auto/qfile/test/test.pro
index 2293bd7..68f4c05 100644
--- a/tests/auto/qfile/test/test.pro
+++ b/tests/auto/qfile/test/test.pro
@@ -17,7 +17,7 @@ QT = core network
DEFINES += SRCDIR=\\\"$$PWD/../\\\"
}
-RESOURCES += ../qfile.qrc
+RESOURCES += ../qfile.qrc ../rename-fallback.qrc
TARGET = ../tst_qfile
diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp
index 48902c7..829e0b3 100644
--- a/tests/auto/qfile/tst_qfile.cpp
+++ b/tests/auto/qfile/tst_qfile.cpp
@@ -169,6 +169,8 @@ private slots:
void rename_data();
void rename();
void renameWithAtEndSpecialFile() const;
+ void renameFallback();
+ void renameMultiple();
void appendAndRead();
void miscWithUncPathAsCurrentDir();
void standarderror();
@@ -214,6 +216,14 @@ void tst_QFile::cleanup()
{
// TODO: Add cleanup code here.
// This will be executed immediately after each test is run.
+
+ // for renameFallback()
+ QFile::remove("file-rename-destination.txt");
+
+ // for renameMultiple()
+ QFile::remove("file-to-be-renamed.txt");
+ QFile::remove("file-renamed-once.txt");
+ QFile::remove("file-renamed-twice.txt");
}
void tst_QFile::initTestCase()
@@ -2091,6 +2101,42 @@ void tst_QFile::renameWithAtEndSpecialFile() const
QVERIFY(QFile::rename(newName, originalName));
}
+void tst_QFile::renameFallback()
+{
+ // Using a resource file both to trigger QFile::rename's fallback handling
+ // and as a *read-only* source whose move should fail.
+ QFile file(":/rename-fallback.qrc");
+ QVERIFY(file.exists() && "(test-precondition)");
+ QFile::remove("file-rename-destination.txt");
+
+ QVERIFY(!file.rename("file-rename-destination.txt"));
+ QVERIFY(!QFile::exists("file-rename-destination.txt"));
+}
+
+void tst_QFile::renameMultiple()
+{
+ // create the file if it doesn't exist
+ QFile file("file-to-be-renamed.txt");
+ QVERIFY(file.open(QIODevice::ReadWrite) && "(test-precondition)");
+
+ // any stale files from previous test failures?
+ QFile::remove("file-renamed-once.txt");
+ QFile::remove("file-renamed-twice.txt");
+
+ // begin testing
+ QVERIFY(file.rename("file-renamed-once.txt"));
+ QCOMPARE(file.fileName(), QString("file-renamed-once.txt"));
+ QVERIFY(file.rename("file-renamed-twice.txt"));
+ QCOMPARE(file.fileName(), QString("file-renamed-twice.txt"));
+
+ QVERIFY(!QFile::exists("file-to-be-renamed.txt"));
+ QVERIFY(!QFile::exists("file-renamed-once.txt"));
+ QVERIFY(QFile::exists("file-renamed-twice.txt"));
+
+ file.remove();
+ QVERIFY(!QFile::exists("file-renamed-twice.txt"));
+}
+
void tst_QFile::appendAndRead()
{
QFile writeFile(QLatin1String("appendfile.txt"));
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp
index b03d459..bade586 100644
--- a/tests/auto/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp
@@ -1526,6 +1526,42 @@ private:
};
+class sortProxy : public QSortFilterProxyModel
+{
+public:
+ sortProxy(QObject *parent) : QSortFilterProxyModel(parent)
+ {
+ }
+protected:
+ virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const
+ {
+ QFileSystemModel * const model = qobject_cast<QFileSystemModel *>(sourceModel());
+ const QFileInfo leftInfo(model->fileInfo(left));
+ const QFileInfo rightInfo(model->fileInfo(right));
+
+ if (leftInfo.isDir() == rightInfo.isDir())
+ return(leftInfo.filePath().compare(rightInfo.filePath(),Qt::CaseInsensitive) < 0);
+ else if (leftInfo.isDir())
+ return(false);
+ else
+ return(true);
+ }
+};
+
+class CrashDialog : public QNonNativeFileDialog
+{
+ Q_OBJECT
+
+public:
+ CrashDialog(QWidget *parent, const QString &caption, const
+QString &dir, const QString &filter)
+ : QNonNativeFileDialog(parent, caption, dir, filter)
+ {
+ sortProxy *proxyModel = new sortProxy(this);
+ setProxyModel(proxyModel);
+ }
+};
+
void tst_QFiledialog::task227304_proxyOnFileDialog()
{
QNonNativeFileDialog fd(0, "", QDir::currentPath(), 0);
@@ -1537,6 +1573,17 @@ void tst_QFiledialog::task227304_proxyOnFileDialog()
QTest::keyClick(edit, Qt::Key_S);
QTest::qWait(200);
QTest::keyClick(edit->completer()->popup(), Qt::Key_Down);
+
+ CrashDialog *dialog = new CrashDialog(0, QString("crash dialog test"), QDir::homePath(), QString("*") );
+ dialog->setFileMode(QFileDialog::ExistingFile);
+ dialog->show();
+
+ QListView *list = qFindChild<QListView*>(dialog, "listView");
+ QTest::qWait(200);
+ QTest::keyClick(list, Qt::Key_Down);
+ QTest::keyClick(list, Qt::Key_Return);
+ QTest::qWait(200);
+
}
void tst_QFiledialog::task227930_correctNavigationKeyboardBehavior()
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 7964c9b..af40e67 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -512,6 +512,17 @@ void tst_QGraphicsItem::destruction()
QCOMPARE(itemDeleted, 59);
}
QCOMPARE(itemDeleted, 109);
+ {
+ QGraphicsScene *scene = new QGraphicsScene;
+ QGraphicsRectItem *parent = new QGraphicsRectItem;
+ Item *child = new Item;
+ child->setParentItem(parent);
+ parent->setVisible(false);
+ scene->addItem(parent);
+ QCOMPARE(child->parentItem(), parent);
+ delete scene;
+ QCOMPARE(itemDeleted, 110);
+ }
}
void tst_QGraphicsItem::deleteChildItem()
@@ -4499,7 +4510,7 @@ void tst_QGraphicsItem::itemClipsChildrenToShape2()
QPainter painter(&image);
scene.render(&painter);
painter.end();
-
+
QCOMPARE(image.pixel(5, 5), QColor(0, 0, 255).rgba());
QCOMPARE(image.pixel(5, 10), QRgb(0));
QCOMPARE(image.pixel(10, 5), QRgb(0));
@@ -5156,7 +5167,7 @@ void tst_QGraphicsItem::task240400_clickOnTextItem()
QVERIFY(selectable ? item->isSelected() : !item->isSelected());
- //
+ //
if (textFlags & Qt::TextEditorInteraction)
QVERIFY(item->textCursor().columnNumber() > column);
else
@@ -5169,7 +5180,7 @@ void tst_QGraphicsItem::task243707_addChildBeforeParent()
// inconsistent internal state that can cause a crash. This test shows
// one such crash.
QGraphicsScene scene;
- QGraphicsWidget *widget = new QGraphicsWidget;
+ QGraphicsWidget *widget = new QGraphicsWidget;
QGraphicsWidget *widget2 = new QGraphicsWidget(widget);
scene.addItem(widget2);
QVERIFY(!widget2->parentItem());
@@ -5285,7 +5296,7 @@ void tst_QGraphicsItem::itemTransform_unrelated()
QCOMPARE(stranger1->itemTransform(stranger2).map(QPointF(10, 10)), QPointF(10, 10));
QCOMPARE(stranger2->itemTransform(stranger1).map(QPointF(10, 10)), QPointF(10, 10));
}
-
+
void tst_QGraphicsItem::opacity_data()
{
QTest::addColumn<qreal>("p_opacity");
@@ -5494,7 +5505,7 @@ void tst_QGraphicsItem::nestedClipping()
l1->setData(0, "l1");
l2->setData(0, "l2");
l3->setData(0, "l3");
-
+
QGraphicsView view(&scene);
view.show();
#ifdef Q_WS_X11
@@ -5522,7 +5533,7 @@ void tst_QGraphicsItem::nestedClipping()
QCOMPARE(image.pixel(80, 130), qRgba(255, 255, 0, 255));
QCOMPARE(image.pixel(92, 105), qRgba(0, 255, 0, 255));
QCOMPARE(image.pixel(105, 105), qRgba(0, 0, 255, 255));
-#if 0
+#if 0
// Enable this to compare if the test starts failing.
image.save("nestedClipping_reference.png");
#endif
@@ -5664,7 +5675,7 @@ void tst_QGraphicsItem::tabChangesFocus_data()
void tst_QGraphicsItem::tabChangesFocus()
{
QFETCH(bool, tabChangesFocus);
-
+
QGraphicsScene scene;
QGraphicsTextItem *item = scene.addText("Hello");
item->setTabChangesFocus(tabChangesFocus);
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index de023f5..dee3f54 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -259,6 +259,35 @@ void tst_QGraphicsWidget::cleanup()
{
}
+class SizeHinter : public QGraphicsWidget
+{
+public:
+ SizeHinter(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0,
+ const QSizeF &min = QSizeF(5,5),
+ const QSizeF &pref = QSizeF(50, 50),
+ const QSizeF &max = QSizeF(500, 500))
+ : QGraphicsWidget(parent, wFlags)
+ {
+ m_sizes[Qt::MinimumSize] = min;
+ m_sizes[Qt::PreferredSize] = pref;
+ m_sizes[Qt::MaximumSize] = max;
+
+ }
+ void setSizeHint(Qt::SizeHint which, const QSizeF &newSizeHint)
+ {
+ m_sizes[which] = newSizeHint;
+ }
+
+protected:
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const
+ {
+ Q_UNUSED(constraint);
+ return m_sizes[which];
+ }
+private:
+ QSizeF m_sizes[4];
+};
+
void tst_QGraphicsWidget::qgraphicswidget()
{
SubQGraphicsWidget widget;
@@ -282,6 +311,12 @@ void tst_QGraphicsWidget::qgraphicswidget()
QCOMPARE(widget.type(), (int)QGraphicsWidget::Type);
QCOMPARE(widget.call_propertyChange(QString(), QVariant()), QVariant());
widget.call_sizeHint(Qt::PreferredSize, QSizeF());
+
+ QGraphicsScene scene;
+ QGraphicsWidget *parent = new QGraphicsWidget;
+ SizeHinter *child = new SizeHinter(parent);
+
+ QCOMPARE(child->minimumSize(), QSizeF(5, 5));
}
void tst_QGraphicsWidget::activation()
@@ -1516,35 +1551,6 @@ enum WhichSize {
None,
};
-class SizeHinter : public QGraphicsWidget
-{
-public:
- SizeHinter(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0,
- const QSizeF &min = QSizeF(5,5),
- const QSizeF &pref = QSizeF(50, 50),
- const QSizeF &max = QSizeF(500, 500))
- : QGraphicsWidget(parent, wFlags)
- {
- m_sizes[Qt::MinimumSize] = min;
- m_sizes[Qt::PreferredSize] = pref;
- m_sizes[Qt::MaximumSize] = max;
-
- }
- void setSizeHint(Qt::SizeHint which, const QSizeF &newSizeHint)
- {
- m_sizes[which] = newSizeHint;
- }
-
-protected:
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const
- {
- Q_UNUSED(constraint);
- return m_sizes[which];
- }
-private:
- QSizeF m_sizes[4];
-};
-
typedef QPair<int, QVariant> Inst;
Q_DECLARE_METATYPE(Inst)
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index 87e966f..8779831 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -257,6 +257,7 @@ private slots:
void task233101_cursorPosAfterInputMethod_data();
void task233101_cursorPosAfterInputMethod();
void task241436_passwordEchoOnEditRestoreEchoMode();
+ void task248948_redoRemovedSelection();
protected slots:
#ifdef QT3_SUPPORT
@@ -3487,5 +3488,17 @@ void tst_QLineEdit::task241436_passwordEchoOnEditRestoreEchoMode()
testWidget->setEchoMode(QLineEdit::Normal);
}
+void tst_QLineEdit::task248948_redoRemovedSelection()
+{
+ testWidget->setText("a");
+ testWidget->selectAll();
+ QTest::keyPress(testWidget, Qt::Key_Delete);
+ testWidget->undo();
+ testWidget->redo();
+ QTest::keyPress(testWidget, 'a');
+ QTest::keyPress(testWidget, 'b');
+ QCOMPARE(testWidget->text(), QLatin1String("ab"));
+}
+
QTEST_MAIN(tst_QLineEdit)
#include "tst_qlineedit.moc"
diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp
index 5e3e334..b8f7c22 100644
--- a/tests/auto/qlocale/tst_qlocale.cpp
+++ b/tests/auto/qlocale/tst_qlocale.cpp
@@ -591,6 +591,17 @@ void tst_QLocale::long_long_conversion_data()
QTest::newRow("de_DE 12345.67") << QString("de_DE") << "12345.67"<< false << (qlonglong) 0;
QTest::newRow("de_DE 123456.7") << QString("de_DE") << "123456.7"<< false << (qlonglong) 0;
QTest::newRow("de_DE 1.234.567") << QString("de_DE")<< "1.234.567"<< true << (qlonglong) 1234567;
+ QTest::newRow("de_DE 1.234.567 ldspcs") << QString("de_DE")<< " 1.234.567" << true << (qlonglong) 1234567;
+ QTest::newRow("de_DE 1.234.567 trspcs") << QString("de_DE")<< "1.234.567 "<< true << (qlonglong) 1234567;
+ QTest::newRow("de_DE 1.234.567 ldtrspcs") << QString("de_DE")<< " 1.234.567 "<< true << (qlonglong) 1234567;
+
+ // test that space is also accepted whenever QLocale::groupSeparator() == 0xa0 (which looks like space).
+ QTest::newRow("nb_NO 123 groupsep") << QString("nb_NO")<< QString("1")+QChar(0xa0)+QString("234") << true << (qlonglong) 1234;
+ QTest::newRow("nb_NO 123 groupsep_space") << QString("nb_NO")<< QString("1")+QChar(0x20)+QString("234") << true << (qlonglong) 1234;
+
+ QTest::newRow("nb_NO 123 ldspcs") << QString("nb_NO")<< " 123" << true << (qlonglong) 123;
+ QTest::newRow("nb_NO 123 trspcs") << QString("nb_NO")<< "123 "<< true << (qlonglong) 123;
+ QTest::newRow("nb_NO 123 ldtrspcs") << QString("nb_NO")<< " 123 "<< true << (qlonglong) 123;
QTest::newRow("C 1234") << QString("C") << " 1234" << true << (qlonglong) 1234;
QTest::newRow("C 1234 ") << QString("C") << "1234 " << true << (qlonglong) 1234;
diff --git a/tests/auto/qmake/qmake.pro b/tests/auto/qmake/qmake.pro
index 59cc2be..8cae6be 100644
--- a/tests/auto/qmake/qmake.pro
+++ b/tests/auto/qmake/qmake.pro
@@ -2,8 +2,6 @@ load(qttest_p4)
HEADERS += testcompiler.h
SOURCES += tst_qmake.cpp testcompiler.cpp
-contains(QT_CONFIG, qt3support): QT += qt3support
-
cross_compile: DEFINES += QMAKE_CROSS_COMPILED
diff --git a/tests/auto/qmake/testcompiler.cpp b/tests/auto/qmake/testcompiler.cpp
index bfc8905..122a2b8 100644
--- a/tests/auto/qmake/testcompiler.cpp
+++ b/tests/auto/qmake/testcompiler.cpp
@@ -39,49 +39,37 @@
**
****************************************************************************/
-
#include "testcompiler.h"
-#include <stdlib.h>
-#include <qapplication.h>
-
-#ifdef QT3_SUPPORT
-
-#include <q3process.h>
-#include <qtimer.h>
-#ifdef Q_OS_WIN32
-# include <windows.h>
-#endif
-#include <QtTest/QtTest>
+#include <QProcess>
+#include <QDir>
-#undef SHOW_QDEBUG
-#undef SHOW_COMPLETENESS
-
-QString targetName( BuildType buildMode, const QString& target, const QString& version )
+static QString targetName( BuildType buildMode, const QString& target, const QString& version )
{
+ Q_UNUSED(version);
QString targetName = target;
#if defined (Q_OS_WIN32)
switch (buildMode)
{
case Exe: // app
- targetName.append(".exe");
- break;
+ targetName.append(".exe");
+ break;
case Dll: // dll
- if (version != "") {
- QStringList ver = QStringList::split(".", version);
- targetName.append(ver.first());
- }
+ if (version != "") {
+ QStringList ver = QStringList::split(".", version);
+ targetName.append(ver.first());
+ }
targetName.append(".dll");
- break;
+ break;
case Lib: // lib
#ifdef Q_CC_GNU
targetName.prepend("lib");
targetName.append(".a");
#else
- targetName.append(".lib");
+ targetName.append(".lib");
#endif
- break;
+ break;
case Plain:
// no conversion
break;
@@ -90,16 +78,16 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v
switch (buildMode)
{
case Exe: // app
- targetName += ".app/Contents/MacOS/" + target.section('/', -1);
- break;
+ targetName += ".app/Contents/MacOS/" + target.section('/', -1);
+ break;
case Dll: // dll
- targetName.prepend("lib");
+ targetName.prepend("lib");
targetName.append("." + version + ".dylib");
- break;
+ break;
case Lib: // lib
- targetName.prepend("lib");
- targetName.append(".a");
- break;
+ targetName.prepend("lib");
+ targetName.append(".a");
+ break;
case Plain:
// no conversion
break;
@@ -108,9 +96,9 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v
switch (buildMode)
{
case Exe: // app
- break;
+ break;
case Dll: // dll
- targetName.prepend("lib");
+ targetName.prepend("lib");
#if defined (Q_OS_HPUX) && !defined (__ia64)
targetName.append(".sl");
#elif defined (Q_OS_AIX)
@@ -118,11 +106,11 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v
#else
targetName.append(".so");
#endif
- break;
+ break;
case Lib: // lib
- targetName.prepend("lib");
- targetName.append(".a");
- break;
+ targetName.prepend("lib");
+ targetName.append(".a");
+ break;
case Plain:
// no conversion
break;
@@ -131,223 +119,119 @@ QString targetName( BuildType buildMode, const QString& target, const QString& v
return targetName;
}
-
-
TestCompiler::TestCompiler()
{
- exit_ok = FALSE;
- childProc = 0;
- setBaseCommands( "", "", FALSE );
+ setBaseCommands( "", "" );
}
TestCompiler::~TestCompiler()
{
- if (childProc)
- delete childProc;
}
-bool TestCompiler::runChild( bool showOutput, QStringList argList, QStringList *envList )
+bool TestCompiler::runCommand( QString cmdline )
{
- //qDebug() << "executing" << argList;
- exit_ok = FALSE;
- if (childProc)
- delete childProc;
+ testOutput_.append("Running command: " + cmdline);
- child_show = showOutput;
- if ( showOutput ) {
+ QProcess child;
+ if (!environment_.empty())
+ child.setEnvironment(QProcess::systemEnvironment() + environment_);
- QString S = argList.join(" ");
- addMakeResult( S );
+ child.start(cmdline);
+ if (!child.waitForStarted(-1)) {
+ testOutput_.append( "Unable to start child process." );
+ return false;
}
- childProc = new Q3Process(argList, this, argList.join(" ").latin1());
- Q_ASSERT(childProc);
-
- connect(childProc,SIGNAL(readyReadStdout()),this,SLOT(childHasData()));
- connect(childProc,SIGNAL(processExited()),this,SLOT(childReady()));
-
- if (!childProc->start( envList )) {
-
- addMakeResult( "Error executing '" + argList[0] + "'." );
- childReady();
- return FALSE;
+ bool failed = false;
+ child.setReadChannel(QProcess::StandardError);
+ while (QProcess::Running == child.state()) {
+ if (child.waitForReadyRead(1000)) {
+ QString output = child.readAllStandardError();
+ testOutput_.append(output);
+
+ output.prepend('\n');
+ if (output.contains("\nProject MESSAGE: FAILED"))
+ failed = true;
+ }
}
- while (childProc != 0 && childProc->isRunning()) {
- qApp->processEvents();
- }
-
- childReady();
-
- return exit_ok;
-}
+ child.waitForFinished(-1);
-void TestCompiler::childReady()
-{
- if (childProc != 0) {
- childHasData();
-
- QString S;
- int pos;
- while (childProc->canReadLineStderr()) {
- S = childProc->readLineStderr();
- do {
- pos = S.find("\t");
- if (pos >= 0) {
- S.remove(pos,1);
- S.insert(pos," ");
- }
- } while (pos >= 0);
-
- if (child_show)
- addMakeResult( S );
- }
-
- exit_ok = childProc->normalExit() && childProc->exitStatus() == 0;
- delete childProc;
- }
- childProc = 0;
+ return failed
+ ? false
+ : (child.exitStatus() == QProcess::NormalExit)
+ && (child.exitCode() == 0);
}
-void TestCompiler::childHasData()
+void TestCompiler::setBaseCommands( QString makeCmd, QString qmakeCmd )
{
- QString S;
- int pos;
- while (childProc->canReadLineStderr()) {
-
- S = childProc->readLineStderr();
- do {
- pos = S.find("\t");
- if (pos >= 0) {
- S.remove(pos,1);
- S.insert(pos," ");
- }
-
- } while (pos >= 0);
-
- if ( S.startsWith("Project MESSAGE: FAILED") )
- QTest::qFail( S, __FILE__, __LINE__ );
- else if ( S.startsWith("Project MESSAGE: SKIPPED") )
- QTest::qSkip( S, QTest::SkipSingle, __FILE__, __LINE__ );
- else if (child_show)
- addMakeResult( S );
- }
+ makeCmd_ = makeCmd;
+ qmakeCmd_ = qmakeCmd;
}
-void TestCompiler::setBaseCommands( QString makeCmd, QString qmakeCmd, bool qwsMode )
+void TestCompiler::resetEnvironment()
{
- qws_mode = qwsMode;
- make_cmd = makeCmd;
-
- // not sure if i need this, but it doesn't hurt
- if (make_cmd.startsWith("\""))
- make_cmd = make_cmd.remove(0,1);
- if (make_cmd.endsWith("\""))
- make_cmd = make_cmd.remove(make_cmd.length()-1,1);
-
- qmake_cmd = qmakeCmd;
- // also not sure if i need this, but it doesn't hurt...
- if(qmake_cmd.length() >= 2 && (qmake_cmd.at(0) == '"' || qmake_cmd.at(0) == '\'') && qmake_cmd.at(qmake_cmd.length()-1) == qmake_cmd.at(0))
- qmake_cmd = qmake_cmd.mid(1, qmake_cmd.length()-2);
+ environment_.clear();
}
-bool TestCompiler::cleanAll( const QString &workPath, const QString &destPath, const QString &exeName, const QString &exeExt )
+void TestCompiler::addToEnvironment( QString varAssignment )
{
- QDir D(workPath);
- if (!D.exists()) {
-
- addMakeResult( "Directory '" + workPath + "' doesn't exist" );
- return FALSE;
- }
-
- D.setCurrent(workPath);
- // must delete at least the executable file to be able to easily and safely
- // verify that the compilation was a success.
- D.remove( destPath + "/" + exeName + exeExt );
- D.remove( workPath + "/Makefile");
- QFileInfo Fi( workPath + "/Makefile");
- if (Fi.exists()) {
-
- // Run make clean
- QStringList args;
- args = QStringList::split( " ", make_cmd );
- args.append("clean");
-
- return runChild( FALSE, args, 0 );
- }
-
- return TRUE;
+ environment_.push_back(varAssignment);
}
bool TestCompiler::makeClean( const QString &workPath )
{
QDir D;
if (!D.exists(workPath)) {
-
- addMakeResult( "Directory '" + workPath + "' doesn't exist" );
- return FALSE;
+ testOutput_.append( "Directory '" + workPath + "' doesn't exist" );
+ return false;
}
D.setCurrent(workPath);
QFileInfo Fi( workPath + "/Makefile");
- if (Fi.exists()) {
-
- // Run make clean
- QStringList args;
- args = QStringList::split( " ", make_cmd );
- args.append("clean");
+ if (Fi.exists())
+ // Run make clean
+ return runCommand( makeCmd_ + " clean" );
- return runChild( FALSE, args, 0 );
- }
-
- return TRUE;
+ return true;
}
bool TestCompiler::makeDistClean( const QString &workPath )
{
QDir D;
if (!D.exists(workPath)) {
- addMakeResult( "Directory '" + workPath + "' doesn't exist" );
- return FALSE;
+ testOutput_.append( "Directory '" + workPath + "' doesn't exist" );
+ return false;
}
D.setCurrent(workPath);
QFileInfo Fi( workPath + "/Makefile");
- if (Fi.exists()) {
- // Run make distclean
- QStringList args;
- args = QStringList::split( " ", make_cmd );
- args.append("distclean");
-
- return runChild( FALSE, args, 0 );
- }
+ if (Fi.exists())
+ // Run make distclean
+ return runCommand( makeCmd_ + " distclean" );
- return TRUE;
+ return true;
}
bool TestCompiler::qmake( const QString &workDir, const QString &proName, const QString &buildDir )
{
- // Now start qmake and generate the makefile
-
- QDir D( workDir );
- // Make sure we start in the right directory
+ QDir D;
D.setCurrent( workDir );
if (D.exists("Makefile"))
- D.remove("Makefile");
-
- QStringList args;
- args = QStringList::split( " ", qmake_cmd );
+ D.remove("Makefile");
- QString project_fname = workDir + "/" + proName + ".pro";
- QString makefile_fname = (buildDir.isNull()?QString():(buildDir + "/")) + "Makefile";
+ QString projectFile = proName;
+ QString makeFile = buildDir;
+ if (!projectFile.endsWith(".pro"))
+ projectFile += ".pro";
+ if (!makeFile.isEmpty() && !makeFile.endsWith('/'))
+ makeFile += '/';
+ makeFile += "Makefile";
- args.append( project_fname );
- args.append( "-o" );
- args.append( makefile_fname );
-
- return runChild( TRUE, args, 0 );
+ // Now start qmake and generate the makefile
+ return runCommand( qmakeCmd_ + " " + projectFile + " -o " + makeFile );
}
bool TestCompiler::make( const QString &workPath, const QString &target )
@@ -355,14 +239,13 @@ bool TestCompiler::make( const QString &workPath, const QString &target )
QDir D;
D.setCurrent( workPath );
- QStringList args;
- args = QStringList::split( " ", make_cmd );
- if ( make_cmd.lower().find("nmake") >= 0)
- args.append("/NOLOGO");
- if ( !target.isNull() )
- args.append(target);
+ QString cmdline = makeCmd_;
+ if ( cmdline.contains("nmake", Qt::CaseInsensitive) )
+ cmdline.append(" /NOLOGO");
+ if ( !target.isEmpty() )
+ cmdline += " " + target;
- return runChild( TRUE, args, 0 );
+ return runCommand( cmdline );
}
bool TestCompiler::exists( const QString &destDir, const QString &exeName, BuildType buildType, const QString &version )
@@ -371,20 +254,12 @@ bool TestCompiler::exists( const QString &destDir, const QString &exeName, Build
return f.exists();
}
-void TestCompiler::addMakeResult( const QString &result )
-{
- make_result.append( result );
-}
-
bool TestCompiler::removeMakefile( const QString &workPath )
{
QDir D;
D.setCurrent( workPath );
if ( D.exists( "Makefile" ) )
- return D.remove( "Makefile" );
+ return D.remove( "Makefile" );
else
- return TRUE;
+ return true;
}
-
-#endif //QT3_SUPPORT
-
diff --git a/tests/auto/qmake/testcompiler.h b/tests/auto/qmake/testcompiler.h
index 597d440..41e5177 100644
--- a/tests/auto/qmake/testcompiler.h
+++ b/tests/auto/qmake/testcompiler.h
@@ -41,33 +41,22 @@
#ifndef TESTCOMPILER_H
#define TESTCOMPILER_H
-
-#ifdef QT3_SUPPORT
-
-#include <qobject.h>
-#include <qstringlist.h>
-
-QT_FORWARD_DECLARE_CLASS(Q3Process)
-
-#define COMPILE_ERROR "Compile error"
-#define COMPILE_SUCCESS "Compile successfull"
-#define COMPILE_NOT_AVAIL "Binary not available for testing"
-#define SELF_TEST "self-test"
+#include <QObject>
+#include <QStringList>
enum BuildType { Exe, Dll, Lib, Plain };
class TestCompiler : public QObject
{
-Q_OBJECT
+ Q_OBJECT
public:
TestCompiler();
virtual ~TestCompiler();
- void setBaseCommands( QString makeCmd, QString qmakeCmd, bool qwsMode );
-
- // builds a complete project, e.g. qmake, make clean, make and exists.
- bool buildProject( const QString &project, BuildType buildType, const QString &targetName, const QString &destPath, const QString &version );
+ void setBaseCommands( QString makeCmd, QString qmakeCmd );
+ void resetEnvironment();
+ void addToEnvironment( QString varAssignment );
// executes a make clean in the specified workPath
bool makeClean( const QString &workPath );
@@ -77,34 +66,20 @@ public:
bool qmake( const QString &workDir, const QString &proName, const QString &buildDir = QString() );
// executes a make in the specified workPath, with an optional target (eg. install)
bool make( const QString &workPath, const QString &target = QString() );
- // executes a make clean and then deletes the makefile in workpath + deletes the executable
- // in destPath.
- bool cleanAll( const QString &workPath, const QString &destPath, const QString &exeName, const QString &exeExt );
// checks if the executable exists in destDir
bool exists( const QString &destDir, const QString &exeName, BuildType buildType, const QString &version );
// removes the makefile
bool removeMakefile( const QString &workPath );
private:
- QString make_cmd;
- QString qmake_cmd;
-
- Q3Process *childProc;
- QStringList env_list;
+ bool runCommand( QString cmdLine );
- bool child_show;
- bool qws_mode;
- bool exit_ok;
-
-private:
- bool runChild( bool showOutput, QStringList argList, QStringList *envList );
- void addMakeResult( const QString &result );
- QStringList make_result;
+ QString makeCmd_;
+ QString qmakeCmd_;
+ QStringList environment_;
-private slots:
- void childReady();
- void childHasData();
+ // need to make this available somewhere
+ QStringList testOutput_;
};
-#endif // QT3_SUPPORT
#endif // TESTCOMPILER_H
diff --git a/tests/auto/qmake/testdata/shadow_files_build/README b/tests/auto/qmake/testdata/shadow_files_build/README
index 46017fc..15e48c0 100644
--- a/tests/auto/qmake/testdata/shadow_files_build/README
+++ b/tests/auto/qmake/testdata/shadow_files_build/README
@@ -1 +1 @@
-Here to ensure include_dir_build exists
+Here to ensure shadow_files_build exists, used by the shadow_files test.
diff --git a/tests/auto/qmake/tst_qmake.cpp b/tests/auto/qmake/tst_qmake.cpp
index facf0bb..70f1f3c 100644
--- a/tests/auto/qmake/tst_qmake.cpp
+++ b/tests/auto/qmake/tst_qmake.cpp
@@ -39,21 +39,13 @@
**
****************************************************************************/
-
-#include <QtTest/QtTest>
-
-#if !defined(QMAKE_CROSS_COMPILED) && defined(QT3_SUPPORT)
-
-#include <qdir.h>
-#include <qprocess.h>
-
+#if !defined(QMAKE_CROSS_COMPILED)
#include "testcompiler.h"
-#include <stdlib.h>
-
-//TESTED_CLASS=
-//TESTED_FILES=corelib/tools/qlocale.h corelib/tools/qlocale.cpp
+#include <QObject>
+#include <QDir>
+#include <QtTest/QtTest>
class tst_qmake : public QObject
{
@@ -63,12 +55,12 @@ public:
tst_qmake();
virtual ~tst_qmake();
-
public slots:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
+
private slots:
void simple_app();
void simple_lib();
@@ -104,16 +96,16 @@ tst_qmake::tst_qmake()
{
QString cmd = QString("qmake \"QT_VERSION=%1\"").arg(QT_VERSION);
#ifdef Q_CC_MSVC
- test_compiler.setBaseCommands( "nmake", cmd, FALSE );
+ test_compiler.setBaseCommands( "nmake", cmd );
#elif defined(Q_CC_MINGW)
- test_compiler.setBaseCommands( "mingw32-make", cmd, FALSE );
+ test_compiler.setBaseCommands( "mingw32-make", cmd );
#elif defined(Q_OS_WIN) && defined(Q_CC_GNU)
- test_compiler.setBaseCommands( "mmmake", cmd, FALSE );
+ test_compiler.setBaseCommands( "mmmake", cmd );
#else
- test_compiler.setBaseCommands( "make", cmd, FALSE );
+ test_compiler.setBaseCommands( "make", cmd );
#endif
QDir dir;
- base_path = dir.currentDirPath();
+ base_path = dir.currentPath();
}
tst_qmake::~tst_qmake()
@@ -255,10 +247,10 @@ void tst_qmake::duplicateLibraryEntries()
void tst_qmake::export_across_file_boundaries()
{
// This relies on features so we need to set the QMAKEFEATURES environment variable
- putenv("QMAKEFEATURES=.");
+ test_compiler.addToEnvironment("QMAKEFEATURES=.");
QString workDir = base_path + "/testdata/export_across_file_boundaries";
QVERIFY( test_compiler.qmake( workDir, "foo" ));
- putenv("QMAKEFEATURES=");
+ test_compiler.resetEnvironment();
}
void tst_qmake::include_dir()
@@ -406,7 +398,7 @@ void tst_qmake::bundle_spaces()
// make (-n).
TestCompiler local_tc;
- local_tc.setBaseCommands("make -n", "qmake -macx -spec macx-g++", FALSE);
+ local_tc.setBaseCommands("make -n", "qmake -macx -spec macx-g++");
QVERIFY( local_tc.qmake(workDir, "bundle-spaces") );
diff --git a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp
index 9010db4..36a4b45 100644
--- a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp
+++ b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp
@@ -286,8 +286,263 @@ void tst_QNetworkCookie::parseSingleCookie_data()
QTest::newRow("expiration3") << "a=b; expires=Wednesday, 09-Nov-1999 23:12:40 GMT " << cookie;
QTest::newRow("expiration-utc") << "a=b;expires=Wednesday, 09-Nov-1999 23:12:40 UTC" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(3, 20, 0, 0), Qt::UTC));
+ QTest::newRow("time-0") << "a=b;expires=14 Apr 89 03:20" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(3, 20, 12, 0), Qt::UTC));
+ QTest::newRow("time-1") << "a=b;expires=14 Apr 89 03:20:12" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(3, 20, 12, 88), Qt::UTC));
+ QTest::newRow("time-2") << "a=b;expires=14 Apr 89 03:20:12.88" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(3, 20, 12, 88), Qt::UTC));
+ QTest::newRow("time-3") << "a=b;expires=14 Apr 89 03:20:12.88am" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(15, 20, 12, 88), Qt::UTC));
+ QTest::newRow("time-4") << "a=b;expires=14 Apr 89 03:20:12.88pm" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(3, 20, 12, 88), Qt::UTC));
+ QTest::newRow("time-5") << "a=b;expires=14 Apr 89 03:20:12.88 Am" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(15, 20, 12, 88), Qt::UTC));
+ QTest::newRow("time-6") << "a=b;expires=14 Apr 89 03:20:12.88 PM" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(15, 20, 12, 88), Qt::UTC));
+ QTest::newRow("time-7") << "a=b;expires=14 Apr 89 3:20:12.88 PM" << cookie;
+
+ // normal months
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(1, 1), Qt::UTC));
+ QTest::newRow("months-1") << "a=b;expires=Jan 1 89 1:1" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 2, 1), QTime(1, 1), Qt::UTC));
+ QTest::newRow("months-2") << "a=b;expires=Feb 1 89 1:1" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 3, 1), QTime(1, 1), Qt::UTC));
+ QTest::newRow("months-3") << "a=b;expires=mar 1 89 1:1" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 4, 1), QTime(1, 1), Qt::UTC));
+ QTest::newRow("months-4") << "a=b;expires=Apr 1 89 1:1" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 5, 1), QTime(1, 1), Qt::UTC));
+ QTest::newRow("months-5") << "a=b;expires=May 1 89 1:1" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 6, 1), QTime(1, 1), Qt::UTC));
+ QTest::newRow("months-6") << "a=b;expires=Jun 1 89 1:1" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 7, 1), QTime(1, 1), Qt::UTC));
+ QTest::newRow("months-7") << "a=b;expires=Jul 1 89 1:1" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 8, 1), QTime(1, 1), Qt::UTC));
+ QTest::newRow("months-8") << "a=b;expires=Aug 1 89 1:1" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 9, 1), QTime(1, 1), Qt::UTC));
+ QTest::newRow("months-9") << "a=b;expires=Sep 1 89 1:1" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 10, 1), QTime(1, 1), Qt::UTC));
+ QTest::newRow("months-10") << "a=b;expires=Oct 1 89 1:1" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 11, 1), QTime(1, 1), Qt::UTC));
+ QTest::newRow("months-11") << "a=b;expires=Nov 1 89 1:1" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 12, 1), QTime(1, 1), Qt::UTC));
+ QTest::newRow("months-12") << "a=b;expires=Dec 1 89 1:1" << cookie;
+
+ // extra months
+ cookie.setExpirationDate(QDateTime(QDate(1989, 12, 1), QTime(1, 1), Qt::UTC));
+ QTest::newRow("months-13") << "a=b;expires=December 1 89 1:1" << cookie;
+ QTest::newRow("months-14") << "a=b;expires=1 89 1:1 Dec" << cookie;
+ //cookie.setExpirationDate(QDateTime());
+ //QTest::newRow("months-15") << "a=b;expires=1 89 1:1 De" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(2024, 2, 29), QTime(1, 1), Qt::UTC));
+ QTest::newRow("months-16") << "a=b;expires=2024 29 Feb 1:1" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(2024, 2, 29), QTime(1, 1), Qt::UTC));
+ QTest::newRow("months-17") << "a=b;expires=Fri, 29-Feb-2024 01:01:00 GMT" << cookie;
+ QTest::newRow("months-18") << "a=b;expires=2024 29 Feb 1:1 GMT" << cookie;
+
+ // normal offsets
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-0") << "a=b;expires=Jan 1 89 8:0 PST" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-1") << "a=b;expires=Jan 1 89 8:0 PDT" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-2") << "a=b;expires=Jan 1 89 7:0 MST" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-3") << "a=b;expires=Jan 1 89 7:0 MDT" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-4") << "a=b;expires=Jan 1 89 6:0 CST" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-5") << "a=b;expires=Jan 1 89 6:0 CDT" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-6") << "a=b;expires=Jan 1 89 5:0 EST" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-7") << "a=b;expires=Jan 1 89 5:0 EDT" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-8") << "a=b;expires=Jan 1 89 4:0 AST" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-9") << "a=b;expires=Jan 1 89 3:0 NST" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-10") << "a=b;expires=Jan 1 89 0:0 GMT" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-11") << "a=b;expires=Jan 1 89 0:0 BST" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 2), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-12") << "a=b;expires=Jan 1 89 23:0 MET" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 2), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-13") << "a=b;expires=Jan 1 89 22:0 EET" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 2), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-14") << "a=b;expires=Jan 1 89 15:0 JST" << cookie;
+
+ // extra offsets
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 2), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-14") << "a=b;expires=Jan 1 89 15:0 JST+1" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(1, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-15") << "a=b;expires=Jan 1 89 0:0 GMT+1" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-15b") << "a=b;expires=Jan 1 89 1:0 GMT-1" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(1, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-16") << "a=b;expires=Jan 1 89 0:0 GMT+01" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(1, 5), Qt::UTC));
+ QTest::newRow("zoneoffset-17") << "a=b;expires=Jan 1 89 0:0 GMT+0105" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-18") << "a=b;expires=Jan 1 89 0:0 GMT+015" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-19") << "a=b;expires=Jan 1 89 0:0 GM" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-19b") << "a=b;expires=Jan 1 89 0:0 GMT" << cookie;
+
+ // offsets from gmt
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(1, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-20") << "a=b;expires=Jan 1 89 0:0 +1" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(1, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-21") << "a=b;expires=Jan 1 89 0:0 +01" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(1, 1), Qt::UTC));
+ QTest::newRow("zoneoffset-22") << "a=b;expires=Jan 1 89 0:0 +0101" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("zoneoffset-23") << "a=b;expires=Jan 1 89 1:0 -1" << cookie;
+
+ // Y2k
+ cookie.setExpirationDate(QDateTime(QDate(2000, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("year-0") << "a=b;expires=Jan 1 00 0:0" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1970, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("year-1") << "a=b;expires=Jan 1 70 0:0" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1971, 1, 1), QTime(0, 0), Qt::UTC));
+ QTest::newRow("year-2") << "a=b;expires=Jan 1 71 0:0" << cookie;
+
+ // Day, month, year
+ cookie.setExpirationDate(QDateTime(QDate(2013, 1, 2), QTime(0, 0), Qt::UTC));
+ QTest::newRow("date-0") << "a=b;expires=Jan 2 13 0:0" << cookie;
+ QTest::newRow("date-1") << "a=b;expires=1-2-13 0:0" << cookie;
+ QTest::newRow("date-2") << "a=b;expires=1/2/13 0:0" << cookie;
+ QTest::newRow("date-3") << "a=b;expires=Jan 2 13 0:0" << cookie;
+ QTest::newRow("date-4") << "a=b;expires=Jan 2, 13 0:0" << cookie;
+ QTest::newRow("date-5") << "a=b;expires=1-2-13 0:0" << cookie;
+ QTest::newRow("date-6") << "a=b;expires=1/2/13 0:0" << cookie;
+
+ // Known Year, determine month and day
+ cookie.setExpirationDate(QDateTime(QDate(1995, 1, 13), QTime(0, 0), Qt::UTC));
+ QTest::newRow("knownyear-0") << "a=b;expires=13/1/95 0:0" << cookie;
+ QTest::newRow("knownyear-1") << "a=b;expires=95/13/1 0:0" << cookie;
+ QTest::newRow("knownyear-2") << "a=b;expires=1995/1/13 0:0" << cookie;
+ QTest::newRow("knownyear-3") << "a=b;expires=1995/13/1 0:0" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(1995, 1, 2), QTime(0, 0), Qt::UTC));
+ QTest::newRow("knownyear-4") << "a=b;expires=1/2/95 0:0" << cookie;
+ QTest::newRow("knownyear-5") << "a=b;expires=95/1/2 0:0" << cookie;
+
+ // Known Year, Known day, determining month
+ cookie.setExpirationDate(QDateTime(QDate(1995, 1, 13), QTime(0, 0), Qt::UTC));
+ QTest::newRow("knownYD-0") << "a=b;expires=13/1/95 0:0" << cookie;
+ QTest::newRow("knownYD-1") << "a=b;expires=1/13/95 0:0" << cookie;
+ QTest::newRow("knownYD-2") << "a=b;expires=95/13/1 0:0" << cookie;
+ QTest::newRow("knownYD-3") << "a=b;expires=95/1/13 0:0" << cookie;
+
+ // Month comes before Year
+ cookie.setExpirationDate(QDateTime(QDate(2021, 03, 26), QTime(0, 0), Qt::UTC));
+ QTest::newRow("month-0") << "a=b;expires=26/03/21 0:0" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(2015, 12, 30), QTime(16, 25, 0, 0), Qt::UTC));
+ QTest::newRow("month-1") << "a=b;expires=wed 16:25pm December 2015 30" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(2031, 11, 11), QTime(16, 25, 0, 0), Qt::UTC));
+ QTest::newRow("month-2") << "a=b;expires=16:25 11 31 11" << cookie;
+
+ // The very ambiguous cases
+ // Matching Firefox's behavior of guessing month, day, year in those cases
+ cookie.setExpirationDate(QDateTime(QDate(2013, 10, 2), QTime(0, 0), Qt::UTC));
+ QTest::newRow("ambiguousd-0") << "a=b;expires=10/2/13 0:0" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(2013, 2, 10), QTime(0, 0), Qt::UTC));
+ QTest::newRow("ambiguousd-1") << "a=b;expires=2/10/13 0:0" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(2010, 2, 3), QTime(0, 0), Qt::UTC));
+ QTest::newRow("ambiguousd-2") << "a=b;expires=2/3/10 0:0" << cookie;
+
+ // FYI If you try these in Firefox it wont set a cookie for the following two string
+ // because 03 is turned into the year at which point it is expired
+ cookie.setExpirationDate(QDateTime(QDate(2003, 2, 10), QTime(0, 0), Qt::UTC));
+ QTest::newRow("ambiguousd-3") << "a=b;expires=2/10/3 0:0" << cookie;
+ cookie.setExpirationDate(QDateTime(QDate(2003, 10, 2), QTime(0, 0), Qt::UTC));
+ QTest::newRow("ambiguousd-4") << "a=b;expires=10/2/3 0:0" << cookie;
+
+ // These are the cookies that firefox's source says it can parse
+ cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(3, 20, 0, 0), Qt::UTC));
+ QTest::newRow("firefox-0") << "a=b;expires=14 Apr 89 03:20" << cookie;
+
+ cookie.setExpirationDate(QDateTime(QDate(1989, 4, 14), QTime(3, 20, 0, 0), Qt::UTC));
+ QTest::newRow("firefox-1") << "a=b;expires=14 Apr 89 03:20 GMT" << cookie;
+
+ cookie.setExpirationDate(QDateTime(QDate(1989, 3, 17), QTime(4, 1, 33, 0), Qt::UTC));
+ QTest::newRow("firefox-2") << "a=b;expires=Fri, 17 Mar 89 4:01:33" << cookie;
+
+ cookie.setExpirationDate(QDateTime(QDate(1989, 3, 17), QTime(4, 1, 0, 0), Qt::UTC));
+ QTest::newRow("firefox-3") << "a=b;expires=Fri, 17 Mar 89 4:01 GMT" << cookie;
+
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 16), QTime(16-8, 12, 0, 0), Qt::UTC));
+ QTest::newRow("firefox-4") << "a=b;expires=Mon Jan 16 16:12 PDT 1989" << cookie;
+
+ cookie.setExpirationDate(QDateTime(QDate(1989, 1, 16), QTime(17, 42, 0, 0), Qt::UTC));
+ QTest::newRow("firefox-5") << "a=b;expires=Mon Jan 16 16:12 +0130 1989" << cookie;
+
+ cookie.setExpirationDate(QDateTime(QDate(1992, 5, 6), QTime(16-9, 41, 0, 0), Qt::UTC));
+ QTest::newRow("firefox-6") << "a=b;expires=6 May 1992 16:41-JST (Wednesday)" << cookie;
+
+ cookie.setExpirationDate(QDateTime(QDate(1993, 8, 22), QTime(10, 59, 12, 82), Qt::UTC));
+ QTest::newRow("firefox-7") << "a=b;expires=22-AUG-1993 10:59:12.82" << cookie;
+
+ cookie.setExpirationDate(QDateTime(QDate(1993, 8, 22), QTime(22, 59, 0, 0), Qt::UTC));
+ QTest::newRow("firefox-8") << "a=b;expires=22-AUG-1993 10:59pm" << cookie;
+
+ cookie.setExpirationDate(QDateTime(QDate(1993, 8, 22), QTime(12, 59, 0, 0), Qt::UTC));
+ QTest::newRow("firefox-9") << "a=b;expires=22-AUG-1993 12:59am" << cookie;
+
+ cookie.setExpirationDate(QDateTime(QDate(1993, 8, 22), QTime(12, 59, 0, 0), Qt::UTC));
+ QTest::newRow("firefox-10") << "a=b;expires=22-AUG-1993 12:59 PM" << cookie;
+
+ cookie.setExpirationDate(QDateTime(QDate(1995, 8, 4), QTime(15, 54, 0, 0), Qt::UTC));
+ QTest::newRow("firefox-11") << "a=b;expires=Friday, August 04, 1995 3:54 PM" << cookie;
+
+ cookie.setExpirationDate(QDateTime(QDate(1995, 6, 21), QTime(16, 24, 34, 0), Qt::UTC));
+ QTest::newRow("firefox-12") << "a=b;expires=06/21/95 04:24:34 PM" << cookie;
+
+ cookie.setExpirationDate(QDateTime(QDate(1995, 6, 20), QTime(21, 7, 0, 0), Qt::UTC));
+ QTest::newRow("firefox-13") << "a=b;expires=20/06/95 21:07" << cookie;
+
+ cookie.setExpirationDate(QDateTime(QDate(1995, 6, 8), QTime(19-5, 32, 48, 0), Qt::UTC));
+ QTest::newRow("firefox-14") << "a=b;expires=95-06-08 19:32:48 EDT" << cookie;
+
+ // Edge cases caught by fuzzing
+ // These are about the default cause creates dates that don't exits
+ cookie.setExpirationDate(QDateTime(QDate(2030, 2, 25), QTime(1, 1, 0, 0), Qt::UTC));
+ QTest::newRow("fuzz-0") << "a=b; expires=30 -000002 1:1 25;" << cookie;
+
+ cookie.setExpirationDate(QDateTime(QDate(2031, 11, 20), QTime(1, 1, 0, 0), Qt::UTC));
+ QTest::newRow("fuzz-1") << "a=b; expires=31 11 20 1:1;" << cookie;
+
+ // April only has 30 days
+ cookie.setExpirationDate(QDateTime(QDate(2031, 4, 30), QTime(1, 1, 0, 0), Qt::UTC));
+ QTest::newRow("fuzz-2") << "a=b; expires=31 30 4 1:1" << cookie;
+
+ // 9 must be the month so 31 can't be the day
+ cookie.setExpirationDate(QDateTime(QDate(2031, 9, 21), QTime(1, 1, 0, 0), Qt::UTC));
+ QTest::newRow("fuzz-3") << "a=b; expires=31 21 9 1:1" << cookie;
+
+ // Year is known, then fallback to defaults of filling in month and day
+ cookie.setExpirationDate(QDateTime(QDate(2031, 11, 1), QTime(1, 1, 0, 0), Qt::UTC));
+ QTest::newRow("fuzz-4") << "a=b; expires=31 11 01 1:1" << cookie;
+
+ // 2 must be the month so 30 can't be the day
+ cookie.setExpirationDate(QDateTime(QDate(2030, 2, 20), QTime(1, 1, 0, 0), Qt::UTC));
+ QTest::newRow("fuzz-5") << "a=b; expires=30 02 20 1:1" << cookie;
+
+ cookie.setExpirationDate(QDateTime(QDate(2021, 12, 22), QTime(1, 1, 0, 0), Qt::UTC));
+ QTest::newRow("fuzz-6") << "a=b; expires=2021 12 22 1:1" << cookie;
+
+ cookie.setExpirationDate(QDateTime(QDate(2029, 2, 23), QTime(1, 1, 0, 0), Qt::UTC));
+ QTest::newRow("fuzz-7") << "a=b; expires=29 23 Feb 1:1" << cookie;
+
+ // 11 and 6 don't have 31 days
+ cookie.setExpirationDate(QDateTime(QDate(2031, 11, 06), QTime(1, 1, 0, 0), Qt::UTC));
+ QTest::newRow("fuzz-8") << "a=b; expires=31 11 06 1:1" << cookie;
+
// two-digit years:
// from 70 until 99, we assume 20th century
+ cookie.setExpirationDate(QDateTime(QDate(1999, 11, 9), QTime(23, 12, 40), Qt::UTC));
QTest::newRow("expiration-2digit1") << "a=b; expires=Wednesday, 09-Nov-99 23:12:40 GMT " << cookie;
cookie.setExpirationDate(QDateTime(QDate(1970, 1, 1), QTime(23, 12, 40), Qt::UTC));
QTest::newRow("expiration-2digit2") << "a=b; expires=Thursday, 01-Jan-70 23:12:40 GMT " << cookie;
@@ -315,6 +570,9 @@ void tst_QNetworkCookie::parseSingleCookie_data()
cookie.setExpirationDate(QDateTime(QDate(9999, 12, 31), QTime(23, 59, 59), Qt::UTC));
QTest::newRow("network2") << "__siteid=1; expires=Fri, 31-Dec-9999 23:59:59 GMT; path=/" << cookie;
+ cookie = QNetworkCookie("YM.LC", "v=2&m=9993_262838_159_1558_1063_0_5649_4012_3776161073,9426_260205_549_1295_1336_0_5141_4738_3922731647,6733_258196_952_1364_643_0_3560_-1_0,3677_237633_1294_1294_19267_0_3244_29483_4102206176,1315_235149_1693_1541_941_0_3224_1691_1861378060,1858_214311_2100_1298_19538_0_2873_30900_716411652,6258_212007_2506_1285_1017_0_2868_3606_4288540264,3743_207884_2895_1362_2759_0_2545_7114_3388520216,2654_205253_3257_1297_1332_0_2504_4682_3048534803,1891_184881_3660_1291_19079_0_978_29178_2592538685&f=1&n=20&s=date&o=down&e=1196548712&b=Inbox&u=removed");
+ cookie.setPath("/");
+ cookie.setDomain("mail.yahoo.com");
QTest::newRow("network3") << "YM.LC=v=2&m=9993_262838_159_1558_1063_0_5649_4012_3776161073,9426_260205_549_1295_1336_0_5141_4738_3922731647,6733_258196_952_1364_643_0_3560_-1_0,3677_237633_1294_1294_19267_0_3244_29483_4102206176,1315_235149_1693_1541_941_0_3224_1691_1861378060,1858_214311_2100_1298_19538_0_2873_30900_716411652,6258_212007_2506_1285_1017_0_2868_3606_4288540264,3743_207884_2895_1362_2759_0_2545_7114_3388520216,2654_205253_3257_1297_1332_0_2504_4682_3048534803,1891_184881_3660_1291_19079_0_978_29178_2592538685&f=1&n=20&s=date&o=down&e=1196548712&b=Inbox&u=removed; path=/; domain=mail.yahoo.com" << cookie;
cookie = QNetworkCookie("__ac", "c2hhdXNtYW46U2FTYW80Wm8%3D");
@@ -330,13 +588,22 @@ void tst_QNetworkCookie::parseSingleCookie()
QList<QNetworkCookie> result = QNetworkCookie::parseCookies(cookieString.toLatin1());
- QEXPECT_FAIL("network2", "QDateTime parsing problem: the date is beyond year 8000", Abort);
- QEXPECT_FAIL("network3", "Cookie value contains commas, violating the HTTP spec", Abort);
+ //QEXPECT_FAIL("network2", "QDateTime parsing problem: the date is beyond year 8000", Abort);
QCOMPARE(result.count(), 1);
+ QEXPECT_FAIL("network3", "Cookie value contains commas, violating the HTTP spec", Abort);
QCOMPARE(result.at(0), expectedCookie);
result = QNetworkCookie::parseCookies(result.at(0).toRawForm());
QCOMPARE(result.count(), 1);
+
+ // Drop any millisecond information, if there's any
+ QDateTime dt = expectedCookie.expirationDate();
+ if (dt.isValid()) {
+ QTime t = dt.time();
+ dt.setTime(t.addMSecs(-t.msec()));
+ expectedCookie.setExpirationDate(dt);
+ }
+
QCOMPARE(result.at(0), expectedCookie);
}
@@ -358,9 +625,7 @@ void tst_QNetworkCookie::parseMultipleCookies_data()
// reason: malformed NAME=VALUE pair
QTest::newRow("invalid-05") << "foo" << list;
QTest::newRow("invalid-06") << "=b" << list;
- QTest::newRow("invalid-08") << "a=b,foo" << list;
QTest::newRow("invalid-09") << "foo,a=b" << list;
- QTest::newRow("invalid-10") << "a=b,=b" << list;
QTest::newRow("invalid-11") << ";path=/" << list;
// reason: malformed expiration date string
@@ -369,8 +634,6 @@ void tst_QNetworkCookie::parseMultipleCookies_data()
QTest::newRow("invalid-14") << "a=b;expires=foobar, abc" << list;
QTest::newRow("invalid-15") << "a=b;expires=foobar, dd-mmm-yyyy hh:mm:ss GMT; path=/" << list;
QTest::newRow("invalid-16") << "a=b;expires=foobar, 32-Caz-1999 24:01:60 GMT; path=/" << list;
- QTest::newRow("invalid-17") << "a=b,c=d;expires=" << list;
- QTest::newRow("invalid-18") << "a=b, c=d; expires=foobar, 32-Caz-1999 24:01:60 GMT; path=/" << list;
QNetworkCookie cookie;
cookie.setName("a");
@@ -417,6 +680,26 @@ void tst_QNetworkCookie::parseMultipleCookies_data()
list << cookie;
QTest::newRow("network1") << "id=51706646077999719 bb=\"K14144t\"_AAQ\"ototrK_A_ttot44AQ4KwoRQtoto| adv=; Domain=.bluestreak.com; expires=Tuesday 05-Dec-2017 09:11:07 GMT; path=/;" << list;
+ QNetworkCookie cookieA;
+ cookieA.setName("a");
+ cookieA.setValue("b");
+
+ QNetworkCookie cookieB;
+ cookieB.setName("c");
+ cookieB.setValue("d");
+
+ // NewLine
+ cookieA.setExpirationDate(QDateTime(QDate(2009, 3, 10), QTime(7, 0, 0, 0), Qt::UTC));
+ cookieB.setExpirationDate(QDateTime(QDate(2009, 3, 20), QTime(7, 0, 0, 0), Qt::UTC));
+ list = QList<QNetworkCookie>() << cookieA << cookieB;
+ QTest::newRow("real-0") << "a=b; expires=Tue Mar 10 07:00:00 2009 GMT\nc=d; expires=Fri Mar 20 07:00:00 2009 GMT" << list;
+ QTest::newRow("real-1") << "a=b; expires=Tue Mar 10 07:00:00 2009 GMT\n\nc=d; expires=Fri Mar 20 07:00:00 2009 GMT" << list;
+ QTest::newRow("real-2") << "a=b; expires=Mar 10 07:00:00 2009 GMT, Tue\nc=d; expires=Fri Mar 20 07:00:00 2009 GMT" << list;
+
+ // Match firefox's behavior
+ cookieA.setPath("/foo");
+ list = QList<QNetworkCookie>() << cookieA << cookieB;
+ QTest::newRow("real-3") << "a=b; expires=Mar 10 07:00:00 2009 GMT, Tue; path=/foo\nc=d; expires=Fri Mar 20 07:00:00 2009 GMT" << list;
}
void tst_QNetworkCookie::parseMultipleCookies()
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 5a15683..a4c768d 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -203,6 +203,10 @@ private slots:
void drawImage_task217400_data();
void drawImage_task217400();
void drawRect_task215378();
+ void drawRect_task247505();
+
+ void drawImage_data();
+ void drawImage();
void clippedImage();
@@ -3586,6 +3590,97 @@ void tst_QPainter::drawRect_task215378()
QVERIFY(img.pixel(0, 0) != img.pixel(1, 1));
}
+void tst_QPainter::drawRect_task247505()
+{
+ QImage a(10, 10, QImage::Format_ARGB32_Premultiplied);
+ a.fill(0);
+ QImage b = a;
+
+ QPainter p(&a);
+ p.setPen(Qt::NoPen);
+ p.setBrush(Qt::black);
+ p.drawRect(QRectF(10, 0, -10, 10));
+ p.end();
+ p.begin(&b);
+ p.setPen(Qt::NoPen);
+ p.setBrush(Qt::black);
+ p.drawRect(QRectF(0, 0, 10, 10));
+ p.end();
+
+ QCOMPARE(a, b);
+}
+
+void tst_QPainter::drawImage_data()
+{
+ QTest::addColumn<int>("x");
+ QTest::addColumn<int>("y");
+ QTest::addColumn<int>("w");
+ QTest::addColumn<int>("h");
+ QTest::addColumn<QImage::Format>("srcFormat");
+ QTest::addColumn<QImage::Format>("dstFormat");
+
+ for (int srcFormat = QImage::Format_Mono; srcFormat < QImage::NImageFormats; ++srcFormat) {
+ for (int dstFormat = QImage::Format_Mono; dstFormat < QImage::NImageFormats; ++dstFormat) {
+ if (dstFormat == QImage::Format_Indexed8)
+ continue;
+ for (int odd_x = 0; odd_x <= 1; ++odd_x) {
+ for (int odd_width = 0; odd_width <= 1; ++odd_width) {
+ QString description =
+ QString("srcFormat %1, dstFormat %2, odd x: %3, odd width: %4")
+ .arg(srcFormat).arg(dstFormat).arg(odd_x).arg(odd_width);
+
+ QTest::newRow(description) << (10 + odd_x) << 10 << (20 + odd_width) << 20
+ << QImage::Format(srcFormat)
+ << QImage::Format(dstFormat);
+ }
+ }
+ }
+ }
+}
+
+bool verifyImage(const QImage &img, int x, int y, int w, int h, uint background)
+{
+ int imgWidth = img.width();
+ int imgHeight = img.height();
+ for (int i = 0; i < imgHeight; ++i) {
+ for (int j = 0; j < imgWidth; ++j) {
+ uint pixel = img.pixel(j, i);
+ bool outside = j < x || j >= (x + w) || i < y || i >= (y + h);
+ if (outside != (pixel == background)) {
+ //printf("%d %d, expected %x, got %x, outside: %d\n", x, y, background, pixel, outside);
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+void tst_QPainter::drawImage()
+{
+ QFETCH(int, x);
+ QFETCH(int, y);
+ QFETCH(int, w);
+ QFETCH(int, h);
+ QFETCH(QImage::Format, srcFormat);
+ QFETCH(QImage::Format, dstFormat);
+
+ QImage dst(40, 40, QImage::Format_RGB32);
+ dst.fill(0xffffffff);
+
+ dst = dst.convertToFormat(dstFormat);
+ uint background = dst.pixel(0, 0);
+
+ QImage src(w, h, QImage::Format_RGB32);
+ src.fill(0xff000000);
+ src = src.convertToFormat(srcFormat);
+
+ QPainter p(&dst);
+ p.drawImage(x, y, src);
+ p.end();
+
+ QVERIFY(verifyImage(dst, x, y, w, h, background));
+}
void tst_QPainter::imageCoordinateLimit()
{
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 1590fc0..8a6b63b 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -106,6 +106,7 @@ private slots:
void grabWidget();
void grabWindow();
void isNull();
+ void task_246446();
#ifdef Q_WS_QWS
void convertFromImageNoDetach();
@@ -1111,5 +1112,20 @@ void tst_QPixmap::fromData()
QCOMPARE(img.pixel(0, 1), QRgb(0xff000000));
}
+void tst_QPixmap::task_246446()
+{
+ // This crashed without the bugfix in 246446
+ QPixmap pm(10, 10);
+ pm.fill(Qt::transparent); // force 32-bit depth
+ QBitmap bm;
+ pm.setMask(bm);
+ {
+ QPixmap pm2(pm);
+ }
+ QVERIFY(pm.width() == 10);
+ QVERIFY(pm.mask().isNull());
+}
+
+
QTEST_MAIN(tst_QPixmap)
#include "tst_qpixmap.moc"
diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp
index ebfe33a..ef78c2e 100644
--- a/tests/auto/qprocess/tst_qprocess.cpp
+++ b/tests/auto/qprocess/tst_qprocess.cpp
@@ -141,6 +141,8 @@ private slots:
void switchReadChannels();
void setWorkingDirectory();
void startFinishStartFinish();
+ void invalidProgramString_data();
+ void invalidProgramString();
// keep these at the end, since they use lots of processes and sometimes
// caused obscure failures to occur in tests that followed them (esp. on the Mac)
@@ -2106,5 +2108,29 @@ void tst_QProcess::startFinishStartFinish()
}
}
+//-----------------------------------------------------------------------------
+void tst_QProcess::invalidProgramString_data()
+{
+ QTest::addColumn<QString>("programString");
+ QTest::newRow("null string") << QString();
+ QTest::newRow("empty string") << QString("");
+ QTest::newRow("only blank string") << QString(" ");
+}
+
+void tst_QProcess::invalidProgramString()
+{
+ QFETCH(QString, programString);
+ QProcess process;
+
+ qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
+ QSignalSpy spy(&process, SIGNAL(error(QProcess::ProcessError)));
+
+ process.start(programString);
+ QCOMPARE(process.error(), QProcess::FailedToStart);
+ QCOMPARE(spy.count(), 1);
+
+ QVERIFY(!QProcess::startDetached(programString));
+}
+
QTEST_MAIN(tst_QProcess)
#include "tst_qprocess.moc"
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 9995b46..5339fb4 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -1187,6 +1187,16 @@ static void fooFromScriptValue(const QScriptValue &value, Foo &foo)
foo.y = value.property("y").toInt32();
}
+static QScriptValue fooToScriptValueV2(QScriptEngine *eng, const Foo &foo)
+{
+ return QScriptValue(eng, foo.x);
+}
+
+static void fooFromScriptValueV2(const QScriptValue &value, Foo &foo)
+{
+ foo.x = value.toInt32();
+}
+
Q_DECLARE_METATYPE(QLinkedList<QString>)
Q_DECLARE_METATYPE(QList<Foo>)
Q_DECLARE_METATYPE(QVector<QChar>)
@@ -1427,6 +1437,24 @@ void tst_QScriptEngine::valueConversion()
QVERIFY(val.isVariant());
QCOMPARE(val.toVariant(), var);
}
+
+ // task 248802
+ qScriptRegisterMetaType<Foo>(&eng, fooToScriptValueV2, fooFromScriptValueV2);
+ {
+ QScriptValue num(&eng, 123);
+ Foo foo = qScriptValueToValue<Foo>(num);
+ QCOMPARE(foo.x, 123);
+ }
+ {
+ QScriptValue num(123);
+ Foo foo = qScriptValueToValue<Foo>(num);
+ QCOMPARE(foo.x, -1);
+ }
+ {
+ QScriptValue str(&eng, "123");
+ Foo foo = qScriptValueToValue<Foo>(str);
+ QCOMPARE(foo.x, 123);
+ }
}
static QScriptValue __import__(QScriptContext *ctx, QScriptEngine *eng)
diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index 9f92c37..0a48066 100644
--- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -129,6 +129,8 @@ private slots:
void task236755_hiddenColumns();
void task247867_insertRowsSort();
+ void task248868_staticSorting();
+ void task248868_dynamicSorting();
protected:
void buildHierarchy(const QStringList &data, QAbstractItemModel *model);
@@ -2479,5 +2481,115 @@ void tst_QSortFilterProxyModel::task247867_insertRowsSort()
QCOMPARE(proxyModel.sortColumn(), 0);
}
+void tst_QSortFilterProxyModel::task248868_staticSorting()
+{
+ QStandardItemModel model(0, 1);
+ QSortFilterProxyModel proxy;
+ proxy.setSourceModel(&model);
+ proxy.setDynamicSortFilter(false);
+ QStringList initial = QString("bateau avion dragon hirondelle flamme camion elephant").split(" ");
+
+ // prepare model
+ QStandardItem *root = model.invisibleRootItem ();
+ QList<QStandardItem *> items;
+ for (int i = 0; i < initial.count(); ++i) {
+ items.append(new QStandardItem(initial.at(i)));
+ }
+ root->insertRows(0, items);
+ QCOMPARE(model.rowCount(QModelIndex()), initial.count());
+ QCOMPARE(model.columnCount(QModelIndex()), 1);
+
+ // make sure the proxy is unsorted
+ QCOMPARE(proxy.columnCount(QModelIndex()), 1);
+ QCOMPARE(proxy.rowCount(QModelIndex()), initial.count());
+ for (int row = 0; row < proxy.rowCount(QModelIndex()); ++row) {
+ QModelIndex index = proxy.index(row, 0, QModelIndex());
+ QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), initial.at(row));
+ }
+
+ // sort
+ proxy.sort(0);
+
+ QStringList expected = initial;
+ expected.sort();
+ // make sure the proxy is sorted
+ for (int row = 0; row < proxy.rowCount(QModelIndex()); ++row) {
+ QModelIndex index = proxy.index(row, 0, QModelIndex());
+ QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), expected.at(row));
+ }
+
+ //update one item.
+ model.setItem(0, 0, new QStandardItem("girafe"));
+
+ // make sure the proxy is updated but not sorted
+ expected.replaceInStrings("bateau", "girafe");
+ for (int row = 0; row < proxy.rowCount(QModelIndex()); ++row) {
+ QModelIndex index = proxy.index(row, 0, QModelIndex());
+ QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), expected.at(row));
+ }
+
+ // sort again
+ proxy.sort(0);
+ expected.sort();
+
+ // make sure the proxy is sorted
+ for (int row = 0; row < proxy.rowCount(QModelIndex()); ++row) {
+ QModelIndex index = proxy.index(row, 0, QModelIndex());
+ QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), expected.at(row));
+ }
+
+}
+
+void tst_QSortFilterProxyModel::task248868_dynamicSorting()
+{
+ QStringListModel model1;
+ const QStringList initial = QString("bateau avion dragon hirondelle flamme camion elephant").split(" ");
+ model1.setStringList(initial);
+ QSortFilterProxyModel proxy1;
+ proxy1.sort(0);
+ proxy1.setSourceModel(&model1);
+
+ QCOMPARE(proxy1.columnCount(QModelIndex()), 1);
+ //the model should not be sorted because sorting has not been set to dynamic yet.
+ QCOMPARE(proxy1.rowCount(QModelIndex()), initial.count());
+ for (int row = 0; row < proxy1.rowCount(QModelIndex()); ++row) {
+ QModelIndex index = proxy1.index(row, 0, QModelIndex());
+ QCOMPARE(proxy1.data(index, Qt::DisplayRole).toString(), initial.at(row));
+ }
+
+ proxy1.setDynamicSortFilter(true);
+
+ //now the model should be sorted.
+ QStringList expected = initial;
+ expected.sort();
+ for (int row = 0; row < proxy1.rowCount(QModelIndex()); ++row) {
+ QModelIndex index = proxy1.index(row, 0, QModelIndex());
+ QCOMPARE(proxy1.data(index, Qt::DisplayRole).toString(), expected.at(row));
+ }
+
+ QStringList initial2 = initial;
+ initial2.replaceInStrings("bateau", "girafe");
+ model1.setStringList(initial2); //this will cause a reset
+
+ QStringList expected2 = initial2;
+ expected2.sort();
+
+ //now the model should still be sorted.
+ for (int row = 0; row < proxy1.rowCount(QModelIndex()); ++row) {
+ QModelIndex index = proxy1.index(row, 0, QModelIndex());
+ QCOMPARE(proxy1.data(index, Qt::DisplayRole).toString(), expected2.at(row));
+ }
+
+ QStringListModel model2(initial);
+ proxy1.setSourceModel(&model2);
+
+ //the model should again be sorted
+ for (int row = 0; row < proxy1.rowCount(QModelIndex()); ++row) {
+ QModelIndex index = proxy1.index(row, 0, QModelIndex());
+ QCOMPARE(proxy1.data(index, Qt::DisplayRole).toString(), expected.at(row));
+ }
+}
+
+
QTEST_MAIN(tst_QSortFilterProxyModel)
#include "tst_qsortfilterproxymodel.moc"
diff --git a/tests/auto/qsplitter/qsplitter.pro b/tests/auto/qsplitter/qsplitter.pro
index 99f27b4..a7ff0a6 100644
--- a/tests/auto/qsplitter/qsplitter.pro
+++ b/tests/auto/qsplitter/qsplitter.pro
@@ -8,4 +8,7 @@ wince*: {
addFiles.sources = extradata.txt setSizes3.dat
addFiles.path = .
DEPLOYMENT += addFiles
+ DEFINES += SRCDIR=\\\"./\\\"
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qsplitter/tst_qsplitter.cpp b/tests/auto/qsplitter/tst_qsplitter.cpp
index b463f7f..33404e4 100644
--- a/tests/auto/qsplitter/tst_qsplitter.cpp
+++ b/tests/auto/qsplitter/tst_qsplitter.cpp
@@ -213,7 +213,7 @@ void tst_QSplitter::setSizes3_data()
QTest::addColumn<IntList>("collapsibleStates");
QTest::addColumn<bool>("childrenCollapse");
- QFile file("setSizes3.dat");
+ QFile file(SRCDIR "setSizes3.dat");
if (!file.open(QIODevice::ReadOnly)) {
qDebug() << "Can't open file, reason:" << file.errorString();
return;
diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/qsqldatabase/tst_databases.h
index b529b7e..9c19048 100644
--- a/tests/auto/qsqldatabase/tst_databases.h
+++ b/tests/auto/qsqldatabase/tst_databases.h
@@ -105,10 +105,11 @@ inline static QString qTableName( const QString& prefix, QSqlDriver* driver = 0
inline static bool testWhiteSpaceNames( const QString &name )
{
- return name.startsWith( "QPSQL" )
+/* return name.startsWith( "QPSQL" )
|| name.startsWith( "QODBC" )
|| name.startsWith( "QSQLITE" )
- || name.startsWith( "QMYSQL" );
+ || name.startsWith( "QMYSQL" );*/
+ return name != QLatin1String("QSQLITE2");
}
inline static QString toHex( const QString& binary )
@@ -203,14 +204,14 @@ public:
{
// addDb( "QOCI8", "//horsehead.nokia.troll.no:1521/pony.troll.no", "scott", "tiger" ); // Oracle 9i on horsehead
// addDb( "QOCI8", "//horsehead.nokia.troll.no:1521/ustest.troll.no", "scott", "tiger", "" ); // Oracle 9i on horsehead
-// addDb( "QOCI8", "ICE", "scott", "tiger", "" ); // Oracle 8 on iceblink
+// addDb( "QOCI8", "//iceblink.nokia.troll.no:1521/ice.troll.no", "scott", "tiger", "" ); // Oracle 8 on iceblink (not currently working)
// addDb( "QOCI", "//silence.nokia.troll.no:1521/testdb", "scott", "tiger" ); // Oracle 10g on silence
// addDb( "QOCI", "//oracle10g-nokia.trolltech.com.au:1521/XE", "scott", "tiger" ); // Oracle 10gexpress on xen
// This requires a local ODBC data source to be configured( pointing to a MySql database )
// addDb( "QODBC", "mysqlodbc", "troll", "trond" );
// addDb( "QODBC", "SqlServer", "troll", "trond" );
-// addDb( "QTDS7", "testdb", "troll", "trondk", "horsehead" );
+// addDb( "QTDS7", "testdb", "troll", "trondk", "horsehead.nokia.troll.no" );
// addDb( "QODBC", "silencetestdb", "troll", "trond", "silence" );
// addDb( "QODBC", "horseheadtestdb", "troll", "trondk", "horsehead" );
@@ -231,7 +232,7 @@ public:
// addDb( "QPSQL7", "testdb", "testuser", "Ee4Gabf6_", "postgres74-nokia.trolltech.com.au" ); // Version 7.4.19-1.el4_6.1
// addDb( "QPSQL7", "testdb", "testuser", "Ee4Gabf6_", "postgres81-nokia.trolltech.com.au" ); // Version 8.1.11-1.el5_1.1
-// addDb( "QDB2", "testdb", "troll", "trond", "silence" ); // DB2 v9.1 on silence
+// addDb( "QDB2", "testdb", "troll", "trond", "silence.nokia.troll.no" ); // DB2 v9.1 on silence
// yes - interbase really wants the physical path on the host machine.
// addDb( "QIBASE", "/opt/interbase/qttest.gdb", "SYSDBA", "masterkey", "horsehead.nokia.troll.no" );
@@ -240,10 +241,6 @@ public:
// addDb( "QIBASE", "/opt/firebird/databases/testdb.fdb", "testuser", "Ee4Gabf6_", "firebird1-nokia.trolltech.com.au" ); // Firebird 1.5.5
// addDb( "QIBASE", "/opt/firebird/databases/testdb.fdb", "testuser", "Ee4Gabf6_", "firebird2-nokia.trolltech.com.au" ); // Firebird 2.1.1
-// Anders' local Firebird and InterBase test databases
-// addDb("QIBASE", "localhost:c:\\Firebird\\Firebird_2_0\\TESTDB.FDB", "SYSDBA", "masterkey", ""); // FireBird 2.0
-// addDb("QIBASE", "localhost:c:\\Borland\\InterBase\\TESTDB_UTF8.IB", "SYSDBA", "masterkey", ""); // InterBase 2007 Developer
-
// use in-memory database to prevent local files
// addDb("QSQLITE", ":memory:");
addDb( "QSQLITE", QDir::toNativeSeparators(QDir::tempPath()+"/foo.db") );
@@ -312,20 +309,22 @@ public:
// drop a table only if it exists to prevent warnings
static void safeDropTables( QSqlDatabase db, const QStringList& tableNames )
{
- int wasDropped = true;
+ bool wasDropped;
QSqlQuery q( db );
QStringList dbtables=db.tables();
- foreach(QString tableName, tableNames)
- {
-
- if ( dbtables.contains( tableName, Qt::CaseSensitive ) )
- wasDropped = q.exec( "drop table " + db.driver()->escapeIdentifier( tableName, QSqlDriver::TableName ) );
- else if ( dbtables.contains( tableName, Qt::CaseInsensitive ) )
- wasDropped = q.exec( "drop table " + tableName );
-
+ foreach(const QString &tableName, tableNames) {
+ wasDropped = true;
+ foreach(const QString dbtablesName, dbtables) {
+ if(dbtablesName.toUpper() == tableName.toUpper()) {
+ dbtables.removeAll(dbtablesName);
+ wasDropped = q.exec("drop table " + db.driver()->escapeIdentifier( dbtablesName, QSqlDriver::TableName ));
+ if(!wasDropped)
+ wasDropped = q.exec("drop table " + dbtablesName);
+ }
+ }
if ( !wasDropped )
- qWarning() << "unable to drop table" << tableName << ':' << q.lastError().text();
+ qWarning() << dbToString(db) << "unable to drop table" << tableName << ':' << q.lastError().text() << "tables:" << dbtables;
}
}
@@ -401,7 +400,7 @@ public:
static QByteArray printError( const QSqlError& err, const QSqlDatabase& db )
{
- return QString( db.driverName() + ": '" + err.driverText() + "' || '" + err.databaseText() + "'" ).toLocal8Bit();
+ return QString( dbToString(db) + ": '" + err.driverText() + "' || '" + err.databaseText() + "'" ).toLocal8Bit();
}
static bool isSqlServer( QSqlDatabase db )
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index 349db65..e10a0ca 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -93,28 +93,28 @@ private slots:
void addDatabase();
//database specific tests
- void recordMySQL_data();
+ void recordMySQL_data() { generic_data("QMYSQL"); }
void recordMySQL();
- void recordPSQL_data();
+ void recordPSQL_data() { generic_data("QPSQL"); }
void recordPSQL();
- void recordOCI_data();
+ void recordOCI_data() { generic_data("QOCI"); }
void recordOCI();
- void recordTDS_data();
+ void recordTDS_data() { generic_data("QTDS"); }
void recordTDS();
- void recordDB2_data();
+ void recordDB2_data() { generic_data("QDB2"); }
void recordDB2();
- void recordSQLite_data();
+ void recordSQLite_data() { generic_data("QSQLITE"); }
void recordSQLite();
- void recordAccess_data();
+ void recordAccess_data() { generic_data("QODBC"); }
void recordAccess();
- void recordSQLServer_data();
+ void recordSQLServer_data() { generic_data("QODBC"); }
void recordSQLServer();
- void recordIBase_data();
+ void recordIBase_data() {generic_data("QIBASE"); }
void recordIBase();
- void eventNotificationIBase_data() { generic_data(); }
+ void eventNotificationIBase_data() { generic_data("QIBASE"); }
void eventNotificationIBase();
- void eventNotificationPSQL_data() { generic_data(); }
+ void eventNotificationPSQL_data() { generic_data("QPSQL"); }
void eventNotificationPSQL();
//database specific 64 bit integer test
@@ -141,59 +141,61 @@ private slots:
void precisionPolicy_data() { generic_data(); }
void precisionPolicy();
- void db2_valueCacheUpdate_data() { generic_data(); }
+ void db2_valueCacheUpdate_data() { generic_data("QDB2"); }
void db2_valueCacheUpdate();
- void psql_schemas_data();
+ void psql_schemas_data() { generic_data("QPSQL"); }
void psql_schemas();
- void psql_escapedIdentifiers_data(){ psql_schemas_data(); }
+ void psql_escapedIdentifiers_data() { generic_data("QPSQL"); }
void psql_escapedIdentifiers();
- void psql_escapeBytea_data() { generic_data(); }
+ void psql_escapeBytea_data() { generic_data("QPSQL"); }
void psql_escapeBytea();
+ void bug_249059_data() { generic_data("QPSQL"); }
+ void bug_249059();
void mysqlOdbc_unsignedIntegers_data() { generic_data(); }
void mysqlOdbc_unsignedIntegers();
- void mysql_multiselect_data() { generic_data(); }
+ void mysql_multiselect_data() { generic_data("QMYSQL"); }
void mysql_multiselect(); // For task 144331
void accessOdbc_strings_data() { generic_data(); }
void accessOdbc_strings();
- void ibase_numericFields_data() { generic_data(); }
+ void ibase_numericFields_data() { generic_data("QIBASE"); }
void ibase_numericFields(); // For task 125053
- void ibase_fetchBlobs_data() { generic_data(); }
+ void ibase_fetchBlobs_data() { generic_data("QIBASE"); }
void ibase_fetchBlobs(); // For task 143471
- void ibase_useCustomCharset_data() { generic_data(); }
+ void ibase_useCustomCharset_data() { generic_data("QIBASE"); }
void ibase_useCustomCharset(); // For task 134608
- void ibase_procWithoutReturnValues_data() { generic_data(); } // For task 165423
+ void ibase_procWithoutReturnValues_data() { generic_data("QIBASE"); } // For task 165423
void ibase_procWithoutReturnValues();
- void ibase_procWithReturnValues_data() { generic_data(); } // For task 177530
+ void ibase_procWithReturnValues_data() { generic_data("QIBASE"); } // For task 177530
void ibase_procWithReturnValues();
- void odbc_reopenDatabase_data() { generic_data(); }
+ void odbc_reopenDatabase_data() { generic_data("QODBC"); }
void odbc_reopenDatabase();
- void odbc_uniqueidentifier_data() { generic_data(); }
+ void odbc_uniqueidentifier_data() { generic_data("QODBC"); }
void odbc_uniqueidentifier(); // For task 141822
- void odbc_uintfield_data() { generic_data(); }
+ void odbc_uintfield_data() { generic_data("QODBC"); }
void odbc_uintfield();
- void odbc_bindBoolean_data() { generic_data(); }
+ void odbc_bindBoolean_data() { generic_data("QODBC"); }
void odbc_bindBoolean();
- void oci_serverDetach_data() { generic_data(); }
+ void oci_serverDetach_data() { generic_data("QOCI"); }
void oci_serverDetach(); // For task 154518
- void oci_xmltypeSupport_data() { generic_data(); }
+ void oci_xmltypeSupport_data() { generic_data("QOCI"); }
void oci_xmltypeSupport();
- void oci_fieldLength_data() { generic_data(); }
+ void oci_fieldLength_data() { generic_data("QOCI"); }
void oci_fieldLength();
- void sqlite_bindAndFetchUInt_data() { generic_data(); }
+ void sqlite_bindAndFetchUInt_data() { generic_data("QSQLITE3"); }
void sqlite_bindAndFetchUInt();
private:
void createTestTables(QSqlDatabase db);
void dropTestTables(QSqlDatabase db);
void populateTestTables(QSqlDatabase db);
- void generic_data();
+ void generic_data(const QString &engine=QString());
#ifdef QT3_SUPPORT
void testRecordInfo(const FieldDef fieldDefs[], const Q3SqlRecordInfo& inf);
@@ -337,7 +339,8 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db)
<< qTableName("qtestBindBool")
<< qTableName("qtest_sqlguid")
<< qTableName("uint_table")
- << qTableName("uint_test");
+ << qTableName("uint_test")
+ << qTableName("bug_249059");
QSqlQuery q(0, db);
if (db.driverName().startsWith("QPSQL"))
@@ -394,70 +397,14 @@ void tst_QSqlDatabase::cleanup()
{
}
-void tst_QSqlDatabase::recordOCI_data()
+void tst_QSqlDatabase::generic_data(const QString& engine)
{
- if (dbs.fillTestTable("QOCI") == 0)
- QSKIP("No Oracle database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::recordPSQL_data()
-{
- if (dbs.fillTestTable("QPSQL") == 0)
- QSKIP("No PostgreSQL database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::recordMySQL_data()
-{
- if (dbs.fillTestTable("QMYSQL") == 0)
- QSKIP("No MySQL database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::recordTDS_data()
-{
- if (dbs.fillTestTable("QTDS") == 0)
- QSKIP("No TDS database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::recordDB2_data()
-{
- if (dbs.fillTestTable("QDB2") == 0)
- QSKIP("No DB2 database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::recordSQLite_data()
-{
- if (dbs.fillTestTable("QSQLITE") == 0)
- QSKIP("No SQLite database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::recordAccess_data()
-{
- if (dbs.fillTestTable("QODBC") == 0)
- QSKIP("No ODBC database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::recordSQLServer_data()
-{
- if (dbs.fillTestTable("QODBC") == 0)
- QSKIP("No ODBC database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::recordIBase_data()
-{
- if (dbs.fillTestTable("QIBASE") == 0)
- QSKIP("No Interbase database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::psql_schemas_data()
-{
- if (dbs.fillTestTable("QPSQL") == 0)
- QSKIP("No Postgres database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::generic_data()
-{
- if (dbs.fillTestTable() == 0)
- QSKIP("No database drivers are available in this Qt configuration", SkipAll);
+ if ( dbs.fillTestTable(engine) == 0 ) {
+ if(engine.isEmpty())
+ QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ else
+ QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll );
+ }
}
void tst_QSqlDatabase::addDatabase()
@@ -885,7 +832,6 @@ void tst_QSqlDatabase::recordTDS()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QTDS");
static const FieldDef fieldDefs[] = {
FieldDef("tinyint", QVariant::Int, 255),
@@ -934,7 +880,6 @@ void tst_QSqlDatabase::recordOCI()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QOCI");
// runtime check for Oracle version since V8 doesn't support TIMESTAMPs
if (tst_Databases::getOraVersion(db) >= 9) {
@@ -1010,7 +955,6 @@ void tst_QSqlDatabase::recordPSQL()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QPSQL");
FieldDef byteadef;
if (db.driver()->hasFeature(QSqlDriver::BLOB))
@@ -1095,7 +1039,6 @@ void tst_QSqlDatabase::recordMySQL()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QMYSQL");
FieldDef bin10, varbin10;
int major = tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 0 ).toInt();
@@ -1174,7 +1117,6 @@ void tst_QSqlDatabase::recordDB2()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QDB2");
static const FieldDef fieldDefs[] = {
FieldDef("char(20)", QVariant::String, QString("Blah1")),
@@ -1220,7 +1162,6 @@ void tst_QSqlDatabase::recordIBase()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QIBASE");
static const FieldDef fieldDefs[] = {
FieldDef("char(20)", QVariant::String, QString("Blah1"), false),
@@ -1251,7 +1192,6 @@ void tst_QSqlDatabase::recordSQLite()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QSQLITE");
static const FieldDef fieldDefs[] = {
// The affinity of these fields are TEXT so SQLite should give us strings, not ints or doubles.
@@ -1594,7 +1534,6 @@ void tst_QSqlDatabase::psql_escapeBytea()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QPSQL");
const char dta[4] = {'\x71', '\x14', '\x32', '\x81'};
QByteArray ba(dta, 4);
@@ -1621,6 +1560,38 @@ void tst_QSqlDatabase::psql_escapeBytea()
QCOMPARE(i, 4);
}
+void tst_QSqlDatabase::bug_249059()
+{
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
+
+ QSqlQuery q(db);
+ QString tableName = qTableName("bug_249059");
+ QVERIFY_SQL(q, exec(QString("CREATE TABLE %1 (dt timestamp, t time)").arg(tableName)));
+
+ QSqlQuery iq(db);
+ QVERIFY_SQL(iq, prepare(QString("INSERT INTO %1 VALUES (?, ?)").arg(tableName)));
+ iq.bindValue(0, QVariant(QString("2001-09-09 04:05:06.789 -5:00")));
+ iq.bindValue(1, QVariant(QString("04:05:06.789 -5:00")));
+ QVERIFY_SQL(iq, exec());
+ iq.bindValue(0, QVariant(QString("2001-09-09 04:05:06.789 +5:00")));
+ iq.bindValue(1, QVariant(QString("04:05:06.789 +5:00")));
+ QVERIFY_SQL(iq, exec());
+
+ QVERIFY_SQL(q, exec(QString("SELECT dt, t FROM %1").arg(tableName)));
+ QVERIFY_SQL(q, next());
+ QDateTime dt1=q.value(0).toDateTime();
+ QTime t1=q.value(1).toTime();
+ QVERIFY_SQL(q, next());
+ QDateTime dt2=q.value(0).toDateTime();
+ QTime t2=q.value(1).toTime();
+
+ // These will fail when timezone support is added, when that's the case, set the second record to 14:05:06.789 and it should work correctly
+ QCOMPARE(dt1, dt2);
+ QCOMPARE(t1, t2);
+}
+
// This test should be rewritten to work with Oracle as well - or the Oracle driver
// should be fixed to make this test pass (handle overflows)
void tst_QSqlDatabase::precisionPolicy()
@@ -1767,7 +1738,6 @@ void tst_QSqlDatabase::ibase_numericFields()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QIBASE");
QSqlQuery q(db);
QString tableName = qTableName("numericfields");
@@ -1841,7 +1811,6 @@ void tst_QSqlDatabase::ibase_fetchBlobs()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QIBASE");
QString tableName = qTableName("qtest_ibaseblobs");
QSqlQuery q(db);
@@ -1874,7 +1843,6 @@ void tst_QSqlDatabase::ibase_procWithoutReturnValues()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QIBASE");
QSqlQuery q(db);
QString procName = qTableName("qtest_proc1");
@@ -1955,11 +1923,6 @@ void tst_QSqlDatabase::odbc_reopenDatabase()
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- if (!tst_Databases::isSqlServer(db)) {
- QSKIP("SQL Server (ODBC) specific test", SkipSingle);
- return;
- }
-
QSqlQuery q(db);
QVERIFY_SQL(q, exec("SELECT * from " + qTableName("qtest")));
QVERIFY_SQL(q, next());
@@ -1974,7 +1937,6 @@ void tst_QSqlDatabase::odbc_bindBoolean()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QODBC");
QSqlQuery q(db);
QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("qtestBindBool") + "(id int, boolvalue bit)"));
@@ -2003,7 +1965,6 @@ void tst_QSqlDatabase::mysql_multiselect()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QMYSQL");
QSqlQuery q(db);
QVERIFY_SQL(q, exec("select version()"));
@@ -2025,7 +1986,6 @@ void tst_QSqlDatabase::ibase_useCustomCharset()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QIBASE");
QString nonlatin1string("��");
db.close();
@@ -2049,7 +2009,6 @@ void tst_QSqlDatabase::oci_serverDetach()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QOCI");
for (int i = 0; i < 2; i++) {
db.close();
@@ -2070,7 +2029,6 @@ void tst_QSqlDatabase::oci_xmltypeSupport()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QOCI");
QString tableName = qTableName("qtest_xmltype");
QString xml("<?xml version=\"1.0\"?><TABLE_NAME>MY_TABLE</TABLE_NAME>");
@@ -2099,7 +2057,6 @@ void tst_QSqlDatabase::oci_fieldLength()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QOCI");
QString tableName = qTableName("qtest");
QSqlQuery q(db);
@@ -2164,7 +2121,6 @@ void tst_QSqlDatabase::odbc_uintfield()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QODBC");
QString tableName = qTableName("uint_table");
unsigned int val = 4294967295U;
@@ -2226,7 +2182,6 @@ void tst_QSqlDatabase::eventNotificationIBase()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QIBASE");
QString procedureName = qTableName("posteventProc");
QSqlDriver *driver=db.driver();
@@ -2256,7 +2211,6 @@ void tst_QSqlDatabase::eventNotificationPSQL()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QPSQL");
QSqlQuery query(db);
QString procedureName = qTableName("posteventProc");
@@ -2277,7 +2231,6 @@ void tst_QSqlDatabase::sqlite_bindAndFetchUInt()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QSQLITE3");
QSqlQuery q(db);
QString tableName = qTableName("uint_test");
@@ -2299,7 +2252,6 @@ void tst_QSqlDatabase::db2_valueCacheUpdate()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QDB2");
QString tableName = qTableName("qtest");
QSqlQuery q(db);
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index 684d6ac..8d77589 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -93,7 +93,7 @@ private slots:
void transaction();
void record_data() { generic_data(); }
void record();
- void record_sqlite_data() { generic_data(); }
+ void record_sqlite_data() { generic_data("QSQLITE"); }
void record_sqlite();
void finish_data() { generic_data(); }
void finish();
@@ -107,13 +107,13 @@ private slots:
void forwardOnly();
// bug specific tests
- void bitField_data();
+ void bitField_data() {generic_data("QTDS"); }
void bitField();
- void nullBlob_data();
+ void nullBlob_data() { generic_data("QOCI"); }
void nullBlob();
void blob_data() { generic_data(); }
void blob();
- void rawField_data();
+ void rawField_data() { generic_data("QOCI"); }
void rawField();
void precision_data() { generic_data(); }
void precision();
@@ -129,19 +129,19 @@ private slots:
void char1SelectUnicode();
void synonyms_data() { generic_data(); }
void synonyms();
- void oraOutValues_data();
+ void oraOutValues_data() { generic_data("QOCI"); }
void oraOutValues();
- void mysqlOutValues_data();
+ void mysqlOutValues_data() { generic_data("QMYSQL"); }
void mysqlOutValues();
- void oraClob_data() { oraOutValues_data(); }
+ void oraClob_data() { generic_data("QOCI"); }
void oraClob();
- void oraLong_data() { oraOutValues_data(); }
+ void oraLong_data() { generic_data("QOCI"); }
void oraLong();
- void outValuesDB2_data();
+ void outValuesDB2_data() { generic_data("QDB2"); }
void outValuesDB2();
- void storedProceduresIBase_data();
+ void storedProceduresIBase_data() {generic_data("QIBASE"); }
void storedProceduresIBase();
- void oraRowId_data();
+ void oraRowId_data() { generic_data("QOCI"); }
void oraRowId();
void prepare_bind_exec_data() { generic_data(); }
void prepare_bind_exec();
@@ -175,13 +175,13 @@ private slots:
void emptyTableNavigate();
#ifdef NOT_READY_YET
- void bug217003_data() { generic_data(); }
- void bug217003();
+ void task_217003_data() { generic_data(); }
+ void task_217003();
#endif
private:
// returns all database connections
- void generic_data();
+ void generic_data(const QString &engine=QString());
void dropTestTables( QSqlDatabase db );
void createTestTables( QSqlDatabase db );
void populateTestTables( QSqlDatabase db );
@@ -247,28 +247,14 @@ void tst_QSqlQuery::cleanup()
}
}
-void tst_QSqlQuery::bitField_data()
+void tst_QSqlQuery::generic_data(const QString& engine)
{
- if ( dbs.fillTestTable( "QTDS" ) == 0 )
- QSKIP( "No TDS database drivers are available in this Qt configuration", SkipAll );
-}
-
-void tst_QSqlQuery::nullBlob_data()
-{
- if ( dbs.fillTestTable( "QOCI" ) == 0 )
- QSKIP( "No Oracle database drivers are available in this Qt configuration", SkipAll );
-}
-
-void tst_QSqlQuery::rawField_data()
-{
- if ( dbs.fillTestTable( "QOCI" ) == 0 )
- QSKIP( "No Oracle database drivers are available in this Qt configuration", SkipAll );
-}
-
-void tst_QSqlQuery::generic_data()
-{
- if ( dbs.fillTestTable() == 0 )
- QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ if ( dbs.fillTestTable(engine) == 0 ) {
+ if(engine.isEmpty())
+ QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ else
+ QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll );
+ }
}
void tst_QSqlQuery::dropTestTables( QSqlDatabase db )
@@ -421,12 +407,6 @@ void tst_QSqlQuery::char1SelectUnicode()
QSKIP( "Database not unicode capable", SkipSingle );
}
-void tst_QSqlQuery::oraRowId_data()
-{
- if ( dbs.fillTestTable( "QOCI" ) == 0 )
- QSKIP( "No Oracle database drivers are available in this Qt configuration", SkipAll );
-}
-
void tst_QSqlQuery::oraRowId()
{
QFETCH( QString, dbName );
@@ -461,12 +441,6 @@ void tst_QSqlQuery::oraRowId()
QCOMPARE( q.value( 0 ).toString(), QString( "b" ) );
}
-void tst_QSqlQuery::mysqlOutValues_data()
-{
- if ( dbs.fillTestTable( "QMYSQL" ) == 0 )
- QSKIP( "No MySQL database drivers are available in this Qt configuration", SkipAll );
-}
-
void tst_QSqlQuery::mysqlOutValues()
{
QFETCH( QString, dbName );
@@ -517,12 +491,6 @@ void tst_QSqlQuery::mysqlOutValues()
QVERIFY_SQL( q, exec( "drop procedure " + qTableName( "qtestproc" ) ) );
}
-void tst_QSqlQuery::oraOutValues_data()
-{
- if ( dbs.fillTestTable( "QOCI" ) == 0 )
- QSKIP( "No Oracle database drivers are available in this Qt configuration", SkipAll );
-}
-
void tst_QSqlQuery::oraOutValues()
{
QFETCH( QString, dbName );
@@ -670,18 +638,11 @@ void tst_QSqlQuery::oraClob()
QVERIFY( q.value( 1 ).toByteArray() == loong.toLatin1() );
}
-void tst_QSqlQuery::storedProceduresIBase_data()
-{
- if ( dbs.fillTestTable( "QIBASE" ) == 0 )
- QSKIP( "No Interbase database drivers are available in this Qt configuration", SkipAll );
-}
-
void tst_QSqlQuery::storedProceduresIBase()
{
QFETCH( QString, dbName );
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
- DBMS_SPECIFIC( db, "QIBASE" );
QSqlQuery q( db );
q.exec( "drop procedure " + qTableName( "TESTPROC" ) );
@@ -713,12 +674,6 @@ void tst_QSqlQuery::storedProceduresIBase()
q.exec( "drop procedure " + qTableName( "TestProc" ) );
}
-void tst_QSqlQuery::outValuesDB2_data()
-{
- if ( dbs.fillTestTable( "QDB2" ) == 0 )
- QSKIP( "No DB2 database drivers are available in this Qt configuration", SkipAll );
-}
-
void tst_QSqlQuery::outValuesDB2()
{
QFETCH( QString, dbName );
@@ -1355,7 +1310,6 @@ void tst_QSqlQuery::nullBlob()
QFETCH( QString, dbName );
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
- DBMS_SPECIFIC( db, "QOCI" );
QSqlQuery q( db );
QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_nullblob" ) + " (id int primary key, bb blob)" ) );
@@ -1385,7 +1339,6 @@ void tst_QSqlQuery::rawField()
QFETCH( QString, dbName );
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
- DBMS_SPECIFIC( db, "QOCI" );
QSqlQuery q( db );
q.setForwardOnly( true );
@@ -2103,7 +2056,6 @@ void tst_QSqlQuery::record_sqlite()
QFETCH( QString, dbName );
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
- DBMS_SPECIFIC( db, "QSQLITE" );
QSqlQuery q( db );
@@ -2131,7 +2083,6 @@ void tst_QSqlQuery::oraLong()
QFETCH( QString, dbName );
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
- DBMS_SPECIFIC( db, "QOCI" );
QSqlQuery q( db );
@@ -2158,7 +2109,7 @@ void tst_QSqlQuery::execErrorRecovery()
QSqlQuery q( db );
- QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_exerr" ) + " (id int primary key)" ) );
+ QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_exerr" ) + " (id int not null primary key)" ) );
QVERIFY_SQL( q, prepare( "insert into " + qTableName( "qtest_exerr" ) + " values (?)" ) );
q.addBindValue( 1 );
@@ -2698,7 +2649,7 @@ void tst_QSqlQuery::emptyTableNavigate()
}
#ifdef NOT_READY_YET
-void tst_QSqlQuery::bug217003()
+void tst_QSqlQuery::task_217003()
{
QFETCH( QString, dbName );
QSqlDatabase db = QSqlDatabase::database( dbName );
diff --git a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp
index 63202f8..88b5770 100644
--- a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp
+++ b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp
@@ -95,7 +95,7 @@ private slots:
void setQueryWithNoRowsInResultSet();
private:
- void generic_data();
+ void generic_data(const QString &engine=QString());
void dropTestTables(QSqlDatabase db);
void createTestTables(QSqlDatabase db);
void populateTestTables(QSqlDatabase db);
@@ -202,10 +202,14 @@ void tst_QSqlQueryModel::populateTestTables(QSqlDatabase db)
tst_Databases::safeDropTables(db, QStringList() << qTableName("manytmp") << qTableName("test3tmp"));
}
-void tst_QSqlQueryModel::generic_data()
+void tst_QSqlQueryModel::generic_data(const QString& engine)
{
- if (dbs.fillTestTable() == 0)
- QSKIP("No database drivers are available in this Qt configuration", SkipAll);
+ if ( dbs.fillTestTable(engine) == 0 ) {
+ if(engine.isEmpty())
+ QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ else
+ QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll );
+ }
}
void tst_QSqlQueryModel::init()
diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
index 6015d1c..d4affe4 100644
--- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
+++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
@@ -66,38 +66,59 @@ public:
tst_Databases dbs;
public slots:
- void initTestCase_data();
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
private slots:
+ void select_data() { generic_data(); }
void select();
+ void submitAll_data() { generic_data(); }
void submitAll();
- void setRecord_data();
+ void setRecord_data() { generic_data(); }
void setRecord();
+ void insertRow_data() { generic_data(); }
void insertRow();
+ void insertRecord_data() { generic_data(); }
void insertRecord();
+ void insertMultiRecords_data() { generic_data(); }
void insertMultiRecords();
+ void removeRow_data() { generic_data(); }
void removeRow();
+ void removeRows_data() { generic_data(); }
void removeRows();
+ void removeInsertedRow_data() { generic_data(); }
void removeInsertedRow();
+ void setFilter_data() { generic_data(); }
void setFilter();
+ void setInvalidFilter_data() { generic_data(); }
void setInvalidFilter();
+ void emptyTable_data() { generic_data(); }
void emptyTable();
+ void tablesAndSchemas_data() { generic_data("QPSQL"); }
void tablesAndSchemas();
+ void whitespaceInIdentifiers_data() { generic_data(); }
void whitespaceInIdentifiers();
+ void primaryKeyOrder_data() { generic_data("QSQLITE"); }
void primaryKeyOrder();
+ void sqlite_bigTable_data() { generic_data("QSQLITE"); }
void sqlite_bigTable();
// bug specific tests
+ void insertRecordBeforeSelect_data() { generic_data(); }
void insertRecordBeforeSelect();
+ void submitAllOnInvalidTable_data() { generic_data(); }
void submitAllOnInvalidTable();
+ void insertRecordsInLoop_data() { generic_data(); }
void insertRecordsInLoop();
+ void sqlite_attachedDatabase_data() { generic_data("QSQLITE"); }
void sqlite_attachedDatabase(); // For task 130799
+
+private:
+ void generic_data(const QString& engine=QString());
};
tst_QSqlTableModel::tst_QSqlTableModel()
@@ -121,7 +142,8 @@ void tst_QSqlTableModel::dropTestTables()
<< qTableName("test2")
<< qTableName("test3")
<< qTableName("emptytable")
- << qTableName("bigtable");
+ << qTableName("bigtable")
+ << qTableName("foo");
if (testWhiteSpaceNames(db.driverName()))
tableNames << qTableName("qtestw hitespace");
@@ -160,16 +182,16 @@ void tst_QSqlTableModel::repopulateTestTables()
QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i));
QSqlQuery q(db);
- QVERIFY_SQL( q, exec("delete from " + qTableName("test")));
+ q.exec("delete from " + qTableName("test"));
QVERIFY_SQL( q, exec("insert into " + qTableName("test") + " values(1, 'harry', 1)"));
QVERIFY_SQL( q, exec("insert into " + qTableName("test") + " values(2, 'trond', 2)"));
QVERIFY_SQL( q, exec("insert into " + qTableName("test") + " values(3, 'vohi', 3)"));
- QVERIFY_SQL( q, exec("delete from " + qTableName("test2")));
+ q.exec("delete from " + qTableName("test2"));
QVERIFY_SQL( q, exec("insert into " + qTableName("test2") + " values(1, 'herr')"));
QVERIFY_SQL( q, exec("insert into " + qTableName("test2") + " values(2, 'mister')"));
- QVERIFY_SQL( q, exec("delete from " + qTableName("test3")));
+ q.exec("delete from " + qTableName("test3"));
QVERIFY_SQL( q, exec("insert into " + qTableName("test3") + " values(1, 'foo', 'bar')"));
QVERIFY_SQL( q, exec("insert into " + qTableName("test3") + " values(2, 'baz', 'joe')"));
}
@@ -182,11 +204,13 @@ void tst_QSqlTableModel::recreateTestTables()
repopulateTestTables();
}
-void tst_QSqlTableModel::initTestCase_data()
+void tst_QSqlTableModel::generic_data(const QString &engine)
{
- if (dbs.fillTestTable() == 0) {
- qWarning("NO DATABASES");
- QSKIP("No database drivers are available in this Qt configuration", SkipAll);
+ if ( dbs.fillTestTable(engine) == 0 ) {
+ if(engine.isEmpty())
+ QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ else
+ QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll );
}
}
@@ -212,7 +236,7 @@ void tst_QSqlTableModel::cleanup()
void tst_QSqlTableModel::select()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -245,58 +269,51 @@ void tst_QSqlTableModel::select()
QCOMPARE(model.data(model.index(3, 3)), QVariant());
}
-void tst_QSqlTableModel::setRecord_data()
-{
- QTest::addColumn<uint>("submitpolicy");
- QTest::newRow("OnFieldChange") << (uint)QSqlTableModel::OnFieldChange;
- QTest::newRow("OnRowChange") << (uint)QSqlTableModel::OnRowChange;
- QTest::newRow("OnManualSubmit") << (uint)QSqlTableModel::OnManualSubmit;
-}
-
void tst_QSqlTableModel::setRecord()
{
- // This needs to be tested with ODBC, which requires a manual change to qsqldatabase\tst_databases.h
- // to ensure an ODBC db is added
-
- QFETCH_GLOBAL(QString, dbName);
- QFETCH(uint, submitpolicy);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- QSqlTableModel model(0, db);
- model.setEditStrategy((QSqlTableModel::EditStrategy)submitpolicy);
- model.setTable(qTableName("test3"));
- model.setSort(0, Qt::AscendingOrder);
- QVERIFY_SQL(model, select());
+ QList<QSqlTableModel::EditStrategy> policies = QList<QSqlTableModel::EditStrategy>() << QSqlTableModel::OnFieldChange << QSqlTableModel::OnRowChange << QSqlTableModel::OnManualSubmit;
+
+ foreach( QSqlTableModel::EditStrategy submitpolicy, policies) {
+
+ QSqlTableModel model(0, db);
+ model.setEditStrategy((QSqlTableModel::EditStrategy)submitpolicy);
+ model.setTable(qTableName("test3"));
+ model.setSort(0, Qt::AscendingOrder);
+ QVERIFY_SQL(model, select());
- for (int i = 0; i < model.rowCount(); ++i) {
- QSignalSpy spy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
-
- QSqlRecord rec = model.record(i);
- rec.setValue(1, rec.value(1).toString() + 'X');
- rec.setValue(2, rec.value(2).toString() + 'X');
- QVERIFY(model.setRecord(i, rec));
-
- if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnManualSubmit)
- QVERIFY(model.submitAll());
- else {
- // dataChanged() is not emitted when submitAll() is called
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.at(0).count(), 2);
- QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(0)), model.index(i, 1));
- QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(1)), model.index(i, 1));
+ for (int i = 0; i < model.rowCount(); ++i) {
+ QSignalSpy spy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
+
+ QSqlRecord rec = model.record(i);
+ rec.setValue(1, rec.value(1).toString() + 'X');
+ rec.setValue(2, rec.value(2).toString() + 'X');
+ QVERIFY(model.setRecord(i, rec));
+
+ if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnManualSubmit)
+ QVERIFY(model.submitAll());
+ else {
+ // dataChanged() is not emitted when submitAll() is called
+ QCOMPARE(spy.count(), 2);
+ QCOMPARE(spy.at(0).count(), 2);
+ QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(0)), model.index(i, 1));
+ QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(1)), model.index(i, 1));
+ }
}
- }
- QCOMPARE(model.data(model.index(0, 1)).toString(), QString("fooX"));
- QCOMPARE(model.data(model.index(0, 2)).toString(), QString("barX"));
- QCOMPARE(model.data(model.index(1, 1)).toString(), QString("bazX"));
- QCOMPARE(model.data(model.index(1, 2)).toString(), QString("joeX"));
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("fooX"));
+ QCOMPARE(model.data(model.index(0, 2)).toString(), QString("barX"));
+ QCOMPARE(model.data(model.index(1, 1)).toString(), QString("bazX"));
+ QCOMPARE(model.data(model.index(1, 2)).toString(), QString("joeX"));
+ }
}
void tst_QSqlTableModel::insertRow()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -321,7 +338,7 @@ void tst_QSqlTableModel::insertRow()
void tst_QSqlTableModel::insertRecord()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -354,7 +371,7 @@ void tst_QSqlTableModel::insertRecord()
void tst_QSqlTableModel::insertMultiRecords()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -403,7 +420,7 @@ void tst_QSqlTableModel::insertMultiRecords()
void tst_QSqlTableModel::submitAll()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -438,7 +455,7 @@ void tst_QSqlTableModel::submitAll()
void tst_QSqlTableModel::removeRow()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -484,7 +501,7 @@ void tst_QSqlTableModel::removeRow()
void tst_QSqlTableModel::removeRows()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -533,7 +550,7 @@ void tst_QSqlTableModel::removeRows()
void tst_QSqlTableModel::removeInsertedRow()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -565,7 +582,7 @@ void tst_QSqlTableModel::removeInsertedRow()
void tst_QSqlTableModel::emptyTable()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -584,12 +601,10 @@ void tst_QSqlTableModel::emptyTable()
void tst_QSqlTableModel::tablesAndSchemas()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QPSQL");
-
QSqlQuery q(db);
q.exec("DROP SCHEMA " + qTableName("testschema") + " CASCADE");
QVERIFY_SQL( q, exec("create schema " + qTableName("testschema")));
@@ -607,7 +622,7 @@ void tst_QSqlTableModel::tablesAndSchemas()
void tst_QSqlTableModel::whitespaceInIdentifiers()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -623,16 +638,16 @@ void tst_QSqlTableModel::whitespaceInIdentifiers()
void tst_QSqlTableModel::primaryKeyOrder()
{
- QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", "primaryKeyOrderTest");
- db.setDatabaseName(":memory:");
- QVERIFY_SQL(db, open());
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
QSqlQuery q(db);
- QVERIFY_SQL( q, exec("create table foo(a varchar(20), id int primary key, b varchar(20))"));
+ QVERIFY_SQL( q, exec("create table "+qTableName("foo")+"(a varchar(20), id int not null primary key, b varchar(20))"));
QSqlTableModel model(0, db);
- model.setTable("foo");
+ model.setTable(qTableName("foo"));
QSqlIndex pk = model.primaryKey();
QCOMPARE(pk.count(), 1);
@@ -652,7 +667,7 @@ void tst_QSqlTableModel::primaryKeyOrder()
void tst_QSqlTableModel::setInvalidFilter()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -671,7 +686,7 @@ void tst_QSqlTableModel::setInvalidFilter()
void tst_QSqlTableModel::setFilter()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -724,12 +739,10 @@ void tst_QSqlTableModel::setFilter()
void tst_QSqlTableModel::sqlite_bigTable()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QSQLITE");
-
bool hasTransactions = db.driver()->hasFeature(QSqlDriver::Transactions);
if (hasTransactions) QVERIFY(db.transaction());
QSqlQuery q(db);
@@ -763,7 +776,7 @@ void tst_QSqlTableModel::sqlite_bigTable()
// had first been called.
void tst_QSqlTableModel::insertRecordBeforeSelect()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -796,7 +809,7 @@ void tst_QSqlTableModel::insertRecordBeforeSelect()
// are inserted and submitted on a non-existing table.
void tst_QSqlTableModel::submitAllOnInvalidTable()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -828,7 +841,7 @@ void tst_QSqlTableModel::submitAllOnInvalidTable()
// For task 147575: the rowsRemoved signal emitted from the model was lying
void tst_QSqlTableModel::insertRecordsInLoop()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -866,12 +879,10 @@ void tst_QSqlTableModel::insertRecordsInLoop()
void tst_QSqlTableModel::sqlite_attachedDatabase()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QSQLITE");
-
QSqlDatabase attachedDb = QSqlDatabase::cloneDatabase(db, db.driverName() + QLatin1String("attached"));
attachedDb.setDatabaseName(db.databaseName()+QLatin1String("attached.dat"));
QVERIFY_SQL(attachedDb, open());
diff --git a/tests/auto/qsqlthread/tst_qsqlthread.cpp b/tests/auto/qsqlthread/tst_qsqlthread.cpp
index 94e0f98..d871be4 100644
--- a/tests/auto/qsqlthread/tst_qsqlthread.cpp
+++ b/tests/auto/qsqlthread/tst_qsqlthread.cpp
@@ -286,10 +286,14 @@ tst_QSqlThread::~tst_QSqlThread()
{
}
-void tst_QSqlThread::generic_data()
+void tst_QSqlThread::generic_data(const QString& engine)
{
- if (dbs.fillTestTable() == 0)
- QSKIP("No database drivers are available in this Qt configuration", SkipAll);
+ if ( dbs.fillTestTable(engine) == 0 ) {
+ if(engine.isEmpty())
+ QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ else
+ QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll );
+ }
}
void tst_QSqlThread::dropTestTables()
diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
index 7954d00..aa63753 100644
--- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -94,6 +94,7 @@ private slots:
void embeddedFonts();
void opaquePaintEvent_data();
void opaquePaintEvent();
+ void task188195_baseBackground();
//at the end because it mess with the style.
void widgetStyle();
@@ -1354,6 +1355,28 @@ void tst_QStyleSheetStyle::opaquePaintEvent()
QCOMPARE(cl.autoFillBackground(), !styled );
}
+void tst_QStyleSheetStyle::task188195_baseBackground()
+{
+ QTreeView tree;
+ tree.setStyleSheet( "QTreeView:disabled { background-color:#ab1251; }" );
+ tree.show();
+ QTest::qWait(20);
+ QImage image(tree.width(), tree.height(), QImage::Format_ARGB32);
+
+ tree.render(&image);
+ QVERIFY(testForColors(image, tree.palette().base().color()));
+ QVERIFY(!testForColors(image, QColor(0xab, 0x12, 0x51)));
+
+ tree.setEnabled(false);
+ tree.render(&image);
+ QVERIFY(testForColors(image, QColor(0xab, 0x12, 0x51)));
+
+ tree.setEnabled(true);
+ tree.render(&image);
+ QVERIFY(testForColors(image, tree.palette().base().color()));
+ QVERIFY(!testForColors(image, QColor(0xab, 0x12, 0x51)));
+}
+
QTEST_MAIN(tst_QStyleSheetStyle)
diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp
index a9b41d8..9595155 100644
--- a/tests/auto/qtableview/tst_qtableview.cpp
+++ b/tests/auto/qtableview/tst_qtableview.cpp
@@ -2540,6 +2540,7 @@ void tst_QTableView::span_data()
<< 2 << 1
<< false;
+ /* This makes no sens.
QTest::newRow("top left 2x0")
<< 10 << 10
<< -1 << -1
@@ -2554,7 +2555,7 @@ void tst_QTableView::span_data()
<< 0 << 0
<< 0 << 2
<< 0 << 2
- << false;
+ << false;*/
QTest::newRow("invalid 2x2")
<< 10 << 10
@@ -2628,7 +2629,7 @@ void tst_QTableView::span()
view.hideRow(hiddenRow);
view.hideColumn(hiddenColumn);
view.show();
-
+
QCOMPARE(view.rowSpan(row, column), expectedRowSpan);
QCOMPARE(view.columnSpan(row, column), expectedColumnSpan);
diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
index d2a2546..9364af4 100644
--- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -77,6 +77,7 @@ private slots:
void resize();
void openOnRootDrives();
void stressTest();
+ void rename();
public:
};
@@ -335,5 +336,30 @@ void tst_QTemporaryFile::stressTest()
}
}
+void tst_QTemporaryFile::rename()
+{
+ // This test checks that the temporary file is deleted, even after a
+ // rename.
+
+ QDir dir;
+ QVERIFY(!dir.exists("temporary-file.txt"));
+
+ QString tempname;
+ {
+ QTemporaryFile file(dir.filePath("temporary-file.XXXXXX"));
+
+ QVERIFY(file.open());
+ tempname = file.fileName();
+ QVERIFY(dir.exists(tempname));
+
+ QVERIFY(file.rename("temporary-file.txt"));
+ QVERIFY(!dir.exists(tempname));
+ QVERIFY(dir.exists("temporary-file.txt"));
+ }
+
+ QVERIFY(!dir.exists(tempname));
+ QVERIFY(!dir.exists("temporary-file.txt"));
+}
+
QTEST_MAIN(tst_QTemporaryFile)
#include "tst_qtemporaryfile.moc"
diff --git a/tests/auto/qtextobject/tst_qtextobject.cpp b/tests/auto/qtextobject/tst_qtextobject.cpp
index 4fbc155..4d1d4b2 100644
--- a/tests/auto/qtextobject/tst_qtextobject.cpp
+++ b/tests/auto/qtextobject/tst_qtextobject.cpp
@@ -62,6 +62,7 @@ public:
private slots:
void getSetCheck();
+ void testStandAloneTextObject();
};
tst_QTextObject::tst_QTextObject()
@@ -105,5 +106,23 @@ void tst_QTextObject::getSetCheck()
QCOMPARE(INT_MAX, obj2.userState());
}
+class TestTextObject : public QTextObject
+{
+public:
+ TestTextObject(QTextDocument *document) : QTextObject(document) {}
+};
+
+void tst_QTextObject::testStandAloneTextObject()
+{
+ QTextDocument document;
+ TestTextObject textObject(&document);
+
+ QCOMPARE(textObject.document(), &document);
+ // don't crash
+ textObject.format();
+ textObject.formatIndex();
+ QCOMPARE(textObject.objectIndex(), -1);
+}
+
QTEST_MAIN(tst_QTextObject)
#include "tst_qtextobject.moc"
diff --git a/tests/auto/qtextstream/tst_qtextstream.cpp b/tests/auto/qtextstream/tst_qtextstream.cpp
index a60433a..5a6cce8 100644
--- a/tests/auto/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/qtextstream/tst_qtextstream.cpp
@@ -60,6 +60,8 @@
#include <QTextCodec>
#include <QProcess>
+#include "../network-settings.h"
+
static const char *TestFileName = "testfile";
Q_DECLARE_METATYPE(qlonglong)
@@ -1229,7 +1231,7 @@ void tst_QTextStream::stillOpenWhenAtEnd()
QSKIP("Qt/CE: Cannot test network on emulator", SkipAll);
#endif
QTcpSocket socket;
- socket.connectToHost("imap.troll.no", 143);
+ socket.connectToHost(QtNetworkSettings::serverName(), 143);
QVERIFY(socket.waitForReadyRead(5000));
QTextStream stream2(&socket);
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 42f496a..9197144 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -343,6 +343,7 @@ private slots:
void paintOutsidePaintEvent();
#endif
void updateOnDestroyedSignal();
+ void toplevelLineEditFocus();
private:
bool ensureScreenSize(int width, int height);
@@ -1543,6 +1544,10 @@ void tst_QWidget::focusChainOnReparent()
QCOMPARE(w, expectedOriginalChain[i]);
w = w->nextInFocusChain();
}
+ for (int i = 7; i >= 0; --i) {
+ w = w->previousInFocusChain();
+ QCOMPARE(w, expectedOriginalChain[i]);
+ }
QWidget window2;
child2->setParent(&window2);
@@ -1553,6 +1558,10 @@ void tst_QWidget::focusChainOnReparent()
QCOMPARE(w, expectedNewChain[i]);
w = w->nextInFocusChain();
}
+ for (int i = 4; i >= 0; --i) {
+ w = w->previousInFocusChain();
+ QCOMPARE(w, expectedNewChain[i]);
+ }
QWidget *expectedOldChain[5] = {&window, child1, child3, child4, &window};
w = &window;
@@ -1560,6 +1569,10 @@ void tst_QWidget::focusChainOnReparent()
QCOMPARE(w, expectedOldChain[i]);
w = w->nextInFocusChain();
}
+ for (int i = 4; i >= 0; --i) {
+ w = w->previousInFocusChain();
+ QCOMPARE(w, expectedOldChain[i]);
+ }
}
@@ -8727,5 +8740,18 @@ void tst_QWidget::updateOnDestroyedSignal()
QTest::qWait(200);
}
+void tst_QWidget::toplevelLineEditFocus()
+{
+ testWidget->hide();
+
+ QLineEdit w;
+ w.show();
+ qt_x11_wait_for_window_manager(&w);
+ QTest::qWait(200);
+
+ QCOMPARE(QApplication::activeWindow(), &w);
+ QCOMPARE(QApplication::focusWidget(), &w);
+}
+
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"
diff --git a/tests/auto/selftests/alive/alive.pro b/tests/auto/selftests/alive/alive.pro
index 4a6b788..08cf358 100644
--- a/tests/auto/selftests/alive/alive.pro
+++ b/tests/auto/selftests/alive/alive.pro
@@ -5,3 +5,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = alive
diff --git a/tests/auto/selftests/assert/assert.pro b/tests/auto/selftests/assert/assert.pro
index 87513d4..0e48375 100644
--- a/tests/auto/selftests/assert/assert.pro
+++ b/tests/auto/selftests/assert/assert.pro
@@ -8,3 +8,4 @@ CONFIG -= debug_and_release_target
!win32:CONFIG += debug
+TARGET = assert
diff --git a/tests/auto/selftests/badxml/badxml.pro b/tests/auto/selftests/badxml/badxml.pro
index d0d4ddf..323791a 100644
--- a/tests/auto/selftests/badxml/badxml.pro
+++ b/tests/auto/selftests/badxml/badxml.pro
@@ -7,4 +7,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
!win32:CONFIG += debug
+TARGET = badxml
diff --git a/tests/auto/selftests/benchlibcallgrind/benchlibcallgrind.pro b/tests/auto/selftests/benchlibcallgrind/benchlibcallgrind.pro
index 34a43d0..c9ec7e2 100644
--- a/tests/auto/selftests/benchlibcallgrind/benchlibcallgrind.pro
+++ b/tests/auto/selftests/benchlibcallgrind/benchlibcallgrind.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = benchlibcallgrind
diff --git a/tests/auto/selftests/benchlibeventcounter/benchlibeventcounter.pro b/tests/auto/selftests/benchlibeventcounter/benchlibeventcounter.pro
index 41e090e..44b0295 100644
--- a/tests/auto/selftests/benchlibeventcounter/benchlibeventcounter.pro
+++ b/tests/auto/selftests/benchlibeventcounter/benchlibeventcounter.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = benchlibeventcounter
diff --git a/tests/auto/selftests/benchliboptions/benchliboptions.pro b/tests/auto/selftests/benchliboptions/benchliboptions.pro
index 2f02eef..4dee69f 100644
--- a/tests/auto/selftests/benchliboptions/benchliboptions.pro
+++ b/tests/auto/selftests/benchliboptions/benchliboptions.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = benchliboptions
diff --git a/tests/auto/selftests/benchlibtickcounter/benchlibtickcounter.pro b/tests/auto/selftests/benchlibtickcounter/benchlibtickcounter.pro
index 3d8cbfa..3621449 100644
--- a/tests/auto/selftests/benchlibtickcounter/benchlibtickcounter.pro
+++ b/tests/auto/selftests/benchlibtickcounter/benchlibtickcounter.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = benchlibtickcounter
diff --git a/tests/auto/selftests/benchlibwalltime/benchlibwalltime.pro b/tests/auto/selftests/benchlibwalltime/benchlibwalltime.pro
index 364e80b..f4694b5 100644
--- a/tests/auto/selftests/benchlibwalltime/benchlibwalltime.pro
+++ b/tests/auto/selftests/benchlibwalltime/benchlibwalltime.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = benchlibwalltime
diff --git a/tests/auto/selftests/cmptest/cmptest.pro b/tests/auto/selftests/cmptest/cmptest.pro
index c19a77a..8b2df1c 100644
--- a/tests/auto/selftests/cmptest/cmptest.pro
+++ b/tests/auto/selftests/cmptest/cmptest.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = cmptest
diff --git a/tests/auto/selftests/commandlinedata/commandlinedata.pro b/tests/auto/selftests/commandlinedata/commandlinedata.pro
index c900fc8..96bfa5b 100644
--- a/tests/auto/selftests/commandlinedata/commandlinedata.pro
+++ b/tests/auto/selftests/commandlinedata/commandlinedata.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = commandlinedata
diff --git a/tests/auto/selftests/crashes/crashes.pro b/tests/auto/selftests/crashes/crashes.pro
index 57eb4c7..7eec6ea 100644
--- a/tests/auto/selftests/crashes/crashes.pro
+++ b/tests/auto/selftests/crashes/crashes.pro
@@ -7,3 +7,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = crashes
diff --git a/tests/auto/selftests/datatable/datatable.pro b/tests/auto/selftests/datatable/datatable.pro
index 69aed7a..98f04d6 100644
--- a/tests/auto/selftests/datatable/datatable.pro
+++ b/tests/auto/selftests/datatable/datatable.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = datatable
diff --git a/tests/auto/selftests/datetime/datetime.pro b/tests/auto/selftests/datetime/datetime.pro
index 489e5cb..b015661 100644
--- a/tests/auto/selftests/datetime/datetime.pro
+++ b/tests/auto/selftests/datetime/datetime.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = datetime
diff --git a/tests/auto/selftests/differentexec/differentexec.pro b/tests/auto/selftests/differentexec/differentexec.pro
index e789649..c11b0d3 100644
--- a/tests/auto/selftests/differentexec/differentexec.pro
+++ b/tests/auto/selftests/differentexec/differentexec.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = differentexec
diff --git a/tests/auto/selftests/exception/exception.pro b/tests/auto/selftests/exception/exception.pro
index 14d8c7f..65705c6 100644
--- a/tests/auto/selftests/exception/exception.pro
+++ b/tests/auto/selftests/exception/exception.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = exception
diff --git a/tests/auto/selftests/expectfail/expectfail.pro b/tests/auto/selftests/expectfail/expectfail.pro
index c411199..97a3560 100644
--- a/tests/auto/selftests/expectfail/expectfail.pro
+++ b/tests/auto/selftests/expectfail/expectfail.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = expectfail
diff --git a/tests/auto/selftests/failinit/failinit.pro b/tests/auto/selftests/failinit/failinit.pro
index 729cf74..e3d54c8 100644
--- a/tests/auto/selftests/failinit/failinit.pro
+++ b/tests/auto/selftests/failinit/failinit.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = failinit
diff --git a/tests/auto/selftests/failinitdata/failinitdata.pro b/tests/auto/selftests/failinitdata/failinitdata.pro
index 6b48af1..1ff96f7 100644
--- a/tests/auto/selftests/failinitdata/failinitdata.pro
+++ b/tests/auto/selftests/failinitdata/failinitdata.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = failinitdata
diff --git a/tests/auto/selftests/fetchbogus/fetchbogus.pro b/tests/auto/selftests/fetchbogus/fetchbogus.pro
index badb636..3a5d13b 100644
--- a/tests/auto/selftests/fetchbogus/fetchbogus.pro
+++ b/tests/auto/selftests/fetchbogus/fetchbogus.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = fetchbogus
diff --git a/tests/auto/selftests/globaldata/globaldata.pro b/tests/auto/selftests/globaldata/globaldata.pro
index eb3b454..1bdcf07 100644
--- a/tests/auto/selftests/globaldata/globaldata.pro
+++ b/tests/auto/selftests/globaldata/globaldata.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = globaldata
diff --git a/tests/auto/selftests/maxwarnings/maxwarnings.pro b/tests/auto/selftests/maxwarnings/maxwarnings.pro
index b43affe..393a964 100644
--- a/tests/auto/selftests/maxwarnings/maxwarnings.pro
+++ b/tests/auto/selftests/maxwarnings/maxwarnings.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = maxwarnings
diff --git a/tests/auto/selftests/multiexec/multiexec.pro b/tests/auto/selftests/multiexec/multiexec.pro
index 723f56f..639b9b8 100644
--- a/tests/auto/selftests/multiexec/multiexec.pro
+++ b/tests/auto/selftests/multiexec/multiexec.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = multiexec
diff --git a/tests/auto/selftests/qexecstringlist/qexecstringlist.pro b/tests/auto/selftests/qexecstringlist/qexecstringlist.pro
index 27afcb2..73bdaca 100644
--- a/tests/auto/selftests/qexecstringlist/qexecstringlist.pro
+++ b/tests/auto/selftests/qexecstringlist/qexecstringlist.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = qexecstringlist
diff --git a/tests/auto/selftests/singleskip/singleskip.pro b/tests/auto/selftests/singleskip/singleskip.pro
index 0d66f68..9762c97 100644
--- a/tests/auto/selftests/singleskip/singleskip.pro
+++ b/tests/auto/selftests/singleskip/singleskip.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = singleskip
diff --git a/tests/auto/selftests/skip/skip.pro b/tests/auto/selftests/skip/skip.pro
index 545a579..989fdeb 100644
--- a/tests/auto/selftests/skip/skip.pro
+++ b/tests/auto/selftests/skip/skip.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = skip
diff --git a/tests/auto/selftests/skipglobal/skipglobal.pro b/tests/auto/selftests/skipglobal/skipglobal.pro
index 97553c6..0205a88 100644
--- a/tests/auto/selftests/skipglobal/skipglobal.pro
+++ b/tests/auto/selftests/skipglobal/skipglobal.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = skipglobal
diff --git a/tests/auto/selftests/skipinit/skipinit.pro b/tests/auto/selftests/skipinit/skipinit.pro
index d8ee13e..6912183 100644
--- a/tests/auto/selftests/skipinit/skipinit.pro
+++ b/tests/auto/selftests/skipinit/skipinit.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = skipinit
diff --git a/tests/auto/selftests/skipinitdata/skipinitdata.pro b/tests/auto/selftests/skipinitdata/skipinitdata.pro
index 8da653e..206ed11 100644
--- a/tests/auto/selftests/skipinitdata/skipinitdata.pro
+++ b/tests/auto/selftests/skipinitdata/skipinitdata.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = skipinitdata
diff --git a/tests/auto/selftests/sleep/sleep.pro b/tests/auto/selftests/sleep/sleep.pro
index 7b28ccc..0bd3225 100644
--- a/tests/auto/selftests/sleep/sleep.pro
+++ b/tests/auto/selftests/sleep/sleep.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = sleep
diff --git a/tests/auto/selftests/strcmp/strcmp.pro b/tests/auto/selftests/strcmp/strcmp.pro
index 489211c..3121c25 100644
--- a/tests/auto/selftests/strcmp/strcmp.pro
+++ b/tests/auto/selftests/strcmp/strcmp.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = strcmp
diff --git a/tests/auto/selftests/subtest/subtest.pro b/tests/auto/selftests/subtest/subtest.pro
index 4d258ee..fe3cafa 100644
--- a/tests/auto/selftests/subtest/subtest.pro
+++ b/tests/auto/selftests/subtest/subtest.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = subtest
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index fcfc625..aa1048b 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -198,7 +198,7 @@ void tst_Selftests::doRunSubTest(QString &subdir, QStringList &arguments )
{
QProcess proc;
proc.setEnvironment(QStringList(""));
- proc.start(subdir + "/tst_" + subdir, arguments);
+ proc.start(subdir + "/" + subdir, arguments);
QVERIFY2(proc.waitForFinished(), qPrintable(proc.errorString()));
const QByteArray out(proc.readAllStandardOutput());
@@ -329,7 +329,7 @@ void tst_Selftests::checkXML() const
QProcess proc;
proc.setEnvironment(QStringList(""));
- proc.start(subdir + "/tst_" + subdir, arguments);
+ proc.start(subdir + "/" + subdir, arguments);
QVERIFY(proc.waitForFinished());
QByteArray out(proc.readAllStandardOutput());
@@ -367,7 +367,7 @@ void tst_Selftests::checkXunitxml() const
QProcess proc;
proc.setEnvironment(QStringList(""));
- proc.start(subdir + "/tst_" + subdir, arguments);
+ proc.start(subdir + "/" + subdir, arguments);
QVERIFY(proc.waitForFinished());
QByteArray out(proc.readAllStandardOutput());
diff --git a/tests/auto/selftests/updateBaselines.sh b/tests/auto/selftests/updateBaselines.sh
deleted file mode 100755
index a0f22e6..0000000
--- a/tests/auto/selftests/updateBaselines.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-# Be *really* sure that your fix is right, before running this script.
-
-tests=" \
- cmptest \
- cmptest \
- cmptest \
- datatable \
- datetime \
- expectfail \
- expectfail \
- globaldata \
- globaldata \
- maxwarnings \
- multiexec \
- singleskip \
- qexecstringlist \
- differentexec \
- skip \
- skip \
- skipglobal \
- sleep \
- strcmp \
- subtest \
- warnings"
-
-for test in $tests; do
- echo "Updating $test"
- cd $test
- baseline="../expected_"$test".txt"
- p4 edit $baseline
- ./tst_$test > ../expected_"$test".txt
- p4 revert -a $baseline
- cd ..
-done
diff --git a/tests/auto/selftests/waitwithoutgui/waitwithoutgui.pro b/tests/auto/selftests/waitwithoutgui/waitwithoutgui.pro
index 8cdf7cc..cf3098d 100644
--- a/tests/auto/selftests/waitwithoutgui/waitwithoutgui.pro
+++ b/tests/auto/selftests/waitwithoutgui/waitwithoutgui.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = waitwithoutgui
diff --git a/tests/auto/selftests/warnings/warnings.pro b/tests/auto/selftests/warnings/warnings.pro
index 9ae22d3..eaf06b4 100644
--- a/tests/auto/selftests/warnings/warnings.pro
+++ b/tests/auto/selftests/warnings/warnings.pro
@@ -6,3 +6,4 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
+TARGET = warnings
diff --git a/tests/auto/selftests/xunit/xunit.pro b/tests/auto/selftests/xunit/xunit.pro
index eb98c2a..81ca157 100644
--- a/tests/auto/selftests/xunit/xunit.pro
+++ b/tests/auto/selftests/xunit/xunit.pro
@@ -10,3 +10,6 @@ wince*: {
contains(QT_CONFIG, qt3support): QT += qt3support
DEFINES += SRCDIR=\\\"$$PWD\\\"
}
+
+TARGET = xunit
+
diff --git a/tests/auto/uiloader/baseline/css_splitter.ui b/tests/auto/uiloader/baseline/css_splitter.ui
new file mode 100644
index 0000000..99dbc18
--- /dev/null
+++ b/tests/auto/uiloader/baseline/css_splitter.ui
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>424</width>
+ <height>364</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"> QSplitter::handle:vertical {
+ image: url(images/splitter_horizontal.png);
+ }
+
+ QSplitter::handle:horizontal {
+ image: url(images/splitter_vertical.png);
+ }
+
+#big_splitter::handle { background-color: blue; border: 3px dashed green; height:50px; }
+
+
+ QSplitter::handle:hover {
+ background-color: qlineargradient(spread:repeat, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 0, 255), stop:0.17 rgba(255, 0, 0, 255), stop:0.18 rgba(255, 255, 255, 255), stop:0.210212 rgba(255, 255, 255, 255), stop:0.220212 rgba(0, 16, 255, 255), stop:0.279897 rgba(0, 16, 255, 255), stop:0.289897 rgba(255, 255, 255, 255), stop:0.32 rgba(255, 255, 255, 255), stop:0.33 rgba(255, 0, 0, 255), stop:1 rgba(255, 0, 0, 255))
+ }
+
+ QSplitter::handle:pressed {
+ background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(9, 41, 4, 255), stop:0.085 rgba(2, 79, 0, 255), stop:0.19 rgba(50, 147, 22, 255), stop:0.275 rgba(236, 191, 49, 255), stop:0.39 rgba(243, 61, 34, 255), stop:0.555 rgba(135, 81, 60, 255), stop:0.667 rgba(121, 75, 255, 255), stop:0.825 rgba(164, 255, 244, 255), stop:0.885 rgba(104, 222, 71, 255), stop:1 rgba(93, 128, 0, 255));
+ }</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QSplitter" name="splitter_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="QSplitter" name="big_splitter">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <widget class="QTextEdit" name="textEdit"/>
+ <widget class="QTextEdit" name="textEdit_5"/>
+ <widget class="QTextEdit" name="textEdit_4"/>
+ </widget>
+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <widget class="QTextEdit" name="textEdit_2"/>
+ <widget class="QTextEdit" name="textEdit_3"/>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>