Remove element of Property::Map by the specified key.
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-PropertyMap.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 84d58c2..61edaee
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -582,6 +582,28 @@ int UtcDaliPropertyMapAnonymousAddChainP(void)
   END_TEST;
 }
 
+int UtcDaliPropertyMapRemove(void)
+{
+  Property::Map map;
+  map["hello"] = 1;
+  map[10]      = "DALi";
+  map["world"] = 2;
+
+  DALI_TEST_CHECK(map.Count() == 3);
+  DALI_TEST_CHECK(!map.Remove(0));
+  DALI_TEST_CHECK(map.Count() == 3);
+  DALI_TEST_CHECK(!map.Remove("doesnotexist"));
+  DALI_TEST_CHECK(map.Count() == 3);
+  DALI_TEST_CHECK(map.Remove(10));
+  DALI_TEST_CHECK(map.Count() == 2);
+  DALI_TEST_CHECK(map.Remove("hello"));
+  DALI_TEST_CHECK(map.Count() == 1);
+  DALI_TEST_CHECK(map.Remove("world"));
+  DALI_TEST_CHECK(map.Count() == 0);
+
+  END_TEST;
+}
+
 int UtcDaliPropertyMapMerge(void)
 {
   Property::Map map;