From 7851cbd64d15d39a0e9cc99efa6c2d007c935ce9 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 6 Oct 2009 07:34:12 +0200 Subject: tst_QCssParser::extractFontFamily fix Windows CE font deployment On Windows mobile we usually don't have the "Times New Roman" font. Thus we must deploy and register it, if its not available. Reviewed-by: mauricek --- tests/auto/qcssparser/qcssparser.pro | 8 +++++--- tests/auto/qcssparser/tst_qcssparser.cpp | 33 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/tests/auto/qcssparser/qcssparser.pro b/tests/auto/qcssparser/qcssparser.pro index 2f99142..6ce559b 100644 --- a/tests/auto/qcssparser/qcssparser.pro +++ b/tests/auto/qcssparser/qcssparser.pro @@ -3,9 +3,11 @@ SOURCES += tst_qcssparser.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" QT += xml - -wince*: { +wince* { addFiles.sources = testdata addFiles.path = . - DEPLOYMENT += addFiles + timesFont.sources = C:/Windows/Fonts/times.ttf + timesFont.path = . + DEPLOYMENT += addFiles timesFont } + diff --git a/tests/auto/qcssparser/tst_qcssparser.cpp b/tests/auto/qcssparser/tst_qcssparser.cpp index c2facb0..d7a126d 100644 --- a/tests/auto/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/qcssparser/tst_qcssparser.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include #include +#if defined(Q_OS_WINCE) +#include +#endif //TESTED_CLASS=QCss //TESTED_FILES=gui/text/qcssparser.cpp gui/text/qcssparser_p.h @@ -49,6 +52,11 @@ class tst_QCssParser : public QObject { Q_OBJECT + +public slots: + void initTestCase(); + void cleanupTestCase(); + private slots: void scanner_data(); void scanner(); @@ -91,8 +99,33 @@ private slots: void extractBorder(); void noTextDecoration(); void quotedAndUnquotedIdentifiers(); + +private: +#if defined(Q_OS_WINCE) + int m_timesFontId; +#endif }; +void tst_QCssParser::initTestCase() +{ +#if defined(Q_OS_WINCE) + QFontDatabase fontDB; + m_timesFontId = -1; + if (!fontDB.families().contains("Times New Roman")) { + m_timesFontId = QFontDatabase::addApplicationFont("times.ttf"); + QVERIFY(m_timesFontId != -1); + } +#endif +} + +void tst_QCssParser::cleanupTestCase() +{ +#if defined(Q_OS_WINCE) + if (m_timesFontId != -1) + QFontDatabase::removeApplicationFont(m_timesFontId); +#endif +} + void tst_QCssParser::scanner_data() { QTest::addColumn("input"); -- cgit v0.12