summaryrefslogtreecommitdiff
path: root/LayerManagerClient
diff options
context:
space:
mode:
authorFrédéric Blain <frederic.blain@valeo.com>2012-07-10 12:51:28 +0200
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>2012-07-20 00:07:16 -0700
commite427ee93fe81639ff849e4526c6e16c4b637fb04 (patch)
tree2c0d156c28f7f29940227064e8b6bfa2723ba397 /LayerManagerClient
parentd6f97f87d6296ebf7b099b2073721f6ab8d488f6 (diff)
downloadlayer_management-e427ee93fe81639ff849e4526c6e16c4b637fb04.tar.gz
Unit tests for new IPC
This patch adds unit tests for the new IPC introduced by the Input Event framework. DBUSCommunicatorTest & IlmCommandTest have been completed.
Diffstat (limited to 'LayerManagerClient')
-rw-r--r--LayerManagerClient/ilmClient/src/generic_ilm_client.c10
-rw-r--r--LayerManagerClient/ilmClient/tests/IlmCommandTest.cpp46
2 files changed, 52 insertions, 4 deletions
diff --git a/LayerManagerClient/ilmClient/src/generic_ilm_client.c b/LayerManagerClient/ilmClient/src/generic_ilm_client.c
index ab819b3..6c0b42c 100644
--- a/LayerManagerClient/ilmClient/src/generic_ilm_client.c
+++ b/LayerManagerClient/ilmClient/src/generic_ilm_client.c
@@ -1481,7 +1481,7 @@ ilmErrorTypes ilm_SetKeyboardFocusOn(t_ilm_surface surfaceId)
{
LOG_ENTER_FUNCTION;
ilmErrorTypes returnValue = ILM_FAILED;
-
+
if (gIpcModule.createMessage("SetKeyboardFocusOn\0")
&& gIpcModule.appendUint(surfaceId)
&& gIpcModule.sendMessage()
@@ -1490,7 +1490,7 @@ ilmErrorTypes ilm_SetKeyboardFocusOn(t_ilm_surface surfaceId)
{
returnValue = ILM_SUCCESS;
}
-
+
return returnValue;
}
@@ -1499,7 +1499,7 @@ ilmErrorTypes ilm_GetKeyboardFocusSurfaceId(t_ilm_surface* pSurfaceId)
{
LOG_ENTER_FUNCTION;
ilmErrorTypes returnValue = ILM_FAILED;
-
+
if (gIpcModule.createMessage("GetKeyboardFocusSurfaceId\0")
&& gIpcModule.sendMessage()
&& gIpcModule.receiveMessage(gReceiveTimeout)
@@ -1518,7 +1518,7 @@ ilmErrorTypes ilm_UpdateInputEventAcceptanceOn(t_ilm_surface surfaceId, ilmInput
{
LOG_ENTER_FUNCTION;
ilmErrorTypes returnValue = ILM_FAILED;
-
+
if (gIpcModule.createMessage("UpdateInputEventAcceptanceOn\0")
&& gIpcModule.appendUint(surfaceId)
&& gIpcModule.appendUint(devices)
@@ -1529,6 +1529,8 @@ ilmErrorTypes ilm_UpdateInputEventAcceptanceOn(t_ilm_surface surfaceId, ilmInput
{
returnValue = ILM_SUCCESS;
}
+
+ return returnValue;
}
diff --git a/LayerManagerClient/ilmClient/tests/IlmCommandTest.cpp b/LayerManagerClient/ilmClient/tests/IlmCommandTest.cpp
index 1488fdd..df86dbf 100644
--- a/LayerManagerClient/ilmClient/tests/IlmCommandTest.cpp
+++ b/LayerManagerClient/ilmClient/tests/IlmCommandTest.cpp
@@ -890,3 +890,49 @@ TEST_F(IlmCommandTest, ilm_layergroupCreate_ilm_layergroupRemove_ilm_layergroupA
ASSERT_EQ(length,0);
}
+
+TEST_F(IlmCommandTest, ilm_keyboard_focus)
+{
+ uint surface;
+ uint surface1 = 36;
+ uint surface2 = 44;
+
+ ilm_surfaceCreate(0,0,0,ILM_PIXELFORMAT_RGBA_8888,&surface1);
+ ilm_surfaceCreate(0,0,0,ILM_PIXELFORMAT_RGBA_8888,&surface2);
+
+ ilm_GetKeyboardFocusSurfaceId(&surface);
+ EXPECT_EQ(0xFFFFFFFF, surface);
+
+ ilm_SetKeyboardFocusOn(surface1);
+ ilm_GetKeyboardFocusSurfaceId(&surface);
+ EXPECT_EQ(surface1, surface);
+}
+
+
+TEST_F(IlmCommandTest, ilm_input_event_acceptance)
+{
+ uint surface;
+ uint surface1 = 36;
+ uint surface2 = 44;
+ ilmSurfaceProperties surfaceProperties;
+
+ ilm_surfaceCreate(0,0,0,ILM_PIXELFORMAT_RGBA_8888,&surface1);
+ ilm_surfaceCreate(0,0,0,ILM_PIXELFORMAT_RGBA_8888,&surface2);
+
+ ilm_getPropertiesOfSurface(surface1, &surfaceProperties);
+ EXPECT_EQ(ILM_INPUT_DEVICE_ALL, surfaceProperties.inputDevicesAcceptance);
+
+ ilm_UpdateInputEventAcceptanceOn(surface1, (ilmInputDevice) (ILM_INPUT_DEVICE_KEYBOARD | ILM_INPUT_DEVICE_POINTER), false);
+ ilm_commitChanges();
+
+
+ ilm_getPropertiesOfSurface(surface1, &surfaceProperties);
+ EXPECT_FALSE(surfaceProperties.inputDevicesAcceptance & ILM_INPUT_DEVICE_KEYBOARD);
+ EXPECT_FALSE(surfaceProperties.inputDevicesAcceptance & ILM_INPUT_DEVICE_POINTER);
+ EXPECT_TRUE(surfaceProperties.inputDevicesAcceptance & ILM_INPUT_DEVICE_TOUCH);
+
+ ilm_SetKeyboardFocusOn(surface1);
+ ilm_GetKeyboardFocusSurfaceId(&surface);
+ EXPECT_NE(surface1, surface);
+}
+