summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-09-26 12:36:43 +0200
committerAllan Sandfeld Jensen <allan.jensen@digia.com>2014-10-01 15:30:43 +0200
commit0175ad4d3ff3de93645b4a8b300ef3b7d6e15c04 (patch)
tree717da251e067cf98c52c410c644fe77d989fd2f1 /tests/auto/gui
parentf5f300ba820f8e6a268790e76d5cdb084853a099 (diff)
Fix regression in metric calculation of text with mnemonics
Even when we do not intend to display the text, we still need to go through the processing of mnemonics to remove them from the text. Instead of capping the max underlines to 0, the TextDontPrint option now just saves adding the underline formats. Task-number: QTBUG-41593 Change-Id: I67790650dbed0092de2c63e5d5a9349dc02d5846 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Robert Loehning <robert.loehning@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
index 3effeb895e..5c2c805506 100644
--- a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
+++ b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
@@ -64,6 +64,7 @@ private slots:
void elidedMultiLengthF();
void inFontUcs4();
void lineWidth();
+ void mnemonicTextWidth();
};
tst_QFontMetrics::tst_QFontMetrics()
@@ -331,5 +332,16 @@ void tst_QFontMetrics::lineWidth()
QVERIFY(smallFontMetrics.lineWidth() < bigFontMetrics.lineWidth());
}
+void tst_QFontMetrics::mnemonicTextWidth()
+{
+ // QTBUG-41593
+ QFont f;
+ QFontMetrics fm(f);
+ const QString f1 = "File";
+ const QString f2 = "&File";
+
+ QCOMPARE(fm.size(Qt::TextShowMnemonic, f1), fm.size(Qt::TextShowMnemonic, f2));
+ QCOMPARE(fm.size(Qt::TextHideMnemonic, f1), fm.size(Qt::TextHideMnemonic, f2));
+}
QTEST_MAIN(tst_QFontMetrics)
#include "tst_qfontmetrics.moc"