1 /*
2 * Copyright (C) 2020-2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16
17 #include "ActsMediaPlayerTest.h"
18
19 namespace OHOS {
20 const string g_avFileName = "1080P_25fps.mp4";
21
InitSurface()22 static void InitSurface()
23 {
24 OHOS::g_surface->SetUserData("region_position_x", "0");
25 OHOS::g_surface->SetUserData("region_position_y", "0");
26 OHOS::g_surface->SetUserData("region_width", "720");
27 OHOS::g_surface->SetUserData("region_height", "540");
28 }
29
30 class ActsMediaPlayerVideoTest : public testing::Test {
31 protected:
32 // SetUpTestCase:The preset action of the test suite is executed before the first TestCase
SetUpTestCase(void)33 static void SetUpTestCase(void)
34 {
35 }
36 // TearDownTestCase:The test suite cleanup action is executed after the last TestCase
TearDownTestCase(void)37 static void TearDownTestCase(void)
38 {
39 }
40 // SetUp:Execute before each test case
SetUp()41 virtual void SetUp()
42 {
43 g_tagTestSample.adaptr = std::make_shared<Player>();
44 InitSurface();
45 }
46 // TearDown:Execute after each test case
TearDown()47 virtual void TearDown()
48 {
49 }
50 };
51
FileCheck(const string & argv)52 static int32_t FileCheck(const string &argv)
53 {
54 const char *ptr = argv.c_str();
55
56 if (strlen(ptr) < FILE_PATH_LEN &&
57 realpath(argv.c_str(), g_tagTestSample.filePath) == nullptr) {
58 printf("realpath input file failed, errno: %d!\n", errno);
59 return -1;
60 }
61 return 0;
62 }
63
CreateAndSetSource()64 static int32_t CreateAndSetSource()
65 {
66 std::string uri(g_tagTestSample.filePath);
67 Source source(uri);
68 int32_t ret = g_tagTestSample.adaptr->SetSource(source);
69 string ret1 = source.GetSourceUri();
70 return ret;
71 }
72
73 /* *
74 * @tc.number : SUB_MEDIA_PLAYER_PLAY_0100
75 * @tc.name : Video Prepare Test.
76 * @tc.desc : [C- SOFTWARE -0200]
77 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_001,Level1)78 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_001, Level1)
79 {
80 int32_t ret = FileCheck(g_avFileName);
81 EXPECT_EQ(HI_SUCCESS, ret);
82 ret = CreateAndSetSource();
83 EXPECT_EQ(HI_SUCCESS, ret);
84 ret = g_tagTestSample.adaptr->Prepare();
85 EXPECT_EQ(HI_SUCCESS, ret);
86 ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface);
87 EXPECT_EQ(HI_SUCCESS, ret);
88 ret = g_tagTestSample.adaptr->Play();
89 EXPECT_EQ(HI_SUCCESS, ret);
90 bool flag = g_tagTestSample.adaptr->IsPlaying();
91 EXPECT_EQ(true, flag);
92 g_tagTestSample.adaptr->Release();
93 sleep(1);
94 }
95
96 /* *
97 * @tc.number : SUB_MEDIA_PLAYER_PLAY_0200
98 * @tc.name : Video Prepare Test.
99 * @tc.desc : [C- SOFTWARE -0200]
100 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_002,Level1)101 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_002, Level1)
102 {
103 int32_t ret = FileCheck(g_avFileName);
104 EXPECT_EQ(HI_SUCCESS, ret);
105 ret = CreateAndSetSource();
106 EXPECT_EQ(HI_SUCCESS, ret);
107 ret = g_tagTestSample.adaptr->Prepare();
108 EXPECT_EQ(HI_SUCCESS, ret);
109 ret = g_tagTestSample.adaptr->Prepare();
110 EXPECT_EQ(HI_SUCCESS, ret);
111 g_tagTestSample.adaptr->Release();
112 sleep(1);
113 }
114
115 /* *
116 * @tc.number : SUB_MEDIA_PLAYER_PLAY_0300
117 * @tc.name : Video Play Test.
118 * @tc.desc : [C- SOFTWARE -0200]
119 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_003,Level1)120 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_003, Level1)
121 {
122 int32_t ret = FileCheck(g_avFileName);
123 EXPECT_EQ(HI_SUCCESS, ret);
124 ret = CreateAndSetSource();
125 EXPECT_EQ(HI_SUCCESS, ret);
126 ret = g_tagTestSample.adaptr->Prepare();
127 EXPECT_EQ(HI_SUCCESS, ret);
128 ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface);
129 EXPECT_EQ(HI_SUCCESS, ret);
130 ret = g_tagTestSample.adaptr->Play();
131 sleep(1);
132 EXPECT_EQ(HI_SUCCESS, ret);
133 bool flag = g_tagTestSample.adaptr->IsPlaying();
134 EXPECT_EQ(true, flag);
135 g_tagTestSample.adaptr->Release();
136 sleep(1);
137 }
138
139 /* *
140 * @tc.number : SUB_MEDIA_PLAYER_PLAY_0400
141 * @tc.name : Video Stop Test.
142 * @tc.desc : [C- SOFTWARE -0200]
143 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_004,Level1)144 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_004, Level1)
145 {
146 int32_t ret = FileCheck(g_avFileName);
147 EXPECT_EQ(HI_SUCCESS, ret);
148 ret = CreateAndSetSource();
149 EXPECT_EQ(HI_SUCCESS, ret);
150 ret = g_tagTestSample.adaptr->Prepare();
151 EXPECT_EQ(HI_SUCCESS, ret);
152 ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface);
153 EXPECT_EQ(HI_SUCCESS, ret);
154 std::shared_ptr<PlayerCallback> cb;
155 g_tagTestSample.adaptr->SetPlayerCallback(cb);
156 ret = g_tagTestSample.adaptr->Play();
157 EXPECT_EQ(HI_SUCCESS, ret);
158 sleep(2);
159 ret = g_tagTestSample.adaptr->Stop();
160 EXPECT_EQ(HI_SUCCESS, ret);
161 bool flag = g_tagTestSample.adaptr->IsPlaying();
162 EXPECT_EQ(false, flag);
163 g_tagTestSample.adaptr->Release();
164 sleep(1);
165 }
166
167 /* *
168 * @tc.number : SUB_MEDIA_PLAYER_PLAY_0500
169 * @tc.name : Video Stop Test.
170 * @tc.desc : [C- SOFTWARE -0200]
171 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_005,Level1)172 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_005, Level1)
173 {
174 int32_t ret = FileCheck(g_avFileName);
175 EXPECT_EQ(HI_SUCCESS, ret);
176 ret = CreateAndSetSource();
177 EXPECT_EQ(HI_SUCCESS, ret);
178 ret = g_tagTestSample.adaptr->Prepare();
179 EXPECT_EQ(HI_SUCCESS, ret);
180 ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface);
181 EXPECT_EQ(HI_SUCCESS, ret);
182 ret = g_tagTestSample.adaptr->Stop();
183 EXPECT_EQ(HI_FAILURE, ret);
184 g_tagTestSample.adaptr->Release();
185 sleep(1);
186 }
187
188 /* *
189 * @tc.number : SUB_MEDIA_PLAYER_PLAY_0600
190 * @tc.name : Video Pause Test.
191 * @tc.desc : [C- SOFTWARE -0200]
192 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_006,Level1)193 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_006, Level1)
194 {
195 int32_t ret = FileCheck(g_avFileName);
196 EXPECT_EQ(HI_SUCCESS, ret);
197 ret = CreateAndSetSource();
198 EXPECT_EQ(HI_SUCCESS, ret);
199 ret = g_tagTestSample.adaptr->Prepare();
200 EXPECT_EQ(HI_SUCCESS, ret);
201 ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface);
202 EXPECT_EQ(HI_SUCCESS, ret);
203 ret = g_tagTestSample.adaptr->Play();
204 EXPECT_EQ(HI_SUCCESS, ret);
205 sleep(2);
206 ret = g_tagTestSample.adaptr->Pause();
207 EXPECT_EQ(HI_SUCCESS, ret);
208 bool flag = g_tagTestSample.adaptr->IsPlaying();
209 EXPECT_EQ(false, flag);
210 g_tagTestSample.adaptr->Release();
211 sleep(1);
212 }
213
214 /* *
215 * @tc.number : SUB_MEDIA_PLAYER_PLAY_0700
216 * @tc.name : Video Pause Test.
217 * @tc.desc : [C- SOFTWARE -0200]
218 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_007,Level1)219 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_007, Level1)
220 {
221 int32_t ret = FileCheck(g_avFileName);
222 EXPECT_EQ(HI_SUCCESS, ret);
223 ret = CreateAndSetSource();
224 EXPECT_EQ(HI_SUCCESS, ret);
225 ret = g_tagTestSample.adaptr->Prepare();
226 EXPECT_EQ(HI_SUCCESS, ret);
227 ret = g_tagTestSample.adaptr->Pause();
228 EXPECT_EQ(HI_FAILURE, ret);
229 g_tagTestSample.adaptr->Release();
230 sleep(1);
231 }
232
233 /* *
234 * @tc.number : SUB_MEDIA_PLAYER_PLAY_0800
235 * @tc.name : Video GetCurrentTime Test.
236 * @tc.desc : [C- SOFTWARE -0200]
237 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_008,Level1)238 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_008, Level1)
239 {
240 int32_t ret = FileCheck(g_avFileName);
241 EXPECT_EQ(HI_SUCCESS, ret);
242 ret = CreateAndSetSource();
243 EXPECT_EQ(HI_SUCCESS, ret);
244 ret = g_tagTestSample.adaptr->Prepare();
245 EXPECT_EQ(HI_SUCCESS, ret);
246 ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface);
247 EXPECT_EQ(HI_SUCCESS, ret);
248 ret = g_tagTestSample.adaptr->Play();
249 EXPECT_EQ(HI_SUCCESS, ret);
250 sleep(1);
251 int64_t currentPosition;
252 ret = g_tagTestSample.adaptr->GetCurrentTime(currentPosition);
253 EXPECT_EQ(HI_SUCCESS, ret);
254 g_tagTestSample.adaptr->Release();
255 sleep(1);
256 }
257
258 /* *
259 * @tc.number : SUB_MEDIA_PLAYER_PLAY_0900
260 * @tc.name : Video GetCurrentTime Test.
261 * @tc.desc : [C- SOFTWARE -0200]
262 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_009,Level1)263 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_009, Level1)
264 {
265 int32_t ret = FileCheck(g_avFileName);
266 EXPECT_EQ(HI_SUCCESS, ret);
267 ret = CreateAndSetSource();
268 EXPECT_EQ(HI_SUCCESS, ret);
269 ret = g_tagTestSample.adaptr->Prepare();
270 EXPECT_EQ(HI_SUCCESS, ret);
271 int64_t currentPosition;
272 ret = g_tagTestSample.adaptr->GetCurrentTime(currentPosition);
273 EXPECT_EQ(HI_SUCCESS, ret);
274 ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface);
275 EXPECT_EQ(HI_SUCCESS, ret);
276 ret = g_tagTestSample.adaptr->Play();
277 EXPECT_EQ(HI_SUCCESS, ret);
278 sleep(1);
279 bool flag = g_tagTestSample.adaptr->IsPlaying();
280 EXPECT_EQ(true, flag);
281 g_tagTestSample.adaptr->Release();
282 sleep(1);
283 }
284
285 /* *
286 * @tc.number : SUB_MEDIA_PLAYER_PLAY_1000
287 * @tc.name : Video GetDuration Test.
288 * @tc.desc : [C- SOFTWARE -0200]
289 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_010,Level1)290 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_010, Level1)
291 {
292 int32_t ret = FileCheck(g_avFileName);
293 EXPECT_EQ(HI_SUCCESS, ret);
294 ret = CreateAndSetSource();
295 EXPECT_EQ(HI_SUCCESS, ret);
296 ret = g_tagTestSample.adaptr->Prepare();
297 EXPECT_EQ(HI_SUCCESS, ret);
298 ret = g_tagTestSample.adaptr->Play();
299 EXPECT_EQ(HI_SUCCESS, ret);
300 sleep(1);
301 ret = g_tagTestSample.adaptr->Pause();
302 EXPECT_EQ(HI_SUCCESS, ret);
303 ret = g_tagTestSample.adaptr->Rewind(1, PLAYER_SEEK_NEXT_SYNC);
304 EXPECT_EQ(HI_SUCCESS, ret);
305 int64_t currentPosition;
306 ret = g_tagTestSample.adaptr->GetCurrentTime(currentPosition);
307 EXPECT_EQ(HI_SUCCESS, ret);
308 g_tagTestSample.adaptr->Release();
309 sleep(1);
310 }
311
312 /* *
313 * @tc.number : SUB_MEDIA_PLAYER_PLAY_1100
314 * @tc.name : Video Rewind Test.
315 * @tc.desc : [C- SOFTWARE -0200]
316 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_011,Level1)317 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_011, Level1)
318 {
319 int32_t ret = FileCheck(g_avFileName);
320 EXPECT_EQ(HI_SUCCESS, ret);
321 ret = CreateAndSetSource();
322 EXPECT_EQ(HI_SUCCESS, ret);
323 ret = g_tagTestSample.adaptr->Prepare();
324 EXPECT_EQ(HI_SUCCESS, ret);
325 ret = g_tagTestSample.adaptr->Play();
326 EXPECT_EQ(HI_SUCCESS, ret);
327 sleep(1);
328 ret = g_tagTestSample.adaptr->Pause();
329 EXPECT_EQ(HI_SUCCESS, ret);
330 ret = g_tagTestSample.adaptr->Rewind(4, PLAYER_SEEK_NEXT_SYNC);
331 EXPECT_EQ(HI_SUCCESS, ret);
332 g_tagTestSample.adaptr->Release();
333 sleep(1);
334 }
335
336 /* *
337 * @tc.number : SUB_MEDIA_PLAYER_PLAY_1200
338 * @tc.name : Video GetDuration Test.
339 * @tc.desc : [C- SOFTWARE -0200]
340 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_012,Level1)341 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_012, Level1)
342 {
343 int32_t ret = FileCheck(g_avFileName);
344 EXPECT_EQ(HI_SUCCESS, ret);
345 ret = CreateAndSetSource();
346 EXPECT_EQ(HI_SUCCESS, ret);
347 ret = g_tagTestSample.adaptr->Prepare();
348 EXPECT_EQ(HI_SUCCESS, ret);
349 int64_t duration;
350 ret = g_tagTestSample.adaptr->GetDuration(duration);
351 EXPECT_EQ(HI_SUCCESS, ret);
352 g_tagTestSample.adaptr->Release();
353 sleep(1);
354 }
355
356 /* *
357 * @tc.number : SUB_MEDIA_PLAYER_PLAY_1300
358 * @tc.name : Video GetVideoSurfaceSize Test.
359 * @tc.desc : [C- SOFTWARE -0200]
360 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_013,Level1)361 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_013, Level1)
362 {
363 int32_t ret = FileCheck(g_avFileName);
364 EXPECT_EQ(HI_SUCCESS, ret);
365 ret = CreateAndSetSource();
366 EXPECT_EQ(HI_SUCCESS, ret);
367 ret = g_tagTestSample.adaptr->Prepare();
368 EXPECT_EQ(HI_SUCCESS, ret);
369 ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface);
370 EXPECT_EQ(HI_SUCCESS, ret);
371 ret = g_tagTestSample.adaptr->Play();
372 EXPECT_EQ(HI_SUCCESS, ret);
373 int32_t videoWidth;
374 ret = g_tagTestSample.adaptr->GetVideoWidth(videoWidth);
375 EXPECT_EQ(HI_SUCCESS, ret);
376 int32_t videoHeight;
377 ret = g_tagTestSample.adaptr->GetVideoHeight(videoHeight);
378 EXPECT_EQ(HI_SUCCESS, ret);
379 g_tagTestSample.adaptr->Release();
380 sleep(1);
381 }
382
383 /* *
384 * @tc.number : SUB_MEDIA_PLAYER_PLAY_1400
385 * @tc.name : Video GetVideoSurfaceSize Test.
386 * @tc.desc : [C- SOFTWARE -0200]
387 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_014,Level1)388 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_014, Level1)
389 {
390 int32_t ret = FileCheck(g_avFileName);
391 EXPECT_EQ(HI_SUCCESS, ret);
392 ret = CreateAndSetSource();
393 EXPECT_EQ(HI_SUCCESS, ret);
394 ret = g_tagTestSample.adaptr->Prepare();
395 EXPECT_EQ(HI_SUCCESS, ret);
396 ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface);
397 EXPECT_EQ(HI_SUCCESS, ret);
398 ret = g_tagTestSample.adaptr->Play();
399 EXPECT_EQ(HI_SUCCESS, ret);
400 int32_t videoWidth;
401 ret = g_tagTestSample.adaptr->GetVideoWidth(videoWidth);
402 EXPECT_EQ(HI_SUCCESS, ret);
403 g_tagTestSample.adaptr->Release();
404 sleep(1);
405 }
406
407 /* *
408 * @tc.number : SUB_MEDIA_PLAYER_PLAY_1500
409 * @tc.name : Video GetVideoSurfaceSize Test.
410 * @tc.desc : [C- SOFTWARE -0200]
411 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_015,Level1)412 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_015, Level1)
413 {
414 int32_t ret = FileCheck(g_avFileName);
415 EXPECT_EQ(HI_SUCCESS, ret);
416 ret = CreateAndSetSource();
417 EXPECT_EQ(HI_SUCCESS, ret);
418 ret = g_tagTestSample.adaptr->Prepare();
419 EXPECT_EQ(HI_SUCCESS, ret);
420 ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface);
421 EXPECT_EQ(HI_SUCCESS, ret);
422 ret = g_tagTestSample.adaptr->Play();
423 EXPECT_EQ(HI_SUCCESS, ret);
424 int32_t videoHeight;
425 ret = g_tagTestSample.adaptr->GetVideoHeight(videoHeight);
426 EXPECT_EQ(HI_SUCCESS, ret);
427 g_tagTestSample.adaptr->Release();
428 sleep(1);
429 }
430
431 /* *
432 * @tc.number : SUB_MEDIA_PLAYER_PLAY_1600
433 * @tc.name : Video Reset Test.
434 * @tc.desc : [C- SOFTWARE -0200]
435 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_016,Level1)436 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_016, Level1)
437 {
438 int32_t ret = FileCheck(g_avFileName);
439 EXPECT_EQ(HI_SUCCESS, ret);
440 ret = CreateAndSetSource();
441 EXPECT_EQ(HI_SUCCESS, ret);
442 ret = g_tagTestSample.adaptr->Prepare();
443 EXPECT_EQ(HI_SUCCESS, ret);
444 ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface);
445 EXPECT_EQ(HI_SUCCESS, ret);
446 ret = g_tagTestSample.adaptr->Play();
447 EXPECT_EQ(HI_SUCCESS, ret);
448 sleep(2);
449 ret = g_tagTestSample.adaptr->Reset();
450 EXPECT_EQ(HI_SUCCESS, ret);
451 g_tagTestSample.adaptr->Release();
452 sleep(1);
453 }
454
455 /* *
456 * @tc.number : SUB_MEDIA_PLAYER_PLAY_1700
457 * @tc.name : Video Reset Test.
458 * @tc.desc : [C- SOFTWARE -0200]
459 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_017,Level1)460 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_017, Level1)
461 {
462 int32_t ret = FileCheck(g_avFileName);
463 EXPECT_EQ(HI_SUCCESS, ret);
464 ret = CreateAndSetSource();
465 EXPECT_EQ(HI_SUCCESS, ret);
466 ret = g_tagTestSample.adaptr->Prepare();
467 EXPECT_EQ(HI_SUCCESS, ret);
468 ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface);
469 EXPECT_EQ(HI_SUCCESS, ret);
470 ret = g_tagTestSample.adaptr->Reset();
471 EXPECT_EQ(HI_SUCCESS, ret);
472 g_tagTestSample.adaptr->Release();
473 sleep(1);
474 }
475
476 /* *
477 * @tc.number : SUB_MEDIA_PLAYER_PLAY_1800
478 * @tc.name : Video Release Test.
479 * @tc.desc : [C- SOFTWARE -0200]
480 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_018,Level1)481 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_018, Level1)
482 {
483 int32_t ret = FileCheck(g_avFileName);
484 EXPECT_EQ(HI_SUCCESS, ret);
485 ret = CreateAndSetSource();
486 EXPECT_EQ(HI_SUCCESS, ret);
487 ret = g_tagTestSample.adaptr->Prepare();
488 EXPECT_EQ(HI_SUCCESS, ret);
489 ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface);
490 EXPECT_EQ(HI_SUCCESS, ret);
491 ret = g_tagTestSample.adaptr->Play();
492 EXPECT_EQ(HI_SUCCESS, ret);
493 sleep(2);
494 ret = g_tagTestSample.adaptr->Release();
495 EXPECT_EQ(HI_SUCCESS, ret);
496 sleep(1);
497 }
498
499 /* *
500 * @tc.number : SUB_MEDIA_PLAYER_PLAY_1900
501 * @tc.name : Video EnableSingleLooping Test.
502 * @tc.desc : [C- SOFTWARE -0200]
503 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_019,Level1)504 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_019, Level1)
505 {
506 int32_t ret = FileCheck(g_avFileName);
507 EXPECT_EQ(HI_SUCCESS, ret);
508 ret = CreateAndSetSource();
509 EXPECT_EQ(HI_SUCCESS, ret);
510 ret = g_tagTestSample.adaptr->Prepare();
511 EXPECT_EQ(HI_SUCCESS, ret);
512 ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface);
513 EXPECT_EQ(HI_SUCCESS, ret);
514 bool loop = true;
515 ret = g_tagTestSample.adaptr->EnableSingleLooping(loop);
516 EXPECT_EQ(HI_SUCCESS, ret);
517 ret = g_tagTestSample.adaptr->Play();
518 sleep(1);
519 EXPECT_EQ(HI_SUCCESS, ret);
520 bool flag = g_tagTestSample.adaptr->IsPlaying();
521 EXPECT_EQ(true, flag);
522 g_tagTestSample.adaptr->Release();
523 sleep(1);
524 }
525
526 /* *
527 * @tc.number : SUB_MEDIA_PLAYER_PLAY_2000
528 * @tc.name : Video EnableSingleLooping Test.
529 * @tc.desc : [C- SOFTWARE -0200]
530 */
HWTEST_F(ActsMediaPlayerVideoTest,player_lite_video_test_020,Level1)531 HWTEST_F(ActsMediaPlayerVideoTest, player_lite_video_test_020, Level1)
532 {
533 int32_t ret = FileCheck(g_avFileName);
534 EXPECT_EQ(HI_SUCCESS, ret);
535 ret = CreateAndSetSource();
536 EXPECT_EQ(HI_SUCCESS, ret);
537 ret = g_tagTestSample.adaptr->Prepare();
538 EXPECT_EQ(HI_SUCCESS, ret);
539 ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface);
540 EXPECT_EQ(HI_SUCCESS, ret);
541 ret = g_tagTestSample.adaptr->Play();
542 sleep(1);
543 EXPECT_EQ(HI_SUCCESS, ret);
544 bool loop = true;
545 ret = g_tagTestSample.adaptr->EnableSingleLooping(loop);
546 EXPECT_EQ(HI_SUCCESS, ret);
547 bool flag = g_tagTestSample.adaptr->IsPlaying();
548 EXPECT_EQ(true, flag);
549 g_tagTestSample.adaptr->Release();
550 }
551 } // OHOS
552