tizen beta release
[framework/system/libslp-pm.git] / TC / unit / utc_SystemFW_pm_unlock_state_func.c
1 #include <tet_api.h>
2 #include <pmapi.h>
3
4 static void startup(void);
5 static void cleanup(void);
6
7 void (*tet_startup)(void) = startup;
8 void (*tet_cleanup)(void) = cleanup;
9
10 static void utc_SystemFW_pm_unlock_state_func_01(void);
11 static void utc_SystemFW_pm_unlock_state_func_02(void);
12
13 enum {
14         POSITIVE_TC_IDX = 0x01,
15         NEGATIVE_TC_IDX,
16 };
17
18 struct tet_testlist tet_testlist[] = {
19         { utc_SystemFW_pm_unlock_state_func_01, POSITIVE_TC_IDX },
20         { utc_SystemFW_pm_unlock_state_func_02, NEGATIVE_TC_IDX },
21         { NULL, 0 },
22 };
23
24 static void startup(void)
25 {
26 }
27
28 static void cleanup(void)
29 {
30 }
31
32 /**
33  * @brief Positive test case of pm_unlock_state()
34  */
35 static void utc_SystemFW_pm_unlock_state_func_01(void)
36 {
37         int ret_val = 0;
38
39         //Lock State as LCD_DIM for infinite time
40         ret_val = pm_lock_state(LCD_DIM, GOTO_STATE_NOW, 0);
41         if(ret_val < 0)
42         {
43                 tet_infoline("\nSystem Fwk : call to pm_lock_state for unlock failed \n");
44         }
45
46
47         //Unlock previously locked state
48         ret_val = pm_unlock_state(LCD_DIM,GOTO_STATE_NOW);
49         if(ret_val < 0) {
50                 tet_infoline("pm_unlock_state() failed in positive test case");
51                 tet_result(TET_FAIL);
52                 return;
53         }
54         tet_result(TET_PASS);
55 }
56
57 /**
58  * @brief Negative test case of ug_init pm_unlock_state()
59  */
60 static void utc_SystemFW_pm_unlock_state_func_02(void)
61 {
62         int r = 0;
63
64         r = pm_unlock_state(-1 ,GOTO_STATE_NOW);
65
66         if (r>=0) {
67                 tet_infoline("pm_unlock_state() failed in negative test case");
68                 tet_result(TET_FAIL);
69                 return;
70         }
71         tet_result(TET_PASS);
72 }