diff options
16 files changed, 360 insertions, 193 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index be99b3b..185d8e5 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -205,6 +205,7 @@ void QUnifiedTimer::updateAnimationsTime() QAbstractAnimation *animation = animations.at(currentAnimationIdx); int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime + (animation->direction() == QAbstractAnimation::Forward ? delta : -delta); + //qWarning() << "SCT" << elapsed; animation->setCurrentTime(elapsed); } currentAnimationIdx = 0; @@ -229,7 +230,9 @@ void QUnifiedTimer::restartAnimationTimer() void QUnifiedTimer::timerEvent(QTimerEvent *event) { - if (event->timerId() == startStopAnimationTimer.timerId()) { + if ((consistentTiming && startStopAnimationTimer.isActive()) || + (event->timerId() == startStopAnimationTimer.timerId())) { + //qWarning() << "A SSAT"; startStopAnimationTimer.stop(); //we transfer the waiting animations into the "really running" state @@ -247,8 +250,11 @@ void QUnifiedTimer::timerEvent(QTimerEvent *event) time.start(); } } - } else if (event->timerId() == animationTimer.timerId()) { + } + + if (event->timerId() == animationTimer.timerId()) { // update current time on all top level animations + //qWarning() << "A AT"; updateAnimationsTime(); restartAnimationTimer(); } @@ -261,8 +267,10 @@ void QUnifiedTimer::registerAnimation(QAbstractAnimation *animation, bool isTopL Q_ASSERT(!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer); QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer = true; animationsToStart << animation; - if (!startStopAnimationTimer.isActive()) + if (!startStopAnimationTimer.isActive()) { + //qWarning("Starting SSAT 1"); startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, this); + } } } @@ -280,8 +288,10 @@ void QUnifiedTimer::unregisterAnimation(QAbstractAnimation *animation) if (idx <= currentAnimationIdx) --currentAnimationIdx; - if (animations.isEmpty() && !startStopAnimationTimer.isActive()) + if (animations.isEmpty() && !startStopAnimationTimer.isActive()) { + //qWarning("Starting SSAT 2"); startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, this); + } } else { animationsToStart.removeOne(animation); } diff --git a/tests/auto/declarative/shared/testhttpserver.cpp b/tests/auto/declarative/shared/testhttpserver.cpp new file mode 100644 index 0000000..c7b7f25 --- /dev/null +++ b/tests/auto/declarative/shared/testhttpserver.cpp @@ -0,0 +1,298 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** 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 Technology Preview License Agreement accompanying +** this package. +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "testhttpserver.h" +#include <QTcpSocket> +#include <QDebug> +#include <QFile> +#include <QTimer> + +/*! +\internal +\class TestHTTPServer +\brief provides a very, very basic HTTP server for testing. + +Inside the test case, an instance of TestHTTPServer should be created, with the +appropriate port to listen on. The server will listen on the localhost interface. + +Directories to serve can then be added to server, which will be added as "roots". +Each root can be added as a Normal, Delay or Disconnect root. Requests for files +within a Normal root are returned immediately. Request for files within a Delay +root are delayed for 500ms, and then served. Requests for files within a Disconnect +directory cause the server to disconnect immediately. A request for a file that isn't +found in any root will return a 404 error. + +If you have the following directory structure: + +\code +disconnect/disconnectTest.qml +files/main.qml +files/Button.qml +files/content/WebView.qml +slowFiles/slowMain.qml +\endcode +it can be added like this: +\code +TestHTTPServer server(14445); +server.serveDirectory("disconnect", TestHTTPServer::Disconnect); +server.serveDirectory("files"); +server.serveDirectory("slowFiles", TestHTTPServer::Delay); +\endcode + +The following request urls will then result in the appropriate action: +\table +\header \o URL \o Action +\row \o http://localhost:14445/disconnectTest.qml \o Disconnection +\row \o http://localhost:14445/main.qml \o main.qml returned immediately +\row \o http://localhost:14445/Button.qml \o Button.qml returned immediately +\row \o http://localhost:14445/content/WebView.qml \o content/WebView.qml returned immediately +\row \o http://localhost:14445/slowMain.qml \o slowMain.qml returned after 500ms +\endtable +*/ +TestHTTPServer::TestHTTPServer(quint16 port) +: m_hasFailed(false) +{ + QObject::connect(&server, SIGNAL(newConnection()), this, SLOT(newConnection())); + + server.listen(QHostAddress::LocalHost, port); +} + +bool TestHTTPServer::isValid() const +{ + return server.isListening(); +} + +bool TestHTTPServer::serveDirectory(const QString &dir, Mode mode) +{ + dirs.append(qMakePair(dir, mode)); + return true; +} + +bool TestHTTPServer::wait(const QUrl &expect, const QUrl &reply, const QUrl &body) +{ + m_hasFailed = false; + + QFile expectFile(expect.toLocalFile()); + if (!expectFile.open(QIODevice::ReadOnly)) return false; + + QFile replyFile(reply.toLocalFile()); + if (!replyFile.open(QIODevice::ReadOnly)) return false; + + bodyData = QByteArray(); + if (body.isValid()) { + QFile bodyFile(body.toLocalFile()); + if (!bodyFile.open(QIODevice::ReadOnly)) return false; + bodyData = bodyFile.readAll(); + } + + waitData = expectFile.readAll(); + /* + while (waitData.endsWith('\n')) + waitData = waitData.left(waitData.count() - 1); + */ + + replyData = replyFile.readAll(); + + if (!replyData.endsWith('\n')) + replyData.append("\n"); + replyData.append("Content-length: " + QByteArray::number(bodyData.length())); + replyData .append("\n\n"); + + for (int ii = 0; ii < replyData.count(); ++ii) { + if (replyData.at(ii) == '\n' && (!ii || replyData.at(ii - 1) != '\r')) { + replyData.insert(ii, '\r'); + ++ii; + } + } + replyData.append(bodyData); + + return true; +} + +bool TestHTTPServer::hasFailed() const +{ + return m_hasFailed; +} + +void TestHTTPServer::newConnection() +{ + QTcpSocket *socket = server.nextPendingConnection(); + if (!socket) return; + + if (!dirs.isEmpty()) + dataCache.insert(socket, QByteArray()); + + QObject::connect(socket, SIGNAL(disconnected()), this, SLOT(disconnected())); + QObject::connect(socket, SIGNAL(readyRead()), this, SLOT(readyRead())); +} + +void TestHTTPServer::disconnected() +{ + QTcpSocket *socket = qobject_cast<QTcpSocket *>(sender()); + if (!socket) return; + + dataCache.remove(socket); + for (int ii = 0; ii < toSend.count(); ++ii) { + if (toSend.at(ii).first == socket) { + toSend.removeAt(ii); + --ii; + } + } + socket->deleteLater(); +} + +void TestHTTPServer::readyRead() +{ + QTcpSocket *socket = qobject_cast<QTcpSocket *>(sender()); + if (!socket) return; + + QByteArray ba = socket->readAll(); + + if (!dirs.isEmpty()) { + serveGET(socket, ba); + return; + } + + if (m_hasFailed || waitData.isEmpty()) { + qWarning() << "TestHTTPServer: Unexpected data" << ba; + return; + } + + for (int ii = 0; ii < ba.count(); ++ii) { + const char c = ba.at(ii); + if (c == '\r' && waitData.isEmpty()) + continue; + else if (!waitData.isEmpty() && c == waitData.at(0)) + waitData = waitData.mid(1); + else if (c == '\r') + continue; + else { + QByteArray data = ba.mid(ii); + qWarning() << "TestHTTPServer: Unexpected data" << data; + m_hasFailed = true; + socket->disconnect(); + return; + } + } + + if (waitData.isEmpty()) { + socket->write(replyData); + socket->disconnect(); + } +} + +bool TestHTTPServer::reply(QTcpSocket *socket, const QByteArray &fileName) +{ + for (int ii = 0; ii < dirs.count(); ++ii) { + QString dir = dirs.at(ii).first; + Mode mode = dirs.at(ii).second; + + QString dirFile = dir + QLatin1String("/") + QLatin1String(fileName); + + QFile file(dirFile); + if (file.open(QIODevice::ReadOnly)) { + + if (mode == Disconnect) + return true; + + QByteArray data = file.readAll(); + + QByteArray response = "HTTP/1.0 200 OK\r\nContent-type: text/html; charset=UTF-8\r\nContent-length: "; + response += QByteArray::number(data.count()); + response += "\r\n\r\n"; + response += data; + + if (mode == Delay) { + toSend.append(qMakePair(socket, response)); + QTimer::singleShot(500, this, SLOT(sendOne())); + return false; + } else { + socket->write(response); + return true; + } + } + } + + + QByteArray response = "HTTP/1.0 404 Not found\r\nContent-type: text/html; charset=UTF-8\r\n\r\n"; + socket->write(response); + + return true; +} + +void TestHTTPServer::sendOne() +{ + if (!toSend.isEmpty()) { + toSend.first().first->write(toSend.first().second); + toSend.first().first->close(); + toSend.removeFirst(); + } +} + +void TestHTTPServer::serveGET(QTcpSocket *socket, const QByteArray &data) +{ + if (!dataCache.contains(socket)) + return; + + QByteArray total = dataCache[socket] + data; + dataCache[socket] = total; + + if (total.contains("\n\r\n")) { + + bool close = true; + + if (total.startsWith("GET /")) { + + int space = total.indexOf(' ', 4); + if (space != -1) { + + QByteArray req = total.mid(5, space - 5); + close = reply(socket, req); + + } + } + dataCache.remove(socket); + + if (close) + socket->close(); + } +} + diff --git a/tests/auto/declarative/xmlhttprequest/testhttpserver.h b/tests/auto/declarative/shared/testhttpserver.h index 709532e..62fe7b4 100644 --- a/tests/auto/declarative/xmlhttprequest/testhttpserver.h +++ b/tests/auto/declarative/shared/testhttpserver.h @@ -45,6 +45,7 @@ #include <QObject> #include <QTcpServer> #include <QUrl> +#include <QPair> class TestHTTPServer : public QObject { @@ -54,6 +55,9 @@ public: bool isValid() const; + enum Mode { Normal, Delay, Disconnect }; + bool serveDirectory(const QString &, Mode = Normal); + bool wait(const QUrl &expect, const QUrl &reply, const QUrl &body); bool hasFailed() const; @@ -61,8 +65,16 @@ private slots: void newConnection(); void disconnected(); void readyRead(); + void sendOne(); private: + void serveGET(QTcpSocket *, const QByteArray &); + bool reply(QTcpSocket *, const QByteArray &); + + QList<QPair<QString, Mode> > dirs; + QHash<QTcpSocket *, QByteArray> dataCache; + QList<QPair<QTcpSocket *, QByteArray> > toSend; + QByteArray waitData; QByteArray replyData; QByteArray bodyData; diff --git a/tests/auto/declarative/xmlhttprequest/data/abort.expect b/tests/auto/declarative/xmlhttprequest/data/abort.expect index 5cdc24e..21b803a 100644 --- a/tests/auto/declarative/xmlhttprequest/data/abort.expect +++ b/tests/auto/declarative/xmlhttprequest/data/abort.expect @@ -5,6 +5,6 @@ Connection: Keep-Alive Accept-Encoding: gzip accept-language: en,* User-Agent: Mozilla/5.0 -Host: localhost:14445 +Host: 127.0.0.1:14445 Test Data
\ No newline at end of file diff --git a/tests/auto/declarative/xmlhttprequest/data/getResponseHeader.expect b/tests/auto/declarative/xmlhttprequest/data/getResponseHeader.expect index 40e648e..8d7b95d 100644 --- a/tests/auto/declarative/xmlhttprequest/data/getResponseHeader.expect +++ b/tests/auto/declarative/xmlhttprequest/data/getResponseHeader.expect @@ -3,5 +3,5 @@ Connection: Keep-Alive Accept-Encoding: gzip accept-language: en,* User-Agent: Mozilla/5.0 -Host: localhost:14445 +Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/xmlhttprequest/data/open_network.expect b/tests/auto/declarative/xmlhttprequest/data/open_network.expect index 40e648e..8d7b95d 100644 --- a/tests/auto/declarative/xmlhttprequest/data/open_network.expect +++ b/tests/auto/declarative/xmlhttprequest/data/open_network.expect @@ -3,5 +3,5 @@ Connection: Keep-Alive Accept-Encoding: gzip accept-language: en,* User-Agent: Mozilla/5.0 -Host: localhost:14445 +Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/xmlhttprequest/data/send_data.1.expect b/tests/auto/declarative/xmlhttprequest/data/send_data.1.expect index 1ef179b..104f485 100644 --- a/tests/auto/declarative/xmlhttprequest/data/send_data.1.expect +++ b/tests/auto/declarative/xmlhttprequest/data/send_data.1.expect @@ -5,6 +5,6 @@ Connection: Keep-Alive Accept-Encoding: gzip accept-language: en,* User-Agent: Mozilla/5.0 -Host: localhost:14445 +Host: 127.0.0.1:14445 My Sent Data
\ No newline at end of file diff --git a/tests/auto/declarative/xmlhttprequest/data/send_data.4.expect b/tests/auto/declarative/xmlhttprequest/data/send_data.4.expect index 6b10b4a..933628f 100644 --- a/tests/auto/declarative/xmlhttprequest/data/send_data.4.expect +++ b/tests/auto/declarative/xmlhttprequest/data/send_data.4.expect @@ -5,6 +5,6 @@ Connection: Keep-Alive Accept-Encoding: gzip accept-language: en,* User-Agent: Mozilla/5.0 -Host: localhost:14445 +Host: 127.0.0.1:14445 My Sent Data
\ No newline at end of file diff --git a/tests/auto/declarative/xmlhttprequest/data/send_data.6.expect b/tests/auto/declarative/xmlhttprequest/data/send_data.6.expect index dc0d6c2..b466a18 100644 --- a/tests/auto/declarative/xmlhttprequest/data/send_data.6.expect +++ b/tests/auto/declarative/xmlhttprequest/data/send_data.6.expect @@ -5,6 +5,6 @@ Connection: Keep-Alive Accept-Encoding: gzip accept-language: en,* User-Agent: Mozilla/5.0 -Host: localhost:14445 +Host: 127.0.0.1:14445 My Sent Data
\ No newline at end of file diff --git a/tests/auto/declarative/xmlhttprequest/data/send_ignoreData_GET.expect b/tests/auto/declarative/xmlhttprequest/data/send_ignoreData_GET.expect index 40e648e..8d7b95d 100644 --- a/tests/auto/declarative/xmlhttprequest/data/send_ignoreData_GET.expect +++ b/tests/auto/declarative/xmlhttprequest/data/send_ignoreData_GET.expect @@ -3,5 +3,5 @@ Connection: Keep-Alive Accept-Encoding: gzip accept-language: en,* User-Agent: Mozilla/5.0 -Host: localhost:14445 +Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/xmlhttprequest/data/send_ignoreData_PUT.expect b/tests/auto/declarative/xmlhttprequest/data/send_ignoreData_PUT.expect index 381cc89..4556e8d 100644 --- a/tests/auto/declarative/xmlhttprequest/data/send_ignoreData_PUT.expect +++ b/tests/auto/declarative/xmlhttprequest/data/send_ignoreData_PUT.expect @@ -3,5 +3,5 @@ Connection: Keep-Alive Accept-Encoding: gzip accept-language: en,* User-Agent: Mozilla/5.0 -Host: localhost:14445 +Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/xmlhttprequest/data/setRequestHeader.expect b/tests/auto/declarative/xmlhttprequest/data/setRequestHeader.expect index 031ddff..da040e7 100644 --- a/tests/auto/declarative/xmlhttprequest/data/setRequestHeader.expect +++ b/tests/auto/declarative/xmlhttprequest/data/setRequestHeader.expect @@ -5,5 +5,5 @@ Connection: Keep-Alive Accept-Encoding: gzip accept-language: en,* User-Agent: Mozilla/5.0 -Host: localhost:14445 +Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/xmlhttprequest/data/status.expect b/tests/auto/declarative/xmlhttprequest/data/status.expect index 40e648e..8d7b95d 100644 --- a/tests/auto/declarative/xmlhttprequest/data/status.expect +++ b/tests/auto/declarative/xmlhttprequest/data/status.expect @@ -3,5 +3,5 @@ Connection: Keep-Alive Accept-Encoding: gzip accept-language: en,* User-Agent: Mozilla/5.0 -Host: localhost:14445 +Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/xmlhttprequest/testhttpserver.cpp b/tests/auto/declarative/xmlhttprequest/testhttpserver.cpp deleted file mode 100644 index b464a1b..0000000 --- a/tests/auto/declarative/xmlhttprequest/testhttpserver.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** 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 Technology Preview License Agreement accompanying -** this package. -** -** 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.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "testhttpserver.h" -#include <QTcpSocket> -#include <QDebug> -#include <QFile> - -TestHTTPServer::TestHTTPServer(quint16 port) -: m_hasFailed(false) -{ - QObject::connect(&server, SIGNAL(newConnection()), this, SLOT(newConnection())); - - server.listen(QHostAddress::Any, port); -} - -bool TestHTTPServer::isValid() const -{ - return server.isListening(); -} - -bool TestHTTPServer::wait(const QUrl &expect, const QUrl &reply, const QUrl &body) -{ - m_hasFailed = false; - - QFile expectFile(expect.toLocalFile()); - if (!expectFile.open(QIODevice::ReadOnly)) return false; - - QFile replyFile(reply.toLocalFile()); - if (!replyFile.open(QIODevice::ReadOnly)) return false; - - bodyData = QByteArray(); - if (body.isValid()) { - QFile bodyFile(body.toLocalFile()); - if (!bodyFile.open(QIODevice::ReadOnly)) return false; - bodyData = bodyFile.readAll(); - } - - waitData = expectFile.readAll(); - /* - while (waitData.endsWith('\n')) - waitData = waitData.left(waitData.count() - 1); - */ - - replyData = replyFile.readAll(); - - if (!replyData.endsWith('\n')) - replyData.append("\n"); - replyData.append("Content-length: " + QByteArray::number(bodyData.length())); - replyData .append("\n\n"); - - for (int ii = 0; ii < replyData.count(); ++ii) { - if (replyData.at(ii) == '\n' && (!ii || replyData.at(ii - 1) != '\r')) { - replyData.insert(ii, '\r'); - ++ii; - } - } - replyData.append(bodyData); - - return true; -} - -bool TestHTTPServer::hasFailed() const -{ - return m_hasFailed; -} - -void TestHTTPServer::newConnection() -{ - QTcpSocket *socket = server.nextPendingConnection(); - if (!socket) return; - - QObject::connect(socket, SIGNAL(disconnected()), this, SLOT(disconnected())); - QObject::connect(socket, SIGNAL(readyRead()), this, SLOT(readyRead())); -} - -void TestHTTPServer::disconnected() -{ - sender()->deleteLater(); -} - -void TestHTTPServer::readyRead() -{ - QTcpSocket *socket = qobject_cast<QTcpSocket *>(sender()); - if (!socket) return; - - QByteArray ba = socket->readAll(); - - if (m_hasFailed || waitData.isEmpty()) { - qWarning() << "TestHTTPServer: Unexpected data" << ba; - return; - } - - for (int ii = 0; ii < ba.count(); ++ii) { - const char c = ba.at(ii); - if (c == '\r' && waitData.isEmpty()) - continue; - else if (!waitData.isEmpty() && c == waitData.at(0)) - waitData = waitData.mid(1); - else if (c == '\r') - continue; - else { - QByteArray data = ba.mid(ii); - qWarning() << "TestHTTPServer: Unexpected data" << data; - m_hasFailed = true; - socket->disconnect(); - return; - } - } - - if (waitData.isEmpty()) { - socket->write(replyData); - socket->disconnect(); - } -} - diff --git a/tests/auto/declarative/xmlhttprequest/tst_xmlhttprequest.cpp b/tests/auto/declarative/xmlhttprequest/tst_xmlhttprequest.cpp index 5a1955e..0af7b18 100644 --- a/tests/auto/declarative/xmlhttprequest/tst_xmlhttprequest.cpp +++ b/tests/auto/declarative/xmlhttprequest/tst_xmlhttprequest.cpp @@ -265,7 +265,7 @@ void tst_xmlhttprequest::open() QmlComponent component(&engine, TEST_FILE("open.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); QCOMPARE(object->property("readyState").toBool(), true); @@ -341,7 +341,7 @@ void tst_xmlhttprequest::setRequestHeader() QmlComponent component(&engine, TEST_FILE("setRequestHeader.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); TRY_WAIT(object->property("dataOK").toBool() == true); @@ -403,7 +403,7 @@ void tst_xmlhttprequest::setRequestHeader_illegalName() QmlComponent component(&engine, TEST_FILE("setRequestHeader_illegalName.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); object->setProperty("header", name); component.completeCreate(); @@ -431,7 +431,7 @@ void tst_xmlhttprequest::setRequestHeader_sent() QmlComponent component(&engine, TEST_FILE("setRequestHeader_sent.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); QCOMPARE(object->property("test").toBool(), true); @@ -480,7 +480,7 @@ void tst_xmlhttprequest::send_ignoreData() QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); object->setProperty("reqType", "GET"); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); TRY_WAIT(object->property("dataOK").toBool() == true); @@ -499,7 +499,7 @@ void tst_xmlhttprequest::send_ignoreData() QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); object->setProperty("reqType", "HEAD"); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); TRY_WAIT(object->property("dataOK").toBool() == true); @@ -522,7 +522,7 @@ void tst_xmlhttprequest::send_withdata() QmlComponent component(&engine, TEST_FILE("send_data.1.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); TRY_WAIT(object->property("dataOK").toBool() == true); @@ -541,7 +541,7 @@ void tst_xmlhttprequest::send_withdata() QmlComponent component(&engine, TEST_FILE("send_data.2.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); TRY_WAIT(object->property("dataOK").toBool() == true); @@ -560,7 +560,7 @@ void tst_xmlhttprequest::send_withdata() QmlComponent component(&engine, TEST_FILE("send_data.3.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); TRY_WAIT(object->property("dataOK").toBool() == true); @@ -579,7 +579,7 @@ void tst_xmlhttprequest::send_withdata() QmlComponent component(&engine, TEST_FILE("send_data.4.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); TRY_WAIT(object->property("dataOK").toBool() == true); @@ -598,7 +598,7 @@ void tst_xmlhttprequest::send_withdata() QmlComponent component(&engine, TEST_FILE("send_data.5.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); TRY_WAIT(object->property("dataOK").toBool() == true); @@ -617,7 +617,7 @@ void tst_xmlhttprequest::send_withdata() QmlComponent component(&engine, TEST_FILE("send_data.6.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); TRY_WAIT(object->property("dataOK").toBool() == true); @@ -680,8 +680,8 @@ void tst_xmlhttprequest::abort() QmlComponent component(&engine, TEST_FILE("abort.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("urlDummy", "http://localhost:14449/testdocument.html"); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("urlDummy", "http://127.0.0.1:14449/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); QCOMPARE(object->property("seenDone").toBool(), true); @@ -707,7 +707,7 @@ void tst_xmlhttprequest::getResponseHeader() QmlComponent component(&engine, TEST_FILE("getResponseHeader.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); QCOMPARE(object->property("unsentException").toBool(), true); @@ -745,7 +745,7 @@ void tst_xmlhttprequest::getAllResponseHeaders() QmlComponent component(&engine, TEST_FILE("getAllResponseHeaders.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); QCOMPARE(object->property("unsentException").toBool(), true); @@ -776,7 +776,7 @@ void tst_xmlhttprequest::status() QmlComponent component(&engine, TEST_FILE("status.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); object->setProperty("expectedStatus", 200); component.completeCreate(); @@ -803,7 +803,7 @@ void tst_xmlhttprequest::status() QmlComponent component(&engine, TEST_FILE("status.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); object->setProperty("expectedStatus", 404); component.completeCreate(); @@ -833,7 +833,7 @@ void tst_xmlhttprequest::statusText() QmlComponent component(&engine, TEST_FILE("statusText.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); object->setProperty("expectedStatus", "OK"); component.completeCreate(); @@ -860,7 +860,7 @@ void tst_xmlhttprequest::statusText() QmlComponent component(&engine, TEST_FILE("statusText.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); object->setProperty("expectedStatus", "Document not found"); component.completeCreate(); @@ -890,7 +890,7 @@ void tst_xmlhttprequest::responseText() QmlComponent component(&engine, TEST_FILE("responseText.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); object->setProperty("expectedText", "QML Rocks!\n"); component.completeCreate(); @@ -917,7 +917,7 @@ void tst_xmlhttprequest::responseText() QmlComponent component(&engine, TEST_FILE("responseText.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); object->setProperty("expectedText", ""); component.completeCreate(); @@ -944,7 +944,7 @@ void tst_xmlhttprequest::responseText() QmlComponent component(&engine, TEST_FILE("responseText.qml")); QObject *object = component.beginCreate(engine.rootContext()); QVERIFY(object != 0); - object->setProperty("url", "http://localhost:14445/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); object->setProperty("expectedText", ""); component.completeCreate(); diff --git a/tests/auto/declarative/xmlhttprequest/xmlhttprequest.pro b/tests/auto/declarative/xmlhttprequest/xmlhttprequest.pro index 5d35a89..6af4e39 100644 --- a/tests/auto/declarative/xmlhttprequest/xmlhttprequest.pro +++ b/tests/auto/declarative/xmlhttprequest/xmlhttprequest.pro @@ -2,10 +2,11 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative webkit network macx:CONFIG -= app_bundle -HEADERS += testhttpserver.h +INCLUDEPATH += ../shared/ +HEADERS += ../shared/testhttpserver.h SOURCES += tst_xmlhttprequest.cpp \ - testhttpserver.cpp + ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory |