1 /*
2 * Copyright (c) 2022-2023 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 #include <gtest/gtest.h>
17 #include "dcamera_hdf_demo.h"
18 #include "distributed_hardware_log.h"
19
20 using namespace testing::ext;
21 using namespace OHOS::DistributedHardware;
22
23 auto mainDemo = std::make_shared<DcameraHdfDemo>();
24 int32_t cameraOk = 0;
25 int32_t sleepOk = 2;
26 int32_t camoreError = -1;
27
28 class DCameraAutomatTest : public testing::Test {
29 public:
30 static void SetUpTestCase(void);
31 static void TearDownTestCase(void);
32 void SetUp();
33 void TearDown();
34 DCameraAutomatTest();
35 };
SetUpTestCase(void)36 void DCameraAutomatTest::SetUpTestCase(void)
37 {
38 int32_t ret = mainDemo->InitSensors();
39 if (ret == camoreError) {
40 DHLOGE("main test: mainDemo->InitSensors() error");
41 return;
42 }
43
44 ret = mainDemo->InitCameraDevice();
45 if (ret == camoreError) {
46 DHLOGE("main test: mainDemo->InitCameraDevice() error");
47 return;
48 }
49 mainDemo->SetEnableResult();
50 }
51
TearDownTestCase(void)52 void DCameraAutomatTest::TearDownTestCase(void)
53 {
54 PreviewOff(mainDemo);
55 mainDemo->QuitDemo();
56 }
SetUp(void)57 void DCameraAutomatTest::SetUp(void) {}
TearDown(void)58 void DCameraAutomatTest::TearDown(void) {}
DCameraAutomatTest(void)59 DCameraAutomatTest::DCameraAutomatTest(void) {}
60
61 /**
62 * @tc.number : DCameraTest_0100
63 * @tc.name :PreviewOn()
64 * @tc.desc : [STD-DISTRIBUTED-0101]禁止修改分布式相机交互协议
65 * @tc.desc : Invoke the preview stream to send the preview file back to the local end and save it to the local end
66 * @tc.type : FUNC
67 * @tc.size : Medium test
68 */
69 HWTEST_F(DCameraAutomatTest, DCameraTest_0100, TestSize.Level1)
70 {
71 int32_t ret = PreviewOn(0, mainDemo);
72 EXPECT_EQ(cameraOk, ret) << "PreviewOn fail";
73 sleep(sleepOk);
74 }
75
76 /**
77 * @tc.number : DCameraTest_0100
78 * @tc.name : CaptureTest()
79 * @tc.desc : [STD-DISTRIBUTED-0101]禁止修改分布式相机交互协议
80 * @tc.desc : Take pictures with a remote camera and save them locally
81 * @tc.type : FUNC
82 * @tc.size : Medium test
83 */
84 HWTEST_F(DCameraAutomatTest, DCameraTest_0200, TestSize.Level1)
85 {
86 int32_t ret = CaptureTest(mainDemo);
87 EXPECT_EQ(cameraOk, ret) << "CaptureTest fail";
88 sleep(sleepOk);
89 }
90
91 /**
92 * @tc.number : DCameraTest_0700
93 * @tc.name :VideoTest()
94 * @tc.desc : [STD-DISTRIBUTED-0101]禁止修改分布式相机交互协议
95 * @tc.desc : Record video with a remote camera and save the video locally
96 * @tc.type : FUNC
97 * @tc.size : Medium test
98 */
99 HWTEST_F(DCameraAutomatTest, DCameraTest_0300, TestSize.Level1)
100 {
101 int32_t ret = VideoTest(mainDemo);
102 EXPECT_EQ(cameraOk, ret) << "VideoTest fail";
103 sleep(sleepOk);
104 }
105
106 /**
107 * @tc.number : DCameraTest_0200
108 * @tc.name : SetAwbMode()
109 * @tc.desc : [STD-DISTRIBUTED-0101]禁止修改分布式相机交互协议
110 * @tc.desc : Set Awb Mode is 0, success is returned
111 * @tc.type : FUNC
112 * @tc.size : Medium test
113 */
114 HWTEST_F(DCameraAutomatTest, DCameraTest_0400, TestSize.Level1)
115 {
116 int32_t ret = mainDemo->SetAwbMode(sleepOk);
117 EXPECT_EQ(cameraOk, ret) << "SetAwbMode incandescent fail";
118 sleep(sleepOk);
119 }
120
121 /**
122 * @tc.number : DCameraTest_0300
123 * @tc.name : SetAwbMode()
124 * @tc.desc : [STD-DISTRIBUTED-0101]禁止修改分布式相机交互协议
125 * @tc.desc : the Set Awb Mode is 2, success is returned
126 * @tc.type : FUNC
127 * @tc.size : Medium test
128 */
129 HWTEST_F(DCameraAutomatTest, DCameraTest_0500, TestSize.Level1)
130 {
131 int32_t ret = mainDemo->SetAwbMode(cameraOk);
132 EXPECT_EQ(cameraOk, ret) << "SetAwbMode fail";
133 sleep(sleepOk);
134 }
135
136 /**
137 * @tc.number : DCameraTest_0400
138 * @tc.name :mainDemo->SetAeExpo()
139 * @tc.desc : [STD-DISTRIBUTED-0101]禁止修改分布式相机交互协议
140 * @tc.desc : Set the exposure mode update parameters
141 * @tc.type : FUNC
142 * @tc.size : Medium test
143 */
144 HWTEST_F(DCameraAutomatTest, DCameraTest_0600, TestSize.Level1)
145 {
146 int32_t ret = mainDemo->SetAeExpo();
147 EXPECT_EQ(cameraOk, ret) << "SetAeExpo fail";
148 sleep(sleepOk);
149 }
150
151 /**
152 * @tc.number : DCameraTest_0500
153 * @tc.name :mainDemo->SetMetadata()
154 * @tc.desc : [STD-DISTRIBUTED-0101]禁止修改分布式相机交互协议
155 * @tc.desc : Set the parameters required for taking pictures and recording videos
156 * @tc.type : FUNC
157 * @tc.size : Medium test
158 */
159 HWTEST_F(DCameraAutomatTest, DCameraTest_0700, TestSize.Level1)
160 {
161 int32_t ret = mainDemo->SetMetadata();
162 EXPECT_EQ(cameraOk, ret) << "SetMetadata fail";
163 sleep(sleepOk);
164 }
165
166 /**
167 * @tc.number : DCameraTest_0800
168 * @tc.name :FlashLightTest()
169 * @tc.desc : [STD-DISTRIBUTED-0101]禁止修改分布式相机交互协议
170 * @tc.desc : Turn off the preview stream, turn on the flashlight, init the camera device, and turn on the preview
171 * @tc.type : FUNC
172 * @tc.size : Medium test
173 */
174 HWTEST_F(DCameraAutomatTest, DCameraTest_0800, TestSize.Level1)
175 {
176 int32_t ret = FlashLightTest(mainDemo);
177 EXPECT_EQ(cameraOk, ret) << "FlashLightTest fail";
178 sleep(sleepOk);
179 }
180
181 /**
182 * @tc.number : DCameraTest_0900
183 * @tc.name :OfflineTest()
184 * @tc.desc : [STD-DISTRIBUTED-0101]禁止修改分布式相机交互协议
185 * @tc.desc : Turn off Preview Turn on dual-stream offline mode delay 5 seconds after init the camera device
186 * @tc.type : FUNC
187 * @tc.size : Medium test
188 */
189 HWTEST_F(DCameraAutomatTest, DCameraTest_0900, TestSize.Level1)
190 {
191 int32_t ret = OfflineTest(mainDemo);
192 EXPECT_EQ(cameraOk, ret) << "OfflineTest fail";
193 }
194
195 /**
196 * @tc.number : DCameraTest_1000
197 * @tc.name : Test whether preview and awb parameter Settings can be successful
198 * @tc.desc : Composite test function
199 * @tc.type : FUNC
200 * @tc.size : Medium test
201 */
202 HWTEST_F(DCameraAutomatTest, DCameraTest_1000, TestSize.Level1)
203 {
204 int32_t ret = PreviewOn(0, mainDemo);
205 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
206 sleep(sleepOk);
207 ret = mainDemo->SetAwbMode(sleepOk);
208 EXPECT_EQ(cameraOk, ret) << "SetAwbMode incandescent fail";
209 sleep(sleepOk);
210 ret = mainDemo->SetAwbMode(cameraOk);
211 EXPECT_EQ(cameraOk, ret) << "SetAwbMode fail";
212 sleep(sleepOk);
213 }
214
215 /**
216 * @tc.number : DCameraTest_1100
217 * @tc.name : Whether an error occurs when multiple methods are executed consecutively
218 * @tc.desc : Composite test function
219 * @tc.type : FUNC
220 * @tc.size : Medium test
221 */
222 HWTEST_F(DCameraAutomatTest, DCameraTest_1100, TestSize.Level1)
223 {
224 int32_t ret = mainDemo->SetAeExpo();
225 EXPECT_EQ(cameraOk, ret) << "SetAeExpo fail";
226 sleep(sleepOk);
227 ret = mainDemo->SetMetadata();
228 EXPECT_EQ(cameraOk, ret) << "SetMetadata fail";
229 sleep(sleepOk);
230 ret = CaptureTest(mainDemo);
231 EXPECT_EQ(cameraOk, ret) << "CaptureTest fail";
232 sleep(sleepOk);
233 }
234
235 /**
236 * @tc.number : DCameraTest_1200
237 * @tc.name : Whether an error occurs when multiple methods are executed consecutively
238 * @tc.desc : Composite test function
239 * @tc.type : FUNC
240 * @tc.size : Medium test
241 */
242 HWTEST_F(DCameraAutomatTest, DCameraTest_1200, TestSize.Level1)
243 {
244 int32_t ret = VideoTest(mainDemo);
245 EXPECT_EQ(cameraOk, ret) << "VideoTest fail";
246 sleep(sleepOk);
247 ret = FlashLightTest(mainDemo);
248 EXPECT_EQ(cameraOk, ret) << "FlashLightTest fail";
249 sleep(sleepOk);
250 ret = OfflineTest(mainDemo);
251 EXPECT_EQ(cameraOk, ret) << "OfflineTest fail";
252 }
253
254 /**
255 * @tc.number : DCameraTest_1300
256 * @tc.name : Scramble the method invocation order to see if the method invocation fails
257 * @tc.desc : Composite test function
258 * @tc.type : FUNC
259 * @tc.size : Medium test
260 */
261 HWTEST_F(DCameraAutomatTest, DCameraTest_1300, TestSize.Level1)
262 {
263 int32_t ret = PreviewOn(0, mainDemo);
264 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
265 sleep(sleepOk);
266 ret = mainDemo->SetAwbMode(cameraOk);
267 EXPECT_EQ(cameraOk, ret) << "SetAwbMode fail";
268 sleep(sleepOk);
269 ret = mainDemo->SetAwbMode(sleepOk);
270 EXPECT_EQ(cameraOk, ret) << "SetAwbMode incandescent fail";
271 sleep(sleepOk);
272 }
273
274 /**
275 * @tc.number : DCameraTest_1400
276 * @tc.name : Scramble the method invocation order to see if the method invocation fails
277 * @tc.desc : Composite test function
278 * @tc.type : FUNC
279 * @tc.size : Medium test
280 */
281 HWTEST_F(DCameraAutomatTest, DCameraTest_1400, TestSize.Level1)
282 {
283 int32_t ret = mainDemo->SetAeExpo();
284 EXPECT_EQ(cameraOk, ret) << "SetAeExpo fail";
285 sleep(sleepOk);
286 ret = CaptureTest(mainDemo);
287 EXPECT_EQ(cameraOk, ret) << "CaptureTest fail";
288 sleep(sleepOk);
289 ret = mainDemo->SetMetadata();
290 EXPECT_EQ(cameraOk, ret) << "SetMetadata fail";
291 sleep(sleepOk);
292 }
293
294 /**
295 * @tc.number : DCameraTest_1500
296 * @tc.name : Scramble the method invocation order to see if the method invocation fails
297 * @tc.desc : Composite test function
298 * @tc.type : FUNC
299 * @tc.size : Medium test
300 */
301 HWTEST_F(DCameraAutomatTest, DCameraTest_1500, TestSize.Level1)
302 {
303 int32_t ret = VideoTest(mainDemo);
304 EXPECT_EQ(cameraOk, ret) << "VideoTest fail";
305 sleep(sleepOk);
306 ret = OfflineTest(mainDemo);
307 EXPECT_EQ(cameraOk, ret) << "OfflineTest fail";
308 ret = FlashLightTest(mainDemo);
309 EXPECT_EQ(cameraOk, ret) << "FlashLightTest fail";
310 sleep(sleepOk);
311 }
312
313 /**
314 * @tc.number : DCameraTest_1600
315 * @tc.name : Scramble the method invocation order to see if the method invocation fails
316 * @tc.desc : Composite test function
317 * @tc.type : FUNC
318 * @tc.size : Medium test
319 */
320 HWTEST_F(DCameraAutomatTest, DCameraTest_1600, TestSize.Level1)
321 {
322 int32_t ret = mainDemo->SetAwbMode(sleepOk);
323 EXPECT_EQ(cameraOk, ret) << "SetAwbMode incandescent fail";
324 sleep(sleepOk);ret = PreviewOn(0, mainDemo);
325 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
326 sleep(sleepOk);
327 ret = mainDemo->SetAwbMode(cameraOk);
328 EXPECT_EQ(cameraOk, ret) << "SetAwbMode fail";
329 sleep(sleepOk);
330 }
331
332 /**
333 * @tc.number : DCameraTest_1700
334 * @tc.name : Scramble the method invocation order to see if the method invocation fails
335 * @tc.desc : Composite test function
336 * @tc.type : FUNC
337 * @tc.size : Medium test
338 */
339 HWTEST_F(DCameraAutomatTest, DCameraTest_1700, TestSize.Level1)
340 {
341 int32_t ret = mainDemo->SetMetadata();
342 EXPECT_EQ(cameraOk, ret) << "SetMetadata fail";
343 sleep(sleepOk);
344 ret = mainDemo->SetAeExpo();
345 EXPECT_EQ(cameraOk, ret) << "SetAeExpo fail";
346 sleep(sleepOk);
347 ret = CaptureTest(mainDemo);
348 EXPECT_EQ(cameraOk, ret) << "CaptureTest fail";
349 sleep(sleepOk);
350 }
351
352 /**
353 * @tc.number : DCameraTest_1800
354 * @tc.name : Scramble the method invocation order to see if the method invocation fails
355 * @tc.desc : Composite test function
356 * @tc.type : FUNC
357 * @tc.size : Medium test
358 */
359 HWTEST_F(DCameraAutomatTest, DCameraTest_1800, TestSize.Level1)
360 {
361 int32_t ret = FlashLightTest(mainDemo);
362 EXPECT_EQ(cameraOk, ret) << "FlashLightTest fail";
363 sleep(sleepOk);
364 ret = VideoTest(mainDemo);
365 EXPECT_EQ(cameraOk, ret) << "VideoTest fail";
366 sleep(sleepOk);
367 ret = OfflineTest(mainDemo);
368 EXPECT_EQ(cameraOk, ret) << "OfflineTest fail";
369 }
370
371 /**
372 * @tc.number : DCameraTest_1900
373 * @tc.name : Scramble the method invocation order to see if the method invocation fails
374 * @tc.desc : Composite test function
375 * @tc.type : FUNC
376 * @tc.size : Medium test
377 */
378 HWTEST_F(DCameraAutomatTest, DCameraTest_1900, TestSize.Level1)
379 {
380 int32_t ret = mainDemo->SetAwbMode(cameraOk);
381 EXPECT_EQ(cameraOk, ret) << "SetAwbMode fail";
382 sleep(sleepOk);
383 ret = mainDemo->SetAwbMode(sleepOk);
384 EXPECT_EQ(cameraOk, ret) << "SetAwbMode incandescent fail";
385 sleep(sleepOk);
386 ret = PreviewOn(0, mainDemo);
387 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
388 sleep(sleepOk);
389 }
390
391 /**
392 * @tc.number : DCameraTest_2000
393 * @tc.name : Scramble the method invocation order to see if the method invocation fails
394 * @tc.desc : Composite test function
395 * @tc.type : FUNC
396 * @tc.size : Medium test
397 */
398 HWTEST_F(DCameraAutomatTest, DCameraTest_2000, TestSize.Level1)
399 {
400 int32_t ret = CaptureTest(mainDemo);
401 EXPECT_EQ(cameraOk, ret) << "CaptureTest fail";
402 sleep(sleepOk);
403 ret = mainDemo->SetMetadata();
404 EXPECT_EQ(cameraOk, ret) << "SetMetadata fail";
405 sleep(sleepOk);
406 ret = mainDemo->SetAeExpo();
407 EXPECT_EQ(cameraOk, ret) << "SetAeExpo fail";
408 sleep(sleepOk);
409 }
410
411 /**
412 * @tc.number : DCameraTest_2100
413 * @tc.name : Scramble the method invocation order to see if the method invocation fails
414 * @tc.desc : Composite test function
415 * @tc.type : FUNC
416 * @tc.size : Medium test
417 */
418 HWTEST_F(DCameraAutomatTest, DCameraTest_2100, TestSize.Level1)
419 {
420 int32_t ret = OfflineTest(mainDemo);
421 EXPECT_EQ(cameraOk, ret) << "OfflineTest fail";
422 ret = FlashLightTest(mainDemo);
423 EXPECT_EQ(cameraOk, ret) << "FlashLightTest fail";
424 sleep(sleepOk);
425 ret = VideoTest(mainDemo);
426 EXPECT_EQ(cameraOk, ret) << "VideoTest fail";
427 sleep(sleepOk);
428 }
429
430 /**
431 * @tc.number : DCameraTest_2200
432 * @tc.name : Scramble the method invocation order to see if the method invocation fails
433 * @tc.desc : Composite test function
434 * @tc.type : FUNC
435 * @tc.size : Medium test
436 */
437 HWTEST_F(DCameraAutomatTest, DCameraTest_2200, TestSize.Level1)
438 {
439 int32_t ret = mainDemo->SetAeExpo();
440 EXPECT_EQ(cameraOk, ret) << "SetAeExpo fail";
441 sleep(sleepOk);
442 ret = mainDemo->SetMetadata();
443 EXPECT_EQ(cameraOk, ret) << "SetMetadata fail";
444 sleep(sleepOk);
445 ret = CaptureTest(mainDemo);
446 EXPECT_EQ(cameraOk, ret) << "CaptureTest fail";
447 sleep(sleepOk);
448 }
449
450 /**
451 * @tc.number : DCameraTest_2300
452 * @tc.name : Scramble the method invocation order to see if the method invocation fails
453 * @tc.desc : Composite test function
454 * @tc.type : FUNC
455 * @tc.size : Medium test
456 */
457 HWTEST_F(DCameraAutomatTest, DCameraTest_2300, TestSize.Level1)
458 {
459 int32_t ret = PreviewOn(0, mainDemo);
460 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
461 sleep(sleepOk);
462 ret = mainDemo->SetAwbMode(sleepOk);
463 EXPECT_EQ(cameraOk, ret) << "SetAwbMode incandescent fail";
464 sleep(sleepOk);
465 ret = mainDemo->SetAwbMode(cameraOk);
466 EXPECT_EQ(cameraOk, ret) << "SetAwbMode fail";
467 sleep(sleepOk);
468 }
469
470 /**
471 * @tc.number : DCameraTest_2400
472 * @tc.name : Scramble the method invocation order to see if the method invocation fails
473 * @tc.desc : Composite test function
474 * @tc.type : FUNC
475 * @tc.size : Medium test
476 */
477 HWTEST_F(DCameraAutomatTest, DCameraTest_2400, TestSize.Level1)
478 {
479 int32_t ret = VideoTest(mainDemo);
480 EXPECT_EQ(cameraOk, ret) << "VideoTest fail";
481 sleep(sleepOk);
482 ret = FlashLightTest(mainDemo);
483 EXPECT_EQ(cameraOk, ret) << "FlashLightTest fail";
484 sleep(sleepOk);
485 ret = OfflineTest(mainDemo);
486 EXPECT_EQ(cameraOk, ret) << "OfflineTest fail";
487 }
488
489 /**
490 * @tc.number : DCameraTest_2500
491 * @tc.name : Scramble the method invocation order to see if the method invocation fails
492 * @tc.desc : Composite test function
493 * @tc.type : FUNC
494 * @tc.size : Medium test
495 */
496 HWTEST_F(DCameraAutomatTest, DCameraTest_2500, TestSize.Level1)
497 {
498 int32_t ret = VideoTest(mainDemo);
499 EXPECT_EQ(cameraOk, ret) << "VideoTest fail";
500 sleep(sleepOk);
501 ret = FlashLightTest(mainDemo);
502 EXPECT_EQ(cameraOk, ret) << "FlashLightTest fail";
503 sleep(sleepOk);
504 ret = OfflineTest(mainDemo);
505 EXPECT_EQ(cameraOk, ret) << "OfflineTest fail";
506 }
507
508 /**
509 * @tc.number : DCameraTest_2600
510 * @tc.name : Scramble the method invocation order to see if the method invocation fails
511 * @tc.desc : Composite test function
512 * @tc.type : FUNC
513 * @tc.size : Medium test
514 */
515 HWTEST_F(DCameraAutomatTest, DCameraTest_2600, TestSize.Level1)
516 {
517 int32_t ret = PreviewOn(0, mainDemo);
518 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
519 sleep(sleepOk);
520 ret = mainDemo->SetAwbMode(sleepOk);
521 EXPECT_EQ(cameraOk, ret) << "SetAwbMode incandescent fail";
522 sleep(sleepOk);
523 ret = mainDemo->SetAwbMode(cameraOk);
524 EXPECT_EQ(cameraOk, ret) << "SetAwbMode fail";
525 sleep(sleepOk);
526 }
527
528 /**
529 * @tc.number : DCameraTest_2700
530 * @tc.name : Scramble the method invocation order to see if the method invocation fails
531 * @tc.desc : Composite test function
532 * @tc.type : FUNC
533 * @tc.size : Medium test
534 */
535 HWTEST_F(DCameraAutomatTest, DCameraTest_2700, TestSize.Level1)
536 {
537 int32_t ret = mainDemo->SetAeExpo();
538 EXPECT_EQ(cameraOk, ret) << "SetAeExpo fail";
539 sleep(sleepOk);
540 ret = mainDemo->SetMetadata();
541 EXPECT_EQ(cameraOk, ret) << "SetMetadata fail";
542 sleep(sleepOk);
543 ret = CaptureTest(mainDemo);
544 EXPECT_EQ(cameraOk, ret) << "CaptureTest fail";
545 sleep(sleepOk);
546 }
547
548 /**
549 * @tc.number : DCameraTest_2800
550 * @tc.name : Scramble the method invocation order to see if the method invocation fails
551 * @tc.desc : Composite test function
552 * @tc.type : FUNC
553 * @tc.size : Medium test
554 */
555 HWTEST_F(DCameraAutomatTest, DCameraTest_2800, TestSize.Level1)
556 {
557 int32_t ret = VideoTest(mainDemo);
558 EXPECT_EQ(cameraOk, ret) << "VideoTest fail";
559 sleep(sleepOk);
560 ret = OfflineTest(mainDemo);
561 EXPECT_EQ(cameraOk, ret) << "OfflineTest fail";
562 ret = FlashLightTest(mainDemo);
563 EXPECT_EQ(cameraOk, ret) << "FlashLightTest fail";
564 sleep(sleepOk);
565 }
566
567 /**
568 * @tc.number : DCameraTest_2900
569 * @tc.name : Scramble the method invocation order to see if the method invocation fails
570 * @tc.desc : Composite test function
571 * @tc.type : FUNC
572 * @tc.size : Medium test
573 */
574 HWTEST_F(DCameraAutomatTest, DCameraTest_2900, TestSize.Level1)
575 {
576 int32_t ret = PreviewOn(0, mainDemo);
577 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
578 sleep(sleepOk);
579 ret = mainDemo->SetAwbMode(cameraOk);
580 EXPECT_EQ(cameraOk, ret) << "SetAwbMode fail";
581 sleep(sleepOk);
582 ret = mainDemo->SetAwbMode(sleepOk);
583 EXPECT_EQ(cameraOk, ret) << "SetAwbMode incandescent fail";
584 sleep(sleepOk);
585 }
586
587 /**
588 * @tc.number : DCameraTest_3000
589 * @tc.name : Scramble the method invocation order to see if the method invocation fails
590 * @tc.desc : Composite test function
591 * @tc.type : FUNC
592 * @tc.size : Medium test
593 */
594 HWTEST_F(DCameraAutomatTest, DCameraTest_3000, TestSize.Level1)
595 {
596 int32_t ret = mainDemo->SetAeExpo();
597 EXPECT_EQ(cameraOk, ret) << "SetAeExpo fail";
598 sleep(sleepOk);
599 ret = CaptureTest(mainDemo);
600 EXPECT_EQ(cameraOk, ret) << "CaptureTest fail";
601 sleep(sleepOk);
602 ret = mainDemo->SetMetadata();
603 EXPECT_EQ(cameraOk, ret) << "SetMetadata fail";
604 sleep(sleepOk);
605 }
606
607 /**
608 * @tc.number : DCameraTest_3100
609 * @tc.name : Preview method Enter error parameters to see the return value
610 * @tc.desc : Test preview exception
611 * @tc.type : FUNC
612 * @tc.size : Medium test
613 */
614 HWTEST_F(DCameraAutomatTest, DCameraTest_3100, TestSize.Level1)
615 {
616 int32_t ret = PreviewOn(1, mainDemo);
617 DHLOGI("DCameraTest_3100 = ", ret);
618 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
619 sleep(sleepOk);
620 }
621
622 /**
623 * @tc.number : DCameraTest_3200
624 * @tc.name : Preview method Enter error parameters to see the return value
625 * @tc.desc : Test preview exception
626 * @tc.type : FUNC
627 * @tc.size : Medium test
628 */
629 HWTEST_F(DCameraAutomatTest, DCameraTest_3200, TestSize.Level1)
630 {
631 int32_t ret = PreviewOn(1, nullptr);
632 DHLOGI("DCameraTest_3200 = ", ret);
633 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
634 sleep(sleepOk);
635 }
636
637 /**
638 * @tc.number : DCameraTest_3300
639 * @tc.name : Preview method Enter error parameters to see the return value
640 * @tc.desc : Test preview exception
641 * @tc.type : FUNC
642 * @tc.size : Medium test
643 */
644 HWTEST_F(DCameraAutomatTest, DCameraTest_3300, TestSize.Level1)
645 {
646 int32_t ret = PreviewOn(0, nullptr);
647 DHLOGI("DCameraTest_3300 = ", ret);
648 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
649 sleep(sleepOk);
650 }
651
652 /**
653 * @tc.number : DCameraTest_3400
654 * @tc.name : Preview method Enter error parameters to see the return value
655 * @tc.desc : Test preview exception
656 * @tc.type : FUNC
657 * @tc.size : Medium test
658 */
659 HWTEST_F(DCameraAutomatTest, DCameraTest_3400, TestSize.Level1)
660 {
661 int32_t ret = PreviewOn(-1, mainDemo);
662 DHLOGI("DCameraTest_3400 = ", ret);
663 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
664 sleep(sleepOk);
665 }
666
667 /**
668 * @tc.number : DCameraTest_3500
669 * @tc.name : Set the wrong awb mode to view the return result
670 * @tc.desc : Test SetAwbMode exception
671 * @tc.type : FUNC
672 * @tc.size : Medium test
673 */
674 HWTEST_F(DCameraAutomatTest, DCameraTest_3500, TestSize.Level1)
675 {
676 int32_t ret = mainDemo->SetAwbMode(5);
677 DHLOGI("DCameraTest_3500 = ", ret);
678 EXPECT_NE(cameraOk, ret) << "SetAwbMode incandescent fail";
679 sleep(sleepOk);
680 }
681
682 /**
683 * @tc.number : DCameraTest_3600
684 * @tc.name : Set the wrong awb mode to view the return result
685 * @tc.desc : Test SetAwbMode exception
686 * @tc.type : FUNC
687 * @tc.size : Medium test
688 */
689 HWTEST_F(DCameraAutomatTest, DCameraTest_3600, TestSize.Level1)
690 {
691 int32_t ret = mainDemo->SetAwbMode(camoreError);
692 DHLOGI("DCameraTest_3600 = ", ret);
693 EXPECT_NE(cameraOk, ret) << "SetAwbMode incandescent fail";
694 sleep(sleepOk);
695 }
696
697 /**
698 * @tc.number : DCameraTest_3700
699 * @tc.name : awb mode input error parameters when calling the SetAeExpo method to see the results
700 * @tc.desc : Test SetAwbMode,SetAeExpo exception
701 * @tc.type : FUNC
702 * @tc.size : Medium test
703 */
704 HWTEST_F(DCameraAutomatTest, DCameraTest_3700, TestSize.Level1)
705 {
706 int32_t ret = mainDemo->SetAwbMode(camoreError);
707 DHLOGI("DCameraTest_3700 = ", ret);
708 EXPECT_NE(cameraOk, ret) << "SetAwbMode incandescent fail";
709 sleep(sleepOk);
710 ret = mainDemo->SetAeExpo();
711 DHLOGI("DCameraTest_3701 = ", ret);
712 EXPECT_EQ(cameraOk, ret) << "SetAeExpo fail";
713 sleep(sleepOk);
714 }
715
716 /**
717 * @tc.number : DCameraTest_3800
718 * @tc.name : awb mode input error parameters when calling the SetAeExpo method to see the results
719 * @tc.desc : Test SetAwbMode,SetAeExpo exception
720 * @tc.type : FUNC
721 * @tc.size : Medium test
722 */
723 HWTEST_F(DCameraAutomatTest, DCameraTest_3800, TestSize.Level1)
724 {
725 int32_t ret = mainDemo->SetAwbMode(camoreError);
726 DHLOGI("DCameraTest_3800 = ", ret);
727 EXPECT_NE(cameraOk, ret) << "SetAwbMode incandescent fail";
728 sleep(sleepOk);
729 ret = mainDemo->SetMetadata();
730 DHLOGI("DCameraTest_3801 = ", ret);
731 EXPECT_EQ(cameraOk, ret) << "SetMetadata fail";
732 sleep(sleepOk);
733 }
734
735 /**
736 * @tc.number : DCameraTest_3900
737 * @tc.name : CaptureTest Enter a null value to view the return result
738 * @tc.desc : Test exception
739 * @tc.type : FUNC
740 * @tc.size : Medium test
741 */
742 HWTEST_F(DCameraAutomatTest, DCameraTest_3900, TestSize.Level1)
743 {
744 int32_t ret = CaptureTest(nullptr);
745 DHLOGI("DCameraTest_3900 = ", ret);
746 EXPECT_NE(cameraOk, ret) << "CaptureTest fail";
747 sleep(sleepOk);
748 }
749
750 /**
751 * @tc.number : DCameraTest_4000
752 * @tc.name : VideoTest Enter a null value to view the return result
753 * @tc.desc : Test exception
754 * @tc.type : FUNC
755 * @tc.size : Medium test
756 */
757 HWTEST_F(DCameraAutomatTest, DCameraTest_4000, TestSize.Level1)
758 {
759 int32_t ret = VideoTest(nullptr);
760 DHLOGI("DCameraTest_4000 = ", ret);
761 EXPECT_NE(cameraOk, ret) << "VideoTest fail";
762 sleep(sleepOk);
763 }
764
765 /**
766 * @tc.number : DCameraTest_4100
767 * @tc.name : FlashLightTest Enter a null value to view the return result
768 * @tc.desc : Test exception
769 * @tc.type : FUNC
770 * @tc.size : Medium test
771 */
772 HWTEST_F(DCameraAutomatTest, DCameraTest_4100, TestSize.Level1)
773 {
774 int32_t ret = FlashLightTest(nullptr);
775 DHLOGI("DCameraTest_4100 = ", ret);
776 EXPECT_NE(cameraOk, ret) << "FlashLightTest fail";
777 sleep(sleepOk);
778 }
779
780 /**
781 * @tc.number : DCameraTest_4200
782 * @tc.name : OfflineTest Enter a null value to view the return result
783 * @tc.desc : Test exception
784 * @tc.type : FUNC
785 * @tc.size : Medium test
786 */
787 HWTEST_F(DCameraAutomatTest, DCameraTest_4200, TestSize.Level1)
788 {
789 int32_t ret = OfflineTest(nullptr);
790 DHLOGI("DCameraTest_4200 = ", ret);
791 EXPECT_NE(cameraOk, ret) << "OfflineTest fail";
792 sleep(sleepOk);
793 }
794
795 /**
796 * @tc.number : DCameraTest_4300
797 * @tc.name : Perform a combination test for different method exceptions and check the return result
798 * @tc.desc : Test exception
799 * @tc.type : FUNC
800 * @tc.size : Medium test
801 */
802 HWTEST_F(DCameraAutomatTest, DCameraTest_4300, TestSize.Level1)
803 {
804 int32_t ret = PreviewOn(1, nullptr);
805 DHLOGI("DCameraTest_4300 = ", ret);
806 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
807 sleep(sleepOk);
808 ret = mainDemo->SetAwbMode(5);
809 DHLOGI("DCameraTest_4301 = ", ret);
810 EXPECT_NE(cameraOk, ret) << "SetAwbMode incandescent fail";
811 sleep(sleepOk);
812 }
813
814 /**
815 * @tc.number : DCameraTest_4400
816 * @tc.name : Perform a combination test for different method exceptions and check the return result
817 * @tc.desc : Test exception
818 * @tc.type : FUNC
819 * @tc.size : Medium test
820 */
821 HWTEST_F(DCameraAutomatTest, DCameraTest_4400, TestSize.Level1)
822 {
823 int32_t ret = PreviewOn(1, nullptr);
824 DHLOGI("DCameraTest_4400 = ", ret);
825 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
826 sleep(sleepOk);
827 ret = mainDemo->SetAwbMode(camoreError);
828 DHLOGI("DCameraTest_4401 = ", ret);
829 EXPECT_NE(cameraOk, ret) << "SetAwbMode incandescent fail";
830 sleep(sleepOk);
831 }
832
833 /**
834 * @tc.number : DCameraTest_4500
835 * @tc.name : Perform a combination test for different method exceptions and check the return result
836 * @tc.desc : Test exception
837 * @tc.type : FUNC
838 * @tc.size : Medium test
839 */
840 HWTEST_F(DCameraAutomatTest, DCameraTest_4500, TestSize.Level1)
841 {
842 int32_t ret = PreviewOn(1, nullptr);
843 DHLOGI("DCameraTest_4500 = ", ret);
844 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
845 sleep(sleepOk);
846 ret = CaptureTest(nullptr);
847 DHLOGI("DCameraTest_4501 = ", ret);
848 EXPECT_NE(cameraOk, ret) << "CaptureTest fail";
849 sleep(sleepOk);
850 }
851
852 /**
853 * @tc.number : DCameraTest_4600
854 * @tc.name : Perform a combination test for different method exceptions and check the return result
855 * @tc.desc : Test exception
856 * @tc.type : FUNC
857 * @tc.size : Medium test
858 */
859 HWTEST_F(DCameraAutomatTest, DCameraTest_4600, TestSize.Level1)
860 {
861 int32_t ret = PreviewOn(1, nullptr);
862 DHLOGI("DCameraTest_4600 = ", ret);
863 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
864 sleep(sleepOk);
865 ret = VideoTest(nullptr);
866 DHLOGI("DCameraTest_4601 = ", ret);
867 EXPECT_NE(cameraOk, ret) << "VideoTest fail";
868 sleep(sleepOk);
869 }
870
871 /**
872 * @tc.number : DCameraTest_4700
873 * @tc.name : Perform a combination test for different method exceptions and check the return result
874 * @tc.desc : Test exception
875 * @tc.type : FUNC
876 * @tc.size : Medium test
877 */
878 HWTEST_F(DCameraAutomatTest, DCameraTest_4700, TestSize.Level1)
879 {
880 int32_t ret = PreviewOn(1, nullptr);
881 DHLOGI("DCameraTest_4700 = ", ret);
882 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
883 sleep(sleepOk);
884 ret = PreviewOn(0, nullptr);
885 DHLOGI("DCameraTest_4701 = ", ret);
886 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
887 sleep(sleepOk);
888 }
889
890 /**
891 * @tc.number : DCameraTest_4800
892 * @tc.name : Perform a combination test for different method exceptions and check the return result
893 * @tc.desc : Test exception
894 * @tc.type : FUNC
895 * @tc.size : Medium test
896 */
897 HWTEST_F(DCameraAutomatTest, DCameraTest_4800, TestSize.Level1)
898 {
899 int32_t ret = PreviewOn(1, nullptr);
900 DHLOGI("DCameraTest_4800 = ", ret);
901 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
902 sleep(sleepOk);
903 ret = FlashLightTest(nullptr);
904 DHLOGI("DCameraTest_4801 = ", ret);
905 EXPECT_NE(cameraOk, ret) << "FlashLightTest fail";
906 sleep(sleepOk);
907 }
908
909 /**
910 * @tc.number : DCameraTest_4900
911 * @tc.name : Perform a combination test for different method exceptions and check the return result
912 * @tc.desc : Test exception
913 * @tc.type : FUNC
914 * @tc.size : Medium test
915 */
916 HWTEST_F(DCameraAutomatTest, DCameraTest_4900, TestSize.Level1)
917 {
918 int32_t ret = PreviewOn(1, nullptr);
919 DHLOGI("DCameraTest_4900 = ", ret);
920 EXPECT_NE(cameraOk, ret) << "PreviewOn fail";
921 sleep(sleepOk);
922 ret = OfflineTest(nullptr);
923 DHLOGI("DCameraTest_4901 = ", ret);
924 EXPECT_NE(cameraOk, ret) << "OfflineTest fail";
925 sleep(sleepOk);
926 }
927
928 /**
929 * @tc.number : DCameraTest_5000
930 * @tc.name : Perform a combination test for different method exceptions and check the return result
931 * @tc.desc : Test exception
932 * @tc.type : FUNC
933 * @tc.size : Medium test
934 */
935 HWTEST_F(DCameraAutomatTest, DCameraTest_5000, TestSize.Level1)
936 {
937 int32_t ret = mainDemo->SetAwbMode(camoreError);
938 DHLOGI("DCameraTest_5000 = ", ret);
939 EXPECT_NE(cameraOk, ret) << "SetAwbMode incandescent fail";
940 sleep(sleepOk);
941 ret = CaptureTest(nullptr);
942 DHLOGI("DCameraTest_5001 = ", ret);
943 EXPECT_NE(cameraOk, ret) << "CaptureTest fail";
944 sleep(sleepOk);
945 }
946
947 /**
948 * @tc.number : DCameraTest_5100
949 * @tc.name : Perform a combination test for different method exceptions and check the return result
950 * @tc.desc : Test exception
951 * @tc.type : FUNC
952 * @tc.size : Medium test
953 */
954 HWTEST_F(DCameraAutomatTest, DCameraTest_5100, TestSize.Level1)
955 {
956 int32_t ret = mainDemo->SetAwbMode(camoreError);
957 DHLOGI("DCameraTest_5100 = ", ret);
958 EXPECT_NE(cameraOk, ret) << "SetAwbMode incandescent fail";
959 sleep(sleepOk);
960 ret = VideoTest(nullptr);
961 DHLOGI("DCameraTest_5101 = ", ret);
962 EXPECT_NE(cameraOk, ret) << "VideoTest fail";
963 sleep(sleepOk);
964 }
965
966 /**
967 * @tc.number : DCameraTest_5200
968 * @tc.name : Perform a combination test for different method exceptions and check the return result
969 * @tc.desc : Test exception
970 * @tc.type : FUNC
971 * @tc.size : Medium test
972 */
973 HWTEST_F(DCameraAutomatTest, DCameraTest_5200, TestSize.Level1)
974 {
975 int32_t ret = mainDemo->SetAwbMode(camoreError);
976 DHLOGI("DCameraTest_5200 = ", ret);
977 EXPECT_NE(cameraOk, ret) << "SetAwbMode incandescent fail";
978 sleep(sleepOk);
979 ret = FlashLightTest(nullptr);
980 DHLOGI("DCameraTest_5201 = ", ret);
981 EXPECT_NE(cameraOk, ret) << "FlashLightTest fail";
982 sleep(sleepOk);
983 }
984
985 /**
986 * @tc.number : DCameraTest_5300
987 * @tc.name : Perform a combination test for different method exceptions and check the return result
988 * @tc.desc : Test exception
989 * @tc.type : FUNC
990 * @tc.size : Medium test
991 */
992 HWTEST_F(DCameraAutomatTest, DCameraTest_5300, TestSize.Level1)
993 {
994 int32_t ret = mainDemo->SetAwbMode(camoreError);
995 DHLOGI("DCameraTest_5300 = ", ret);
996 EXPECT_NE(cameraOk, ret) << "SetAwbMode incandescent fail";
997 sleep(sleepOk);
998 ret = OfflineTest(nullptr);
999 DHLOGI("DCameraTest_5301 = ", ret);
1000 EXPECT_NE(cameraOk, ret) << "OfflineTest fail";
1001 sleep(sleepOk);
1002 }
1003
1004 /**
1005 * @tc.number : DCameraTest_5400
1006 * @tc.name : Perform a combination test for different method exceptions and check the return result
1007 * @tc.desc : Test exception
1008 * @tc.type : FUNC
1009 * @tc.size : Medium test
1010 */
1011 HWTEST_F(DCameraAutomatTest, DCameraTest_5400, TestSize.Level1)
1012 {
1013 int32_t ret = CaptureTest(nullptr);
1014 DHLOGI("DCameraTest_5400 = ", ret);
1015 EXPECT_NE(cameraOk, ret) << "CaptureTest fail";
1016 sleep(sleepOk);
1017 ret = VideoTest(nullptr);
1018 DHLOGI("DCameraTest_5401 = ", ret);
1019 EXPECT_NE(cameraOk, ret) << "VideoTest fail";
1020 sleep(sleepOk);
1021 }
1022
1023 /**
1024 * @tc.number : DCameraTest_5500
1025 * @tc.name : Perform a combination test for different method exceptions and check the return result
1026 * @tc.desc : Test exception
1027 * @tc.type : FUNC
1028 * @tc.size : Medium test
1029 */
1030 HWTEST_F(DCameraAutomatTest, DCameraTest_5500, TestSize.Level1)
1031 {
1032 int32_t ret = CaptureTest(nullptr);
1033 DHLOGI("DCameraTest_5500 = ", ret);
1034 EXPECT_NE(cameraOk, ret) << "CaptureTest fail";
1035 sleep(sleepOk);
1036 ret = FlashLightTest(nullptr);
1037 DHLOGI("DCameraTest_5501 = ", ret);
1038 EXPECT_NE(cameraOk, ret) << "FlashLightTest fail";
1039 sleep(sleepOk);
1040 }
1041
1042 /**
1043 * @tc.number : DCameraTest_5600
1044 * @tc.name : Perform a combination test for different method exceptions and check the return result
1045 * @tc.desc : Test exception
1046 * @tc.type : FUNC
1047 * @tc.size : Medium test
1048 */
1049 HWTEST_F(DCameraAutomatTest, DCameraTest_5600, TestSize.Level1)
1050 {
1051 int32_t ret = CaptureTest(nullptr);
1052 DHLOGI("DCameraTest_5600 = ", ret);
1053 EXPECT_NE(cameraOk, ret) << "CaptureTest fail";
1054 sleep(sleepOk);
1055 ret = OfflineTest(nullptr);
1056 DHLOGI("DCameraTest_5601 = ", ret);
1057 EXPECT_NE(cameraOk, ret) << "OfflineTest fail";
1058 sleep(sleepOk);
1059 }
1060
1061 /**
1062 * @tc.number : DCameraTest_5700
1063 * @tc.name : Perform a combination test for different method exceptions and check the return result
1064 * @tc.desc : Test exception
1065 * @tc.type : FUNC
1066 * @tc.size : Medium test
1067 */
1068 HWTEST_F(DCameraAutomatTest, DCameraTest_5700, TestSize.Level1)
1069 {
1070 int32_t ret = VideoTest(nullptr);
1071 DHLOGI("DCameraTest_5700 = ", ret);
1072 EXPECT_NE(cameraOk, ret) << "VideoTest fail";
1073 sleep(sleepOk);
1074 ret = FlashLightTest(nullptr);
1075 DHLOGI("DCameraTest_5701 = ", ret);
1076 EXPECT_NE(cameraOk, ret) << "FlashLightTest fail";
1077 sleep(sleepOk);
1078 }
1079
1080 /**
1081 * @tc.number : DCameraTest_5800
1082 * @tc.name : Perform a combination test for different method exceptions and check the return result
1083 * @tc.desc : Test exception
1084 * @tc.type : FUNC
1085 * @tc.size : Medium test
1086 */
1087 HWTEST_F(DCameraAutomatTest, DCameraTest_5800, TestSize.Level1)
1088 {
1089 int32_t ret = VideoTest(nullptr);
1090 DHLOGI("DCameraTest_5800 = ", ret);
1091 EXPECT_NE(cameraOk, ret) << "VideoTest fail";
1092 sleep(sleepOk);
1093 ret = OfflineTest(nullptr);
1094 DHLOGI("DCameraTest_5801 = ", ret);
1095 EXPECT_NE(cameraOk, ret) << "OfflineTest fail";
1096 sleep(sleepOk);
1097 }
1098
1099 /**
1100 * @tc.number : DCameraTest_5900
1101 * @tc.name : Perform a combination test for different method exceptions and check the return result
1102 * @tc.desc : Test exception
1103 * @tc.type : FUNC
1104 * @tc.size : Medium test
1105 */
1106 HWTEST_F(DCameraAutomatTest, DCameraTest_5900, TestSize.Level1)
1107 {
1108 int32_t ret = FlashLightTest(nullptr);
1109 DHLOGI("DCameraTest_5900 = ", ret);
1110 EXPECT_NE(cameraOk, ret) << "FlashLightTest fail";
1111 sleep(sleepOk);
1112 ret = OfflineTest(nullptr);
1113 DHLOGI("DCameraTest_5901 = ", ret);
1114 EXPECT_NE(cameraOk, ret) << "OfflineTest fail";
1115 sleep(sleepOk);
1116 }
1117
1118 /**
1119 * @tc.number : DCameraTest_6000
1120 * @tc.name : Perform a combination test for different method exceptions and check the return result
1121 * @tc.desc : Test exception
1122 * @tc.type : FUNC
1123 * @tc.size : Medium test
1124 */
1125 HWTEST_F(DCameraAutomatTest, DCameraTest_6000, TestSize.Level1)
1126 {
1127 int32_t ret = FlashLightTest(nullptr);
1128 DHLOGI("DCameraTest_6000 = ", ret);
1129 EXPECT_NE(cameraOk, ret) << "FlashLightTest fail";
1130 sleep(sleepOk);
1131 ret = FlashLightTest(nullptr);
1132 DHLOGI("DCameraTest_6001 = ", ret);
1133 EXPECT_NE(cameraOk, ret) << "FlashLightTest fail";
1134 sleep(sleepOk);
1135 }