• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // (c) Copyright Juergen Hunold 2016
2 // Use, modification and distribution is subject to the Boost Software
3 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 
6 #define BOOST_TEST_MODULE QtBluetooth
7 
8 #include <QtBluetooth>
9 
10 #include <boost/test/unit_test.hpp>
11 
BOOST_AUTO_TEST_CASE(defines)12 BOOST_AUTO_TEST_CASE( defines)
13 {
14     BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true);
15     BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_BLUETOOTH_LIB), true);
16 }
17 
18 /*!
19   Try to detect a device
20  */
BOOST_AUTO_TEST_CASE(bluetooth)21 BOOST_AUTO_TEST_CASE( bluetooth )
22 {
23     QList<QBluetoothHostInfo> localAdapters = QBluetoothLocalDevice::allDevices();
24 
25     if (!localAdapters.empty())
26     {
27         QBluetoothLocalDevice adapter(localAdapters.at(0).address());
28         adapter.setHostMode(QBluetoothLocalDevice::HostDiscoverable);
29     }
30     else
31     {
32         BOOST_TEST(localAdapters.size() == 0);
33     }
34 }
35