0008_focus: Added window activate test case. 90/180590/1
authorJunSeok, Kim <juns.kim@samsung.com>
Thu, 31 May 2018 05:24:53 +0000 (14:24 +0900)
committerJunSeok, Kim <juns.kim@samsung.com>
Thu, 31 May 2018 05:24:53 +0000 (14:24 +0900)
Change-Id: Ida8fbbb0082d42985f4b0352658eb67f58da9074

src/testcase/0008_focus.cpp

index 37fa999..f502f1f 100644 (file)
@@ -266,6 +266,71 @@ TEST_F(etTestFocus, focus_destroy)
    etRunner::get().freeWinInfoList(list);
 }
 
+TEST_F(etTestFocus, focus_activate1)
+{
+   etWin *tw = NULL;
+   Eina_Bool res = EINA_FALSE;
+   Eina_List *list = NULL, *l = NULL;
+
+   res = initTC(EINA_TRUE, EINA_TRUE);
+   ASSERT_TRUE(res);
+
+   // Activate tw_red
+   res = registerTCWin(tw_red);
+   EXPECT_TRUE(res);
+   res = etRunner::get().setWinActivate(tw_red);
+   ASSERT_TRUE(res);
+   etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_ON);
+
+   // Expected focus res:
+   // [Top] Red[focused] -> Blue -> Green [Bottom]
+   list = etRunner::get().getWinInfoList();
+   ASSERT_TRUE(list != NULL);
+
+   EINA_LIST_CAST_FOREACH(list, l, tw, etWin*)
+     {
+        if (tw->native_win == tw_red->native_win)
+          ASSERT_TRUE(tw->Focus.obj);
+        else
+          ASSERT_FALSE(tw->Focus.obj);
+     }
+   etRunner::get().freeWinInfoList(list);
+}
+
+TEST_F(etTestFocus, focus_activate2)
+{
+   etWin *tw = NULL;
+   Eina_Bool res = EINA_FALSE;
+   Eina_List *list = NULL, *l = NULL;
+
+   res = initTC(EINA_TRUE, EINA_TRUE);
+   ASSERT_TRUE(res);
+
+   // show Blocker
+   showTCWin(tw_blocker);
+
+   // Activate tw_red
+   res = registerTCWin(tw_red);
+   EXPECT_TRUE(res);
+   res = etRunner::get().setWinActivate(tw_red);
+   ASSERT_TRUE(res);
+   etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_ON);
+
+   // Expected focus res:
+   // [Top] Red[focused] -> Blocker -> Blue -> Green [Bottom]
+   list = etRunner::get().getWinInfoList();
+   ASSERT_TRUE(list != NULL);
+
+   EINA_LIST_CAST_FOREACH(list, l, tw, etWin*)
+     {
+        if (tw->native_win == tw_red->native_win)
+          ASSERT_TRUE(tw->Focus.obj);
+        else
+          ASSERT_FALSE(tw->Focus.obj);
+     }
+   etRunner::get().freeWinInfoList(list);
+}
+
 TEST_F(etTestFocus, focus_fullsize_basic)
 {
    etWin *tw = NULL;
@@ -377,3 +442,34 @@ TEST_F(etTestFocus, focus_fullsize_destroy)
      }
    etRunner::get().freeWinInfoList(list);
 }
+
+TEST_F(etTestFocus, focus_fullsize_activate)
+{
+   etWin *tw = NULL;
+   Eina_Bool res = EINA_FALSE;
+   Eina_List *list = NULL, *l = NULL;
+
+   res = initTC(EINA_TRUE, EINA_FALSE);
+   ASSERT_TRUE(res);
+
+   // Activate tw_red
+   res = registerTCWin(tw_red);
+   EXPECT_TRUE(res);
+   res = etRunner::get().setWinActivate(tw_red);
+   ASSERT_TRUE(res);
+   etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_ON);
+
+   // Expected focus res:
+   // [Top] Red[focused] -> Blue -> Green [Bottom]
+   list = etRunner::get().getWinInfoList();
+   ASSERT_TRUE(list != NULL);
+
+   EINA_LIST_CAST_FOREACH(list, l, tw, etWin*)
+     {
+        if (tw->native_win == tw_red->native_win)
+          ASSERT_TRUE(tw->Focus.obj);
+        else
+          ASSERT_FALSE(tw->Focus.obj);
+     }
+   etRunner::get().freeWinInfoList(list);
+}