+int UtcDaliHandleGetPropertyIndex02(void)
+{
+ tet_infoline("Positive Test Dali::Handle::GetPropertyIndex() int key");
+ TestApplication application;
+
+ Stage stage = Stage::GetCurrent();
+
+ Actor actor = Actor::New();
+ stage.Add( actor );
+
+ const unsigned int defaultPropertyCount = actor.GetPropertyCount();
+
+ application.SendNotification();
+ application.Render();
+
+ Property::Index key1 = CORE_PROPERTY_MAX_INDEX+1;
+ Property::Index key2 = CORE_PROPERTY_MAX_INDEX+2;
+
+ const Vector4 testColor(0.5f, 0.2f, 0.9f, 1.0f);
+ const float withFlake(99.f);
+
+ Property::Index index1 = actor.RegisterProperty( "MyPropertyOne", Vector3::ONE );
+ Property::Index index2 = DevelHandle::RegisterProperty( actor, key1, "sideColor", testColor);
+ Property::Index index3 = actor.RegisterProperty( "MyPropertyTwo", Vector3::ONE );
+ Property::Index index4 = DevelHandle::RegisterProperty( actor, key2, "iceCream", withFlake );
+ Property::Index index5 = actor.RegisterProperty( "MyPropertyThree", Vector3::ONE );
+
+ application.SendNotification();
+ application.Render();
+
+ // Test that we can get the property index from the integer key
+ Property::Index testIndex1 = DevelHandle::GetPropertyIndex( actor, key1 );
+ Property::Index testIndex2 = DevelHandle::GetPropertyIndex( actor, key2 );
+
+ DALI_TEST_EQUALS( index2, testIndex1, TEST_LOCATION );
+ DALI_TEST_EQUALS( index4, testIndex2, TEST_LOCATION );
+
+ // Test that we keep the same indices on the named properties
+ Property::Index testIndex = actor.GetPropertyIndex("MyPropertyOne");
+ DALI_TEST_EQUALS(testIndex, index1, TEST_LOCATION);
+ testIndex = actor.GetPropertyIndex("MyPropertyTwo");
+ DALI_TEST_EQUALS(testIndex, index3, TEST_LOCATION);
+ testIndex = actor.GetPropertyIndex("MyPropertyThree");
+ DALI_TEST_EQUALS(testIndex, index5, TEST_LOCATION);
+ testIndex = actor.GetPropertyIndex("sideColor");
+ DALI_TEST_EQUALS(testIndex, index2, TEST_LOCATION);
+ testIndex = actor.GetPropertyIndex("iceCream");
+ DALI_TEST_EQUALS(testIndex, index4, TEST_LOCATION);
+
+ DALI_TEST_EQUALS(defaultPropertyCount+5, actor.GetPropertyCount(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliHandleGetPropertyIndex03(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ std::string myName("croydon");
+ Property::Index intKey = CORE_PROPERTY_MAX_INDEX+1;
+ Property::Value value( Color::GREEN );
+ Property::Index myIndex = DevelHandle::RegisterProperty( actor, intKey, myName, value );
+
+ DALI_TEST_EQUALS( myIndex, DevelHandle::GetPropertyIndex( actor, intKey ), TEST_LOCATION );
+
+ Property::Key key1(myName);
+ Property::Key key2(intKey);
+
+ DALI_TEST_EQUALS( myIndex, DevelHandle::GetPropertyIndex( actor, key1 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( myIndex, DevelHandle::GetPropertyIndex( actor, key2 ), TEST_LOCATION );
+ END_TEST;
+}
+
+