/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
#include <stdlib.h>
#include <limits>
#include <dali/public-api/dali-core.h>
-#include <dali/devel-api/object/handle-devel.h>
#include <dali-test-suite-utils.h>
#include <dali/internal/event/common/type-info-impl.h>
#include <dali/integration-api/events/long-press-gesture-event.h>
}
catch ( DaliException& e )
{
- DALI_TEST_ASSERT( e, "Duplicate type name for Type Registation", TEST_LOCATION );
+ DALI_TEST_ASSERT( e, "Duplicate type name in Type Registration", TEST_LOCATION );
}
END_TEST;
(void)customActor.GetProperty< bool >( propertyIndex );
DALI_TEST_CHECK( getPropertyCalled );
- // Get the property using DevelHandle::GetCurrentProperty and ensure GetProperty is called
+ // Get the property using GetCurrentProperty and ensure GetProperty is called
getPropertyCalled = false;
DALI_TEST_CHECK( !getPropertyCalled );
- (void)DevelHandle::GetCurrentProperty< bool >( customActor, propertyIndex );
+ customActor.GetCurrentProperty< bool >( propertyIndex );
DALI_TEST_CHECK( getPropertyCalled );
// Check the property name
Animation animation = Animation::New(0.2f);
animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 15.f, AlphaFunction::LINEAR );
animation.Play();
+
+ // Target value should change straight away
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 15.0f, TEST_LOCATION );
+
// Render and notify, animation play for 0.05 seconds
application.SendNotification();
application.Render(50);
DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyIndex ), 22.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 22.5f, TEST_LOCATION );
+
// Render and notify, animation play for another 0.1 seconds
application.SendNotification();
application.Render(100);
DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyIndex ), 17.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION );
END_TEST;
}
Animation animation = Animation::New(0.2f);
animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 20.f, AlphaFunction::LINEAR );
animation.Play();
+
+ // Target value should change straight away
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 20.0f, TEST_LOCATION );
+
// Render and notify, animation play for 0.05 seconds
application.SendNotification();
application.Render(50);
DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyIndex ), 12.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 12.5f, TEST_LOCATION );
+
// Render and notify, animation play for another 0.1 seconds
application.SendNotification();
application.Render(100);
DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyIndex ), 17.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION );
END_TEST;
}
DALI_TEST_EQUALS( customPropertyCount + 3u, customActor.GetPropertyCount(), TEST_LOCATION );
// Check the animatable property component value
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyComponentIndex1 ), 25.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex1 ), 25.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
// Set the animatable property component value
customActor.SetProperty( animatablePropertyComponentIndex1, 150.0f );
application.Render();
// Check the animatable property value
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( customActor, animatablePropertyIndex ), Vector2(150.0f, 50.0f), TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 50.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
// Set the animatable property component value
customActor.SetProperty( animatablePropertyComponentIndex2, 225.0f );
application.Render();
// Check the animatable property value
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( customActor, animatablePropertyIndex ), Vector2(150.0f, 225.0f), TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyComponentIndex2 ), 225.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 225.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex2 ), 225.0f, TEST_LOCATION );
// Ensure indices returned from actor and customActor differ by three
Actor actor = Actor::New();
unsigned int customActorIndices = indices.Size();
DALI_TEST_EQUALS( actorIndices + 3u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
+ // Attempt to animate component property, it should not crash
+ Animation animation = Animation::New( 1.0f );
+ animation.AnimateTo( Property( customActor, animatablePropertyComponentIndex1 ), 200.0f );
+ animation.Play();
+
+ // Check the property value
+ DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(200.0f, 225.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex1 ), 200.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex2 ), 225.0f, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector2AnimateByP(void)
+{
+ TestApplication application;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
+ DALI_TEST_CHECK( typeInfo );
+ BaseHandle handle = typeInfo.CreateInstance();
+ DALI_TEST_CHECK( handle );
+ Actor customActor = Actor::DownCast( handle );
+ DALI_TEST_CHECK( customActor );
+
+ const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
+ const unsigned int xComponentIndex = index + 1;
+ const unsigned int yComponentIndex = index + 2;
+ const Vector2 initialValue( 20.0f, 40.0f );
+
+ // Register animatable property & its components
+ AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 );
+
+ // Check the animatable property value
+ DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( index ), initialValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check the animatable property current value
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( index ), initialValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
+
+ // Do an AnimateBy
+ const Vector2 targetValue( 45.0f, 53.0f );
+ const Vector2 relativeValue( targetValue - initialValue );
+
+ Animation animation = Animation::New( 1.0f );
+ animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x );
+ animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y );
+ animation.Play();
+
+ // Target values should change straight away
+ DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector3AnimateByP(void)
+{
+ TestApplication application;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
+ DALI_TEST_CHECK( typeInfo );
+ BaseHandle handle = typeInfo.CreateInstance();
+ DALI_TEST_CHECK( handle );
+ Actor customActor = Actor::DownCast( handle );
+ DALI_TEST_CHECK( customActor );
+
+ const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
+ const unsigned int xComponentIndex = index + 1;
+ const unsigned int yComponentIndex = index + 2;
+ const unsigned int zComponentIndex = index + 3;
+ const Vector3 initialValue( 20.0f, 40.0f, 50.0f );
+
+ // Register animatable property & its components
+ AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent3( customType1, "animatableProp1Z", zComponentIndex, index, 2 );
+
+ // Check the animatable property value
+ DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( index ), initialValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check the animatable property current value
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector3 >( index ), initialValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
+
+ // Do an AnimateBy
+ const Vector3 targetValue( 45.0f, 53.0f, 25.0f );
+ const Vector3 relativeValue( targetValue - initialValue );
+
+ Animation animation = Animation::New( 1.0f );
+ animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x );
+ animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y );
+ animation.AnimateBy( Property( customActor, zComponentIndex ), relativeValue.z );
+ animation.Play();
+
+ // Target values should change straight away
+ DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), targetValue.z, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector4AnimateByP(void)
+{
+ TestApplication application;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
+ DALI_TEST_CHECK( typeInfo );
+ BaseHandle handle = typeInfo.CreateInstance();
+ DALI_TEST_CHECK( handle );
+ Actor customActor = Actor::DownCast( handle );
+ DALI_TEST_CHECK( customActor );
+
+ const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
+ const unsigned int xComponentIndex = index + 1;
+ const unsigned int yComponentIndex = index + 2;
+ const unsigned int zComponentIndex = index + 3;
+ const unsigned int wComponentIndex = index + 4;
+ const Vector4 initialValue( 20.0f, 40.0f, 50.0f, 60.0f );
+
+ // Register animatable property & its components
+ AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent3( customType1, "animatableProp1Z", zComponentIndex, index, 2 );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent4( customType1, "animatableProp1W", wComponentIndex, index, 3 );
+
+ // Check the animatable property value
+ DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( index ), initialValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( wComponentIndex ), initialValue.w, TEST_LOCATION );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check the animatable property current value
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector4 >( index ), initialValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( wComponentIndex ), initialValue.w, TEST_LOCATION );
+
+ // Do an AnimateBy
+ const Vector4 targetValue( 45.0f, 53.0f, 25.0f, 13.0f );
+ const Vector4 relativeValue( targetValue - initialValue );
+
+ Animation animation = Animation::New( 1.0f );
+ animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x );
+ animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y );
+ animation.AnimateBy( Property( customActor, zComponentIndex ), relativeValue.z );
+ animation.AnimateBy( Property( customActor, wComponentIndex ), relativeValue.w );
+ animation.Play();
+
+ // Target values should change straight away
+ DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), targetValue.z, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( wComponentIndex ), targetValue.w, TEST_LOCATION );
+
END_TEST;
}
Property::Type type = typeInfoImpl.GetChildPropertyType( typeInfoImpl.GetChildPropertyIndex("childProp4") );
DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION );
+ std::string unRegisteredChildName( typeInfoImpl.GetChildPropertyName( CHILD_PROPERTY_REGISTRATION_START_INDEX + 4 ) );
+ DALI_TEST_EQUALS( unRegisteredChildName, "", TEST_LOCATION );
// Create a child actor
Actor childActor = Actor::New();
DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.0f, TEST_LOCATION );
tet_infoline( "Check latest scene-graph value is unchanged" );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyIndex ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 0.0f, TEST_LOCATION );
// Render and notify
application.SendNotification();
tet_infoline( "Check values after rendering and both retrieval methods should return the latest" );
DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyIndex ), 25.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 25.0f, TEST_LOCATION );
END_TEST;
}
DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION );
tet_infoline( "Check latest scene-graph value is unchanged" );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( customActor, basePropertyIndex ), Vector2( 13.0f, 24.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( basePropertyIndex ), Vector2( 13.0f, 24.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
// Render and notify
application.SendNotification();
DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( customActor, basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
tet_infoline( "Set the base property value and ensure the component values reflect the change" );
customActor.SetProperty( basePropertyIndex, Vector2( 1.0f, 2.0f ) );
DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION );
tet_infoline( "Check latest scene-graph value is unchanged" );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( customActor, basePropertyIndex ), Vector3( 13.0f, 24.0f, 35.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector3 >( basePropertyIndex ), Vector3( 13.0f, 24.0f, 35.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
// Render and notify
application.SendNotification();
DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( customActor, basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
tet_infoline( "Set the base property value and ensure the component values reflect the change" );
customActor.SetProperty( basePropertyIndex, Vector3( 1.0f, 2.0f, 3.0f ) );
DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION );
tet_infoline( "Check latest scene-graph value is unchanged" );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( customActor, basePropertyIndex ), Vector4( 13.0f, 24.0f, 35.0f, 47.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentThreePropertyIndex ), 47.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector4 >( basePropertyIndex ), Vector4( 13.0f, 24.0f, 35.0f, 47.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentThreePropertyIndex ), 47.0f, TEST_LOCATION );
// Render and notify
application.SendNotification();
DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 435.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( customActor, basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, componentThreePropertyIndex ), 435.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentThreePropertyIndex ), 435.0f, TEST_LOCATION );
tet_infoline( "Set the base property value and ensure the component values reflect the change" );
customActor.SetProperty( basePropertyIndex, Vector4( 1.0f, 2.0f, 3.0f, 4.0f ) );
END_TEST;
}
+
+
+int UtcDaliTypeInfoRegisterChildProperties01(void)
+{
+ TestApplication application;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ tet_infoline( "Register child properties on a type via name" );
+
+ auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(CustomActor) );
+ auto myCustomTypeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
+ DALI_TEST_CHECK( customActorTypeInfo );
+ DALI_TEST_CHECK( myCustomTypeInfo );
+
+ const Property::Index WIDTH_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX );
+ const Property::Index HEIGHT_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1);
+ const Property::Index MARGIN_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 100);
+
+ ChildPropertyRegistration( customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER );
+ ChildPropertyRegistration( customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER );
+ ChildPropertyRegistration( myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS );
+
+ auto customActor = MyTestCustomActor::New();
+ Stage::GetCurrent().Add( customActor );
+ auto child = Actor::New();
+ customActor.Add( child );
+
+ child.SetProperty( WIDTH_SPECIFICATION, 33 );
+
+ auto value = child.GetProperty( WIDTH_SPECIFICATION );
+ DALI_TEST_EQUALS( value, Property::Value(33), TEST_LOCATION );
+
+ child.SetProperty( HEIGHT_SPECIFICATION, 44 );
+ value = child.GetProperty( HEIGHT_SPECIFICATION );
+ DALI_TEST_EQUALS( value, Property::Value(44), TEST_LOCATION );
+
+ child.SetProperty( MARGIN_SPECIFICATION, Extents(10, 10, 10, 10) );
+ value = child.GetProperty( MARGIN_SPECIFICATION );
+ DALI_TEST_EQUALS( value, Property::Value(Extents(10,10,10,10)), TEST_LOCATION );
+
+ END_TEST;
+}
+
+
+int UtcDaliTypeInfoRegisterChildProperties02(void)
+{
+ TestApplication application;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ tet_infoline( "Register child properties on a type via name" );
+
+ auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(CustomActor) );
+ auto myCustomTypeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
+ DALI_TEST_CHECK( customActorTypeInfo );
+ DALI_TEST_CHECK( myCustomTypeInfo );
+
+ const Property::Index WIDTH_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX );
+ const Property::Index HEIGHT_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1);
+ const Property::Index MARGIN_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 100);
+
+ ChildPropertyRegistration( customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER );
+ ChildPropertyRegistration( customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER );
+ ChildPropertyRegistration( myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS );
+
+
+ auto index = customActorTypeInfo.GetChildPropertyIndex( "widthSpecification" );
+ DALI_TEST_EQUALS( index, WIDTH_SPECIFICATION, TEST_LOCATION );
+
+ index = customActorTypeInfo.GetChildPropertyIndex( "heightSpecification" );
+ DALI_TEST_EQUALS( index, HEIGHT_SPECIFICATION, TEST_LOCATION );
+
+ index = customActorTypeInfo.GetChildPropertyIndex( "marginSpecification" );
+ DALI_TEST_EQUALS( index, Property::INVALID_INDEX, TEST_LOCATION );
+
+ index = myCustomTypeInfo.GetChildPropertyIndex( "marginSpecification" );
+ DALI_TEST_EQUALS( index, MARGIN_SPECIFICATION, TEST_LOCATION );
+
+
+ auto name = customActorTypeInfo.GetChildPropertyName( WIDTH_SPECIFICATION );
+ DALI_TEST_EQUALS( name, "widthSpecification", TEST_LOCATION );
+
+ name = customActorTypeInfo.GetChildPropertyName( HEIGHT_SPECIFICATION );
+ DALI_TEST_EQUALS( name, "heightSpecification", TEST_LOCATION );
+
+ name = myCustomTypeInfo.GetChildPropertyName( MARGIN_SPECIFICATION );
+ DALI_TEST_EQUALS( name, "marginSpecification", TEST_LOCATION );
+
+
+ auto type = customActorTypeInfo.GetChildPropertyType( WIDTH_SPECIFICATION );
+ DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION );
+
+ type = customActorTypeInfo.GetChildPropertyType( HEIGHT_SPECIFICATION );
+ DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION );
+
+ type = myCustomTypeInfo.GetChildPropertyType( MARGIN_SPECIFICATION );
+ DALI_TEST_EQUALS( type, Property::EXTENTS, TEST_LOCATION );
+
+
+ END_TEST;
+}
+
+
+int UtcDaliTypeInfoRegisterChildProperties03(void)
+{
+ TestApplication application;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ tet_infoline( "Check registered child properties can be retrieved" );
+
+ auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(CustomActor) );
+ auto myCustomTypeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
+ DALI_TEST_CHECK( customActorTypeInfo );
+ DALI_TEST_CHECK( myCustomTypeInfo );
+
+ const Property::Index WIDTH_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX );
+ const Property::Index HEIGHT_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1);
+ const Property::Index MARGIN_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 100);
+
+ ChildPropertyRegistration( customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER );
+ ChildPropertyRegistration( customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER );
+ ChildPropertyRegistration( myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS );
+
+ Property::IndexContainer indices;
+ myCustomTypeInfo.GetChildPropertyIndices( indices );
+
+ auto result = std::find( indices.Begin(), indices.End(), WIDTH_SPECIFICATION );
+ DALI_TEST_EQUALS( result != indices.End(), true, TEST_LOCATION );
+
+ result = std::find( indices.Begin(), indices.End(), HEIGHT_SPECIFICATION );
+ DALI_TEST_EQUALS( result != indices.End(), true, TEST_LOCATION );
+
+ result = std::find( indices.Begin(), indices.End(), MARGIN_SPECIFICATION );
+ DALI_TEST_EQUALS( result != indices.End(), true, TEST_LOCATION );
+
+ END_TEST;
+}