• 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 QtPurchasing
7 
8 #include <QtPurchasing>
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_PURCHASING_LIB), true);
16 }
17 
18 class DummyProduct : public QInAppProduct
19 {
20 public:
21 
DummyProduct()22     DummyProduct() : QInAppProduct{QStringLiteral("One"),
23                                    QString{},
24                                    QString{},
25                                    Consumable,
26                                    QStringLiteral("DummyProduct"),
27                                    nullptr} {};
purchase()28     void purchase() override {};
29 };
30 
31 std::ostream&
operator <<(std::ostream & stream,QString const & string)32 operator << (std::ostream& stream, QString const& string)
33 {
34     stream << qPrintable(string);
35     return stream;
36 }
37 
BOOST_AUTO_TEST_CASE(purchase)38 BOOST_AUTO_TEST_CASE (purchase)
39 {
40   DummyProduct product;
41 
42   BOOST_TEST(product.price() == QLatin1String("One"));
43   BOOST_TEST(product.identifier() == QLatin1String("DummyProduct"));
44 }
45