summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-04-14 03:05:07 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-04-14 03:05:07 (GMT)
commitb24a4c0b75f5d393ca673942b68a12f02ed476e8 (patch)
treeebe8cca06c57d6ff505b2870bbd2b367e8fce28e /tests
parent99412b443101dad3fc593018f2ab715df09ffb8f (diff)
downloadQt-b24a4c0b75f5d393ca673942b68a12f02ed476e8.zip
Qt-b24a4c0b75f5d393ca673942b68a12f02ed476e8.tar.gz
Qt-b24a4c0b75f5d393ca673942b68a12f02ed476e8.tar.bz2
Stabilize test.
Uses built-in server.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativepixmapcache/data/http/exists.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/declarative/qdeclarativepixmapcache/data/http/exists1.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/declarative/qdeclarativepixmapcache/data/http/exists2.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/declarative/qdeclarativepixmapcache/data/http/exists3.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/declarative/qdeclarativepixmapcache/data/http/exists4.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/declarative/qdeclarativepixmapcache/data/http/exists5.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro6
-rw-r--r--tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp30
8 files changed, 24 insertions, 12 deletions
diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists.png
new file mode 100644
index 0000000..399bd0b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists1.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists1.png
new file mode 100644
index 0000000..399bd0b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists1.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists2.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists2.png
new file mode 100644
index 0000000..399bd0b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists2.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists3.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists3.png
new file mode 100644
index 0000000..399bd0b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists3.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists4.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists4.png
new file mode 100644
index 0000000..399bd0b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists4.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists5.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists5.png
new file mode 100644
index 0000000..399bd0b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists5.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro
index b5b033a..4b247fc 100644
--- a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro
+++ b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro
@@ -5,6 +5,12 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativepixmapcache.cpp
+INCLUDEPATH += ../shared/
+HEADERS += ../shared/testhttpserver.h
+SOURCES += ../shared/testhttpserver.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
# LIBS += -lgcov
diff --git a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp
index 223f54f..f2ccf80 100644
--- a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp
+++ b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp
@@ -43,6 +43,8 @@
#include <private/qdeclarativepixmapcache_p.h>
#include <QtDeclarative/qdeclarativeengine.h>
#include <QNetworkReply>
+#include "testhttpserver.h"
+#include "../../../shared/util.h"
// These don't let normal people run tests!
//#include "../network-settings.h"
@@ -52,8 +54,10 @@ class tst_qdeclarativepixmapcache : public QObject
Q_OBJECT
public:
tst_qdeclarativepixmapcache() :
- thisfile(QUrl::fromLocalFile(__FILE__))
+ thisfile(QUrl::fromLocalFile(__FILE__)),
+ server(14452)
{
+ server.serveDirectory(SRCDIR "/data/http");
}
private slots:
@@ -65,6 +69,7 @@ private slots:
private:
QDeclarativeEngine engine;
QUrl thisfile;
+ TestHTTPServer server;
};
@@ -110,8 +115,8 @@ void tst_qdeclarativepixmapcache::single_data()
// File URLs are optimized
QTest::newRow("local") << thisfile.resolved(QUrl("data/exists.png")) << localfile_optimized << true << false;
QTest::newRow("local") << thisfile.resolved(QUrl("data/notexists.png")) << localfile_optimized << false << false;
- QTest::newRow("remote") << QUrl("http://qt.nokia.com/logo.png") << false << true << false;
- QTest::newRow("remote") << QUrl("http://qt.nokia.com/thereisnologo.png") << false << false << true;
+ QTest::newRow("remote") << QUrl("http://127.0.0.1:14452/exists.png") << false << true << false;
+ QTest::newRow("remote") << QUrl("http://127.0.0.1:14452/notexists.png") << false << false << true;
}
void tst_qdeclarativepixmapcache::single()
@@ -122,7 +127,7 @@ void tst_qdeclarativepixmapcache::single()
QFETCH(bool, neterror);
if (neterror) {
- QString expected = "\"Error downloading " + target.toString() + " - server replied: Not Found\" ";
+ QString expected = "\"Error downloading " + target.toString() + " - server replied: Not found\" ";
QTest::ignoreMessage(QtWarningMsg, expected.toLatin1());
} else if (!exists) {
QString expected = "Cannot open QUrl( \"" + target.toString() + "\" ) ";
@@ -183,32 +188,32 @@ void tst_qdeclarativepixmapcache::parallel_data()
;
QTest::newRow("remote")
- << QUrl("http://qt.nokia.com/images/template/checkbox-on.png")
- << QUrl("http://qt.nokia.com/images/products/qt-logo/image_tile")
+ << QUrl("http://127.0.0.1:14452/exists2.png")
+ << QUrl("http://127.0.0.1:14452/exists3.png")
<< 0
<< -1
<< 2
;
QTest::newRow("remoteagain")
- << QUrl("http://qt.nokia.com/images/template/checkbox-on.png")
- << QUrl("http://qt.nokia.com/images/products/qt-logo/image_tile")
+ << QUrl("http://127.0.0.1:14452/exists2.png")
+ << QUrl("http://127.0.0.1:14452/exists3.png")
<< 2
<< -1
<< 0
;
QTest::newRow("remotecopy")
- << QUrl("http://qt.nokia.com/images/template/checkbox-off.png")
- << QUrl("http://qt.nokia.com/images/template/checkbox-off.png")
+ << QUrl("http://127.0.0.1:14452/exists4.png")
+ << QUrl("http://127.0.0.1:14452/exists4.png")
<< 0
<< -1
<< 1
;
QTest::newRow("remotecopycancel")
- << QUrl("http://qt.nokia.com/rounded_block_bg.png")
- << QUrl("http://qt.nokia.com/rounded_block_bg.png")
+ << QUrl("http://127.0.0.1:14452/exists5.png")
+ << QUrl("http://127.0.0.1:14452/exists5.png")
<< 0
<< 0
<< 1
@@ -233,6 +238,7 @@ void tst_qdeclarativepixmapcache::parallel()
QPixmap pixmap;
QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(target, &pixmap);
QDeclarativePixmapReply *reply = 0;
+ QVERIFY(status != QDeclarativePixmapReply::Error);
if (status != QDeclarativePixmapReply::Error && status != QDeclarativePixmapReply::Ready)
reply = QDeclarativePixmapCache::request(&engine, target);
replies.append(reply);