418 connect(&iface, SIGNAL(signal()), SLOT(signalSpySlot())); |
423 connect(&iface, SIGNAL(signal()), SLOT(signalSpySlot())); |
419 |
424 |
420 QTest::qWait(100); |
425 QTest::qWait(100); |
421 QCOMPARE(signalSpy, 0); |
426 QCOMPARE(signalSpy, 0); |
422 |
427 |
423 functionSpy = 0; |
428 functionSpy = NoMethod; |
424 threadSpy = 0; |
429 threadSpy = 0; |
425 QDBusReply<void> reply = iface.call("method"); |
430 QDBusReply<void> reply = iface.call("method"); |
426 QVERIFY(reply.isValid()); |
431 QVERIFY(reply.isValid()); |
427 QCOMPARE(functionSpy, "void Object::method()"); |
432 QCOMPARE(functionSpy, Object_method); |
428 QCOMPARE(threadSpy, th); |
433 QCOMPARE(threadSpy, th); |
429 |
434 |
430 QTest::qWait(100); |
435 QTest::qWait(100); |
431 QCOMPARE(signalSpy, 1); |
436 QCOMPARE(signalSpy, 1); |
432 |
437 |
433 sem2.acquire(); // the object is gone |
438 sem2.acquire(); // the object is gone |
434 functionSpy = 0; |
439 functionSpy = NoMethod; |
435 threadSpy = 0; |
440 threadSpy = 0; |
436 reply = iface.call("method"); |
441 reply = iface.call("method"); |
437 QVERIFY(!reply.isValid()); |
442 QVERIFY(!reply.isValid()); |
438 QCOMPARE(functionSpy, (const char*)0); |
443 QCOMPARE(functionSpy, NoMethod); |
439 QCOMPARE(threadSpy, (QThread*)0); |
444 QCOMPARE(threadSpy, (QThread*)0); |
440 } |
445 } |
441 |
446 |
442 void tst_QDBusThreading::registerAdaptorInOtherThread_thread() |
447 void tst_QDBusThreading::registerAdaptorInOtherThread_thread() |
443 { |
448 { |
466 |
471 |
467 signalSpy = 0; |
472 signalSpy = 0; |
468 connect(&adaptor, SIGNAL(signal()), SLOT(signalSpySlot())); |
473 connect(&adaptor, SIGNAL(signal()), SLOT(signalSpySlot())); |
469 QCOMPARE(signalSpy, 0); |
474 QCOMPARE(signalSpy, 0); |
470 |
475 |
471 functionSpy = 0; |
476 functionSpy = NoMethod; |
472 threadSpy = 0; |
477 threadSpy = 0; |
473 QDBusReply<void> reply = adaptor.call("method"); |
478 QDBusReply<void> reply = adaptor.call("method"); |
474 QVERIFY(reply.isValid()); |
479 QVERIFY(reply.isValid()); |
475 QCOMPARE(functionSpy, "void Adaptor::method()"); |
480 QCOMPARE(functionSpy, Adaptor_method); |
476 QCOMPARE(threadSpy, th); |
481 QCOMPARE(threadSpy, th); |
477 |
482 |
478 QTest::qWait(100); |
483 QTest::qWait(100); |
479 QCOMPARE(signalSpy, 1); |
484 QCOMPARE(signalSpy, 1); |
480 |
485 |
481 functionSpy = 0; |
486 functionSpy = NoMethod; |
482 threadSpy = 0; |
487 threadSpy = 0; |
483 reply = object.call("method"); |
488 reply = object.call("method"); |
484 QVERIFY(reply.isValid()); |
489 QVERIFY(reply.isValid()); |
485 QCOMPARE(functionSpy, "void Object::method()"); |
490 QCOMPARE(functionSpy, Object_method); |
486 QCOMPARE(threadSpy, th); |
491 QCOMPARE(threadSpy, th); |
487 |
492 |
488 QTest::qWait(100); |
493 QTest::qWait(100); |
489 QCOMPARE(signalSpy, 1); |
494 QCOMPARE(signalSpy, 1); |
490 |
495 |
491 sem2.acquire(); // the object is gone |
496 sem2.acquire(); // the object is gone |
492 functionSpy = 0; |
497 functionSpy = NoMethod; |
493 threadSpy = 0; |
498 threadSpy = 0; |
494 reply = adaptor.call("method"); |
499 reply = adaptor.call("method"); |
495 QVERIFY(!reply.isValid()); |
500 QVERIFY(!reply.isValid()); |
496 QCOMPARE(functionSpy, (const char*)0); |
501 QCOMPARE(functionSpy, NoMethod); |
497 QCOMPARE(threadSpy, (QThread*)0); |
502 QCOMPARE(threadSpy, (QThread*)0); |
498 reply = object.call("method"); |
503 reply = object.call("method"); |
499 QVERIFY(!reply.isValid()); |
504 QVERIFY(!reply.isValid()); |
500 QCOMPARE(functionSpy, (const char*)0); |
505 QCOMPARE(functionSpy, NoMethod); |
501 QCOMPARE(threadSpy, (QThread*)0); |
506 QCOMPARE(threadSpy, (QThread*)0); |
502 } |
507 } |
503 |
508 |
504 void tst_QDBusThreading::callbackInMainThread_thread() |
509 void tst_QDBusThreading::callbackInMainThread_thread() |
505 { |
510 { |