summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlowenergycharacteristic
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-07-10 15:47:41 +0200
committerAlex Blasche <alexander.blasche@digia.com>2014-07-16 08:28:46 +0200
commitf399837b3a723af9add6d9ea2d2e988f64f76ae0 (patch)
tree2c2a17ff5c4cfd007af98c98c70a2bf8c5fe8984 /tests/auto/qlowenergycharacteristic
parent8bf7e9986e359df46bb351dfb76e4140d9b04da7 (diff)
Add simpler API to retrieve descriptor/characteristic for certain uuid
This new API is mostly syntactic sugar and reduces the amount of code to be written by API users. Change-Id: I51ff1ea706ac97199646d211e39e79c8140ee74b Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Diffstat (limited to 'tests/auto/qlowenergycharacteristic')
-rw-r--r--tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp b/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp
index 27c32db9..c6c408b6 100644
--- a/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp
+++ b/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp
@@ -188,6 +188,12 @@ void tst_QLowEnergyCharacteristic::tst_constructionDefault()
QVERIFY(characteristic.handle() == 0);
QCOMPARE(characteristic.name(), QString());
QCOMPARE(characteristic.descriptors().count(), 0);
+ QCOMPARE(characteristic.descriptor(QBluetoothUuid()),
+ QLowEnergyDescriptor());
+ QCOMPARE(characteristic.descriptor(QBluetoothUuid(QBluetoothUuid::ClientCharacteristicConfiguration)),
+ QLowEnergyDescriptor());
+ QCOMPARE(characteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration),
+ QLowEnergyDescriptor());
QCOMPARE(characteristic.properties(), QLowEnergyCharacteristic::Unknown);
QLowEnergyCharacteristic copyConstructed(characteristic);
@@ -244,6 +250,10 @@ void tst_QLowEnergyCharacteristic::tst_assignCompare()
const QList<QLowEnergyCharacteristic> chars = globalService->characteristics();
QVERIFY(!chars.isEmpty());
for (int i = 0; i < chars.count(); i++) {
+ const QLowEnergyCharacteristic specific =
+ globalService->characteristic(chars[i].uuid());
+ QVERIFY(specific.isValid());
+ QCOMPARE(specific, chars[i]);
if (chars[i].descriptors().count() > 0) {
indexWithDescriptor = i;
break;
@@ -290,6 +300,9 @@ void tst_QLowEnergyCharacteristic::tst_assignCompare()
QCOMPARE(target.descriptors()[i].handle(), ref.handle());
QCOMPARE(target.descriptors()[i].uuid(), ref.uuid());
QCOMPARE(target.descriptors()[i].value(), ref.value());
+
+ const QLowEnergyDescriptor ref2 = chars[indexWithDescriptor].descriptor(ref.uuid());
+ QCOMPARE(ref, ref2);
}
// test copy constructor