summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJanne Koskinen <janne.p.koskinen@digia.com>2009-12-23 13:34:35 (GMT)
committerJanne Koskinen <janne.p.koskinen@digia.com>2009-12-23 13:34:35 (GMT)
commitc0a4c266deeb867069b65b158ded3f7b9becfebf (patch)
tree3641277e204e22b0490f8d03f19b158c7e81cf96 /tests
parent01cf310d21b17d8f57911ae194eaa0ca2472d155 (diff)
parent5f7b681661d8067b3fd954f04b7a25d833f5c92a (diff)
downloadQt-c0a4c266deeb867069b65b158ded3f7b9becfebf.zip
Qt-c0a4c266deeb867069b65b158ded3f7b9becfebf.tar.gz
Qt-c0a4c266deeb867069b65b158ded3f7b9becfebf.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qhostinfo/tst_qhostinfo.cpp49
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp10
-rw-r--r--tests/auto/qresourceengine/tst_qresourceengine.cpp22
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp37
4 files changed, 95 insertions, 23 deletions
diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp
index 4d63e10..348c41b 100644
--- a/tests/auto/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp
@@ -88,6 +88,7 @@
#endif
#include "../network-settings.h"
+#include "../../shared/util.h"
//TESTED_CLASS=
//TESTED_FILES=
@@ -124,6 +125,9 @@ private slots:
void raceCondition();
void threadSafety();
+ void multipleSameLookups();
+ void multipleDifferentLookups();
+
protected slots:
void resultsReady(const QHostInfo &);
@@ -131,6 +135,7 @@ private:
bool ipv6LookupsAvailable;
bool ipv6Available;
bool lookupDone;
+ int lookupsDoneCounter;
QHostInfo lookupResults;
};
@@ -411,11 +416,53 @@ void tst_QHostInfo::threadSafety()
}
}
+// this test is for the multi-threaded QHostInfo rewrite. It is about getting results at all,
+// not about getting correct IPs
+void tst_QHostInfo::multipleSameLookups()
+{
+ const int COUNT = 10;
+ lookupsDoneCounter = 0;
+
+ for (int i = 0; i < COUNT; i++)
+ QHostInfo::lookupHost("localhost", this, SLOT(resultsReady(const QHostInfo)));
+
+ QTRY_VERIFY(lookupsDoneCounter == COUNT);
+
+ // spin two seconds more to see if it is not more :)
+ QTestEventLoop::instance().enterLoop(2);
+ QTRY_VERIFY(lookupsDoneCounter == COUNT);
+}
+
+// this test is for the multi-threaded QHostInfo rewrite. It is about getting results at all,
+// not about getting correct IPs
+void tst_QHostInfo::multipleDifferentLookups()
+{
+ QStringList hostnameList;
+ hostnameList << "www.ovi.com" << "www.nokia.com" << "qt.nokia.com" << "www.trolltech.com" << "troll.no"
+ << "www.qtcentre.org" << "forum.nokia.com" << "www.forum.nokia.com" << "wiki.forum.nokia.com"
+ << "www.nokia.no" << "nokia.de" << "127.0.0.1" << "----";
+
+ const int COUNT = hostnameList.size();
+ lookupsDoneCounter = 0;
+
+ for (int i = 0; i < hostnameList.size(); i++)
+ QHostInfo::lookupHost(hostnameList.at(i), this, SLOT(resultsReady(const QHostInfo)));
+
+ // give some time
+ QTestEventLoop::instance().enterLoop(5);
+ // try_verify gives some more time
+ QTRY_VERIFY(lookupsDoneCounter == COUNT);
+
+ // spin two seconds more to see if it is not more than expected
+ QTestEventLoop::instance().enterLoop(2);
+ QTRY_VERIFY(lookupsDoneCounter == COUNT);
+}
+
void tst_QHostInfo::resultsReady(const QHostInfo &hi)
{
lookupDone = true;
lookupResults = hi;
-
+ lookupsDoneCounter++;
QTestEventLoop::instance().exitLoop();
}
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 15b1c1c..630cc03 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -322,7 +322,15 @@ void tst_QImageReader::setScaledSize_data()
QTest::newRow("PPM: test") << "test.ppm" << QSize(10, 10) << QByteArray("ppm");
QTest::newRow("XBM: gnus") << "gnus" << QSize(200, 200) << QByteArray("xbm");
#ifdef QTEST_HAVE_JPEG
- QTest::newRow("JPEG: beavis") << "beavis" << QSize(200, 200) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis A") << "beavis" << QSize(200, 200) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis B") << "beavis" << QSize(175, 175) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis C") << "beavis" << QSize(100, 100) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis D") << "beavis" << QSize(100, 200) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis E") << "beavis" << QSize(200, 100) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis F") << "beavis" << QSize(87, 87) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis G") << "beavis" << QSize(50, 45) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis H") << "beavis" << QSize(43, 43) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis I") << "beavis" << QSize(25, 25) << QByteArray("jpeg");
#endif // QTEST_HAVE_JPEG
#ifdef QTEST_HAVE_GIF
QTest::newRow("GIF: earth") << "earth" << QSize(200, 200) << QByteArray("gif");
diff --git a/tests/auto/qresourceengine/tst_qresourceengine.cpp b/tests/auto/qresourceengine/tst_qresourceengine.cpp
index cc6eda3..ed7de23 100644
--- a/tests/auto/qresourceengine/tst_qresourceengine.cpp
+++ b/tests/auto/qresourceengine/tst_qresourceengine.cpp
@@ -62,6 +62,7 @@ private slots:
void searchPath_data();
void searchPath();
void doubleSlashInRoot();
+ void setLocale();
private:
QString builddir;
@@ -460,6 +461,27 @@ void tst_QResourceEngine::doubleSlashInRoot()
QVERIFY(QFile::exists("://secondary_root/runtime_resource/search_file.txt"));
}
+void tst_QResourceEngine::setLocale()
+{
+ QLocale::setDefault(QLocale::c());
+
+ // default constructed QResource gets the default locale
+ QResource resource;
+ resource.setFileName("aliasdir/aliasdir.txt");
+ QVERIFY(!resource.isCompressed());
+
+ // change the default locale and make sure it doesn't affect the resource
+ QLocale::setDefault(QLocale("de_CH"));
+ QVERIFY(!resource.isCompressed());
+
+ // then explicitly set the locale on qresource
+ resource.setLocale(QLocale("de_CH"));
+ QVERIFY(resource.isCompressed());
+
+ // the reset the default locale back
+ QLocale::setDefault(QLocale::system());
+}
+
QTEST_MAIN(tst_QResourceEngine)
#include "tst_qresourceengine.moc"
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index 13cb3be..1d39c67 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -903,12 +903,8 @@ void tst_QSqlDatabase::recordOCI()
CHECK_DATABASE(db);
// runtime check for Oracle version since V8 doesn't support TIMESTAMPs
- if (tst_Databases::getOraVersion(db) >= 9) {
- qDebug("Detected Oracle >= 9, TIMESTAMP test enabled");
- hasTimeStamp = true;
- } else {
- qDebug("Detected Oracle < 9, TIMESTAMP test disabled");
- }
+ if (tst_Databases::getOraVersion(db) >= 9)
+ hasTimeStamp = true;
FieldDef tsdef;
FieldDef tstzdef;
@@ -919,11 +915,11 @@ void tst_QSqlDatabase::recordOCI()
static const QDateTime dt(QDate::currentDate(), QTime(1, 2, 3, 0));
if (hasTimeStamp) {
- tsdef = FieldDef("timestamp", QVariant::DateTime, dt);
- tstzdef = FieldDef("timestamp with time zone", QVariant::DateTime, dt);
- tsltzdef = FieldDef("timestamp with local time zone", QVariant::DateTime, dt);
- intytm = FieldDef("interval year to month", QVariant::String, QString("+01-01"));
- intdts = FieldDef("interval day to second", QVariant::String, QString("+01 00:00:01.000000"));
+ tsdef = FieldDef("timestamp", QVariant::DateTime, dt);
+ tstzdef = FieldDef("timestamp with time zone", QVariant::DateTime, dt);
+ tsltzdef = FieldDef("timestamp with local time zone", QVariant::DateTime, dt);
+ intytm = FieldDef("interval year to month", QVariant::String, QString("+01-01"));
+ intdts = FieldDef("interval day to second", QVariant::String, QString("+01 00:00:01.000000"));
}
const FieldDef fieldDefs[] = {
@@ -938,14 +934,14 @@ void tst_QSqlDatabase::recordOCI()
FieldDef("blob", QVariant::ByteArray, QByteArray("blah7")),
FieldDef("clob", QVariant::String, QString("blah8")),
FieldDef("nclob", QVariant::String, QString("blah9")),
- FieldDef("bfile", QVariant::ByteArray, QByteArray("blah10")),
+// FieldDef("bfile", QVariant::ByteArray, QByteArray("blah10")),
- intytm,
-// intdts,
-// tsdef,
-// tstzdef,
-// tsltzdef,
- FieldDef()
+ intytm,
+ intdts,
+ tsdef,
+ tstzdef,
+ tsltzdef,
+ FieldDef()
};
const int fieldCount = createFieldTable(fieldDefs, db);
@@ -953,9 +949,8 @@ void tst_QSqlDatabase::recordOCI()
commonFieldTest(fieldDefs, db, fieldCount);
checkNullValues(fieldDefs, db);
- for (int i = 0; i < ITERATION_COUNT; ++i) {
- checkValues(fieldDefs, db);
- }
+ for (int i = 0; i < ITERATION_COUNT; ++i)
+ checkValues(fieldDefs, db);
// some additional tests
QSqlRecord rec = db.record(qTableName("qtestfields"));