qtpurchasing.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 QtPurchasing
  6. #include <QtPurchasing>
  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_PURCHASING_LIB), true);
  12. }
  13. class DummyProduct : public QInAppProduct
  14. {
  15. public:
  16. DummyProduct() : QInAppProduct{QStringLiteral("One"),
  17. QString{},
  18. QString{},
  19. Consumable,
  20. QStringLiteral("DummyProduct"),
  21. nullptr} {};
  22. void purchase() override {};
  23. };
  24. std::ostream&
  25. operator << (std::ostream& stream, QString const& string)
  26. {
  27. stream << qPrintable(string);
  28. return stream;
  29. }
  30. BOOST_AUTO_TEST_CASE (purchase)
  31. {
  32. DummyProduct product;
  33. BOOST_TEST(product.price() == QLatin1String("One"));
  34. BOOST_TEST(product.identifier() == QLatin1String("DummyProduct"));
  35. }