Merge branch 'devel/master' into tizen
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-BaseHandle.cpp
index 5b3d622..5b2061b 100644 (file)
@@ -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.
@@ -98,15 +98,6 @@ struct TestCallback
 class FakeObject : public BaseObject
 {
 };
-// used for testing ThisIsSaferThanReturningVoidStar
-class FakeHandle : public BaseHandle
-{
-public:
-  void RunTest()
-  {
-    return ThisIsSaferThanReturningVoidStar();
-  }
-};
 } // namespace
 
 int UtcDaliBaseHandleConstructorVoid(void)
@@ -317,6 +308,30 @@ int UtcDaliBaseHandleInequalityOperator02(void)
   END_TEST;
 }
 
+int UtcDaliBaseHandleInequalityWithNullptr(void)
+{
+  TestApplication application;
+  tet_infoline("Test for Dali::BaseHandle::operator == nullptr");
+
+  BaseHandle object;
+
+  // object is nullptr.
+  DALI_TEST_CHECK(object == nullptr);
+  DALI_TEST_CHECK(nullptr == object);
+  DALI_TEST_CHECK(!(object != nullptr));
+  DALI_TEST_CHECK(!(nullptr != object));
+
+  object = Actor::New();
+
+  // object is not nullptr.
+  DALI_TEST_CHECK(!(object == nullptr));
+  DALI_TEST_CHECK(!(nullptr == object));
+  DALI_TEST_CHECK(object != nullptr);
+  DALI_TEST_CHECK(nullptr != object);
+
+  END_TEST;
+}
+
 int UtcDaliBaseHandleStlVector(void)
 {
   TestApplication application;
@@ -543,16 +558,6 @@ int UtcDaliBaseHandleGetTypeInfoP(void)
   END_TEST;
 }
 
-int UtcDaliBaseHandleThisIsSaferThanReturningVoidStar(void)
-{
-  TestApplication application;
-  tet_infoline("Testing Dali::BaseHandle::GetTypeInfo");
-  FakeHandle handle;
-  handle.RunTest();
-  tet_result(TET_PASS);
-  END_TEST;
-}
-
 int UtcDaliBaseHandleGetTypeInfoN(void)
 {
   TestApplication application;
@@ -583,12 +588,12 @@ int UtcDaliBaseHandleGetObjectPtr(void)
 int UtcDaliBaseHandleBooleanCast(void)
 {
   TestApplication application;
-  tet_infoline("Testing Dali::BaseHandle::BooleanType");
+  tet_infoline("Testing Dali::BaseHandle::operator bool");
 
   // get the root layer
   BaseHandle handle = Actor::New();
 
-  DALI_TEST_CHECK(static_cast<BaseHandle::BooleanType>(handle));
+  DALI_TEST_CHECK(static_cast<bool>(handle));
   END_TEST;
 }