Use QFINDTESTDATA in tst_qfontdatabase.
Change-Id: I851dbe18cd3ba9a07ddac71d23e04f5211b2db17 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
parent
bf42eacc7f
commit
0b9c942f3d
@ -2,7 +2,6 @@ CONFIG += testcase
|
||||
CONFIG += parallel_test
|
||||
TARGET = tst_qfontdatabase
|
||||
SOURCES += tst_qfontdatabase.cpp
|
||||
DEFINES += SRCDIR=\\\"$$PWD\\\"
|
||||
QT += testlib
|
||||
!mac: QT += core-private gui-private
|
||||
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
virtual ~tst_QFontDatabase();
|
||||
|
||||
public slots:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
private slots:
|
||||
@ -75,13 +76,14 @@ private slots:
|
||||
void addAppFont();
|
||||
|
||||
void aliases();
|
||||
|
||||
private:
|
||||
const QString m_testFont;
|
||||
};
|
||||
|
||||
tst_QFontDatabase::tst_QFontDatabase()
|
||||
: m_testFont(QFINDTESTDATA("FreeMono.ttf"))
|
||||
{
|
||||
#ifndef Q_OS_IRIX
|
||||
QDir::setCurrent(SRCDIR);
|
||||
#endif
|
||||
}
|
||||
|
||||
tst_QFontDatabase::~tst_QFontDatabase()
|
||||
@ -89,6 +91,11 @@ tst_QFontDatabase::~tst_QFontDatabase()
|
||||
|
||||
}
|
||||
|
||||
void tst_QFontDatabase::initTestCase()
|
||||
{
|
||||
QVERIFY(!m_testFont.isEmpty());
|
||||
}
|
||||
|
||||
void tst_QFontDatabase::init()
|
||||
{
|
||||
// TODO: Add initialization code here.
|
||||
@ -230,13 +237,13 @@ void tst_QFontDatabase::addAppFont()
|
||||
|
||||
int id;
|
||||
if (useMemoryFont) {
|
||||
QFile fontfile("FreeMono.ttf");
|
||||
QFile fontfile(m_testFont);
|
||||
fontfile.open(QIODevice::ReadOnly);
|
||||
QByteArray fontdata = fontfile.readAll();
|
||||
QVERIFY(!fontdata.isEmpty());
|
||||
id = QFontDatabase::addApplicationFontFromData(fontdata);
|
||||
} else {
|
||||
id = QFontDatabase::addApplicationFont("FreeMono.ttf");
|
||||
id = QFontDatabase::addApplicationFont(m_testFont);
|
||||
}
|
||||
#if defined(Q_OS_HPUX) && defined(QT_NO_FONTCONFIG)
|
||||
// Documentation says that X11 systems that don't have fontconfig
|
||||
|
Loading…
Reference in New Issue
Block a user