add transient_for_below test 26/261326/3
authorDoyoun Kang <doyoun.kang@samsung.com>
Thu, 15 Jul 2021 08:59:18 +0000 (17:59 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Thu, 15 Jul 2021 09:47:25 +0000 (18:47 +0900)
Change-Id: I165cf6486f778a454a2c6da2c5477a6fe5131851

src/Makefile.am
src/testcase/0014_transient_for_below.cpp [new file with mode: 0644]

index 109a114..5845136 100644 (file)
@@ -22,7 +22,8 @@ testcase/0009_input.cpp \
 testcase/0010_splash.cpp \
 testcase/0011_effect.cpp \
 testcase/0012_aux_hint.cpp \
-testcase/0013_iconic_state.cpp
+testcase/0013_iconic_state.cpp \
+testcase/0014_transient_for_below.cpp
 
 e_tizen_unittests_SOURCES = \
 e_test_main.cpp \
diff --git a/src/testcase/0014_transient_for_below.cpp b/src/testcase/0014_transient_for_below.cpp
new file mode 100644 (file)
index 0000000..b5d391c
--- /dev/null
@@ -0,0 +1,165 @@
+#include "e_test_event.h"
+#include "e_test_base.h"
+
+class etTestTransientForBelow : public ::etTCBase
+{
+ public:
+    etTestTransientForBelow() { };
+    ~etTestTransientForBelow() { };
+
+ protected:
+    etWin *tw_parent = NULL;
+    etWin *tw_base = NULL;
+    std::string testCaseName;
+    std::string testName;
+
+    void initTC(Eina_Bool show_win);
+    void makeTransientBelowChild(etWin **win, etWin *parent, int x, int y, int w, int h, E_TC_Win_Color color, const char *name);
+};
+
+void
+etTestTransientForBelow::initTC(Eina_Bool show_win)
+{
+   const ::testing::TestInfo *const test_info = ::testing::UnitTest::GetInstance()->current_test_info();
+
+   tw_base = initNormalWin("TCWin_Normal_normal", 0, 0, 480, 800, E_TC_WIN_COLOR_BLACK);
+   if (show_win)
+     {
+        showTCWin(tw_base);
+        ASSERT_VIS_ON(tw_base);
+     }
+   ASSERT_TRUE(tw_base != NULL) << "failed to initiation window";
+
+   tw_parent = initNormalWin("TCWin_Normal_parent", 50, 50, 300, 300, E_TC_WIN_COLOR_RED);
+   if (show_win)
+     {
+        showTCWin(tw_parent);
+        ASSERT_VIS_ON(tw_parent);
+     }
+   ASSERT_TRUE(tw_parent != NULL) << "failed to initiation window";
+
+   testCaseName = test_info->test_case_name();
+   testName = test_info->name();
+}
+
+void
+etTestTransientForBelow::makeTransientBelowChild(etWin **win, etWin *parent, int x, int y, int w, int h, E_TC_Win_Color color, const char *name)
+{
+   Eina_Bool res;
+   etWin *temp_win = NULL;
+
+   temp_win = initNormalWin(name, x, y, w, h, color);
+   ASSERT_TRUE(temp_win != NULL) << "failed to create window";
+
+   res = etRunner::get().setWinTransientForBelow(temp_win, parent, EINA_TRUE);
+   ASSERT_TRUE(res);
+   etRunner::get().work(0.1); // wait for activate done. It does not change stack.
+
+   showTCWin(temp_win);
+   ASSERT_VIS_ON(temp_win);
+
+   *win = temp_win;
+}
+
+TEST_F(etTestTransientForBelow, transient_for_below_basic)
+{
+   etWin *tw = NULL;
+   etWin *tw_child = NULL;
+   Eina_List *list = NULL, *l = NULL;
+   int pass_count = 0;
+
+   // init TC window, show=true, geom=true
+   initTC(EINA_TRUE);
+
+   makeTransientBelowChild(&tw_child, tw_parent, 80, 80, 300, 300, E_TC_WIN_COLOR_BLUE, "TCWin_Normal_child");
+
+   // Expected stack res:
+   // [Top] tw_parent -> tw_child -> tw_base [Bottom]
+   list = etRunner::get().getWinInfoList();
+   ASSERT_TRUE(list != NULL);
+
+   EINA_LIST_CAST_FOREACH(list, l, tw, etWin*)
+     {
+        if (tw->layer > 200) continue;
+
+        if (pass_count == 0)
+          {
+             ASSERT_EQ(tw->native_win, tw_parent->native_win);
+             pass_count++;
+             continue;
+          }
+        else if (pass_count == 1)
+          {
+             ASSERT_EQ(tw->native_win, tw_child->native_win);
+             pass_count++;
+             continue;
+          }
+        else
+          {
+             ASSERT_EQ(tw->native_win, tw_base->native_win);
+             pass_count++;
+          }
+
+        break;
+     }
+   etRunner::get().freeWinInfoList(list);
+
+   ASSERT_EQ(3, pass_count);
+   //ASSERT_EQ(etRunner::get().verifyTC(testCaseName, testName), EINA_TRUE);
+}
+
+TEST_F(etTestTransientForBelow, transient_for_below_basic2)
+{
+   etWin *tw = NULL;
+   etWin *tw_child = NULL;
+   etWin *tw_child2 = NULL;
+   Eina_List *list = NULL, *l = NULL;
+   int pass_count = 0;
+
+   // init TC window, show=true, geom=true
+   initTC(EINA_TRUE);
+
+   makeTransientBelowChild(&tw_child, tw_parent, 80, 80, 300, 300, E_TC_WIN_COLOR_BLUE, "TCWin_Normal_child");
+   makeTransientBelowChild(&tw_child2, tw_parent, 110, 110, 300, 300, E_TC_WIN_COLOR_GREEN, "TCWin_Normal_child2");
+
+   // Expected stack res:
+   // [Top] tw_parent -> tw_child -> tw_child2 -> tw_base [Bottom]
+   list = etRunner::get().getWinInfoList();
+   ASSERT_TRUE(list != NULL);
+
+   EINA_LIST_CAST_FOREACH(list, l, tw, etWin*)
+     {
+        if (tw->layer > 200) continue;
+
+        if (pass_count == 0)
+          {
+             ASSERT_EQ(tw->native_win, tw_parent->native_win);
+             pass_count++;
+             continue;
+          }
+        else if (pass_count == 1)
+          {
+             ASSERT_EQ(tw->native_win, tw_child->native_win);
+             pass_count++;
+             continue;
+          }
+        else if (pass_count == 2)
+          {
+             ASSERT_EQ(tw->native_win, tw_child2->native_win);
+             pass_count++;
+             continue;
+          }
+        else
+          {
+             ASSERT_EQ(tw->native_win, tw_base->native_win);
+             pass_count++;
+          }
+
+        break;
+     }
+   etRunner::get().freeWinInfoList(list);
+
+   ASSERT_EQ(4, pass_count);
+   //ASSERT_EQ(etRunner::get().verifyTC(testCaseName, testName), EINA_TRUE);
+}
+