From 42d67aefe5376273d4461d7ccf4071156c72baec Mon Sep 17 00:00:00 2001
From: =?utf8?q?Pawe=C5=82=20Stawicki?=
Date: Tue, 13 Jun 2017 14:20:52 +0200
Subject: [PATCH] Move ecore_init,ecore_shutdown to main function
Workaround for errors generated by multiple ecore_init calls,
issue doesn't exist from efl 1.18.
Change-Id: I6f6925b5c31bd149c5103c47d030bdb2ddd9b75c
---
packaging/org.tizen.universal-switch.spec | 2 ++
tests/ActivityDispatchingTests.cpp | 12 ++++++++++++
tests/ConfigurationTests.cpp | 11 +++++++++++
tests/ConfigurationTests.hpp | 9 +--------
4 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/packaging/org.tizen.universal-switch.spec b/packaging/org.tizen.universal-switch.spec
index 9ce4891..a0759cf 100644
--- a/packaging/org.tizen.universal-switch.spec
+++ b/packaging/org.tizen.universal-switch.spec
@@ -13,6 +13,8 @@ BuildRequires: pkgconfig(ecore)
BuildRequires: pkgconfig(elementary)
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(libtzplatform-config)
+#Required for tests
+BuildRequires: net-config
%description
An utility library for developers of the menu screen.
diff --git a/tests/ActivityDispatchingTests.cpp b/tests/ActivityDispatchingTests.cpp
index b6db195..f33a2c2 100644
--- a/tests/ActivityDispatchingTests.cpp
+++ b/tests/ActivityDispatchingTests.cpp
@@ -32,3 +32,15 @@ TEST_F(ActivityDispatchingFixture, ActivityAbandoned)
simulateKeyDown(keyMappedToSelectActivity_);
EXPECT_EQ(adHocActivityDispatcher_->updatedWithActivity, 0);
}
+
+
+int main(int argc, char **argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+ EXPECT_TRUE(ecore_init());
+ EXPECT_TRUE(ecore_event_init());
+ int r = RUN_ALL_TESTS();
+ ecore_event_shutdown();
+ ecore_shutdown();
+ return r;
+}
\ No newline at end of file
diff --git a/tests/ConfigurationTests.cpp b/tests/ConfigurationTests.cpp
index c2a64f1..64a2e7a 100644
--- a/tests/ConfigurationTests.cpp
+++ b/tests/ConfigurationTests.cpp
@@ -43,3 +43,14 @@ TEST_F(ConfigurationTestsFixture, MappingAddedAndUpdated_BeUpdatedWithNewValue)
EXPECT_EQ(switchManager->updatedWithSwitch, 1);
EXPECT_EQ(switchManager->receivedItem->getId()->getGlobalId(), switchId_);
}
+
+int main(int argc, char **argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+ EXPECT_TRUE(ecore_init());
+ EXPECT_TRUE(ecore_event_init());
+ int r = RUN_ALL_TESTS();
+ ecore_event_shutdown();
+ ecore_shutdown();
+ return r;
+}
\ No newline at end of file
diff --git a/tests/ConfigurationTests.hpp b/tests/ConfigurationTests.hpp
index bcf6287..cc6f87f 100644
--- a/tests/ConfigurationTests.hpp
+++ b/tests/ConfigurationTests.hpp
@@ -23,8 +23,6 @@ class ConfigurationTestsFixture : public ::testing::Test
public:
void SetUp()
{
- EXPECT_TRUE(ecore_init());
- EXPECT_TRUE(ecore_event_init());
configuration_ = std::make_shared(true);
switchProvider_ = std::make_shared();
activityFactory_ = ActivityFactory::getInstance();
@@ -32,18 +30,13 @@ public:
item_ = std::make_shared(switch_->getId()->getGlobalId(), activityType_);
}
- void TearDown()
- {
- ecore_event_shutdown();
- ecore_shutdown();
- }
-
void simulateKeyDown(const std::string &key)
{
Ecore_Event_Key *event = (Ecore_Event_Key *)malloc(sizeof(Ecore_Event_Key));
event->key = key.c_str();
EXPECT_TRUE(ecore_event_add(ECORE_EVENT_KEY_DOWN, event, NULL, NULL));
ecore_main_loop_iterate();
+ free(event);
}
protected:
--
2.7.4