diff options
-rw-r--r-- | tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp b/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp index a65ecf4..464ae5d 100644 --- a/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp +++ b/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp @@ -42,6 +42,7 @@ #include <QtDeclarative/qmlengine.h> #include <QtDeclarative/qmlcomponent.h> #include <private/qmlfontloader_p.h> +#include "../../../shared/util.h" class tst_qmlfontloader : public QObject @@ -51,8 +52,10 @@ public: tst_qmlfontloader(); private slots: + void nofont(); void namedfont(); void localfont(); + void webfont(); private slots: @@ -64,6 +67,16 @@ tst_qmlfontloader::tst_qmlfontloader() { } +void tst_qmlfontloader::nofont() +{ + QString componentStr = "import Qt 4.6\nFontLoader { }"; + QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlFontLoader *fontObject = qobject_cast<QmlFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + QCOMPARE(fontObject->name(), QString("")); +} + void tst_qmlfontloader::namedfont() { QString componentStr = "import Qt 4.6\nFontLoader { name: \"Helvetica\" }"; @@ -84,6 +97,16 @@ void tst_qmlfontloader::localfont() QCOMPARE(fontObject->name(), QString("Fontin")); } +void tst_qmlfontloader::webfont() +{ + QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://www.princexml.com/fonts/steffmann/Starburst.ttf\" }"; + QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlFontLoader *fontObject = qobject_cast<QmlFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + QTRY_COMPARE(fontObject->name(), QString("Starburst")); +} + QTEST_MAIN(tst_qmlfontloader) #include "tst_qmlfontloader.moc" |