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
|
CONFIG += parallel_test
|
||||||
TARGET = tst_qfontdatabase
|
TARGET = tst_qfontdatabase
|
||||||
SOURCES += tst_qfontdatabase.cpp
|
SOURCES += tst_qfontdatabase.cpp
|
||||||
DEFINES += SRCDIR=\\\"$$PWD\\\"
|
|
||||||
QT += testlib
|
QT += testlib
|
||||||
!mac: QT += core-private gui-private
|
!mac: QT += core-private gui-private
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ public:
|
|||||||
virtual ~tst_QFontDatabase();
|
virtual ~tst_QFontDatabase();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void initTestCase();
|
||||||
void init();
|
void init();
|
||||||
void cleanup();
|
void cleanup();
|
||||||
private slots:
|
private slots:
|
||||||
@ -75,13 +76,14 @@ private slots:
|
|||||||
void addAppFont();
|
void addAppFont();
|
||||||
|
|
||||||
void aliases();
|
void aliases();
|
||||||
|
|
||||||
|
private:
|
||||||
|
const QString m_testFont;
|
||||||
};
|
};
|
||||||
|
|
||||||
tst_QFontDatabase::tst_QFontDatabase()
|
tst_QFontDatabase::tst_QFontDatabase()
|
||||||
|
: m_testFont(QFINDTESTDATA("FreeMono.ttf"))
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_IRIX
|
|
||||||
QDir::setCurrent(SRCDIR);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tst_QFontDatabase::~tst_QFontDatabase()
|
tst_QFontDatabase::~tst_QFontDatabase()
|
||||||
@ -89,6 +91,11 @@ tst_QFontDatabase::~tst_QFontDatabase()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_QFontDatabase::initTestCase()
|
||||||
|
{
|
||||||
|
QVERIFY(!m_testFont.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
void tst_QFontDatabase::init()
|
void tst_QFontDatabase::init()
|
||||||
{
|
{
|
||||||
// TODO: Add initialization code here.
|
// TODO: Add initialization code here.
|
||||||
@ -230,13 +237,13 @@ void tst_QFontDatabase::addAppFont()
|
|||||||
|
|
||||||
int id;
|
int id;
|
||||||
if (useMemoryFont) {
|
if (useMemoryFont) {
|
||||||
QFile fontfile("FreeMono.ttf");
|
QFile fontfile(m_testFont);
|
||||||
fontfile.open(QIODevice::ReadOnly);
|
fontfile.open(QIODevice::ReadOnly);
|
||||||
QByteArray fontdata = fontfile.readAll();
|
QByteArray fontdata = fontfile.readAll();
|
||||||
QVERIFY(!fontdata.isEmpty());
|
QVERIFY(!fontdata.isEmpty());
|
||||||
id = QFontDatabase::addApplicationFontFromData(fontdata);
|
id = QFontDatabase::addApplicationFontFromData(fontdata);
|
||||||
} else {
|
} else {
|
||||||
id = QFontDatabase::addApplicationFont("FreeMono.ttf");
|
id = QFontDatabase::addApplicationFont(m_testFont);
|
||||||
}
|
}
|
||||||
#if defined(Q_OS_HPUX) && defined(QT_NO_FONTCONFIG)
|
#if defined(Q_OS_HPUX) && defined(QT_NO_FONTCONFIG)
|
||||||
// Documentation says that X11 systems that don't have fontconfig
|
// Documentation says that X11 systems that don't have fontconfig
|
||||||
|
Loading…
x
Reference in New Issue
Block a user