summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Fritzsch <marcus.fritzsch@xse.de>2014-07-03 15:12:39 +0200
committerNobuhiko Tanibata <NOBUHIKO_TANIBATA@denso.co.jp>2014-08-12 22:15:09 +0900
commitd9bc7904343994cb3ea978f0cf87a13a154b712b (patch)
tree534767da2a141412beb9723f3393bf7ef9cdb0c0
parent8536a991812ea49cac0cf97c4b0cfdc8c9609917 (diff)
downloadwayland-ivi-extension-d9bc7904343994cb3ea978f0cf87a13a154b712b.tar.gz
ilmControlTests: do not rely on order of IDs
Signed-off-by: Marcus Fritzsch <marcus.fritzsch@xse.de>
-rw-r--r--ivi-layermanagement-api/test/ilm_control_test.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/ivi-layermanagement-api/test/ilm_control_test.cpp b/ivi-layermanagement-api/test/ilm_control_test.cpp
index 40235ce..d06fa23 100644
--- a/ivi-layermanagement-api/test/ilm_control_test.cpp
+++ b/ivi-layermanagement-api/test/ilm_control_test.cpp
@@ -27,6 +27,15 @@ extern "C" {
#include "ilm_control.h"
}
+template <typename T>
+bool contains(T const *actual, size_t as, T expected)
+{
+ for (unsigned i = 0; i < as; i++)
+ if (actual[i] == expected)
+ return true;
+ return false;
+}
+
class IlmCommandTest : public TestBase, public ::testing::Test {
public:
void SetUp()
@@ -470,8 +479,8 @@ TEST_F(IlmCommandTest, ilm_getSurfaceIDs) {
ASSERT_EQ(ILM_SUCCESS, ilm_getSurfaceIDs(&length, &IDs));
ASSERT_EQ(old_length+2, length);
- ASSERT_EQ(surface1, IDs[old_length]);
- ASSERT_EQ(surface2, IDs[old_length+1]);
+ EXPECT_TRUE(contains(IDs+old_length, 2, surface1));
+ EXPECT_TRUE(contains(IDs+old_length, 2, surface2));
free(IDs);
// cleanup
@@ -491,8 +500,8 @@ TEST_F(IlmCommandTest, ilm_surfaceCreate_Remove) {
ASSERT_EQ(ILM_SUCCESS, ilm_getSurfaceIDs(&length, &IDs));
ASSERT_EQ(length, 2);
- ASSERT_EQ(surface1, IDs[0]);
- ASSERT_EQ(surface2, IDs[1]);
+ EXPECT_TRUE(contains(IDs, 2, surface1));
+ EXPECT_TRUE(contains(IDs, 2, surface2));
ASSERT_EQ(ILM_SUCCESS, ilm_surfaceRemove(surface1));
ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
@@ -674,8 +683,8 @@ TEST_F(IlmCommandTest, ilm_layerAddSurface_ilm_layerRemoveSurface_ilm_getSurface
ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
ASSERT_EQ(ILM_SUCCESS, ilm_getSurfaceIDsOnLayer(layer, &length, &IDs));
ASSERT_EQ(length, 2);
- ASSERT_EQ(surface1, IDs[0]);
- ASSERT_EQ(surface2, IDs[1]);
+ EXPECT_EQ(surface1, IDs[0]);
+ EXPECT_EQ(surface2, IDs[1]);
free(IDs);
ASSERT_EQ(ILM_SUCCESS, ilm_layerRemoveSurface(layer, surface1));