summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlowenergycharacteristic
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-08-22 09:56:56 +0200
committerAlex Blasche <alexander.blasche@digia.com>2014-09-02 20:18:09 +0200
commitbb4de7e992fc673884db553977b2756a165278b5 (patch)
tree0c0a9e56cc2f766ac13d76338bf64f3b52247222 /tests/auto/qlowenergycharacteristic
parent6837d143b456eb1f253b68704a5ff1b48bef4de4 (diff)
Add a way to detect that the QLEController is performing a discovery
Change-Id: Ie3146c136461ad4ecde4169f3b30dda0c814ca7b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/qlowenergycharacteristic')
-rw-r--r--tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp b/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp
index a313d1f6..23189f51 100644
--- a/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp
+++ b/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp
@@ -67,10 +67,14 @@ private:
QLowEnergyService *globalService;
};
+Q_DECLARE_METATYPE(QLowEnergyController::ControllerState)
+
tst_QLowEnergyCharacteristic::tst_QLowEnergyCharacteristic() :
globalControl(0), globalService(0)
{
QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
+
+ qRegisterMetaType<QLowEnergyController::ControllerState>();
}
tst_QLowEnergyCharacteristic::~tst_QLowEnergyCharacteristic()
@@ -121,8 +125,15 @@ void tst_QLowEnergyCharacteristic::initTestCase()
}
QSignalSpy discoveryFinishedSpy(controller, SIGNAL(discoveryFinished()));
+ QSignalSpy stateSpy(controller, SIGNAL(stateChanged(QLowEnergyController::ControllerState)));
controller->discoverServices();
QTRY_VERIFY_WITH_TIMEOUT(discoveryFinishedSpy.count() == 1, 10000);
+ QCOMPARE(stateSpy.count(), 2);
+ QCOMPARE(stateSpy.at(0).at(0).value<QLowEnergyController::ControllerState>(),
+ QLowEnergyController::DiscoveringState);
+ QCOMPARE(stateSpy.at(1).at(0).value<QLowEnergyController::ControllerState>(),
+ QLowEnergyController::DiscoveredState);
+
foreach (const QBluetoothUuid &leServiceUuid, controller->services()) {
QLowEnergyService *leService = controller->createServiceObject(leServiceUuid, this);
if (!leService)