summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2009-10-07 02:25:17 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2009-10-07 02:25:17 (GMT)
commit54c5c60c8f5937690fa006f6fbee434259f25061 (patch)
tree1094938fe272e5bbb272f729805ee546d54d74fc /tests
parentf60b50f86e5d99de49497f5ead8a76207991cc4c (diff)
downloadQt-54c5c60c8f5937690fa006f6fbee434259f25061.zip
Qt-54c5c60c8f5937690fa006f6fbee434259f25061.tar.gz
Qt-54c5c60c8f5937690fa006f6fbee434259f25061.tar.bz2
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 (cherry picked from commit 7851cbd64d15d39a0e9cc99efa6c2d007c935ce9) Conflicts: tests/auto/qcssparser/qcssparser.pro
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qcssparser/qcssparser.pro6
-rw-r--r--tests/auto/qcssparser/tst_qcssparser.cpp33
2 files changed, 37 insertions, 2 deletions
diff --git a/tests/auto/qcssparser/qcssparser.pro b/tests/auto/qcssparser/qcssparser.pro
index ce1281f..674064f 100644
--- a/tests/auto/qcssparser/qcssparser.pro
+++ b/tests/auto/qcssparser/qcssparser.pro
@@ -3,7 +3,6 @@ SOURCES += tst_qcssparser.cpp
QT += xml
requires(contains(QT_CONFIG,private_tests))
-
!symbian: {
DEFINES += SRCDIR=\\\"$$PWD\\\"
}
@@ -11,5 +10,8 @@ requires(contains(QT_CONFIG,private_tests))
wince*|symbian: {
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 c7f50d4..150f131 100644
--- a/tests/auto/qcssparser/tst_qcssparser.cpp
+++ b/tests/auto/qcssparser/tst_qcssparser.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include <QtTest/QtTest>
#include <QtXml/QtXml>
+#if defined(Q_OS_WINCE)
+#include <QtGui/QFontDatabase>
+#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<QString>("input");