mmi-fusion-tests : create mmi-fusion-tests for mmi-fusion api 91/264291/1
authordyamy-lee <dyamy.lee@samsung.com>
Tue, 14 Sep 2021 11:14:30 +0000 (20:14 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Wed, 15 Sep 2021 12:06:00 +0000 (21:06 +0900)
Change-Id: Idb88cc9c072171f9143f30e792fa06adfac9ae45

tests/mmi-fusion-tests.cpp [new file with mode: 0644]

diff --git a/tests/mmi-fusion-tests.cpp b/tests/mmi-fusion-tests.cpp
new file mode 100644 (file)
index 0000000..1a801c0
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+* Copyright © 2021 Samsung Electronics co., Ltd. All Rights Reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice (including the next
+* paragraph) shall be included in all copies or substantial portions of the
+* Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+* DEALINGS IN THE SOFTWARE.
+*/
+#include "mmi-manager-tests.h"
+extern "C" {
+#include "mmi-fusion.h"
+}
+
+#include <Ecore.h>
+#include <dirent.h>
+#include <dlfcn.h>
+
+class MMIFusionTest : public ::testing::Test
+{
+public:
+       void SetUp(void) override
+       {
+               ecore_init();
+       }
+
+       void TearDown(void) override
+       {
+               ecore_shutdown();
+       }
+};
+
+TEST_F(MMIFusionTest, MMIFusionInitShutdown)
+{
+       int res = 0;
+       modality_fusions_init();
+       res = 1;
+
+       EXPECT_EQ(res, 1);
+
+       modality_fusions_shutdown();
+}
+
+TEST_F(MMIFusionTest, MMIFusionGetClientFusion)
+{
+       mmi_fusion_handle *fusion = NULL;
+       mmi_client *client = NULL;
+
+       modality_fusions_init();
+
+       fusion = modality_fusions_get_client_fusion(client);
+       EXPECT_NE(fusion, nullptr);
+
+       modality_fusions_shutdown();
+}
+
+TEST_F(MMIFusionTest, MMIFusionSetGetState)
+{
+       mmi_state state = MMI_STATE_NONE;
+       mmi_fusion_handle *fusion = NULL;
+       mmi_client *client = NULL;
+
+       modality_fusions_init();
+
+       fusion = modality_fusions_get_client_fusion(client);
+       EXPECT_NE(fusion, nullptr);
+
+       state = modality_fusion_get_state(NULL);
+       EXPECT_EQ(state, MMI_STATE_NONE);
+
+       //set_state Fail Case
+       state = MMI_STATE_NONE;
+       state = modality_fusion_set_state(NULL, MMI_STATE_INITIATION);
+       EXPECT_EQ(state, MMI_STATE_NONE);
+
+       //set_state Success Case
+       state = MMI_STATE_NONE;
+       state = modality_fusion_set_state(fusion, MMI_STATE_INITIATION);
+       EXPECT_EQ(state, MMI_STATE_INITIATION);
+
+       //get_state Fail Case
+       state = modality_fusion_get_state(NULL);
+       EXPECT_EQ(state, MMI_STATE_NONE);
+
+       //get_state Success Case
+       state = modality_fusion_get_state(fusion);
+       EXPECT_EQ(state, MMI_STATE_INITIATION);
+
+       modality_fusions_shutdown();
+}