qt6windows7/tests/auto/dbus/qdbusconnection_spyhook/tst_qdbusconnection_spyhook.cpp

28 lines
696 B
C++
Raw Normal View History

2023-10-30 06:33:08 +08:00
// Copyright (C) 2016 Intel Corporation.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtDBus/QDBusMessage>
#define HAS_HOOKSETUPFUNCTION 1
static void hookSetupFunction();
// Ugly hack, look away
#include "../qdbusconnection/tst_qdbusconnection.cpp"
QT_BEGIN_NAMESPACE
extern Q_DBUS_EXPORT void qDBusAddSpyHook(void (*Hook)(const QDBusMessage&));
QT_END_NAMESPACE
static void hookFunction(const QDBusMessage &)
{
// qDebug() << "hook called";
++tst_QDBusConnection::hookCallCount;
}
static void hookSetupFunction()
{
QT_PREPEND_NAMESPACE(qDBusAddSpyHook)(hookFunction);
}
QTEST_MAIN(tst_QDBusConnection_SpyHook)