int UtcDaliBaseHandleGetBaseObject(void) { TestApplication application; tet_infoline("Testing Dali::BaseHandle::GetBaseObject()"); BaseHandle object = Actor::New(); BaseObject& handle = object.GetBaseObject(); DALI_TEST_EQUALS(1, handle.ReferenceCount(), TEST_LOCATION); END_TEST; }
int UtcDaliBaseHandleAssignmentOperator(void) { TestApplication application; tet_infoline("Testing Dali::BaseHandle::operator="); BaseHandle object = Actor::New(); DALI_TEST_CHECK(object); if (object) { DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION); } BaseHandle copy = object; DALI_TEST_CHECK(copy); if (copy) { DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION); } END_TEST; }
int UtcDaliBaseHandleCopyConstructor(void) { TestApplication application; tet_infoline("Testing Dali::BaseHandle::BaseHandle(const BaseHandle&)"); // Initialize an object, ref count == 1 BaseHandle object = Actor::New(); DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION); // Copy the object, ref count == 2 BaseHandle copy(object); DALI_TEST_CHECK(copy); if (copy) { DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION); } { // Pass by value, and return another copy, ref count == 3 BaseHandle anotherCopy = ImplicitCopyConstructor(copy); DALI_TEST_CHECK(anotherCopy); if (anotherCopy) { DALI_TEST_EQUALS(3, anotherCopy.GetBaseObject().ReferenceCount(), TEST_LOCATION); } } // anotherCopy out of scope, ref count == 2 DALI_TEST_CHECK(copy); if (copy) { DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION); } END_TEST; }
int UtcDaliBaseHandleReset(void) { TestApplication application; tet_infoline("Testing Dali::BaseHandle::Reset()"); // Initialize an object, ref count == 1 BaseHandle object = Actor::New(); DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION); object.Reset(); DALI_TEST_CHECK(!object); END_TEST; }