0009_input: add tap gesture's test cases
[platform/core/uifw/e-tizen-testcase.git] / src / e_test_event.h
1 #ifndef __ET_EVENT_LOOP_H__
2 #define __ET_EVENT_LOOP_H__
3
4 #include <gtest/gtest.h>
5 #include <efl_util.h>
6
7 #include "e_test_util.h"
8 #include "e_test_win.h"
9
10 class etRunner
11 {
12 private:
13    etRunner()
14    {
15       worker.timer = NULL;
16       worker.waitTime = 0.0;
17       tzPolicy = NULL;
18       tzSurface = NULL;
19       tzlaunch_effect = NULL;
20       tzlaunch_splash =  NULL;
21       ev.expire_timer = NULL;
22       ev.request = E_TC_EVENT_TYPE_NONE;
23       ev.response = E_TC_EVENT_TYPE_NONE;
24       ev.key = {0,};
25       logDomain = 0;
26       dbus.conn = NULL;
27       dbus.proxy = NULL;
28       dbus.obj = NULL;
29       listWinInfo = NULL;
30    };
31
32    ~etRunner() {}
33
34    static etRunner inst;
35
36 public:
37    static etRunner &get() { return inst; }
38
39 private:
40    int          logDomain;
41    struct
42      {
43         Ecore_Timer *timer;
44         double       waitTime;
45      } worker;
46
47    struct
48      {
49         Eldbus_Connection *conn;
50         Eldbus_Proxy      *proxy;
51         Eldbus_Object     *obj;
52      } dbus;
53
54    struct tizen_policy  *tzPolicy;
55    struct tizen_surface *tzSurface;
56    struct tizen_launch_effect *tzlaunch_effect;
57    struct tizen_launch_splash *tzlaunch_splash;
58
59    Eina_List *listWinInfo;
60
61 public: /* TODO: make it hidden */
62    struct
63      {
64         Ecore_Timer *expire_timer;
65         E_TC_Event_Type request;
66         E_TC_Event_Type response;
67         Evas_Object *win;
68         Eldbus_Signal_Handler *sh;
69         struct
70           {
71              Eina_Stringshare *name;
72              Eina_Bool state;
73              Ecore_Timer *timer;
74           } key;
75         struct
76           {
77              unsigned int state_smcb;
78              unsigned int type;
79           } effect;
80         struct
81           {
82              struct
83                {
84                   Ecore_Timer *timer;
85                   int fingers;
86                   int repeats;
87                   int current_repeats;
88                   Eina_Bool pressed;
89                } tap;
90           } gesture;
91      } ev;
92
93 public:
94    Eina_Bool     init();
95    void          shutdown();
96    void          work();
97    void          work(double time);
98    void          finishWork();
99    void          printWinInfoList();
100    void          setWaitTime(double time) { worker.waitTime = time; };
101    void          delTimer();
102    void          addTimer();
103    void          addTimer(double time);
104    void          waitForDestroy();
105
106    Eina_Bool     registerWin(etWin *tw);
107    Eina_Bool     deregisterWin(etWin *tw);
108    Eina_Bool     resetRegisterWin();
109    Eina_Bool     setWinActivate(etWin *tw);
110    Eina_Bool     setWinIconic(etWin *tw, Eina_Bool set);
111    Eina_Bool     setWinStack(etWin *tw, etWin *sibiling, Eina_Bool above);
112    Eina_Bool     setWinTransientFor(etWin *tw_child, etWin *tw_parent, Eina_Bool set);
113    Eina_Bool     setWinNotiLevel(etWin *tw, efl_util_notification_level_e lv);
114    efl_util_notification_level_e getWinNotiLevel(etWin *tw);
115    Eina_Bool     setFocusSkip(etWin *tw, Eina_Bool set);
116    Eina_Bool     setZoneRotation(int angle);
117    Eina_Bool     getWinInfo(etWin *tw);
118    Eina_List    *getWinInfoList();
119    void          freeWinInfoList(Eina_List *list);
120    void          freeLastWinInfoList();
121    Eina_Bool     hasLastWinInfoList() { return !!listWinInfo; };
122    void          setLastWinInfoList(Eina_List *list);
123    Ecore_Window  getWinId(Evas_Object *elm_win);
124    struct wl_surface *getWlSurface(Evas_Object *elm_win);
125    Eina_Bool     setDpms(Eina_Bool on);
126    Eina_Bool     feedMouseDown(int x, int y);
127    Eina_Bool     feedMouseMove(int x, int y);
128    Eina_Bool     feedMouseUp(int x, int y);
129    Eina_Bool     feedKeyDown(const char *key);
130    Eina_Bool     feedKeyUp(const char *key);
131    Eina_Bool     generateMouseDown(int x, int y);
132    Eina_Bool     generateMouseMove(int x, int y);
133    Eina_Bool     generateMouseUp(int x, int y);
134    Eina_Bool     generateKeyPress(const char *key);
135    Eina_Bool     generateKeyRelease(const char *key);
136    void          generateKeyEvent(const char *keyname, double delay);
137    Eina_Bool     generateTouchDown(int idx, int x, int y);
138    Eina_Bool     generateTouchMove(int idx, int x, int y);
139    Eina_Bool     generateTouchUp(int idx, int x, int y);
140    Eina_Bool     setSplashLaunch(const char *path, int type);
141    Eina_Bool     setSplashOwner();
142    Eina_Bool     setWindowEffectType(etWin *tw, E_TC_Window_Effect_type type);
143    Eina_Bool     freezeEvent();
144    Eina_Bool     thawEvent();
145    Eina_Bool     waitEvent(E_TC_Event_Type ev);
146
147    Eldbus_Proxy  *getDbusProxy()  { return dbus.proxy; }
148    Eldbus_Object *getDbusObject() { return dbus.obj;   }
149    int            getLogDomain()  { return logDomain;  }
150
151 protected:
152    Eina_Bool initProtocols();
153    efl_util_inputgen_h inputGenerator = NULL;
154 };
155
156 #endif // end of __ET_EVENT_LOOP_H__