PuzzleSDK
NewAudioEngineTest.h
浏览该文件的文档.
1/****************************************************************************
2 Copyright (c) 2014-2016 Chukong Technologies Inc.
3 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
4
5 http://www.cocos2d-x.org
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE.
24 ****************************************************************************/
25
26#include "platform/CCPlatformConfig.h"
27
28#ifndef __NEWAUDIOENGINE_TEST_H_
29#define __NEWAUDIOENGINE_TEST_H_
30
31#include "cocos2d.h"
32#include "../BaseTest.h"
33
34#include "audio/include/AudioEngine.h"
35
36DEFINE_TEST_SUITE(AudioEngineTests);
37
39{
40public:
42
43 virtual std::string title() const override;
44 virtual void onExit() override;
45
46 virtual void onBackCallback(cocos2d::Ref* sender) override;
47
48protected:
49 std::shared_ptr<bool> _isDestroyed;
50};
51
53{
54public:
56
57 virtual ~AudioControlTest();
58
59 virtual bool init() override;
60
61 virtual void update(float dt) override;
62
63 virtual std::string title() const override;
64
65private:
68 float _volume;
69 float _duration;
71
72 void* _playItem;
76 cocos2d::Label* _playOverLabel;
77};
78
80{
81public:
83
85
86 virtual bool init() override;
87
88 virtual std::string title() const override;
89private:
90 static const int TEST_COUNT = 10;
91 std::string _files[TEST_COUNT];
92
93 void* _playItem;
95};
96
98{
99public:
101
102 virtual ~AudioProfileTest();
103
104 virtual bool init() override;
105
106 virtual std::string title() const override;
107 virtual std::string subtitle() const override;
108
109 virtual void update(float dt) override;
110
111private:
112 static const int FILE_COUNT = 2;
113 std::string _files[FILE_COUNT];
114 cocos2d::AudioProfile _audioProfile;
115
117 cocos2d::Label* _showLabel;
118 float _time;
121};
122
124{
125public:
127
128 virtual ~InvalidAudioFileTest();
129
130 virtual bool init() override;
131
132 virtual std::string title() const override;
133 virtual std::string subtitle() const override;
134
135private:
136
137};
138
140{
141public:
143
144 virtual ~LargeAudioFileTest();
145
146 virtual bool init() override;
147
148 virtual std::string title() const override;
149
150private:
151
152};
153
155{
156public:
158
159 virtual bool init() override;
160
161 virtual std::string title() const override;
162};
163
165{
166public:
168
169 float _time;
170
171 virtual bool init() override;
172
173 virtual std::string title() const override;
174 virtual std::string subtitle() const override;
175};
176
178{
179public:
181
182 virtual bool init() override;
183
184 virtual std::string title() const override;
185 virtual std::string subtitle() const override;
186};
187
189{
190public:
192
193 virtual bool init() override;
194
195 virtual std::string title() const override;
196 virtual std::string subtitle() const override;
197};
198
200{
201public:
203
204 virtual bool init() override;
205
206 virtual std::string title() const override;
207 virtual std::string subtitle() const override;
208};
209
211{
212public:
214
215 virtual bool init() override;
216
217 virtual std::string title() const override;
218 virtual std::string subtitle() const override;
219};
220
222{
223public:
225
226 virtual void onEnter() override;
227
228 virtual std::string title() const override;
229 virtual std::string subtitle() const override;
230};
231
233{
234public:
236
237 virtual void onEnter() override;
238
239 virtual std::string title() const override;
240 virtual std::string subtitle() const override;
241};
242
244{
245public:
247
248 virtual void onEnter() override;
249
250 virtual std::string title() const override;
251 virtual std::string subtitle() const override;
252};
253
255{
256public:
258
259 virtual void onEnter() override;
260
261 virtual std::string title() const override;
262 virtual std::string subtitle() const override;
263};
264
266{
267public:
269
270 virtual void onEnter() override;
271
272 virtual std::string title() const override;
273 virtual std::string subtitle() const override;
274};
275
277{
278public:
280
281 virtual void onEnter() override;
282 virtual void onExit() override;
283
284 virtual std::string title() const override;
285 virtual std::string subtitle() const override;
286
287private:
288 std::vector<std::string> _oldSearchPaths;
289};
290
292{
293public:
295
296 virtual void onEnter() override;
297 virtual void onExit() override;
298
299 virtual std::string title() const override;
300 virtual std::string subtitle() const override;
301
302private:
303 void doPlay(const std::string& filename);
304 void playMusic(const std::string& filename);
305 std::list<std::string> _playList;
306};
307
309{
310public:
312
313 virtual void onEnter() override;
314 virtual void onExit() override;
315
316 virtual std::string title() const override;
317 virtual std::string subtitle() const override;
318
319private:
320};
321
322#endif /* defined(__NEWAUDIOENGINE_TEST_H_) */
DEFINE_TEST_SUITE(AudioEngineTests)
virtual void update(float dt) override
virtual bool init() override
virtual std::string title() const override
cocos2d::Label * _playOverLabel
CREATE_FUNC(AudioControlTest)
virtual std::string title() const override
std::shared_ptr< bool > _isDestroyed
virtual void onBackCallback(cocos2d::Ref *sender) override
virtual void onExit() override
virtual bool init() override
CREATE_FUNC(AudioIssue11143Test)
virtual std::string subtitle() const override
virtual std::string title() const override
virtual std::string title() const override
virtual std::string subtitle() const override
virtual void onEnter() override
CREATE_FUNC(AudioIssue16938Test)
virtual bool init() override
virtual std::string title() const override
CREATE_FUNC(AudioIssue18597Test)
virtual std::string subtitle() const override
CREATE_FUNC(AudioLoadTest)
virtual std::string title() const override
virtual bool init() override
virtual std::string title() const override
virtual std::string subtitle() const override
CREATE_FUNC(AudioPauseResumeAfterPlay)
virtual void onEnter() override
virtual std::string subtitle() const override
virtual std::string title() const override
virtual bool init() override
CREATE_FUNC(AudioPerformanceTest)
virtual void onEnter() override
std::vector< std::string > _oldSearchPaths
virtual std::string subtitle() const override
virtual void onExit() override
virtual std::string title() const override
CREATE_FUNC(AudioPlayFileInWritablePath)
std::list< std::string > _playList
virtual void onExit() override
CREATE_FUNC(AudioPlayInFinishedCB)
virtual void onEnter() override
void doPlay(const std::string &filename)
virtual std::string title() const override
virtual std::string subtitle() const override
void playMusic(const std::string &filename)
virtual std::string subtitle() const override
virtual std::string title() const override
CREATE_FUNC(AudioPreloadSameFileMultipleTimes)
CREATE_FUNC(AudioProfileTest)
std::string _files[FILE_COUNT]
cocos2d::AudioProfile _audioProfile
virtual std::string subtitle() const override
cocos2d::Label * _showLabel
virtual void update(float dt) override
virtual std::string title() const override
static const int FILE_COUNT
virtual bool init() override
CREATE_FUNC(AudioSmallFile2Test)
virtual std::string title() const override
virtual void onEnter() override
virtual std::string subtitle() const override
virtual void onEnter() override
CREATE_FUNC(AudioSmallFile3Test)
virtual std::string subtitle() const override
virtual std::string title() const override
virtual std::string title() const override
virtual bool init() override
CREATE_FUNC(AudioSmallFileTest)
virtual std::string subtitle() const override
virtual std::string subtitle() const override
virtual bool init() override
virtual std::string title() const override
CREATE_FUNC(AudioSwitchStateTest)
virtual std::string title() const override
CREATE_FUNC(AudioUncacheInFinishedCB)
virtual std::string subtitle() const override
virtual void onEnter() override
virtual void onExit() override
virtual std::string subtitle() const override
CREATE_FUNC(InvalidAudioFileTest)
virtual bool init() override
virtual std::string title() const override
virtual std::string title() const override
virtual bool init() override
CREATE_FUNC(LargeAudioFileTest)
std::string _files[TEST_COUNT]
static const int TEST_COUNT
CREATE_FUNC(PlaySimultaneouslyTest)
virtual std::string title() const override
virtual bool init() override