Tizen 2.1 base
[platform/core/api/camera.git] / TC / testcase / utc_media_camera_setting.c
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18
19 #include <tet_api.h>
20 #include <media/camera.h>
21 #include <stdio.h>
22 #include <glib.h>
23 #include <pthread.h>
24
25
26 #define MY_ASSERT( fun , test , msg ) \
27 {\
28         if( !test ) \
29                 dts_fail(fun , msg ); \
30 }               
31
32 static GMainLoop *g_mainloop = NULL;
33         
34
35 static void utc_camera_set_display_negative(void);
36 static void utc_camera_set_display_positive(void);
37
38 static void utc_camera_set_preview_resolution_negative(void);
39 static void utc_camera_set_preview_resolution_positive(void);
40
41 static void utc_camera_set_display_rotation_negative(void);
42 static void utc_camera_set_display_rotation_positive(void);
43
44 static void utc_camera_set_capture_resolution_negative(void);
45 static void utc_camera_set_capture_resolution_positive(void);
46
47 static void utc_camera_set_capture_format_negative(void);
48 static void utc_camera_set_capture_format_positive(void);
49
50 static void utc_camera_set_preview_format_negative(void);
51 static void utc_camera_set_preview_format_positive(void);
52
53 static void utc_camera_get_preview_resolution_negative(void);
54 static void utc_camera_get_preview_resolution_positive(void);
55
56 static void utc_camera_get_display_rotation_negative(void);
57 static void utc_camera_get_display_rotation_positive(void);
58
59 static void utc_camera_get_capture_resolution_negative(void);
60 static void utc_camera_get_capture_resolution_positive(void);
61
62 static void utc_camera_get_preview_format_negative(void);
63 static void utc_camera_get_preview_format_positive(void);
64
65 static void utc_camera_set_preview_cb_negative(void);
66 static void utc_camera_set_preview_cb_positive(void);
67
68 static void utc_camera_unset_preview_cb_negative(void);
69 static void utc_camera_unset_preview_cb_positive(void);
70
71 static void utc_camera_set_state_changed_cb_negative(void);
72 static void utc_camera_set_state_changed_cb_positive(void);
73
74 static void utc_camera_unset_state_changed_cb_negative(void);
75 static void utc_camera_unset_state_changed_cb_positive(void);
76
77 static void utc_camera_set_focus_changed_cb_negative(void);
78 static void utc_camera_set_focus_changed_cb_positive(void);
79
80 static void utc_camera_unset_focus_changed_cb_negative(void);
81 static void utc_camera_unset_focus_changed_cb_positive(void);
82
83 static void utc_camera_foreach_supported_preview_resolution_negative(void);
84 static void utc_camera_foreach_supported_preview_resolution_positive(void);
85
86 static void utc_camera_foreach_supported_capture_resolution_negative(void);
87 static void utc_camera_foreach_supported_capture_resolution_positive(void);
88
89 static void utc_camera_foreach_supported_capture_format_negative(void);
90 static void utc_camera_foreach_supported_capture_format_positive(void);
91
92 static void utc_camera_foreach_supported_preview_format_negative(void);
93 static void utc_camera_foreach_supported_preview_format_positive(void);
94
95 static void utc_camera_set_x11_display_visible_positive(void);
96 static void utc_camera_set_x11_display_visible_negative(void);
97
98 static void utc_camera_is_x11_display_visible_positive(void);
99 static void utc_camera_is_x11_display_visible_negative(void);
100
101
102 static void utc_camera_set_x11_display_mode_positive(void);
103 static void utc_camera_set_x11_display_mode_negative(void);
104
105 static void utc_camera_get_x11_display_mode_positive(void);
106 static void utc_camera_get_x11_display_mode_negative(void);
107
108
109 static void utc_camera_get_capture_format_positive(void);
110 static void utc_camera_get_capture_format_negative(void);
111
112 static void utc_camera_set_error_cb_positive(void);
113 static void utc_camera_set_error_cb_negative(void);
114
115 static void utc_camera_unset_error_cb_positive(void);
116 static void utc_camera_unset_error_cb_negative(void);
117
118
119
120
121
122 static void startup(void);
123 static void cleanup(void);
124
125 void (*tet_startup)(void) = startup;
126 void (*tet_cleanup)(void) = cleanup;
127
128 struct tet_testlist tet_testlist[] = {
129         {utc_camera_set_display_negative , 1 },
130         {utc_camera_set_display_positive , 2 },
131
132         {utc_camera_set_preview_resolution_negative , 3 },
133         {utc_camera_set_preview_resolution_positive , 4 },
134
135         {utc_camera_set_display_rotation_negative , 5 },
136         {utc_camera_set_display_rotation_positive , 6 },
137
138         {utc_camera_set_capture_resolution_negative , 7 },
139         {utc_camera_set_capture_resolution_positive, 8 },
140
141         {utc_camera_set_capture_format_negative, 9 },
142         {utc_camera_set_capture_format_positive, 10 },
143
144         {utc_camera_set_preview_format_negative, 11 },
145         {utc_camera_set_preview_format_positive, 12 },
146
147         {utc_camera_get_preview_resolution_negative, 13 },
148         {utc_camera_get_preview_resolution_positive, 14 },
149
150         {utc_camera_get_display_rotation_negative, 15 },
151         {utc_camera_get_display_rotation_positive, 16 },
152
153         {utc_camera_get_capture_resolution_negative, 17 },
154         {utc_camera_get_capture_resolution_positive, 18 },
155
156         {utc_camera_get_preview_format_negative, 19 },
157         {utc_camera_get_preview_format_positive, 20 },
158
159         {utc_camera_set_preview_cb_negative, 21 },
160         {utc_camera_set_preview_cb_positive, 22 },
161
162         {utc_camera_unset_preview_cb_negative, 23 },
163         {utc_camera_unset_preview_cb_positive, 24 },
164
165         {utc_camera_set_state_changed_cb_negative, 29 },
166         {utc_camera_set_state_changed_cb_positive, 30 },
167
168         {utc_camera_unset_state_changed_cb_negative, 31 },
169         {utc_camera_unset_state_changed_cb_positive, 32 },
170
171         {utc_camera_set_focus_changed_cb_negative, 33 },
172         {utc_camera_set_focus_changed_cb_positive, 34 },
173
174         {utc_camera_unset_focus_changed_cb_negative, 35 },
175         {utc_camera_unset_focus_changed_cb_positive, 36 },
176
177         {utc_camera_foreach_supported_preview_resolution_negative, 41 },
178         {utc_camera_foreach_supported_preview_resolution_positive, 42 },
179
180         {utc_camera_foreach_supported_capture_resolution_negative, 43 },
181         {utc_camera_foreach_supported_capture_resolution_positive, 44 },
182
183         {utc_camera_foreach_supported_capture_format_negative, 45 },
184         {utc_camera_foreach_supported_capture_format_positive, 46 },
185
186         {utc_camera_foreach_supported_preview_format_negative, 47 },
187         {utc_camera_foreach_supported_preview_format_positive, 48 },
188
189         { utc_camera_set_x11_display_visible_negative , 49 },   
190         { utc_camera_set_x11_display_visible_positive , 50 },
191
192         { utc_camera_is_x11_display_visible_negative , 51 },    
193         { utc_camera_is_x11_display_visible_positive , 52 },
194
195         { utc_camera_set_x11_display_mode_negative , 53 },      
196         { utc_camera_set_x11_display_mode_positive , 54 },
197         
198         { utc_camera_get_x11_display_mode_negative , 55 },      
199         { utc_camera_get_x11_display_mode_positive , 56 },
200
201         { utc_camera_get_capture_format_positive , 57 },        
202         { utc_camera_get_capture_format_negative , 58 },
203
204         { utc_camera_set_error_cb_positive , 59 },      
205         { utc_camera_set_error_cb_negative , 60 },
206
207         { utc_camera_unset_error_cb_positive , 61 },    
208         { utc_camera_unset_error_cb_negative , 62 },
209
210         
211         { NULL, 0 },
212 };
213
214
215 gpointer GmainThread(gpointer data){
216         g_mainloop = g_main_loop_new (NULL, 0);
217         g_main_loop_run (g_mainloop);
218         
219         return NULL;
220 }
221
222 camera_h camera;
223
224
225 static void startup(void)
226 {
227         fprintf(stderr, "%s test\n", __func__);
228         /* start of TC */
229         int ret;
230         ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera);
231         if( ret != 0 )
232                 dts_fail("camera_create", "Could not create camera");   
233 }
234
235 static void cleanup(void)
236 {
237         /* end of TC */
238         camera_destroy(camera);
239 }
240
241
242 static void utc_camera_set_display_negative(void)
243 {
244         fprintf(stderr, "%s test\n", __func__);
245         int ret;
246         ret = camera_set_display(NULL, CAMERA_DISPLAY_TYPE_X11, 0);
247         dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed");
248 }
249 static void utc_camera_set_display_positive(void)
250 {
251         int ret;
252         ret = camera_set_display(camera, CAMERA_DISPLAY_TYPE_X11, 0);
253         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE , "set display handle fail");
254         dts_pass(__func__, "PASS");     
255 }
256
257 static void utc_camera_set_preview_resolution_negative(void)
258 {
259         int ret;
260         ret = camera_set_preview_resolution(NULL,0,  0);
261         dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed");
262 }
263
264
265 bool _preview_resolution_cb(int width, int height, void *user_data )
266 {
267         int *resolution = (int*)user_data;
268         resolution[0] = width;
269         resolution[1] = height;
270         return false;
271 }
272
273 static void utc_camera_set_preview_resolution_positive(void)
274 {
275         int ret;
276         int resolution[2];
277         
278         camera_foreach_supported_preview_resolution(camera, _preview_resolution_cb, resolution) ;
279         ret = camera_set_preview_resolution(camera,resolution[0],  resolution[1]);
280         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE , "set preview resolution is faild");
281
282         dts_pass(__func__, "PASS");     
283 }
284
285 static void utc_camera_set_display_rotation_negative(void)
286 {
287         int ret;
288         ret = camera_set_x11_display_rotation(camera, -1);
289         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE , "not allow -1");
290         dts_pass(__func__, "PASS");     
291 }
292 static void utc_camera_set_display_rotation_positive(void)
293 {
294         int ret;
295         ret = camera_set_x11_display_rotation(camera, CAMERA_ROTATION_NONE);
296         MY_ASSERT(__func__, ret== CAMERA_ERROR_NONE , "camera_set_display_rotation fail");
297         dts_pass(__func__, "PASS");     
298 }
299
300 static void utc_camera_set_capture_resolution_negative(void)
301 {
302         int ret;
303         ret = camera_set_capture_resolution(NULL, 0,0);
304         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE , "not allow NULL");
305         dts_pass(__func__, "PASS");     
306 }
307
308 bool _capture_resolution_cb(int width, int height, void *user_data)
309 {
310         int *resolution = (int*) user_data;
311         resolution[0] = width;
312         resolution[1] = height;
313         return false;
314 }
315
316 static void utc_camera_set_capture_resolution_positive(void)
317 {
318         int ret;
319         int resolution[2];
320         
321         camera_foreach_supported_capture_resolution(camera, _capture_resolution_cb, resolution);
322         ret = camera_set_capture_resolution(camera, resolution[0],resolution[1]);
323         
324         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE , "camera_set_capture_resolution fail");
325         dts_pass(__func__, "PASS");     
326
327 }
328 static void utc_camera_set_capture_format_negative(void)
329 {
330         int ret;
331         ret = camera_set_capture_format(camera, -1);
332         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE , "not allow -1");
333
334         dts_pass(__func__, "PASS");     
335 }
336
337 bool _capture_format_cb(camera_pixel_format_e format , void *user_data)
338 {
339         int *ret = (int*) user_data;
340         *ret = format;
341         return false;
342 }
343
344 static void utc_camera_set_capture_format_positive(void)
345 {
346         int ret;
347         int value;
348         camera_foreach_supported_capture_format(camera, _capture_format_cb, &value);
349         ret = camera_set_capture_format(camera, value);
350         MY_ASSERT(__func__, ret== CAMERA_ERROR_NONE , "camera_set_capture_format fail");
351         
352         dts_pass(__func__, "PASS");     
353 }
354
355 static void utc_camera_set_preview_format_negative(void)
356 {
357         int ret ;
358         ret = camera_set_preview_format(camera, -1);
359         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "-1 is not allowed");
360         dts_pass(__func__, "PASS");     
361 }
362
363 bool _preview_format_cb(camera_pixel_format_e format , void *user_data)
364 {
365         camera_pixel_format_e * ret = (camera_pixel_format_e*)user_data;
366         *ret = format;
367         return false;
368 }
369
370 static void utc_camera_set_preview_format_positive(void)
371 {
372         int ret;
373         camera_pixel_format_e format;
374         camera_foreach_supported_preview_format(camera, _preview_format_cb, &format);
375         ret = camera_set_preview_format(camera, format);
376         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE,"set preview format fail");
377         dts_pass(__func__, "PASS");     
378 }
379
380 static void utc_camera_get_preview_resolution_negative(void)
381 {
382         int ret ;
383         ret = camera_get_preview_resolution(NULL, NULL,NULL);
384         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed");
385
386         dts_pass(__func__, "PASS");     
387 }
388 static void utc_camera_get_preview_resolution_positive(void)
389 {
390         int ret;
391         int value1;
392         int value2;
393         ret = camera_get_preview_resolution(camera, &value1,&value2);
394         MY_ASSERT(__func__,ret == CAMERA_ERROR_NONE, "get preview resolution fail");
395         dts_pass(__func__, "PASS");     
396 }
397
398 static void utc_camera_get_display_rotation_negative(void)
399 {
400         int ret ;
401         ret = camera_get_x11_display_rotation(NULL, NULL);
402         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed");
403
404         dts_pass(__func__, "PASS");     
405
406 }
407 static void utc_camera_get_display_rotation_positive(void)
408 {
409         int ret;
410         camera_rotation_e value;
411         ret = camera_get_x11_display_rotation(camera, &value);
412         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail get display rotation");
413         dts_pass(__func__, "PASS");     
414 }
415
416 static void utc_camera_get_capture_resolution_negative(void)
417 {
418         int ret ;
419         ret = camera_get_capture_resolution(NULL, NULL,NULL);
420         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed");
421         dts_pass(__func__, "PASS");     
422 }
423 static void utc_camera_get_capture_resolution_positive(void)
424 {
425         int ret;
426         int value1, value2;
427         ret = camera_get_capture_resolution(camera,&value1, &value2);
428         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "get capture resolution fail");
429         dts_pass(__func__, "PASS");     
430 }
431
432 static void utc_camera_get_preview_format_negative(void)
433 {
434         int ret ;
435         ret = camera_get_preview_format(NULL, NULL);
436         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed");
437
438         dts_pass(__func__, "PASS");     
439 }
440 static void utc_camera_get_preview_format_positive(void)
441 {
442         int ret;
443         int value;
444         ret=  camera_get_preview_format(camera, &value);
445         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "get preview format fail");
446         dts_pass(__func__, "PASS");     
447 }
448
449 static void utc_camera_set_preview_cb_negative(void)
450 {
451         int ret ;
452         ret = camera_set_preview_cb(NULL, NULL, NULL);
453         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed");
454         dts_pass(__func__, "PASS");     
455 }
456
457 void _preview_cb(void* stream_buffer, int buffer_size, int width, int height, camera_pixel_format_e format, void *user_data)
458 {
459 }
460
461 static void utc_camera_set_preview_cb_positive(void)
462 {
463         int ret;
464         ret = camera_set_preview_cb(camera,_preview_cb,NULL);
465         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "set preview cb fail");
466         dts_pass(__func__, "PASS");     
467 }
468
469 static void utc_camera_unset_preview_cb_negative(void)
470 {
471         int ret ;
472         ret = camera_unset_preview_cb(NULL);
473         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed");
474         dts_pass(__func__, "PASS");     
475 }
476
477 static void utc_camera_unset_preview_cb_positive(void)
478 {
479         int ret;
480         ret = camera_unset_preview_cb(camera);
481         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "unset preview cb fail");
482         dts_pass(__func__, "PASS");     
483 }
484
485 static void utc_camera_set_state_changed_cb_negative(void)
486 {
487         int ret ;
488         ret = camera_set_state_changed_cb(NULL, NULL, NULL);
489         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed");
490         dts_pass(__func__, "PASS");     
491         
492 }
493
494 void _changed_cb(camera_state_e previous , camera_state_e current , bool by_asm, void *user_data)
495 {
496 }
497
498 static void utc_camera_set_state_changed_cb_positive(void)
499 {
500         int ret;
501         ret = camera_set_state_changed_cb(camera, _changed_cb, NULL);
502         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE , "set state change cb fail");
503         dts_pass(__func__, "PASS");     
504 }
505 static void utc_camera_unset_state_changed_cb_negative(void)
506 {
507         int ret ;
508         ret = camera_unset_state_changed_cb(NULL);
509         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed");
510         dts_pass(__func__, "PASS");     
511 }
512 static void utc_camera_unset_state_changed_cb_positive(void)
513 {
514         int ret ;
515         ret = camera_unset_state_changed_cb(camera);
516         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "camera_unset_state_changed_cb fail");
517
518         dts_pass(__func__, "PASS");     
519 }
520 static void utc_camera_set_focus_changed_cb_negative(void)
521 {
522         int ret ;
523         ret = camera_set_focus_changed_cb(NULL, NULL, NULL);
524         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed");
525         dts_pass(__func__, "PASS");     
526 }
527
528 void _focus_changed_cb(camera_focus_state_e state, void *user_data)
529 {
530 }
531
532 static void utc_camera_set_focus_changed_cb_positive(void)
533 {
534         int ret;
535         ret = camera_set_focus_changed_cb(camera, _focus_changed_cb, NULL);
536         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail");
537
538         dts_pass(__func__, "PASS");     
539 }
540 static void utc_camera_unset_focus_changed_cb_negative(void)
541 {
542         int ret ;
543         ret = camera_unset_focus_changed_cb(NULL);
544         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed");
545         dts_pass(__func__, "PASS");     
546 }
547 static void utc_camera_unset_focus_changed_cb_positive(void)
548 {
549         int ret ;
550         ret = camera_unset_focus_changed_cb(camera);
551         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail");
552         dts_pass(__func__, "PASS");     
553 }
554
555 static void utc_camera_foreach_supported_preview_resolution_negative(void)
556 {
557         int ret ;
558         ret = camera_foreach_supported_preview_resolution(NULL, NULL, NULL);
559         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed");
560         dts_pass(__func__, "PASS");     
561 }
562
563 bool _preview_resolution_cb2(int width, int height, void *user_data )
564 {
565         return false;
566 }
567
568 static void utc_camera_foreach_supported_preview_resolution_positive(void)
569 {
570         int ret ;
571         ret = camera_foreach_supported_preview_resolution(camera, _preview_resolution_cb2, NULL);
572         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail");
573         dts_pass(__func__, "PASS");     
574 }
575
576 static void utc_camera_foreach_supported_capture_resolution_negative(void)
577 {
578         int ret ;
579         ret = camera_foreach_supported_capture_resolution(NULL, NULL, NULL);
580         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed");
581         dts_pass(__func__, "PASS");     
582 }
583
584 bool _capture_resolution_cb2(int width, int height, void *user_data)
585 {
586         return false;
587 }
588
589 static void utc_camera_foreach_supported_capture_resolution_positive(void)
590 {
591         int ret ;
592         ret = camera_foreach_supported_capture_resolution(camera, _capture_resolution_cb2, NULL);
593         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail");
594         dts_pass(__func__, "PASS");     
595 }
596
597 static void utc_camera_foreach_supported_capture_format_negative(void)
598 {
599         int ret ;
600         ret = camera_foreach_supported_capture_format(NULL, NULL, NULL);
601         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed");
602         dts_pass(__func__, "PASS");     
603 }
604
605 bool _capture_format_cb2(camera_pixel_format_e format , void *user_data)
606 {
607         return false;
608 }
609
610 static void utc_camera_foreach_supported_capture_format_positive(void)
611 {
612         int ret ;
613         ret = camera_foreach_supported_capture_format(camera, _capture_format_cb2, NULL);
614         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail");
615         dts_pass(__func__, "PASS");     
616 }
617
618 static void utc_camera_foreach_supported_preview_format_negative(void)
619 {
620         int ret ;
621         ret = camera_foreach_supported_preview_format(NULL, NULL, NULL);
622         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed");
623         dts_pass(__func__, "PASS");     
624 }
625
626 bool _preview_format_cb2(camera_pixel_format_e format , void *user_data)
627 {
628         return false;
629 }
630
631 static void utc_camera_foreach_supported_preview_format_positive(void)
632 {
633         int ret ;
634         ret = camera_foreach_supported_preview_format(camera, _preview_format_cb2,NULL);        
635         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail");
636         dts_pass(__func__, "PASS");     
637 }
638
639
640 static void utc_camera_set_x11_display_visible_positive(void){
641         int ret;
642         ret = camera_set_x11_display_visible(camera, true);
643         MY_ASSERT(__func__, ret== CAMERA_ERROR_NONE , "camera_set_x11_display_visible fail");
644         dts_pass(__func__, "PASS");             
645 }
646 static void utc_camera_set_x11_display_visible_negative(void){
647         int ret;
648         ret = camera_set_x11_display_visible(NULL, 0);
649         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE , "not allow NULL");
650         dts_pass(__func__, "PASS");             
651 }
652
653 static void utc_camera_is_x11_display_visible_positive(void){
654         int ret;
655         bool value;
656         ret = camera_is_x11_display_visible(camera, &value);
657         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail camera_is_x11_display_visible");
658         dts_pass(__func__, "PASS");     
659         
660 }
661 static void utc_camera_is_x11_display_visible_negative(void){
662         int ret ;
663         ret = camera_is_x11_display_visible(NULL, NULL);
664         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed");
665
666         dts_pass(__func__, "PASS");             
667 }
668
669
670 static void utc_camera_set_x11_display_mode_positive(void){
671         int ret;
672         ret = camera_set_x11_display_mode(camera, CAMERA_DISPLAY_MODE_LETTER_BOX);
673         MY_ASSERT(__func__, ret== CAMERA_ERROR_NONE , "camera_set_x11_display_mode fail");
674         dts_pass(__func__, "PASS");             
675         
676 }
677 static void utc_camera_set_x11_display_mode_negative(void){
678         int ret;
679         ret = camera_set_x11_display_mode(NULL, 0);
680         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE , "not allow NULL");
681         dts_pass(__func__, "PASS");             
682 }
683
684 static void utc_camera_get_x11_display_mode_positive(void){
685         int ret;
686         camera_display_mode_e value;
687         ret = camera_get_x11_display_mode(camera, &value);
688         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail camera_set_x11_display_mode");
689         dts_pass(__func__, "PASS");             
690 }
691 static void utc_camera_get_x11_display_mode_negative(void){
692         int ret ;
693         ret = camera_get_x11_display_mode(NULL, NULL);
694         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed");
695
696         dts_pass(__func__, "PASS");                     
697 }
698
699
700
701 static void utc_camera_get_capture_format_positive(void)
702 {
703         int ret;
704         camera_pixel_format_e value;
705         ret = camera_get_capture_format(camera, &value);
706         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail camera_get_capture_format");
707         dts_pass(__func__, "PASS");             
708 }
709 static void utc_camera_get_capture_format_negative(void)
710 {
711         int ret ;
712         ret = camera_get_capture_format(NULL, NULL);
713         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed");
714         dts_pass(__func__, "PASS");                     
715 }
716
717
718
719 void _error_cb(int error, camera_state_e current_state, void *user_data)
720 {
721 }
722
723 static void utc_camera_set_error_cb_positive(void)
724 {
725         int ret;
726         ret = camera_set_error_cb(camera, _error_cb, NULL);
727         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail");
728         dts_pass(__func__, "PASS");     
729 }
730
731 static void utc_camera_set_error_cb_negative(void)
732 {
733         int ret;
734         ret = camera_set_error_cb(NULL, NULL, NULL);
735         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "fail");
736         dts_pass(__func__, "PASS");     
737 }
738
739 static void utc_camera_unset_error_cb_positive(void)
740 {
741         int ret;
742         ret = camera_unset_error_cb(camera);
743         MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail");
744         dts_pass(__func__, "PASS");     
745 }
746 static void utc_camera_unset_error_cb_negative(void)
747 {
748         int ret;
749         ret = camera_unset_error_cb(NULL);
750         MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "fail");
751         dts_pass(__func__, "PASS");     
752 }
753