equal
deleted
inserted
replaced
155 received = arg; |
155 received = arg; |
156 ++count; |
156 ++count; |
157 } |
157 } |
158 }; |
158 }; |
159 |
159 |
|
160 class DerivedFromQDBusInterface: public QDBusInterface |
|
161 { |
|
162 Q_OBJECT |
|
163 public: |
|
164 DerivedFromQDBusInterface() |
|
165 : QDBusInterface("com.example.Test", "/") |
|
166 {} |
|
167 |
|
168 public slots: |
|
169 void method() {} |
|
170 }; |
|
171 |
160 // helper function |
172 // helper function |
161 void emitSignal(const QString &interface, const QString &name, const QString &arg) |
173 void emitSignal(const QString &interface, const QString &name, const QString &arg) |
162 { |
174 { |
163 QDBusMessage msg = QDBusMessage::createSignal("/", interface, name); |
175 QDBusMessage msg = QDBusMessage::createSignal("/", interface, name); |
164 msg << arg; |
176 msg << arg; |
181 private slots: |
193 private slots: |
182 void initTestCase(); |
194 void initTestCase(); |
183 |
195 |
184 void notConnected(); |
196 void notConnected(); |
185 void notValid(); |
197 void notValid(); |
|
198 void notValidDerived(); |
186 void invalidAfterServiceOwnerChanged(); |
199 void invalidAfterServiceOwnerChanged(); |
187 void introspect(); |
200 void introspect(); |
188 void callMethod(); |
201 void callMethod(); |
189 void invokeMethod(); |
202 void invokeMethod(); |
190 void invokeMethodWithReturn(); |
203 void invokeMethodWithReturn(); |
217 |
230 |
218 QDBusInterface interface("org.freedesktop.DBus", "/", "org.freedesktop.DBus", |
231 QDBusInterface interface("org.freedesktop.DBus", "/", "org.freedesktop.DBus", |
219 connection); |
232 connection); |
220 |
233 |
221 QVERIFY(!interface.isValid()); |
234 QVERIFY(!interface.isValid()); |
|
235 QVERIFY(!QMetaObject::invokeMethod(&interface, "ListNames", Qt::DirectConnection)); |
222 } |
236 } |
223 |
237 |
224 void tst_QDBusInterface::notValid() |
238 void tst_QDBusInterface::notValid() |
225 { |
239 { |
226 QDBusConnection connection(""); |
240 QDBusConnection connection(""); |
228 |
242 |
229 QDBusInterface interface("com.example.Test", QString(), "org.example.Test", |
243 QDBusInterface interface("com.example.Test", QString(), "org.example.Test", |
230 connection); |
244 connection); |
231 |
245 |
232 QVERIFY(!interface.isValid()); |
246 QVERIFY(!interface.isValid()); |
|
247 QVERIFY(!QMetaObject::invokeMethod(&interface, "ListNames", Qt::DirectConnection)); |
|
248 } |
|
249 |
|
250 void tst_QDBusInterface::notValidDerived() |
|
251 { |
|
252 DerivedFromQDBusInterface c; |
|
253 QVERIFY(!c.isValid()); |
|
254 QMetaObject::invokeMethod(&c, "method", Qt::DirectConnection); |
233 } |
255 } |
234 |
256 |
235 void tst_QDBusInterface::invalidAfterServiceOwnerChanged() |
257 void tst_QDBusInterface::invalidAfterServiceOwnerChanged() |
236 { |
258 { |
237 // this test is technically the same as tst_QDBusAbstractInterface::followSignal |
259 // this test is technically the same as tst_QDBusAbstractInterface::followSignal |