diff options
author | Pierre Rossi <pierre.rossi@nokia.com> | 2011-07-19 16:36:05 (GMT) |
---|---|---|
committer | Pierre Rossi <pierre.rossi@nokia.com> | 2011-08-15 19:02:37 (GMT) |
commit | 1bea92a96e3007667d23058be03b75cef315608b (patch) | |
tree | 541398160eb244605eb3f85e8a12e83d1da28329 /tests | |
parent | b90a0139a4f63c730bb4668e04ab3f8c81ead04f (diff) | |
download | Qt-1bea92a96e3007667d23058be03b75cef315608b.zip Qt-1bea92a96e3007667d23058be03b75cef315608b.tar.gz Qt-1bea92a96e3007667d23058be03b75cef315608b.tar.bz2 |
Add support for rawFonts loaded from data in FaceId
The problem was that with an empty filename and index of 0, all raw fonts
loaded from data had the same FaceId, and we wouldn't bother to load
another one after doing this once.
This commit introduces a uuid in FaceId to help distinguish them in
that case.
Change-Id: I93655ff07a7d8856af1f854024e207c519f8ed1a
Reviewed-on: http://codereview.qt.nokia.com/1882
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qrawfont/tst_qrawfont.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/auto/qrawfont/tst_qrawfont.cpp b/tests/auto/qrawfont/tst_qrawfont.cpp index e0680c4..eb78057 100644 --- a/tests/auto/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/qrawfont/tst_qrawfont.cpp @@ -47,7 +47,6 @@ class tst_QRawFont: public QObject { Q_OBJECT - #if !defined(QT_NO_RAWFONT) private slots: void invalidRawFont(); @@ -94,6 +93,11 @@ private slots: void rawFontSetPixelSize_data(); void rawFontSetPixelSize(); + +#if defined(Q_WS_X11) || defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA) + void multipleRawFontsFromData(); +#endif + #endif // QT_NO_RAWFONT }; @@ -843,6 +847,25 @@ void tst_QRawFont::rawFontSetPixelSize() QCOMPARE(rawFont.pixelSize(), 24.0); } +#if defined(Q_WS_X11) || defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA) +void tst_QRawFont::multipleRawFontsFromData() +{ + QFile file(QString::fromLatin1(SRCDIR "testfont.ttf")); + QRawFont testFont; + if (file.open(QIODevice::ReadOnly)) { + testFont.loadFromData(file.readAll(), 11, QFont::PreferDefaultHinting); + file.close(); + } + file.setFileName(QLatin1String(SRCDIR "testfont_bold_italic.ttf")); + QRawFont testFontBoldItalic; + if (file.open(QIODevice::ReadOnly)) + testFontBoldItalic.loadFromData(file.readAll(), 11, QFont::PreferDefaultHinting); + + QVERIFY(testFont.familyName() != (testFontBoldItalic.familyName()) + || testFont.styleName() != (testFontBoldItalic.styleName())); +} +#endif + #endif // QT_NO_RAWFONT QTEST_MAIN(tst_QRawFont) |