[libtdm] Move unit tests from ws-testcase and change test framework
[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         if (OUTPUT_CREATE_CAPTURE_ERROR) {
14                 *error = TDM_ERROR_OPERATION_FAILED;
15                 return NULL;
16         }
17
18         *error = TDM_ERROR_NONE;
19
20         return NULL;
21 }
22
23 static void capture_destroy(tdm_capture *capture)
24 {
25
26 }
27
28 static tdm_error capture_set_done_handler(tdm_capture *capture,
29                                                 tdm_capture_done_handler func, void *user_data)
30 {
31         if (CAPTURE_SET_DONE_HANDLER_ERROR) {
32                 if (user_data) {
33                         free(user_data);
34                 }
35                 return TDM_ERROR_OPERATION_FAILED;
36         }
37
38         return TDM_ERROR_NONE;
39 }
40
41 static tdm_capture *layer_create_capture(tdm_layer *layer, tdm_error *error)
42 {
43         if (LAYER_CREATE_CAPTURE_ERROR) {
44                 *error = TDM_ERROR_OPERATION_FAILED;
45                 return NULL;
46         }
47
48         *error = TDM_ERROR_NONE;
49         return NULL;
50 }
51
52 static tdm_error capture_set_info(tdm_capture *capture, tdm_info_capture *info)
53 {
54         if (CAPTURE_SET_INFO_ERROR) {
55                 return TDM_ERROR_OPERATION_FAILED;
56         }
57
58         return TDM_ERROR_NONE;
59 }
60
61 static tdm_error capture_attach(tdm_capture *capture, tbm_surface_h buffer)
62 {
63         if (CAPTURE_ATTACH_ERROR) {
64                 return TDM_ERROR_OPERATION_FAILED;
65         }
66
67         return TDM_ERROR_NONE;
68 }
69
70 static tdm_error capture_commit(tdm_capture *capture)
71 {
72         if (CAPTURE_COMMIT_ERROR) {
73                 return TDM_ERROR_OPERATION_FAILED;
74         }
75
76         return TDM_ERROR_NONE;
77 }
78
79 #endif /* _TDM_CAPTURE_STUBS_H */