launch: merge header files in one (launch.h)
[platform/core/uifw/libds-tizen.git] / tests / tc_launch_effect.cpp
index ebfd8ca..e024956 100644 (file)
@@ -1,7 +1,7 @@
 #include "tc_main.h"
 #include "mockclient.h"
 #include "mockcompositor.h"
-#include <libds-tizen/launch/effect.h>
+#include <libds-tizen/launch.h>
 #include <tizen-launch-server-protocol.h>
 #include <tizen-launch-client-protocol.h>
 
 char const *path_edc = "/usr/share/e_tizen_unittests/data/launch_splash.edj";
 char const *path_img = "/usr/share/e_tizen_unittests/data/launchimg_splash.png";
 
-class MockEffectCompositor : public MockCompositor
+class MockLaunchEffectCompositor : public MockCompositor
 {
 public:
-    MockEffectCompositor()
-        : MockCompositor(&MockEffectCompositor::TestSetup, this)
+    MockLaunchEffectCompositor()
+        : MockCompositor(&MockLaunchEffectCompositor::TestSetup, this)
     {
         ds_inf("%s : this(%p)", __func__, this);
 
@@ -33,47 +33,47 @@ public:
         mEffectType = -1;
     }
 
-    ~MockEffectCompositor()
+    ~MockLaunchEffectCompositor()
     {
         ds_inf("%s : this(%p)", __func__, this);
     }
 
     static void TestSetup(void *data)
     {
-        MockEffectCompositor *mockComp =
-            static_cast<MockEffectCompositor *>(data);
+        MockLaunchEffectCompositor *mockComp =
+            static_cast<MockLaunchEffectCompositor *>(data);
         Compositor *comp = mockComp->compositor;
 
         ds_inf("%s: mockComp(%p)", __func__, mockComp);
 
-        mockComp->mEffect = ds_tizen_effect_create(comp->display);
+        mockComp->mEffect = ds_tizen_launch_effect_create(comp->display);
 
         // destroy listener
         mockComp->mDestroyListener.notify =
-            MockEffectCompositor::DestroyCallback;
+            MockLaunchEffectCompositor::DestroyCallback;
         mockComp->mDestroyListener.parent = mockComp;
-        ds_tizen_effect_add_destroy_listener(mockComp->mEffect,
+        ds_tizen_launch_effect_add_destroy_listener(mockComp->mEffect,
             &mockComp->mDestroyListener);
 
         // type_set listener
         mockComp->mTypeSetListener.notify =
-            MockEffectCompositor::TypeSetCallback;
+            MockLaunchEffectCompositor::TypeSetCallback;
         mockComp->mTypeSetListener.parent = mockComp;
-        ds_tizen_effect_add_type_set_listener(mockComp->mEffect,
+        ds_tizen_launch_effect_add_type_set_listener(mockComp->mEffect,
             &mockComp->mTypeSetListener);
 
         // type_unset listener
         mockComp->mTypeUnsetListener.notify =
-            MockEffectCompositor::TypeUnsetCallback;
+            MockLaunchEffectCompositor::TypeUnsetCallback;
         mockComp->mTypeUnsetListener.parent = mockComp;
-        ds_tizen_effect_add_type_unset_listener(mockComp->mEffect,
+        ds_tizen_launch_effect_add_type_unset_listener(mockComp->mEffect,
             &mockComp->mTypeUnsetListener);
 
         // new_splash listener
         mockComp->mNewSplashListener.notify =
-            MockEffectCompositor::NewSplashCallback;
+            MockLaunchEffectCompositor::NewSplashCallback;
         mockComp->mNewSplashListener.parent = mockComp;
-        ds_tizen_effect_add_new_splash_listener(mockComp->mEffect,
+        ds_tizen_launch_effect_add_new_splash_listener(mockComp->mEffect,
             &mockComp->mNewSplashListener);
     }
 
@@ -81,7 +81,7 @@ public:
     {
         ds_inf("%s", __func__);
 
-        MockEffectCompositor *mockComp =
+        MockLaunchEffectCompositor *mockComp =
             reinterpret_cast<DestroyListener *>(listener)->parent;
 
         mockComp->bDestroyed = true;
@@ -89,10 +89,10 @@ public:
 
     static void TypeSetCallback(struct wl_listener *listener, void *data)
     {
-        struct ds_tizen_effect_event_type_set *event = (ds_tizen_effect_event_type_set *)data;
+        struct ds_tizen_launch_effect_event_type_set *event = (ds_tizen_launch_effect_event_type_set *)data;
         ds_inf("%s", __func__);
 
-        MockEffectCompositor *mockComp =
+        MockLaunchEffectCompositor *mockComp =
             reinterpret_cast<TypeSetListener *>(listener)->parent;
 
         mockComp->bTypeSet = true;
@@ -102,10 +102,10 @@ public:
 
     static void TypeUnsetCallback(struct wl_listener *listener, void *data)
     {
-        struct ds_tizen_effect_event_type_unset *event = (ds_tizen_effect_event_type_unset *)data;
+        struct ds_tizen_launch_effect_event_type_unset *event = (ds_tizen_launch_effect_event_type_unset *)data;
         ds_inf("%s", __func__);
 
-        MockEffectCompositor *mockComp =
+        MockLaunchEffectCompositor *mockComp =
             reinterpret_cast<TypeUnsetListener *>(listener)->parent;
 
         mockComp->bTypeSet = false;
@@ -116,29 +116,29 @@ public:
 
     static void NewSplashCallback(struct wl_listener *listener, void *data)
     {
-        struct ds_tizen_effect_event_new_splash *event = (ds_tizen_effect_event_new_splash *)data;
+        struct ds_tizen_launch_splash *splash = (ds_tizen_launch_splash *)data;
         ds_inf("%s", __func__);
 
-        MockEffectCompositor *mockComp =
+        MockLaunchEffectCompositor *mockComp =
             reinterpret_cast<NewSplashListener *>(listener)->parent;
 
         mockComp->bNewSplash = true;
-        mockComp->mSplash = event->splash;
+        mockComp->mSplash = splash;
 
         // owner listener
         mockComp->mOwnerListener.notify =
-            MockEffectCompositor::OwnerCallback;
+            MockLaunchEffectCompositor::OwnerCallback;
         mockComp->mOwnerListener.parent = mockComp;
-        ds_tizen_splash_add_owner_listener(mockComp->mSplash,
+        ds_tizen_launch_splash_add_owner_listener(mockComp->mSplash,
             &mockComp->mOwnerListener);
     }
 
     static void OwnerCallback(struct wl_listener *listener, void *data)
     {
-        struct ds_tizen_splash_event_owner *event = (ds_tizen_splash_event_owner *)data;
+        struct ds_tizen_launch_splash_event_owner *event = (ds_tizen_launch_splash_event_owner *)data;
         ds_inf("%s", __func__);
 
-        MockEffectCompositor *mockComp =
+        MockLaunchEffectCompositor *mockComp =
             reinterpret_cast<OwnerListener *>(listener)->parent;
 
         mockComp->mPid = event->pid;
@@ -154,49 +154,49 @@ public:
     int mEffectType;
 
 private:
-    struct ds_tizen_effect *mEffect;
-    struct ds_tizen_splash *mSplash;
+    struct ds_tizen_launch_effect *mEffect;
+    struct ds_tizen_launch_splash *mSplash;
     struct DestroyListener: ::wl_listener {
-        MockEffectCompositor *parent;
+        MockLaunchEffectCompositor *parent;
     };
     DestroyListener mDestroyListener;
 
     struct TypeSetListener: ::wl_listener {
-        MockEffectCompositor *parent;
+        MockLaunchEffectCompositor *parent;
     };
     TypeSetListener mTypeSetListener;
 
     struct TypeUnsetListener: ::wl_listener {
-        MockEffectCompositor *parent;
+        MockLaunchEffectCompositor *parent;
     };
     TypeUnsetListener mTypeUnsetListener;
 
     struct NewSplashListener: ::wl_listener {
-        MockEffectCompositor *parent;
+        MockLaunchEffectCompositor *parent;
     };
     NewSplashListener mNewSplashListener;
 
     struct OwnerListener: ::wl_listener {
-        MockEffectCompositor *parent;
+        MockLaunchEffectCompositor *parent;
     };
     OwnerListener mOwnerListener;
 };
 
-class MockEffectClient : public MockClient
+class MockLaunchEffectClient : public MockClient
 {
 public:
-    MockEffectClient()
+    MockLaunchEffectClient()
         : compositor_res(nullptr),
           tizen_launch_effect(nullptr)
     {}
 
-    MockEffectClient(const struct wl_registry_listener *listener)
+    MockLaunchEffectClient(const struct wl_registry_listener *listener)
         : MockClient(listener, this)
     {
         ds_inf("%s", __func__);
     }
 
-    ~MockEffectClient()
+    ~MockLaunchEffectClient()
     {
         ds_inf("%s", __func__);
     }
@@ -215,13 +215,13 @@ public:
         return compositor_res;
     }
 
-    void SetTizenEffect(struct tizen_launch_effect *global_res)
+    void SetTizenLaunchEffect(struct tizen_launch_effect *global_res)
     {
         ds_inf("%s", __func__);
         tizen_launch_effect = global_res;
     }
 
-    struct tizen_launch_effect *GetTizenEffect()
+    struct tizen_launch_effect *GetTizenLaunchEffect()
     {
         ds_inf("%s", __func__);
 
@@ -241,7 +241,7 @@ client_registry_cb_global(void *data, struct wl_registry *registry,
 {
     ds_inf("%s", __func__);
 
-    MockEffectClient *client = static_cast<MockEffectClient *>(data);
+    MockLaunchEffectClient *client = static_cast<MockLaunchEffectClient *>(data);
     struct wl_compositor *compositor_res;
     struct tizen_launch_effect *tizen_launch_effect;
 
@@ -260,7 +260,7 @@ client_registry_cb_global(void *data, struct wl_registry *registry,
             ds_err("wl_registry_bind() failed. tizen_launch_effect resource.");
             return;
         }
-        client->SetTizenEffect(tizen_launch_effect);
+        client->SetTizenLaunchEffect(tizen_launch_effect);
     }
 }
 
@@ -270,9 +270,9 @@ client_registry_cb_global_remove(void *data, struct wl_registry *registry,
 {
     ds_inf("%s", __func__);
 
-    MockEffectClient *client = static_cast<MockEffectClient *>(data);
+    MockLaunchEffectClient *client = static_cast<MockLaunchEffectClient *>(data);
     struct wl_compositor *compositor_res = client->GetWlCompositor();
-    struct tizen_launch_effect *effect_res = client->GetTizenEffect();
+    struct tizen_launch_effect *effect_res = client->GetTizenLaunchEffect();
 
     tizen_launch_effect_destroy(effect_res);
     wl_compositor_destroy(compositor_res);
@@ -283,33 +283,33 @@ static const struct wl_registry_listener registry_listener = {
     .global_remove = client_registry_cb_global_remove
 };
 
-class EffectTest : public ::testing::Test
+class LaunchEffectTest : public ::testing::Test
 {
 public:
     void SetUp(void) override;
     void TearDown(void) override;
 
-    MockEffectCompositor *comp;
-    MockEffectClient *client;
+    MockLaunchEffectCompositor *comp;
+    MockLaunchEffectClient *client;
     struct wl_compositor *compositor_res;
     struct tizen_launch_effect *effect_res;
 };
 
 void
-EffectTest::SetUp(void)
+LaunchEffectTest::SetUp(void)
 {
     ds_inf("%s", __func__);
 
-    comp = new MockEffectCompositor();
-    client = new MockEffectClient(&registry_listener);
+    comp = new MockLaunchEffectCompositor();
+    client = new MockLaunchEffectClient(&registry_listener);
     compositor_res = client->GetWlCompositor();
-    effect_res = client->GetTizenEffect();
+    effect_res = client->GetTizenLaunchEffect();
 
     client->RoundTrip();
 }
 
 void
-EffectTest::TearDown(void)
+LaunchEffectTest::TearDown(void)
 {
     ds_inf("%s", __func__);
 
@@ -319,12 +319,12 @@ EffectTest::TearDown(void)
     delete comp;
 }
 
-TEST_F(EffectTest, Create_P)
+TEST_F(LaunchEffectTest, Create_P)
 {
     EXPECT_TRUE(true);
 }
 
-TEST_F(EffectTest, Req_TizenEffectTypeSet)
+TEST_F(LaunchEffectTest, Req_TizenLaunchEffectTypeSet)
 {
     uint pid = 12345;
     const char *effect_type;
@@ -334,10 +334,10 @@ TEST_F(EffectTest, Req_TizenEffectTypeSet)
     client->RoundTrip();
     EXPECT_TRUE(comp->bTypeSet);
     EXPECT_TRUE(comp->mPid == pid);
-    EXPECT_TRUE(comp->mEffectType == DS_TIZEN_EFFECT_TYPE_LAUNCH);
+    EXPECT_TRUE(comp->mEffectType == DS_TIZEN_LAUNCH_EFFECT_TYPE_LAUNCH);
 }
 
-TEST_F(EffectTest, Req_TizenEffectTypeUnSet)
+TEST_F(LaunchEffectTest, Req_TizenLaunchEffectTypeUnSet)
 {
     uint pid = 12345;
     const char *effect_type;
@@ -347,7 +347,7 @@ TEST_F(EffectTest, Req_TizenEffectTypeUnSet)
     client->RoundTrip();
     EXPECT_TRUE(comp->bTypeSet);
     EXPECT_TRUE(comp->mPid == pid);
-    EXPECT_TRUE(comp->mEffectType == DS_TIZEN_EFFECT_TYPE_DEPTH_IN);
+    EXPECT_TRUE(comp->mEffectType == DS_TIZEN_LAUNCH_EFFECT_TYPE_DEPTH_IN);
 
     tizen_launch_effect_type_unset(effect_res, pid);
     client->RoundTrip();
@@ -356,7 +356,7 @@ TEST_F(EffectTest, Req_TizenEffectTypeUnSet)
     EXPECT_TRUE(comp->mEffectType == -1);
 }
 
-TEST_F(EffectTest, Req_TizenEffectCreateSplashImg)
+TEST_F(LaunchEffectTest, Req_TizenLaunchEffectCreateSplashImg)
 {
     struct tizen_launch_splash *splash = NULL;
 
@@ -366,7 +366,7 @@ TEST_F(EffectTest, Req_TizenEffectCreateSplashImg)
     EXPECT_TRUE(comp->bNewSplash);
 }
 
-TEST_F(EffectTest, Req_TizenSplashLaunch_EDC)
+TEST_F(LaunchEffectTest, Req_TizenLaunchSplashLaunch_EDC)
 {
     struct tizen_launch_splash *splash = NULL;
     struct wl_array options;
@@ -383,10 +383,10 @@ TEST_F(EffectTest, Req_TizenSplashLaunch_EDC)
     client->RoundTrip();
     wl_array_release(&options);
     EXPECT_TRUE(comp->mPid == SPLASH_CLIENT_PID);
-    EXPECT_TRUE(comp->mEffectType == DS_TIZEN_EFFECT_TYPE_LAUNCH);
+    EXPECT_TRUE(comp->mEffectType == DS_TIZEN_LAUNCH_EFFECT_TYPE_LAUNCH);
 }
 
-TEST_F(EffectTest, Req_TizenSplashLaunch_IMG)
+TEST_F(LaunchEffectTest, Req_TizenLaunchSplashLaunch_IMG)
 {
     struct tizen_launch_splash *splash = NULL;
     struct wl_array options;
@@ -403,10 +403,10 @@ TEST_F(EffectTest, Req_TizenSplashLaunch_IMG)
     client->RoundTrip();
     wl_array_release(&options);
     EXPECT_TRUE(comp->mPid == SPLASH_CLIENT_PID);
-    EXPECT_TRUE(comp->mEffectType == DS_TIZEN_EFFECT_TYPE_LAUNCH);
+    EXPECT_TRUE(comp->mEffectType == DS_TIZEN_LAUNCH_EFFECT_TYPE_LAUNCH);
 }
 
-TEST_F(EffectTest, Req_TizenSplashSetOwner)
+TEST_F(LaunchEffectTest, Req_TizenLaunchSplashSetOwner)
 {
     struct tizen_launch_splash *splash = NULL;
     struct wl_array options;
@@ -424,15 +424,15 @@ TEST_F(EffectTest, Req_TizenSplashSetOwner)
     client->RoundTrip();
     wl_array_release(&options);
     EXPECT_TRUE(comp->mPid == SPLASH_CLIENT_PID);
-    EXPECT_TRUE(comp->mEffectType == DS_TIZEN_EFFECT_TYPE_DEPTH_IN);
+    EXPECT_TRUE(comp->mEffectType == DS_TIZEN_LAUNCH_EFFECT_TYPE_DEPTH_IN);
 
     tizen_launch_splash_owner(splash, pid);
     client->RoundTrip();
     EXPECT_TRUE(comp->mPid == pid);
-    EXPECT_TRUE(comp->mEffectType == DS_TIZEN_EFFECT_TYPE_DEPTH_IN);
+    EXPECT_TRUE(comp->mEffectType == DS_TIZEN_LAUNCH_EFFECT_TYPE_DEPTH_IN);
 }
 
-TEST_F(EffectTest, Req_TizenSplashLaunch_v2)
+TEST_F(LaunchEffectTest, Req_TizenLaunchSplashLaunch_v2)
 
 {
     struct tizen_launch_splash *splash = NULL;
@@ -472,5 +472,5 @@ TEST_F(EffectTest, Req_TizenSplashLaunch_v2)
     wl_array_release(&options);
     wl_array_release(&extra_config);
     EXPECT_TRUE(comp->mPid == SPLASH_CLIENT_PID);
-    EXPECT_TRUE(comp->mEffectType == DS_TIZEN_EFFECT_TYPE_DEPTH_IN);
+    EXPECT_TRUE(comp->mEffectType == DS_TIZEN_LAUNCH_EFFECT_TYPE_DEPTH_IN);
 }