summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2011-05-02 10:06:44 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2011-05-02 10:13:32 +0200
commitac4af55972291db96cc6bfa322dc7d35b67f7775 (patch)
treef7efca2b247901b9fd84f612b2b2649422d9b878 /tests
parentf26c4ba80dd927a705f5af03b915dcf1af8f351a (diff)
Make pixel size a qreal in QRawFont
The pixel size in the font engines is already a floating point value. For maximum flexibility, we should expose this in the public API. Task-number: QTBUG-18817 Reviewed-by: Jiang Jiang (cherry picked from commit ac9e63b58533a3215106ed9da82cff3a3e3dda3a)
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qrawfont/tst_qrawfont.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/tests/auto/qrawfont/tst_qrawfont.cpp b/tests/auto/qrawfont/tst_qrawfont.cpp
index 3aa4006b68..4b42c74bb7 100644
--- a/tests/auto/qrawfont/tst_qrawfont.cpp
+++ b/tests/auto/qrawfont/tst_qrawfont.cpp
@@ -104,7 +104,7 @@ void tst_QRawFont::invalidRawFont()
{
QRawFont font;
QVERIFY(!font.isValid());
- QCOMPARE(font.pixelSize(), -1);
+ QCOMPARE(font.pixelSize(), 0.0);
QVERIFY(font.familyName().isEmpty());
QCOMPARE(font.style(), QFont::StyleNormal);
QCOMPARE(font.weight(), -1);
@@ -165,7 +165,7 @@ void tst_QRawFont::correctFontData_data()
QTest::addColumn<QFont::Weight>("weight");
QTest::addColumn<QFont::HintingPreference>("hintingPreference");
QTest::addColumn<qreal>("unitsPerEm");
- QTest::addColumn<int>("pixelSize");
+ QTest::addColumn<qreal>("pixelSize");
int hintingPreferences[] = {
int(QFont::PreferDefaultHinting),
@@ -189,7 +189,7 @@ void tst_QRawFont::correctFontData_data()
<< QFont::Normal
<< QFont::HintingPreference(*hintingPreference)
<< 1000.0
- << 10;
+ << 10.0;
fileName = QLatin1String(SRCDIR "testfont_bold_italic.ttf");
title = fileName
@@ -203,7 +203,7 @@ void tst_QRawFont::correctFontData_data()
<< QFont::Bold
<< QFont::HintingPreference(*hintingPreference)
<< 1000.0
- << 10;
+ << 10.0;
++hintingPreference;
}
@@ -217,7 +217,7 @@ void tst_QRawFont::correctFontData()
QFETCH(QFont::Weight, weight);
QFETCH(QFont::HintingPreference, hintingPreference);
QFETCH(qreal, unitsPerEm);
- QFETCH(int, pixelSize);
+ QFETCH(qreal, pixelSize);
QRawFont font(fileName, 10, hintingPreference);
QVERIFY(font.isValid());
@@ -284,7 +284,7 @@ void tst_QRawFont::textLayout()
QString familyName = QString::fromLatin1("QtBidiTestFont");
QFont font(familyName);
- font.setPixelSize(18);
+ font.setPixelSize(18.0);
QCOMPARE(QFontInfo(font).family(), familyName);
QTextLayout layout(QLatin1String("Foobar"));
@@ -301,7 +301,7 @@ void tst_QRawFont::textLayout()
QRawFont rawFont = glyphs.font();
QVERIFY(rawFont.isValid());
QCOMPARE(rawFont.familyName(), familyName);
- QCOMPARE(rawFont.pixelSize(), 18);
+ QCOMPARE(rawFont.pixelSize(), 18.0);
QVector<quint32> expectedGlyphIndices;
expectedGlyphIndices << 44 << 83 << 83 << 70 << 69 << 86;
@@ -597,12 +597,12 @@ void tst_QRawFont::fromFont()
QFont font(familyName);
font.setHintingPreference(hintingPreference);
- font.setPixelSize(26);
+ font.setPixelSize(26.0);
QRawFont rawFont = QRawFont::fromFont(font, writingSystem);
QVERIFY(rawFont.isValid());
QCOMPARE(rawFont.familyName(), familyName);
- QCOMPARE(rawFont.pixelSize(), 26);
+ QCOMPARE(rawFont.pixelSize(), 26.0);
QVERIFY(fontDatabase.removeApplicationFont(id));
}
@@ -623,7 +623,7 @@ void tst_QRawFont::copyConstructor()
{
QString rawFontFamilyName;
- int rawFontPixelSize;
+ qreal rawFontPixelSize;
qreal rawFontAscent;
qreal rawFontDescent;
int rawFontTableSize;
@@ -691,7 +691,7 @@ void tst_QRawFont::detach()
{
QString rawFontFamilyName;
- int rawFontPixelSize;
+ qreal rawFontPixelSize;
qreal rawFontAscent;
qreal rawFontDescent;
int rawFontTableSize;
@@ -773,15 +773,15 @@ void tst_QRawFont::unsupportedWritingSystem()
QFont font("QtBidiTestFont");
font.setHintingPreference(hintingPreference);
- font.setPixelSize(12);
+ font.setPixelSize(12.0);
QRawFont rawFont = QRawFont::fromFont(font, QFontDatabase::Any);
QCOMPARE(rawFont.familyName(), QString::fromLatin1("QtBidiTestFont"));
- QCOMPARE(rawFont.pixelSize(), 12);
+ QCOMPARE(rawFont.pixelSize(), 12.0);
rawFont = QRawFont::fromFont(font, QFontDatabase::Hebrew);
QCOMPARE(rawFont.familyName(), QString::fromLatin1("QtBidiTestFont"));
- QCOMPARE(rawFont.pixelSize(), 12);
+ QCOMPARE(rawFont.pixelSize(), 12.0);
QString arabicText = QFontDatabase::writingSystemSample(QFontDatabase::Arabic);
@@ -798,11 +798,11 @@ void tst_QRawFont::unsupportedWritingSystem()
QGlyphs glyphs = glyphss.at(0);
QRawFont layoutFont = glyphs.font();
QVERIFY(layoutFont.familyName() != QString::fromLatin1("QtBidiTestFont"));
- QCOMPARE(layoutFont.pixelSize(), 12);
+ QCOMPARE(layoutFont.pixelSize(), 12.0);
rawFont = QRawFont::fromFont(font, QFontDatabase::Arabic);
QCOMPARE(rawFont.familyName(), layoutFont.familyName());
- QCOMPARE(rawFont.pixelSize(), 12);
+ QCOMPARE(rawFont.pixelSize(), 12.0);
fontDatabase.removeApplicationFont(id);
}