diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-15 22:13:33 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-15 22:13:33 (GMT) |
commit | 792978f693087dfecb1b9a6479e13ab75305d0d6 (patch) | |
tree | 906874fe561b06061f6c22f665d3304d1e2026cc /tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp | |
parent | fdcb62d5d6a3e295273042555d2551eb491a5b2d (diff) | |
parent | 737c0c8d9aa319384ef0bcbed4e709deb2239e75 (diff) | |
download | Qt-792978f693087dfecb1b9a6479e13ab75305d0d6.zip Qt-792978f693087dfecb1b9a6479e13ab75305d0d6.tar.gz Qt-792978f693087dfecb1b9a6479e13ab75305d0d6.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (89 commits)
Compile with user defined Qt namespace
Fix regression from previous commit
Import "content" with as qualifier to support network without qmldir
Small fixes to photoviewer demo
Fix benchmark.
Add basic QUrl benchmarks.
Add busy indicator to photoviewer demo
Set maximumExtents correctly for highlightRangeMode: StrictlyEnforceRange
fix installation of imports libraries
QDeclarative::isWritable optimization.
Make easing docs more consistent with other grouped property docs.
Make the loader a focusscope.
Fix typo.
Use reliable local server for HTTP testing.
Fix installation of imports libraries
Change PathView offset property to use range 0 - 1.0
Tweak benchmark
Optimization: Use linked list for context children
Add new declarative photoviewer demo
Remove dead code
...
Diffstat (limited to 'tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp index a9762df..375e801 100644 --- a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp +++ b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp @@ -43,6 +43,9 @@ #include <QtDeclarative/qdeclarativecomponent.h> #include <private/qdeclarativefontloader_p.h> #include "../../../shared/util.h" +#include "../shared/testhttpserver.h" + +#define SERVER_PORT 14445 class tst_qdeclarativefontloader : public QObject @@ -57,16 +60,21 @@ private slots: void localFont(); void failLocalFont(); void webFont(); + void redirWebFont(); void failWebFont(); private slots: private: QDeclarativeEngine engine; + TestHTTPServer server; }; -tst_qdeclarativefontloader::tst_qdeclarativefontloader() +tst_qdeclarativefontloader::tst_qdeclarativefontloader() : + server(SERVER_PORT) { + server.serveDirectory(SRCDIR "/data"); + Q_ASSERT(server.isValid()); } void tst_qdeclarativefontloader::noFont() @@ -126,21 +134,38 @@ void tst_qdeclarativefontloader::failLocalFont() void tst_qdeclarativefontloader::webFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://www.princexml.com/fonts/steffmann/Starburst.ttf\" }"; + QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14445/tarzeau_ocr_a.ttf\" }"; + QDeclarativeComponent component(&engine); + + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + QVERIFY(fontObject->source() != QUrl("")); + QTRY_COMPARE(fontObject->name(), QString("OCRA")); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); +} + +void tst_qdeclarativefontloader::redirWebFont() +{ + server.addRedirect("olddir/oldname.ttf","../tarzeau_ocr_a.ttf"); + + QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14445/olddir/oldname.ttf\" }"; QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); QVERIFY(fontObject != 0); QVERIFY(fontObject->source() != QUrl("")); - QTRY_COMPARE(fontObject->name(), QString("Starburst")); + QTRY_COMPARE(fontObject->name(), QString("OCRA")); QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); } void tst_qdeclarativefontloader::failWebFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://wrong.address.com/Starburst.ttf\" }"; - QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"http://wrong.address.com/Starburst.ttf\" ) "); + QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14445/nonexist.ttf\" }"; + QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"http://localhost:14445/nonexist.ttf\" ) "); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); |