summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-08-03 11:33:34 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-08-03 11:33:34 (GMT)
commit5e05bafa229b645bf30a90975bfc57e458e081e5 (patch)
tree54606401f955891574cbcc589ae2558cb2a5b748 /tests/auto
parent128717b171f01c82e5f0fb83f5923d4f7b9cfc10 (diff)
parent463df7e4a6dc7c11716e27ca5de9ebeb61940990 (diff)
downloadQt-5e05bafa229b645bf30a90975bfc57e458e081e5.zip
Qt-5e05bafa229b645bf30a90975bfc57e458e081e5.tar.gz
Qt-5e05bafa229b645bf30a90975bfc57e458e081e5.tar.bz2
Merge branch '4.5'
Conflicts: src/corelib/tools/qsharedpointer.cpp src/corelib/tools/qsharedpointer_impl.h src/gui/dialogs/qcolordialog.cpp src/gui/painting/qwindowsurface_raster.cpp src/network/access/qnetworkaccessmanager.cpp tests/auto/qsharedpointer/externaltests.cpp
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/moc/os9-newlines.h2
-rw-r--r--tests/auto/q3socket/tst_qsocket.cpp14
-rw-r--r--tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp6
-rw-r--r--tests/auto/q3urloperator/tst_q3urloperator.cpp12
-rw-r--r--tests/auto/qlocale/tst_qlocale.cpp16
-rw-r--r--tests/auto/qmake/testdata/simple_app_build/README1
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp2
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp4
-rw-r--r--tests/auto/selftests/tst_selftests.cpp7
-rw-r--r--tests/auto/uic3/uic3.pro3
10 files changed, 42 insertions, 25 deletions
diff --git a/tests/auto/moc/os9-newlines.h b/tests/auto/moc/os9-newlines.h
index fb9bbe4..85fa671 100644
--- a/tests/auto/moc/os9-newlines.h
+++ b/tests/auto/moc/os9-newlines.h
@@ -1 +1 @@
-/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the test suite of the Qt Toolkit. ** ** $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 http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <QObject> class Os9Newlines : public QObject { Q_OBJECT public Q_SLOTS: inline void testSlot() {} };
+/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the test suite of the Qt Toolkit. ** ** $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 http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <QObject> class Os9Newlines : public QObject { Q_OBJECT public Q_SLOTS: inline void testSlot() {} }; \ No newline at end of file
diff --git a/tests/auto/q3socket/tst_qsocket.cpp b/tests/auto/q3socket/tst_qsocket.cpp
index b07fa2f..854cc75 100644
--- a/tests/auto/q3socket/tst_qsocket.cpp
+++ b/tests/auto/q3socket/tst_qsocket.cpp
@@ -124,8 +124,10 @@ void tst_Q3Socket::peerAddress_data()
QTest::addColumn<bool>("peerClosesConnection");
QTest::addColumn<QString>("peerAddr");
- QTest::newRow( "echo" ) << QString("qt-test-server.troll.no") << (uint)7 << false << QString("10.3.3.69");
- QTest::newRow( "daytime" ) << QString("qt-test-server.troll.no") << (uint)13 << true << QString("10.3.3.69");
+ QTest::newRow( "echo" ) << QtNetworkSettings::serverLocalName() << (uint)7 << false
+ << QtNetworkSettings::serverIP().toString();
+ QTest::newRow( "daytime" ) << QtNetworkSettings::serverLocalName() << (uint)13 << true
+ << QtNetworkSettings::serverIP().toString();
}
void tst_Q3Socket::peerAddress()
@@ -191,7 +193,7 @@ void tst_Q3Socket::emitConnectionRefused()
{
Q3Socket sock;
connect( &sock, SIGNAL(error(int)), SLOT(emitConnectionRefused_error(int)) );
- sock.connectToHost( "ares.troll.no", 12331 );
+ sock.connectToHost( QtNetworkSettings::serverLocalName(), 12331 );
emitConnectionRefused_errorReceived = false;
QTestEventLoop::instance().enterLoop( 30 );
@@ -225,8 +227,8 @@ void tst_Q3Socket::connectionAttempts_data()
QTest::addColumn<int>("port");
QTest::addColumn<bool>("expectedResult");
- QTest::newRow("fluke port 80") << QString("qt-test-server.troll.no") << 80 << true;
- QTest::newRow("fluke port 79") << QString("qt-test-server.troll.no") << 79 << false;
+ QTest::newRow("fluke port 80") << QtNetworkSettings::serverLocalName() << 80 << true;
+ QTest::newRow("fluke port 79") << QtNetworkSettings::serverLocalName() << 79 << false;
}
void tst_Q3Socket::connectionAttempts()
@@ -266,7 +268,7 @@ void tst_Q3Socket::canReadLine()
connect(&socket, SIGNAL(connected()), &loop, SLOT(quit()));
// timeout error will fail in #238
connect(&socket, SIGNAL(error(int)), &loop, SLOT(quit()));
- socket.connectToHost("qt-test-server.troll.no", 143);
+ socket.connectToHost(QtNetworkSettings::serverLocalName(), 143);
loop.exec();
diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
index e4b1a55..e5a9b01 100644
--- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
+++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
@@ -548,7 +548,7 @@ void tst_Q3SqlCursor::unicode()
else
QFAIL( QString( "Strings differ at position %1: orig: %2, db: %3" ).arg( i ).arg( utf8str[ i ].unicode(), 0, 16 ).arg( res[ i ].unicode(), 0, 16 ) );
}
- if(db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QDB2"))
+ if((db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QDB2")) && res != utf8str)
QEXPECT_FAIL("", "See above message", Continue);
QVERIFY( res == utf8str );
}
@@ -721,7 +721,9 @@ void tst_Q3SqlCursor::updateNoPK()
// Sqlite returns 2, don't ask why.
QVERIFY(cur.update() != 0);
QString expect = "update " + qTableName("qtestPK") +
- " set id = 1 , name = NULL , num = NULL where " + qTableName("qtestPK") + ".id"
+ " set "+db.driver()->escapeIdentifier("id", QSqlDriver::FieldName)+" = 1 , "
+ +db.driver()->escapeIdentifier("name", QSqlDriver::FieldName)+" = NULL , "
+ +db.driver()->escapeIdentifier("num", QSqlDriver::FieldName)+" = NULL where " + qTableName("qtestPK") + ".id"
" IS NULL and " + qTableName("qtestPK") + ".name IS NULL and " +
qTableName("qtestPK") + ".num IS NULL";
if (!db.driver()->hasFeature(QSqlDriver::PreparedQueries)) {
diff --git a/tests/auto/q3urloperator/tst_q3urloperator.cpp b/tests/auto/q3urloperator/tst_q3urloperator.cpp
index f1e1059..a9e5096 100644
--- a/tests/auto/q3urloperator/tst_q3urloperator.cpp
+++ b/tests/auto/q3urloperator/tst_q3urloperator.cpp
@@ -55,6 +55,8 @@
#include <q3valuelist.h>
#include <qlist.h>
+#include "../network-settings.h"
+
//TESTED_CLASS=
//TESTED_FILES=
@@ -150,7 +152,7 @@ void tst_Q3UrlOperator::initTestCase()
// prepare: make sure that there is a unique directory for FTP upload
// testing (to avoid parallel executed tests interfere with each other)
- ftpQtestUpload = "ftp://qt-test-server.troll.no/";
+ ftpQtestUpload = QString("ftp://%1/").arg(QtNetworkSettings::serverLocalName());
QString dir = QString( "qtest/upload/%1" ).arg( (ulong)this );
Q3UrlOperator opMkdir( ftpQtestUpload );
@@ -218,8 +220,8 @@ void tst_Q3UrlOperator::cleanup()
void tst_Q3UrlOperator::copy_data()
{
- const QString ftpQtest( "ftp://qt-test-server.troll.no/qtest" );
- const QString httpQtest( "http://qt-test-server.troll.no/qtest" );
+ const QString ftpQtest( QString("ftp://%1/qtest").arg(QtNetworkSettings::serverLocalName()) );
+ const QString httpQtest( QString("http://%1/qtest").arg(QtNetworkSettings::serverLocalName()) );
// argument for the constructor
QTest::addColumn<QString>("url");
@@ -339,8 +341,8 @@ void tst_Q3UrlOperator::slotFinished_copy( Q3NetworkOperation *op )
void tst_Q3UrlOperator::put_data()
{
- const QString httpQtest( "http://qt-test-server.troll.no/qtest/cgi-bin" );
- const QString httpQtestGet( "http://qt-test-server.troll.no/qtest/cgi-bin/retrieve_testfile.cgi" );
+ const QString httpQtest( QString("http://%1/qtest/cgi-bin").arg(QtNetworkSettings::serverLocalName()) );
+ const QString httpQtestGet( QString("http://%1/qtest/cgi-bin/retrieve_testfile.cgi").arg(QtNetworkSettings::serverLocalName()) );
QByteArray putData_1( 5 );
putData_1[0] = 'a';
diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp
index 9ef7f1d..9a5c549 100644
--- a/tests/auto/qlocale/tst_qlocale.cpp
+++ b/tests/auto/qlocale/tst_qlocale.cpp
@@ -327,9 +327,8 @@ void tst_QLocale::emptyCtor()
{ \
/* Test constructor without arguments. Needs separate process */ \
/* because of caching of the system locale. */ \
- QString oldEnv = QString::fromLocal8Bit(qgetenv("LANG")); \
- qputenv("LANG", QString(req_lc).toLocal8Bit()); \
QProcess process; \
+ process.setEnvironment(QStringList(env) << QString("LANG=%1").arg(req_lc)); \
process.start("syslocaleapp/syslocaleapp"); \
process.waitForReadyRead(); \
QString ret = QString(process.readAll()); \
@@ -337,18 +336,23 @@ void tst_QLocale::emptyCtor()
QVERIFY2(!ret.isEmpty(), "Cannot launch external process"); \
QVERIFY2(QString(exp_str) == ret, QString("Expected: " + QString(exp_str) + ", got: " \
+ ret + ". Requested: " + QString(req_lc)).toLatin1().constData()); \
- qputenv("LANG", oldEnv.toLocal8Bit()); \
+ }
+
+ // Get an environment free of any locale-related variables
+ QStringList env;
+ foreach (QString const& entry, QProcess::systemEnvironment()) {
+ if (entry.startsWith("LANG=") || entry.startsWith("LC_"))
+ continue;
+ env << entry;
}
// Get default locale.
- QString old = QString::fromLocal8Bit(qgetenv("LANG"));
- qputenv("LANG", "");
QProcess p;
+ p.setEnvironment(env);
p.start("syslocaleapp/syslocaleapp");
p.waitForReadyRead();
QString defaultLoc = QString(p.readAll());
p.waitForFinished();
- qputenv("LANG", old.toLocal8Bit());
TEST_CTOR("C", "C")
TEST_CTOR("bla", "C")
diff --git a/tests/auto/qmake/testdata/simple_app_build/README b/tests/auto/qmake/testdata/simple_app_build/README
new file mode 100644
index 0000000..81dc596
--- /dev/null
+++ b/tests/auto/qmake/testdata/simple_app_build/README
@@ -0,0 +1 @@
+Placeholder file to ensure this directory exists
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
index ae5155e..e001eab 100644
--- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
@@ -1195,6 +1195,7 @@ void tst_QSharedPointer::invalidConstructs_data()
"QSharedPointer<Data> b;\n"
"if (a + b) return;";
+#if QT_VERSION >= 0x040600
// two objects with the same pointer
QTest::newRow("same-pointer")
<< &QTest::QExternalTest::tryRunFail
@@ -1208,6 +1209,7 @@ void tst_QSharedPointer::invalidConstructs_data()
<< "Data *aData = new Data;\n"
"QSharedPointer<Data> ptr1 = QSharedPointer<Data>(aData);"
"ptr1 = QSharedPointer<Data>(aData);";
+#endif
// any type of cast for unrelated types:
// (we have no reinterpret_cast)
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index e1f1d3c..4cf8d56 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -2028,8 +2028,8 @@ void tst_QSqlDatabase::mysql_multiselect()
QVERIFY_SQL(q, exec("select version()"));
QVERIFY_SQL(q, next());
QString version=tst_Databases::getMySqlVersion( db );
- int ver=version.section(QChar::fromLatin1('.'),0,1).toDouble();
- if (ver >= 4.1)
+ double ver=version.section(QChar::fromLatin1('.'),0,1).toDouble();
+ if (ver < 4.1)
QSKIP("Test requires MySQL >= 4.1", SkipSingle);
QVERIFY_SQL(q, exec("SELECT * FROM " + qTableName("qtest") + "; SELECT * FROM " + qTableName("qtest")));
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index 69b84e2..76a005b 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -184,9 +184,10 @@ void tst_Selftests::runSubTest_data()
QTest::newRow("benchliboptions") << "benchliboptions" << QStringList("-eventcounter");
QTest::newRow("benchlibwalltime") << "benchlibwalltime" << QStringList();
- //### QWS tests are currently run on a virtual machine, where ticks are not
- //### monotonously increasing
-#if defined(HAVE_TICK_COUNTER) && !defined(Q_WS_QWS)
+ //### This test is affected by the speed of the CPU and whether the tick counter is
+ //### monotonically increasing. It won't work on some machines so leave it off by default.
+ //### Feel free to uncomment for your own testing.
+#if 0
QTest::newRow("benchlibtickcounter") << "benchlibtickcounter" << QStringList("-tickcounter");
#endif
diff --git a/tests/auto/uic3/uic3.pro b/tests/auto/uic3/uic3.pro
index 520f95a..72a1304 100644
--- a/tests/auto/uic3/uic3.pro
+++ b/tests/auto/uic3/uic3.pro
@@ -6,3 +6,6 @@ TARGET = tst_uic3
# This test is not run on wince (I think)
DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+requires(contains(QT_CONFIG,qt3support))
+