summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel/qtooltip
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-09-08 15:29:51 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-09-09 19:22:55 +0000
commit2b8a6d026d2a9fed48847d9759a1b07ec34418a1 (patch)
tree22b4f0d0473eb40fdeb8b3cdb9a2a356998cd9b7 /tests/auto/widgets/kernel/qtooltip
parentba8d1da4a971a6351318e86fc613f74843bb2c49 (diff)
Unskip QToolTip::keyEvent test on macOS
The test was failing because it didn't account for the platform behavior. Task-number: QTBUG-30040 Pick-to: 6.2 Change-Id: I7c523c06f0bfa459c1532cee721718bebc1858c4 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'tests/auto/widgets/kernel/qtooltip')
-rw-r--r--tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp33
1 files changed, 18 insertions, 15 deletions
diff --git a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
index 092adc58af..8e4e2a0ea4 100644
--- a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
+++ b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
@@ -43,8 +43,8 @@ class tst_QToolTip : public QObject
private slots:
void init();
void cleanup();
- void task183679_data();
- void task183679();
+ void keyEvent_data();
+ void keyEvent();
void whatsThis();
void setPalette();
void qtbug64550_stylesheet();
@@ -62,11 +62,11 @@ void tst_QToolTip::cleanup()
qApp->setStyleSheet(QString());
}
-class Widget_task183679 : public QWidget
+class Widget : public QWidget
{
Q_OBJECT
public:
- Widget_task183679(QWidget *parent = nullptr) : QWidget(parent) {}
+ Widget(QWidget *parent = nullptr) : QWidget(parent) {}
void showDelayedToolTip(int msecs)
{
@@ -78,25 +78,32 @@ public:
private slots:
void showToolTip()
{
- QToolTip::showText(mapToGlobal(QPoint(0, 0)), Widget_task183679::toolTipText(), this);
+ QToolTip::showText(mapToGlobal(QPoint(0, 0)), Widget::toolTipText(), this);
}
};
Q_DECLARE_METATYPE(Qt::Key)
-void tst_QToolTip::task183679_data()
+void tst_QToolTip::keyEvent_data()
{
QTest::addColumn<Qt::Key>("key");
QTest::addColumn<bool>("visible");
- QTest::newRow("non-modifier") << Qt::Key_A << true;
+ QTest::newRow("non-modifier") << Qt::Key_A <<
+#if defined(Q_OS_MACOS)
+ // macOS natively hides tooltips on non-modifier key events,
+ // so QTipLabel::eventFilter does the same. Match that here.
+ false;
+#else
+ true;
+#endif
QTest::newRow("Shift") << Qt::Key_Shift << true;
QTest::newRow("Control") << Qt::Key_Control << true;
QTest::newRow("Alt") << Qt::Key_Alt << true;
QTest::newRow("Meta") << Qt::Key_Meta << true;
}
-void tst_QToolTip::task183679()
+void tst_QToolTip::keyEvent()
{
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
@@ -104,11 +111,7 @@ void tst_QToolTip::task183679()
QFETCH(Qt::Key, key);
QFETCH(bool, visible);
-#ifdef Q_OS_MAC
- QSKIP("This test fails in the CI system, QTBUG-30040");
-#endif
-
- Widget_task183679 widget;
+ Widget widget;
widget.move(QGuiApplication::primaryScreen()->availableGeometry().topLeft() + QPoint(50, 50));
// Ensure cursor is not over tooltip, which causes it to hide
#ifndef QT_NO_CURSOR
@@ -208,7 +211,7 @@ void tst_QToolTip::qtbug64550_stylesheet()
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
- Widget_task183679 widget;
+ Widget widget;
widget.setStyleSheet(QStringLiteral("* { font-size: 48pt; }\n"));
widget.show();
QApplication::setActiveWindow(&widget);
@@ -220,7 +223,7 @@ void tst_QToolTip::qtbug64550_stylesheet()
QVERIFY(toolTip);
QTRY_VERIFY(toolTip->isVisible());
- const QRect boundingRect = QFontMetrics(widget.font()).boundingRect(Widget_task183679::toolTipText());
+ const QRect boundingRect = QFontMetrics(widget.font()).boundingRect(Widget::toolTipText());
const QSize toolTipSize = toolTip->size();
QVERIFY2(toolTipSize.width() >= boundingRect.width()
&& toolTipSize.height() >= boundingRect.height(),