#include <qwidget.h>
#include <qlist.h>
#include <qbuffer.h>
+#include <qdebug.h>
//TESTED_CLASS=
//TESTED_FILES=
void tst_QFont::exactMatch()
{
- QFont font;
-
// Check if a non-existing font hasn't an exact match
- font = QFont( "BogusFont", 33 );
+ QFont font( "BogusFont", 33 );
QVERIFY( !font.exactMatch() );
#ifdef Q_WS_X11
- QVERIFY(QFont("sans").exactMatch());
- QVERIFY(QFont("sans-serif").exactMatch());
- QVERIFY(QFont("serif").exactMatch());
- QVERIFY(QFont("monospace").exactMatch());
+ bool sansseriftested = false;
+ bool sanstested = false;
+ bool seriftested = false;
+ bool monospacetested = false;
+ QFontDatabase fdb;
+ foreach (const QString &family, fdb.families()) {
+ if (family.compare("sans serif", Qt::CaseInsensitive) && !sansseriftested) {
+ qDebug() << "Checking sans-serif";
+ QVERIFY(QFont("sans-serif").exactMatch());
+ sansseriftested = true;
+ } else if (family.compare("sans", Qt::CaseInsensitive) && !sanstested) {
+ qDebug() << "Checking sans";
+ QVERIFY(QFont("sans").exactMatch());
+ sanstested = true;
+ } else if (family.compare("serif", Qt::CaseInsensitive) && !seriftested) {
+ qDebug() << "Checking serif";
+ QVERIFY(QFont("serif").exactMatch());
+ seriftested = true;
+ } else if (family.compare("monospace", Qt::CaseInsensitive) && !monospacetested) {
+ qDebug() << "Checking monospace";
+ QVERIFY(QFont("monospace").exactMatch());
+ monospacetested = true;
+ }
+ }
#endif
}