summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmlfontloader
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2009-11-03 07:50:26 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2009-11-03 07:50:26 (GMT)
commit3550d1b22b3a5f8f974ca2ba17a3d4f5d52b3743 (patch)
tree74e14c32e0b08365010807186faaa7100faddec9 /tests/auto/declarative/qmlfontloader
parent8dbea8ec48084b27c56f7d263c38c84ff03ebc3d (diff)
downloadQt-3550d1b22b3a5f8f974ca2ba17a3d4f5d52b3743.zip
Qt-3550d1b22b3a5f8f974ca2ba17a3d4f5d52b3743.tar.gz
Qt-3550d1b22b3a5f8f974ca2ba17a3d4f5d52b3743.tar.bz2
QmlFontLoader tests
Diffstat (limited to 'tests/auto/declarative/qmlfontloader')
-rw-r--r--tests/auto/declarative/qmlfontloader/data/Fontin-Bold.ttfbin0 -> 30916 bytes
-rw-r--r--tests/auto/declarative/qmlfontloader/qmlfontloader.pro5
-rw-r--r--tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp89
3 files changed, 94 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlfontloader/data/Fontin-Bold.ttf b/tests/auto/declarative/qmlfontloader/data/Fontin-Bold.ttf
new file mode 100644
index 0000000..f6a33b0
--- /dev/null
+++ b/tests/auto/declarative/qmlfontloader/data/Fontin-Bold.ttf
Binary files differ
diff --git a/tests/auto/declarative/qmlfontloader/qmlfontloader.pro b/tests/auto/declarative/qmlfontloader/qmlfontloader.pro
new file mode 100644
index 0000000..0ecfde0
--- /dev/null
+++ b/tests/auto/declarative/qmlfontloader/qmlfontloader.pro
@@ -0,0 +1,5 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative gui
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qmlfontloader.cpp
diff --git a/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp b/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp
new file mode 100644
index 0000000..a65ecf4
--- /dev/null
+++ b/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** 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 <qtest.h>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <private/qmlfontloader_p.h>
+
+class tst_qmlfontloader : public QObject
+
+{
+ Q_OBJECT
+public:
+ tst_qmlfontloader();
+
+private slots:
+ void namedfont();
+ void localfont();
+
+private slots:
+
+private:
+ QmlEngine engine;
+};
+
+tst_qmlfontloader::tst_qmlfontloader()
+{
+}
+
+void tst_qmlfontloader::namedfont()
+{
+ QString componentStr = "import Qt 4.6\nFontLoader { name: \"Helvetica\" }";
+ QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlFontLoader *fontObject = qobject_cast<QmlFontLoader*>(component.create());
+
+ QVERIFY(fontObject != 0);
+ QCOMPARE(fontObject->name(), QString("Helvetica"));
+}
+
+void tst_qmlfontloader::localfont()
+{
+ QString componentStr = "import Qt 4.6\nFontLoader { source: \"data/Fontin-Bold.ttf\" }";
+ QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlFontLoader *fontObject = qobject_cast<QmlFontLoader*>(component.create());
+
+ QVERIFY(fontObject != 0);
+ QCOMPARE(fontObject->name(), QString("Fontin"));
+}
+
+QTEST_MAIN(tst_qmlfontloader)
+
+#include "tst_qmlfontloader.moc"