aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGergely Risko <gergely+context@risko.hu>2009-09-09 12:18:45 +0300
committerGergely Risko <gergely+context@risko.hu>2009-09-09 12:18:45 +0300
commit7f9af3a13a36b9ac2ba3b8cfa1d375758acf4251 (patch)
tree65fd54cf3012a15bb3d92de173821903cfc60e60
parent196da5a18f85d81e2654584e82e12fb2aa391ca8 (diff)
libcontextsubscriber/unit-tests/propertyhandle update
-rw-r--r--libcontextsubscriber/src/propertyhandle.cpp1
-rw-r--r--libcontextsubscriber/src/provider.h4
-rw-r--r--libcontextsubscriber/unit-tests/propertyhandle/Makefile.am2
-rw-r--r--libcontextsubscriber/unit-tests/propertyhandle/contextpropertyinfo.h4
-rw-r--r--libcontextsubscriber/unit-tests/propertyhandle/provider.h (renamed from libcontextsubscriber/unit-tests/propertyhandle/propertyprovider.h)19
-rw-r--r--libcontextsubscriber/unit-tests/propertyhandle/testpropertyhandle.cpp254
-rw-r--r--libcontextsubscriber/unit-tests/propertyhandle/testpropertyhandle.h1
7 files changed, 144 insertions, 141 deletions
diff --git a/libcontextsubscriber/src/propertyhandle.cpp b/libcontextsubscriber/src/propertyhandle.cpp
index 777ac8ed..f1592659 100644
--- a/libcontextsubscriber/src/propertyhandle.cpp
+++ b/libcontextsubscriber/src/propertyhandle.cpp
@@ -135,7 +135,6 @@ void PropertyHandle::updateProvider()
} else {
// The myInfo object doesn't have to be re-created, because it
// just routes the function calls to a registry backend.
- QString dbusName = myInfo->providerDBusName();
if (myInfo->exists()) {
// If myInfo knows the current provider which should be
diff --git a/libcontextsubscriber/src/provider.h b/libcontextsubscriber/src/provider.h
index a8767b3b..fc1e2e25 100644
--- a/libcontextsubscriber/src/provider.h
+++ b/libcontextsubscriber/src/provider.h
@@ -19,8 +19,8 @@
*
*/
-#ifndef PROPERTYPROVIDER_H
-#define PROPERTYPROVIDER_H
+#ifndef PROVIDER_H
+#define PROVIDER_H
#include "queuedinvoker.h"
diff --git a/libcontextsubscriber/unit-tests/propertyhandle/Makefile.am b/libcontextsubscriber/unit-tests/propertyhandle/Makefile.am
index c6efe95a..3fa452e2 100644
--- a/libcontextsubscriber/unit-tests/propertyhandle/Makefile.am
+++ b/libcontextsubscriber/unit-tests/propertyhandle/Makefile.am
@@ -2,7 +2,7 @@ check_PROGRAMS = propertyhandle-unit-tests
# your test's sources
propertyhandle_unit_tests_SOURCES = testpropertyhandle.cpp \
- testpropertyhandle.h propertyprovider.h dbusnamelistener.h \
+ testpropertyhandle.h provider.h dbusnamelistener.h \
contextpropertyinfo.h contextregistryinfo.h
# only include these files in the coverage
diff --git a/libcontextsubscriber/unit-tests/propertyhandle/contextpropertyinfo.h b/libcontextsubscriber/unit-tests/propertyhandle/contextpropertyinfo.h
index ec0caf58..a53f6d46 100644
--- a/libcontextsubscriber/unit-tests/propertyhandle/contextpropertyinfo.h
+++ b/libcontextsubscriber/unit-tests/propertyhandle/contextpropertyinfo.h
@@ -38,6 +38,10 @@ public:
QString type() const;
+ bool exists() const;
+ QString plugin() const;
+ QString constructionString() const;
+
QString providerDBusName() const;
QDBusConnection::BusType providerDBusType() const;
diff --git a/libcontextsubscriber/unit-tests/propertyhandle/propertyprovider.h b/libcontextsubscriber/unit-tests/propertyhandle/provider.h
index eff2954b..ab6ec6c7 100644
--- a/libcontextsubscriber/unit-tests/propertyhandle/propertyprovider.h
+++ b/libcontextsubscriber/unit-tests/propertyhandle/provider.h
@@ -21,8 +21,8 @@
// This is a mock implementation
-#ifndef PROPERTYPROVIDER_H
-#define PROPERTYPROVIDER_H
+#ifndef PROVIDER_H
+#define PROVIDER_H
#include <QObject>
#include <QDBusConnection>
@@ -31,23 +31,24 @@
namespace ContextSubscriber {
-class PropertyProvider : public QObject
+class Provider : public QObject
{
Q_OBJECT
public:
+ static Provider* instance(const QString &plugin, const QString& constructionString);
bool subscribe(const QString &key);
void unsubscribe(const QString &key);
- static PropertyProvider* instance(const QDBusConnection::BusType busType, const QString& busName);
signals:
- void subscribeFinished(QSet<QString> keys);
- void valueChanged(QString key, QVariant value, bool processingSubscription);
+ void subscribeFinished(QString key);
+ void valueChanged(QString key, QVariant value);
+
public:
// Logging
static int instanceCount;
- static QList<QDBusConnection::BusType> instanceDBusTypes;
- static QStringList instanceDBusNames;
+ static QStringList instancePluginNames;
+ static QStringList instancePluginConstructionStrings;
// Log the subscribe calls
static int subscribeCount; // count
static QStringList subscribeKeys; // parameters
@@ -60,7 +61,7 @@ public:
// on which it was called
// For tests
- PropertyProvider(QString name); // public only in tests
+ Provider(QString name); // public only in tests
static void resetLogs();
QString myName;
diff --git a/libcontextsubscriber/unit-tests/propertyhandle/testpropertyhandle.cpp b/libcontextsubscriber/unit-tests/propertyhandle/testpropertyhandle.cpp
index ce21c946..00368e0f 100644
--- a/libcontextsubscriber/unit-tests/propertyhandle/testpropertyhandle.cpp
+++ b/libcontextsubscriber/unit-tests/propertyhandle/testpropertyhandle.cpp
@@ -23,7 +23,7 @@
#include "testpropertyhandle.h"
// Mock header files
-#include "propertyprovider.h"
+#include "provider.h"
#include "dbusnamelistener.h"
#include "contextpropertyinfo.h"
#include "contextregistryinfo.h"
@@ -41,7 +41,7 @@ ContextPropertyInfo* mockContextPropertyInfo;
// Mock implementation of ContextPropertyInfo
ContextPropertyInfo::ContextPropertyInfo(const QString &key, QObject *parent)
- : myType("")
+ : myType("faketype")
{
// Store the object created by the class to be tested
mockContextPropertyInfo = this;
@@ -52,6 +52,21 @@ QString ContextPropertyInfo::type() const
return myType;
}
+bool ContextPropertyInfo::exists() const
+{
+ return myType != "";
+}
+
+QString ContextPropertyInfo::plugin() const
+{
+ return "fakeplugin";
+}
+
+QString ContextPropertyInfo::constructionString() const
+{
+ return "fakeconstructionstring";
+}
+
QString ContextPropertyInfo::providerDBusName() const
{
return "Fake.Provider";
@@ -96,39 +111,39 @@ void myMessageOutput(QtMsgType type, const char *msg)
// Mock instances
// These will be created by the test program
-PropertyProvider* mockPropertyProvider;
-PropertyProvider* mockCommanderProvider;
+Provider* mockProvider;
+Provider* mockCommanderProvider;
DBusNameListener* mockDBusNameListener;
-// Mock implementation of the PropertyProvider
-int PropertyProvider::instanceCount = 0;
-QList<QDBusConnection::BusType> PropertyProvider::instanceDBusTypes;
-QStringList PropertyProvider::instanceDBusNames;
-int PropertyProvider::subscribeCount = 0;
-QStringList PropertyProvider::subscribeKeys;
-QStringList PropertyProvider::subscribeProviderNames;
+// Mock implementation of the Provider
+int Provider::instanceCount = 0;
+QStringList Provider::instancePluginNames;
+QStringList Provider::instancePluginConstructionStrings;
+int Provider::subscribeCount = 0;
+QStringList Provider::subscribeKeys;
+QStringList Provider::subscribeProviderNames;
-int PropertyProvider::unsubscribeCount = 0;
-QStringList PropertyProvider::unsubscribeKeys;
-QStringList PropertyProvider::unsubscribeProviderNames;
+int Provider::unsubscribeCount = 0;
+QStringList Provider::unsubscribeKeys;
+QStringList Provider::unsubscribeProviderNames;
-PropertyProvider* PropertyProvider::instance(const QDBusConnection::BusType busType, const QString &busName)
+Provider* Provider::instance(const QString &plugin, const QString& constructionString)
{
++ instanceCount;
- instanceDBusTypes << busType;
- instanceDBusNames << busName;
- if (busName.contains("Commander")) {
+ instancePluginNames << plugin;
+ instancePluginConstructionStrings << constructionString;
+ if (constructionString.contains("Commander")) {
return mockCommanderProvider;
}
- return mockPropertyProvider;
+ return mockProvider;
}
-PropertyProvider::PropertyProvider(QString name)
+Provider::Provider(QString name)
: myName(name)
{
}
-bool PropertyProvider::subscribe(const QString& key)
+bool Provider::subscribe(const QString& key)
{
qDebug() << "subscribe" << key << myName;
++subscribeCount;
@@ -137,7 +152,7 @@ bool PropertyProvider::subscribe(const QString& key)
return true;
}
-void PropertyProvider::unsubscribe(const QString& key)
+void Provider::unsubscribe(const QString& key)
{
qDebug() << "unsubscribe" << key << myName;
++unsubscribeCount;
@@ -145,11 +160,11 @@ void PropertyProvider::unsubscribe(const QString& key)
unsubscribeProviderNames << myName;
}
-void PropertyProvider::resetLogs()
+void Provider::resetLogs()
{
instanceCount = 0;
- instanceDBusTypes.clear();
- instanceDBusNames.clear();
+ instancePluginConstructionStrings.clear();
+ instancePluginNames.clear();
subscribeCount = 0;
subscribeKeys.clear();
subscribeProviderNames.clear();
@@ -201,11 +216,11 @@ void PropertyHandleUnitTests::cleanupTestCase()
void PropertyHandleUnitTests::init()
{
// Create the mock instances
- mockPropertyProvider = new PropertyProvider("NormalProvider");
- mockCommanderProvider = new PropertyProvider("Commander");
+ mockProvider = new Provider("NormalProvider");
+ mockCommanderProvider = new Provider("Commander");
mockContextRegistryInfo = new ContextRegistryInfo();
// Reset the logs
- PropertyProvider::resetLogs();
+ Provider::resetLogs();
// Reset the DBusNameListener (it is created only once, by the class to be tested)
mockDBusNameListener->servicePresent = DBusNameListener::NotPresent;
}
@@ -213,8 +228,8 @@ void PropertyHandleUnitTests::init()
// After each test
void PropertyHandleUnitTests::cleanup()
{
- delete mockPropertyProvider;
- mockPropertyProvider = 0;
+ delete mockProvider;
+ mockProvider = 0;
delete mockCommanderProvider;
mockCommanderProvider = 0;
delete mockContextRegistryInfo;
@@ -237,10 +252,10 @@ void PropertyHandleUnitTests::initializing()
propertyHandle = PropertyHandle::instance(key);
// Expected results:
- // The PropertyProvider with the correct DBusName and DBusType was created.
- QCOMPARE(PropertyProvider::instanceCount, 1);
- QCOMPARE(PropertyProvider::instanceDBusTypes.at(0), QDBusConnection::SessionBus);
- QCOMPARE(PropertyProvider::instanceDBusNames.at(0), QString("Fake.Provider"));
+ // The Provider with the correct DBusName and DBusType was created.
+ QCOMPARE(Provider::instanceCount, 1);
+ QCOMPARE(Provider::instancePluginNames.at(0), QString("fakeplugin"));
+ QCOMPARE(Provider::instancePluginConstructionStrings.at(0), QString("fakeconstructionstring"));
}
void PropertyHandleUnitTests::key()
@@ -285,10 +300,10 @@ void PropertyHandleUnitTests::subscribe()
propertyHandle->subscribe();
// Expected results:
- // The PropertyHandle calls the PropertyProvider::subscribe
- QCOMPARE(PropertyProvider::subscribeCount, 1);
- QCOMPARE(PropertyProvider::subscribeKeys.at(0), key);
- QCOMPARE(PropertyProvider::unsubscribeCount, 0);
+ // The PropertyHandle calls the Provider::subscribe
+ QCOMPARE(Provider::subscribeCount, 1);
+ QCOMPARE(Provider::subscribeKeys.at(0), key);
+ QCOMPARE(Provider::unsubscribeCount, 0);
}
void PropertyHandleUnitTests::subscribeAndUnsubscribe()
@@ -307,11 +322,11 @@ void PropertyHandleUnitTests::subscribeAndUnsubscribe()
propertyHandle->unsubscribe();
// Expected results:
- // The PropertyHandle calls the PropertyProvider::unsubscribe
- QCOMPARE(PropertyProvider::subscribeCount, 1);
- QCOMPARE(PropertyProvider::subscribeKeys.at(0), key);
- QCOMPARE(PropertyProvider::unsubscribeCount, 1);
- QCOMPARE(PropertyProvider::unsubscribeKeys.at(0), key);
+ // The PropertyHandle calls the Provider::unsubscribe
+ QCOMPARE(Provider::subscribeCount, 1);
+ QCOMPARE(Provider::subscribeKeys.at(0), key);
+ QCOMPARE(Provider::unsubscribeCount, 1);
+ QCOMPARE(Provider::unsubscribeKeys.at(0), key);
}
void PropertyHandleUnitTests::subscribeTwice()
@@ -330,11 +345,11 @@ void PropertyHandleUnitTests::subscribeTwice()
propertyHandle->subscribe();
// Expected results:
- // The PropertyHandle calls the PropertyProvider::subscribe
+ // The PropertyHandle calls the Provider::subscribe
// but only once.
- QCOMPARE(PropertyProvider::subscribeCount, 1);
- QCOMPARE(PropertyProvider::subscribeKeys.at(0), key);
- QCOMPARE(PropertyProvider::unsubscribeCount, 0);
+ QCOMPARE(Provider::subscribeCount, 1);
+ QCOMPARE(Provider::subscribeKeys.at(0), key);
+ QCOMPARE(Provider::unsubscribeCount, 0);
}
void PropertyHandleUnitTests::subscriptionPendingAndFinished()
@@ -354,23 +369,8 @@ void PropertyHandleUnitTests::subscriptionPendingAndFinished()
// The subscription is marked as pending
QVERIFY(propertyHandle->isSubscribePending());
- // Test:
- // Command the PropertyProvider to emit the subscriptionFinished signal
- // without the relevant key
- QSet<QString> toEmit1;
- toEmit1.insert("Non.Relevant.Key");
- emit mockPropertyProvider->subscribeFinished(toEmit1);
-
- // Expected results:
- // The subscription is still marked as pending
- QVERIFY(propertyHandle->isSubscribePending());
-
- // Test:
- // Command the PropertyProvider to emit the subscriptionFinished signal
- // with the relevant key
- QSet<QString> toEmit2;
- toEmit2.insert(key);
- emit mockPropertyProvider->subscribeFinished(toEmit2);
+ // finished
+ propertyHandle->setSubscribeFinished();
// Expected results:
// The subscription is no longer marked as pending
@@ -395,12 +395,12 @@ void PropertyHandleUnitTests::subscribeTwiceAndUnsubscribe()
propertyHandle->unsubscribe();
// Expected results:
- // The PropertyHandle calls the PropertyProvider::subscribe
+ // The PropertyHandle calls the Provider::subscribe
// but only once. The unsubscribe is not called, since one of the
// subscriptions is still valid.
- QCOMPARE(PropertyProvider::subscribeCount, 1);
- QCOMPARE(PropertyProvider::subscribeKeys.at(0), key);
- QCOMPARE(PropertyProvider::unsubscribeCount, 0);
+ QCOMPARE(Provider::subscribeCount, 1);
+ QCOMPARE(Provider::subscribeKeys.at(0), key);
+ QCOMPARE(Provider::unsubscribeCount, 0);
}
void PropertyHandleUnitTests::subscribeTwiceAndUnsubscribeTwice()
@@ -423,12 +423,12 @@ void PropertyHandleUnitTests::subscribeTwiceAndUnsubscribeTwice()
propertyHandle->unsubscribe();
// Expected results:
- // The PropertyHandle calls the PropertyProvider::subscribe
+ // The PropertyHandle calls the Provider::subscribe
// but only once. Also the unsubscription is called once.
- QCOMPARE(PropertyProvider::subscribeCount, 1);
- QCOMPARE(PropertyProvider::subscribeKeys.at(0), key);
- QCOMPARE(PropertyProvider::unsubscribeCount, 1);
- QCOMPARE(PropertyProvider::unsubscribeKeys.at(0), key);
+ QCOMPARE(Provider::subscribeCount, 1);
+ QCOMPARE(Provider::subscribeKeys.at(0), key);
+ QCOMPARE(Provider::unsubscribeCount, 1);
+ QCOMPARE(Provider::unsubscribeKeys.at(0), key);
}
void PropertyHandleUnitTests::setValueWithoutTypeCheck()
@@ -447,7 +447,7 @@ void PropertyHandleUnitTests::setValueWithoutTypeCheck()
spy.clear();
// Command the PropertyHandle to change its value
// The new value is a double
- propertyHandle->setValue(QVariant(1.4), true);
+ propertyHandle->setValue(QVariant(1.4));
// Expected results:
// The valueChanged signal was emitted
@@ -458,7 +458,7 @@ void PropertyHandleUnitTests::setValueWithoutTypeCheck()
// Test:
spy.clear();
// Command the PropertyHandle to set its value to the same value it already has
- propertyHandle->setValue(QVariant(1.4), true);
+ propertyHandle->setValue(QVariant(1.4));
// Expected results:
// The valueChanged signal is not emitted
@@ -468,7 +468,7 @@ void PropertyHandleUnitTests::setValueWithoutTypeCheck()
spy.clear();
// Command the PropertyHandle to change its value
// The new value is an integer
- propertyHandle->setValue(QVariant(-8), true);
+ propertyHandle->setValue(QVariant(-8));
// Expected results:
// The valueChanged signal was emitted
@@ -480,7 +480,7 @@ void PropertyHandleUnitTests::setValueWithoutTypeCheck()
// Test:
spy.clear();
// Command the PropertyHandle to set its value to the same value it already has
- propertyHandle->setValue(QVariant(-8), true);
+ propertyHandle->setValue(QVariant(-8));
// Expected results:
// The valueChanged signal is not emitted
@@ -490,7 +490,7 @@ void PropertyHandleUnitTests::setValueWithoutTypeCheck()
spy.clear();
// Command the PropertyHandle to change its value
// The new value is a string
- propertyHandle->setValue(QVariant("myValue"), true);
+ propertyHandle->setValue(QVariant("myValue"));
// Expected results:
// The valueChanged signal was emitted
@@ -502,7 +502,7 @@ void PropertyHandleUnitTests::setValueWithoutTypeCheck()
// Test:
spy.clear();
// Command the PropertyHandle to set its value to the same value it already has
- propertyHandle->setValue(QVariant("myValue"), true);
+ propertyHandle->setValue(QVariant("myValue"));
// Expected results:
// The valueChanged signal is not emitted
@@ -512,7 +512,7 @@ void PropertyHandleUnitTests::setValueWithoutTypeCheck()
spy.clear();
// Command the PropertyHandle to change its value
// The new value is a boolean
- propertyHandle->setValue(QVariant(true), true);
+ propertyHandle->setValue(QVariant(true));
// Expected results:
// The valueChanged signal was emitted
@@ -524,7 +524,7 @@ void PropertyHandleUnitTests::setValueWithoutTypeCheck()
// Test:
spy.clear();
// Command the PropertyHandle to set its value to the same value it already has
- propertyHandle->setValue(QVariant(true), true);
+ propertyHandle->setValue(QVariant(true));
// Expected results:
// The valueChanged signal is not emitted
@@ -534,7 +534,7 @@ void PropertyHandleUnitTests::setValueWithoutTypeCheck()
spy.clear();
// Command the PropertyHandle to change its value
// The new value is a null
- propertyHandle->setValue(QVariant(), true);
+ propertyHandle->setValue(QVariant());
// Expected results:
// The valueChanged signal was emitted
@@ -546,7 +546,7 @@ void PropertyHandleUnitTests::setValueWithoutTypeCheck()
// Test:
spy.clear();
// Command the PropertyHandle to set its value to the same value it already has
- propertyHandle->setValue(QVariant(), true);
+ propertyHandle->setValue(QVariant());
// Expected results:
// The valueChanged signal is not emitted
@@ -577,7 +577,7 @@ void PropertyHandleUnitTests::setValueWithTypeCheckAndCorrectTypes()
// Test:
// Command the PropertyHandle to change its value
// The new value is a double
- propertyHandle->setValue(QVariant(1.4), true);
+ propertyHandle->setValue(QVariant(1.4));
// Expected results:
// The valueChanged signal was emitted
@@ -589,7 +589,7 @@ void PropertyHandleUnitTests::setValueWithTypeCheckAndCorrectTypes()
spy.clear();
// Command the PropertyHandle to change its value
// The new value is a null
- propertyHandle->setValue(QVariant(), true);
+ propertyHandle->setValue(QVariant());
// Expected results:
// The NULL value is always accepcted (not depending on the type)
@@ -607,7 +607,7 @@ void PropertyHandleUnitTests::setValueWithTypeCheckAndCorrectTypes()
// Test:
// Command the PropertyHandle to change its value
// The new value is an integer
- propertyHandle->setValue(QVariant(-8), true);
+ propertyHandle->setValue(QVariant(-8));
// Expected results:
// The valueChanged signal was emitted
@@ -620,7 +620,7 @@ void PropertyHandleUnitTests::setValueWithTypeCheckAndCorrectTypes()
spy.clear();
// Command the PropertyHandle to change its value
// The new value is a null
- propertyHandle->setValue(QVariant(), true);
+ propertyHandle->setValue(QVariant());
// Expected results:
// The NULL value is always accepcted (not depending on the type)
@@ -638,7 +638,7 @@ void PropertyHandleUnitTests::setValueWithTypeCheckAndCorrectTypes()
// Test:
// Command the PropertyHandle to change its value
// The new value is a string
- propertyHandle->setValue(QVariant("myValue"), true);
+ propertyHandle->setValue(QVariant("myValue"));
// Expected results:
// The valueChanged signal was emitted
@@ -651,7 +651,7 @@ void PropertyHandleUnitTests::setValueWithTypeCheckAndCorrectTypes()
spy.clear();
// Command the PropertyHandle to change its value
// The new value is a null
- propertyHandle->setValue(QVariant(), true);
+ propertyHandle->setValue(QVariant());
// Expected results:
// The NULL value is always accepcted (not depending on the type)
@@ -669,7 +669,7 @@ void PropertyHandleUnitTests::setValueWithTypeCheckAndCorrectTypes()
// Test:
// Command the PropertyHandle to change its value
// The new value is a boolean
- propertyHandle->setValue(QVariant(true), true);
+ propertyHandle->setValue(QVariant(true));
// Expected results:
// The valueChanged signal was emitted
@@ -682,7 +682,7 @@ void PropertyHandleUnitTests::setValueWithTypeCheckAndCorrectTypes()
spy.clear();
// Command the PropertyHandle to change its value
// The new value is a null
- propertyHandle->setValue(QVariant(), true);
+ propertyHandle->setValue(QVariant());
// Expected results:
// The NULL value is always accepcted (not depending on the type)
@@ -713,15 +713,15 @@ void PropertyHandleUnitTests::setValueWithTypeCheckAndIncorrectTypes()
// Set the type to DOUBLE
mockContextPropertyInfo->myType = "DOUBLE";
// Set an initial value
- propertyHandle->setValue(QVariant(4.2), true);
+ propertyHandle->setValue(QVariant(4.2));
spy.clear();
// Test:
// Command the PropertyHandle to change its value multiple times but with
// incorrect types.
- propertyHandle->setValue(QVariant(5), true);
- propertyHandle->setValue(QVariant("string"), true);
- propertyHandle->setValue(QVariant(false), true);
+ propertyHandle->setValue(QVariant(5));
+ propertyHandle->setValue(QVariant("string"));
+ propertyHandle->setValue(QVariant(false));
// Expected results:
// The valueChanged signal was not emitted
@@ -733,15 +733,15 @@ void PropertyHandleUnitTests::setValueWithTypeCheckAndIncorrectTypes()
// Set the type to INT
mockContextPropertyInfo->myType = "INT";
// Set an initial value
- propertyHandle->setValue(QVariant(22), true);
+ propertyHandle->setValue(QVariant(22));
spy.clear();
// Test:
// Command the PropertyHandle to change its value multiple times but with
// incorrect types.
- propertyHandle->setValue(QVariant(5.6), true);
- propertyHandle->setValue(QVariant("string"), true);
- propertyHandle->setValue(QVariant(false), true);
+ propertyHandle->setValue(QVariant(5.6));
+ propertyHandle->setValue(QVariant("string"));
+ propertyHandle->setValue(QVariant(false));
// Expected results:
// The valueChanged signal was not emitted
@@ -753,15 +753,15 @@ void PropertyHandleUnitTests::setValueWithTypeCheckAndIncorrectTypes()
// Set the type to STRING
mockContextPropertyInfo->myType = "STRING";
// Set an initial value
- propertyHandle->setValue(QVariant("myString"), true);
+ propertyHandle->setValue(QVariant("myString"));
spy.clear();
// Test:
// Command the PropertyHandle to change its value multiple times but with
// incorrect types.
- propertyHandle->setValue(QVariant(5.4), true);
- propertyHandle->setValue(QVariant(-8), true);
- propertyHandle->setValue(QVariant(false), true);
+ propertyHandle->setValue(QVariant(5.4));
+ propertyHandle->setValue(QVariant(-8));
+ propertyHandle->setValue(QVariant(false));
// Expected results:
// The valueChanged signal was not emitted
@@ -773,15 +773,15 @@ void PropertyHandleUnitTests::setValueWithTypeCheckAndIncorrectTypes()
// Set the type to TRUTH
mockContextPropertyInfo->myType = "TRUTH";
// Set an initial value
- propertyHandle->setValue(QVariant(false), true);
+ propertyHandle->setValue(QVariant(false));
spy.clear();
// Test:
// Command the PropertyHandle to change its value multiple times but with
// incorrect types.
- propertyHandle->setValue(QVariant(5.4), true);
- propertyHandle->setValue(QVariant(-8), true);
- propertyHandle->setValue(QVariant("string"), true);
+ propertyHandle->setValue(QVariant(5.4));
+ propertyHandle->setValue(QVariant(-8));
+ propertyHandle->setValue(QVariant("string"));
// Expected results:
// The valueChanged signal was not emitted
@@ -803,7 +803,7 @@ void PropertyHandleUnitTests::commanderAppearsAndDisappears()
propertyHandle->subscribe();
// Clear the logs from the subscription
- PropertyProvider::resetLogs();
+ Provider::resetLogs();
// Test:
// Command the DBusNameListener to tell that the Commander has appeared
@@ -812,17 +812,17 @@ void PropertyHandleUnitTests::commanderAppearsAndDisappears()
// Expected results:
// The handle unsubscribes from the real provider
- QCOMPARE(PropertyProvider::unsubscribeCount, 1);
- QCOMPARE(PropertyProvider::unsubscribeKeys.at(0), key);
- QCOMPARE(PropertyProvider::unsubscribeProviderNames.at(0), QString("NormalProvider"));
+ QCOMPARE(Provider::unsubscribeCount, 1);
+ QCOMPARE(Provider::unsubscribeKeys.at(0), key);
+ QCOMPARE(Provider::unsubscribeProviderNames.at(0), QString("NormalProvider"));
// And subscribes to Commander
- QCOMPARE(PropertyProvider::subscribeCount, 1);
- QCOMPARE(PropertyProvider::subscribeKeys.at(0), key);
- QCOMPARE(PropertyProvider::subscribeProviderNames.at(0), QString("Commander"));
+ QCOMPARE(Provider::subscribeCount, 1);
+ QCOMPARE(Provider::subscribeKeys.at(0), key);
+ QCOMPARE(Provider::subscribeProviderNames.at(0), QString("Commander"));
// Setup:
// Clear the logs from the subscription
- PropertyProvider::resetLogs();
+ Provider::resetLogs();
// Test:
// Command the DBusNameListener to tell that the Commander has disappeared
@@ -831,13 +831,13 @@ void PropertyHandleUnitTests::commanderAppearsAndDisappears()
// Expected results:
// The PropertyHandle unsubscribes from the commander
- QCOMPARE(PropertyProvider::unsubscribeCount, 1);
- QCOMPARE(PropertyProvider::unsubscribeKeys.at(0), key);
- QCOMPARE(PropertyProvider::unsubscribeProviderNames.at(0), QString("Commander"));
+ QCOMPARE(Provider::unsubscribeCount, 1);
+ QCOMPARE(Provider::unsubscribeKeys.at(0), key);
+ QCOMPARE(Provider::unsubscribeProviderNames.at(0), QString("Commander"));
// And subscribes to the real provider
- QCOMPARE(PropertyProvider::subscribeCount, 1);
- QCOMPARE(PropertyProvider::subscribeKeys.at(0), key);
- QCOMPARE(PropertyProvider::subscribeProviderNames.at(0), QString("NormalProvider"));
+ QCOMPARE(Provider::subscribeCount, 1);
+ QCOMPARE(Provider::subscribeKeys.at(0), key);
+ QCOMPARE(Provider::subscribeProviderNames.at(0), QString("NormalProvider"));
}
void PropertyHandleUnitTests::commandingDisabled()
@@ -853,7 +853,7 @@ void PropertyHandleUnitTests::commandingDisabled()
propertyHandle->subscribe();
// Clear the logs from the subscription
- PropertyProvider::resetLogs();
+ Provider::resetLogs();
// Test:
// Disable commanding
@@ -865,12 +865,12 @@ void PropertyHandleUnitTests::commandingDisabled()
// Expected results:
// The PropertyHandle ignores the Commander
- QCOMPARE(PropertyProvider::unsubscribeCount, 0);
- QCOMPARE(PropertyProvider::subscribeCount, 0);
+ QCOMPARE(Provider::unsubscribeCount, 0);
+ QCOMPARE(Provider::subscribeCount, 0);
// Setup:
// Clear the logs from the subscription
- PropertyProvider::resetLogs();
+ Provider::resetLogs();
// Test:
// Command the DBusNameListener to tell that the Commander has disappeared
@@ -879,8 +879,8 @@ void PropertyHandleUnitTests::commandingDisabled()
// Expected results:
// The PropertyHandle ignores the Commander
- QCOMPARE(PropertyProvider::unsubscribeCount, 0);
- QCOMPARE(PropertyProvider::subscribeCount, 0);
+ QCOMPARE(Provider::unsubscribeCount, 0);
+ QCOMPARE(Provider::subscribeCount, 0);
}
} // end namespace
diff --git a/libcontextsubscriber/unit-tests/propertyhandle/testpropertyhandle.h b/libcontextsubscriber/unit-tests/propertyhandle/testpropertyhandle.h
index e09e276e..496c7653 100644
--- a/libcontextsubscriber/unit-tests/propertyhandle/testpropertyhandle.h
+++ b/libcontextsubscriber/unit-tests/propertyhandle/testpropertyhandle.h
@@ -61,7 +61,6 @@ private slots:
void commanderAppearsAndDisappears();
void commandingDisabled();
-
};
} // end namespace