mmi-ref-fusion-tests : add ref fusion testcase in tests/ref-fusion directory 96/264296/1
authordyamy-lee <dyamy.lee@samsung.com>
Wed, 15 Sep 2021 07:29:06 +0000 (16:29 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Wed, 15 Sep 2021 12:06:08 +0000 (21:06 +0900)
Change-Id: Ie31ed27598b8e64b74b5427c9e26de4a746e9cdd

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

diff --git a/tests/ref-fusion/main.cpp b/tests/ref-fusion/main.cpp
new file mode 100644 (file)
index 0000000..960d73c
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+* 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 "main.h"
+
+int main(int argc, char **argv)
+{
+       auto testResults = false;
+
+       try
+       {
+               ::testing::InitGoogleMock(&argc, argv);
+               ::testing::FLAGS_gtest_death_test_style = "fast";
+       }
+       catch ( ... )
+       {
+               PRINT("Error occurred while trying to initialize GoogleTest.\n");
+               exit(EXIT_FAILURE);
+       }
+
+       try
+       {
+               testResults = (RUN_ALL_TESTS() == 0) ? true : false;
+       }
+       catch (const ::testing::internal::GoogleTestFailureException &e)
+       {
+               testResults = false;
+               PRINT("GoogleTestFailureException has been thrown: %s\n", e.what());
+       }
+
+       return testResults;
+}
+
diff --git a/tests/ref-fusion/main.h b/tests/ref-fusion/main.h
new file mode 100644 (file)
index 0000000..e75fbbe
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+* 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.
+*/
+
+#ifndef __MMI_REF_FUSION_TESTS_H__
+#define __MMI_REF_FUSION_TESTS_H__
+
+#include <stdio.h>
+#include <gmock/gmock.h>
+#include <Ecore.h>
+
+#define PRINT printf
+
+using ::testing::TestWithParam;
+using ::testing::Bool;
+using ::testing::Values;
+using ::testing::Combine;
+
+#endif //__MMI_REF_FUSION_TESTS_H__
diff --git a/tests/ref-fusion/mmi-ref-fusion-tests.cpp b/tests/ref-fusion/mmi-ref-fusion-tests.cpp
new file mode 100644 (file)
index 0000000..6a8c131
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+* 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 "main.h"
+
+extern "C" {
+#include "mmi-ref-fusion.h"
+}
+
+#include <Ecore.h>
+#include <string.h>
+#include <gtest/gtest.h>
+
+class MMIRefFusionTest : public ::testing::Test
+{
+public:
+       void SetUp(void) override
+       {
+               ecore_init();
+       }
+
+       void TearDown(void) override
+       {
+               ecore_shutdown();
+       }
+};
+
+TEST_F(MMIRefFusionTest, MMIRefFusionSetGetMode)
+{
+       mmi_state state = MMI_STATE_NONE;
+
+       state = ref_fusion_set_state(MMI_STATE_INITIATION);
+       EXPECT_EQ(state, MMI_STATE_INITIATION);
+
+       state = MMI_STATE_NONE;
+       state = ref_fusion_get_state();
+       EXPECT_EQ(state, MMI_STATE_INITIATION);
+
+       state = ref_fusion_set_state(MMI_STATE_EXPLORATION);
+       EXPECT_EQ(state, MMI_STATE_EXPLORATION);
+
+       state = ref_fusion_set_state(MMI_STATE_EXPLORATION);
+       EXPECT_EQ(state, MMI_STATE_EXPLORATION);
+}