summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-11-19 10:45:32 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2009-11-20 13:44:36 (GMT)
commite99d75909354cdf58178618e121513a0a96f44d3 (patch)
tree6c8b0ebaba75cc071aae100c60380f915ef1e0bc /tests
parentdcf539f975ae4b3a2664af0b9bce0bf1eea6ab6a (diff)
downloadQt-e99d75909354cdf58178618e121513a0a96f44d3.zip
Qt-e99d75909354cdf58178618e121513a0a96f44d3.tar.gz
Qt-e99d75909354cdf58178618e121513a0a96f44d3.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 (cherry picked from commit 65e00180516eb136c2a7119dfe9e63fc9c66065e)
Diffstat (limited to 'tests')
-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 15496ce..cc0d226 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)));