'name':'text', \
'type':'basic-text', \
'text':'Hello' \
+ }, \
+ { \
+ 'name':'text2', \
+ 'type':'basic-text', \
+ 'text':'Hello', \
+ 'signals': \
+ [ \
+ { 'name': 'on-stage', 'action':'set', 'actor':'text2', 'property':'text', 'value':'Jaylo' } \
+ ] \
} \
], \
'other': \
static void UtcDaliBuilderStyles();
static void UtcDaliBuilderAddActorsOther();
static void UtcDaliBuilderAddActors();
+static void UtcDaliBuilderSetProperty();
enum {
POSITIVE_TC_IDX = 0x01,
{ UtcDaliBuilderStyles, POSITIVE_TC_IDX },
{ UtcDaliBuilderAddActorsOther, POSITIVE_TC_IDX },
{ UtcDaliBuilderAddActors, POSITIVE_TC_IDX },
+ { UtcDaliBuilderSetProperty, POSITIVE_TC_IDX },
{ NULL, 0 }
};
}
DALI_TEST_CHECK( 0.8f == v.Get<float>() );
}
+
+static void UtcDaliBuilderSetProperty()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliBuilderSetProperty");
+
+ Builder builder = Builder::New();
+
+ builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR));
+
+ builder.AddActors( Stage::GetCurrent().GetRootLayer() );
+
+ application.SendNotification();
+ application.Render();
+
+ TextActor actor = TextActor::DownCast( Stage::GetCurrent().GetRootLayer().FindChildByName("text2") );
+
+ DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK( actor.GetText() == "Jaylo" );
+
+}
if( idx != Property::INVALID_INDEX )
{
- actor.SetProperty( idx, value );
+ if( actor.GetPropertyType(idx) != value.GetType() )
+ {
+ DALI_SCRIPT_WARNING("Set property action has different type for property '%s'\n", propertyName.c_str());
+ }
+ else
+ {
+ actor.SetProperty( idx, value );
+ }
+ }
+ else
+ {
+ DALI_SCRIPT_WARNING("Set property action cannot find property '%s'\n", propertyName.c_str());
}
}
};
OptionalString childActorName(IsString( IsChild(&child, "child-actor")) );
OptionalString actorName(IsString( IsChild(&child, "actor")) );
OptionalString propertyName(IsString( IsChild(&child, "property")) );
- OptionalString valueChild(IsString( IsChild(&child, "value")) );
+ OptionalChild valueChild( IsChild(&child, "value") );
OptionalString actionName = IsString( IsChild(&child, "action") );
DALI_ASSERT_ALWAYS(actionName && "Signal must have an action");
}
else if(actorName)
{
- if(propertyName && valueChild)
+ if(propertyName && valueChild && ("set" == *actionName) )
{
PropertySetAction action;
action.actorName = *actorName;
action.propertyName = *propertyName;
+ // actor may not exist yet so we can't check the property type
+ if( !Dali::Toolkit::Internal::SetPropertyFromNode( *valueChild, action.value ) )
+ {
+ DALI_SCRIPT_WARNING("Cannot set property for set property action\n");
+ }
callback = action;
}
else