summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-11-19 10:45:32 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-11-19 10:53:19 (GMT)
commit65e00180516eb136c2a7119dfe9e63fc9c66065e (patch)
treeea7e581652400c895a16e4ac563bf8cf21c02bb9
parentb1196d5733ae01660e4345a5bbecd9c1b32238a4 (diff)
downloadQt-65e00180516eb136c2a7119dfe9e63fc9c66065e.zip
Qt-65e00180516eb136c2a7119dfe9e63fc9c66065e.tar.gz
Qt-65e00180516eb136c2a7119dfe9e63fc9c66065e.tar.bz2
Autotest: Change the service name we're testing between tests.
Otherwise, we get errors from one test to the next, due to the cleanup unregistering the name again. Task-number: QT-5588
-rw-r--r--tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp b/tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp
index 10b43b1..ac0f806 100644
--- a/tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp
+++ b/tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp
@@ -47,12 +47,13 @@ class tst_QDBusServiceWatcher: public QObject
{
Q_OBJECT
QString serviceName;
+ int testCounter;
public:
tst_QDBusServiceWatcher();
private slots:
void initTestCase();
- void cleanup();
+ void init();
void watchForCreation();
void watchForDisappearance();
@@ -61,7 +62,7 @@ private slots:
};
tst_QDBusServiceWatcher::tst_QDBusServiceWatcher()
- : serviceName("com.example.TestName")
+ : testCounter(0)
{
}
@@ -71,10 +72,10 @@ void tst_QDBusServiceWatcher::initTestCase()
QVERIFY(con.isConnected());
}
-void tst_QDBusServiceWatcher::cleanup()
+void tst_QDBusServiceWatcher::init()
{
- // ensure that the name isn't registered
- QDBusConnection::sessionBus().unregisterService(serviceName);
+ // change the service name from test to test
+ serviceName = "com.example.TestService" + QString::number(testCounter++);
}
void tst_QDBusServiceWatcher::watchForCreation()
@@ -135,6 +136,7 @@ void tst_QDBusServiceWatcher::watchForDisappearance()
QVERIFY(con.isConnected());
QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForUnregistration);
+ watcher.setObjectName("watcher for disappearance");
QSignalSpy spyR(&watcher, SIGNAL(serviceRegistered(QString)));
QSignalSpy spyU(&watcher, SIGNAL(serviceUnregistered(QString)));