tests: Move isGammaray() into Platform_qt

This commit is contained in:
Sergio Martins
2022-04-29 15:52:46 +01:00
parent 721d344533
commit fcf02fc8bf
3 changed files with 11 additions and 8 deletions

View File

@@ -186,4 +186,12 @@ void Platform_qt::tests_deinitPlatform_impl()
delete qApp;
}
/*static*/
extern quintptr Q_CORE_EXPORT qtHookData[];
bool Platform_qt::isGammaray()
{
static bool is = qtHookData[3] != 0;
return is;
}
#endif

View File

@@ -34,6 +34,7 @@ public:
void sendEvent(View *, QEvent *) const override;
#ifdef DOCKS_DEVELOPER_MODE
static bool isGammaray();
bool tests_waitForWindowActive(std::shared_ptr<Window>, int timeout = 5000) const override;
bool tests_waitForEvent(QObject *w, QEvent::Type type, int timeout = 5000) const override;
bool tests_waitForEvent(View *, QEvent::Type type, int timeout = 5000) const override;

View File

@@ -11,6 +11,7 @@
#include "Testing.h"
#include "DockRegistry_p.h"
#include "qtcommon/Platform_qt.h"
#include <QGuiApplication>
#include <QTest>
@@ -23,17 +24,10 @@ using namespace KDDockWidgets;
using namespace KDDockWidgets::Controllers;
using namespace KDDockWidgets::Testing;
extern quintptr Q_CORE_EXPORT qtHookData[];
static QString s_expectedWarning;
static WarningObserver *s_warningObserver = nullptr;
static QtMessageHandler s_original = nullptr;
static bool isGammaray()
{
static bool is = qtHookData[3] != 0;
return is;
}
static bool shouldBlacklistWarning(const QString &msg, const QString &category)
{
if (category == QLatin1String("qt.qpa.xcb"))
@@ -70,7 +64,7 @@ static void fatalWarningsMessageHandler(QtMsgType t, const QMessageLogContext &c
if (!s_expectedWarning.isEmpty() && msg.contains(s_expectedWarning))
return;
if (!isGammaray() && !qEnvironmentVariableIsSet("NO_FATAL")) {
if (!Platform_qt::isGammaray() && !qEnvironmentVariableIsSet("NO_FATAL")) {
if (s_warningObserver)
s_warningObserver->onFatal();