[dali_1.0.10] Merge branch 'tizen'
[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
24 using namespace Dali;
25
26 void handle_test_startup(void)
27 {
28   test_return_value = TET_UNDEF;
29 }
30
31 void handle_test_cleanup(void)
32 {
33   test_return_value = TET_PASS;
34 }
35
36 namespace
37 {
38
39 Handle ImplicitCopyConstructor(Handle passedByValue)
40 {
41   // object + copy + passedByValue, ref count == 3
42   DALI_TEST_CHECK(passedByValue);
43   if (passedByValue)
44   {
45     DALI_TEST_EQUALS(3, passedByValue.GetBaseObject().ReferenceCount(), TEST_LOCATION);
46   }
47
48   return passedByValue;
49 }
50
51 void CheckTypeName(const Property::Type& type)
52 {
53   switch(type)
54   {
55     case Property::NONE:
56     {
57       DALI_TEST_CHECK( "NONE" == std::string(PropertyTypes::GetName( type ) ) );
58       break;
59     }
60     case Property::BOOLEAN:
61     {
62       DALI_TEST_CHECK( "BOOLEAN" == std::string(PropertyTypes::GetName( type ) ) );
63       break;
64     }
65     case Property::FLOAT:
66     {
67       DALI_TEST_CHECK( "FLOAT" == std::string(PropertyTypes::GetName( type ) ) );
68       break;
69     }
70     case Property::INTEGER:
71     {
72       DALI_TEST_CHECK( "INTEGER" == std::string(PropertyTypes::GetName( type ) ) );
73       break;
74     }
75     case Property::UNSIGNED_INTEGER:
76     {
77       DALI_TEST_CHECK( "UNSIGNED_INTEGER" == std::string(PropertyTypes::GetName( type ) ) );
78       break;
79     }
80     case Property::VECTOR2:
81     {
82       DALI_TEST_CHECK( "VECTOR2" == std::string(PropertyTypes::GetName( type ) ) );
83       break;
84     }
85     case Property::VECTOR3:
86     {
87       DALI_TEST_CHECK( "VECTOR3" == std::string(PropertyTypes::GetName( type ) ) );
88       break;
89     }
90     case Property::VECTOR4:
91     {
92       DALI_TEST_CHECK( "VECTOR4" == std::string(PropertyTypes::GetName( type ) ) );
93       break;
94     }
95     case Property::MATRIX3:
96     {
97       DALI_TEST_CHECK( "MATRIX3" == std::string(PropertyTypes::GetName( type  ) ) );
98       break;
99     }
100     case Property::MATRIX:
101     {
102       DALI_TEST_CHECK( "MATRIX" == std::string(PropertyTypes::GetName( type ) ) );
103       break;
104     }
105     case Property::RECTANGLE:
106     {
107       DALI_TEST_CHECK( "RECTANGLE" == std::string(PropertyTypes::GetName( type ) ) );
108       break;
109     }
110     case Property::ROTATION:
111     {
112       DALI_TEST_CHECK( "ROTATION" == std::string(PropertyTypes::GetName( type ) ) );
113       break;
114     }
115     case Property::STRING:
116     {
117       DALI_TEST_CHECK( "STRING" == std::string(PropertyTypes::GetName( type ) ) );
118       break;
119     }
120     case Property::ARRAY:
121     {
122       DALI_TEST_CHECK( "ARRAY" == std::string(PropertyTypes::GetName( type ) ) );
123       break;
124     }
125     case Property::MAP:
126     {
127       DALI_TEST_CHECK( "MAP" == std::string(PropertyTypes::GetName( type ) ) );
128       break;
129     }
130     case Property::TYPE_COUNT:
131     {
132       DALI_TEST_CHECK( "NONE" == std::string(PropertyTypes::GetName( type ) ) );
133       break;
134     }
135   } // switch(type)
136
137 } // CheckTypeName
138
139 } // anon namespace
140
141
142 int UtcDaliHandleConstructorVoid(void)
143 {
144   TestApplication application;
145   tet_infoline("Testing Dali::Handle::Handle()");
146
147   Handle object;
148
149   DALI_TEST_CHECK(!object);
150   END_TEST;
151 }
152
153 int UtcDaliHandleCopyConstructor(void)
154 {
155   TestApplication application;
156   tet_infoline("Testing Dali::Handle::Handle(const Handle&)");
157
158   // Initialize an object, ref count == 1
159   Handle object = Actor::New();
160
161   DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION);
162
163   // Copy the object, ref count == 2
164   Handle copy(object);
165   DALI_TEST_CHECK(copy);
166   if (copy)
167   {
168     DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
169   }
170
171   {
172     // Pass by value, and return another copy, ref count == 3
173     Handle anotherCopy = ImplicitCopyConstructor(copy);
174
175     DALI_TEST_CHECK(anotherCopy);
176     if (anotherCopy)
177     {
178       DALI_TEST_EQUALS(3, anotherCopy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
179     }
180   }
181
182   // anotherCopy out of scope, ref count == 2
183   DALI_TEST_CHECK(copy);
184   if (copy)
185   {
186     DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
187   }
188   END_TEST;
189 }
190
191 int UtcDaliHandleAssignmentOperator(void)
192 {
193   TestApplication application;
194   tet_infoline("Testing Dali::Handle::operator=");
195
196   Handle object = Actor::New();
197
198   DALI_TEST_CHECK(object);
199   DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION);
200
201   Handle copy;
202   DALI_TEST_CHECK(!copy);
203
204   copy = object;
205   DALI_TEST_CHECK(copy);
206   DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
207   DALI_TEST_CHECK(&(copy.GetBaseObject()) == &(object.GetBaseObject()));
208   END_TEST;
209 }
210
211 int UtcDaliHandleSupports(void)
212 {
213   tet_infoline("Positive Test Dali::Handle::Supports()");
214   TestApplication application;
215
216   Actor actor = Actor::New();
217   DALI_TEST_CHECK( true == actor.Supports( Handle::DYNAMIC_PROPERTIES ) );
218   END_TEST;
219 }
220
221 int UtcDaliHandleGetPropertyCount(void)
222 {
223   tet_infoline("Positive Test Dali::Handle::GetPropertyCount()");
224   TestApplication application;
225
226   Actor actor = Actor::New();
227   int defaultPropertyCount( actor.GetPropertyCount() );
228
229   // Register a dynamic property
230   actor.RegisterProperty( "test-property", float(123.0f) );
231   DALI_TEST_CHECK( (defaultPropertyCount + 1u) == actor.GetPropertyCount() );
232   END_TEST;
233 }
234
235 int UtcDaliHandleGetPropertyName(void)
236 {
237   tet_infoline("Positive Test Dali::Handle::GetPropertyName()");
238   TestApplication application;
239
240   Actor actor = Actor::New();
241   DALI_TEST_CHECK( "parent-origin" == actor.GetPropertyName( Actor::PARENT_ORIGIN ) );
242
243   // Register a dynamic property
244   std::string name("this-name-should-match");
245   Property::Index index = actor.RegisterProperty( name, float(123.0f) );
246   DALI_TEST_CHECK( name == actor.GetPropertyName( index ) );
247
248   END_TEST;
249 }
250
251 int UtcDaliHandleGetPropertyIndex(void)
252 {
253   tet_infoline("Positive Test Dali::Handle::GetPropertyIndex()");
254   TestApplication application;
255
256   Actor actor = Actor::New();
257   DALI_TEST_CHECK( Actor::PARENT_ORIGIN == actor.GetPropertyIndex("parent-origin") );
258
259   // Register a dynamic property
260   std::string name("this-name-should-match");
261   Property::Index index = actor.RegisterProperty( name, float(123.0f) );
262   DALI_TEST_CHECK( index == actor.GetPropertyIndex( name ) );
263   END_TEST;
264 }
265
266 int UtcDaliHandleIsPropertyWritable(void)
267 {
268   tet_infoline("Positive Test Dali::Handle::IsPropertyWritable()");
269   TestApplication application;
270
271   Actor actor = Actor::New();
272
273   // Actor properties which are writable:
274   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::PARENT_ORIGIN ) );
275   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::PARENT_ORIGIN_X ) );
276   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::PARENT_ORIGIN_Y ) );
277   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::PARENT_ORIGIN_Z ) );
278   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::ANCHOR_POINT ) );
279   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::ANCHOR_POINT_X ) );
280   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::ANCHOR_POINT_Y ) );
281   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::ANCHOR_POINT_Z ) );
282   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::SIZE ) );
283   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::SIZE_WIDTH  ) );
284   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::SIZE_HEIGHT ) );
285   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::SIZE_DEPTH  ) );
286   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::POSITION ) );
287   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::POSITION_X ) );
288   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::POSITION_Y ) );
289   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::POSITION_Z ) );
290   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::ROTATION ) );
291   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::SCALE ) );
292   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::SCALE_X ) );
293   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::SCALE_Y ) );
294   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::SCALE_Z ) );
295   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::VISIBLE ) );
296   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::COLOR ) );
297   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::COLOR_RED ) );
298   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::COLOR_GREEN ) );
299   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::COLOR_BLUE ) );
300   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::COLOR_ALPHA ) );
301
302   // World-properties are not writable:
303   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::WORLD_POSITION ) );
304   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::WORLD_ROTATION ) );
305   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::WORLD_SCALE ) );
306   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::WORLD_COLOR ) );
307   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::WORLD_POSITION_X ) );
308   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::WORLD_POSITION_Y ) );
309   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::WORLD_POSITION_Z ) );
310
311   END_TEST;
312 }
313
314 int UtcDaliHandleIsPropertyAnimatable(void)
315 {
316   tet_infoline("Positive Test Dali::Handle::IsPropertyAnimatable()");
317   TestApplication application;
318
319   Actor actor = Actor::New();
320
321   // Actor properties which are animatable:
322   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::PARENT_ORIGIN ) );
323   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::PARENT_ORIGIN_X ) );
324   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::PARENT_ORIGIN_Y ) );
325   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::PARENT_ORIGIN_Z ) );
326   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::ANCHOR_POINT ) );
327   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::ANCHOR_POINT_X ) );
328   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::ANCHOR_POINT_Y ) );
329   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::ANCHOR_POINT_Z ) );
330   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::SIZE ) );
331   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::SIZE_WIDTH  ) );
332   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::SIZE_HEIGHT ) );
333   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::SIZE_DEPTH  ) );
334   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::POSITION ) );
335   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::POSITION_X ) );
336   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::POSITION_Y ) );
337   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::POSITION_Z ) );
338   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::ROTATION ) );
339   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::SCALE ) );
340   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::SCALE_X ) );
341   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::SCALE_Y ) );
342   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::SCALE_Z ) );
343   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::VISIBLE ) );
344   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::COLOR ) );
345   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::COLOR_RED ) );
346   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::COLOR_GREEN ) );
347   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::COLOR_BLUE ) );
348   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::COLOR_ALPHA ) );
349
350   // World-properties can not be animated
351   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::WORLD_POSITION ) );
352   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::WORLD_ROTATION ) );
353   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::WORLD_SCALE ) );
354   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::WORLD_COLOR ) );
355   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::WORLD_POSITION_X ) );
356   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::WORLD_POSITION_Y ) );
357   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::WORLD_POSITION_Z ) );
358
359   END_TEST;
360 }
361
362 int UtcDaliHandleIsPropertyAConstraintInput(void)
363 {
364   TestApplication application;
365
366   Actor actor = Actor::New();
367
368   // Actor properties which can be used as a constraint input:
369   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::PARENT_ORIGIN ) );
370   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::PARENT_ORIGIN_X ) );
371   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::PARENT_ORIGIN_Y ) );
372   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::PARENT_ORIGIN_Z ) );
373   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::ANCHOR_POINT ) );
374   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::ANCHOR_POINT_X ) );
375   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::ANCHOR_POINT_Y ) );
376   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::ANCHOR_POINT_Z ) );
377   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::SIZE ) );
378   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::SIZE_WIDTH  ) );
379   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::SIZE_HEIGHT ) );
380   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::SIZE_DEPTH  ) );
381   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::POSITION ) );
382   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::POSITION_X ) );
383   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::POSITION_Y ) );
384   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::POSITION_Z ) );
385   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::ROTATION ) );
386   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::SCALE ) );
387   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::SCALE_X ) );
388   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::SCALE_Y ) );
389   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::SCALE_Z ) );
390   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::VISIBLE ) );
391   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::COLOR ) );
392   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::COLOR_RED ) );
393   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::COLOR_GREEN ) );
394   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::COLOR_BLUE ) );
395   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::COLOR_ALPHA ) );
396   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::WORLD_POSITION ) );
397   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::WORLD_ROTATION ) );
398   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::WORLD_SCALE ) );
399   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::WORLD_COLOR ) );
400   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::WORLD_POSITION_X ) );
401   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::WORLD_POSITION_Y ) );
402   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::WORLD_POSITION_Z ) );
403
404   // Actor properties that cannot be used as a constraint input
405   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::NAME ) );
406   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::SENSITIVE ) );
407   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::LEAVE_REQUIRED ) );
408   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::INHERIT_ROTATION ) );
409   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::INHERIT_SCALE ) );
410   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::COLOR_MODE ) );
411   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::POSITION_INHERITANCE ) );
412   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::DRAW_MODE ) );
413
414   END_TEST;
415 }
416
417
418 int UtcDaliHandleGetPropertyType(void)
419 {
420   tet_infoline("Positive Test Dali::Handle::GetPropertyType()");
421   TestApplication application;
422   unsigned int unsingedIntTest = 33;
423
424   Actor actor = Actor::New();
425   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( Actor::PARENT_ORIGIN ) );
426   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( Actor::ANCHOR_POINT ) );
427   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( Actor::SIZE ) );
428   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( Actor::POSITION ) );
429   DALI_TEST_CHECK( Property::ROTATION == actor.GetPropertyType( Actor::ROTATION ) );
430   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( Actor::SCALE ) );
431   DALI_TEST_CHECK( Property::BOOLEAN  == actor.GetPropertyType( Actor::VISIBLE ) );
432   DALI_TEST_CHECK( Property::VECTOR4  == actor.GetPropertyType( Actor::COLOR ) );
433
434   // Register some dynamic properties
435   Property::Index boolIndex     = actor.RegisterProperty( "bool-property",     bool(true) );
436   Property::Index floatIndex    = actor.RegisterProperty( "float-property",    float(123.0f) );
437   Property::Index intIndex      = actor.RegisterProperty( "int-property",      123 );
438   Property::Index vector2Index  = actor.RegisterProperty( "vector2-property",  Vector2(1.0f, 2.0f) );
439   Property::Index vector3Index  = actor.RegisterProperty( "vector3-property",  Vector3(1.0f, 2.0f, 3.0f) );
440   Property::Index vector4Index  = actor.RegisterProperty( "vector4-property",  Vector4(1.0f, 2.0f, 3.0f, 4.0f) );
441   Property::Index rotationIndex = actor.RegisterProperty( "rotation-property", AngleAxis(Degree(180.0f), Vector3::YAXIS) );
442
443   DALI_TEST_CHECK( Property::BOOLEAN  == actor.GetPropertyType( boolIndex ) );
444   DALI_TEST_CHECK( Property::FLOAT    == actor.GetPropertyType( floatIndex ) );
445   DALI_TEST_CHECK( Property::INTEGER  == actor.GetPropertyType( intIndex ) );
446   DALI_TEST_CHECK( Property::VECTOR2  == actor.GetPropertyType( vector2Index ) );
447   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( vector3Index ) );
448   DALI_TEST_CHECK( Property::VECTOR4  == actor.GetPropertyType( vector4Index ) );
449   DALI_TEST_CHECK( Property::ROTATION == actor.GetPropertyType( rotationIndex ) );
450
451   // Non animatable properties
452   Property::Index nonAnimStringIndex = actor.RegisterProperty( "man-from-delmonte", std::string("yes"), Property::READ_WRITE);
453   Property::Index nonAnimV2Index = actor.RegisterProperty( "v2", Vector2(1.f, 2.f), Property::READ_WRITE);
454   Property::Index nonAnimV3Index = actor.RegisterProperty( "v3", Vector3(1.f, 2.f, 3.f), Property::READ_WRITE);
455   Property::Index nonAnimV4Index = actor.RegisterProperty( "v4", Vector4(1.f, 2.f, 3.f, 4.f), Property::READ_WRITE);
456   Property::Index nonAnimBooleanIndex = actor.RegisterProperty( "bool", true, Property::READ_WRITE);
457   Property::Index nonAnimFloatIndex = actor.RegisterProperty( "float", 0.f, Property::READ_WRITE);
458   Property::Index nonAnimIntegerIndex = actor.RegisterProperty( "int", 0, Property::READ_WRITE);
459   Property::Index nonAnimUnsignedIntIndex = actor.RegisterProperty( "unsinged-int", unsingedIntTest, Property::READ_WRITE);
460
461   DALI_TEST_CHECK( nonAnimStringIndex  != Property::INVALID_INDEX );
462   DALI_TEST_CHECK( nonAnimV2Index      != Property::INVALID_INDEX );
463   DALI_TEST_CHECK( nonAnimV3Index      != Property::INVALID_INDEX );
464   DALI_TEST_CHECK( nonAnimV4Index      != Property::INVALID_INDEX );
465   DALI_TEST_CHECK( nonAnimBooleanIndex != Property::INVALID_INDEX );
466   DALI_TEST_CHECK( nonAnimFloatIndex   != Property::INVALID_INDEX );
467   DALI_TEST_CHECK( nonAnimIntegerIndex != Property::INVALID_INDEX );
468   DALI_TEST_CHECK( nonAnimUnsignedIntIndex != Property::INVALID_INDEX );
469
470   DALI_TEST_CHECK( Property::STRING   == actor.GetPropertyType( nonAnimStringIndex ) );
471   DALI_TEST_CHECK( Property::VECTOR2  == actor.GetPropertyType( nonAnimV2Index ) );
472   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( nonAnimV3Index ) );
473   DALI_TEST_CHECK( Property::VECTOR4  == actor.GetPropertyType( nonAnimV4Index ) );
474   DALI_TEST_CHECK( Property::BOOLEAN  == actor.GetPropertyType( nonAnimBooleanIndex ) );
475   DALI_TEST_CHECK( Property::FLOAT    == actor.GetPropertyType( nonAnimFloatIndex ) );
476   DALI_TEST_CHECK( Property::INTEGER  == actor.GetPropertyType( nonAnimIntegerIndex ) );
477   DALI_TEST_CHECK( Property::UNSIGNED_INTEGER == actor.GetPropertyType( nonAnimUnsignedIntIndex ) );
478
479   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimStringIndex ) );
480   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV2Index ) );
481   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV3Index ) );
482   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV4Index ) );
483   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimBooleanIndex ) );
484   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimFloatIndex ) );
485   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimIntegerIndex ) );
486   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimUnsignedIntIndex ) );
487
488   DALI_TEST_EQUALS( "yes" , actor.GetProperty( nonAnimStringIndex ).Get<std::string>(), TEST_LOCATION );
489   DALI_TEST_EQUALS( Vector2(1.f, 2.f) , actor.GetProperty( nonAnimV2Index ).Get<Vector2>(), TEST_LOCATION );
490   DALI_TEST_EQUALS( Vector3(1.f, 2.f, 3.f) , actor.GetProperty( nonAnimV3Index ).Get<Vector3>(), TEST_LOCATION );
491   DALI_TEST_EQUALS( Vector4(1.f, 2.f, 3.f, 4.f) , actor.GetProperty( nonAnimV4Index ).Get<Vector4>(), TEST_LOCATION );
492   DALI_TEST_EQUALS( true, actor.GetProperty( nonAnimBooleanIndex ).Get<bool>(), TEST_LOCATION );
493   DALI_TEST_EQUALS( 0.f, actor.GetProperty( nonAnimFloatIndex ).Get<float>(), TEST_LOCATION );
494   DALI_TEST_EQUALS( 0, actor.GetProperty( nonAnimIntegerIndex ).Get<int>(), TEST_LOCATION );
495   DALI_TEST_EQUALS( unsingedIntTest, actor.GetProperty( nonAnimUnsignedIntIndex ).Get<unsigned int>(), TEST_LOCATION );
496
497   END_TEST;
498 }
499
500 int UtcDaliHandleNonAnimtableProperties(void)
501 {
502   tet_infoline("Test Non Animatable Properties");
503   TestApplication application;
504
505   Actor actor = Actor::New();
506
507   Property::Index nonAnimStringIndex = actor.RegisterProperty( "man-from-delmonte", std::string("no"), Property::READ_WRITE);
508
509   //// modify writable?
510   try
511   {
512     actor.SetProperty( nonAnimStringIndex, Property::Value("yes") );
513   }
514   catch (Dali::DaliException& e)
515   {
516     DALI_TEST_CHECK(!"exception");
517   }
518
519   DALI_TEST_CHECK( "yes"  == actor.GetProperty( nonAnimStringIndex ).Get<std::string>() );
520
521   //// cannot modify read only?
522   Property::Index readonly = actor.RegisterProperty( "float", 0.f, Property::READ_ONLY);
523
524   DALI_TEST_CHECK(!actor.IsPropertyAnimatable(readonly));
525   DALI_TEST_CHECK(!actor.IsPropertyWritable(readonly));
526
527   bool exception = false;
528   try
529   {
530     actor.SetProperty( readonly, Property::Value(1.f) );
531   }
532   catch (Dali::DaliException& e)
533   {
534     exception = true;
535   }
536
537   DALI_TEST_CHECK(exception);
538
539   DALI_TEST_EQUALS( 0.f, actor.GetProperty( readonly ).Get<float>(), TEST_LOCATION );
540
541   /// animatable can be set
542   Property::Index write_anim = actor.RegisterProperty( "write_float", 0.f, Property::ANIMATABLE);
543
544   DALI_TEST_CHECK(actor.IsPropertyAnimatable(write_anim));
545   DALI_TEST_CHECK(actor.IsPropertyWritable(write_anim));
546
547   exception = false;
548   try
549   {
550     actor.SetProperty( write_anim, Property::Value(1.f) );
551   }
552   catch (Dali::DaliException& e)
553   {
554     exception = true;
555   }
556
557   DALI_TEST_CHECK(!exception);
558
559   //// animate a non animatable property is a noop?
560   float durationSeconds(2.0f);
561   Animation animation = Animation::New(durationSeconds);
562   bool relativeValue(true);
563
564   exception = false;
565
566   try
567   {
568     animation.AnimateBy(Property(actor, nonAnimStringIndex), relativeValue, AlphaFunctions::EaseIn);
569     animation.Play();
570     application.SendNotification();
571     application.Render(static_cast<unsigned int>(durationSeconds*0100.0f)/* some progress */);
572   }
573   catch (Dali::DaliException& e)
574   {
575     exception = true;
576   }
577
578   DALI_TEST_CHECK(!exception);
579   DALI_TEST_EQUALS( "yes", actor.GetProperty( nonAnimStringIndex ).Get<std::string>(), TEST_LOCATION );
580
581   END_TEST;
582 }
583
584 int UtcDaliHandleNonAnimtableCompositeProperties(void)
585 {
586   tet_infoline("Test Non Animatable Composite Properties");
587   TestApplication application;
588
589   Actor actor = Actor::New();
590
591   Property::Value value(Property::ARRAY);
592   Property::Array anArray;
593   DALI_TEST_CHECK( Property::Value(anArray).GetType() == Property::ARRAY ); // 2nd constructor
594
595   value.AppendItem( Property::Value( 0.f ) );
596   value.AppendItem( "a string" );
597   value.SetItem(0, Property::Value( 5.f )); // exercise SetItem
598
599   int index = value.AppendItem( Vector3(1,2,3) );
600
601   DALI_TEST_EQUALS( 2, index, TEST_LOCATION);
602   DALI_TEST_EQUALS( 3, value.GetSize(), TEST_LOCATION);
603
604   Property::Index propertyIndex = actor.RegisterProperty( "composite", value, Property::READ_WRITE);
605
606   Property::Value out = actor.GetProperty( propertyIndex );
607
608   DALI_TEST_CHECK( Property::FLOAT     == out.GetItem(0).GetType());
609   DALI_TEST_CHECK( Property::STRING    == out.GetItem(1).GetType());
610   DALI_TEST_CHECK( Property::VECTOR3   == out.GetItem(2).GetType());
611
612   DALI_TEST_EQUALS( 5.f,            out.GetItem(0).Get<float>(),        TEST_LOCATION);
613   DALI_TEST_EQUALS( "a string",     out.GetItem(1).Get<std::string>(),  TEST_LOCATION);
614   DALI_TEST_EQUALS( Vector3(1,2,3), out.GetItem(2).Get<Vector3>(),      TEST_LOCATION);
615
616   // Property Maps
617   Property::Value valueMap(Property::MAP);
618   Property::Map aKindofMap;
619   DALI_TEST_CHECK( Property::Value(aKindofMap).GetType() == Property::MAP ); // 2nd constructor
620
621   valueMap.SetValue("key", 5.f);
622   valueMap.SetValue("2key", "a string");
623
624   DALI_TEST_EQUALS( true, valueMap.HasKey("key"),         TEST_LOCATION);
625   DALI_TEST_EQUALS( "key", valueMap.GetKey(0),           TEST_LOCATION);
626
627   DALI_TEST_EQUALS( true, valueMap.HasKey("2key"),       TEST_LOCATION);
628   DALI_TEST_EQUALS( "2key", valueMap.GetKey(1),          TEST_LOCATION);
629
630   DALI_TEST_EQUALS( 5.f,         valueMap.GetValue("key").Get<float>(),         TEST_LOCATION);
631   DALI_TEST_EQUALS( "a string",  valueMap.GetValue("2key").Get<std::string>(),  TEST_LOCATION);
632
633   valueMap.SetItem(0, Property::Value("a string"));
634   valueMap.SetItem(1, Property::Value(5.f));
635
636   DALI_TEST_EQUALS( 5.f,         valueMap.GetValue("2key").Get<float>(),         TEST_LOCATION);
637   DALI_TEST_EQUALS( "a string",  valueMap.GetValue("key").Get<std::string>(),  TEST_LOCATION);
638
639   // ordered map
640   valueMap = Property::Value(Property::MAP);
641
642   valueMap.SetValue("key", 5.f);
643   valueMap.SetValue("2key", "a string");
644
645   DALI_TEST_EQUALS( 5.f,         valueMap.GetItem(0).Get<float>(),         TEST_LOCATION);
646   DALI_TEST_EQUALS( "a string",  valueMap.GetItem(1).Get<std::string>(),   TEST_LOCATION);
647
648   DALI_TEST_EQUALS( 2, valueMap.GetSize(), TEST_LOCATION);
649
650   // composite types not animatable
651   bool exception = false;
652   try
653   {
654     /* Property::Index mapPropertyIndex = */ actor.RegisterProperty( "compositemap", value, Property::ANIMATABLE);
655   }
656   catch (Dali::DaliException& e)
657   {
658     exception = true;
659     tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
660   }
661
662   DALI_TEST_EQUALS(exception, true, TEST_LOCATION);
663
664   // Map of maps
665   Property::Value mapOfMaps(Property::MAP);
666
667   mapOfMaps.SetValue( "key", Property::Value(Property::MAP) );
668   mapOfMaps.SetValue( "2key", "a string" );
669
670   DALI_TEST_EQUALS( "a string",  mapOfMaps.GetValue("2key").Get<std::string>(),  TEST_LOCATION);
671
672   mapOfMaps.GetValue("key").SetValue("subkey", 5.f);
673
674   DALI_TEST_EQUALS( true, mapOfMaps.GetValue("key").HasKey("subkey"), TEST_LOCATION);
675   DALI_TEST_EQUALS( 5.f, mapOfMaps.GetValue("key").GetValue("subkey").Get<float>(), TEST_LOCATION);
676
677   // list of maps
678   Property::Value listOfMaps(Property::ARRAY);
679
680   listOfMaps.AppendItem( Property::Value(Property::MAP) );
681   listOfMaps.AppendItem( Property::Value(Property::MAP) );
682
683   listOfMaps.GetItem(0).SetValue("key", 5.f);
684   listOfMaps.GetItem(1).SetValue("key",10.f);
685
686   DALI_TEST_EQUALS( 5.f, listOfMaps.GetItem(0).GetValue("key").Get<float>(), TEST_LOCATION );
687   DALI_TEST_EQUALS( 10.f, listOfMaps.GetItem(1).GetValue("key").Get<float>(), TEST_LOCATION );
688
689   END_TEST;
690 }
691
692 int UtcDaliHandleSetProperty01(void)
693 {
694   tet_infoline("Positive Test Dali::Handle::SetProperty()");
695   TestApplication application;
696
697   Actor actor = Actor::New();
698   DALI_TEST_CHECK( ParentOrigin::TOP_LEFT == actor.GetProperty( Actor::PARENT_ORIGIN ).Get<Vector3>() );
699
700   actor.SetProperty( Actor::PARENT_ORIGIN, ParentOrigin::CENTER );
701   // flush the queue and render once
702   application.SendNotification();
703   application.Render();
704   DALI_TEST_CHECK( ParentOrigin::CENTER == actor.GetProperty( Actor::PARENT_ORIGIN ).Get<Vector3>() );
705   END_TEST;
706 }
707
708 int UtcDaliHandleSetProperty02(void)
709 {
710   tet_infoline("Positive Test Dali::Handle::SetProperty()");
711   TestApplication application;
712
713   Actor actor = Actor::New();
714
715   DALI_TEST_CHECK( !actor.IsPropertyWritable( Actor::WORLD_POSITION ) );
716
717   try
718   {
719     // World position is not writable
720     actor.SetProperty( Actor::WORLD_POSITION, Vector3(1,2,3) );
721   }
722   catch (Dali::DaliException& e)
723   {
724     tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
725     DALI_TEST_ASSERT(e, "IsDefaultPropertyWritable(index) && \"Property is read-only\"", TEST_LOCATION);
726   }
727
728   END_TEST;
729 }
730
731 int UtcDaliHandleRegisterProperty(void)
732 {
733   tet_infoline("Positive Test Dali::Handle::RegisterProperty()");
734   TestApplication application;
735
736   Actor actor = Actor::New();
737   DALI_TEST_CHECK( ParentOrigin::TOP_LEFT == actor.GetProperty( Actor::PARENT_ORIGIN ).Get<Vector3>() );
738
739   END_TEST;
740 }
741
742 int UtcDaliHandleGetProperty(void)
743 {
744   tet_infoline("Positive Test Dali::Handle::GetProperty()");
745   TestApplication application;
746
747   Actor actor = Actor::New();
748
749   DALI_TEST_CHECK( ParentOrigin::TOP_LEFT == actor.GetProperty( Actor::PARENT_ORIGIN   ).Get<Vector3>() );
750   DALI_TEST_CHECK( AnchorPoint::CENTER    == actor.GetProperty( Actor::ANCHOR_POINT    ).Get<Vector3>() );
751   DALI_TEST_CHECK( Vector3::ZERO          == actor.GetProperty( Actor::SIZE            ).Get<Vector3>() );
752   DALI_TEST_CHECK( Vector3::ZERO          == actor.GetProperty( Actor::POSITION        ).Get<Vector3>() );
753   DALI_TEST_CHECK( Vector3::ONE           == actor.GetProperty( Actor::SCALE           ).Get<Vector3>() );
754   DALI_TEST_CHECK( true                   == actor.GetProperty( Actor::VISIBLE         ).Get<bool>() );
755   DALI_TEST_CHECK( Color::WHITE           == actor.GetProperty( Actor::COLOR           ).Get<Vector4>() );
756   END_TEST;
757 }
758
759 int UtcDaliHandleDownCast(void)
760 {
761   TestApplication application;
762   tet_infoline("Testing Dali::Handle::DownCast()");
763
764   Actor actor = Actor::New();
765
766   BaseHandle baseHandle = actor;
767
768   Handle handle = Handle::DownCast(baseHandle);
769
770   DALI_TEST_CHECK( handle );
771
772   baseHandle = BaseHandle();
773
774   handle = Handle::DownCast(baseHandle);
775
776   DALI_TEST_CHECK( !handle );
777
778   END_TEST;
779 }
780
781 int UtcDaliHandleCreateProperty(void)
782 {
783   TestApplication application;
784   tet_infoline("Testing PropertyTypes::GetName()");
785
786   Property::Type type = Property::NONE;
787   CheckTypeName(type);
788   // Value(Value&) ctor and Value(Type&) ctor
789   DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
790   DALI_TEST_CHECK( Property::NONE == type );
791
792   // PropertyTypes
793   type = Property::BOOLEAN;
794   CheckTypeName(type);
795   DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
796   DALI_TEST_CHECK( PropertyTypes::Get<bool>()            == type );
797
798   type = Property::FLOAT;
799   CheckTypeName(type);
800   DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
801   DALI_TEST_CHECK( PropertyTypes::Get<float>()           == type );
802
803   type = Property::INTEGER;
804   CheckTypeName(type);
805   DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
806   DALI_TEST_CHECK( PropertyTypes::Get<int>()             == type );
807
808   type = Property::UNSIGNED_INTEGER;
809   CheckTypeName(type);
810   DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
811   DALI_TEST_CHECK( PropertyTypes::Get<unsigned int>()    == type );
812
813   type = Property::VECTOR2;
814   CheckTypeName(type);
815   DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
816   DALI_TEST_CHECK( PropertyTypes::Get<Vector2>()         == type );
817
818   type = Property::VECTOR3;
819   CheckTypeName(type);
820   DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
821   DALI_TEST_CHECK( PropertyTypes::Get<Vector3>()         == type );
822
823   type = Property::VECTOR4;
824   CheckTypeName(type);
825   DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
826   DALI_TEST_CHECK( PropertyTypes::Get<Vector4>()         == type );
827
828   type = Property::MATRIX3;
829   CheckTypeName(type);
830   DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
831   DALI_TEST_CHECK( PropertyTypes::Get<Matrix3>()         == type );
832
833   type = Property::MATRIX;
834   CheckTypeName(type);
835   DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
836   DALI_TEST_CHECK( PropertyTypes::Get<Matrix>()          == type );
837
838   typedef Dali::Rect<int> Rectangle;
839   type = Property::RECTANGLE;
840   CheckTypeName(type);
841   DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
842   DALI_TEST_CHECK( PropertyTypes::Get<Rectangle>()       == type );
843
844   type = Property::ROTATION;
845   CheckTypeName(type);
846   DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
847   DALI_TEST_CHECK( PropertyTypes::Get<Quaternion>()      == type );
848
849   type = Property::ROTATION;
850   CheckTypeName(type);
851   DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
852   DALI_TEST_CHECK( PropertyTypes::Get<AngleAxis>()       == type );
853
854   type = Property::STRING;
855   CheckTypeName(type);
856   DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
857   DALI_TEST_CHECK( PropertyTypes::Get<std::string>()     == type );
858
859   type = Property::ARRAY;
860   CheckTypeName(type);
861   DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
862   DALI_TEST_CHECK( PropertyTypes::Get<Property::Array>() == type );
863
864   type = Property::MAP;
865   CheckTypeName(type);
866   DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
867   DALI_TEST_CHECK( PropertyTypes::Get<Property::Map>()   == type );
868   END_TEST;
869 }
870
871 int UtcDaliHandleGetPropertyGet(void)
872 {
873   TestApplication application;
874   tet_infoline("Testing PropertyTypes::GetName()");
875
876   Property::Value value;
877
878   bool b = false;
879   value = Property::Value(true);
880   value.Get(b);
881   DALI_TEST_CHECK( true == b );
882
883   float f = 5.f;
884   value = Property::Value(10.f);
885   value.Get(f);
886   DALI_TEST_CHECK( Dali::Equals(10.f, f) );
887
888   int i = 5;
889   value = Property::Value(10);
890   value.Get(i);
891   DALI_TEST_CHECK( 10 == i );
892
893   unsigned int ui = 5;
894   value = Property::Value(10U);
895   value.Get(ui);
896   DALI_TEST_CHECK( 10 == ui );
897
898   Vector2 v2 = Vector2(0,0);
899   value = Property::Value( Vector2(1,1) );
900   value.Get(v2);
901   DALI_TEST_CHECK( Vector2(1,1) == v2 );
902
903   Vector3 v3 = Vector3(0.f,0.f,0.f);
904   value = Property::Value( Vector3(1.f,1.f,1.f) );
905   value.Get(v3);
906   DALI_TEST_CHECK( Vector3(1.f,1.f,1.f) == v3 );
907
908   Vector4 v4 = Vector4(0,0,0,0);
909   value = Property::Value( Vector4(1,1,1,1) );
910   value.Get(v4);
911   DALI_TEST_CHECK( Vector4(1,1,1,1) == v4 );
912
913   Matrix3 m3 = Matrix3(0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f);
914   value = Property::Value( Matrix3::IDENTITY );
915   value.Get(m3);
916   DALI_TEST_CHECK( Matrix3::IDENTITY == m3 );
917
918   Matrix m = Matrix(true);
919   value = Property::Value( Matrix::IDENTITY );
920   value.Get(m);
921   DALI_TEST_CHECK( Matrix::IDENTITY == m );
922
923   typedef Dali::Rect<int> Rectangle;
924   Rectangle r = Rectangle(0,0,0,0);
925   value = Property::Value( Rectangle(1,1,1,1) );
926   value.Get(r);
927   DALI_TEST_CHECK( Rectangle(1,1,1,1) == r );
928
929   Quaternion q = Quaternion(0,0,0,0);
930   value = Property::Value( Quaternion(1,1,1,1) );
931   value.Get(q);
932   DALI_TEST_CHECK( Quaternion(1,1,1,1) == q );
933
934   AngleAxis aa = AngleAxis( Degree(0), Vector3(0.f,0.f,0.f) );
935   value = Property::Value( AngleAxis( Radian(Math::PI_2), Vector3::XAXIS  ));
936   value.Get(aa);
937   Quaternion r8(Radian(Degree(aa.angle)), aa.axis);
938   DALI_TEST_EQUALS(r8, Quaternion(Math::PI_2, Vector3::XAXIS), 0.001, TEST_LOCATION);
939
940   std::string s = "no";
941   value = Property::Value("yes");
942   value.Get(s);
943   DALI_TEST_CHECK( "yes" == s );
944
945   Property::Array array;
946   value = Property::Value(Property::ARRAY);
947   value.AppendItem(10);
948   value.Get(array);
949   int getItem = 0;
950   array[0].Get(getItem);
951   DALI_TEST_CHECK( getItem == 10 );
952
953   Property::Map map;
954   value = Property::Value(Property::MAP);
955   value.SetValue("key", "value");
956   value.Get(map);
957   DALI_TEST_CHECK( map[0].first == "key" );
958
959   END_TEST;
960 }
961
962 int UtcDaliHandleGetPropertyIndices(void)
963 {
964   TestApplication application;
965   Property::IndexContainer indices;
966
967   // Actor
968   Actor actor = Actor::New();
969   actor.GetPropertyIndices( indices );
970   DALI_TEST_CHECK( ! indices.empty() );
971   DALI_TEST_EQUALS( indices.size(), actor.GetPropertyCount(), TEST_LOCATION );
972   END_TEST;
973 }
974
975 int UtcDaliHandleRegisterPropertyTypes(void)
976 {
977   TestApplication application;
978
979   struct PropertyTypeAnimatable
980   {
981     const char * name;
982     Property::Value value;
983     bool animatable;
984   };
985
986   Property::Array array;
987   Property::Map map;
988
989   PropertyTypeAnimatable properties[] =
990   {
991     { "Property::BOOLEAN",          true,              true  },
992     { "Property::FLOAT",            1.0f,              true  },
993     { "Property::INTEGER",          1,                 true  },
994     { "Property::UNSIGNED_INTEGER", 1u,                false },
995     { "Property::VECTOR2",          Vector2::ONE,      true  },
996     { "Property::VECTOR3",          Vector3::ONE,      true  },
997     { "Property::VECTOR4",          Vector4::ONE,      true  },
998     { "Property::MATRIX3",          Matrix3::IDENTITY, true  },
999     { "Property::MATRIX",           Matrix::IDENTITY,  true  },
1000     { "Property::RECTANGLE",        Rect<int>(),       false },
1001     { "Property::ROTATION",         AngleAxis(),       true  },
1002     { "Property::STRING",           std::string("Me"), false },
1003     { "Property::ARRAY",            array,             false },
1004     { "Property::MAP",              map,               false },
1005   };
1006   unsigned int numOfProperties( sizeof( properties ) / sizeof( properties[0] ) );
1007
1008   for ( unsigned int i = 0; i < numOfProperties; ++i )
1009   {
1010     tet_printf( "Testing: %s\n", properties[i].name );
1011
1012     bool exception = false;
1013     try
1014     {
1015       Actor actor = Actor::New();
1016       actor.RegisterProperty( "man-from-delmonte", properties[i].value );
1017     }
1018     catch (Dali::DaliException& e)
1019     {
1020       exception = true;
1021     }
1022
1023     DALI_TEST_CHECK( properties[i].animatable != exception );
1024   }
1025   END_TEST;
1026 }