diff options
Diffstat (limited to 'tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp')
-rw-r--r-- | tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp b/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp index 6c45eed7..e2534a14 100644 --- a/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp +++ b/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp @@ -37,6 +37,7 @@ #include <QtBluetooth/qbluetoothlocaldevice.h> #include <QtBluetooth/qlowenergyadvertisingdata.h> #include <QtBluetooth/qlowenergyadvertisingparameters.h> +#include <QtBluetooth/qlowenergyconnectionparameters.h> #include <QtBluetooth/qlowenergycontroller.h> #include <QtBluetooth/qlowenergycharacteristicdata.h> #include <QtBluetooth/qlowenergydescriptordata.h> @@ -60,6 +61,7 @@ private slots: // Static, local stuff goes here. void advertisingParameters(); void advertisingData(); + void connectionParameters(); void controllerType(); void serviceData(); @@ -148,6 +150,28 @@ void TestQLowEnergyControllerGattServer::advertisingData() QVERIFY(data != QLowEnergyAdvertisingData()); } +void TestQLowEnergyControllerGattServer::connectionParameters() +{ + QLowEnergyConnectionParameters connParams; + QCOMPARE(connParams, QLowEnergyConnectionParameters()); + connParams.setIntervalRange(8, 9); + QCOMPARE(connParams.minimumInterval(), double(8)); + QCOMPARE(connParams.maximumInterval(), double(9)); + connParams.setIntervalRange(9, 8); + QCOMPARE(connParams.minimumInterval(), double(9)); + QCOMPARE(connParams.maximumInterval(), double(9)); + connParams.setLatency(50); + QCOMPARE(connParams.latency(), 50); + connParams.setSupervisionTimeout(1000); + QCOMPARE(connParams.supervisionTimeout(), 1000); + const QLowEnergyConnectionParameters cp2 = connParams; + QCOMPARE(cp2, connParams); + QLowEnergyConnectionParameters cp3; + QVERIFY(cp3 != connParams); + cp3 = connParams; + QCOMPARE(cp3, connParams); +} + void TestQLowEnergyControllerGattServer::advertisedData() { if (m_serverAddress.isNull()) @@ -325,6 +349,9 @@ void TestQLowEnergyControllerGattServer::serverCommunication() QCOMPARE(customChar3.value().constData(), "indicated"); QCOMPARE(customChar4.value().constData(), "notified"); + spy.reset(new QSignalSpy(m_leController.data(), &QLowEnergyController::connectionUpdated)); + QVERIFY(spy->wait(5000)); + const bool isBonded = QBluetoothLocalDevice().pairingStatus(m_serverAddress) != QBluetoothLocalDevice::Unpaired; m_leController->disconnectFromDevice(); |