7e49f75c3f0b4106085fdb4dd4d7f55b6a573875
[platform/core/uifw/libtdm.git] / ut / stubs / tdm_capture_stubs.h
1 #ifndef _TDM_CAPTURE_STUBS_H
2 #define _TDM_CAPTURE_STUBS_H
3
4 static int OUTPUT_CREATE_CAPTURE_ERROR;
5 static int CAPTURE_SET_DONE_HANDLER_ERROR;
6 static int LAYER_CREATE_CAPTURE_ERROR;
7 static int CAPTURE_SET_INFO_ERROR;
8 static int CAPTURE_ATTACH_ERROR;
9 static int CAPTURE_COMMIT_ERROR;
10
11 static tdm_capture *output_create_capture(tdm_output *output, tdm_error *error)
12 {
13         (void)output;
14         (void)error;
15
16         if (OUTPUT_CREATE_CAPTURE_ERROR) {
17                 *error = TDM_ERROR_OPERATION_FAILED;
18                 return NULL;
19         }
20
21         *error = TDM_ERROR_NONE;
22
23         return NULL;
24 }
25
26 static void capture_destroy(tdm_capture *capture)
27 {
28         (void)capture;
29 }
30
31 static tdm_error capture_set_done_handler(tdm_capture *capture,
32                                                 tdm_capture_done_handler func, void *user_data)
33 {
34         (void)capture;
35         (void)func;
36         (void)user_data;
37
38         if (CAPTURE_SET_DONE_HANDLER_ERROR) {
39                 if (user_data) {
40                         free(user_data);
41                 }
42                 return TDM_ERROR_OPERATION_FAILED;
43         }
44
45         return TDM_ERROR_NONE;
46 }
47
48 static tdm_capture *layer_create_capture(tdm_layer *layer, tdm_error *error)
49 {
50         (void)layer;
51         (void)error;
52
53         if (LAYER_CREATE_CAPTURE_ERROR) {
54                 *error = TDM_ERROR_OPERATION_FAILED;
55                 return NULL;
56         }
57
58         *error = TDM_ERROR_NONE;
59         return NULL;
60 }
61
62 static tdm_error capture_set_info(tdm_capture *capture, tdm_info_capture *info)
63 {
64         (void)capture;
65         (void)info;
66
67         if (CAPTURE_SET_INFO_ERROR) {
68                 return TDM_ERROR_OPERATION_FAILED;
69         }
70
71         return TDM_ERROR_NONE;
72 }
73
74 static tdm_error capture_commit(tdm_capture *capture)
75 {
76         (void)capture;
77
78         if (CAPTURE_COMMIT_ERROR) {
79                 return TDM_ERROR_OPERATION_FAILED;
80         }
81
82         return TDM_ERROR_NONE;
83 }
84
85 #endif /* _TDM_CAPTURE_STUBS_H */