0008_focus: Added window iconify/uniconify test case. 92/180592/1
authorJunSeok, Kim <juns.kim@samsung.com>
Thu, 31 May 2018 05:28:02 +0000 (14:28 +0900)
committerJunSeok, Kim <juns.kim@samsung.com>
Thu, 31 May 2018 05:28:02 +0000 (14:28 +0900)
Change-Id: Iba449c07f23a2a7c761f79ba2e011c0d91470f90

src/testcase/0008_focus.cpp

index 2d999e1..32f8cf6 100644 (file)
@@ -420,6 +420,101 @@ TEST_F(etTestFocus, focus_transient_for3)
      }
    etRunner::get().freeWinInfoList(list);
 }
+
+TEST_F(etTestFocus, focus_iconify1)
+{
+   etWin *tw = NULL;
+   Eina_Bool res = EINA_FALSE;
+   Eina_List *list = NULL, *l = NULL;
+
+   res = initTC(EINA_TRUE, EINA_TRUE);
+
+   // set iconify Blue
+   res = registerTCWin(tw_blue);
+   EXPECT_TRUE(res);
+   res = etRunner::get().setWinIconic(tw_blue, EINA_TRUE);
+   ASSERT_TRUE(res);
+   etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_OFF);
+
+   // Expected focus res:
+   // [Top] Blue(iconified) -> Green[focused] -> 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_iconify2)
+{
+   etWin *tw = NULL;
+   Eina_Bool res = EINA_FALSE;
+   Eina_List *list = NULL, *l = NULL;
+
+   res = initTC(EINA_TRUE, EINA_TRUE);
+
+   // set iconify Red
+   res = registerTCWin(tw_red);
+   EXPECT_TRUE(res);
+   res = etRunner::get().setWinIconic(tw_red, EINA_TRUE);
+   ASSERT_TRUE(res);
+   etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_OFF);
+
+   // Expected focus res:
+   // [Top] Blue[focused] -> Green -> Red(iconified) [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_uniconify)
+{
+   etWin *tw = NULL;
+   Eina_Bool res = EINA_FALSE;
+   Eina_List *list = NULL, *l = NULL;
+
+   res = initTC(EINA_TRUE, EINA_TRUE);
+
+   // set iconify Red
+   res = registerTCWin(tw_red);
+   EXPECT_TRUE(res);
+   res = etRunner::get().setWinIconic(tw_red, EINA_TRUE);
+   ASSERT_TRUE(res);
+   etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_OFF);
+
+   // set uniconify Red
+   res = etRunner::get().setWinIconic(tw_red, EINA_FALSE);
+   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_fullsize_basic)
 {
    etWin *tw = NULL;
@@ -592,3 +687,68 @@ TEST_F(etTestFocus, focus_fullsize_transient_for)
      }
    etRunner::get().freeWinInfoList(list);
 }
+
+TEST_F(etTestFocus, focus_fullsize_iconify)
+{
+   etWin *tw = NULL;
+   Eina_Bool res = EINA_FALSE;
+   Eina_List *list = NULL, *l = NULL;
+
+   res = initTC(EINA_TRUE, EINA_FALSE);
+
+   // set iconify Blue
+   res = registerTCWin(tw_blue);
+   EXPECT_TRUE(res);
+   res = etRunner::get().setWinIconic(tw_blue, EINA_TRUE);
+   ASSERT_TRUE(res);
+   etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_OFF);
+
+   // Expected focus res:
+   // [Top] Blue(iconified) -> Green[focused] -> 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_fullsize_uniconify)
+{
+   etWin *tw = NULL;
+   Eina_Bool res = EINA_FALSE;
+   Eina_List *list = NULL, *l = NULL;
+
+   res = initTC(EINA_TRUE, EINA_FALSE);
+
+   // set iconify Red
+   res = registerTCWin(tw_red);
+   EXPECT_TRUE(res);
+   res = etRunner::get().setWinIconic(tw_red, EINA_TRUE);
+   ASSERT_TRUE(res);
+   etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_OFF);
+
+   // set uniconify Red
+   res = etRunner::get().setWinIconic(tw_red, EINA_FALSE);
+   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);
+}