1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the test suite of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | |
29 | #include <QtCore/QString> |
30 | #include <QtTest/QtTest> |
31 | |
32 | #include <qplacecontentrequest.h> |
33 | |
34 | QT_USE_NAMESPACE |
35 | |
36 | class tst_QPlaceContentRequest : public QObject |
37 | { |
38 | Q_OBJECT |
39 | |
40 | public: |
41 | tst_QPlaceContentRequest(); |
42 | |
43 | private Q_SLOTS: |
44 | void contentTest(); |
45 | void clearTest(); |
46 | }; |
47 | |
48 | tst_QPlaceContentRequest::tst_QPlaceContentRequest() |
49 | { |
50 | } |
51 | |
52 | void tst_QPlaceContentRequest::contentTest() |
53 | { |
54 | QPlaceContentRequest req; |
55 | QCOMPARE(req.limit(), -1); |
56 | QCOMPARE(req.contentType(), QPlaceContent::NoType); |
57 | |
58 | //check that we can set the request fields |
59 | req.setLimit(100); |
60 | req.setContentType(QPlaceContent::ImageType); |
61 | QCOMPARE(req.limit(), 100); |
62 | QCOMPARE(req.contentType(), QPlaceContent::ImageType); |
63 | |
64 | //check that we assignment works correctly |
65 | QPlaceContentRequest otherReq; |
66 | otherReq.setLimit(10); |
67 | otherReq.setContentType(QPlaceContent::ReviewType); |
68 | req = otherReq; |
69 | QCOMPARE(req.limit(), 10); |
70 | QCOMPARE(req.contentType(), QPlaceContent::ReviewType); |
71 | QCOMPARE(req, otherReq); |
72 | |
73 | //check that comparison will fail if one the fields are different |
74 | req.setLimit(9000); |
75 | QVERIFY(req != otherReq); |
76 | } |
77 | |
78 | void tst_QPlaceContentRequest::clearTest() |
79 | { |
80 | QPlaceContentRequest req; |
81 | req.setContentType(QPlaceContent::ReviewType); |
82 | req.setLimit(9000); |
83 | req.clear(); |
84 | QVERIFY(req.contentType() == QPlaceContent::NoType); |
85 | QVERIFY(req.limit() == -1); |
86 | } |
87 | |
88 | QTEST_APPLESS_MAIN(tst_QPlaceContentRequest) |
89 | |
90 | #include "tst_qplacecontentrequest.moc" |
91 | |