0008_focus: Added window transient_for test case. 91/180591/1
authorJunSeok, Kim <juns.kim@samsung.com>
Thu, 31 May 2018 05:27:19 +0000 (14:27 +0900)
committerJunSeok, Kim <juns.kim@samsung.com>
Thu, 31 May 2018 05:27:19 +0000 (14:27 +0900)
Change-Id: I530da5894cdc6ddd236befc8ccee30fc63dc1fd4

src/testcase/0008_focus.cpp

index f502f1f..2d999e1 100644 (file)
@@ -331,6 +331,95 @@ TEST_F(etTestFocus, focus_activate2)
    etRunner::get().freeWinInfoList(list);
 }
 
+TEST_F(etTestFocus, focus_transient_for1)
+{
+   etWin *tw = NULL;
+   Eina_Bool res = EINA_FALSE;
+   Eina_List *list = NULL, *l = NULL;
+
+   res = initTC(EINA_TRUE, EINA_TRUE);
+
+   // set transient_for Blue(parent) & Red(child)
+   res = registerTCWin(tw_red);
+   EXPECT_TRUE(res);
+   res = etRunner::get().setWinTransientFor(tw_red, tw_blue, EINA_TRUE);
+   ASSERT_TRUE(res);
+   etRunner::get().waitEvent(E_TC_EVENT_TYPE_STACK_RAISE);
+
+   // 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_transient_for2)
+{
+   etWin *tw = NULL;
+   Eina_Bool res = EINA_FALSE;
+   Eina_List *list = NULL, *l = NULL;
+
+   res = initTC(EINA_TRUE, EINA_TRUE);
+
+   // set transient_for Blue(parent) & Green(child)
+   res = registerTCWin(tw_green);
+   EXPECT_TRUE(res);
+   res = etRunner::get().setWinTransientFor(tw_green, tw_blue, EINA_TRUE);
+   ASSERT_TRUE(res);
+   etRunner::get().waitEvent(E_TC_EVENT_TYPE_STACK_RAISE);
+
+   // Expected focus res:
+   // [Top] Green[focused] -> Blue -> Red [Bottom]
+   list = etRunner::get().getWinInfoList();
+   ASSERT_TRUE(list != NULL);
+
+   EINA_LIST_CAST_FOREACH(list, l, tw, etWin*)
+     {
+        if (tw->native_win == tw_green->native_win)
+          ASSERT_TRUE(tw->Focus.obj);
+        else
+          ASSERT_FALSE(tw->Focus.obj);
+     }
+   etRunner::get().freeWinInfoList(list);
+}
+
+TEST_F(etTestFocus, focus_transient_for3)
+{
+   etWin *tw = NULL;
+   Eina_Bool res = EINA_FALSE;
+   Eina_List *list = NULL, *l = NULL;
+
+   res = initTC(EINA_TRUE, EINA_TRUE);
+
+   // set transient_for Green(parent) & Blue(child)
+   res = registerTCWin(tw_green);
+   EXPECT_TRUE(res);
+   res = etRunner::get().setWinTransientFor(tw_blue, tw_green, EINA_TRUE);
+   ASSERT_TRUE(res);
+   etRunner::get().waitEvent(E_TC_EVENT_TYPE_STACK_RAISE);
+
+   // Expected focus res:
+   // [Top] Blue[focused] -> Green -> Red [Bottom]
+   list = etRunner::get().getWinInfoList();
+   ASSERT_TRUE(list != NULL);
+
+   EINA_LIST_CAST_FOREACH(list, l, tw, etWin*)
+     {
+        if (tw->native_win == tw_blue->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;
@@ -473,3 +562,33 @@ TEST_F(etTestFocus, focus_fullsize_activate)
      }
    etRunner::get().freeWinInfoList(list);
 }
+
+TEST_F(etTestFocus, focus_fullsize_transient_for)
+{
+   etWin *tw = NULL;
+   Eina_Bool res = EINA_FALSE;
+   Eina_List *list = NULL, *l = NULL;
+
+   res = initTC(EINA_TRUE, EINA_FALSE);
+
+   // set transient_for Blue(parent) & Red(child)
+   res = registerTCWin(tw_red);
+   EXPECT_TRUE(res);
+   res = etRunner::get().setWinTransientFor(tw_red, tw_blue, EINA_TRUE);
+   ASSERT_TRUE(res);
+   etRunner::get().waitEvent(E_TC_EVENT_TYPE_STACK_RAISE);
+
+   // 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);
+}