diff options
author | Jens Bache-Wiig <jbache@trolltech.com> | 2009-09-14 11:21:22 (GMT) |
---|---|---|
committer | Jens Bache-Wiig <jbache@trolltech.com> | 2009-09-14 11:29:01 (GMT) |
commit | c5a8d26d2337c3ed01f66783b69c5090c515be38 (patch) | |
tree | 9275c0da1f8deadf9b24ba9ec5c1eca91c5318c6 /tests/auto/qtooltip/tst_qtooltip.cpp | |
parent | 53ea5e98eab90ee9e3ae23e3b67e8993e6c2b31c (diff) | |
download | Qt-c5a8d26d2337c3ed01f66783b69c5090c515be38.zip Qt-c5a8d26d2337c3ed01f66783b69c5090c515be38.tar.gz Qt-c5a8d26d2337c3ed01f66783b69c5090c515be38.tar.bz2 |
Fix whatsThis breakage when using custom style sheet font
When setting a large font using style sheets, the whats this
popup size calculation would be incorrect resulting in
half visible lables. By calling ensurePolished before showing the
label, we ensure that this will be properly handled.
We also added a new test case for whatsThis in tst_qtooltip
Task-number: QTBUG-2416
Reviewed-by: ogoffart
Diffstat (limited to 'tests/auto/qtooltip/tst_qtooltip.cpp')
-rw-r--r-- | tests/auto/qtooltip/tst_qtooltip.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qtooltip/tst_qtooltip.cpp b/tests/auto/qtooltip/tst_qtooltip.cpp index 283effa..fc76069 100644 --- a/tests/auto/qtooltip/tst_qtooltip.cpp +++ b/tests/auto/qtooltip/tst_qtooltip.cpp @@ -66,6 +66,7 @@ private slots: // task-specific tests below me void task183679_data(); void task183679(); + void whatsThis(); void setPalette(); }; @@ -131,6 +132,27 @@ void tst_QToolTip::task183679() QCOMPARE(QToolTip::isVisible(), visible); } +#include <QWhatsThis> + +void tst_QToolTip::whatsThis() +{ + qApp->setStyleSheet( "QWidget { font-size: 72px; }" ); + QWhatsThis::showText(QPoint(0,0), "THis is text"); + QTest::qWait(400); + QWidget *whatsthis = 0; + foreach (QWidget *widget, QApplication::topLevelWidgets()) { + if (widget->inherits("QWhatsThat")) { + whatsthis = widget; + break; + } + } + QVERIFY(whatsthis); + QVERIFY(whatsthis->isVisible()); + QVERIFY(whatsthis->height() > 100); // Test QTBUG-2416 + qApp->setStyleSheet(""); +} + + void tst_QToolTip::setPalette() { //the previous test may still have a tooltip pending for deletion |