(Automated Tests) Added several negative test cases
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Handle.cpp
1 /*
2  * Copyright (c) 2020 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/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"
26
27 #include <mesh-builder.h>
28
29 using namespace Dali;
30
31 void handle_test_startup(void)
32 {
33   test_return_value = TET_UNDEF;
34 }
35
36 void handle_test_cleanup(void)
37 {
38   test_return_value = TET_PASS;
39 }
40
41 namespace
42 {
43
44 /// Allows the creation of a BaseObject
45 class BaseObjectType : public BaseObject
46 {
47 public:
48   BaseObjectType()
49   {
50   }
51 };
52
53 Handle ImplicitCopyConstructor(Handle passedByValue)
54 {
55   // object + copy + passedByValue, ref count == 3
56   DALI_TEST_CHECK(passedByValue);
57   if (passedByValue)
58   {
59     DALI_TEST_EQUALS(3, passedByValue.GetBaseObject().ReferenceCount(), TEST_LOCATION);
60   }
61
62   return passedByValue;
63 }
64
65 } // anon namespace
66
67
68 int UtcDaliHandleConstructorVoid(void)
69 {
70   TestApplication application;
71   tet_infoline("Testing Dali::Handle::Handle()");
72
73   Handle object;
74
75   DALI_TEST_CHECK(!object);
76
77   END_TEST;
78 }
79
80 int UtcDaliHandleCopyConstructor(void)
81 {
82   TestApplication application;
83   tet_infoline("Testing Dali::Handle::Handle(const Handle&)");
84
85   // Initialize an object, ref count == 1
86   Handle object = Actor::New();
87
88   DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION);
89
90   // Copy the object, ref count == 2
91   Handle copy(object);
92   DALI_TEST_CHECK(copy);
93   if (copy)
94   {
95     DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
96   }
97
98   {
99     // Pass by value, and return another copy, ref count == 3
100     Handle anotherCopy = ImplicitCopyConstructor(copy);
101
102     DALI_TEST_CHECK(anotherCopy);
103     if (anotherCopy)
104     {
105       DALI_TEST_EQUALS(3, anotherCopy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
106     }
107   }
108
109   // anotherCopy out of scope, ref count == 2
110   DALI_TEST_CHECK(copy);
111   if (copy)
112   {
113     DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
114   }
115   END_TEST;
116 }
117
118 int UtcDaliHandleAssignmentOperator(void)
119 {
120   TestApplication application;
121   tet_infoline("Testing Dali::Handle::operator=");
122
123   Handle object = Actor::New();
124
125   DALI_TEST_CHECK(object);
126   DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION);
127
128   Handle copy;
129   DALI_TEST_CHECK(!copy);
130
131   copy = object;
132   DALI_TEST_CHECK(copy);
133   DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
134   DALI_TEST_CHECK(&(copy.GetBaseObject()) == &(object.GetBaseObject()));
135   END_TEST;
136 }
137
138 int UtcDaliHandleMoveConstructor(void)
139 {
140   TestApplication application;
141
142   // Initialize a handle, ref count == 1
143   Handle handle = Actor::New();
144
145   DALI_TEST_EQUALS( 1, handle.GetBaseObject().ReferenceCount(), TEST_LOCATION );
146
147   int value( 20 );
148   Property::Index index = handle.RegisterProperty( "customProperty",  value );
149   DALI_TEST_CHECK( handle.GetProperty<int>( index ) == value );
150
151   // Move the object, ref count == 1
152   Handle move = std::move( handle );
153   DALI_TEST_CHECK( move );
154
155   // Check that object is moved (not copied, so ref count keeps the same)
156   DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
157   DALI_TEST_CHECK( move.GetProperty<int>( index ) == value );
158   DALI_TEST_CHECK( !handle );
159
160   END_TEST;
161 }
162
163 int UtcDaliHandleMoveAssignment(void)
164 {
165   TestApplication application;
166
167   // Initialize a handle, ref count == 1
168   Handle handle = Actor::New();
169
170   DALI_TEST_EQUALS( 1, handle.GetBaseObject().ReferenceCount(), TEST_LOCATION );
171
172   int value( 20 );
173   Property::Index index = handle.RegisterProperty( "customProperty",  value );
174   DALI_TEST_CHECK( handle.GetProperty<int>( index ) == value );
175
176   // Move the object, ref count == 1
177   Handle move;
178   move = std::move( handle );
179   DALI_TEST_CHECK( move );
180
181   // Check that object is moved (not copied, so ref count keeps the same)
182   DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
183   DALI_TEST_CHECK( move.GetProperty<int>( index ) == value );
184   DALI_TEST_CHECK( !handle );
185
186   END_TEST;
187 }
188
189 int UtcDaliHandleSupports(void)
190 {
191   tet_infoline("Positive Test Dali::Handle::Supports()");
192   TestApplication application;
193
194   Actor actor = Actor::New();
195   DALI_TEST_CHECK( true == actor.Supports( Handle::DYNAMIC_PROPERTIES ) );
196   END_TEST;
197 }
198
199 int UtcDaliHandleGetPropertyCount(void)
200 {
201   tet_infoline("Positive Test Dali::Handle::GetPropertyCount()");
202   TestApplication application;
203
204   Actor actor = Actor::New();
205   int defaultPropertyCount( actor.GetPropertyCount() );
206
207   // Register a dynamic property
208   actor.RegisterProperty( "testProperty",  float(123.0f) );
209   DALI_TEST_CHECK( (defaultPropertyCount + 1u) == actor.GetPropertyCount() );
210   END_TEST;
211 }
212
213 int UtcDaliHandleGetPropertyName(void)
214 {
215   tet_infoline("Positive Test Dali::Handle::GetPropertyName()");
216   TestApplication application;
217
218   Actor actor = Actor::New();
219   DALI_TEST_CHECK( "parentOrigin" == actor.GetPropertyName( Actor::Property::PARENT_ORIGIN ) );
220
221   // Register a dynamic property
222   std::string name("thisNameShouldMatch");
223   Property::Index index = actor.RegisterProperty( name, float(123.0f) );
224   DALI_TEST_CHECK( name == actor.GetPropertyName( index ) );
225
226   END_TEST;
227 }
228
229 int UtcDaliHandleGetPropertyIndex01(void)
230 {
231   tet_infoline("Positive Test Dali::Handle::GetPropertyIndex()");
232   TestApplication application;
233
234   Actor actor = Actor::New();
235   DALI_TEST_CHECK( Actor::Property::PARENT_ORIGIN == actor.GetPropertyIndex("parentOrigin") );
236
237   // Register a dynamic property
238   std::string name("thisNameShouldMatch");
239   Property::Index index = actor.RegisterProperty( name, float(123.0f) );
240   DALI_TEST_CHECK( index == actor.GetPropertyIndex( name ) );
241   END_TEST;
242 }
243
244 int UtcDaliHandleGetPropertyIndex02(void)
245 {
246   tet_infoline("Positive Test Dali::Handle::GetPropertyIndex() int key");
247   TestApplication application;
248
249   Integration::Scene stage = application.GetScene();
250
251   Actor actor = Actor::New();
252   stage.Add( actor );
253
254   const unsigned int defaultPropertyCount = actor.GetPropertyCount();
255
256   application.SendNotification();
257   application.Render();
258
259   Property::Index key1 = CORE_PROPERTY_MAX_INDEX+1;
260   Property::Index key2 = CORE_PROPERTY_MAX_INDEX+2;
261
262   const Vector4 testColor(0.5f, 0.2f, 0.9f, 1.0f);
263   const float withFlake(99.f);
264
265   Property::Index index1 = actor.RegisterProperty( "MyPropertyOne", Vector3::ONE );
266   Property::Index index2 = DevelHandle::RegisterProperty( actor, key1, "sideColor", testColor);
267   Property::Index index3 = actor.RegisterProperty( "MyPropertyTwo", Vector3::ONE );
268   Property::Index index4 = DevelHandle::RegisterProperty( actor, key2, "iceCream", withFlake );
269   Property::Index index5 = actor.RegisterProperty( "MyPropertyThree", Vector3::ONE );
270
271   application.SendNotification();
272   application.Render();
273
274   // Test that we can get the property index from the integer key
275   Property::Index testIndex1 = DevelHandle::GetPropertyIndex( actor, key1 );
276   Property::Index testIndex2 = DevelHandle::GetPropertyIndex( actor, key2 );
277
278   DALI_TEST_EQUALS( index2, testIndex1, TEST_LOCATION );
279   DALI_TEST_EQUALS( index4, testIndex2, TEST_LOCATION );
280
281   // Test that we keep the same indices on the named properties
282   Property::Index testIndex = actor.GetPropertyIndex("MyPropertyOne");
283   DALI_TEST_EQUALS(testIndex, index1, TEST_LOCATION);
284   testIndex = actor.GetPropertyIndex("MyPropertyTwo");
285   DALI_TEST_EQUALS(testIndex, index3, TEST_LOCATION);
286   testIndex = actor.GetPropertyIndex("MyPropertyThree");
287   DALI_TEST_EQUALS(testIndex, index5, TEST_LOCATION);
288   testIndex = actor.GetPropertyIndex("sideColor");
289   DALI_TEST_EQUALS(testIndex, index2, TEST_LOCATION);
290   testIndex = actor.GetPropertyIndex("iceCream");
291   DALI_TEST_EQUALS(testIndex, index4, TEST_LOCATION);
292
293   DALI_TEST_EQUALS(defaultPropertyCount+5, actor.GetPropertyCount(), TEST_LOCATION);
294   END_TEST;
295 }
296
297 int UtcDaliHandleGetPropertyIndex03(void)
298 {
299   TestApplication application;
300
301   Actor actor = Actor::New();
302
303   std::string myName("croydon");
304   Property::Index intKey = CORE_PROPERTY_MAX_INDEX+1;
305   Property::Value value( Color::GREEN );
306   Property::Index myIndex = DevelHandle::RegisterProperty( actor, intKey, myName, value );
307
308   DALI_TEST_EQUALS( myIndex, DevelHandle::GetPropertyIndex( actor, intKey ), TEST_LOCATION );
309
310   Property::Key key1(myName);
311   Property::Key key2(intKey);
312
313   DALI_TEST_EQUALS( myIndex, DevelHandle::GetPropertyIndex( actor, key1 ), TEST_LOCATION );
314   DALI_TEST_EQUALS( myIndex, DevelHandle::GetPropertyIndex( actor, key2 ), TEST_LOCATION );
315   END_TEST;
316 }
317
318
319 int UtcDaliHandleIsPropertyWritable(void)
320 {
321   tet_infoline("Positive Test Dali::Handle::IsPropertyWritable()");
322   TestApplication application;
323
324   Actor actor = Actor::New();
325
326   // Actor properties which are writable:
327   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN ) );
328   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN_X ) );
329   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN_Y ) );
330   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN_Z ) );
331   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT ) );
332   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT_X ) );
333   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT_Y ) );
334   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT_Z ) );
335   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE ) );
336   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE_WIDTH  ) );
337   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE_HEIGHT ) );
338   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE_DEPTH  ) );
339   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION ) );
340   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION_X ) );
341   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION_Y ) );
342   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION_Z ) );
343   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ORIENTATION ) );
344   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE ) );
345   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE_X ) );
346   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE_Y ) );
347   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE_Z ) );
348   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::VISIBLE ) );
349   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR ) );
350   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_RED ) );
351   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_GREEN ) );
352   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_BLUE ) );
353   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_ALPHA ) );
354   DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::OPACITY ) );
355
356   // World-properties are not writable:
357   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION ) );
358   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_ORIENTATION ) );
359   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_SCALE ) );
360   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_COLOR ) );
361   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION_X ) );
362   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION_Y ) );
363   DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION_Z ) );
364
365   END_TEST;
366 }
367
368 int UtcDaliHandleIsPropertyAnimatable(void)
369 {
370   tet_infoline("Positive Test Dali::Handle::IsPropertyAnimatable()");
371   TestApplication application;
372
373   Actor actor = Actor::New();
374
375   // Actor properties which are animatable:
376   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN ) );
377   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN_X ) );
378   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN_Y ) );
379   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN_Z ) );
380   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT ) );
381   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT_X ) );
382   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT_Y ) );
383   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT_Z ) );
384   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE ) );
385   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE_WIDTH  ) );
386   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE_HEIGHT ) );
387   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE_DEPTH  ) );
388   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION ) );
389   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION_X ) );
390   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION_Y ) );
391   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION_Z ) );
392   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::ORIENTATION ) );
393   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE ) );
394   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE_X ) );
395   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE_Y ) );
396   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE_Z ) );
397   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::VISIBLE ) );
398   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR ) );
399   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_RED ) );
400   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_GREEN ) );
401   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_BLUE ) );
402   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_ALPHA ) );
403   DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::OPACITY ) );
404
405   // World-properties can not be animated
406   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION ) );
407   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_ORIENTATION ) );
408   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_SCALE ) );
409   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_COLOR ) );
410   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION_X ) );
411   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION_Y ) );
412   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION_Z ) );
413
414   END_TEST;
415 }
416
417 int UtcDaliHandleIsPropertyAConstraintInput(void)
418 {
419   TestApplication application;
420
421   Actor actor = Actor::New();
422
423   // Actor properties which can be used as a constraint input:
424   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN ) );
425   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN_X ) );
426   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN_Y ) );
427   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN_Z ) );
428   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT ) );
429   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT_X ) );
430   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT_Y ) );
431   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT_Z ) );
432   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE ) );
433   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_WIDTH  ) );
434   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_HEIGHT ) );
435   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_DEPTH  ) );
436   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION ) );
437   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_X ) );
438   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_Y ) );
439   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_Z ) );
440   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ORIENTATION ) );
441   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE ) );
442   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE_X ) );
443   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE_Y ) );
444   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE_Z ) );
445   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::VISIBLE ) );
446   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR ) );
447   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_RED ) );
448   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_GREEN ) );
449   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_BLUE ) );
450   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_ALPHA ) );
451   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::OPACITY ) );
452   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION ) );
453   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_ORIENTATION ) );
454   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_SCALE ) );
455   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_COLOR ) );
456   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION_X ) );
457   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION_Y ) );
458   DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION_Z ) );
459
460   // Actor properties that cannot be used as a constraint input
461   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::NAME ) );
462   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::SENSITIVE ) );
463   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::LEAVE_REQUIRED ) );
464   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::INHERIT_ORIENTATION ) );
465   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::INHERIT_SCALE ) );
466   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_MODE ) );
467   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::DRAW_MODE ) );
468   DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_MODE_FACTOR ) );
469
470   END_TEST;
471 }
472
473
474 int UtcDaliHandleGetPropertyType(void)
475 {
476   tet_infoline("Positive Test Dali::Handle::GetPropertyType()");
477   TestApplication application;
478
479   Actor actor = Actor::New();
480   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( Actor::Property::PARENT_ORIGIN ) );
481   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( Actor::Property::ANCHOR_POINT ) );
482   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( Actor::Property::SIZE ) );
483   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( Actor::Property::POSITION ) );
484   DALI_TEST_CHECK( Property::ROTATION == actor.GetPropertyType( Actor::Property::ORIENTATION ) );
485   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( Actor::Property::SCALE ) );
486   DALI_TEST_CHECK( Property::BOOLEAN  == actor.GetPropertyType( Actor::Property::VISIBLE ) );
487   DALI_TEST_CHECK( Property::VECTOR4  == actor.GetPropertyType( Actor::Property::COLOR ) );
488
489   // Register some dynamic properties
490   Property::Index boolIndex     = actor.RegisterProperty( "boolProperty",      bool(true) );
491   Property::Index floatIndex    = actor.RegisterProperty( "floatProperty",     float(123.0f) );
492   Property::Index intIndex      = actor.RegisterProperty( "intProperty",       123 );
493   Property::Index vector2Index  = actor.RegisterProperty( "vector2Property",   Vector2(1.0f, 2.0f) );
494   Property::Index vector3Index  = actor.RegisterProperty( "vector3Property",   Vector3(1.0f, 2.0f, 3.0f) );
495   Property::Index vector4Index  = actor.RegisterProperty( "vector4Property",   Vector4(1.0f, 2.0f, 3.0f, 4.0f) );
496   Property::Index rotationIndex = actor.RegisterProperty( "rotationProperty",  AngleAxis(Degree(180.0f), Vector3::YAXIS) );
497
498   DALI_TEST_CHECK( Property::BOOLEAN  == actor.GetPropertyType( boolIndex ) );
499   DALI_TEST_CHECK( Property::FLOAT    == actor.GetPropertyType( floatIndex ) );
500   DALI_TEST_CHECK( Property::INTEGER  == actor.GetPropertyType( intIndex ) );
501   DALI_TEST_CHECK( Property::VECTOR2  == actor.GetPropertyType( vector2Index ) );
502   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( vector3Index ) );
503   DALI_TEST_CHECK( Property::VECTOR4  == actor.GetPropertyType( vector4Index ) );
504   DALI_TEST_CHECK( Property::ROTATION == actor.GetPropertyType( rotationIndex ) );
505
506   // Non animatable properties
507   Property::Index nonAnimStringIndex = actor.RegisterProperty( "manFromDelmonte",   std::string("yes"), Property::READ_WRITE);
508   Property::Index nonAnimV2Index = actor.RegisterProperty( "v2", Vector2(1.f, 2.f), Property::READ_WRITE);
509   Property::Index nonAnimV3Index = actor.RegisterProperty( "v3", Vector3(1.f, 2.f, 3.f), Property::READ_WRITE);
510   Property::Index nonAnimV4Index = actor.RegisterProperty( "v4", Vector4(1.f, 2.f, 3.f, 4.f), Property::READ_WRITE);
511   Property::Index nonAnimBooleanIndex = actor.RegisterProperty( "bool", true, Property::READ_WRITE);
512   Property::Index nonAnimFloatIndex = actor.RegisterProperty( "float", 0.f, Property::READ_WRITE);
513   Property::Index nonAnimIntegerIndex = actor.RegisterProperty( "int", 0, Property::READ_WRITE);
514
515   DALI_TEST_CHECK( nonAnimStringIndex  != Property::INVALID_INDEX );
516   DALI_TEST_CHECK( nonAnimV2Index      != Property::INVALID_INDEX );
517   DALI_TEST_CHECK( nonAnimV3Index      != Property::INVALID_INDEX );
518   DALI_TEST_CHECK( nonAnimV4Index      != Property::INVALID_INDEX );
519   DALI_TEST_CHECK( nonAnimBooleanIndex != Property::INVALID_INDEX );
520   DALI_TEST_CHECK( nonAnimFloatIndex   != Property::INVALID_INDEX );
521   DALI_TEST_CHECK( nonAnimIntegerIndex != Property::INVALID_INDEX );
522
523   DALI_TEST_CHECK( Property::STRING   == actor.GetPropertyType( nonAnimStringIndex ) );
524   DALI_TEST_CHECK( Property::VECTOR2  == actor.GetPropertyType( nonAnimV2Index ) );
525   DALI_TEST_CHECK( Property::VECTOR3  == actor.GetPropertyType( nonAnimV3Index ) );
526   DALI_TEST_CHECK( Property::VECTOR4  == actor.GetPropertyType( nonAnimV4Index ) );
527   DALI_TEST_CHECK( Property::BOOLEAN  == actor.GetPropertyType( nonAnimBooleanIndex ) );
528   DALI_TEST_CHECK( Property::FLOAT    == actor.GetPropertyType( nonAnimFloatIndex ) );
529   DALI_TEST_CHECK( Property::INTEGER  == actor.GetPropertyType( nonAnimIntegerIndex ) );
530
531   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimStringIndex ) );
532   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV2Index ) );
533   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV3Index ) );
534   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV4Index ) );
535   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimBooleanIndex ) );
536   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimFloatIndex ) );
537   DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimIntegerIndex ) );
538
539   DALI_TEST_EQUALS( "yes" , actor.GetProperty( nonAnimStringIndex ).Get<std::string>(), TEST_LOCATION );
540   DALI_TEST_EQUALS( Vector2(1.f, 2.f) , actor.GetProperty( nonAnimV2Index ).Get<Vector2>(), TEST_LOCATION );
541   DALI_TEST_EQUALS( Vector3(1.f, 2.f, 3.f) , actor.GetProperty( nonAnimV3Index ).Get<Vector3>(), TEST_LOCATION );
542   DALI_TEST_EQUALS( Vector4(1.f, 2.f, 3.f, 4.f) , actor.GetProperty( nonAnimV4Index ).Get<Vector4>(), TEST_LOCATION );
543   DALI_TEST_EQUALS( true, actor.GetProperty( nonAnimBooleanIndex ).Get<bool>(), TEST_LOCATION );
544   DALI_TEST_EQUALS( 0.f, actor.GetProperty( nonAnimFloatIndex ).Get<float>(), TEST_LOCATION );
545   DALI_TEST_EQUALS( 0, actor.GetProperty( nonAnimIntegerIndex ).Get<int>(), TEST_LOCATION );
546
547   END_TEST;
548 }
549
550 int UtcDaliHandleNonAnimatableProperties(void)
551 {
552   tet_infoline("Test Non Animatable Properties");
553   TestApplication application;
554
555   Actor actor = Actor::New();
556
557   Property::Index nonAnimStringIndex = actor.RegisterProperty( "manFromDelmonte", std::string("no"), Property::READ_WRITE);
558
559   //// modify writable?
560   actor.SetProperty( nonAnimStringIndex, Property::Value("yes") );
561
562   DALI_TEST_CHECK( "yes"  == actor.GetProperty( nonAnimStringIndex ).Get<std::string>() );
563
564   //// cannot modify read only?
565   Property::Index readonly = actor.RegisterProperty( "float", 0.f, Property::READ_ONLY);
566
567   DALI_TEST_CHECK(!actor.IsPropertyAnimatable(readonly));
568   DALI_TEST_CHECK(!actor.IsPropertyWritable(readonly));
569
570   actor.SetProperty( readonly, Property::Value(1.f) );
571   // trying to set a read-only property is a no-op
572
573   DALI_TEST_EQUALS( 0.f, actor.GetProperty( readonly ).Get<float>(), TEST_LOCATION );
574
575   /// animatable can be set
576   Property::Index write_anim = actor.RegisterProperty( "write_float", 0.f, Property::ANIMATABLE);
577
578   DALI_TEST_CHECK(actor.IsPropertyAnimatable(write_anim));
579   DALI_TEST_CHECK(actor.IsPropertyWritable(write_anim));
580
581   actor.SetProperty( write_anim, Property::Value(1.f) );
582
583   //// animate a non animatable property throws
584   float durationSeconds(2.0f);
585   Animation animation = Animation::New(durationSeconds);
586   bool relativeValue(true);
587   try
588   {
589     animation.AnimateBy(Property(actor, nonAnimStringIndex), relativeValue, AlphaFunction::EASE_IN);
590   }
591   catch ( Dali::DaliException& e )
592   {
593     DALI_TEST_ASSERT( e, "Property type is not animatable", TEST_LOCATION );
594   }
595
596   DALI_TEST_EQUALS( "yes", actor.GetProperty( nonAnimStringIndex ).Get<std::string>(), TEST_LOCATION );
597
598   END_TEST;
599 }
600
601 int UtcDaliHandleNonAnimtableCompositeProperties(void)
602 {
603   tet_infoline("Test Non Animatable Composite Properties");
604   TestApplication application;
605
606   Actor actor = Actor::New();
607
608   Property::Value value(Property::ARRAY);
609   Property::Array* array = value.GetArray();
610   DALI_TEST_CHECK( array );
611
612   array->PushBack( Property::Value( 0.1f ) );
613   array->PushBack( "a string" );
614   array->PushBack( Property::Value( Vector3(1,2,3) ) );
615
616   DALI_TEST_EQUALS( 3u, array->Count(), TEST_LOCATION );
617
618   Property::Index propertyIndex = actor.RegisterProperty( "composite", value, Property::READ_WRITE );
619
620   Property::Value out = actor.GetProperty( propertyIndex );
621   Property::Array* outArray = out.GetArray();
622   DALI_TEST_CHECK( outArray != NULL );
623
624   DALI_TEST_CHECK( Property::FLOAT     == outArray->GetElementAt(0).GetType());
625   DALI_TEST_CHECK( Property::STRING    == outArray->GetElementAt(1).GetType());
626   DALI_TEST_CHECK( Property::VECTOR3   == outArray->GetElementAt(2).GetType());
627
628   DALI_TEST_EQUALS( 0.1f,            outArray->GetElementAt(0).Get<float>(),       TEST_LOCATION);
629   DALI_TEST_EQUALS( "a string",     outArray->GetElementAt(1).Get<std::string>(),  TEST_LOCATION);
630   DALI_TEST_EQUALS( Vector3(1,2,3), outArray->GetElementAt(2).Get<Vector3>(),      TEST_LOCATION);
631
632   // composite types not animatable
633   bool exception = false;
634   try
635   {
636     actor.RegisterProperty( "compositemap", value, Property::ANIMATABLE);
637   }
638   catch (Dali::DaliException& e)
639   {
640     exception = true;
641     DALI_TEST_PRINT_ASSERT( e );
642   }
643
644   DALI_TEST_EQUALS(exception, true, TEST_LOCATION);
645
646   // Map of maps
647   Property::Value mapOfMaps(Property::MAP);
648   Property::Map* map = mapOfMaps.GetMap();
649
650   map->Insert( "key", Property::Value(Property::MAP) );
651   map->Insert( "2key", "a string" );
652
653   DALI_TEST_EQUALS( "a string",  (*map)["2key"].Get<std::string>(),  TEST_LOCATION);
654
655   Property::Map* innerMap = map->Find("key")->GetMap();
656   innerMap->Insert( "subkey", 5.f );
657
658   DALI_TEST_CHECK( NULL != map->Find("key")->GetMap()->Find("subkey") );
659   DALI_TEST_EQUALS( 5.f, map->Find("key")->GetMap()->Find("subkey")->Get<float>(), TEST_LOCATION);
660   END_TEST;
661 }
662
663 int UtcDaliHandleSetProperty01(void)
664 {
665   tet_infoline("Positive Test Dali::Handle::SetProperty()");
666   TestApplication application;
667
668   Actor actor = Actor::New();
669   DALI_TEST_CHECK( ParentOrigin::TOP_LEFT == actor.GetProperty( Actor::Property::PARENT_ORIGIN ).Get<Vector3>() );
670
671   actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
672   // flush the queue and render once
673   application.SendNotification();
674   application.Render();
675   DALI_TEST_CHECK( ParentOrigin::CENTER == actor.GetProperty( Actor::Property::PARENT_ORIGIN ).Get<Vector3>() );
676   END_TEST;
677 }
678
679 int UtcDaliHandleSetProperty02(void)
680 {
681   tet_infoline("Positive Test Dali::Handle::SetProperty()");
682   TestApplication application;
683
684   Actor actor = Actor::New();
685
686   DALI_TEST_CHECK( !actor.IsPropertyWritable( Actor::Property::WORLD_POSITION ) );
687
688   // World position is not writable so this is a no-op and should not crash
689   actor.SetProperty( Actor::Property::WORLD_POSITION, Vector3(1,2,3) );
690
691   END_TEST;
692 }
693
694 int UtcDaliHandleRegisterProperty01(void)
695 {
696   tet_infoline("Positive Test Dali::Handle::RegisterProperty()");
697   TestApplication application;
698
699   Integration::Scene stage = application.GetScene();
700
701   Actor actor = Actor::New();
702   stage.Add( actor );
703
704   const unsigned int defaultPropertyCount = actor.GetPropertyCount();
705
706   application.SendNotification();
707   application.Render();
708
709   Property::Index index1 = actor.RegisterProperty( "MyProperty", Vector3::ONE );
710
711   application.SendNotification();
712   application.Render();
713
714   DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 1, TEST_LOCATION );
715   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index1 ), Vector3::ONE, TEST_LOCATION );
716
717   // No new property should be registered when we call the below function
718   Property::Index index2 = actor.RegisterProperty( "MyProperty", Vector3::ZAXIS );
719
720   application.SendNotification();
721   application.Render();
722
723
724   DALI_TEST_EQUALS( index1, index2, TEST_LOCATION ); // We should have the same index as per the first registration
725   DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 1, TEST_LOCATION ); // Property count should be the same
726   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index2 ), Vector3::ZAXIS, TEST_LOCATION ); // Value should be what we sent on second RegisterProperty call
727
728   END_TEST;
729 }
730
731 int UtcDaliHandleRegisterProperty02(void)
732 {
733   tet_infoline("Positive Test Dali::Handle::RegisterProperty() int key");
734   TestApplication application;
735
736   Integration::Scene stage = application.GetScene();
737
738   Actor actor = Actor::New();
739   stage.Add( actor );
740
741   const unsigned int defaultPropertyCount = actor.GetPropertyCount();
742
743   application.SendNotification();
744   application.Render();
745
746   Property::Index key1 = CORE_PROPERTY_MAX_INDEX+1;
747   Property::Index key2 = CORE_PROPERTY_MAX_INDEX+2;
748
749   const Vector4 testColor(0.5f, 0.2f, 0.9f, 1.0f);
750   const float withFlake(99.f);
751
752   Property::Index index1 = actor.RegisterProperty( "MyPropertyOne", Vector3::ONE );
753   Property::Index index2 = DevelHandle::RegisterProperty( actor, key1, "sideColor", testColor);
754   Property::Index index3 = DevelHandle::RegisterProperty( actor, key2, "iceCream", withFlake );
755
756   application.SendNotification();
757   application.Render();
758
759   DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 3, TEST_LOCATION );
760   DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index1 ), Vector3::ONE, TEST_LOCATION );
761   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index2 ), testColor, TEST_LOCATION );
762   DALI_TEST_EQUALS( actor.GetProperty< float >( index3 ), withFlake, TEST_LOCATION );
763
764   // No new property should be registered when we call the below functions
765   Property::Index testIndex2 = actor.RegisterProperty( "iceCream", 2200.f );
766   Property::Index testIndex1 = actor.RegisterProperty( "sideColor", Color::BLACK );
767   application.SendNotification();
768   application.Render();
769
770   DALI_TEST_EQUALS( index2, testIndex1, TEST_LOCATION ); // We should have the same index as per the first registration
771   DALI_TEST_EQUALS( index3, testIndex2, TEST_LOCATION ); // We should have the same index as per the first registration
772   DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 3, TEST_LOCATION ); // Property count should be the same
773   DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index2 ), Color::BLACK, TEST_LOCATION ); // Value should be what we sent on second RegisterProperty call
774   DALI_TEST_EQUALS( actor.GetProperty< float >( index3 ), 2200.f, TEST_LOCATION );
775
776   END_TEST;
777 }
778
779
780
781 int UtcDaliHandleGetProperty(void)
782 {
783   tet_infoline("Positive Test Dali::Handle::GetProperty()");
784   TestApplication application;
785
786   Actor actor = Actor::New();
787
788   DALI_TEST_CHECK( ParentOrigin::TOP_LEFT == actor.GetProperty( Actor::Property::PARENT_ORIGIN   ).Get<Vector3>() );
789   DALI_TEST_CHECK( AnchorPoint::CENTER    == actor.GetProperty( Actor::Property::ANCHOR_POINT    ).Get<Vector3>() );
790   DALI_TEST_CHECK( Vector3::ZERO          == actor.GetProperty( Actor::Property::SIZE            ).Get<Vector3>() );
791   DALI_TEST_CHECK( Vector3::ZERO          == actor.GetProperty( Actor::Property::POSITION        ).Get<Vector3>() );
792   DALI_TEST_CHECK( Vector3::ONE           == actor.GetProperty( Actor::Property::SCALE           ).Get<Vector3>() );
793   DALI_TEST_CHECK( true                   == actor.GetProperty( Actor::Property::VISIBLE         ).Get<bool>() );
794   DALI_TEST_CHECK( Color::WHITE           == actor.GetProperty( Actor::Property::COLOR           ).Get<Vector4>() );
795   END_TEST;
796 }
797
798 int UtcDaliHandleDownCast(void)
799 {
800   TestApplication application;
801   tet_infoline("Testing Dali::Handle::DownCast()");
802
803   Actor actor = Actor::New();
804
805   BaseHandle baseHandle = actor;
806
807   Handle handle = Handle::DownCast(baseHandle);
808
809   DALI_TEST_CHECK( handle );
810
811   baseHandle = BaseHandle();
812
813   handle = Handle::DownCast(baseHandle);
814
815   DALI_TEST_CHECK( !handle );
816
817   END_TEST;
818 }
819
820 int UtcDaliHandleDownCastNegative(void)
821 {
822   TestApplication application;
823
824   // BaseObject is NOT an Object, so this DownCast should fail
825   BaseHandle handle( new BaseObjectType );
826   Handle customHandle1 = Handle::DownCast( handle );
827   DALI_TEST_CHECK( ! customHandle1 );
828
829   // A DownCast on an empty handle will also fail
830   Handle empty;
831   Handle customHandle2 = Handle::DownCast( empty );
832   DALI_TEST_CHECK( ! customHandle2 );
833   END_TEST;
834 }
835
836 int UtcDaliHandleGetPropertyIndices(void)
837 {
838   TestApplication application;
839   Property::IndexContainer indices;
840
841   // Actor
842   Actor actor = Actor::New();
843   actor.GetPropertyIndices( indices );
844   int numDefaultProperties = indices.Size();
845   DALI_TEST_CHECK( numDefaultProperties > 0 );
846   DALI_TEST_EQUALS( numDefaultProperties, actor.GetPropertyCount(), TEST_LOCATION );
847
848   const Vector4 testColor(0.5f, 0.2f, 0.9f, 1.0f);
849   const float withFlake(99.f);
850
851   Property::Index key1 = CORE_PROPERTY_MAX_INDEX+1;
852   Property::Index key2 = CORE_PROPERTY_MAX_INDEX+2;
853
854   actor.RegisterProperty( "MyPropertyOne", Vector3::ONE );
855   DevelHandle::RegisterProperty( actor, key1, "sideColor", testColor);
856   actor.RegisterProperty( "MyPropertyTwo", 1234 );
857   Property::Index index4 = DevelHandle::RegisterProperty( actor, key2, "iceCream", withFlake );
858   actor.RegisterProperty( "MyPropertyThree", Vector2(.2f,.7f) );
859
860   actor.GetPropertyIndices( indices );
861
862   DALI_TEST_EQUALS( indices.Size(), numDefaultProperties + 5, TEST_LOCATION );
863   DALI_TEST_EQUALS( indices[indices.Size()-2], index4, TEST_LOCATION );
864
865   END_TEST;
866 }
867
868 int UtcDaliHandleRegisterPropertyTypes(void)
869 {
870   TestApplication application;
871
872   struct PropertyTypeAnimatable
873   {
874     const char * name;
875     Property::Value value;
876     bool animatable;
877   };
878
879   Property::Array array;
880   Property::Map map;
881
882   PropertyTypeAnimatable properties[] =
883   {
884     { "Property::BOOLEAN",          true,              true  },
885     { "Property::FLOAT",            1.0f,              true  },
886     { "Property::INTEGER",          1,                 true  },
887     { "Property::VECTOR2",          Vector2::ONE,      true  },
888     { "Property::VECTOR3",          Vector3::ONE,      true  },
889     { "Property::VECTOR4",          Vector4::ONE,      true  },
890     { "Property::MATRIX3",          Matrix3::IDENTITY, true  },
891     { "Property::MATRIX",           Matrix::IDENTITY,  true  },
892     { "Property::RECTANGLE",        Rect<int>(),       false },
893     { "Property::ROTATION",         AngleAxis(),       true  },
894     { "Property::STRING",           std::string("Me"), false },
895     { "Property::ARRAY",            array,             false },
896     { "Property::MAP",              map,               false },
897   };
898
899   unsigned int numOfProperties( sizeof( properties ) / sizeof( properties[0] ) );
900
901   for ( unsigned int i = 0; i < numOfProperties; ++i )
902   {
903     tet_printf( "Testing: %s\n", properties[i].name );
904
905     bool exception = false;
906     try
907     {
908       Actor actor = Actor::New();
909       actor.RegisterProperty( "manFromDelmonte",   properties[i].value );
910     }
911     catch (Dali::DaliException& e)
912     {
913       exception = true;
914     }
915
916     DALI_TEST_CHECK( properties[i].animatable != exception );
917   }
918   END_TEST;
919 }
920
921 int UtcDaliHandleCustomProperty(void)
922 {
923   TestApplication application;
924
925   Handle handle = Handle::New();
926
927   float startValue(1.0f);
928   Property::Index index = handle.RegisterProperty( "testProperty",  startValue );
929   DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
930
931   application.SendNotification();
932   application.Render(0);
933   DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
934   application.Render(0);
935   DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
936
937   handle.SetProperty( index, 5.0f );
938
939   application.SendNotification();
940   application.Render(0);
941   DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
942   application.Render(0);
943   DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
944   END_TEST;
945 }
946
947 int UtcDaliHandleCustomPropertyNone(void)
948 {
949   TestApplication application;
950
951   Handle handle = Handle::New();
952
953   Property::Value value( Property::NONE );
954   Property::Index index = handle.RegisterProperty( "testProperty", value, Property::READ_WRITE);
955
956   // Negative test i.e. setting a property of type NONE is meaningless
957   handle.SetProperty( index, 5.0f );
958
959   DALI_TEST_CHECK( true ); // got here without crashing
960
961   END_TEST;
962 }
963
964 int UtcDaliHandleCustomPropertyIntToFloat(void)
965 {
966   TestApplication application;
967
968   Handle handle = Handle::New();
969
970   float startValue(5.0f);
971   Property::Index index = handle.RegisterProperty( "testProperty",  startValue );
972   DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
973
974   application.SendNotification();
975   application.Render(0);
976   DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
977
978   handle.SetProperty( index, int(1) );
979
980   application.SendNotification();
981   application.Render(0);
982   DALI_TEST_CHECK( handle.GetProperty<float>(index) == 1.0f );
983   END_TEST;
984 }
985
986 int UtcDaliHandleCustomPropertyFloatToInt(void)
987 {
988   TestApplication application;
989
990   Handle handle = Handle::New();
991
992   int startValue(5);
993   Property::Index index = handle.RegisterProperty( "testProperty",  startValue );
994   DALI_TEST_CHECK( handle.GetProperty<int>(index) == startValue );
995
996   application.SendNotification();
997   application.Render(0);
998   DALI_TEST_CHECK( handle.GetProperty<int>(index) == startValue );
999
1000   handle.SetProperty( index, float(1.5) );
1001
1002   application.SendNotification();
1003   application.Render(0);
1004   DALI_TEST_CHECK( handle.GetProperty<int>(index) == 1 );
1005   END_TEST;
1006 }
1007
1008 int UtcDaliHandleCustomPropertyInvalidToRect(void)
1009 {
1010   TestApplication application;
1011
1012   Handle handle = Handle::New();
1013
1014   Rect<int> startValue(1,2,3,4);
1015   Property::Index index = handle.RegisterProperty( "testProperty", startValue, Property::READ_WRITE);
1016   DALI_TEST_EQUALS( handle.GetProperty< Rect<int> >( index ), startValue, TEST_LOCATION );
1017
1018   application.SendNotification();
1019   application.Render(0);
1020   DALI_TEST_EQUALS( handle.GetProperty< Rect<int> >( index ), startValue, TEST_LOCATION );
1021
1022   // Negative test i.e. there is no conversion from float to Rect
1023   handle.SetProperty( index, float(1.5) );
1024
1025   application.SendNotification();
1026   application.Render(0);
1027   DALI_TEST_EQUALS( handle.GetProperty< Rect<int> >( index ), startValue, TEST_LOCATION );
1028
1029   // Positive test (sanity check)
1030   Rect<int> endValue(5,6,7,8);
1031   handle.SetProperty( index, endValue );
1032   DALI_TEST_EQUALS( handle.GetProperty< Rect<int> >( index ), endValue, TEST_LOCATION );
1033
1034   application.SendNotification();
1035   application.Render(0);
1036   DALI_TEST_EQUALS( handle.GetProperty< Rect<int> >( index ), endValue, TEST_LOCATION );
1037
1038   END_TEST;
1039 }
1040
1041 int UtcDaliHandleCustomPropertyInvalidToString(void)
1042 {
1043   TestApplication application;
1044
1045   Handle handle = Handle::New();
1046
1047   std::string startValue( "Libraries gave us power" );
1048   Property::Index index = handle.RegisterProperty( "testProperty", startValue, Property::READ_WRITE);
1049   DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), startValue, TEST_LOCATION );
1050
1051   application.SendNotification();
1052   application.Render(0);
1053   DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), startValue, TEST_LOCATION );
1054
1055   // No conversion from Vector3 to std::string, therefore this should be a NOOP
1056   handle.SetProperty( index, Vector3(1,2,3) );
1057
1058   application.SendNotification();
1059   application.Render(0);
1060   DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), startValue, TEST_LOCATION );
1061
1062   // Positive test (sanity check)
1063   std::string endValue( "Then work came and made us free" );
1064   handle.SetProperty( index, endValue );
1065   DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), endValue, TEST_LOCATION );
1066
1067   application.SendNotification();
1068   application.Render(0);
1069   DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), endValue, TEST_LOCATION );
1070
1071   END_TEST;
1072 }
1073
1074 int UtcDaliHandleCustomPropertyInvalidToArray(void)
1075 {
1076   TestApplication application;
1077
1078   Handle handle = Handle::New();
1079
1080   Property::Value value( Property::ARRAY );
1081   std::string startValue( "The future teaches you to be alone" );
1082   value.GetArray()->PushBack( startValue );
1083
1084   Property::Index index = handle.RegisterProperty( "testProperty", value, Property::READ_WRITE);
1085   Property::Array check1 = handle.GetProperty< Property::Array >( index );
1086   DALI_TEST_EQUALS( check1.GetElementAt(0).Get<std::string>(), startValue, TEST_LOCATION );
1087
1088   application.SendNotification();
1089   application.Render(0);
1090   Property::Array check2 = handle.GetProperty< Property::Array >( index );
1091   DALI_TEST_EQUALS( check2.GetElementAt(0).Get<std::string>(), startValue, TEST_LOCATION );
1092
1093   // No conversion from int to ARRAY, therefore this should be a NOOP
1094   handle.SetProperty( index, int(2) );
1095
1096   application.SendNotification();
1097   application.Render(0);
1098   Property::Array check3 = handle.GetProperty< Property::Array >( index );
1099   DALI_TEST_EQUALS( check3.GetElementAt(0).Get<std::string>(), startValue, TEST_LOCATION );
1100
1101   // Positive test (sanity check)
1102   Property::Value value2(Property::ARRAY);
1103   std::string endValue( "The present to be afraid and cold" );
1104   value2.GetArray()->PushBack( endValue );
1105   handle.SetProperty( index, value2 );
1106
1107   Property::Array check4 = handle.GetProperty< Property::Array >( index );
1108   DALI_TEST_EQUALS( check4.GetElementAt(0).Get<std::string>(), endValue, TEST_LOCATION );
1109
1110   application.SendNotification();
1111   application.Render(0);
1112   Property::Array check5 = handle.GetProperty< Property::Array >( index );
1113   DALI_TEST_EQUALS( check5.GetElementAt(0).Get<std::string>(), endValue, TEST_LOCATION );
1114
1115   END_TEST;
1116 }
1117
1118 int UtcDaliHandleCustomPropertyInvalidToMap(void)
1119 {
1120   TestApplication application;
1121
1122   Handle handle = Handle::New();
1123
1124   Property::Value value( Property::MAP );
1125   std::string startValue( "Culture sucks down words" );
1126   value.GetMap()->Insert( "1", startValue );
1127
1128   Property::Index index = handle.RegisterProperty( "testProperty", value, Property::READ_WRITE );
1129   Property::Value* check1 = handle.GetProperty< Property::Map >( index ).Find("1");
1130   DALI_TEST_CHECK( NULL != check1 );
1131
1132   // No conversion from float to MAP, therefore this should be a NOOP
1133   handle.SetProperty( index, float(3.0) );
1134
1135   // Positive test (sanity check)
1136   Property::Value value2( Property::MAP );
1137   std::string endValue( "Itemise loathing and feed yourself smiles" );
1138   value.GetMap()->Insert( "1", endValue );
1139   handle.SetProperty( index, value2 );
1140
1141   END_TEST;
1142 }
1143
1144 int UtcDaliHandleCustomPropertyInvalidToExtents(void)
1145 {
1146   TestApplication application;
1147
1148   Handle handle = Handle::New();
1149
1150   Extents startValue(1,2,3,4);
1151   Property::Index index = handle.RegisterProperty( "testProperty", startValue, Property::READ_WRITE);
1152   DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), startValue, TEST_LOCATION );
1153
1154   application.SendNotification();
1155   application.Render(0);
1156   DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), startValue, TEST_LOCATION );
1157
1158   // Negative test i.e. there is no conversion from float to Extents
1159   handle.SetProperty( index, float(1.5) );
1160
1161   application.SendNotification();
1162   application.Render(0);
1163   DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), startValue, TEST_LOCATION );
1164
1165   // Positive test (sanity check)
1166   Extents endValue(5,6,7,8);
1167   handle.SetProperty( index, endValue );
1168   DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), endValue, TEST_LOCATION );
1169
1170   application.SendNotification();
1171   application.Render(0);
1172   DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), endValue, TEST_LOCATION );
1173
1174   END_TEST;
1175 }
1176
1177 int UtcDaliHandleCustomPropertyInvalidToBool(void)
1178 {
1179   TestApplication application;
1180
1181   Handle handle = Handle::New();
1182
1183   bool startValue(true);
1184   Property::Index index = handle.RegisterProperty( "testProperty", startValue, Property::READ_WRITE);
1185   DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), startValue, TEST_LOCATION );
1186
1187   application.SendNotification();
1188   application.Render(0);
1189   DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), startValue, TEST_LOCATION );
1190
1191   // Negative test i.e. there is no conversion from float to bool
1192   handle.SetProperty( index, float(0.0) );
1193
1194   application.SendNotification();
1195   application.Render(0);
1196   DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), startValue, TEST_LOCATION );
1197
1198   // Positive test (sanity check)
1199   bool endValue(false);
1200   handle.SetProperty( index, endValue );
1201   DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), endValue, TEST_LOCATION );
1202
1203   application.SendNotification();
1204   application.Render(0);
1205   DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), endValue, TEST_LOCATION );
1206
1207   END_TEST;
1208 }
1209
1210 int UtcDaliHandleCustomPropertyInvalidToInt(void)
1211 {
1212   TestApplication application;
1213
1214   Handle handle = Handle::New();
1215
1216   int startValue(5);
1217   Property::Index index = handle.RegisterProperty( "testProperty",  startValue );
1218   DALI_TEST_CHECK( handle.GetProperty<int>(index) == startValue );
1219
1220   application.SendNotification();
1221   application.Render(0);
1222   DALI_TEST_CHECK( handle.GetProperty<int>(index) == startValue );
1223
1224   // Negative test i.e. there is no conversion from Vector3 to int
1225   handle.SetProperty( index, Vector3(1,2,3) );
1226
1227   application.SendNotification();
1228   application.Render(0);
1229   DALI_TEST_CHECK( handle.GetProperty<int>(index) == startValue );
1230   END_TEST;
1231 }
1232
1233 int UtcDaliHandleCustomPropertyInvalidToFloat(void)
1234 {
1235   TestApplication application;
1236
1237   Handle handle = Handle::New();
1238
1239   float startValue(5.0);
1240   Property::Index index = handle.RegisterProperty( "testProperty",  startValue );
1241   DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
1242
1243   application.SendNotification();
1244   application.Render(0);
1245   DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
1246
1247   // Negative test i.e. there is no conversion from Vector3 to float
1248   handle.SetProperty( index, Vector3(1,2,3) );
1249
1250   application.SendNotification();
1251   application.Render(0);
1252   DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
1253   END_TEST;
1254 }
1255
1256 int UtcDaliHandleCustomPropertyInvalidToRotation(void)
1257 {
1258   TestApplication application;
1259
1260   Handle handle = Handle::New();
1261
1262   Quaternion startValue( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1263   Property::Index index = handle.RegisterProperty( "testProperty",  startValue );
1264   DALI_TEST_CHECK( handle.GetProperty<Quaternion>(index) == startValue );
1265
1266   application.SendNotification();
1267   application.Render(0);
1268   DALI_TEST_CHECK( handle.GetProperty<Quaternion>(index) == startValue );
1269
1270   // Negative test i.e. there is no conversion from float to Quaternion
1271   handle.SetProperty( index, float(7.0) );
1272
1273   application.SendNotification();
1274   application.Render(0);
1275   DALI_TEST_CHECK( handle.GetProperty<Quaternion>(index) == startValue );
1276
1277   // Positive test (sanity check)
1278   Quaternion endValue( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1279   handle.SetProperty( index, endValue );
1280   DALI_TEST_CHECK( handle.GetProperty<Quaternion>(index) == endValue );
1281
1282   END_TEST;
1283 }
1284
1285 int UtcDaliHandleCustomPropertyInvalidToMatrix(void)
1286 {
1287   TestApplication application;
1288
1289   Handle handle = Handle::New();
1290
1291   Quaternion rotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1292   Matrix startValue(rotation);
1293   Property::Index index = handle.RegisterProperty( "testProperty",  startValue );
1294   DALI_TEST_CHECK( handle.GetProperty<Matrix>(index) == startValue );
1295
1296   application.SendNotification();
1297   application.Render(0);
1298   DALI_TEST_CHECK( handle.GetProperty<Matrix>(index) == startValue );
1299
1300   // Negative test i.e. there is no conversion from float to Matrix
1301   handle.SetProperty( index, float(7.0) );
1302
1303   application.SendNotification();
1304   application.Render(0);
1305   DALI_TEST_CHECK( handle.GetProperty<Matrix>(index) == startValue );
1306
1307   // Positive test (sanity check)
1308   Quaternion endRotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
1309   Matrix endValue(endRotation);
1310   handle.SetProperty( index, endValue );
1311   DALI_TEST_CHECK( handle.GetProperty<Matrix>(index) == endValue );
1312
1313   END_TEST;
1314 }
1315
1316 int UtcDaliHandleCustomPropertyInvalidToMatrix3(void)
1317 {
1318   TestApplication application;
1319
1320   Handle handle = Handle::New();
1321
1322   Matrix3 startValue(11,12,13,
1323                      21,22,23,
1324                      31,32,33);
1325
1326   Property::Index index = handle.RegisterProperty( "testProperty",  startValue );
1327   DALI_TEST_CHECK( handle.GetProperty<Matrix3>(index) == startValue );
1328
1329   application.SendNotification();
1330   application.Render(0);
1331   DALI_TEST_CHECK( handle.GetProperty<Matrix3>(index) == startValue );
1332
1333   // Negative test i.e. there is no conversion from float to Matrix3
1334   handle.SetProperty( index, float(7.0) );
1335
1336   application.SendNotification();
1337   application.Render(0);
1338   DALI_TEST_CHECK( handle.GetProperty<Matrix3>(index) == startValue );
1339
1340   // Positive test (sanity check)
1341   Matrix3 endValue(31,32,33,
1342                    21,22,23,
1343                    11,12,13);
1344   handle.SetProperty( index, endValue );
1345   DALI_TEST_CHECK( handle.GetProperty<Matrix3>(index) == endValue );
1346
1347   END_TEST;
1348 }
1349
1350 int UtcDaliHandleWeightNew(void)
1351 {
1352   TestApplication application;
1353
1354   Handle handle = WeightObject::New();
1355   DALI_TEST_CHECK( handle.GetProperty<float>(WeightObject::WEIGHT) == 0.0f );
1356
1357   // process the message so scene object is added to update manager
1358   application.SendNotification();
1359   application.Render(0);
1360
1361   // no message to release scene object in this scenario
1362
1363   END_TEST;
1364 }
1365
1366 int UtcDaliHandleWeightNew2(void)
1367 {
1368   TestApplication application;
1369
1370   // scope for the weight object
1371   {
1372     Handle handle = WeightObject::New();
1373     DALI_TEST_CHECK( handle.GetProperty<float>(WeightObject::WEIGHT) == 0.0f );
1374
1375     // process the message so scene object is added to update manager
1376     application.SendNotification();
1377     application.Render(0);
1378   }
1379   // handle out of scope so object gets destroyed
1380   // process the message so update manager destroys the scene object
1381   application.SendNotification();
1382   application.Render(0);
1383
1384   END_TEST;
1385 }
1386
1387 int UtcDaliHandleSetTypeInfo(void)
1388 {
1389   TestApplication application;
1390   TypeRegistry typeRegistry = TypeRegistry::Get();
1391
1392   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
1393   DALI_TEST_CHECK( typeInfo );
1394
1395   Actor actor = Actor::DownCast(typeInfo.CreateInstance());
1396   DALI_TEST_CHECK( actor );
1397
1398   DevelHandle::SetTypeInfo(actor, typeInfo);
1399
1400   TypeInfo newTypeInfo;
1401   bool success = actor.GetTypeInfo( newTypeInfo );
1402   DALI_TEST_CHECK( success );
1403
1404   DALI_TEST_CHECK(typeInfo.GetName() == newTypeInfo.GetName());
1405   DALI_TEST_CHECK(typeInfo.GetBaseName() == newTypeInfo.GetBaseName());
1406
1407   END_TEST;
1408 }
1409
1410 int UtcDaliHandleCustomPropertySynchronousGetSet(void)
1411 {
1412   TestApplication application;
1413
1414   tet_infoline( "Create a custom property and set the value ensuring it can be retrieved synchronously" );
1415
1416   Actor actor = Actor::New();
1417   application.GetScene().Add( actor );
1418
1419   tet_infoline( "Create the custom property with an initial value" );
1420   float startValue(1.0f);
1421   Property::Index index = actor.RegisterProperty( "testProperty",  startValue );
1422   DALI_TEST_EQUALS( actor.GetProperty< float >( index ), startValue, TEST_LOCATION );
1423
1424   tet_infoline( "Set the value, retrieve it and ensure both the synchronous and the async version work" );
1425   actor.SetProperty( index, 5.0f );
1426   DALI_TEST_EQUALS( actor.GetProperty< float >( index ), 5.0f, TEST_LOCATION );
1427   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
1428
1429   tet_infoline( "Render and retrieve values again" );
1430   application.SendNotification();
1431   application.Render(0);
1432
1433   DALI_TEST_EQUALS( actor.GetProperty< float >( index ), 5.0f, TEST_LOCATION );
1434   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 5.0f, TEST_LOCATION );
1435
1436   END_TEST;
1437 }
1438
1439 int UtcDaliHandleCustomPropertyGetType(void)
1440 {
1441   TestApplication application;
1442
1443   tet_infoline( "Create a custom property and retrieve its type" );
1444
1445   Handle handle = Handle::New();
1446   Property::Index index = handle.RegisterProperty( "testProperty",  1.0f );
1447   DALI_TEST_EQUALS( handle.GetPropertyType( index ), Property::FLOAT, TEST_LOCATION );
1448
1449   END_TEST;
1450 }
1451
1452 int UtcDaliHandleCustomPropertyAccessMode(void)
1453 {
1454   TestApplication application;
1455
1456   tet_infoline( "Create a custom property and retrieve whether it's animatable etc." );
1457
1458   Handle handle = Handle::New();
1459   Property::Index index = handle.RegisterProperty( "testProperty",  1.0f );
1460   DALI_TEST_EQUALS( handle.IsPropertyAnimatable( index ), true, TEST_LOCATION );
1461   DALI_TEST_EQUALS( handle.IsPropertyWritable( index ), true, TEST_LOCATION );
1462
1463   index = handle.RegisterProperty( "testProperty2", 1.0f, Property::READ_ONLY );
1464   DALI_TEST_EQUALS( handle.IsPropertyAnimatable( index ), false, TEST_LOCATION );
1465   DALI_TEST_EQUALS( handle.IsPropertyWritable( index ), false, TEST_LOCATION );
1466
1467   index = handle.RegisterProperty( "testProperty3", 1.0f, Property::READ_WRITE );
1468   DALI_TEST_EQUALS( handle.IsPropertyAnimatable( index ), false, TEST_LOCATION );
1469   DALI_TEST_EQUALS( handle.IsPropertyWritable( index ), true, TEST_LOCATION );
1470
1471   END_TEST;
1472 }
1473
1474 int UtcDaliHandleGetCurrentProperty(void)
1475 {
1476   TestApplication application;
1477
1478   tet_infoline( "Get a default and non-animatable custom property using the GetCurrentProperty API" );
1479
1480   Actor actor = Actor::New();
1481   application.GetScene().Add( actor );
1482   DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
1483
1484   Property::Index index = actor.RegisterProperty( "testProperty3", 1.0f, Property::READ_WRITE );
1485   DALI_TEST_EQUALS( actor.GetProperty< float >( index ), 1.0f, TEST_LOCATION );
1486   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 1.0f, TEST_LOCATION );
1487
1488   actor.SetProperty( index, 2.0f );
1489   DALI_TEST_EQUALS( actor.GetProperty< float >( index ), 2.0f, TEST_LOCATION );
1490   DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 2.0f, TEST_LOCATION );
1491
1492   END_TEST;
1493 }
1494
1495 int UtcDaliHandleDoesCustomPropertyExistP1(void)
1496 {
1497   TestApplication application; // Needs type registry
1498
1499   tet_infoline( "Test if a registered custom property exists on object" );
1500
1501   Actor actor = Actor::New();
1502   auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f);
1503
1504   DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( actor, propertyIndex ), true, TEST_LOCATION );
1505   END_TEST;
1506 }
1507
1508 int UtcDaliHandleDoesCustomPropertyExistN1(void)
1509 {
1510   TestApplication application; // Needs type registry
1511
1512   tet_infoline( "Test if a registered custom property does not exist on object" );
1513
1514   Actor actor = Actor::New();
1515   auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f);
1516
1517   DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( actor, propertyIndex+1 ), false, TEST_LOCATION );
1518   END_TEST;
1519 }
1520
1521 int UtcDaliHandleDoesCustomPropertyExistN2(void)
1522 {
1523   TestApplication application; // Needs type registry
1524
1525   tet_infoline( "Test that a default property does not show as a custom property on object" );
1526
1527   Actor actor = Actor::New();
1528   DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( actor, Actor::Property::POSITION ), false, TEST_LOCATION );
1529   END_TEST;
1530 }
1531
1532 int UtcDaliHandleDoesCustomPropertyExistN3(void)
1533 {
1534   TestApplication application; // Needs type registry
1535
1536   tet_infoline( "Test that a child property does not exist on actor after parenting to container" );
1537   TypeRegistry typeRegistry = TypeRegistry::Get();
1538
1539   auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) );
1540
1541   const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX );
1542   const char* CHILD_PROPERTY_NAME( "childProperty" );
1543
1544   ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER );
1545
1546   auto container = Test::TestCustomActor::New();
1547   application.GetScene().Add( container );
1548   auto child = Actor::New();
1549   container.Add( child ); // Resolve child properties (if any)
1550
1551   DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( child, CHILD_PROPERTY ), false, TEST_LOCATION );
1552   END_TEST;
1553 }
1554
1555 int UtcDaliHandleDoesCustomPropertyExistP2(void)
1556 {
1557   TestApplication application; // Needs type registry
1558
1559   tet_infoline( "Test that a child property exists after being set" );
1560   TypeRegistry typeRegistry = TypeRegistry::Get();
1561
1562   auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) );
1563
1564   const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX );
1565   const char* CHILD_PROPERTY_NAME( "childProperty" );
1566
1567   ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER );
1568
1569   auto container = Test::TestCustomActor::New();
1570   application.GetScene().Add( container );
1571   auto child = Actor::New();
1572   container.Add( child ); // Resolve child properties (if any)
1573   child.SetProperty( CHILD_PROPERTY, 2 );
1574
1575   DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( child, CHILD_PROPERTY ), true, TEST_LOCATION );
1576   DALI_TEST_EQUALS( child.GetProperty<int>( CHILD_PROPERTY ), 2, TEST_LOCATION );
1577   END_TEST;
1578 }
1579
1580 int UtcDaliHandleDoesCustomPropertyExistP3(void)
1581 {
1582   TestApplication application; // Needs type registry
1583
1584   tet_infoline( "Test that a child property is re-indexed after registration, and that it exists" );
1585   TypeRegistry typeRegistry = TypeRegistry::Get();
1586
1587   auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) );
1588
1589   const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX );
1590   const char* CHILD_PROPERTY_NAME( "childProperty" );
1591
1592   ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER );
1593
1594   auto container = Test::TestCustomActor::New();
1595   application.GetScene().Add( container );
1596   auto child = Actor::New();
1597   child.RegisterProperty( CHILD_PROPERTY_NAME, Property::Value(3) );
1598   container.Add( child ); // Resolve child properties (if any)
1599
1600   DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( child, CHILD_PROPERTY ), true, TEST_LOCATION );
1601   DALI_TEST_EQUALS( child.GetProperty<int>( CHILD_PROPERTY ), 3, TEST_LOCATION );
1602   END_TEST;
1603 }
1604
1605 namespace
1606 {
1607
1608 struct PropertySetSignalCheck
1609 {
1610   PropertySetSignalCheck(bool& signalReceived, Property::Value& value)
1611   : mSignalReceived(signalReceived),
1612     mValue(value)
1613   {
1614   }
1615
1616   void operator()(Handle& handle, Property::Index index, Property::Value value)
1617   {
1618     mSignalReceived = true;
1619     mValue = value;
1620   }
1621
1622   void Reset()
1623   {
1624     mSignalReceived = false;
1625   }
1626
1627   void CheckSignalReceived()
1628   {
1629     if (!mSignalReceived)
1630     {
1631       tet_printf("Expected Property Set signal was not received\n");
1632       tet_result(TET_FAIL);
1633     }
1634     else
1635     {
1636       tet_result(TET_PASS);
1637     }
1638   }
1639
1640   bool& mSignalReceived; // owned by individual tests
1641   Property::Value& mValue;
1642 };
1643
1644 } // anon namespace
1645
1646 int UtcDaliHandlePropertySetSignal01(void)
1647 {
1648   TestApplication application;
1649
1650   bool signalReceived(false);
1651   Property::Value value;
1652   PropertySetSignalCheck propertySetCheck(signalReceived, value);
1653
1654   tet_infoline( "Test that setting a default property triggers a signal" );
1655
1656   auto actor = Actor::New();
1657   DevelHandle::PropertySetSignal(actor).Connect(&application, propertySetCheck);
1658
1659   actor.SetProperty( Actor::Property::POSITION, Vector3::XAXIS );
1660   propertySetCheck.CheckSignalReceived();
1661
1662   END_TEST;
1663 }
1664
1665
1666 int UtcDaliHandlePropertySetSignal02(void)
1667 {
1668   TestApplication application;
1669
1670   bool signalReceived(false);
1671   Property::Value value;
1672   PropertySetSignalCheck propertySetCheck(signalReceived, value);
1673
1674   tet_infoline( "Test that setting a custom property triggers a signal" );
1675
1676   auto actor = Actor::New();
1677   DevelHandle::PropertySetSignal(actor).Connect(&application, propertySetCheck);
1678
1679   auto propertyIndex = actor.RegisterProperty("propName", 3.0f);
1680   actor.SetProperty( propertyIndex, 5.0f );
1681   propertySetCheck.CheckSignalReceived();
1682   DALI_TEST_EQUALS( propertySetCheck.mValue, Property::Value( 5.0f ), 0.001f, TEST_LOCATION );
1683
1684   END_TEST;
1685 }
1686
1687 int UtcDaliHandlePropertySetSignal03(void)
1688 {
1689   TestApplication application;
1690   TypeRegistry typeRegistry = TypeRegistry::Get();
1691
1692   bool signalReceived(false);
1693   Property::Value value;
1694   PropertySetSignalCheck propertySetCheck(signalReceived, value);
1695
1696   tet_infoline( "Test that setting a child property triggers a signal" );
1697
1698   auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) );
1699
1700   const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX );
1701   const char* CHILD_PROPERTY_NAME( "childProperty" );
1702
1703   ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER );
1704
1705   auto container = Test::TestCustomActor::New();
1706   application.GetScene().Add( container );
1707   auto child = Actor::New();
1708   child.RegisterProperty( CHILD_PROPERTY_NAME, Property::Value(3) );
1709   DevelHandle::PropertySetSignal(child).Connect(&application, propertySetCheck);
1710   container.Add( child ); // Resolve child properties (if any)
1711
1712   DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( child, CHILD_PROPERTY ), true, TEST_LOCATION );
1713   DALI_TEST_EQUALS( child.GetProperty<int>( CHILD_PROPERTY ), 3, TEST_LOCATION );
1714
1715   child.SetProperty( CHILD_PROPERTY, 29 );
1716   propertySetCheck.CheckSignalReceived();
1717   DALI_TEST_EQUALS( propertySetCheck.mValue, Property::Value( 29 ), TEST_LOCATION );
1718   END_TEST;
1719 }
1720
1721 int UtcDaliHandlePropertySetProperties(void)
1722 {
1723   TestApplication application;
1724   const Vector3 actorSize( 10.0f, 20.0f, 30.0f );
1725   const Vector3 anchorPoint( 1.0f, 0.5f, 0.0f );
1726   const Vector4 color( 0.1f, 0.2, 0.3f, 0.4f );
1727
1728   Handle handle = Actor::New();
1729   DevelHandle::SetProperties(
1730     handle,
1731     Property::Map
1732     {
1733       { Actor::Property::SIZE, actorSize },
1734       { Actor::Property::ANCHOR_POINT, anchorPoint },
1735       { "color", color },
1736       { "invalid", Vector2::ZERO } // It should quietly ignore invalid data
1737     }
1738   );
1739   DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(), actorSize, TEST_LOCATION );
1740   DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::ANCHOR_POINT ).Get< Vector3 >(), anchorPoint, TEST_LOCATION );
1741   DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::COLOR ).Get< Vector4 >(), color, TEST_LOCATION );
1742
1743   END_TEST;
1744 }
1745
1746 int UtcDaliHandleTemplateNew(void)
1747 {
1748   TestApplication application;
1749   const Vector3 actorSize( 10.0f, 20.0f, 30.0f );
1750   const Vector3 anchorPoint( 1.0f, 0.5f, 0.0f );
1751   const Vector4 color( 0.1f, 0.2, 0.3f, 0.4f );
1752
1753   Handle handle = DevelHandle::New< Actor >(
1754     Property::Map
1755     {
1756       { Actor::Property::SIZE, actorSize },
1757       { Actor::Property::ANCHOR_POINT, anchorPoint },
1758       { "color", color },
1759       { "invalid", Vector2::ZERO } // It should quietly ignore invalid data
1760     }
1761   );
1762
1763   DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(), actorSize, TEST_LOCATION );
1764   DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::ANCHOR_POINT ).Get< Vector3 >(), anchorPoint, TEST_LOCATION );
1765   DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::COLOR ).Get< Vector4 >(), color, TEST_LOCATION );
1766
1767   END_TEST;
1768 }
1769
1770 int UtcDaliHandleGetProperties(void)
1771 {
1772   TestApplication application;
1773
1774   Handle handle = Actor::New();
1775   DevelHandle::SetProperties(
1776     handle,
1777     Property::Map
1778     {
1779       { Actor::Property::SIZE, Vector3( 400.0f, 200.0f, 100.0f ) },
1780       { Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER },
1781       { Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER },
1782       { Actor::Property::NAME, "Actor" },
1783       { Actor::Property::LEAVE_REQUIRED, true },
1784       { "color", Color::RED },
1785     }
1786   );
1787
1788   Property::Map map;
1789   DevelHandle::GetProperties( handle, map );
1790
1791   // Get all the properties and ensure they match
1792
1793   DALI_TEST_EQUALS( handle.GetPropertyCount(), map.Count(), TEST_LOCATION );
1794
1795   for( auto position = 0u; position < map.Count(); ++position )
1796   {
1797     auto keyValuePair = map.GetKeyValue( position );
1798     const auto& index = keyValuePair.first.indexKey;
1799     const auto& value = keyValuePair.second;
1800     auto handleValue = handle.GetProperty( index );
1801
1802     switch( value.GetType() )
1803     {
1804       case Property::NONE:       break;
1805       case Property::BOOLEAN:    DALI_TEST_EQUALS( value.Get< bool >(), handleValue.Get< bool >(), TEST_LOCATION ); break;
1806       case Property::FLOAT:      DALI_TEST_EQUALS( value.Get< float >(), handleValue.Get< float >(), TEST_LOCATION ); break;
1807       case Property::INTEGER:    DALI_TEST_EQUALS( value.Get< int >(), handleValue.Get< int >(), TEST_LOCATION ); break;
1808       case Property::VECTOR2:    DALI_TEST_EQUALS( value.Get< Vector2 >(), handleValue.Get< Vector2 >(), TEST_LOCATION ); break;
1809       case Property::VECTOR3:    DALI_TEST_EQUALS( value.Get< Vector3 >(), handleValue.Get< Vector3 >(), TEST_LOCATION ); break;
1810       case Property::VECTOR4:    DALI_TEST_EQUALS( value.Get< Vector4 >(), handleValue.Get< Vector4 >(), TEST_LOCATION ); break;
1811       case Property::MATRIX3:    DALI_TEST_EQUALS( value.Get< Matrix3 >(), handleValue.Get< Matrix3 >(), TEST_LOCATION ); break;
1812       case Property::MATRIX:     DALI_TEST_EQUALS( value.Get< Matrix >(), handleValue.Get< Matrix >(), TEST_LOCATION ); break;
1813       case Property::RECTANGLE:  DALI_TEST_EQUALS( value.Get< Rect< int > >(), handleValue.Get< Rect< int > >(), TEST_LOCATION ); break;
1814       case Property::ROTATION:   DALI_TEST_EQUALS( value.Get< Quaternion >(), handleValue.Get< Quaternion >(), TEST_LOCATION ); break;
1815       case Property::STRING:     DALI_TEST_EQUALS( value.Get< std::string >(), handleValue.Get< std::string >(), TEST_LOCATION ); break;
1816       case Property::ARRAY:      DALI_TEST_EQUALS( value.GetArray()->Count(), handleValue.GetArray()->Count(), TEST_LOCATION ); break;
1817       case Property::MAP:        DALI_TEST_EQUALS( value.GetMap()->Count(), handleValue.GetMap()->Count(), TEST_LOCATION ); break;
1818       case Property::EXTENTS:    DALI_TEST_EQUALS( value.Get< Extents >(), handleValue.Get< Extents >(), TEST_LOCATION ); break;
1819     }
1820   }
1821
1822   // Add a custom property and ensure the count goes up by one.
1823   const auto countBefore = map.Count();
1824   handle.RegisterProperty( "tempProperty", Color::GREEN );
1825   DevelHandle::GetProperties( handle, map );
1826   DALI_TEST_EQUALS( countBefore + 1, map.Count(), TEST_LOCATION );
1827
1828   END_TEST;
1829 }
1830
1831 int UtcDaliHandleSetPropertyNegative(void)
1832 {
1833   TestApplication application;
1834   Dali::Handle instance;
1835   try
1836   {
1837     int arg1(0);
1838     Dali::Property::Value arg2;
1839     instance.SetProperty(arg1,arg2);
1840     DALI_TEST_CHECK(false); // Should not get here
1841   }
1842   catch(...)
1843   {
1844     DALI_TEST_CHECK(true); // We expect an assert
1845   }
1846   END_TEST;
1847 }
1848
1849 int UtcDaliHandleRegisterPropertyNegative01(void)
1850 {
1851   TestApplication application;
1852   Dali::Handle instance;
1853   try
1854   {
1855     std::string arg1;
1856     Dali::Property::Value arg2;
1857     instance.RegisterProperty(arg1,arg2);
1858     DALI_TEST_CHECK(false); // Should not get here
1859   }
1860   catch(...)
1861   {
1862     DALI_TEST_CHECK(true); // We expect an assert
1863   }
1864   END_TEST;
1865 }
1866
1867 int UtcDaliHandleRegisterPropertyNegative02(void)
1868 {
1869   TestApplication application;
1870   Dali::Handle instance;
1871   try
1872   {
1873     std::string arg1;
1874     Dali::Property::Value arg2;
1875     Dali::Property::AccessMode arg3(Property::READ_ONLY);
1876     instance.RegisterProperty(arg1,arg2,arg3);
1877     DALI_TEST_CHECK(false); // Should not get here
1878   }
1879   catch(...)
1880   {
1881     DALI_TEST_CHECK(true); // We expect an assert
1882   }
1883   END_TEST;
1884 }
1885
1886 int UtcDaliHandleRemoveConstraintsNegative01(void)
1887 {
1888   TestApplication application;
1889   Dali::Handle instance;
1890   try
1891   {
1892     unsigned int arg1(0u);
1893     instance.RemoveConstraints(arg1);
1894     DALI_TEST_CHECK(false); // Should not get here
1895   }
1896   catch(...)
1897   {
1898     DALI_TEST_CHECK(true); // We expect an assert
1899   }
1900   END_TEST;
1901 }
1902
1903 int UtcDaliHandleRemoveConstraintsNegative02(void)
1904 {
1905   TestApplication application;
1906   Dali::Handle instance;
1907   try
1908   {
1909     instance.RemoveConstraints();
1910     DALI_TEST_CHECK(false); // Should not get here
1911   }
1912   catch(...)
1913   {
1914     DALI_TEST_CHECK(true); // We expect an assert
1915   }
1916   END_TEST;
1917 }
1918
1919 int UtcDaliHandleAddPropertyNotificationNegative01(void)
1920 {
1921   TestApplication application;
1922   Dali::Handle instance;
1923   try
1924   {
1925     int arg1(0);
1926     int arg2(0);
1927     Dali::PropertyCondition arg3;
1928     instance.AddPropertyNotification(arg1,arg2,arg3);
1929     DALI_TEST_CHECK(false); // Should not get here
1930   }
1931   catch(...)
1932   {
1933     DALI_TEST_CHECK(true); // We expect an assert
1934   }
1935   END_TEST;
1936 }
1937
1938 int UtcDaliHandleAddPropertyNotificationNegative02(void)
1939 {
1940   TestApplication application;
1941   Dali::Handle instance;
1942   try
1943   {
1944     int arg1(0);
1945     Dali::PropertyCondition arg2;
1946     instance.AddPropertyNotification(arg1,arg2);
1947     DALI_TEST_CHECK(false); // Should not get here
1948   }
1949   catch(...)
1950   {
1951     DALI_TEST_CHECK(true); // We expect an assert
1952   }
1953   END_TEST;
1954 }
1955
1956 int UtcDaliHandleRemovePropertyNotificationNegative(void)
1957 {
1958   TestApplication application;
1959   Dali::Handle instance;
1960   try
1961   {
1962     Dali::PropertyNotification arg1;
1963     instance.RemovePropertyNotification(arg1);
1964     DALI_TEST_CHECK(false); // Should not get here
1965   }
1966   catch(...)
1967   {
1968     DALI_TEST_CHECK(true); // We expect an assert
1969   }
1970   END_TEST;
1971 }
1972
1973 int UtcDaliHandleRemovePropertyNotificationsNegative(void)
1974 {
1975   TestApplication application;
1976   Dali::Handle instance;
1977   try
1978   {
1979     instance.RemovePropertyNotifications();
1980     DALI_TEST_CHECK(false); // Should not get here
1981   }
1982   catch(...)
1983   {
1984     DALI_TEST_CHECK(true); // We expect an assert
1985   }
1986   END_TEST;
1987 }
1988
1989 int UtcDaliHandleGetPropertyNegative(void)
1990 {
1991   TestApplication application;
1992   Dali::Handle instance;
1993   try
1994   {
1995     int arg1(0);
1996     instance.GetProperty(arg1);
1997     DALI_TEST_CHECK(false); // Should not get here
1998   }
1999   catch(...)
2000   {
2001     DALI_TEST_CHECK(true); // We expect an assert
2002   }
2003   END_TEST;
2004 }
2005
2006 int UtcDaliHandleGetPropertyNameNegative(void)
2007 {
2008   TestApplication application;
2009   Dali::Handle instance;
2010   try
2011   {
2012     int arg1(0);
2013     instance.GetPropertyName(arg1);
2014     DALI_TEST_CHECK(false); // Should not get here
2015   }
2016   catch(...)
2017   {
2018     DALI_TEST_CHECK(true); // We expect an assert
2019   }
2020   END_TEST;
2021 }
2022
2023 int UtcDaliHandleGetPropertyTypeNegative(void)
2024 {
2025   TestApplication application;
2026   Dali::Handle instance;
2027   try
2028   {
2029     int arg1(0);
2030     instance.GetPropertyType(arg1);
2031     DALI_TEST_CHECK(false); // Should not get here
2032   }
2033   catch(...)
2034   {
2035     DALI_TEST_CHECK(true); // We expect an assert
2036   }
2037   END_TEST;
2038 }
2039
2040 int UtcDaliHandleGetPropertyCountNegative(void)
2041 {
2042   TestApplication application;
2043   Dali::Handle instance;
2044   try
2045   {
2046     instance.GetPropertyCount();
2047     DALI_TEST_CHECK(false); // Should not get here
2048   }
2049   catch(...)
2050   {
2051     DALI_TEST_CHECK(true); // We expect an assert
2052   }
2053   END_TEST;
2054 }
2055
2056 int UtcDaliHandleGetPropertyIndexNegative(void)
2057 {
2058   TestApplication application;
2059   Dali::Handle instance;
2060   try
2061   {
2062     std::string arg1;
2063     instance.GetPropertyIndex(arg1);
2064     DALI_TEST_CHECK(false); // Should not get here
2065   }
2066   catch(...)
2067   {
2068     DALI_TEST_CHECK(true); // We expect an assert
2069   }
2070   END_TEST;
2071 }
2072
2073 int UtcDaliHandleGetCurrentPropertyNegative(void)
2074 {
2075   TestApplication application;
2076   Dali::Handle instance;
2077   try
2078   {
2079     int arg1(0);
2080     instance.GetCurrentProperty(arg1);
2081     DALI_TEST_CHECK(false); // Should not get here
2082   }
2083   catch(...)
2084   {
2085     DALI_TEST_CHECK(true); // We expect an assert
2086   }
2087   END_TEST;
2088 }
2089
2090 int UtcDaliHandleGetPropertyIndicesNegative(void)
2091 {
2092   TestApplication application;
2093   Dali::Handle instance;
2094   try
2095   {
2096     Dali::Vector<int> arg1;
2097     instance.GetPropertyIndices(arg1);
2098     DALI_TEST_CHECK(false); // Should not get here
2099   }
2100   catch(...)
2101   {
2102     DALI_TEST_CHECK(true); // We expect an assert
2103   }
2104   END_TEST;
2105 }
2106
2107 int UtcDaliHandleIsPropertyWritableNegative(void)
2108 {
2109   TestApplication application;
2110   Dali::Handle instance;
2111   try
2112   {
2113     int arg1(0);
2114     instance.IsPropertyWritable(arg1);
2115     DALI_TEST_CHECK(false); // Should not get here
2116   }
2117   catch(...)
2118   {
2119     DALI_TEST_CHECK(true); // We expect an assert
2120   }
2121   END_TEST;
2122 }
2123
2124 int UtcDaliHandleIsPropertyAnimatableNegative(void)
2125 {
2126   TestApplication application;
2127   Dali::Handle instance;
2128   try
2129   {
2130     int arg1(0);
2131     instance.IsPropertyAnimatable(arg1);
2132     DALI_TEST_CHECK(false); // Should not get here
2133   }
2134   catch(...)
2135   {
2136     DALI_TEST_CHECK(true); // We expect an assert
2137   }
2138   END_TEST;
2139 }
2140
2141 int UtcDaliHandleIsPropertyAConstraintInputNegative(void)
2142 {
2143   TestApplication application;
2144   Dali::Handle instance;
2145   try
2146   {
2147     int arg1(0);
2148     instance.IsPropertyAConstraintInput(arg1);
2149     DALI_TEST_CHECK(false); // Should not get here
2150   }
2151   catch(...)
2152   {
2153     DALI_TEST_CHECK(true); // We expect an assert
2154   }
2155   END_TEST;
2156 }
2157
2158 int UtcDaliHandleSupportsNegative(void)
2159 {
2160   TestApplication application;
2161   Dali::Handle instance;
2162   try
2163   {
2164     Dali::Handle::Capability arg1(Handle::DYNAMIC_PROPERTIES);
2165     instance.Supports(arg1);
2166     DALI_TEST_CHECK(false); // Should not get here
2167   }
2168   catch(...)
2169   {
2170     DALI_TEST_CHECK(true); // We expect an assert
2171   }
2172   END_TEST;
2173 }