qtbluetooth.cpp 891 B

12345678910111213141516171819202122232425262728293031323334
  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.txt or copy at
  4. // https://www.bfgroup.xyz/b2/LICENSE.txt)
  5. #define BOOST_TEST_MODULE QtBluetooth
  6. #include <QtBluetooth>
  7. #include <boost/test/unit_test.hpp>
  8. BOOST_AUTO_TEST_CASE( defines)
  9. {
  10. BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true);
  11. BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_BLUETOOTH_LIB), true);
  12. }
  13. /*!
  14. Try to detect a device
  15. */
  16. BOOST_AUTO_TEST_CASE( bluetooth )
  17. {
  18. QList<QBluetoothHostInfo> localAdapters = QBluetoothLocalDevice::allDevices();
  19. if (!localAdapters.empty())
  20. {
  21. QBluetoothLocalDevice adapter(localAdapters.at(0).address());
  22. adapter.setHostMode(QBluetoothLocalDevice::HostDiscoverable);
  23. }
  24. else
  25. {
  26. BOOST_TEST(localAdapters.size() == 0);
  27. }
  28. }