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 | #ifndef MOCKRADIODATACONTROL_H |
30 | #define MOCKRADIODATACONTROL_H |
31 | |
32 | #include "qradiodatacontrol.h" |
33 | |
34 | class MockRadioDataControl : public QRadioDataControl |
35 | { |
36 | Q_OBJECT |
37 | |
38 | public: |
39 | MockRadioDataControl(QObject *parent): |
40 | QRadioDataControl(parent), m_err(QRadioData::NoError), |
41 | m_errstr("") |
42 | { |
43 | } |
44 | |
45 | using QRadioDataControl::error; |
46 | |
47 | QRadioData::Error error() const |
48 | { |
49 | return m_err; |
50 | } |
51 | |
52 | QString errorString() const |
53 | { |
54 | return m_errstr; |
55 | } |
56 | |
57 | QString stationId() const |
58 | { |
59 | return m_stationId; |
60 | } |
61 | |
62 | QRadioData::ProgramType programType() const |
63 | { |
64 | return m_programType; |
65 | } |
66 | |
67 | QString programTypeName() const |
68 | { |
69 | return m_programTypeName; |
70 | } |
71 | |
72 | QString stationName() const |
73 | { |
74 | return m_stationName; |
75 | } |
76 | |
77 | QString radioText() const |
78 | { |
79 | return m_radioText; |
80 | } |
81 | |
82 | void setAlternativeFrequenciesEnabled(bool enabled) |
83 | { |
84 | m_alternativeFrequenciesEnabled = enabled; |
85 | emit alternativeFrequenciesEnabledChanged(enabled: m_alternativeFrequenciesEnabled); |
86 | } |
87 | |
88 | bool isAlternativeFrequenciesEnabled() const |
89 | { |
90 | return m_alternativeFrequenciesEnabled; |
91 | } |
92 | |
93 | void forceRT( QString text ) |
94 | { |
95 | m_radioText = text; |
96 | emit radioTextChanged(radioText: m_radioText); |
97 | } |
98 | |
99 | void forceProgramType( int pty ) |
100 | { |
101 | m_programType = static_cast<QRadioData::ProgramType>(pty); |
102 | emit programTypeChanged(programType: m_programType); |
103 | } |
104 | |
105 | void forcePTYN( QString ptyn ) |
106 | { |
107 | m_programTypeName = ptyn; |
108 | emit programTypeNameChanged(programTypeName: m_programTypeName); |
109 | } |
110 | |
111 | void forcePI( QString pi ) |
112 | { |
113 | m_stationId = pi; |
114 | emit stationIdChanged(stationId: m_stationId); |
115 | } |
116 | |
117 | void forcePS( QString ps ) |
118 | { |
119 | m_stationName = ps; |
120 | emit stationNameChanged(stationName: m_stationName); |
121 | } |
122 | |
123 | public: |
124 | QString m_radioText; |
125 | QRadioData::ProgramType m_programType; |
126 | QString m_programTypeName; |
127 | QString m_stationId; |
128 | QString m_stationName; |
129 | bool m_alternativeFrequenciesEnabled; |
130 | |
131 | QRadioData::Error m_err; |
132 | QString m_errstr; |
133 | }; |
134 | |
135 | #endif // MOCKRADIODATACONTROL_H |
136 |