summaryrefslogtreecommitdiffstats
path: root/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2023-03-23 21:57:01 +0200
committerTarja Sundqvist <tarja.sundqvist@qt.io>2023-03-23 21:57:01 +0200
commit3dcb548bd6fe4aa488ca0bac95e65a7a366c3eca (patch)
treed8e263e0341880d970832326c7c7cecfd05e67cd /tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
parente957d4810b05d8453e163d7bcdcab42d3c60a7bb (diff)
parent2b3b5c899ebdb0fc11273af7370804f5f03ad9e8 (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.9' into tqtc/lts-5.15-opensourcev5.15.9-lts-lgpl
Diffstat (limited to 'tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp')
-rw-r--r--tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
index 94a065bc..52a0c8bd 100644
--- a/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
+++ b/tests/auto/qbluetoothservicediscoveryagent/tst_qbluetoothservicediscoveryagent.cpp
@@ -64,6 +64,7 @@ private slots:
void tst_invalidBtAddress();
void tst_serviceDiscovery_data();
void tst_serviceDiscovery();
+ void tst_serviceDiscoveryStop();
void tst_serviceDiscoveryAdapters();
private:
@@ -141,6 +142,28 @@ void tst_QBluetoothServiceDiscoveryAgent::initTestCase()
}
}
+void tst_QBluetoothServiceDiscoveryAgent::tst_serviceDiscoveryStop()
+{
+ if (!localDeviceAvailable)
+ QSKIP("This test requires Bluetooth adapter in powered ON state");
+
+ QBluetoothServiceDiscoveryAgent discoveryAgent;
+ QSignalSpy finishedSpy(&discoveryAgent, SIGNAL(finished()));
+ QSignalSpy canceledSpy(&discoveryAgent, SIGNAL(canceled()));
+
+ // Verify we get the correct signals on start-stop
+ discoveryAgent.start(QBluetoothServiceDiscoveryAgent::FullDiscovery);
+ QVERIFY(discoveryAgent.isActive());
+ discoveryAgent.stop();
+ QTRY_COMPARE(canceledSpy.count(), 1);
+ QVERIFY(!discoveryAgent.isActive());
+ // Wait a bit to see that there are no latent signals
+ QTest::qWait(200);
+ QCOMPARE(canceledSpy.count(), 1);
+ QCOMPARE(finishedSpy.count(), 0);
+}
+
+
void tst_QBluetoothServiceDiscoveryAgent::tst_invalidBtAddress()
{
#ifdef Q_OS_OSX