0010_splash: add test case for splash 40/187340/3
authorJuyeon Lee <juyeonne.lee@samsung.com>
Wed, 22 Aug 2018 06:30:31 +0000 (15:30 +0900)
committerJuyeon Lee <juyeonne.lee@samsung.com>
Fri, 24 Aug 2018 09:10:53 +0000 (18:10 +0900)
from this TC, we can evaluate splash launch feature
tizen_launch_splash_interface, tizen_launch_effect_interface are going to be run

Change-Id: Ie7bd992a799bf5e20d6057cad74f368ced68e1f1

Makefile.am
configure.ac
data/Makefile.am [new file with mode: 0644]
data/edc/launch_splash.edc [new file with mode: 0644]
data/img/launchimg_splash.png [new file with mode: 0644]
packaging/e-tizen-testcase.spec
src/Makefile.am
src/e_test_event.cpp
src/e_test_event.h
src/e_test_util.h
src/testcase/0010_splash.cpp [new file with mode: 0644]

index fb2d034..c50e209 100644 (file)
@@ -1,4 +1,5 @@
-SUBDIRS = src
+SUBDIRS = src \
+          data
 
 MAINTAINERCLEANFILES = \
                       Makefile.in
index d9c3d68..e1311b5 100644 (file)
@@ -30,15 +30,33 @@ requirements="\
    wayland-client \
    ecore-wl2 \
    tizen-extension-client \
+   tizen-launch-client \
    tzsh-screensaver-manager-service \
    tzsh-screensaver-service \
    "
 
 PKG_CHECK_MODULES(E_TEST_RUNNER, [${requirements}])
 
+# Find edje_cc
+PKG_CHECK_MODULES(EDJE, [edje >= 1.0.0])
+AC_ARG_WITH(edje-cc,
+   AC_HELP_STRING([--with-edje-cc=PATH], [specify a specific path to edje_cc]),
+   [
+       v=$withval;
+       EDJE_CC=$v
+   ],
+   [
+   EDJE_CC=$(pkg-config --variable=prefix edje)/bin/edje_cc
+   ]
+)
+AC_SUBST(EDJE_CC)
+AC_MSG_CHECKING([Which edje_cc to use])
+AC_MSG_RESULT(${EDJE_CC})
+
 AC_CONFIG_FILES([
 Makefile
 src/Makefile
+data/Makefile
 ])
 
 AC_OUTPUT
diff --git a/data/Makefile.am b/data/Makefile.am
new file mode 100644 (file)
index 0000000..fce27dc
--- /dev/null
@@ -0,0 +1,20 @@
+MAINTAINERCLEANFILES = Makefile.in
+
+EDJE_CC = @EDJE_CC@
+EDJE_CC_FLAGS = -v -id $(top_srcdir)/data/img
+
+filesdir = $(pkgdatadir)/data
+files_DATA = launch_splash.edj
+
+EXTRA_DIST = \
+    edc/launch_splash.edc \
+    img/launchimg_splash.png
+
+launch_splash.edj: Makefile $(EXTRA_DIST)
+       $(EDJE_CC) $(EDJE_CC_FLAGS) \
+       $(top_srcdir)/data/edc/launch_splash.edc \
+       $(top_builddir)/data/launch_splash.edj
+
+clean-local:
+       rm -f *.edj
+
diff --git a/data/edc/launch_splash.edc b/data/edc/launch_splash.edc
new file mode 100644 (file)
index 0000000..d1f5821
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+collections {
+
+    group
+    {
+        name: "effect";
+
+        parts {
+            part {
+                name: "bg";
+                type: RECT;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    color: 21 108 148 255;
+                }
+            }
+            part {
+                name: "title";
+                type: RECT;
+                scale: 1;
+                repeat_events: 0;
+                description {
+                    state: "default" 0.0;
+                    min, 0 96;
+                    fixed,0  1;
+                    align: 0.5 0;
+                    rel1 { relative: 0.0 0.0; }
+                    rel2 { relative: 1.0 0.0; }
+                    color: 255 108 148 255;
+                }
+            }
+            part {
+                name: "category";
+                type: RECT;
+                scale: 1;
+                repeat_events: 0;
+                description {
+                    state: "default" 0.0;
+                    min, 0 532;
+                    fixed,0  1;
+                    align: 0.5 0;
+                    rel1 { relative: 0.0 1.0; to_y:"title";}
+                    rel2 { relative: 1.0 1.0; to_y:"title";}
+                    color: 21 255 148 255;
+                }
+            }
+
+            part {
+                name: "tabbar";
+                type: RECT;
+                scale: 1;
+                repeat_events: 1;
+                description {
+                    state: "default" 0.0;
+                    min, 0 75;
+                    fixed,0  1;
+                    align: 0.5 0.0;
+                    rel1 { relative: 0.0 1.0; to:"category";}
+                    rel2 { relative: 1.0 1.0; to:"category";}
+                    color:  21 255 242 255;
+                }
+            }
+            part {
+                name: "elm.swallow.content";
+                type: RECT;
+                scale: 1;
+                repeat_events: 1;
+                description {
+                    state: "default" 0.0;
+                    align: 0.5 0;
+                    fixed: 0 1;
+                    rel1 { relative: 0.0 1.0; to_y: "tabbar";}
+                    rel2 { relative: 1.0 1.0;}
+                    color: 21 108 148 255;
+                }
+            }
+        }
+    }
+}
+
+
diff --git a/data/img/launchimg_splash.png b/data/img/launchimg_splash.png
new file mode 100644 (file)
index 0000000..c299c7d
Binary files /dev/null and b/data/img/launchimg_splash.png differ
index f6c50c5..ab3dcc2 100644 (file)
@@ -13,9 +13,12 @@ BuildRequires: pkgconfig(capi-ui-efl-util)
 BuildRequires: pkgconfig(ecore-wl2)
 BuildRequires: gettext
 BuildRequires: pkgconfig(tizen-extension-client)
+BuildRequires: pkgconfig(tizen-launch-client)
 BuildRequires: pkgconfig(tzsh-screensaver-manager-service)
 BuildRequires: pkgconfig(tzsh-screensaver-service)
 BuildRequires: gtest-devel
+BuildRequires: pkgconfig(edje)
+BuildRequires: edje-tools
 
 %description
 This package is a test case runner for enlightenment.
@@ -35,6 +38,8 @@ make %{?_smp_mflags}
 
 %install
 rm -rf %{buildroot}
+%__mkdir_p %{buildroot}/usr/share/e_test_runner/data/
+%__cp -afr data/img/launchimg_splash.png  %{buildroot}/usr/share/e_test_runner/data/
 
 # install
 make install DESTDIR=%{buildroot}
@@ -44,3 +49,4 @@ make install DESTDIR=%{buildroot}
 %defattr(-,root,root,-)
 %attr(550,root,root) %{_bindir}/e_test_runner
 %license COPYING
+%{_datadir}/e_test_runner/data/
index bbcd04c..5d08c7c 100644 (file)
@@ -18,7 +18,8 @@ testcase/0005_notification.cpp \
 testcase/0006_tzsh.cpp \
 testcase/0007_rotation.cpp \
 testcase/0008_focus.cpp \
-testcase/0009_input.cpp
+testcase/0009_input.cpp \
+testcase/0010_splashcpp
 
 e_test_runner_SOURCES = \
 e_test_main.cpp \
@@ -37,7 +38,8 @@ testcase/0005_notification.cpp \
 testcase/0006_tzsh.cpp \
 testcase/0007_rotation.cpp \
 testcase/0008_focus.cpp \
-testcase/0009_input.cpp
+testcase/0009_input.cpp \
+testcase/0010_splash.cpp
 
 MAINTAINERCLEANFILES = \
 Makefile.in
index 6fe98e3..ae7ea00 100644 (file)
@@ -115,6 +115,18 @@ etRunner::shutdown()
         tzSurface = NULL;
      }
 
+   if (tzlaunch_splash)
+     {
+        tizen_launch_splash_destroy(tzlaunch_splash);
+        tzlaunch_splash = NULL;
+     }
+
+   if (tzlaunch_effect)
+     {
+        tizen_launch_effect_destroy(tzlaunch_effect);
+        tzlaunch_effect = NULL;
+     }
+
    // deinit eldbus
    eldbus_proxy_unref(dbus.proxy);
    eldbus_object_unref(dbus.obj);
@@ -717,6 +729,44 @@ etRunner::generateKeyEvent(const char *keyname, double delay)
                                         this);
 }
 
+Eina_Bool
+etRunner::setSplashLaunch(const char *path, int type)
+{
+   const char *effect_type = "launch";
+   struct wl_array options1, options2;
+
+   // init tzlaunch_splash
+   if (tzlaunch_splash)
+     {
+        tizen_launch_splash_destroy(tzlaunch_splash);
+        tzlaunch_splash = NULL;
+     }
+   if (tzlaunch_effect) tzlaunch_splash = tizen_launch_effect_create_splash_img(tzlaunch_effect);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tzlaunch_splash, EINA_FALSE);
+
+   wl_array_init(&options1);
+   tizen_launch_effect_type_set(tzlaunch_effect, "launch", 555, &options1);
+   wl_array_release(&options1);
+
+   wl_array_init(&options2);
+   tizen_launch_splash_launch(tzlaunch_splash, path, type,
+          24, 0, 0,
+          effect_type, NULL, &options2);
+    wl_array_release(&options2);
+
+   return EINA_TRUE;
+}
+
+Eina_Bool
+etRunner::setSplashOwner()
+{
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tzlaunch_splash, EINA_FALSE);
+
+   tizen_launch_splash_owner(tzlaunch_splash, (int)getpid());
+
+   return EINA_TRUE;
+}
 
 Eina_Bool
 etRunner::freezeEvent()
@@ -961,10 +1011,19 @@ etRunner::initProtocols()
                                  &tizen_surface_interface,
                                  (global->version > 1)? 1 : global->version);
           }
+        if (!strcmp(global->interface, "tizen_launch_effect"))
+          {
+             tzlaunch_effect = (struct tizen_launch_effect *)
+                wl_registry_bind(registry,
+                                 global->id,
+                                 &tizen_launch_effect_interface,
+                                 (global->version > 1)? 1 : global->version);
+          }
      }
 
    EINA_SAFETY_ON_NULL_GOTO(tzPolicy, err);
    EINA_SAFETY_ON_NULL_GOTO(tzSurface, err);
+   EINA_SAFETY_ON_NULL_GOTO(tzlaunch_effect, err);
 
    eina_iterator_free(globals);
    return EINA_TRUE;
index dd66005..a5a0526 100644 (file)
@@ -16,6 +16,8 @@ private:
       worker.waitTime = 0.0;
       tzPolicy = NULL;
       tzSurface = NULL;
+      tzlaunch_effect = NULL;
+      tzlaunch_splash =  NULL;
       ev.expire_timer = NULL;
       ev.request = E_TC_EVENT_TYPE_NONE;
       ev.response = E_TC_EVENT_TYPE_NONE;
@@ -51,6 +53,8 @@ private:
 
    struct tizen_policy  *tzPolicy;
    struct tizen_surface *tzSurface;
+   struct tizen_launch_effect *tzlaunch_effect;
+   struct tizen_launch_splash *tzlaunch_splash;
 
    Eina_List *listWinInfo;
 
@@ -111,6 +115,8 @@ public:
    Eina_Bool     generateKeyPress(const char *key);
    Eina_Bool     generateKeyRelease(const char *key);
    void          generateKeyEvent(const char *keyname, double delay);
+   Eina_Bool     setSplashLaunch(const char *path, int type);
+   Eina_Bool     setSplashOwner();
    Eina_Bool     freezeEvent();
    Eina_Bool     thawEvent();
    Eina_Bool     waitEvent(E_TC_Event_Type ev);
index 83e404c..b7b832c 100644 (file)
@@ -11,6 +11,7 @@ extern "C" {
 #include <Elementary.h>
 #include <wayland-client.h>
 #include <tizen-extension-client-protocol.h>
+#include <tizen-launch-client-protocol.h>
 
 #ifdef ERR
 # undef ERR
diff --git a/src/testcase/0010_splash.cpp b/src/testcase/0010_splash.cpp
new file mode 100644 (file)
index 0000000..4426adf
--- /dev/null
@@ -0,0 +1,104 @@
+#include "e_test_event.h"
+#include "e_test_base.h"
+
+#define SPLASH_TYPE_IMG 0
+#define SPLASH_TYPE_EDC 1
+
+char const *path_edc = "/usr/share/e_test_runner/data/launch_splash.edj";
+char const *path_img = "/usr/share/e_test_runner/data/launchimg_splash.png";
+
+class etTestSplash : public ::etTCBase
+{
+ public:
+    etTestSplash() { };
+    ~etTestSplash() { };
+
+ protected:
+    etWin *tw = NULL;
+
+    void initTC(char * path, int type);
+};
+
+void
+etTestSplash::initTC(char * path, int type)
+{
+   Eina_Bool ret = EINA_FALSE;
+
+   tw = initNormalWin("TCWin_Splash", EINA_FALSE, EINA_FALSE);
+   ASSERT_TRUE(tw != NULL) << "failed to initiation window";
+
+   ret = etRunner::get().setSplashLaunch(path, type);
+   ASSERT_TRUE(ret);
+}
+
+TEST_F(etTestSplash, splash_edc)
+{
+   etWin *tw2 = NULL;
+   Eina_Bool res = EINA_FALSE;
+   Eina_List *list = NULL, *l = NULL;
+
+   initTC((char*)path_edc, SPLASH_TYPE_EDC);
+
+   // find Launchscreen from toplv windows
+   list = etRunner::get().getWinInfoList();
+   ASSERT_TRUE(list != NULL);
+
+   EINA_LIST_CAST_FOREACH(list, l, tw2, etWin*)
+     {
+        // todo: check cw->obj is EDJ type, and group name is effect
+        if (!strncmp(tw2->name, "Launchscreen", strlen(tw2->name)))
+          res = EINA_TRUE;
+     }
+   etRunner::get().freeWinInfoList(list);
+
+   ASSERT_TRUE(res);
+}
+
+TEST_F(etTestSplash, splash_img)
+{
+   etWin *tw2 = NULL;
+   Eina_Bool res = EINA_FALSE;
+   Eina_List *list = NULL, *l = NULL;
+
+   initTC((char*)path_img, SPLASH_TYPE_IMG);
+
+   // find Launchscreen from toplv windows
+   list = etRunner::get().getWinInfoList();
+   ASSERT_TRUE(list != NULL);
+
+   EINA_LIST_CAST_FOREACH(list, l, tw2, etWin*)
+     {
+        // todo: check cw->obj is IMG type, and img file
+        if (!strncmp(tw2->name, "Launchscreen", strlen(tw2->name)))
+          res = EINA_TRUE;
+     }
+   etRunner::get().freeWinInfoList(list);
+
+   ASSERT_TRUE(res);
+}
+
+TEST_F(etTestSplash, splash_replace)
+{
+   etWin *tw2 = NULL;
+   Eina_List *list = NULL, *l = NULL;
+
+   initTC((char*)path_img, SPLASH_TYPE_IMG);
+   etRunner::get().setSplashOwner();
+
+   tw->updateGeometry();
+   tw->show();
+   etRunner::get().waitEvent(E_TC_EVENT_TYPE_VIS_ON);
+
+   // Expected focus res:
+   list = etRunner::get().getWinInfoList();
+   ASSERT_TRUE(list != NULL);
+
+   EINA_LIST_CAST_FOREACH(list, l, tw2, etWin*)
+     {
+        if (tw->native_win == tw2->native_win)
+          ASSERT_TRUE(tw2->Focus.obj);
+        if (!strncmp(tw2->name, "Launchscreen", strlen(tw2->name)))
+          ASSERT_NE(tw->native_win, tw2->native_win);
+     }
+   etRunner::get().freeWinInfoList(list);
+}