2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include <dali/public-api/dali-core.h>
22 #include <dali/devel-api/actors/actor-devel.h>
23 #include <dali/devel-api/object/handle-devel.h>
24 #include "dali-test-suite-utils/dali-test-suite-utils.h"
25 #include "dali-test-suite-utils/test-custom-actor.h"
27 #include <mesh-builder.h>
31 void handle_test_startup(void)
33 test_return_value = TET_UNDEF;
36 void handle_test_cleanup(void)
38 test_return_value = TET_PASS;
44 /// Allows the creation of a BaseObject
45 class BaseObjectType : public BaseObject
53 Handle ImplicitCopyConstructor(Handle passedByValue)
55 // object + copy + passedByValue, ref count == 3
56 DALI_TEST_CHECK(passedByValue);
59 DALI_TEST_EQUALS(3, passedByValue.GetBaseObject().ReferenceCount(), TEST_LOCATION);
68 int UtcDaliHandleConstructorVoid(void)
70 TestApplication application;
71 tet_infoline("Testing Dali::Handle::Handle()");
75 DALI_TEST_CHECK(!object);
80 int UtcDaliHandleCopyConstructor(void)
82 TestApplication application;
83 tet_infoline("Testing Dali::Handle::Handle(const Handle&)");
85 // Initialize an object, ref count == 1
86 Handle object = Actor::New();
88 DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION);
90 // Copy the object, ref count == 2
92 DALI_TEST_CHECK(copy);
95 DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
99 // Pass by value, and return another copy, ref count == 3
100 Handle anotherCopy = ImplicitCopyConstructor(copy);
102 DALI_TEST_CHECK(anotherCopy);
105 DALI_TEST_EQUALS(3, anotherCopy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
109 // anotherCopy out of scope, ref count == 2
110 DALI_TEST_CHECK(copy);
113 DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
118 int UtcDaliHandleAssignmentOperator(void)
120 TestApplication application;
121 tet_infoline("Testing Dali::Handle::operator=");
123 Handle object = Actor::New();
125 DALI_TEST_CHECK(object);
126 DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION);
129 DALI_TEST_CHECK(!copy);
132 DALI_TEST_CHECK(copy);
133 DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
134 DALI_TEST_CHECK(&(copy.GetBaseObject()) == &(object.GetBaseObject()));
138 int UtcDaliHandleSupports(void)
140 tet_infoline("Positive Test Dali::Handle::Supports()");
141 TestApplication application;
143 Actor actor = Actor::New();
144 DALI_TEST_CHECK( true == actor.Supports( Handle::DYNAMIC_PROPERTIES ) );
148 int UtcDaliHandleGetPropertyCount(void)
150 tet_infoline("Positive Test Dali::Handle::GetPropertyCount()");
151 TestApplication application;
153 Actor actor = Actor::New();
154 int defaultPropertyCount( actor.GetPropertyCount() );
156 // Register a dynamic property
157 actor.RegisterProperty( "testProperty", float(123.0f) );
158 DALI_TEST_CHECK( (defaultPropertyCount + 1u) == actor.GetPropertyCount() );
162 int UtcDaliHandleGetPropertyName(void)
164 tet_infoline("Positive Test Dali::Handle::GetPropertyName()");
165 TestApplication application;
167 Actor actor = Actor::New();
168 DALI_TEST_CHECK( "parentOrigin" == actor.GetPropertyName( Actor::Property::PARENT_ORIGIN ) );
170 // Register a dynamic property
171 std::string name("thisNameShouldMatch");
172 Property::Index index = actor.RegisterProperty( name, float(123.0f) );
173 DALI_TEST_CHECK( name == actor.GetPropertyName( index ) );
178 int UtcDaliHandleGetPropertyIndex01(void)
180 tet_infoline("Positive Test Dali::Handle::GetPropertyIndex()");
181 TestApplication application;
183 Actor actor = Actor::New();
184 DALI_TEST_CHECK( Actor::Property::PARENT_ORIGIN == actor.GetPropertyIndex("parentOrigin") );
186 // Register a dynamic property
187 std::string name("thisNameShouldMatch");
188 Property::Index index = actor.RegisterProperty( name, float(123.0f) );
189 DALI_TEST_CHECK( index == actor.GetPropertyIndex( name ) );
193 int UtcDaliHandleGetPropertyIndex02(void)
195 tet_infoline("Positive Test Dali::Handle::GetPropertyIndex() int key");
196 TestApplication application;
198 Stage stage = Stage::GetCurrent();
200 Actor actor = Actor::New();
203 const unsigned int defaultPropertyCount = actor.GetPropertyCount();
205 application.SendNotification();
206 application.Render();
208 Property::Index key1 = CORE_PROPERTY_MAX_INDEX+1;
209 Property::Index key2 = CORE_PROPERTY_MAX_INDEX+2;
211 const Vector4 testColor(0.5f, 0.2f, 0.9f, 1.0f);
212 const float withFlake(99.f);
214 Property::Index index1 = actor.RegisterProperty( "MyPropertyOne", Vector3::ONE );
215 Property::Index index2 = DevelHandle::RegisterProperty( actor, key1, "sideColor", testColor);
216 Property::Index index3 = actor.RegisterProperty( "MyPropertyTwo", Vector3::ONE );
217 Property::Index index4 = DevelHandle::RegisterProperty( actor, key2, "iceCream", withFlake );
218 Property::Index index5 = actor.RegisterProperty( "MyPropertyThree", Vector3::ONE );
220 application.SendNotification();
221 application.Render();
223 // Test that we can get the property index from the integer key
224 Property::Index testIndex1 = DevelHandle::GetPropertyIndex( actor, key1 );
225 Property::Index testIndex2 = DevelHandle::GetPropertyIndex( actor, key2 );
227 DALI_TEST_EQUALS( index2, testIndex1, TEST_LOCATION );
228 DALI_TEST_EQUALS( index4, testIndex2, TEST_LOCATION );
230 // Test that we keep the same indices on the named properties
231 Property::Index testIndex = actor.GetPropertyIndex("MyPropertyOne");
232 DALI_TEST_EQUALS(testIndex, index1, TEST_LOCATION);
233 testIndex = actor.GetPropertyIndex("MyPropertyTwo");
234 DALI_TEST_EQUALS(testIndex, index3, TEST_LOCATION);
235 testIndex = actor.GetPropertyIndex("MyPropertyThree");
236 DALI_TEST_EQUALS(testIndex, index5, TEST_LOCATION);
237 testIndex = actor.GetPropertyIndex("sideColor");
238 DALI_TEST_EQUALS(testIndex, index2, TEST_LOCATION);
239 testIndex = actor.GetPropertyIndex("iceCream");
240 DALI_TEST_EQUALS(testIndex, index4, TEST_LOCATION);
242 DALI_TEST_EQUALS(defaultPropertyCount+5, actor.GetPropertyCount(), TEST_LOCATION);
246 int UtcDaliHandleGetPropertyIndex03(void)
248 TestApplication application;
250 Actor actor = Actor::New();
252 std::string myName("croydon");
253 Property::Index intKey = CORE_PROPERTY_MAX_INDEX+1;
254 Property::Value value( Color::GREEN );
255 Property::Index myIndex = DevelHandle::RegisterProperty( actor, intKey, myName, value );
257 DALI_TEST_EQUALS( myIndex, DevelHandle::GetPropertyIndex( actor, intKey ), TEST_LOCATION );
259 Property::Key key1(myName);
260 Property::Key key2(intKey);
262 DALI_TEST_EQUALS( myIndex, DevelHandle::GetPropertyIndex( actor, key1 ), TEST_LOCATION );
263 DALI_TEST_EQUALS( myIndex, DevelHandle::GetPropertyIndex( actor, key2 ), TEST_LOCATION );
268 int UtcDaliHandleIsPropertyWritable(void)
270 tet_infoline("Positive Test Dali::Handle::IsPropertyWritable()");
271 TestApplication application;
273 Actor actor = Actor::New();
275 // Actor properties which are writable:
276 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN ) );
277 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN_X ) );
278 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN_Y ) );
279 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN_Z ) );
280 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT ) );
281 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT_X ) );
282 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT_Y ) );
283 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT_Z ) );
284 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE ) );
285 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE_WIDTH ) );
286 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE_HEIGHT ) );
287 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE_DEPTH ) );
288 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION ) );
289 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION_X ) );
290 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION_Y ) );
291 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION_Z ) );
292 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ORIENTATION ) );
293 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE ) );
294 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE_X ) );
295 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE_Y ) );
296 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE_Z ) );
297 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::VISIBLE ) );
298 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR ) );
299 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_RED ) );
300 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_GREEN ) );
301 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_BLUE ) );
302 DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_ALPHA ) );
303 DALI_TEST_CHECK( true == actor.IsPropertyWritable( DevelActor::Property::OPACITY ) );
305 // World-properties are not writable:
306 DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION ) );
307 DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_ORIENTATION ) );
308 DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_SCALE ) );
309 DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_COLOR ) );
310 DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION_X ) );
311 DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION_Y ) );
312 DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION_Z ) );
317 int UtcDaliHandleIsPropertyAnimatable(void)
319 tet_infoline("Positive Test Dali::Handle::IsPropertyAnimatable()");
320 TestApplication application;
322 Actor actor = Actor::New();
324 // Actor properties which are animatable:
325 DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN ) );
326 DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN_X ) );
327 DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN_Y ) );
328 DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN_Z ) );
329 DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT ) );
330 DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT_X ) );
331 DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT_Y ) );
332 DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT_Z ) );
333 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE ) );
334 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE_WIDTH ) );
335 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE_HEIGHT ) );
336 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE_DEPTH ) );
337 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION ) );
338 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION_X ) );
339 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION_Y ) );
340 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION_Z ) );
341 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::ORIENTATION ) );
342 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE ) );
343 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE_X ) );
344 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE_Y ) );
345 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE_Z ) );
346 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::VISIBLE ) );
347 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR ) );
348 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_RED ) );
349 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_GREEN ) );
350 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_BLUE ) );
351 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_ALPHA ) );
352 DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( DevelActor::Property::OPACITY ) );
354 // World-properties can not be animated
355 DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION ) );
356 DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_ORIENTATION ) );
357 DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_SCALE ) );
358 DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_COLOR ) );
359 DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION_X ) );
360 DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION_Y ) );
361 DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION_Z ) );
366 int UtcDaliHandleIsPropertyAConstraintInput(void)
368 TestApplication application;
370 Actor actor = Actor::New();
372 // Actor properties which can be used as a constraint input:
373 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN ) );
374 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN_X ) );
375 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN_Y ) );
376 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN_Z ) );
377 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT ) );
378 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT_X ) );
379 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT_Y ) );
380 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT_Z ) );
381 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE ) );
382 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_WIDTH ) );
383 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_HEIGHT ) );
384 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_DEPTH ) );
385 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION ) );
386 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_X ) );
387 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_Y ) );
388 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_Z ) );
389 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ORIENTATION ) );
390 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE ) );
391 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE_X ) );
392 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE_Y ) );
393 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE_Z ) );
394 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::VISIBLE ) );
395 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR ) );
396 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_RED ) );
397 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_GREEN ) );
398 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_BLUE ) );
399 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_ALPHA ) );
400 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( DevelActor::Property::OPACITY ) );
401 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION ) );
402 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_ORIENTATION ) );
403 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_SCALE ) );
404 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_COLOR ) );
405 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION_X ) );
406 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION_Y ) );
407 DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION_Z ) );
409 // Actor properties that cannot be used as a constraint input
410 DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::NAME ) );
411 DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::SENSITIVE ) );
412 DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::LEAVE_REQUIRED ) );
413 DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::INHERIT_ORIENTATION ) );
414 DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::INHERIT_SCALE ) );
415 DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_MODE ) );
416 DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_INHERITANCE ) );
417 DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::DRAW_MODE ) );
418 DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_MODE_FACTOR ) );
424 int UtcDaliHandleGetPropertyType(void)
426 tet_infoline("Positive Test Dali::Handle::GetPropertyType()");
427 TestApplication application;
429 Actor actor = Actor::New();
430 DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( Actor::Property::PARENT_ORIGIN ) );
431 DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( Actor::Property::ANCHOR_POINT ) );
432 DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( Actor::Property::SIZE ) );
433 DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( Actor::Property::POSITION ) );
434 DALI_TEST_CHECK( Property::ROTATION == actor.GetPropertyType( Actor::Property::ORIENTATION ) );
435 DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( Actor::Property::SCALE ) );
436 DALI_TEST_CHECK( Property::BOOLEAN == actor.GetPropertyType( Actor::Property::VISIBLE ) );
437 DALI_TEST_CHECK( Property::VECTOR4 == actor.GetPropertyType( Actor::Property::COLOR ) );
439 // Register some dynamic properties
440 Property::Index boolIndex = actor.RegisterProperty( "boolProperty", bool(true) );
441 Property::Index floatIndex = actor.RegisterProperty( "floatProperty", float(123.0f) );
442 Property::Index intIndex = actor.RegisterProperty( "intProperty", 123 );
443 Property::Index vector2Index = actor.RegisterProperty( "vector2Property", Vector2(1.0f, 2.0f) );
444 Property::Index vector3Index = actor.RegisterProperty( "vector3Property", Vector3(1.0f, 2.0f, 3.0f) );
445 Property::Index vector4Index = actor.RegisterProperty( "vector4Property", Vector4(1.0f, 2.0f, 3.0f, 4.0f) );
446 Property::Index rotationIndex = actor.RegisterProperty( "rotationProperty", AngleAxis(Degree(180.0f), Vector3::YAXIS) );
448 DALI_TEST_CHECK( Property::BOOLEAN == actor.GetPropertyType( boolIndex ) );
449 DALI_TEST_CHECK( Property::FLOAT == actor.GetPropertyType( floatIndex ) );
450 DALI_TEST_CHECK( Property::INTEGER == actor.GetPropertyType( intIndex ) );
451 DALI_TEST_CHECK( Property::VECTOR2 == actor.GetPropertyType( vector2Index ) );
452 DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( vector3Index ) );
453 DALI_TEST_CHECK( Property::VECTOR4 == actor.GetPropertyType( vector4Index ) );
454 DALI_TEST_CHECK( Property::ROTATION == actor.GetPropertyType( rotationIndex ) );
456 // Non animatable properties
457 Property::Index nonAnimStringIndex = actor.RegisterProperty( "manFromDelmonte", std::string("yes"), Property::READ_WRITE);
458 Property::Index nonAnimV2Index = actor.RegisterProperty( "v2", Vector2(1.f, 2.f), Property::READ_WRITE);
459 Property::Index nonAnimV3Index = actor.RegisterProperty( "v3", Vector3(1.f, 2.f, 3.f), Property::READ_WRITE);
460 Property::Index nonAnimV4Index = actor.RegisterProperty( "v4", Vector4(1.f, 2.f, 3.f, 4.f), Property::READ_WRITE);
461 Property::Index nonAnimBooleanIndex = actor.RegisterProperty( "bool", true, Property::READ_WRITE);
462 Property::Index nonAnimFloatIndex = actor.RegisterProperty( "float", 0.f, Property::READ_WRITE);
463 Property::Index nonAnimIntegerIndex = actor.RegisterProperty( "int", 0, Property::READ_WRITE);
465 DALI_TEST_CHECK( nonAnimStringIndex != Property::INVALID_INDEX );
466 DALI_TEST_CHECK( nonAnimV2Index != Property::INVALID_INDEX );
467 DALI_TEST_CHECK( nonAnimV3Index != Property::INVALID_INDEX );
468 DALI_TEST_CHECK( nonAnimV4Index != Property::INVALID_INDEX );
469 DALI_TEST_CHECK( nonAnimBooleanIndex != Property::INVALID_INDEX );
470 DALI_TEST_CHECK( nonAnimFloatIndex != Property::INVALID_INDEX );
471 DALI_TEST_CHECK( nonAnimIntegerIndex != Property::INVALID_INDEX );
473 DALI_TEST_CHECK( Property::STRING == actor.GetPropertyType( nonAnimStringIndex ) );
474 DALI_TEST_CHECK( Property::VECTOR2 == actor.GetPropertyType( nonAnimV2Index ) );
475 DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( nonAnimV3Index ) );
476 DALI_TEST_CHECK( Property::VECTOR4 == actor.GetPropertyType( nonAnimV4Index ) );
477 DALI_TEST_CHECK( Property::BOOLEAN == actor.GetPropertyType( nonAnimBooleanIndex ) );
478 DALI_TEST_CHECK( Property::FLOAT == actor.GetPropertyType( nonAnimFloatIndex ) );
479 DALI_TEST_CHECK( Property::INTEGER == actor.GetPropertyType( nonAnimIntegerIndex ) );
481 DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimStringIndex ) );
482 DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV2Index ) );
483 DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV3Index ) );
484 DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV4Index ) );
485 DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimBooleanIndex ) );
486 DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimFloatIndex ) );
487 DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimIntegerIndex ) );
489 DALI_TEST_EQUALS( "yes" , actor.GetProperty( nonAnimStringIndex ).Get<std::string>(), TEST_LOCATION );
490 DALI_TEST_EQUALS( Vector2(1.f, 2.f) , actor.GetProperty( nonAnimV2Index ).Get<Vector2>(), TEST_LOCATION );
491 DALI_TEST_EQUALS( Vector3(1.f, 2.f, 3.f) , actor.GetProperty( nonAnimV3Index ).Get<Vector3>(), TEST_LOCATION );
492 DALI_TEST_EQUALS( Vector4(1.f, 2.f, 3.f, 4.f) , actor.GetProperty( nonAnimV4Index ).Get<Vector4>(), TEST_LOCATION );
493 DALI_TEST_EQUALS( true, actor.GetProperty( nonAnimBooleanIndex ).Get<bool>(), TEST_LOCATION );
494 DALI_TEST_EQUALS( 0.f, actor.GetProperty( nonAnimFloatIndex ).Get<float>(), TEST_LOCATION );
495 DALI_TEST_EQUALS( 0, actor.GetProperty( nonAnimIntegerIndex ).Get<int>(), TEST_LOCATION );
500 int UtcDaliHandleNonAnimatableProperties(void)
502 tet_infoline("Test Non Animatable Properties");
503 TestApplication application;
505 Actor actor = Actor::New();
507 Property::Index nonAnimStringIndex = actor.RegisterProperty( "manFromDelmonte", std::string("no"), Property::READ_WRITE);
509 //// modify writable?
510 actor.SetProperty( nonAnimStringIndex, Property::Value("yes") );
512 DALI_TEST_CHECK( "yes" == actor.GetProperty( nonAnimStringIndex ).Get<std::string>() );
514 //// cannot modify read only?
515 Property::Index readonly = actor.RegisterProperty( "float", 0.f, Property::READ_ONLY);
517 DALI_TEST_CHECK(!actor.IsPropertyAnimatable(readonly));
518 DALI_TEST_CHECK(!actor.IsPropertyWritable(readonly));
520 actor.SetProperty( readonly, Property::Value(1.f) );
521 // trying to set a read-only property is a no-op
523 DALI_TEST_EQUALS( 0.f, actor.GetProperty( readonly ).Get<float>(), TEST_LOCATION );
525 /// animatable can be set
526 Property::Index write_anim = actor.RegisterProperty( "write_float", 0.f, Property::ANIMATABLE);
528 DALI_TEST_CHECK(actor.IsPropertyAnimatable(write_anim));
529 DALI_TEST_CHECK(actor.IsPropertyWritable(write_anim));
531 actor.SetProperty( write_anim, Property::Value(1.f) );
533 //// animate a non animatable property throws
534 float durationSeconds(2.0f);
535 Animation animation = Animation::New(durationSeconds);
536 bool relativeValue(true);
539 animation.AnimateBy(Property(actor, nonAnimStringIndex), relativeValue, AlphaFunction::EASE_IN);
541 catch ( Dali::DaliException& e )
543 DALI_TEST_ASSERT( e, "Animated value and Property type don't match", TEST_LOCATION );
546 DALI_TEST_EQUALS( "yes", actor.GetProperty( nonAnimStringIndex ).Get<std::string>(), TEST_LOCATION );
551 int UtcDaliHandleNonAnimtableCompositeProperties(void)
553 tet_infoline("Test Non Animatable Composite Properties");
554 TestApplication application;
556 Actor actor = Actor::New();
558 Property::Value value(Property::ARRAY);
559 Property::Array* array = value.GetArray();
560 DALI_TEST_CHECK( array );
562 array->PushBack( Property::Value( 0.1f ) );
563 array->PushBack( "a string" );
564 array->PushBack( Property::Value( Vector3(1,2,3) ) );
566 DALI_TEST_EQUALS( 3u, array->Count(), TEST_LOCATION );
568 Property::Index propertyIndex = actor.RegisterProperty( "composite", value, Property::READ_WRITE );
570 Property::Value out = actor.GetProperty( propertyIndex );
571 Property::Array* outArray = out.GetArray();
572 DALI_TEST_CHECK( outArray != NULL );
574 DALI_TEST_CHECK( Property::FLOAT == outArray->GetElementAt(0).GetType());
575 DALI_TEST_CHECK( Property::STRING == outArray->GetElementAt(1).GetType());
576 DALI_TEST_CHECK( Property::VECTOR3 == outArray->GetElementAt(2).GetType());
578 DALI_TEST_EQUALS( 0.1f, outArray->GetElementAt(0).Get<float>(), TEST_LOCATION);
579 DALI_TEST_EQUALS( "a string", outArray->GetElementAt(1).Get<std::string>(), TEST_LOCATION);
580 DALI_TEST_EQUALS( Vector3(1,2,3), outArray->GetElementAt(2).Get<Vector3>(), TEST_LOCATION);
582 // composite types not animatable
583 bool exception = false;
586 actor.RegisterProperty( "compositemap", value, Property::ANIMATABLE);
588 catch (Dali::DaliException& e)
591 DALI_TEST_PRINT_ASSERT( e );
594 DALI_TEST_EQUALS(exception, true, TEST_LOCATION);
597 Property::Value mapOfMaps(Property::MAP);
598 Property::Map* map = mapOfMaps.GetMap();
600 map->Insert( "key", Property::Value(Property::MAP) );
601 map->Insert( "2key", "a string" );
603 DALI_TEST_EQUALS( "a string", (*map)["2key"].Get<std::string>(), TEST_LOCATION);
605 Property::Map* innerMap = map->Find("key")->GetMap();
606 innerMap->Insert( "subkey", 5.f );
608 DALI_TEST_CHECK( NULL != map->Find("key")->GetMap()->Find("subkey") );
609 DALI_TEST_EQUALS( 5.f, map->Find("key")->GetMap()->Find("subkey")->Get<float>(), TEST_LOCATION);
613 int UtcDaliHandleSetProperty01(void)
615 tet_infoline("Positive Test Dali::Handle::SetProperty()");
616 TestApplication application;
618 Actor actor = Actor::New();
619 DALI_TEST_CHECK( ParentOrigin::TOP_LEFT == actor.GetProperty( Actor::Property::PARENT_ORIGIN ).Get<Vector3>() );
621 actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
622 // flush the queue and render once
623 application.SendNotification();
624 application.Render();
625 DALI_TEST_CHECK( ParentOrigin::CENTER == actor.GetProperty( Actor::Property::PARENT_ORIGIN ).Get<Vector3>() );
629 int UtcDaliHandleSetProperty02(void)
631 tet_infoline("Positive Test Dali::Handle::SetProperty()");
632 TestApplication application;
634 Actor actor = Actor::New();
636 DALI_TEST_CHECK( !actor.IsPropertyWritable( Actor::Property::WORLD_POSITION ) );
638 // World position is not writable so this is a no-op and should not crash
639 actor.SetProperty( Actor::Property::WORLD_POSITION, Vector3(1,2,3) );
644 int UtcDaliHandleRegisterProperty01(void)
646 tet_infoline("Positive Test Dali::Handle::RegisterProperty()");
647 TestApplication application;
649 Stage stage = Stage::GetCurrent();
651 Actor actor = Actor::New();
654 const unsigned int defaultPropertyCount = actor.GetPropertyCount();
656 application.SendNotification();
657 application.Render();
659 Property::Index index1 = actor.RegisterProperty( "MyProperty", Vector3::ONE );
661 application.SendNotification();
662 application.Render();
664 DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 1, TEST_LOCATION );
665 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index1 ), Vector3::ONE, TEST_LOCATION );
667 // No new property should be registered when we call the below function
668 Property::Index index2 = actor.RegisterProperty( "MyProperty", Vector3::ZAXIS );
670 application.SendNotification();
671 application.Render();
674 DALI_TEST_EQUALS( index1, index2, TEST_LOCATION ); // We should have the same index as per the first registration
675 DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 1, TEST_LOCATION ); // Property count should be the same
676 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index2 ), Vector3::ZAXIS, TEST_LOCATION ); // Value should be what we sent on second RegisterProperty call
681 int UtcDaliHandleRegisterProperty02(void)
683 tet_infoline("Positive Test Dali::Handle::RegisterProperty() int key");
684 TestApplication application;
686 Stage stage = Stage::GetCurrent();
688 Actor actor = Actor::New();
691 const unsigned int defaultPropertyCount = actor.GetPropertyCount();
693 application.SendNotification();
694 application.Render();
696 Property::Index key1 = CORE_PROPERTY_MAX_INDEX+1;
697 Property::Index key2 = CORE_PROPERTY_MAX_INDEX+2;
699 const Vector4 testColor(0.5f, 0.2f, 0.9f, 1.0f);
700 const float withFlake(99.f);
702 Property::Index index1 = actor.RegisterProperty( "MyPropertyOne", Vector3::ONE );
703 Property::Index index2 = DevelHandle::RegisterProperty( actor, key1, "sideColor", testColor);
704 Property::Index index3 = DevelHandle::RegisterProperty( actor, key2, "iceCream", withFlake );
706 application.SendNotification();
707 application.Render();
709 DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 3, TEST_LOCATION );
710 DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index1 ), Vector3::ONE, TEST_LOCATION );
711 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index2 ), testColor, TEST_LOCATION );
712 DALI_TEST_EQUALS( actor.GetProperty< float >( index3 ), withFlake, TEST_LOCATION );
714 // No new property should be registered when we call the below functions
715 Property::Index testIndex2 = actor.RegisterProperty( "iceCream", 2200.f );
716 Property::Index testIndex1 = actor.RegisterProperty( "sideColor", Color::BLACK );
717 application.SendNotification();
718 application.Render();
720 DALI_TEST_EQUALS( index2, testIndex1, TEST_LOCATION ); // We should have the same index as per the first registration
721 DALI_TEST_EQUALS( index3, testIndex2, TEST_LOCATION ); // We should have the same index as per the first registration
722 DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 3, TEST_LOCATION ); // Property count should be the same
723 DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index2 ), Color::BLACK, TEST_LOCATION ); // Value should be what we sent on second RegisterProperty call
724 DALI_TEST_EQUALS( actor.GetProperty< float >( index3 ), 2200.f, TEST_LOCATION );
731 int UtcDaliHandleGetProperty(void)
733 tet_infoline("Positive Test Dali::Handle::GetProperty()");
734 TestApplication application;
736 Actor actor = Actor::New();
738 DALI_TEST_CHECK( ParentOrigin::TOP_LEFT == actor.GetProperty( Actor::Property::PARENT_ORIGIN ).Get<Vector3>() );
739 DALI_TEST_CHECK( AnchorPoint::CENTER == actor.GetProperty( Actor::Property::ANCHOR_POINT ).Get<Vector3>() );
740 DALI_TEST_CHECK( Vector3::ZERO == actor.GetProperty( Actor::Property::SIZE ).Get<Vector3>() );
741 DALI_TEST_CHECK( Vector3::ZERO == actor.GetProperty( Actor::Property::POSITION ).Get<Vector3>() );
742 DALI_TEST_CHECK( Vector3::ONE == actor.GetProperty( Actor::Property::SCALE ).Get<Vector3>() );
743 DALI_TEST_CHECK( true == actor.GetProperty( Actor::Property::VISIBLE ).Get<bool>() );
744 DALI_TEST_CHECK( Color::WHITE == actor.GetProperty( Actor::Property::COLOR ).Get<Vector4>() );
748 int UtcDaliHandleDownCast(void)
750 TestApplication application;
751 tet_infoline("Testing Dali::Handle::DownCast()");
753 Actor actor = Actor::New();
755 BaseHandle baseHandle = actor;
757 Handle handle = Handle::DownCast(baseHandle);
759 DALI_TEST_CHECK( handle );
761 baseHandle = BaseHandle();
763 handle = Handle::DownCast(baseHandle);
765 DALI_TEST_CHECK( !handle );
770 int UtcDaliHandleDownCastNegative(void)
772 TestApplication application;
774 // BaseObject is NOT an Object, so this DownCast should fail
775 BaseHandle handle( new BaseObjectType );
776 Handle customHandle1 = Handle::DownCast( handle );
777 DALI_TEST_CHECK( ! customHandle1 );
779 // A DownCast on an empty handle will also fail
781 Handle customHandle2 = Handle::DownCast( empty );
782 DALI_TEST_CHECK( ! customHandle2 );
786 int UtcDaliHandleGetPropertyIndices(void)
788 TestApplication application;
789 Property::IndexContainer indices;
792 Actor actor = Actor::New();
793 actor.GetPropertyIndices( indices );
794 int numDefaultProperties = indices.Size();
795 DALI_TEST_CHECK( numDefaultProperties > 0 );
796 DALI_TEST_EQUALS( numDefaultProperties, actor.GetPropertyCount(), TEST_LOCATION );
798 const Vector4 testColor(0.5f, 0.2f, 0.9f, 1.0f);
799 const float withFlake(99.f);
801 Property::Index key1 = CORE_PROPERTY_MAX_INDEX+1;
802 Property::Index key2 = CORE_PROPERTY_MAX_INDEX+2;
804 actor.RegisterProperty( "MyPropertyOne", Vector3::ONE );
805 DevelHandle::RegisterProperty( actor, key1, "sideColor", testColor);
806 actor.RegisterProperty( "MyPropertyTwo", 1234 );
807 Property::Index index4 = DevelHandle::RegisterProperty( actor, key2, "iceCream", withFlake );
808 actor.RegisterProperty( "MyPropertyThree", Vector2(.2f,.7f) );
810 actor.GetPropertyIndices( indices );
812 DALI_TEST_EQUALS( indices.Size(), numDefaultProperties + 5, TEST_LOCATION );
813 DALI_TEST_EQUALS( indices[indices.Size()-2], index4, TEST_LOCATION );
818 int UtcDaliHandleRegisterPropertyTypes(void)
820 TestApplication application;
822 struct PropertyTypeAnimatable
825 Property::Value value;
829 Property::Array array;
832 PropertyTypeAnimatable properties[] =
834 { "Property::BOOLEAN", true, true },
835 { "Property::FLOAT", 1.0f, true },
836 { "Property::INTEGER", 1, true },
837 { "Property::VECTOR2", Vector2::ONE, true },
838 { "Property::VECTOR3", Vector3::ONE, true },
839 { "Property::VECTOR4", Vector4::ONE, true },
840 { "Property::MATRIX3", Matrix3::IDENTITY, true },
841 { "Property::MATRIX", Matrix::IDENTITY, true },
842 { "Property::RECTANGLE", Rect<int>(), false },
843 { "Property::ROTATION", AngleAxis(), true },
844 { "Property::STRING", std::string("Me"), false },
845 { "Property::ARRAY", array, false },
846 { "Property::MAP", map, false },
849 unsigned int numOfProperties( sizeof( properties ) / sizeof( properties[0] ) );
851 for ( unsigned int i = 0; i < numOfProperties; ++i )
853 tet_printf( "Testing: %s\n", properties[i].name );
855 bool exception = false;
858 Actor actor = Actor::New();
859 actor.RegisterProperty( "manFromDelmonte", properties[i].value );
861 catch (Dali::DaliException& e)
866 DALI_TEST_CHECK( properties[i].animatable != exception );
871 int UtcDaliHandleCustomProperty(void)
873 TestApplication application;
875 Handle handle = Handle::New();
877 float startValue(1.0f);
878 Property::Index index = handle.RegisterProperty( "testProperty", startValue );
879 DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
881 application.SendNotification();
882 application.Render(0);
883 DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
884 application.Render(0);
885 DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
887 handle.SetProperty( index, 5.0f );
889 application.SendNotification();
890 application.Render(0);
891 DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
892 application.Render(0);
893 DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
897 int UtcDaliHandleCustomPropertyNone(void)
899 TestApplication application;
901 Handle handle = Handle::New();
903 Property::Value value( Property::NONE );
904 Property::Index index = handle.RegisterProperty( "testProperty", value, Property::READ_WRITE);
906 // Negative test i.e. setting a property of type NONE is meaningless
907 handle.SetProperty( index, 5.0f );
909 DALI_TEST_CHECK( true ); // got here without crashing
914 int UtcDaliHandleCustomPropertyIntToFloat(void)
916 TestApplication application;
918 Handle handle = Handle::New();
920 float startValue(5.0f);
921 Property::Index index = handle.RegisterProperty( "testProperty", startValue );
922 DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
924 application.SendNotification();
925 application.Render(0);
926 DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
928 handle.SetProperty( index, int(1) );
930 application.SendNotification();
931 application.Render(0);
932 DALI_TEST_CHECK( handle.GetProperty<float>(index) == 1.0f );
936 int UtcDaliHandleCustomPropertyFloatToInt(void)
938 TestApplication application;
940 Handle handle = Handle::New();
943 Property::Index index = handle.RegisterProperty( "testProperty", startValue );
944 DALI_TEST_CHECK( handle.GetProperty<int>(index) == startValue );
946 application.SendNotification();
947 application.Render(0);
948 DALI_TEST_CHECK( handle.GetProperty<int>(index) == startValue );
950 handle.SetProperty( index, float(1.5) );
952 application.SendNotification();
953 application.Render(0);
954 DALI_TEST_CHECK( handle.GetProperty<int>(index) == 1 );
958 int UtcDaliHandleCustomPropertyInvalidToRect(void)
960 TestApplication application;
962 Handle handle = Handle::New();
964 Rect<int> startValue(1,2,3,4);
965 Property::Index index = handle.RegisterProperty( "testProperty", startValue, Property::READ_WRITE);
966 DALI_TEST_EQUALS( handle.GetProperty< Rect<int> >( index ), startValue, TEST_LOCATION );
968 application.SendNotification();
969 application.Render(0);
970 DALI_TEST_EQUALS( handle.GetProperty< Rect<int> >( index ), startValue, TEST_LOCATION );
972 // Negative test i.e. there is no conversion from float to Rect
973 handle.SetProperty( index, float(1.5) );
975 application.SendNotification();
976 application.Render(0);
977 DALI_TEST_EQUALS( handle.GetProperty< Rect<int> >( index ), startValue, TEST_LOCATION );
979 // Positive test (sanity check)
980 Rect<int> endValue(5,6,7,8);
981 handle.SetProperty( index, endValue );
982 DALI_TEST_EQUALS( handle.GetProperty< Rect<int> >( index ), endValue, TEST_LOCATION );
984 application.SendNotification();
985 application.Render(0);
986 DALI_TEST_EQUALS( handle.GetProperty< Rect<int> >( index ), endValue, TEST_LOCATION );
991 int UtcDaliHandleCustomPropertyInvalidToString(void)
993 TestApplication application;
995 Handle handle = Handle::New();
997 std::string startValue( "Libraries gave us power" );
998 Property::Index index = handle.RegisterProperty( "testProperty", startValue, Property::READ_WRITE);
999 DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), startValue, TEST_LOCATION );
1001 application.SendNotification();
1002 application.Render(0);
1003 DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), startValue, TEST_LOCATION );
1005 // No conversion from Vector3 to std::string, therefore this should be a NOOP
1006 handle.SetProperty( index, Vector3(1,2,3) );
1008 application.SendNotification();
1009 application.Render(0);
1010 DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), startValue, TEST_LOCATION );
1012 // Positive test (sanity check)
1013 std::string endValue( "Then work came and made us free" );
1014 handle.SetProperty( index, endValue );
1015 DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), endValue, TEST_LOCATION );
1017 application.SendNotification();
1018 application.Render(0);
1019 DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), endValue, TEST_LOCATION );
1024 int UtcDaliHandleCustomPropertyInvalidToArray(void)
1026 TestApplication application;
1028 Handle handle = Handle::New();
1030 Property::Value value( Property::ARRAY );
1031 std::string startValue( "The future teaches you to be alone" );
1032 value.GetArray()->PushBack( startValue );
1034 Property::Index index = handle.RegisterProperty( "testProperty", value, Property::READ_WRITE);
1035 Property::Array check1 = handle.GetProperty< Property::Array >( index );
1036 DALI_TEST_EQUALS( check1.GetElementAt(0).Get<std::string>(), startValue, TEST_LOCATION );
1038 application.SendNotification();
1039 application.Render(0);
1040 Property::Array check2 = handle.GetProperty< Property::Array >( index );
1041 DALI_TEST_EQUALS( check2.GetElementAt(0).Get<std::string>(), startValue, TEST_LOCATION );
1043 // No conversion from int to ARRAY, therefore this should be a NOOP
1044 handle.SetProperty( index, int(2) );
1046 application.SendNotification();
1047 application.Render(0);
1048 Property::Array check3 = handle.GetProperty< Property::Array >( index );
1049 DALI_TEST_EQUALS( check3.GetElementAt(0).Get<std::string>(), startValue, TEST_LOCATION );
1051 // Positive test (sanity check)
1052 Property::Value value2(Property::ARRAY);
1053 std::string endValue( "The present to be afraid and cold" );
1054 value2.GetArray()->PushBack( endValue );
1055 handle.SetProperty( index, value2 );
1057 Property::Array check4 = handle.GetProperty< Property::Array >( index );
1058 DALI_TEST_EQUALS( check4.GetElementAt(0).Get<std::string>(), endValue, TEST_LOCATION );
1060 application.SendNotification();
1061 application.Render(0);
1062 Property::Array check5 = handle.GetProperty< Property::Array >( index );
1063 DALI_TEST_EQUALS( check5.GetElementAt(0).Get<std::string>(), endValue, TEST_LOCATION );
1068 int UtcDaliHandleCustomPropertyInvalidToMap(void)
1070 TestApplication application;
1072 Handle handle = Handle::New();
1074 Property::Value value( Property::MAP );
1075 std::string startValue( "Culture sucks down words" );
1076 value.GetMap()->Insert( "1", startValue );
1078 Property::Index index = handle.RegisterProperty( "testProperty", value, Property::READ_WRITE );
1079 Property::Value* check1 = handle.GetProperty< Property::Map >( index ).Find("1");
1080 DALI_TEST_CHECK( NULL != check1 );
1082 // No conversion from float to MAP, therefore this should be a NOOP
1083 handle.SetProperty( index, float(3.0) );
1085 // Positive test (sanity check)
1086 Property::Value value2( Property::MAP );
1087 std::string endValue( "Itemise loathing and feed yourself smiles" );
1088 value.GetMap()->Insert( "1", endValue );
1089 handle.SetProperty( index, value2 );
1094 int UtcDaliHandleCustomPropertyInvalidToExtents(void)
1096 TestApplication application;
1098 Handle handle = Handle::New();
1100 Extents startValue(1,2,3,4);
1101 Property::Index index = handle.RegisterProperty( "testProperty", startValue, Property::READ_WRITE);
1102 DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), startValue, TEST_LOCATION );
1104 application.SendNotification();
1105 application.Render(0);
1106 DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), startValue, TEST_LOCATION );
1108 // Negative test i.e. there is no conversion from float to Extents
1109 handle.SetProperty( index, float(1.5) );
1111 application.SendNotification();
1112 application.Render(0);
1113 DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), startValue, TEST_LOCATION );
1115 // Positive test (sanity check)
1116 Extents endValue(5,6,7,8);
1117 handle.SetProperty( index, endValue );
1118 DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), endValue, TEST_LOCATION );
1120 application.SendNotification();
1121 application.Render(0);
1122 DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), endValue, TEST_LOCATION );
1127 int UtcDaliHandleCustomPropertyInvalidToBool(void)
1129 TestApplication application;
1131 Handle handle = Handle::New();
1133 bool startValue(true);
1134 Property::Index index = handle.RegisterProperty( "testProperty", startValue, Property::READ_WRITE);
1135 DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), startValue, TEST_LOCATION );
1137 application.SendNotification();
1138 application.Render(0);
1139 DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), startValue, TEST_LOCATION );
1141 // Negative test i.e. there is no conversion from float to bool
1142 handle.SetProperty( index, float(0.0) );
1144 application.SendNotification();
1145 application.Render(0);
1146 DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), startValue, TEST_LOCATION );
1148 // Positive test (sanity check)
1149 bool endValue(false);
1150 handle.SetProperty( index, endValue );
1151 DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), endValue, TEST_LOCATION );
1153 application.SendNotification();
1154 application.Render(0);
1155 DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), endValue, TEST_LOCATION );
1160 int UtcDaliHandleCustomPropertyInvalidToInt(void)
1162 TestApplication application;
1164 Handle handle = Handle::New();
1167 Property::Index index = handle.RegisterProperty( "testProperty", startValue );
1168 DALI_TEST_CHECK( handle.GetProperty<int>(index) == startValue );
1170 application.SendNotification();
1171 application.Render(0);
1172 DALI_TEST_CHECK( handle.GetProperty<int>(index) == startValue );
1174 // Negative test i.e. there is no conversion from Vector3 to int
1175 handle.SetProperty( index, Vector3(1,2,3) );
1177 application.SendNotification();
1178 application.Render(0);
1179 DALI_TEST_CHECK( handle.GetProperty<int>(index) == startValue );
1183 int UtcDaliHandleCustomPropertyInvalidToFloat(void)
1185 TestApplication application;
1187 Handle handle = Handle::New();
1189 float startValue(5.0);
1190 Property::Index index = handle.RegisterProperty( "testProperty", startValue );
1191 DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
1193 application.SendNotification();
1194 application.Render(0);
1195 DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
1197 // Negative test i.e. there is no conversion from Vector3 to float
1198 handle.SetProperty( index, Vector3(1,2,3) );
1200 application.SendNotification();
1201 application.Render(0);
1202 DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
1206 int UtcDaliHandleCustomPropertyInvalidToRotation(void)
1208 TestApplication application;
1210 Handle handle = Handle::New();
1212 Quaternion startValue( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1213 Property::Index index = handle.RegisterProperty( "testProperty", startValue );
1214 DALI_TEST_CHECK( handle.GetProperty<Quaternion>(index) == startValue );
1216 application.SendNotification();
1217 application.Render(0);
1218 DALI_TEST_CHECK( handle.GetProperty<Quaternion>(index) == startValue );
1220 // Negative test i.e. there is no conversion from float to Quaternion
1221 handle.SetProperty( index, float(7.0) );
1223 application.SendNotification();
1224 application.Render(0);
1225 DALI_TEST_CHECK( handle.GetProperty<Quaternion>(index) == startValue );
1227 // Positive test (sanity check)
1228 Quaternion endValue( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1229 handle.SetProperty( index, endValue );
1230 DALI_TEST_CHECK( handle.GetProperty<Quaternion>(index) == endValue );
1235 int UtcDaliHandleCustomPropertyInvalidToMatrix(void)
1237 TestApplication application;
1239 Handle handle = Handle::New();
1241 Quaternion rotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1242 Matrix startValue(rotation);
1243 Property::Index index = handle.RegisterProperty( "testProperty", startValue );
1244 DALI_TEST_CHECK( handle.GetProperty<Matrix>(index) == startValue );
1246 application.SendNotification();
1247 application.Render(0);
1248 DALI_TEST_CHECK( handle.GetProperty<Matrix>(index) == startValue );
1250 // Negative test i.e. there is no conversion from float to Matrix
1251 handle.SetProperty( index, float(7.0) );
1253 application.SendNotification();
1254 application.Render(0);
1255 DALI_TEST_CHECK( handle.GetProperty<Matrix>(index) == startValue );
1257 // Positive test (sanity check)
1258 Quaternion endRotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1259 Matrix endValue(endRotation);
1260 handle.SetProperty( index, endValue );
1261 DALI_TEST_CHECK( handle.GetProperty<Matrix>(index) == endValue );
1266 int UtcDaliHandleCustomPropertyInvalidToMatrix3(void)
1268 TestApplication application;
1270 Handle handle = Handle::New();
1272 Matrix3 startValue(11,12,13,
1276 Property::Index index = handle.RegisterProperty( "testProperty", startValue );
1277 DALI_TEST_CHECK( handle.GetProperty<Matrix3>(index) == startValue );
1279 application.SendNotification();
1280 application.Render(0);
1281 DALI_TEST_CHECK( handle.GetProperty<Matrix3>(index) == startValue );
1283 // Negative test i.e. there is no conversion from float to Matrix3
1284 handle.SetProperty( index, float(7.0) );
1286 application.SendNotification();
1287 application.Render(0);
1288 DALI_TEST_CHECK( handle.GetProperty<Matrix3>(index) == startValue );
1290 // Positive test (sanity check)
1291 Matrix3 endValue(31,32,33,
1294 handle.SetProperty( index, endValue );
1295 DALI_TEST_CHECK( handle.GetProperty<Matrix3>(index) == endValue );
1300 int UtcDaliHandleWeightNew(void)
1302 TestApplication application;
1304 Handle handle = WeightObject::New();
1305 DALI_TEST_CHECK( handle.GetProperty<float>(WeightObject::WEIGHT) == 0.0f );
1307 // process the message so scene object is added to update manager
1308 application.SendNotification();
1309 application.Render(0);
1311 // no message to release scene object in this scenario
1316 int UtcDaliHandleWeightNew2(void)
1318 TestApplication application;
1320 // scope for the weight object
1322 Handle handle = WeightObject::New();
1323 DALI_TEST_CHECK( handle.GetProperty<float>(WeightObject::WEIGHT) == 0.0f );
1325 // process the message so scene object is added to update manager
1326 application.SendNotification();
1327 application.Render(0);
1329 // handle out of scope so object gets destroyed
1330 // process the message so update manager destroys the scene object
1331 application.SendNotification();
1332 application.Render(0);
1337 int UtcDaliHandleSetTypeInfo(void)
1339 TestApplication application;
1340 TypeRegistry typeRegistry = TypeRegistry::Get();
1342 TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
1343 DALI_TEST_CHECK( typeInfo );
1345 Actor actor = Actor::DownCast(typeInfo.CreateInstance());
1346 DALI_TEST_CHECK( actor );
1348 DevelHandle::SetTypeInfo(actor, typeInfo);
1350 TypeInfo newTypeInfo;
1351 bool success = actor.GetTypeInfo( newTypeInfo );
1352 DALI_TEST_CHECK( success );
1354 DALI_TEST_CHECK(typeInfo.GetName() == newTypeInfo.GetName());
1355 DALI_TEST_CHECK(typeInfo.GetBaseName() == newTypeInfo.GetBaseName());
1360 int UtcDaliHandleCustomPropertySynchronousGetSet(void)
1362 TestApplication application;
1364 tet_infoline( "Create a custom property and set the value ensuring it can be retrieved synchronously" );
1366 Actor actor = Actor::New();
1367 Stage::GetCurrent().Add( actor );
1369 tet_infoline( "Create the custom property with an initial value" );
1370 float startValue(1.0f);
1371 Property::Index index = actor.RegisterProperty( "testProperty", startValue );
1372 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), startValue, TEST_LOCATION );
1374 tet_infoline( "Set the value, retrieve it and ensure both the synchronous and the async version work" );
1375 actor.SetProperty( index, 5.0f );
1376 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), 5.0f, TEST_LOCATION );
1377 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
1379 tet_infoline( "Render and retrieve values again" );
1380 application.SendNotification();
1381 application.Render(0);
1383 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), 5.0f, TEST_LOCATION );
1384 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 5.0f, TEST_LOCATION );
1389 int UtcDaliHandleCustomPropertyGetType(void)
1391 TestApplication application;
1393 tet_infoline( "Create a custom property and retrieve its type" );
1395 Handle handle = Handle::New();
1396 Property::Index index = handle.RegisterProperty( "testProperty", 1.0f );
1397 DALI_TEST_EQUALS( handle.GetPropertyType( index ), Property::FLOAT, TEST_LOCATION );
1402 int UtcDaliHandleCustomPropertyAccessMode(void)
1404 TestApplication application;
1406 tet_infoline( "Create a custom property and retrieve whether it's animatable etc." );
1408 Handle handle = Handle::New();
1409 Property::Index index = handle.RegisterProperty( "testProperty", 1.0f );
1410 DALI_TEST_EQUALS( handle.IsPropertyAnimatable( index ), true, TEST_LOCATION );
1411 DALI_TEST_EQUALS( handle.IsPropertyWritable( index ), true, TEST_LOCATION );
1413 index = handle.RegisterProperty( "testProperty2", 1.0f, Property::READ_ONLY );
1414 DALI_TEST_EQUALS( handle.IsPropertyAnimatable( index ), false, TEST_LOCATION );
1415 DALI_TEST_EQUALS( handle.IsPropertyWritable( index ), false, TEST_LOCATION );
1417 index = handle.RegisterProperty( "testProperty3", 1.0f, Property::READ_WRITE );
1418 DALI_TEST_EQUALS( handle.IsPropertyAnimatable( index ), false, TEST_LOCATION );
1419 DALI_TEST_EQUALS( handle.IsPropertyWritable( index ), true, TEST_LOCATION );
1424 int UtcDaliHandleGetCurrentProperty(void)
1426 TestApplication application;
1428 tet_infoline( "Get a default and non-animatable custom property using the GetCurrentProperty API" );
1430 Actor actor = Actor::New();
1431 Stage::GetCurrent().Add( actor );
1432 DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
1434 Property::Index index = actor.RegisterProperty( "testProperty3", 1.0f, Property::READ_WRITE );
1435 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), 1.0f, TEST_LOCATION );
1436 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 1.0f, TEST_LOCATION );
1438 actor.SetProperty( index, 2.0f );
1439 DALI_TEST_EQUALS( actor.GetProperty< float >( index ), 2.0f, TEST_LOCATION );
1440 DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 2.0f, TEST_LOCATION );
1445 int UtcDaliHandleDoesCustomPropertyExistP1(void)
1447 TestApplication application; // Needs type registry
1449 tet_infoline( "Test if a registered custom property exists on object" );
1451 Actor actor = Actor::New();
1452 auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f);
1454 DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( actor, propertyIndex ), true, TEST_LOCATION );
1458 int UtcDaliHandleDoesCustomPropertyExistN1(void)
1460 TestApplication application; // Needs type registry
1462 tet_infoline( "Test if a registered custom property does not exist on object" );
1464 Actor actor = Actor::New();
1465 auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f);
1467 DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( actor, propertyIndex+1 ), false, TEST_LOCATION );
1471 int UtcDaliHandleDoesCustomPropertyExistN2(void)
1473 TestApplication application; // Needs type registry
1475 tet_infoline( "Test that a default property does not show as a custom property on object" );
1477 Actor actor = Actor::New();
1478 DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( actor, Actor::Property::POSITION ), false, TEST_LOCATION );
1482 int UtcDaliHandleDoesCustomPropertyExistN3(void)
1484 TestApplication application; // Needs type registry
1486 tet_infoline( "Test that a child property does not exist on actor after parenting to container" );
1487 TypeRegistry typeRegistry = TypeRegistry::Get();
1489 auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) );
1491 const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX );
1492 const char* CHILD_PROPERTY_NAME( "childProperty" );
1494 ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER );
1496 auto container = Test::TestCustomActor::New();
1497 Stage::GetCurrent().Add( container );
1498 auto child = Actor::New();
1499 container.Add( child ); // Resolve child properties (if any)
1501 DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( child, CHILD_PROPERTY ), false, TEST_LOCATION );
1505 int UtcDaliHandleDoesCustomPropertyExistP2(void)
1507 TestApplication application; // Needs type registry
1509 tet_infoline( "Test that a child property exists after being set" );
1510 TypeRegistry typeRegistry = TypeRegistry::Get();
1512 auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) );
1514 const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX );
1515 const char* CHILD_PROPERTY_NAME( "childProperty" );
1517 ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER );
1519 auto container = Test::TestCustomActor::New();
1520 Stage::GetCurrent().Add( container );
1521 auto child = Actor::New();
1522 container.Add( child ); // Resolve child properties (if any)
1523 child.SetProperty( CHILD_PROPERTY, 2 );
1525 DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( child, CHILD_PROPERTY ), true, TEST_LOCATION );
1526 DALI_TEST_EQUALS( child.GetProperty<int>( CHILD_PROPERTY ), 2, TEST_LOCATION );
1530 int UtcDaliHandleDoesCustomPropertyExistP3(void)
1532 TestApplication application; // Needs type registry
1534 tet_infoline( "Test that a child property is re-indexed after registration, and that it exists" );
1535 TypeRegistry typeRegistry = TypeRegistry::Get();
1537 auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) );
1539 const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX );
1540 const char* CHILD_PROPERTY_NAME( "childProperty" );
1542 ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER );
1544 auto container = Test::TestCustomActor::New();
1545 Stage::GetCurrent().Add( container );
1546 auto child = Actor::New();
1547 child.RegisterProperty( CHILD_PROPERTY_NAME, Property::Value(3) );
1548 container.Add( child ); // Resolve child properties (if any)
1550 DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( child, CHILD_PROPERTY ), true, TEST_LOCATION );
1551 DALI_TEST_EQUALS( child.GetProperty<int>( CHILD_PROPERTY ), 3, TEST_LOCATION );
1558 struct PropertySetSignalCheck
1560 PropertySetSignalCheck(bool& signalReceived, Property::Value& value)
1561 : mSignalReceived(signalReceived),
1566 void operator()(Handle& handle, Property::Index index, Property::Value value)
1568 mSignalReceived = true;
1574 mSignalReceived = false;
1577 void CheckSignalReceived()
1579 if (!mSignalReceived)
1581 tet_printf("Expected Property Set signal was not received\n");
1582 tet_result(TET_FAIL);
1586 tet_result(TET_PASS);
1590 bool& mSignalReceived; // owned by individual tests
1591 Property::Value& mValue;
1596 int UtcDaliHandlePropertySetSignal01(void)
1598 TestApplication app;
1600 bool signalReceived(false);
1601 Property::Value value;
1602 PropertySetSignalCheck propertySetCheck(signalReceived, value);
1604 tet_infoline( "Test that setting a default property triggers a signal" );
1606 auto actor = Actor::New();
1607 DevelHandle::PropertySetSignal(actor).Connect(&app, propertySetCheck);
1609 actor.SetProperty( Actor::Property::POSITION, Vector3::XAXIS );
1610 propertySetCheck.CheckSignalReceived();
1616 int UtcDaliHandlePropertySetSignal02(void)
1618 TestApplication app;
1620 bool signalReceived(false);
1621 Property::Value value;
1622 PropertySetSignalCheck propertySetCheck(signalReceived, value);
1624 tet_infoline( "Test that setting a custom property triggers a signal" );
1626 auto actor = Actor::New();
1627 DevelHandle::PropertySetSignal(actor).Connect(&app, propertySetCheck);
1629 auto propertyIndex = actor.RegisterProperty("propName", 3.0f);
1630 actor.SetProperty( propertyIndex, 5.0f );
1631 propertySetCheck.CheckSignalReceived();
1632 DALI_TEST_EQUALS( propertySetCheck.mValue, Property::Value( 5.0f ), 0.001f, TEST_LOCATION );
1637 int UtcDaliHandlePropertySetSignal03(void)
1639 TestApplication app;
1640 TypeRegistry typeRegistry = TypeRegistry::Get();
1642 bool signalReceived(false);
1643 Property::Value value;
1644 PropertySetSignalCheck propertySetCheck(signalReceived, value);
1646 tet_infoline( "Test that setting a child property triggers a signal" );
1648 auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) );
1650 const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX );
1651 const char* CHILD_PROPERTY_NAME( "childProperty" );
1653 ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER );
1655 auto container = Test::TestCustomActor::New();
1656 Stage::GetCurrent().Add( container );
1657 auto child = Actor::New();
1658 child.RegisterProperty( CHILD_PROPERTY_NAME, Property::Value(3) );
1659 DevelHandle::PropertySetSignal(child).Connect(&app, propertySetCheck);
1660 container.Add( child ); // Resolve child properties (if any)
1662 DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( child, CHILD_PROPERTY ), true, TEST_LOCATION );
1663 DALI_TEST_EQUALS( child.GetProperty<int>( CHILD_PROPERTY ), 3, TEST_LOCATION );
1665 child.SetProperty( CHILD_PROPERTY, 29 );
1666 propertySetCheck.CheckSignalReceived();
1667 DALI_TEST_EQUALS( propertySetCheck.mValue, Property::Value( 29 ), TEST_LOCATION );