summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qdockwidget
diff options
context:
space:
mode:
authorAxel Spoerl <axel.spoerl@qt.io>2023-08-17 14:51:01 +0200
committerAxel Spoerl <axel.spoerl@qt.io>2023-08-22 15:37:46 +0200
commit366b4d3ae7783a055a6b1d6fe18470169cb6f8f3 (patch)
tree56cdfad4158d7476f31e4ca85efc9f3795f3ee8f /tests/auto/widgets/widgets/qdockwidget
parent108d2e44867acfa98c3b0c211d9b48f39d10efa9 (diff)
tst_QDockWidget: Fix compiler warning in non-development build
Static variables for a message handler were used only in developer build, while they were declared unconditionally. That has lead to compiler warnings about unused variables in a non developer build. => declare them only in developer build => move assignment and static method in front of the method, that uses them. Pick-to: 6.6 6.5 Change-Id: Ie06f91f7857130f08fd484a6e7319ddfd16c546b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/widgets/widgets/qdockwidget')
-rw-r--r--tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp42
1 files changed, 23 insertions, 19 deletions
diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
index 0de5fadfc5..61f8bf995b 100644
--- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
+++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
@@ -104,10 +104,12 @@ private:
// move a dock widget
void moveDockWidget(QDockWidget* dw, QPoint to, QPoint from = QPoint()) const;
+#ifdef QT_BUILD_INTERNAL
// Message handling for xcb error QTBUG 82059
static void xcbMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg);
public:
bool xcbError = false;
+#endif
private:
#ifdef QT_DEBUG
@@ -128,11 +130,6 @@ private:
};
-// Statics for xcb error / msg handler
-static tst_QDockWidget *qThis = nullptr;
-static void (*oldMessageHandler)(QtMsgType, const QMessageLogContext&, const QString&);
-#define QXCBVERIFY(cond) do { if (xcbError) QSKIP("Test skipped due to XCB error"); QVERIFY(cond); } while (0)
-
// Testing get/set functions
void tst_QDockWidget::getSetCheck()
{
@@ -1307,20 +1304,6 @@ bool tst_QDockWidget::checkFloatingTabs(QMainWindow* mainWindow, QPointer<QDockW
return true;
}
-// detect xcb error
-// qt.qpa.xcb: internal error: void QXcbWindow::setNetWmStateOnUnmappedWindow() called on mapped window
-void tst_QDockWidget::xcbMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
-{
- Q_ASSERT(oldMessageHandler);
-
- if (type == QtWarningMsg && QString(context.category) == "qt.qpa.xcb" && msg.contains("internal error")) {
- Q_ASSERT(qThis);
- qThis->xcbError = true;
- }
-
- return oldMessageHandler(type, context, msg);
-}
-
#endif // QT_BUILD_INTERNAL
// test floating tabs and item_tree consistency
@@ -1450,6 +1433,27 @@ void tst_QDockWidget::floatingTabs()
#endif // QT_BUILD_INTERNAL
}
+#ifdef QT_BUILD_INTERNAL
+// Statics for xcb error / msg handler
+static tst_QDockWidget *qThis = nullptr;
+static void (*oldMessageHandler)(QtMsgType, const QMessageLogContext&, const QString&);
+#define QXCBVERIFY(cond) do { if (xcbError) QSKIP("Test skipped due to XCB error"); QVERIFY(cond); } while (0)
+
+// detect xcb error
+// qt.qpa.xcb: internal error: void QXcbWindow::setNetWmStateOnUnmappedWindow() called on mapped window
+void tst_QDockWidget::xcbMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
+{
+ Q_ASSERT(oldMessageHandler);
+
+ if (type == QtWarningMsg && QString(context.category) == "qt.qpa.xcb" && msg.contains("internal error")) {
+ Q_ASSERT(qThis);
+ qThis->xcbError = true;
+ }
+
+ return oldMessageHandler(type, context, msg);
+}
+#endif // QT_BUILD_INTERNAL
+
// test hide & show
void tst_QDockWidget::hideAndShow()
{