Add a color parameter for intializing/creating window 04/261304/1
authorDoyoun Kang <doyoun.kang@samsung.com>
Thu, 15 Jul 2021 05:02:19 +0000 (14:02 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Thu, 15 Jul 2021 05:02:24 +0000 (14:02 +0900)
Change-Id: I52e2c910e50fa4f7d7014740484bf88c0c895352

src/e_test_base.cpp
src/e_test_base.h
src/e_test_util.h

index 394573e..f03e84f 100644 (file)
@@ -60,8 +60,14 @@ etTCBase::initFakeWin()
    return tw;
 }
 
+E_TC_Win_Color
+etTCBase::generateColor()
+{
+   return (E_TC_Win_Color)((numTw % E_TC_WIN_COLOR_CYAN) + 2);
+}
+
 etWin *
-etTCBase::createWindow(Elm_Win_Type type, const char *name, Eina_Bool usr_geom, int x, int y, int w, int h)
+etTCBase::createWindow(Elm_Win_Type type, const char *name, Eina_Bool usr_geom, int x, int y, int w, int h, E_TC_Win_Color color)
 {
    Eina_Bool res = EINA_FALSE;
    etWin *tw = new etWin();
@@ -74,12 +80,15 @@ etTCBase::createWindow(Elm_Win_Type type, const char *name, Eina_Bool usr_geom,
           numGeomTw++;
      }
 
+   if (color == E_TC_WIN_COLOR_AUTO)
+     color = generateColor();
+
    res = tw->init(NULL,
                   type,
                   EINA_FALSE,
                   name? name : "TCWin",
                   x, y, w, h, usr_geom,
-                  (E_TC_Win_Color) ((numTw % E_TC_WIN_COLOR_CYAN) + 2));
+                  color);
    EINA_SAFETY_ON_FALSE_GOTO(res, err);
 
    tw->native_win = etRunner::get().getWinId(tw->elm_win);
@@ -100,23 +109,23 @@ err:
 }
 
 etWin *
-etTCBase::initNormalWin(const char *name, Eina_Bool usr_geom)
+etTCBase::initNormalWin(const char *name, Eina_Bool usr_geom, E_TC_Win_Color color)
 {
-   etWin *tw = createWindow(ELM_WIN_BASIC, name, usr_geom, 0, 0, 0, 0);
+   etWin *tw = createWindow(ELM_WIN_BASIC, name, usr_geom, 0, 0, 0, 0, color);
    return tw;
 }
 
 etWin *
-etTCBase::initNormalWin(const char *name, int x, int y, int w, int h)
+etTCBase::initNormalWin(const char *name, int x, int y, int w, int h, E_TC_Win_Color color)
 {
-   etWin *tw = createWindow(ELM_WIN_BASIC, name, EINA_TRUE, x, y, w, h);
+   etWin *tw = createWindow(ELM_WIN_BASIC, name, EINA_TRUE, x, y, w, h, color);
    return tw;
 }
 
 etWin *
-etTCBase::initNotiWin(const char *name, Eina_Bool usr_geom, Eina_Bool set_noti_level_normal)
+etTCBase::initNotiWin(const char *name, Eina_Bool usr_geom, Eina_Bool set_noti_level_normal, E_TC_Win_Color color)
 {
-   etWin *tw = createWindow(ELM_WIN_NOTIFICATION, name, usr_geom, 0, 0, 0, 0);
+   etWin *tw = createWindow(ELM_WIN_NOTIFICATION, name, usr_geom, 0, 0, 0, 0, color);
 
    if (set_noti_level_normal)
      etRunner::get().setWinNotiLevel(tw, EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM);
@@ -125,9 +134,9 @@ etTCBase::initNotiWin(const char *name, Eina_Bool usr_geom, Eina_Bool set_noti_l
 }
 
 etWin *
-etTCBase::initNotiWin(const char *name, Eina_Bool set_noti_level_normal, int x, int y, int w, int h)
+etTCBase::initNotiWin(const char *name, Eina_Bool set_noti_level_normal, int x, int y, int w, int h, E_TC_Win_Color color)
 {
-   etWin *tw = createWindow(ELM_WIN_NOTIFICATION, name, EINA_TRUE, x, y, w, h);
+   etWin *tw = createWindow(ELM_WIN_NOTIFICATION, name, EINA_TRUE, x, y, w, h, color);
 
    if (set_noti_level_normal)
      etRunner::get().setWinNotiLevel(tw, EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM);
index d0b278d..00264ab 100644 (file)
@@ -13,10 +13,10 @@ class etTCBase : public ::testing::Test
 
  public:
    etWin     *initFakeWin();
-   etWin     *initNormalWin(const char *name, Eina_Bool usr_geom);
-   etWin     *initNormalWin(const char *name, int x, int y, int w, int h);
-   etWin     *initNotiWin(const char *name, Eina_Bool usr_geom, Eina_Bool set_noti_level_normal);
-   etWin     *initNotiWin(const char *name, Eina_Bool set_noti_level_normal, int x, int y, int w, int h);
+   etWin     *initNormalWin(const char *name, Eina_Bool usr_geom, E_TC_Win_Color color = E_TC_WIN_COLOR_AUTO);
+   etWin     *initNormalWin(const char *name, int x, int y, int w, int h, E_TC_Win_Color color = E_TC_WIN_COLOR_AUTO);
+   etWin     *initNotiWin(const char *name, Eina_Bool usr_geom, Eina_Bool set_noti_level_normal, E_TC_Win_Color color = E_TC_WIN_COLOR_AUTO);
+   etWin     *initNotiWin(const char *name, Eina_Bool set_noti_level_normal, int x, int y, int w, int h, E_TC_Win_Color color = E_TC_WIN_COLOR_AUTO);
 
    Eina_Bool  registerTCWin(etWin *tw);
    Eina_Bool  deregisterTCWin(etWin *tw);
@@ -39,7 +39,8 @@ class etTCBase : public ::testing::Test
    int        numTw = 0;     // number of wins
    int        numGeomTw = 0; // number of wins using usr_geom
 
-   etWin     *createWindow(Elm_Win_Type type, const char *name, Eina_Bool usr_geom, int x, int y, int w, int h);
+   etWin     *createWindow(Elm_Win_Type type, const char *name, Eina_Bool usr_geom, int x, int y, int w, int h, E_TC_Win_Color color);
+   E_TC_Win_Color generateColor();
 };
 
 #endif // end of __ET_TESTCASE_BASE__
index 8e8f1bd..ac5e326 100644 (file)
@@ -103,6 +103,7 @@ typedef enum _E_TC_Win_Color
    E_TC_WIN_COLOR_YELLOW,
    E_TC_WIN_COLOR_CYAN,
    E_TC_WIN_COLOR_PURPLE,
+   E_TC_WIN_COLOR_AUTO = 255,
 } E_TC_Win_Color;
 
 /* NB: These types are originally defined in the enlightenment.