[dali_1.2.7] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Handle.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 #include <iostream>
19
20 #include <stdlib.h>
21 #include <dali/public-api/dali-core.h>
22 #include "dali-test-suite-utils/dali-test-suite-utils.h"
23 #include <mesh-builder.h>
24
25 using namespace Dali;
26
27 void handle_test_startup(void)
28 {
29   test_return_value = TET_UNDEF;
30 }
31
32 void handle_test_cleanup(void)
33 {
34   test_return_value = TET_PASS;
35 }
36
37 namespace
38 {
39
40 /// Allows the creation of a BaseObject
41 class BaseObjectType : public BaseObject
42 {
43 public:
44   BaseObjectType()
45   {
46   }
47 };
48
49 Handle ImplicitCopyConstructor(Handle passedByValue)
50 {
51   // object + copy + passedByValue, ref count == 3
52   DALI_TEST_CHECK(passedByValue);
53   if (passedByValue)
54   {
55     DALI_TEST_EQUALS(3, passedByValue.GetBaseObject().ReferenceCount(), TEST_LOCATION);
56   }
57
58   return passedByValue;
59 }
60
61 } // anon namespace
62
63
64 int UtcDaliHandleConstructorVoid(void)
65 {
66   TestApplication application;
67   tet_infoline("Testing Dali::Handle::Handle()");
68
69   Handle object;
70
71   DALI_TEST_CHECK(!object);
72
73   END_TEST;
74 }
75
76 int UtcDaliHandleCopyConstructor(void)
77 {
78   TestApplication application;
79   tet_infoline("Testing Dali::Handle::Handle(const Handle&)");
80
81   // Initialize an object, ref count == 1
82   Handle object = Actor::New();
83
84   DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION);
85
86   // Copy the object, ref count == 2
87   Handle copy(object);
88   DALI_TEST_CHECK(copy);
89   if (copy)
90   {
91     DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
92   }
93
94   {
95     // Pass by value, and return another copy, ref count == 3
96     Handle anotherCopy = ImplicitCopyConstructor(copy);
97
98     DALI_TEST_CHECK(anotherCopy);
99     if (anotherCopy)
100     {
101       DALI_TEST_EQUALS(3, anotherCopy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
102     }
103   }
104
105   // anotherCopy out of scope, ref count == 2
106   DALI_TEST_CHECK(copy);
107   if (copy)
108   {
109     DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
110   }
111   END_TEST;
112 }
113
114 int UtcDaliHandleAssignmentOperator(void)
115 {
116   TestApplication application;
117   tet_infoline("Testing Dali::Handle::operator=");
118
119   Handle object = Actor::New();
120
121   DALI_TEST_CHECK(object);
122   DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION);
123
124   Handle copy;
125   DALI_TEST_CHECK(!copy);
126
127   copy = object;
128   DALI_TEST_CHECK(copy);
129   DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
130   DALI_TEST_CHECK(&(copy.GetBaseObject()) == &(object.GetBaseObject()));
131   END_TEST;
132 }
133
134 int UtcDaliHandleSupports(void)
135 {
136   tet_infoline("Positive Test Dali::Handle::Supports()");
137   TestApplication application;
138
139   Actor actor = Actor::New();
140   DALI_TEST_CHECK( true == actor.Supports( Handle::DYNAMIC_PROPERTIES ) );
141   END_TEST;
142 }
143
144 int UtcDaliHandleGetPropertyCount(void)
145 {
146   tet_infoline("Positive Test Dali::Handle::GetPropertyCount()");
147   TestApplication application;
148
149   Actor actor = Actor::New();
150   int defaultPropertyCount( actor.GetPropertyCount() );
151
152   // Register a dynamic property
153   actor.RegisterProperty( "testProperty",  float(123.0f) );
154   DALI_TEST_CHECK( (defaultPropertyCount + 1u) == actor.GetPropertyCount() );
155   END_TEST;
156 }
157
158 int UtcDaliHandleGetPropertyName(void)
159 {
160   tet_infoline("Positive Test Dali::Handle::GetPropertyName()");
161   TestApplication application;
162
163   Actor actor = Actor::New();
164   DALI_TEST_CHECK( "parentOrigin" == actor.GetPropertyName( Actor::Property::PARENT_ORIGIN ) );
165
166   // Register a dynamic property
167   std::string name("thisNameShouldMatch");
168   Property::Index index = actor.RegisterProperty( name, float(123.0f) );
169   DALI_TEST_CHECK( name == actor.GetPropertyName( index ) );
170
171   END_TEST;
172 }
173
174 int UtcDaliHandleGetPropertyIndex01(void)
175 {
176   tet_infoline("Positive Test Dali::Handle::GetPropertyIndex()");
177   TestApplication application;
178
179   Actor actor = Actor::New();
180   DALI_TEST_CHECK( Actor::Property::PARENT_ORIGIN == actor.GetPropertyIndex("parentOrigin") );
181
182   // Register a dynamic property
183   std::string name("thisNameShouldMatch");
184   Property::Index index = actor.RegisterProperty( name, float(123.0f) );
185   DALI_TEST_CHECK( index == actor.GetPropertyIndex( name ) );
186   END_TEST;
187 }
188
189 int UtcDaliHandleGetPropertyIndex02(void)
190 {
191   tet_infoline("Positive Test Dali::Handle::GetPropertyIndex() int key");
192   TestApplication application;
193
194   Stage stage = Stage::GetCurrent();
195
196   Actor actor = Actor::New();
197   stage.Add( actor );
198
199   const unsigned int defaultPropertyCount = actor.GetPropertyCount();
200
201   application.SendNotification();
202   application.Render();
203
204   Property::Index key1 = CORE_PROPERTY_MAX_INDEX+1;
205   Property::Index key2 = CORE_PROPERTY_MAX_INDEX+2;
206
207   const Vector4 testColor(0.5f, 0.2f, 0.9f, 1.0f);
208   const float withFlake(99.f);
209
210   Property::Index index1 = actor.RegisterProperty( "MyPropertyOne", Vector3::ONE );
211   Property::Index index2 = actor.RegisterProperty( key1, "sideColor", testColor);
212   Property::Index index3 = actor.RegisterProperty( "MyPropertyTwo", Vector3::ONE );
213   Property::Index index4 = actor.RegisterProperty( key2, "iceCream", withFlake );
214   Property::Index index5 = actor.RegisterProperty( "MyPropertyThree", Vector3::ONE );
215
216   application.SendNotification();
217   application.Render();
218
219   // Test that we can get the property index from the integer key
220   Property::Index testIndex1 = actor.GetPropertyIndex( key1 );
221   Property::Index testIndex2 = actor.GetPropertyIndex( key2 );
222
223   DALI_TEST_EQUALS( index2, testIndex1, TEST_LOCATION );
224   DALI_TEST_EQUALS( index4, testIndex2, TEST_LOCATION );
225
226   // Test that we keep the same indices on the named properties
227   Property::Index testIndex = actor.GetPropertyIndex("MyPropertyOne");
228   DALI_TEST_EQUALS(testIndex, index1, TEST_LOCATION);
229   testIndex = actor.GetPropertyIndex("MyPropertyTwo");
230   DALI_TEST_EQUALS(testIndex, index3, TEST_LOCATION);
231   testIndex = actor.GetPropertyIndex("MyPropertyThree");
232   DALI_TEST_EQUALS(testIndex, index5, TEST_LOCATION);
233   testIndex = actor.GetPropertyIndex("sideColor");
234   DALI_TEST_EQUALS(testIndex, index2, TEST_LOCATION);
235   testIndex = actor.GetPropertyIndex("iceCream");
236   DALI_TEST_EQUALS(testIndex, index4, TEST_LOCATION);
237
238   DALI_TEST_EQUALS(defaultPropertyCount+5, actor.GetPropertyCount(), TEST_LOCATION);
239   END_TEST;
240 }
241
242 int UtcDaliHandleGetPropertyIndex03(void)
243 {
244   TestApplication application;
245
246   Actor actor = Actor::New();
247
248   std::string myName("croydon");
249   Property::Index intKey = CORE_PROPERTY_MAX_INDEX+1;
250   Property::Value value( Color::GREEN );
251   Property::Index myIndex = actor.RegisterProperty( intKey, myName, value );
252
253   DALI_TEST_EQUALS( myIndex, actor.GetPropertyIndex( intKey ), TEST_LOCATION );
254
255   Property::Key key1(myName);
256   Property::Key key2(intKey);
257
258   DALI_TEST_EQUALS( myIndex, actor.GetPropertyIndex( key1 ), TEST_LOCATION );
259   DALI_TEST_EQUALS( myIndex, actor.GetPropertyIndex( key2 ), TEST_LOCATION );
260   END_TEST;
261 }
262
263
264 int UtcDaliHandleIsPropertyWritable(void)
265 {
266   tet_infoline("Positive Test Dali::Handle::IsPropertyWritable()");
267   TestApplication application;
268
269   Actor actor = Actor::New();
270
271   // Actor properties which are writable:
272   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN ) );
273   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN_X ) );
274   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN_Y ) );
275   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN_Z ) );
276   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT ) );
277   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT_X ) );
278   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT_Y ) );
279   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT_Z ) );
280   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE ) );
281   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE_WIDTH  ) );
282   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE_HEIGHT ) );
283   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE_DEPTH  ) );
284   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION ) );
285   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION_X ) );
286   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION_Y ) );
287   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION_Z ) );
288   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ORIENTATION ) );
289   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE ) );
290   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE_X ) );
291   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE_Y ) );
292   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE_Z ) );
293   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::VISIBLE ) );
294   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR ) );
295   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_RED ) );
296   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_GREEN ) );
297   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_BLUE ) );
298   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_ALPHA ) );
299
300   // World-properties are not writable:
301   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION ) );
302   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_ORIENTATION ) );
303   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_SCALE ) );
304   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_COLOR ) );
305   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION_X ) );
306   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION_Y ) );
307   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION_Z ) );
308
309   END_TEST;
310 }
311
312 int UtcDaliHandleIsPropertyAnimatable(void)
313 {
314   tet_infoline("Positive Test Dali::Handle::IsPropertyAnimatable()");
315   TestApplication application;
316
317   Actor actor = Actor::New();
318
319   // Actor properties which are animatable:
320   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN ) );
321   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN_X ) );
322   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN_Y ) );
323   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN_Z ) );
324   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT ) );
325   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT_X ) );
326   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT_Y ) );
327   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT_Z ) );
328   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE ) );
329   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE_WIDTH  ) );
330   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE_HEIGHT ) );
331   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE_DEPTH  ) );
332   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION ) );
333   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION_X ) );
334   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION_Y ) );
335   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION_Z ) );
336   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::ORIENTATION ) );
337   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE ) );
338   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE_X ) );
339   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE_Y ) );
340   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE_Z ) );
341   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::VISIBLE ) );
342   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR ) );
343   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_RED ) );
344   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_GREEN ) );
345   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_BLUE ) );
346   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_ALPHA ) );
347
348   // World-properties can not be animated
349   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION ) );
350   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_ORIENTATION ) );
351   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_SCALE ) );
352   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_COLOR ) );
353   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION_X ) );
354   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION_Y ) );
355   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION_Z ) );
356
357   END_TEST;
358 }
359
360 int UtcDaliHandleIsPropertyAConstraintInput(void)
361 {
362   TestApplication application;
363
364   Actor actor = Actor::New();
365
366   // Actor properties which can be used as a constraint input:
367   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN ) );
368   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN_X ) );
369   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN_Y ) );
370   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN_Z ) );
371   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT ) );
372   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT_X ) );
373   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT_Y ) );
374   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT_Z ) );
375   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE ) );
376   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_WIDTH  ) );
377   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_HEIGHT ) );
378   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_DEPTH  ) );
379   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION ) );
380   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_X ) );
381   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_Y ) );
382   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_Z ) );
383   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ORIENTATION ) );
384   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE ) );
385   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE_X ) );
386   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE_Y ) );
387   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE_Z ) );
388   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::VISIBLE ) );
389   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR ) );
390   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_RED ) );
391   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_GREEN ) );
392   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_BLUE ) );
393   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_ALPHA ) );
394   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION ) );
395   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_ORIENTATION ) );
396   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_SCALE ) );
397   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_COLOR ) );
398   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION_X ) );
399   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION_Y ) );
400   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION_Z ) );
401
402   // Actor properties that cannot be used as a constraint input
403   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::NAME ) );
404   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::SENSITIVE ) );
405   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::LEAVE_REQUIRED ) );
406   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::INHERIT_ORIENTATION ) );
407   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::INHERIT_SCALE ) );
408   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_MODE ) );
409   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_INHERITANCE ) );
410   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::DRAW_MODE ) );
411   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_MODE_FACTOR ) );
412
413   END_TEST;
414 }
415
416
417 int UtcDaliHandleGetPropertyType(void)
418 {
419   tet_infoline("Positive Test Dali::Handle::GetPropertyType()");
420   TestApplication application;
421
422   Actor actor = Actor::New();
423   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( Actor::Property::PARENT_ORIGIN ) );
424   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( Actor::Property::ANCHOR_POINT ) );
425   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( Actor::Property::SIZE ) );
426   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( Actor::Property::POSITION ) );
427   DALI_TEST_CHECK( Property::ROTATION == actor.GetPropertyType( Actor::Property::ORIENTATION ) );
428   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( Actor::Property::SCALE ) );
429   DALI_TEST_CHECK( Property::BOOLEAN  == actor.GetPropertyType( Actor::Property::VISIBLE ) );
430   DALI_TEST_CHECK( Property::VECTOR4  == actor.GetPropertyType( Actor::Property::COLOR ) );
431
432   // Register some dynamic properties
433   Property::Index boolIndex     = actor.RegisterProperty( "boolProperty",      bool(true) );
434   Property::Index floatIndex    = actor.RegisterProperty( "floatProperty",     float(123.0f) );
435   Property::Index intIndex      = actor.RegisterProperty( "intProperty",       123 );
436   Property::Index vector2Index  = actor.RegisterProperty( "vector2Property",   Vector2(1.0f, 2.0f) );
437   Property::Index vector3Index  = actor.RegisterProperty( "vector3Property",   Vector3(1.0f, 2.0f, 3.0f) );
438   Property::Index vector4Index  = actor.RegisterProperty( "vector4Property",   Vector4(1.0f, 2.0f, 3.0f, 4.0f) );
439   Property::Index rotationIndex = actor.RegisterProperty( "rotationProperty",  AngleAxis(Degree(180.0f), Vector3::YAXIS) );
440
441   DALI_TEST_CHECK( Property::BOOLEAN  == actor.GetPropertyType( boolIndex ) );
442   DALI_TEST_CHECK( Property::FLOAT    == actor.GetPropertyType( floatIndex ) );
443   DALI_TEST_CHECK( Property::INTEGER  == actor.GetPropertyType( intIndex ) );
444   DALI_TEST_CHECK( Property::VECTOR2  == actor.GetPropertyType( vector2Index ) );
445   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( vector3Index ) );
446   DALI_TEST_CHECK( Property::VECTOR4  == actor.GetPropertyType( vector4Index ) );
447   DALI_TEST_CHECK( Property::ROTATION == actor.GetPropertyType( rotationIndex ) );
448
449   // Non animatable properties
450   Property::Index nonAnimStringIndex = actor.RegisterProperty( "manFromDelmonte",   std::string("yes"), Property::READ_WRITE);
451   Property::Index nonAnimV2Index = actor.RegisterProperty( "v2", Vector2(1.f, 2.f), Property::READ_WRITE);
452   Property::Index nonAnimV3Index = actor.RegisterProperty( "v3", Vector3(1.f, 2.f, 3.f), Property::READ_WRITE);
453   Property::Index nonAnimV4Index = actor.RegisterProperty( "v4", Vector4(1.f, 2.f, 3.f, 4.f), Property::READ_WRITE);
454   Property::Index nonAnimBooleanIndex = actor.RegisterProperty( "bool", true, Property::READ_WRITE);
455   Property::Index nonAnimFloatIndex = actor.RegisterProperty( "float", 0.f, Property::READ_WRITE);
456   Property::Index nonAnimIntegerIndex = actor.RegisterProperty( "int", 0, Property::READ_WRITE);
457
458   DALI_TEST_CHECK( nonAnimStringIndex  != Property::INVALID_INDEX );
459   DALI_TEST_CHECK( nonAnimV2Index      != Property::INVALID_INDEX );
460   DALI_TEST_CHECK( nonAnimV3Index      != Property::INVALID_INDEX );
461   DALI_TEST_CHECK( nonAnimV4Index      != Property::INVALID_INDEX );
462   DALI_TEST_CHECK( nonAnimBooleanIndex != Property::INVALID_INDEX );
463   DALI_TEST_CHECK( nonAnimFloatIndex   != Property::INVALID_INDEX );
464   DALI_TEST_CHECK( nonAnimIntegerIndex != Property::INVALID_INDEX );
465
466   DALI_TEST_CHECK( Property::STRING   == actor.GetPropertyType( nonAnimStringIndex ) );
467   DALI_TEST_CHECK( Property::VECTOR2  == actor.GetPropertyType( nonAnimV2Index ) );
468   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( nonAnimV3Index ) );
469   DALI_TEST_CHECK( Property::VECTOR4  == actor.GetPropertyType( nonAnimV4Index ) );
470   DALI_TEST_CHECK( Property::BOOLEAN  == actor.GetPropertyType( nonAnimBooleanIndex ) );
471   DALI_TEST_CHECK( Property::FLOAT    == actor.GetPropertyType( nonAnimFloatIndex ) );
472   DALI_TEST_CHECK( Property::INTEGER  == actor.GetPropertyType( nonAnimIntegerIndex ) );
473
474   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimStringIndex ) );
475   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV2Index ) );
476   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV3Index ) );
477   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV4Index ) );
478   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimBooleanIndex ) );
479   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimFloatIndex ) );
480   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimIntegerIndex ) );
481
482   DALI_TEST_EQUALS( "yes" , actor.GetProperty( nonAnimStringIndex ).Get<std::string>(), TEST_LOCATION );
483   DALI_TEST_EQUALS( Vector2(1.f, 2.f) , actor.GetProperty( nonAnimV2Index ).Get<Vector2>(), TEST_LOCATION );
484   DALI_TEST_EQUALS( Vector3(1.f, 2.f, 3.f) , actor.GetProperty( nonAnimV3Index ).Get<Vector3>(), TEST_LOCATION );
485   DALI_TEST_EQUALS( Vector4(1.f, 2.f, 3.f, 4.f) , actor.GetProperty( nonAnimV4Index ).Get<Vector4>(), TEST_LOCATION );
486   DALI_TEST_EQUALS( true, actor.GetProperty( nonAnimBooleanIndex ).Get<bool>(), TEST_LOCATION );
487   DALI_TEST_EQUALS( 0.f, actor.GetProperty( nonAnimFloatIndex ).Get<float>(), TEST_LOCATION );
488   DALI_TEST_EQUALS( 0, actor.GetProperty( nonAnimIntegerIndex ).Get<int>(), TEST_LOCATION );
489
490   END_TEST;
491 }
492
493 int UtcDaliHandleNonAnimtableProperties(void)
494 {
495   tet_infoline("Test Non Animatable Properties");
496   TestApplication application;
497
498   Actor actor = Actor::New();
499
500   Property::Index nonAnimStringIndex = actor.RegisterProperty( "manFromDelmonte",   std::string("no"), Property::READ_WRITE);
501
502   //// modify writable?
503   try
504   {
505     actor.SetProperty( nonAnimStringIndex, Property::Value("yes") );
506   }
507   catch (Dali::DaliException& e)
508   {
509     DALI_TEST_CHECK(!"exception");
510   }
511
512   DALI_TEST_CHECK( "yes"  == actor.GetProperty( nonAnimStringIndex ).Get<std::string>() );
513
514   //// cannot modify read only?
515   Property::Index readonly = actor.RegisterProperty( "float", 0.f, Property::READ_ONLY);
516
517   DALI_TEST_CHECK(!actor.IsPropertyAnimatable(readonly));
518   DALI_TEST_CHECK(!actor.IsPropertyWritable(readonly));
519
520   bool exception = false;
521   try
522   {
523     actor.SetProperty( readonly, Property::Value(1.f) );
524   }
525   catch (Dali::DaliException& e)
526   {
527     exception = true;
528   }
529
530   DALI_TEST_CHECK(!exception);// trying to set a read-only property is a no-op
531
532   DALI_TEST_EQUALS( 0.f, actor.GetProperty( readonly ).Get<float>(), TEST_LOCATION );
533
534   /// animatable can be set
535   Property::Index write_anim = actor.RegisterProperty( "write_float", 0.f, Property::ANIMATABLE);
536
537   DALI_TEST_CHECK(actor.IsPropertyAnimatable(write_anim));
538   DALI_TEST_CHECK(actor.IsPropertyWritable(write_anim));
539
540   exception = false;
541   try
542   {
543     actor.SetProperty( write_anim, Property::Value(1.f) );
544   }
545   catch (Dali::DaliException& e)
546   {
547     exception = true;
548   }
549
550   DALI_TEST_CHECK(!exception);
551
552   //// animate a non animatable property is a noop?
553   float durationSeconds(2.0f);
554   Animation animation = Animation::New(durationSeconds);
555   bool relativeValue(true);
556
557   exception = false;
558
559   try
560   {
561     animation.AnimateBy(Property(actor, nonAnimStringIndex), relativeValue, AlphaFunction::EASE_IN);
562     animation.Play();
563     application.SendNotification();
564     application.Render(static_cast<unsigned int>(durationSeconds*0100.0f)/* some progress */);
565   }
566   catch (Dali::DaliException& e)
567   {
568     exception = true;
569   }
570
571   DALI_TEST_CHECK(!exception);
572   DALI_TEST_EQUALS( "yes", actor.GetProperty( nonAnimStringIndex ).Get<std::string>(), TEST_LOCATION );
573
574   END_TEST;
575 }
576
577 int UtcDaliHandleNonAnimtableCompositeProperties(void)
578 {
579   tet_infoline("Test Non Animatable Composite Properties");
580   TestApplication application;
581
582   Actor actor = Actor::New();
583
584   Property::Value value(Property::ARRAY);
585   Property::Array* array = value.GetArray();
586   DALI_TEST_CHECK( array );
587
588   array->PushBack( Property::Value( 0.1f ) );
589   array->PushBack( "a string" );
590   array->PushBack( Property::Value( Vector3(1,2,3) ) );
591
592   DALI_TEST_EQUALS( 3u, array->Count(), TEST_LOCATION );
593
594   Property::Index propertyIndex = actor.RegisterProperty( "composite", value, Property::READ_WRITE );
595
596   Property::Value out = actor.GetProperty( propertyIndex );
597   Property::Array* outArray = out.GetArray();
598   DALI_TEST_CHECK( outArray != NULL );
599
600   DALI_TEST_CHECK( Property::FLOAT     == outArray->GetElementAt(0).GetType());
601   DALI_TEST_CHECK( Property::STRING    == outArray->GetElementAt(1).GetType());
602   DALI_TEST_CHECK( Property::VECTOR3   == outArray->GetElementAt(2).GetType());
603
604   DALI_TEST_EQUALS( 0.1f,            outArray->GetElementAt(0).Get<float>(),       TEST_LOCATION);
605   DALI_TEST_EQUALS( "a string",     outArray->GetElementAt(1).Get<std::string>(),  TEST_LOCATION);
606   DALI_TEST_EQUALS( Vector3(1,2,3), outArray->GetElementAt(2).Get<Vector3>(),      TEST_LOCATION);
607
608   // composite types not animatable
609   bool exception = false;
610   try
611   {
612     actor.RegisterProperty( "compositemap", value, Property::ANIMATABLE);
613   }
614   catch (Dali::DaliException& e)
615   {
616     exception = true;
617     DALI_TEST_PRINT_ASSERT( e );
618   }
619
620   DALI_TEST_EQUALS(exception, true, TEST_LOCATION);
621
622   // Map of maps
623   Property::Value mapOfMaps(Property::MAP);
624   Property::Map* map = mapOfMaps.GetMap();
625
626   map->Insert( "key", Property::Value(Property::MAP) );
627   map->Insert( "2key", "a string" );
628
629   DALI_TEST_EQUALS( "a string",  (*map)["2key"].Get<std::string>(),  TEST_LOCATION);
630
631   Property::Map* innerMap = map->Find("key")->GetMap();
632   innerMap->Insert( "subkey", 5.f );
633
634   DALI_TEST_CHECK( NULL != map->Find("key")->GetMap()->Find("subkey") );
635   DALI_TEST_EQUALS( 5.f, map->Find("key")->GetMap()->Find("subkey")->Get<float>(), TEST_LOCATION);
636   END_TEST;
637 }
638
639 int UtcDaliHandleSetProperty01(void)
640 {
641   tet_infoline("Positive Test Dali::Handle::SetProperty()");
642   TestApplication application;
643
644   Actor actor = Actor::New();
645   DALI_TEST_CHECK( ParentOrigin::TOP_LEFT == actor.GetProperty( Actor::Property::PARENT_ORIGIN ).Get<Vector3>() );
646
647   actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
648   // flush the queue and render once
649   application.SendNotification();
650   application.Render();
651   DALI_TEST_CHECK( ParentOrigin::CENTER == actor.GetProperty( Actor::Property::PARENT_ORIGIN ).Get<Vector3>() );
652   END_TEST;
653 }
654
655 int UtcDaliHandleSetProperty02(void)
656 {
657   tet_infoline("Positive Test Dali::Handle::SetProperty()");
658   TestApplication application;
659
660   Actor actor = Actor::New();
661
662   DALI_TEST_CHECK( !actor.IsPropertyWritable( Actor::Property::WORLD_POSITION ) );
663
664   // World position is not writable so this is a no-op and should not crash
665   actor.SetProperty( Actor::Property::WORLD_POSITION, Vector3(1,2,3) );
666
667   END_TEST;
668 }
669
670 int UtcDaliHandleRegisterProperty01(void)
671 {
672   tet_infoline("Positive Test Dali::Handle::RegisterProperty()");
673   TestApplication application;
674
675   Stage stage = Stage::GetCurrent();
676
677   Actor actor = Actor::New();
678   stage.Add( actor );
679
680   const unsigned int defaultPropertyCount = actor.GetPropertyCount();
681
682   application.SendNotification();
683   application.Render();
684
685   Property::Index index1 = actor.RegisterProperty( "MyProperty", Vector3::ONE );
686
687   application.SendNotification();
688   application.Render();
689
690   DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 1, TEST_LOCATION );
691   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index1 ), Vector3::ONE, TEST_LOCATION );
692
693   // No new property should be registered when we call the below function
694   Property::Index index2 = actor.RegisterProperty( "MyProperty", Vector3::ZAXIS );
695
696   application.SendNotification();
697   application.Render();
698
699
700   DALI_TEST_EQUALS( index1, index2, TEST_LOCATION ); // We should have the same index as per the first registration
701   DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 1, TEST_LOCATION ); // Property count should be the same
702   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index2 ), Vector3::ZAXIS, TEST_LOCATION ); // Value should be what we sent on second RegisterProperty call
703
704   END_TEST;
705 }
706
707 int UtcDaliHandleRegisterProperty02(void)
708 {
709   tet_infoline("Positive Test Dali::Handle::RegisterProperty() int key");
710   TestApplication application;
711
712   Stage stage = Stage::GetCurrent();
713
714   Actor actor = Actor::New();
715   stage.Add( actor );
716
717   const unsigned int defaultPropertyCount = actor.GetPropertyCount();
718
719   application.SendNotification();
720   application.Render();
721
722   Property::Index key1 = CORE_PROPERTY_MAX_INDEX+1;
723   Property::Index key2 = CORE_PROPERTY_MAX_INDEX+2;
724
725   const Vector4 testColor(0.5f, 0.2f, 0.9f, 1.0f);
726   const float withFlake(99.f);
727
728   Property::Index index1 = actor.RegisterProperty( "MyPropertyOne", Vector3::ONE );
729   Property::Index index2 = actor.RegisterProperty( key1, "sideColor", testColor);
730   Property::Index index3 = actor.RegisterProperty( key2, "iceCream", withFlake );
731
732   application.SendNotification();
733   application.Render();
734
735   DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 3, TEST_LOCATION );
736   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index1 ), Vector3::ONE, TEST_LOCATION );
737   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index2 ), testColor, TEST_LOCATION );
738   DALI_TEST_EQUALS( actor.GetProperty< float >( index3 ), withFlake, TEST_LOCATION );
739
740   // No new property should be registered when we call the below functions
741   Property::Index testIndex2 = actor.RegisterProperty( "iceCream", 2200.f );
742   Property::Index testIndex1 = actor.RegisterProperty( "sideColor", Color::BLACK );
743   application.SendNotification();
744   application.Render();
745
746   DALI_TEST_EQUALS( index2, testIndex1, TEST_LOCATION ); // We should have the same index as per the first registration
747   DALI_TEST_EQUALS( index3, testIndex2, TEST_LOCATION ); // We should have the same index as per the first registration
748   DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 3, TEST_LOCATION ); // Property count should be the same
749   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index2 ), Color::BLACK, TEST_LOCATION ); // Value should be what we sent on second RegisterProperty call
750   DALI_TEST_EQUALS( actor.GetProperty< float >( index3 ), 2200.f, TEST_LOCATION );
751
752   END_TEST;
753 }
754
755
756
757 int UtcDaliHandleGetProperty(void)
758 {
759   tet_infoline("Positive Test Dali::Handle::GetProperty()");
760   TestApplication application;
761
762   Actor actor = Actor::New();
763
764   DALI_TEST_CHECK( ParentOrigin::TOP_LEFT == actor.GetProperty( Actor::Property::PARENT_ORIGIN   ).Get<Vector3>() );
765   DALI_TEST_CHECK( AnchorPoint::CENTER    == actor.GetProperty( Actor::Property::ANCHOR_POINT    ).Get<Vector3>() );
766   DALI_TEST_CHECK( Vector3::ZERO          == actor.GetProperty( Actor::Property::SIZE            ).Get<Vector3>() );
767   DALI_TEST_CHECK( Vector3::ZERO          == actor.GetProperty( Actor::Property::POSITION        ).Get<Vector3>() );
768   DALI_TEST_CHECK( Vector3::ONE           == actor.GetProperty( Actor::Property::SCALE           ).Get<Vector3>() );
769   DALI_TEST_CHECK( true                   == actor.GetProperty( Actor::Property::VISIBLE         ).Get<bool>() );
770   DALI_TEST_CHECK( Color::WHITE           == actor.GetProperty( Actor::Property::COLOR           ).Get<Vector4>() );
771   END_TEST;
772 }
773
774 int UtcDaliHandleDownCast(void)
775 {
776   TestApplication application;
777   tet_infoline("Testing Dali::Handle::DownCast()");
778
779   Actor actor = Actor::New();
780
781   BaseHandle baseHandle = actor;
782
783   Handle handle = Handle::DownCast(baseHandle);
784
785   DALI_TEST_CHECK( handle );
786
787   baseHandle = BaseHandle();
788
789   handle = Handle::DownCast(baseHandle);
790
791   DALI_TEST_CHECK( !handle );
792
793   END_TEST;
794 }
795
796 int UtcDaliHandleDownCastNegative(void)
797 {
798   TestApplication application;
799
800   // BaseObject is NOT an Object, so this DownCast should fail
801   BaseHandle handle( new BaseObjectType );
802   Handle customHandle1 = Handle::DownCast( handle );
803   DALI_TEST_CHECK( ! customHandle1 );
804
805   // A DownCast on an empty handle will also fail
806   Handle empty;
807   Handle customHandle2 = Handle::DownCast( empty );
808   DALI_TEST_CHECK( ! customHandle2 );
809   END_TEST;
810 }
811
812 int UtcDaliHandleGetPropertyIndices(void)
813 {
814   TestApplication application;
815   Property::IndexContainer indices;
816
817   // Actor
818   Actor actor = Actor::New();
819   actor.GetPropertyIndices( indices );
820   int numDefaultProperties = indices.Size();
821   DALI_TEST_CHECK( numDefaultProperties > 0 );
822   DALI_TEST_EQUALS( numDefaultProperties, actor.GetPropertyCount(), TEST_LOCATION );
823
824   const Vector4 testColor(0.5f, 0.2f, 0.9f, 1.0f);
825   const float withFlake(99.f);
826
827   Property::Index key1 = CORE_PROPERTY_MAX_INDEX+1;
828   Property::Index key2 = CORE_PROPERTY_MAX_INDEX+2;
829
830   actor.RegisterProperty( "MyPropertyOne", Vector3::ONE );
831   actor.RegisterProperty( key1, "sideColor", testColor);
832   actor.RegisterProperty( "MyPropertyTwo", 1234 );
833   Property::Index index4 = actor.RegisterProperty( key2, "iceCream", withFlake );
834   actor.RegisterProperty( "MyPropertyThree", Vector2(.2f,.7f) );
835
836   actor.GetPropertyIndices( indices );
837
838   DALI_TEST_EQUALS( indices.Size(), numDefaultProperties + 5, TEST_LOCATION );
839   DALI_TEST_EQUALS( indices[indices.Size()-2], index4, TEST_LOCATION );
840
841   END_TEST;
842 }
843
844 int UtcDaliHandleRegisterPropertyTypes(void)
845 {
846   TestApplication application;
847
848   struct PropertyTypeAnimatable
849   {
850     const char * name;
851     Property::Value value;
852     bool animatable;
853   };
854
855   Property::Array array;
856   Property::Map map;
857
858   PropertyTypeAnimatable properties[] =
859   {
860     { "Property::BOOLEAN",          true,              true  },
861     { "Property::FLOAT",            1.0f,              true  },
862     { "Property::INTEGER",          1,                 true  },
863     { "Property::VECTOR2",          Vector2::ONE,      true  },
864     { "Property::VECTOR3",          Vector3::ONE,      true  },
865     { "Property::VECTOR4",          Vector4::ONE,      true  },
866     { "Property::MATRIX3",          Matrix3::IDENTITY, true  },
867     { "Property::MATRIX",           Matrix::IDENTITY,  true  },
868     { "Property::RECTANGLE",        Rect<int>(),       false },
869     { "Property::ROTATION",         AngleAxis(),       true  },
870     { "Property::STRING",           std::string("Me"), false },
871     { "Property::ARRAY",            array,             false },
872     { "Property::MAP",              map,               false },
873   };
874
875   unsigned int numOfProperties( sizeof( properties ) / sizeof( properties[0] ) );
876
877   for ( unsigned int i = 0; i < numOfProperties; ++i )
878   {
879     tet_printf( "Testing: %s\n", properties[i].name );
880
881     bool exception = false;
882     try
883     {
884       Actor actor = Actor::New();
885       actor.RegisterProperty( "manFromDelmonte",   properties[i].value );
886     }
887     catch (Dali::DaliException& e)
888     {
889       exception = true;
890     }
891
892     DALI_TEST_CHECK( properties[i].animatable != exception );
893   }
894   END_TEST;
895 }
896
897 int UtcDaliHandleCustomProperty(void)
898 {
899   TestApplication application;
900
901   Handle handle = Handle::New();
902
903   float startValue(1.0f);
904   Property::Index index = handle.RegisterProperty( "testProperty",  startValue );
905   DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
906
907   application.SendNotification();
908   application.Render(0);
909   DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
910   application.Render(0);
911   DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
912
913   handle.SetProperty( index, 5.0f );
914
915   application.SendNotification();
916   application.Render(0);
917   DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
918   application.Render(0);
919   DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
920   END_TEST;
921 }
922
923 int UtcDaliHandleWeightNew(void)
924 {
925   TestApplication application;
926
927   Handle handle = WeightObject::New();;
928   DALI_TEST_CHECK( handle.GetProperty<float>(WeightObject::WEIGHT) == 0.0f );
929
930   END_TEST;
931 }