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. Change-Id: Ie06f91f7857130f08fd484a6e7319ddfd16c546b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 366b4d3ae7783a055a6b1d6fe18470169cb6f8f3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
14d8d5099e
commit
e27d14bd55
@ -104,10 +104,12 @@ private:
|
|||||||
// move a dock widget
|
// move a dock widget
|
||||||
void moveDockWidget(QDockWidget* dw, QPoint to, QPoint from = QPoint()) const;
|
void moveDockWidget(QDockWidget* dw, QPoint to, QPoint from = QPoint()) const;
|
||||||
|
|
||||||
|
#ifdef QT_BUILD_INTERNAL
|
||||||
// Message handling for xcb error QTBUG 82059
|
// Message handling for xcb error QTBUG 82059
|
||||||
static void xcbMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg);
|
static void xcbMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg);
|
||||||
public:
|
public:
|
||||||
bool xcbError = false;
|
bool xcbError = false;
|
||||||
|
#endif
|
||||||
private:
|
private:
|
||||||
|
|
||||||
#ifdef QT_DEBUG
|
#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
|
// Testing get/set functions
|
||||||
void tst_QDockWidget::getSetCheck()
|
void tst_QDockWidget::getSetCheck()
|
||||||
{
|
{
|
||||||
@ -1307,20 +1304,6 @@ bool tst_QDockWidget::checkFloatingTabs(QMainWindow* mainWindow, QPointer<QDockW
|
|||||||
return true;
|
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
|
#endif // QT_BUILD_INTERNAL
|
||||||
|
|
||||||
// test floating tabs and item_tree consistency
|
// test floating tabs and item_tree consistency
|
||||||
@ -1450,6 +1433,27 @@ void tst_QDockWidget::floatingTabs()
|
|||||||
#endif // QT_BUILD_INTERNAL
|
#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
|
// test hide & show
|
||||||
void tst_QDockWidget::hideAndShow()
|
void tst_QDockWidget::hideAndShow()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user