*/
#include "mmi-client.h"
+#include "mmi-manager.h"
#include "mmi-manager-tests.h"
#include "interface/mmifw_stub.h"
-#include <Ecore.h>
-
class MMIClientTest : public ::testing::Test
{
public:
EXPECT_EQ(state, MMI_STATE_INITIATION);
res = client_manager_remove_client(app_id);
+ EXPECT_EQ(res, 0);
client_manager_shutdown();
}
EXPECT_EQ(has_focus, true);
res = client_manager_remove_client(app_id);
+ EXPECT_EQ(res, 0);
client_manager_shutdown();
}
EXPECT_NE(sender, nullptr);
res = client_manager_remove_client(app_id);
+ EXPECT_EQ(res, 0);
client_manager_shutdown();
}
TEST_F(MMIClientTest, MMIClientSetGetClientEventCB)
{
const char *app_id = "org.tizen.mmi-system-ux-test";
- void *handle = nullptr, *temp_h = nullptr;
+ void *handle = nullptr;
mmi_client *mc = nullptr;
int res = 0;
EXPECT_EQ(handle, nullptr);
res = client_manager_remove_client(app_id);
+ EXPECT_EQ(res, 0);
client_manager_shutdown();
}
TEST_F(MMIClientTest, MMIClientSendClientEvent)
{
const char *app_id = "org.tizen.mmi-system-ux-test";
- void *handle = nullptr;
mmi_client *mc = nullptr;
int res = 0;
focus_event_arg arg;
- client_manager_init();
+ mmi_manager_init();
+
mc = client_manager_add_client(app_id);
/* TODO: set focus_cb handle using client_manager_set_client_key_cb_handle()
arg.timestamp = ecore_time_get();
arg.focus_in = false;
+ PRINT("\n\nTC: client_manager_send_focus_event(FOCUS_IN)\n\n");
res = client_manager_send_focus_event(mc, &arg);
client_manager_set_client_has_focus(mc, false);
EXPECT_EQ(res, 0);
arg.timestamp = ecore_time_get();
arg.focus_in = true;
+ PRINT("\n\nTC: client_manager_send_focus_event(FOCUS_OUT)\n\n");
res = client_manager_send_focus_event(mc, &arg);
client_manager_set_client_has_focus(mc, true);
EXPECT_EQ(res, 0);
*/
res = client_manager_remove_client(app_id);
- client_manager_shutdown();
+ mmi_manager_shutdown();
}
--- /dev/null
+/*
+* 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.h"
+#include "mmi-manager-tests.h"
+
+namespace {
+
+class MMIMANAGERMainTest : public ::testing::Test
+{
+public:
+ void SetUp(void) override
+ {
+ }
+
+ void TearDown(void) override
+ {
+ }
+};
+
+
+TEST_F(MMIMANAGERMainTest, MMIMANAGERMainInit)
+{
+ int res = 0;
+
+ mmi_manager_init();
+
+ res = 1;
+ EXPECT_EQ(res, 1);
+
+ mmi_manager_shutdown();
+}
+
+TEST_F(MMIMANAGERMainTest, MMIMANAGERMainSetGetFocusClient)
+{
+ const char *app_id = "org.tizen.mmi-system-ux-test";
+ mmi_client *mc = NULL, *mc_temp = NULL;
+ int res = 0;
+
+ mmi_manager_init();
+ mc = client_manager_add_client(app_id);
+
+ res = mmi_manager_set_focus_client(mc);
+ EXPECT_EQ(res, 0);
+
+ wait_for_dispatch();
+
+ mc_temp = mmi_manager_get_focus_client();
+ EXPECT_EQ(mc, mc_temp);
+
+ res = client_manager_remove_client(app_id);
+ mmi_manager_shutdown();
+}
+
+TEST_F(MMIMANAGERMainTest, MMIMANAGERMainSetState)
+{
+ const char *app_id = "org.tizen.mmi-system-ux-test";
+ mmi_client *mc = NULL;
+ int res = 0;
+
+ mmi_manager_init();
+ mc = client_manager_add_client(app_id);
+
+ res = mmi_manager_set_state(mc, MMI_STATE_INITIATION);
+ EXPECT_EQ(res, 0);
+
+ wait_for_dispatch();
+
+ mmi_state state = client_manager_get_client_state(mc);
+ EXPECT_EQ(state, MMI_STATE_INITIATION);
+
+ res = client_manager_remove_client(app_id);
+ mmi_manager_shutdown();
+}
+
+TEST_F(MMIMANAGERMainTest, MMIMANAGERMainRemoveClientFromFocusCandidate)
+{
+ const char *app_id = "org.tizen.mmi-system-ux-test";
+ const char *app_id_new = "org.tizen.mmi-system-ux-test-new";
+ int res = 0;
+ mmi_client *mc = NULL, *mc_new = NULL, *mc_temp = NULL;
+
+ mmi_manager_init();
+ mc = client_manager_add_client(app_id);
+ res = mmi_manager_set_focus_client(mc);
+ EXPECT_EQ(res, 0);
+
+ wait_for_dispatch();
+
+ mc_temp = mmi_manager_get_focus_client();
+ EXPECT_EQ(mc, mc_temp);
+
+ mc_new = client_manager_add_client(app_id_new);
+ res = mmi_manager_set_focus_client(mc_new);
+ EXPECT_EQ(res, 0);
+
+ wait_for_dispatch();
+
+ mc_temp = mmi_manager_get_focus_client();
+ EXPECT_EQ(mc_new, mc_temp);
+
+ res = mmi_manager_remove_client_from_focus_candidates(mc);
+ EXPECT_EQ(res, 0);
+
+ res = client_manager_remove_client(app_id);
+ res = client_manager_remove_client(app_id_new);
+ mmi_manager_shutdown();
+}
+
+TEST_F(MMIMANAGERMainTest, MMIMANAGERMainRemoveFocusClient)
+{
+ int res = 0;
+ mmi_client *mc = NULL, *mc_new = NULL, *mc_temp = NULL;
+ const char *app_id = "org.tizen.mmi-system-ux-test3";
+ const char *app_id_new = "org.tizen.mmi-system-ux-test_new4";
+
+ mmi_manager_init();
+ mc = client_manager_add_client(app_id);
+ res = mmi_manager_set_focus_client(mc);
+ EXPECT_EQ(res, 0);
+
+ wait_for_dispatch();
+
+ mc_temp = mmi_manager_get_focus_client();
+ EXPECT_EQ(mc, mc_temp);
+
+ mc_new = client_manager_add_client(app_id_new);
+ res = mmi_manager_set_focus_client(mc_new);
+ EXPECT_EQ(res, 0);
+
+ wait_for_dispatch();
+
+ mc_temp = mmi_manager_get_focus_client();
+ EXPECT_EQ(mc_new, mc_temp);
+
+ res = mmi_manager_remove_focus_client(mc_new);
+ EXPECT_EQ(res, 0);
+
+ wait_for_dispatch();
+
+ mc_temp = mmi_manager_get_focus_client();
+ EXPECT_EQ(mc, mc_temp);
+
+ res = client_manager_remove_client(app_id);
+ res = client_manager_remove_client(app_id_new);
+ mmi_manager_shutdown();
+}
+
+} // namespace