aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickfontloader
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-01-31 12:25:46 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-04-23 09:02:03 +0200
commit4601cd23f6c90372edbd4145833041bd7cf227cb (patch)
tree948ef69b9575b2bfcdcbce58ac39ad121e88ec30 /tests/auto/quick/qquickfontloader
parent7e5a691006c1051be1a163fa6a7d40effb6ef0bb (diff)
Add additional properties to FontLoader to help disambiguate
The FontLoader only returns the family name, and there is no way to disambiguate fonts within the same family. This change adds the option of getting other properties from the loaded font to help with this. [ChangeLog][QtQuick] Added FontLoader.font property which is filled with a font query that matches the loaded font. This can be used to disambiguate when multiple fonts in the same family are loaded in the same application. Fixes: QTBUG-68829 Change-Id: If05e85a1ca8d93b93100345cb2d05cd1ad6c7549 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/quick/qquickfontloader')
-rw-r--r--tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp
index 8f6910bee4..4d63803e78 100644
--- a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp
+++ b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp
@@ -158,9 +158,9 @@ void tst_qquickfontloader::failWebFont()
void tst_qquickfontloader::changeFont()
{
- QString componentStr = "import QtQuick 2.0\nFontLoader { source: font }";
+ QString componentStr = "import QtQuick 2.0\nFontLoader { source: fnt }";
QQmlContext *ctxt = engine.rootContext();
- ctxt->setContextProperty("font", testFileUrl("tarzeau_ocr_a.ttf"));
+ ctxt->setContextProperty("fnt", testFileUrl("tarzeau_ocr_a.ttf"));
QQmlComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create());
@@ -175,20 +175,20 @@ void tst_qquickfontloader::changeFont()
QCOMPARE(statusSpy.count(), 0);
QTRY_COMPARE(fontObject->name(), QString("OCRA"));
- ctxt->setContextProperty("font", server.urlString("/daniel.ttf"));
+ ctxt->setContextProperty("fnt", server.urlString("/daniel.ttf"));
QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Loading);
QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready);
QCOMPARE(nameSpy.count(), 1);
QCOMPARE(statusSpy.count(), 2);
QTRY_COMPARE(fontObject->name(), QString("Daniel"));
- ctxt->setContextProperty("font", testFileUrl("tarzeau_ocr_a.ttf"));
+ ctxt->setContextProperty("fnt", testFileUrl("tarzeau_ocr_a.ttf"));
QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready);
QCOMPARE(nameSpy.count(), 2);
QCOMPARE(statusSpy.count(), 2);
QTRY_COMPARE(fontObject->name(), QString("OCRA"));
- ctxt->setContextProperty("font", server.urlString("/daniel.ttf"));
+ ctxt->setContextProperty("fnt", server.urlString("/daniel.ttf"));
QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready);
QCOMPARE(nameSpy.count(), 3);
QCOMPARE(statusSpy.count(), 2);