summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-01-20 01:16:33 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-01-20 01:16:33 (GMT)
commita7506ce64ae9e80a202e0ffdaa86785d1d117c78 (patch)
treecd88679a8c075ad59b2a26d2661a632d00074f64 /tests
parent91a2da396fb476401e3b2c55ca7672a8b462ceca (diff)
parent810074e299f7b2826fbfb8b224082f455eab94e5 (diff)
downloadQt-a7506ce64ae9e80a202e0ffdaa86785d1d117c78.zip
Qt-a7506ce64ae9e80a202e0ffdaa86785d1d117c78.tar.gz
Qt-a7506ce64ae9e80a202e0ffdaa86785d1d117c78.tar.bz2
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/shared/testhttpserver.cpp16
-rw-r--r--tests/auto/declarative/shared/testhttpserver.h4
2 files changed, 19 insertions, 1 deletions
diff --git a/tests/auto/declarative/shared/testhttpserver.cpp b/tests/auto/declarative/shared/testhttpserver.cpp
index 215f3c3..6c9d849 100644
--- a/tests/auto/declarative/shared/testhttpserver.cpp
+++ b/tests/auto/declarative/shared/testhttpserver.cpp
@@ -106,6 +106,15 @@ bool TestHTTPServer::serveDirectory(const QString &dir, Mode mode)
return true;
}
+/*
+ Add an alias, so that if filename is requested and does not exist,
+ alias may be returned.
+*/
+void TestHTTPServer::addAlias(const QString &filename, const QString &alias)
+{
+ aliases.insert(filename, alias);
+}
+
bool TestHTTPServer::wait(const QUrl &expect, const QUrl &reply, const QUrl &body)
{
m_hasFailed = false;
@@ -226,7 +235,12 @@ bool TestHTTPServer::reply(QTcpSocket *socket, const QByteArray &fileName)
Mode mode = dirs.at(ii).second;
QString dirFile = dir + QLatin1String("/") + QLatin1String(fileName);
-
+
+ if (!QFile::exists(dirFile)) {
+ if (aliases.contains(fileName))
+ dirFile = dir + QLatin1String("/") + aliases.value(fileName);
+ }
+
QFile file(dirFile);
if (file.open(QIODevice::ReadOnly)) {
diff --git a/tests/auto/declarative/shared/testhttpserver.h b/tests/auto/declarative/shared/testhttpserver.h
index 62fe7b4..2a8709f 100644
--- a/tests/auto/declarative/shared/testhttpserver.h
+++ b/tests/auto/declarative/shared/testhttpserver.h
@@ -61,6 +61,8 @@ public:
bool wait(const QUrl &expect, const QUrl &reply, const QUrl &body);
bool hasFailed() const;
+ void addAlias(const QString &filename, const QString &aliasName);
+
private slots:
void newConnection();
void disconnected();
@@ -80,6 +82,8 @@ private:
QByteArray bodyData;
bool m_hasFailed;
+ QHash<QString,QString> aliases;
+
QTcpServer server;
};