mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-03 15:55:27 +08:00
6.5.3 clean
This commit is contained in:
@ -1412,6 +1412,39 @@ void tst_QDBusConnection::pendingCallWhenDisconnected()
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QDBusConnection::emptyServerAddress()
|
||||
{
|
||||
QDBusServer server({}, nullptr);
|
||||
}
|
||||
|
||||
void tst_QDBusConnection::parentClassSignal()
|
||||
{
|
||||
if (!QCoreApplication::instance())
|
||||
QSKIP("Test requires a QCoreApplication");
|
||||
|
||||
const QString path = "/path";
|
||||
|
||||
QDBusConnection con = QDBusConnection::sessionBus();
|
||||
QVERIFY(con.isConnected());
|
||||
|
||||
// register one object at root:
|
||||
MyObject obj;
|
||||
QVERIFY(con.registerObject(path, &obj, QDBusConnection::ExportAllContents));
|
||||
QCOMPARE(con.objectRegisteredAt(path), static_cast<QObject *>(&obj));
|
||||
|
||||
SignalReceiver recv;
|
||||
QVERIFY(con.connect(con.baseService(), path, "local.BaseObject", "baseObjectSignal", &recv,
|
||||
SLOT(oneSlot())));
|
||||
QVERIFY(con.connect(con.baseService(), path, "local.MyObject", "myObjectSignal", &recv,
|
||||
SLOT(oneSlot())));
|
||||
|
||||
emit obj.baseObjectSignal();
|
||||
QTRY_COMPARE(recv.signalsReceived, 1);
|
||||
|
||||
emit obj.myObjectSignal();
|
||||
QTRY_COMPARE(recv.signalsReceived, 2);
|
||||
}
|
||||
|
||||
QString MyObject::path;
|
||||
QString MyObjectWithoutInterface::path;
|
||||
QString MyObjectWithoutInterface::interface;
|
||||
|
@ -21,11 +21,14 @@ public:
|
||||
BaseObject(QObject *parent = nullptr) : QObject(parent) { }
|
||||
public slots:
|
||||
void anotherMethod() { }
|
||||
signals:
|
||||
void baseObjectSignal();
|
||||
};
|
||||
|
||||
class MyObject: public BaseObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", "local.MyObject")
|
||||
public slots:
|
||||
void method(const QDBusMessage &msg);
|
||||
|
||||
@ -33,6 +36,9 @@ public:
|
||||
static QString path;
|
||||
int callCount;
|
||||
MyObject(QObject *parent = nullptr) : BaseObject(parent), callCount(0) {}
|
||||
|
||||
signals:
|
||||
void myObjectSignal();
|
||||
};
|
||||
|
||||
class MyObjectWithoutInterface: public QObject
|
||||
@ -115,6 +121,10 @@ private slots:
|
||||
void callVirtualObjectLocal();
|
||||
void pendingCallWhenDisconnected();
|
||||
|
||||
void emptyServerAddress();
|
||||
|
||||
void parentClassSignal();
|
||||
|
||||
public:
|
||||
QString serviceName() const { return "org.qtproject.Qt.Autotests.QDBusConnection"; }
|
||||
bool callMethod(const QDBusConnection &conn, const QString &path);
|
||||
|
Reference in New Issue
Block a user