diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-11-11 14:57:11 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-11-11 15:16:41 (GMT) |
commit | 2b6fd0a7bdac686a41d7fbbe47ad3ded9e1d77b5 (patch) | |
tree | be33c57eabcb3dc2ac58b950478317b2191114e4 | |
parent | ad5f41c02daa0278902d0e8273c8cd34efd2d6da (diff) | |
download | Qt-2b6fd0a7bdac686a41d7fbbe47ad3ded9e1d77b5.zip Qt-2b6fd0a7bdac686a41d7fbbe47ad3ded9e1d77b5.tar.gz Qt-2b6fd0a7bdac686a41d7fbbe47ad3ded9e1d77b5.tar.bz2 |
Small caps font variant wouldn't be used when defined through style sheets
The font comparison (operator==) didn't check the capital attribute, which is
the one responsible for this variant. Now it does. Auto-test updated.
Reviewed-by: Samuel
Reviewed-by: Olivier
-rw-r--r-- | src/gui/text/qfont.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qfont/tst_qfont.cpp | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 447087c..f1cd6bb 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1613,7 +1613,8 @@ bool QFont::operator==(const QFont &f) const && f.d->underline == d->underline && f.d->overline == d->overline && f.d->strikeOut == d->strikeOut - && f.d->kerning == d->kerning)); + && f.d->kerning == d->kerning + && f.d->capital == d->capital)); } @@ -1645,6 +1646,7 @@ bool QFont::operator<(const QFont &f) const #ifdef Q_WS_X11 if (r1.addStyle != r2.addStyle) return r1.addStyle < r2.addStyle; #endif // Q_WS_X11 + if (f.d->capital != d->capital) return f.d->capital < d->capital; int f1attrs = (f.d->underline << 3) + (f.d->overline << 2) + (f.d->strikeOut<<1) + f.d->kerning; int f2attrs = (d->underline << 3) + (d->overline << 2) + (d->strikeOut<<1) + d->kerning; diff --git a/tests/auto/qfont/tst_qfont.cpp b/tests/auto/qfont/tst_qfont.cpp index fa76e44..5622e10 100644 --- a/tests/auto/qfont/tst_qfont.cpp +++ b/tests/auto/qfont/tst_qfont.cpp @@ -395,6 +395,13 @@ void tst_QFont::compare() font.setOverline(false); QVERIFY( font == font2 ); QVERIFY(!(font < font2)); + + font.setCapitalization(QFont::SmallCaps); + QVERIFY( font != font2 ); + QCOMPARE(font < font2,!(font2 < font)); + font.setCapitalization(QFont::MixedCase); + QVERIFY( font == font2 ); + QVERIFY(!(font < font2)); } #if defined(Q_WS_X11) |