Merge "Removed On(...)Event()" into devel/master
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-CustomActor.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 #include <stdlib.h>
20 #include <dali/public-api/dali-core.h>
21
22 #include <dali/devel-api/actors/custom-actor-devel.h>
23 #include <dali/integration-api/events/touch-event-integ.h>
24 #include <dali/integration-api/events/hover-event-integ.h>
25 #include <dali/integration-api/events/wheel-event-integ.h>
26 #include <dali/integration-api/events/key-event-integ.h>
27 #include <dali/public-api/object/type-registry-helper.h>
28 #include "dali-test-suite-utils/dali-test-suite-utils.h"
29 #include "test-custom-actor.h"
30
31 using namespace Dali;
32
33
34 void custom_actor_test_startup(void)
35 {
36   test_return_value = TET_UNDEF;
37 }
38
39 void custom_actor_test_cleanup(void)
40 {
41   test_return_value = TET_PASS;
42 }
43
44
45
46 using namespace Dali;
47
48
49 int UtcDaliCustomActorDestructor(void)
50 {
51   TestApplication application;
52
53   CustomActor* actor = new CustomActor();
54   delete actor;
55
56   DALI_TEST_CHECK( true );
57   END_TEST;
58 }
59
60 int UtcDaliCustomActorImplDestructor(void)
61 {
62   TestApplication application;
63   CustomActorImpl* actor = new Test::Impl::TestCustomActor();
64   CustomActor customActor( *actor ); // Will automatically unref at the end of this function
65
66   DALI_TEST_CHECK( true );
67   END_TEST;
68 }
69
70 // Positive test case for a method
71 int UtcDaliCustomActorDownCast(void)
72 {
73   TestApplication application;
74   tet_infoline("Testing Dali::CustomActor::DownCast()");
75
76   Test::TestCustomActor custom = Test::TestCustomActor::New();
77
78   Actor anActor = Actor::New();
79   anActor.Add( custom );
80
81   Actor child = anActor.GetChildAt(0);
82   CustomActor customActor = CustomActor::DownCast( child );
83   DALI_TEST_CHECK( customActor );
84
85   customActor = NULL;
86   DALI_TEST_CHECK( !customActor );
87
88   customActor = DownCast< CustomActor >( child );
89   DALI_TEST_CHECK( customActor );
90   END_TEST;
91 }
92
93 // Negative test case for a method
94 int UtcDaliCustomActorDownCastNegative(void)
95 {
96   TestApplication application;
97   tet_infoline("Testing Dali::CustomActor::DownCast()");
98
99   Actor actor1 = Actor::New();
100   Actor anActor = Actor::New();
101   anActor.Add(actor1);
102
103   Actor child = anActor.GetChildAt(0);
104   CustomActor customActor = CustomActor::DownCast( child );
105   DALI_TEST_CHECK( !customActor );
106
107   Actor unInitialzedActor;
108   customActor = CustomActor::DownCast( unInitialzedActor );
109   DALI_TEST_CHECK( !customActor );
110
111   customActor = DownCast< CustomActor >( unInitialzedActor );
112   DALI_TEST_CHECK( !customActor );
113   END_TEST;
114 }
115
116 int UtcDaliCustomActorMoveConstructor(void)
117 {
118   TestApplication application;
119
120   Test::TestCustomActor custom = Test::TestCustomActor::New();
121   DALI_TEST_CHECK( custom );
122   DALI_TEST_EQUALS( 1, custom.GetBaseObject().ReferenceCount(), TEST_LOCATION );
123
124   int id = custom.GetProperty< int >( Actor::Property::ID );
125
126   Test::TestCustomActor moved = std::move( custom );
127   DALI_TEST_CHECK( moved );
128   DALI_TEST_EQUALS( id, moved.GetProperty< int >( Actor::Property::ID ), TEST_LOCATION );
129   DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
130   DALI_TEST_CHECK( !custom );
131
132   END_TEST;
133 }
134
135 int UtcDaliCustomActorMoveAssignment(void)
136 {
137   TestApplication application;
138
139   Test::TestCustomActor custom = Test::TestCustomActor::New();
140   DALI_TEST_CHECK( custom );
141   DALI_TEST_EQUALS( 1, custom.GetBaseObject().ReferenceCount(), TEST_LOCATION );
142
143   int id = custom.GetProperty< int >( Actor::Property::ID );
144
145   Test::TestCustomActor moved;
146   moved = std::move( custom );
147   DALI_TEST_CHECK( moved );
148   DALI_TEST_EQUALS( id, moved.GetProperty< int >( Actor::Property::ID ), TEST_LOCATION );
149   DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
150   DALI_TEST_CHECK( !custom );
151
152   END_TEST;
153 }
154
155 int UtcDaliCustomActorOnSceneConnectionDisconnection(void)
156 {
157   TestApplication application;
158   tet_infoline("Testing Dali::CustomActor::OnSceneConnection() & OnSceneDisconnection");
159
160   Test::TestCustomActor custom = Test::TestCustomActor::New();
161   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
162
163   // add the custom actor to stage
164   application.GetScene().Add( custom );
165
166   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
167   DALI_TEST_EQUALS( "OnSceneConnection", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
168
169   application.GetScene().Remove( custom );
170
171   DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
172   DALI_TEST_EQUALS( "OnSceneDisconnection", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION );
173
174   // Excercise the message passing to Update thread
175
176   application.SendNotification();
177   application.Render();
178   application.Render();
179   END_TEST;
180 }
181
182 int UtcDaliCustomActorOnSceneConnectionOrder(void)
183 {
184   TestApplication application;
185   tet_infoline("Testing Dali::CustomActor::OnSceneConnection() order");
186
187   MasterCallStack.clear();
188
189   /* Build tree of actors:
190    *
191    *       A (parent)
192    *      / \
193    *     B   C
194    *    / \   \
195    *   D   E   F
196    *
197    * OnSceneConnection should be received for A, B, D, E, C, and finally F
198    */
199
200   Test::TestCustomActor actorA = Test::TestCustomActor::New();
201   actorA.SetProperty( Actor::Property::NAME, "ActorA" );
202
203   Test::TestCustomActor actorB = Test::TestCustomActor::New();
204   actorB.SetProperty( Actor::Property::NAME, "ActorB" );
205   actorA.Add( actorB );
206
207   Test::TestCustomActor actorC = Test::TestCustomActor::New();
208   actorC.SetProperty( Actor::Property::NAME, "ActorC" );
209   actorA.Add( actorC );
210
211   Test::TestCustomActor actorD = Test::TestCustomActor::New();
212   actorD.SetProperty( Actor::Property::NAME, "ActorD" );
213   actorB.Add( actorD );
214
215   Test::TestCustomActor actorE = Test::TestCustomActor::New();
216   actorE.SetProperty( Actor::Property::NAME, "ActorE" );
217   actorB.Add( actorE );
218
219   Test::TestCustomActor actorF = Test::TestCustomActor::New();
220   actorF.SetProperty( Actor::Property::NAME, "ActorF" );
221   actorC.Add( actorF );
222
223   // add the custom actor to stage
224   application.GetScene().Add( actorA );
225
226   DALI_TEST_EQUALS( 4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
227   DALI_TEST_EQUALS( "OnPropertySet",     actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
228   DALI_TEST_EQUALS( "OnChildAdd",        actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
229   DALI_TEST_EQUALS( "OnChildAdd",        actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
230   DALI_TEST_EQUALS( "OnSceneConnection", actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION );
231
232   DALI_TEST_EQUALS( 4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
233   DALI_TEST_EQUALS( "OnPropertySet",     actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
234   DALI_TEST_EQUALS( "OnChildAdd",        actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
235   DALI_TEST_EQUALS( "OnChildAdd",        actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION );
236   DALI_TEST_EQUALS( "OnSceneConnection", actorB.GetMethodsCalled()[ 3 ], TEST_LOCATION );
237
238   DALI_TEST_EQUALS( 3, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION );
239   DALI_TEST_EQUALS( "OnPropertySet",     actorC.GetMethodsCalled()[ 0 ], TEST_LOCATION );
240   DALI_TEST_EQUALS( "OnChildAdd",        actorC.GetMethodsCalled()[ 1 ], TEST_LOCATION );
241   DALI_TEST_EQUALS( "OnSceneConnection", actorC.GetMethodsCalled()[ 2 ], TEST_LOCATION );
242
243   DALI_TEST_EQUALS( 2, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION );
244   DALI_TEST_EQUALS( "OnPropertySet",     actorD.GetMethodsCalled()[ 0 ], TEST_LOCATION );
245   DALI_TEST_EQUALS( "OnSceneConnection", actorD.GetMethodsCalled()[ 1 ], TEST_LOCATION );
246
247   DALI_TEST_EQUALS( 2, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION );
248   DALI_TEST_EQUALS( "OnPropertySet",     actorE.GetMethodsCalled()[ 0 ], TEST_LOCATION );
249   DALI_TEST_EQUALS( "OnSceneConnection", actorE.GetMethodsCalled()[ 1 ], TEST_LOCATION );
250
251   DALI_TEST_EQUALS( 2, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION );
252   DALI_TEST_EQUALS( "OnPropertySet",     actorF.GetMethodsCalled()[ 0 ], TEST_LOCATION );
253   DALI_TEST_EQUALS( "OnSceneConnection", actorF.GetMethodsCalled()[ 1 ], TEST_LOCATION );
254
255   // Check sequence is correct in MasterCallStack
256
257   DALI_TEST_EQUALS( 4+4+3+2+2+2, (int)(MasterCallStack.size()), TEST_LOCATION );
258
259   DALI_TEST_EQUALS( "ActorA: OnPropertySet", MasterCallStack[ 0 ], TEST_LOCATION );
260   DALI_TEST_EQUALS( "ActorB: OnPropertySet", MasterCallStack[ 1 ], TEST_LOCATION );
261   DALI_TEST_EQUALS( "ActorA: OnChildAdd",    MasterCallStack[ 2 ], TEST_LOCATION );
262   DALI_TEST_EQUALS( "ActorC: OnPropertySet", MasterCallStack[ 3 ], TEST_LOCATION );
263   DALI_TEST_EQUALS( "ActorA: OnChildAdd",    MasterCallStack[ 4 ], TEST_LOCATION );
264   DALI_TEST_EQUALS( "ActorD: OnPropertySet", MasterCallStack[ 5 ], TEST_LOCATION );
265
266   DALI_TEST_EQUALS( "ActorB: OnChildAdd",    MasterCallStack[ 6 ], TEST_LOCATION );
267   DALI_TEST_EQUALS( "ActorE: OnPropertySet", MasterCallStack[ 7 ], TEST_LOCATION );
268   DALI_TEST_EQUALS( "ActorB: OnChildAdd",    MasterCallStack[ 8 ], TEST_LOCATION );
269   DALI_TEST_EQUALS( "ActorF: OnPropertySet", MasterCallStack[ 9 ], TEST_LOCATION );
270   DALI_TEST_EQUALS( "ActorC: OnChildAdd",    MasterCallStack[ 10 ], TEST_LOCATION );
271
272   DALI_TEST_EQUALS( "ActorA: OnSceneConnection", MasterCallStack[ 11 ], TEST_LOCATION );
273   DALI_TEST_EQUALS( "ActorB: OnSceneConnection", MasterCallStack[ 12 ], TEST_LOCATION );
274   DALI_TEST_EQUALS( "ActorD: OnSceneConnection", MasterCallStack[ 13 ], TEST_LOCATION );
275   DALI_TEST_EQUALS( "ActorE: OnSceneConnection", MasterCallStack[ 14 ], TEST_LOCATION );
276   DALI_TEST_EQUALS( "ActorC: OnSceneConnection", MasterCallStack[ 15 ], TEST_LOCATION );
277   DALI_TEST_EQUALS( "ActorF: OnSceneConnection", MasterCallStack[ 16 ], TEST_LOCATION );
278
279   // Excercise the message passing to Update thread
280
281   application.SendNotification();
282   application.Render();
283   application.Render();
284   END_TEST;
285 }
286
287 int UtcDaliCustomActorOnSceneDisconnectionOrder(void)
288 {
289   TestApplication application;
290   tet_infoline("Testing Dali::CustomActor::OnSceneDisconnection() order");
291
292   Integration::Scene stage = application.GetScene();
293
294   /* Build tree of actors:
295    *
296    *       A (parent)
297    *      / \
298    *     B   C
299    *    / \   \
300    *   D   E   F
301    *
302    * OnSceneDisconnection should be received for D, E, B, F, C, and finally A.
303    */
304
305   Test::TestCustomActor actorA = Test::TestCustomActor::New();
306   actorA.SetProperty( Actor::Property::NAME, "ActorA" );
307   stage.Add( actorA );
308
309   Test::TestCustomActor actorB = Test::TestCustomActor::New();
310   actorB.SetProperty( Actor::Property::NAME, "ActorB" );
311   actorA.Add( actorB );
312
313   Test::TestCustomActor actorC = Test::TestCustomActor::New();
314   actorC.SetProperty( Actor::Property::NAME, "ActorC" );
315   actorA.Add( actorC );
316
317   Test::TestCustomActor actorD = Test::TestCustomActor::New();
318   actorD.SetProperty( Actor::Property::NAME, "ActorD" );
319   actorB.Add( actorD );
320
321   Test::TestCustomActor actorE = Test::TestCustomActor::New();
322   actorE.SetProperty( Actor::Property::NAME, "ActorE" );
323   actorB.Add( actorE );
324
325   Test::TestCustomActor actorF = Test::TestCustomActor::New();
326   actorF.SetProperty( Actor::Property::NAME, "ActorF" );
327   actorC.Add( actorF );
328
329   // Excercise the message passing to Update thread
330
331   application.SendNotification();
332   application.Render();
333   application.Render();
334
335   // Clear call stacks before disconnection
336   actorA.ResetCallStack();
337   actorB.ResetCallStack();
338   actorC.ResetCallStack();
339   actorD.ResetCallStack();
340   actorE.ResetCallStack();
341   actorF.ResetCallStack();
342   MasterCallStack.clear();
343
344   stage.Remove( actorA );
345
346   DALI_TEST_EQUALS( 1, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
347   DALI_TEST_EQUALS( "OnSceneDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
348
349   DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
350   DALI_TEST_EQUALS( "OnSceneDisconnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
351
352   DALI_TEST_EQUALS( 1, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION );
353   DALI_TEST_EQUALS( "OnSceneDisconnection", actorC.GetMethodsCalled()[ 0 ], TEST_LOCATION );
354
355   DALI_TEST_EQUALS( 1, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION );
356   DALI_TEST_EQUALS( "OnSceneDisconnection", actorD.GetMethodsCalled()[ 0 ], TEST_LOCATION );
357
358   DALI_TEST_EQUALS( 1, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION );
359   DALI_TEST_EQUALS( "OnSceneDisconnection", actorE.GetMethodsCalled()[ 0 ], TEST_LOCATION );
360
361   DALI_TEST_EQUALS( 1, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION );
362   DALI_TEST_EQUALS( "OnSceneDisconnection", actorF.GetMethodsCalled()[ 0 ], TEST_LOCATION );
363
364   // Check sequence is correct in MasterCallStack
365
366   DALI_TEST_EQUALS( 6, (int)(MasterCallStack.size()), TEST_LOCATION );
367
368   DALI_TEST_EQUALS( "ActorD: OnSceneDisconnection", MasterCallStack[ 0 ], TEST_LOCATION );
369   DALI_TEST_EQUALS( "ActorE: OnSceneDisconnection", MasterCallStack[ 1 ], TEST_LOCATION );
370   DALI_TEST_EQUALS( "ActorB: OnSceneDisconnection", MasterCallStack[ 2 ], TEST_LOCATION );
371   DALI_TEST_EQUALS( "ActorF: OnSceneDisconnection", MasterCallStack[ 3 ], TEST_LOCATION );
372   DALI_TEST_EQUALS( "ActorC: OnSceneDisconnection", MasterCallStack[ 4 ], TEST_LOCATION );
373   DALI_TEST_EQUALS( "ActorA: OnSceneDisconnection", MasterCallStack[ 5 ], TEST_LOCATION );
374
375   // Excercise the message passing to Update thread
376
377   application.SendNotification();
378   application.Render();
379   application.Render();
380   END_TEST;
381 }
382
383 int UtcDaliCustomActorAddDuringOnSceneConnection(void)
384 {
385   TestApplication application;
386   tet_infoline("Testing Actor::Add behaviour during Dali::CustomActor::OnSceneConnection() callback");
387
388   Integration::Scene stage = application.GetScene();
389
390   MasterCallStack.clear();
391
392   /* The actorA is a special variant which adds a child to itself during OnSceneConnection()
393    * The actorB is provided as the child
394    */
395
396   Test::TestCustomActor actorB = Test::TestCustomActor::New();
397   actorB.SetProperty( Actor::Property::NAME, "ActorB" );
398
399   Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant1( actorB );
400   actorA.SetProperty( Actor::Property::NAME, "ActorA" );
401   stage.Add( actorA );
402
403   // Check callback sequence
404
405   DALI_TEST_EQUALS( 3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
406   DALI_TEST_EQUALS( "OnPropertySet",     actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
407   DALI_TEST_EQUALS( "OnSceneConnection", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
408   DALI_TEST_EQUALS( "OnChildAdd",        actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); // Called from within OnSceneConnection()
409
410   DALI_TEST_EQUALS( 2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
411   DALI_TEST_EQUALS( "OnPropertySet",     actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
412   DALI_TEST_EQUALS( "OnSceneConnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
413
414   DALI_TEST_EQUALS( 5, (int)(MasterCallStack.size()), TEST_LOCATION );
415
416   DALI_TEST_EQUALS( "ActorB: OnPropertySet",     MasterCallStack[ 0 ], TEST_LOCATION );
417   DALI_TEST_EQUALS( "ActorA: OnPropertySet",     MasterCallStack[ 1 ], TEST_LOCATION );
418   DALI_TEST_EQUALS( "ActorA: OnSceneConnection", MasterCallStack[ 2 ], TEST_LOCATION );
419   DALI_TEST_EQUALS( "ActorB: OnSceneConnection", MasterCallStack[ 3 ], TEST_LOCATION ); // Occurs during Actor::Add from within from within OnSceneConnection()
420   DALI_TEST_EQUALS( "ActorA: OnChildAdd",        MasterCallStack[ 4 ], TEST_LOCATION ); // Occurs after Actor::Add from within from within OnSceneConnection()
421
422   // Excercise the message passing to Update thread
423
424   application.SendNotification();
425   application.Render();
426   application.Render();
427
428   // Check everything is ok after Actors are removed
429
430   stage.Remove( actorA );
431   application.SendNotification();
432   application.Render();
433   application.Render();
434   END_TEST;
435 }
436
437 int UtcDaliCustomActorRemoveDuringOnSceneConnection(void)
438 {
439   TestApplication application;
440   tet_infoline("Testing Actor::Remove behaviour during Dali::CustomActor::OnSceneConnection() callback");
441
442   Integration::Scene stage = application.GetScene();
443
444   MasterCallStack.clear();
445
446   /* The actorA is a special variant which removes its children during OnSceneConnection()
447    * Actors B & C are provided as the children
448    */
449
450   Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant2();
451   actorA.SetProperty( Actor::Property::NAME, "ActorA" );
452
453   Test::TestCustomActor actorB = Test::TestCustomActor::New();
454   actorB.SetProperty( Actor::Property::NAME, "ActorB" );
455   actorA.Add( actorB );
456
457   Test::TestCustomActor actorC = Test::TestCustomActor::New();
458   actorC.SetProperty( Actor::Property::NAME, "ActorC" );
459   actorA.Add( actorC );
460
461   stage.Add( actorA );
462
463   // Check callback sequence
464
465   DALI_TEST_EQUALS( 6, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
466   DALI_TEST_EQUALS( "OnPropertySet",     actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
467   DALI_TEST_EQUALS( "OnChildAdd",        actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
468   DALI_TEST_EQUALS( "OnChildAdd",        actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
469   DALI_TEST_EQUALS( "OnSceneConnection", actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION );
470   DALI_TEST_EQUALS( "OnChildRemove",     actorA.GetMethodsCalled()[ 4 ], TEST_LOCATION ); // Called from within OnSceneConnection()
471   DALI_TEST_EQUALS( "OnChildRemove",     actorA.GetMethodsCalled()[ 5 ], TEST_LOCATION ); // Called from within OnSceneConnection()
472
473   DALI_TEST_EQUALS( 8, (int)(MasterCallStack.size()), TEST_LOCATION );
474
475   DALI_TEST_EQUALS( "ActorA: OnPropertySet",     MasterCallStack[ 0 ], TEST_LOCATION );
476   DALI_TEST_EQUALS( "ActorB: OnPropertySet",     MasterCallStack[ 1 ], TEST_LOCATION );
477   DALI_TEST_EQUALS( "ActorA: OnChildAdd",        MasterCallStack[ 2 ], TEST_LOCATION );
478   DALI_TEST_EQUALS( "ActorC: OnPropertySet",     MasterCallStack[ 3 ], TEST_LOCATION );
479   DALI_TEST_EQUALS( "ActorA: OnChildAdd",        MasterCallStack[ 4 ], TEST_LOCATION );
480   DALI_TEST_EQUALS( "ActorA: OnSceneConnection", MasterCallStack[ 5 ], TEST_LOCATION );
481   DALI_TEST_EQUALS( "ActorA: OnChildRemove",     MasterCallStack[ 6 ], TEST_LOCATION );
482   DALI_TEST_EQUALS( "ActorA: OnChildRemove",     MasterCallStack[ 7 ], TEST_LOCATION );
483
484   /* Actors B & C should be removed before the point where they could receive an OnSceneConnection callback
485    * Therefore they shouldn't receive either OnSceneConnection or OnSceneDisconnection
486    */
487   DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
488   DALI_TEST_EQUALS( 1, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION );
489
490   // Excercise the message passing to Update thread
491
492   application.SendNotification();
493   application.Render();
494   application.Render();
495
496   // Check everything is ok after last actor is removed
497
498   stage.Remove( actorA );
499   application.SendNotification();
500   application.Render();
501   application.Render();
502   END_TEST;
503 }
504
505 int UtcDaliCustomActorAddDuringOnSceneDisconnection(void)
506 {
507   TestApplication application;
508   tet_infoline("Testing Actor::Add behaviour during Dali::CustomActor::OnSceneDisonnection() callback");
509
510   Integration::Scene stage = application.GetScene();
511
512   /* The actorA is a special variant which adds a child to itself during OnSceneDisconnection()
513    * The actorB is provided as the child
514    */
515
516   Test::TestCustomActor actorB = Test::TestCustomActor::New();
517   actorB.SetProperty( Actor::Property::NAME, "ActorB" );
518
519   Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant3( actorB );
520   actorA.SetProperty( Actor::Property::NAME, "ActorA" );
521   stage.Add( actorA );
522
523   // Excercise the message passing to Update thread
524
525   application.SendNotification();
526   application.Render();
527   application.Render();
528
529   // Clear call stacks before disconnection
530   actorA.ResetCallStack();
531   actorB.ResetCallStack();
532   MasterCallStack.clear();
533
534   stage.Remove( actorA );
535
536   // Check callback sequence
537
538   DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
539   DALI_TEST_EQUALS( "OnSceneDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
540   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
541
542   // Child was added after parent disconnection, so should not receive OnSceneConnection()
543   DALI_TEST_EQUALS( 0, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
544
545   DALI_TEST_EQUALS( 2, (int)(MasterCallStack.size()), TEST_LOCATION );
546
547   DALI_TEST_EQUALS( "ActorA: OnSceneDisconnection", MasterCallStack[ 0 ], TEST_LOCATION );
548   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 1 ], TEST_LOCATION );
549
550   // Excercise the message passing to Update thread
551
552   application.SendNotification();
553   application.Render();
554   application.Render();
555   END_TEST;
556 }
557
558 int UtcDaliCustomActorRemoveDuringOnSceneDisconnection(void)
559 {
560   TestApplication application;
561   tet_infoline("Testing Actor::Remove behaviour during Dali::CustomActor::OnSceneDisconnection() callback");
562
563   Integration::Scene stage = application.GetScene();
564
565   /* The actorA is a special variant which removes its children during OnSceneDisconnection()
566    * The actorB is provided as the child
567    */
568
569   Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant4();
570   actorA.SetProperty( Actor::Property::NAME, "ActorA" );
571   stage.Add( actorA );
572
573   Test::TestCustomActor actorB = Test::TestCustomActor::New();
574   actorB.SetProperty( Actor::Property::NAME, "ActorB" );
575   actorA.Add( actorB );
576
577   // Excercise the message passing to Update thread
578
579   application.SendNotification();
580   application.Render();
581   application.Render();
582
583   // Clear call stacks before disconnection
584   actorA.ResetCallStack();
585   actorB.ResetCallStack();
586   MasterCallStack.clear();
587
588   stage.Remove( actorA );
589
590   // Check callback sequence
591
592   DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
593   DALI_TEST_EQUALS( "OnSceneDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
594   DALI_TEST_EQUALS( "OnChildRemove",        actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
595
596   DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
597   DALI_TEST_EQUALS( "OnSceneDisconnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
598
599   DALI_TEST_EQUALS( 3, (int)(MasterCallStack.size()), TEST_LOCATION );
600
601   DALI_TEST_EQUALS( "ActorB: OnSceneDisconnection", MasterCallStack[ 0 ], TEST_LOCATION );
602   DALI_TEST_EQUALS( "ActorA: OnSceneDisconnection", MasterCallStack[ 1 ], TEST_LOCATION );
603   DALI_TEST_EQUALS( "ActorA: OnChildRemove",        MasterCallStack[ 2 ], TEST_LOCATION );
604
605   // Excercise the message passing to Update thread
606
607   application.SendNotification();
608   application.Render();
609   application.Render();
610   END_TEST;
611 }
612
613 int UtcDaliCustomActorRemoveParentDuringOnSceneConnection(void)
614 {
615   TestApplication application;
616   tet_infoline("Weird test where child removes its own parent from Stage during Dali::CustomActor::OnSceneConnection() callback");
617
618   Integration::Scene scene = application.GetScene();
619
620   MasterCallStack.clear();
621
622   /* The actorA is the parent of actorB
623    * The actorB is a special variant which removes its own parent during OnSceneConnection()
624    * The child actor is interrupting the parent's connection to stage, therefore the parent should not get an OnSceneDisconnection()
625    */
626
627   Test::TestCustomActor actorA = Test::TestCustomActor::New();
628   actorA.SetProperty( Actor::Property::NAME, "ActorA" );
629
630   Test::TestCustomActor actorB = Test::TestCustomActor::NewVariant5(scene);
631   actorB.SetProperty( Actor::Property::NAME, "ActorB" );
632   actorA.Add( actorB );
633
634   scene.Add( actorA );
635
636   // Check callback sequence
637
638   DALI_TEST_EQUALS( 4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
639   DALI_TEST_EQUALS( "OnPropertySet",        actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
640   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
641   DALI_TEST_EQUALS( "OnSceneConnection",    actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
642   DALI_TEST_EQUALS( "OnSceneDisconnection", actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION );
643
644   DALI_TEST_EQUALS( 2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
645   DALI_TEST_EQUALS( "OnPropertySet",     actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
646   DALI_TEST_EQUALS( "OnSceneConnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
647
648   DALI_TEST_EQUALS( 6, (int)(MasterCallStack.size()), TEST_LOCATION );
649
650   DALI_TEST_EQUALS( "ActorA: OnPropertySet",        MasterCallStack[ 0 ], TEST_LOCATION );
651   DALI_TEST_EQUALS( "ActorB: OnPropertySet",        MasterCallStack[ 1 ], TEST_LOCATION );
652   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 2 ], TEST_LOCATION );
653   DALI_TEST_EQUALS( "ActorA: OnSceneConnection",    MasterCallStack[ 3 ], TEST_LOCATION );
654   DALI_TEST_EQUALS( "ActorB: OnSceneConnection",    MasterCallStack[ 4 ], TEST_LOCATION );
655   DALI_TEST_EQUALS( "ActorA: OnSceneDisconnection", MasterCallStack[ 5 ], TEST_LOCATION );
656
657   // Excercise the message passing to Update thread
658
659   application.SendNotification();
660   application.Render();
661   application.Render();
662   END_TEST;
663 }
664
665 int UtcDaliCustomActorAddParentDuringOnSceneDisconnection(void)
666 {
667   TestApplication application;
668   tet_infoline("Weird test where child adds its own parent to Stage during Dali::CustomActor::OnSceneDisconnection() callback");
669
670   Integration::Scene scene = application.GetScene();
671
672   MasterCallStack.clear();
673
674   /* The actorA is the parent of actorB
675    * The actorB is a special variant which (weirdly) adds its own parent during OnSceneDisconnection()
676    * The child actor is interrupting the disconnection, such that parent should not get a OnSceneDisconnection()
677    */
678
679   Test::TestCustomActor actorA = Test::TestCustomActor::New();
680   actorA.SetProperty( Actor::Property::NAME, "ActorA" );
681   scene.Add( actorA );
682
683   Test::TestCustomActor actorB = Test::TestCustomActor::NewVariant6(scene);
684   actorB.SetProperty( Actor::Property::NAME, "ActorB" );
685   actorA.Add( actorB );
686
687   scene.Remove( actorA );
688
689   // Check callback sequence
690
691   DALI_TEST_EQUALS( 3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
692   DALI_TEST_EQUALS( "OnPropertySet",        actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
693   DALI_TEST_EQUALS( "OnSceneConnection",    actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
694   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
695
696   DALI_TEST_EQUALS( 3, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
697   DALI_TEST_EQUALS( "OnPropertySet",        actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
698   DALI_TEST_EQUALS( "OnSceneConnection",    actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
699   DALI_TEST_EQUALS( "OnSceneDisconnection", actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION );
700   // Disconnect was interrupted, so we should only get one OnSceneConnection() for actorB
701
702   DALI_TEST_EQUALS( 6, (int)(MasterCallStack.size()), TEST_LOCATION );
703
704   DALI_TEST_EQUALS( "ActorA: OnPropertySet",        MasterCallStack[ 0 ], TEST_LOCATION );
705   DALI_TEST_EQUALS( "ActorA: OnSceneConnection",    MasterCallStack[ 1 ], TEST_LOCATION );
706   DALI_TEST_EQUALS( "ActorB: OnPropertySet",        MasterCallStack[ 2 ], TEST_LOCATION );
707   DALI_TEST_EQUALS( "ActorB: OnSceneConnection",    MasterCallStack[ 3 ], TEST_LOCATION );
708   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 4 ], TEST_LOCATION );
709   DALI_TEST_EQUALS( "ActorB: OnSceneDisconnection", MasterCallStack[ 5 ], TEST_LOCATION );
710
711   // Excercise the message passing to Update thread
712
713   application.SendNotification();
714   application.Render();
715   application.Render();
716   END_TEST;
717 }
718
719 int UtcDaliCustomActorOnChildAddRemove(void)
720 {
721   TestApplication application;
722   tet_infoline("Testing Dali::CustomActor::OnChildAdd() & OnChildRemove()");
723
724   Test::TestCustomActor custom = Test::TestCustomActor::New();
725   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
726
727   Actor aChild = Actor::New();
728   custom.Add( aChild );
729
730   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
731   DALI_TEST_EQUALS( "OnChildAdd", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
732
733   custom.Remove( aChild );
734
735   DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
736   DALI_TEST_EQUALS( "OnChildRemove", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION );
737   END_TEST;
738 }
739
740 int UtcDaliCustomActorReparentDuringOnChildAdd(void)
741 {
742   TestApplication application;
743   tet_infoline("Testing Actor:Add (reparenting) behaviour during Dali::CustomActor::OnChildAdd() callback");
744
745   Integration::Scene stage = application.GetScene();
746
747   MasterCallStack.clear();
748
749   /* The actorA is a special variant which reparents children added into a separate container child
750    * The actorB is the child of actorA
751    */
752
753   Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant7( "ActorA" );
754   stage.Add( actorA );
755
756   Test::TestCustomActor actorB = Test::TestCustomActor::New();
757   actorB.SetProperty( Actor::Property::NAME, "ActorB" );
758   actorA.Add( actorB );
759
760   // Check hierarchy is as follows:
761   //  A
762   //  |
763   //  Container
764   //  |
765   //  B
766
767   DALI_TEST_EQUALS( 1, (int)(actorA.GetChildCount()), TEST_LOCATION );
768
769   Actor container = actorA.GetChildAt(0);
770   Actor containerChild;
771
772   DALI_TEST_CHECK( container );
773   if ( container )
774   {
775     DALI_TEST_EQUALS( "Container", container.GetProperty< std::string >( Actor::Property::NAME ), TEST_LOCATION );
776     DALI_TEST_EQUALS( 1, (int)(container.GetChildCount()), TEST_LOCATION );
777     containerChild = container.GetChildAt(0);
778   }
779
780   DALI_TEST_CHECK( containerChild );
781   if ( containerChild )
782   {
783     DALI_TEST_EQUALS( "ActorB", containerChild.GetProperty< std::string >( Actor::Property::NAME ), TEST_LOCATION );
784     DALI_TEST_EQUALS( 0, (int)(containerChild.GetChildCount()), TEST_LOCATION );
785   }
786
787   // Check callback sequence
788
789   DALI_TEST_EQUALS( 5, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
790   DALI_TEST_EQUALS( "OnPropertySet",        actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
791   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); // The mContainer added to actorA
792   DALI_TEST_EQUALS( "OnSceneConnection",    actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
793   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION ); // The actorB added to actorA
794   DALI_TEST_EQUALS( "OnChildRemove",        actorA.GetMethodsCalled()[ 4 ], TEST_LOCATION );
795   // mContainer will then receive OnChildAdd
796
797   DALI_TEST_EQUALS( 4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
798   DALI_TEST_EQUALS( "OnPropertySet",        actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
799   DALI_TEST_EQUALS( "OnSceneConnection",    actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
800   DALI_TEST_EQUALS( "OnSceneDisconnection", actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION );
801   DALI_TEST_EQUALS( "OnSceneConnection",    actorB.GetMethodsCalled()[ 3 ], TEST_LOCATION );
802
803   DALI_TEST_EQUALS( 9, (int)(MasterCallStack.size()), TEST_LOCATION );
804
805   DALI_TEST_EQUALS( "ActorA: OnPropertySet",        MasterCallStack[ 0 ], TEST_LOCATION );
806   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 1 ], TEST_LOCATION );
807   DALI_TEST_EQUALS( "ActorA: OnSceneConnection",    MasterCallStack[ 2 ], TEST_LOCATION );
808   DALI_TEST_EQUALS( "ActorB: OnPropertySet",        MasterCallStack[ 3 ], TEST_LOCATION );
809   DALI_TEST_EQUALS( "ActorB: OnSceneConnection",    MasterCallStack[ 4 ], TEST_LOCATION );
810   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 5 ], TEST_LOCATION );
811   DALI_TEST_EQUALS( "ActorB: OnSceneDisconnection", MasterCallStack[ 6 ], TEST_LOCATION );
812   DALI_TEST_EQUALS( "ActorA: OnChildRemove",        MasterCallStack[ 7 ], TEST_LOCATION );
813   DALI_TEST_EQUALS( "ActorB: OnSceneConnection",    MasterCallStack[ 8 ], TEST_LOCATION );
814
815   // Excercise the message passing to Update thread
816
817   application.SendNotification();
818   application.Render();
819   application.Render();
820   END_TEST;
821 }
822
823 /**
824  * Test that Remove can be called (a NOOP) during the OnChildRemove
825  * triggered when reparenting an actor
826  */
827 int UtcDaliCustomActorRemoveDuringOnChildRemove(void)
828 {
829   TestApplication application;
830   tet_infoline("Testing Actor:Remove behaviour during OnChildRemove() callback triggered when reparenting");
831
832   Integration::Scene stage = application.GetScene();
833
834   MasterCallStack.clear();
835
836   /* The childActor will be reparented from actorA to actorB
837    * The actorA is a special variant which attempts to remove a child from actorB, during the OnChildRemove callback()
838    * This should be a NOOP since the reparenting has not occured yet
839    */
840
841   Test::TestCustomActor actorB = Test::TestCustomActor::New();
842   actorB.SetProperty( Actor::Property::NAME, "ActorB" );
843   stage.Add( actorB );
844
845   Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant8( actorB );
846   actorA.SetProperty( Actor::Property::NAME, "ActorA" );
847   stage.Add( actorA );
848
849   Actor childActor = Actor::New();
850   childActor.SetProperty( Actor::Property::NAME, "Child" );
851   // Reparent from actorA to actorB
852   actorA.Add( childActor );
853   actorB.Add( childActor );
854
855   // Check hierarchy is as follows:
856   //  A    B
857   //       |
858   //       Child
859
860   DALI_TEST_EQUALS( 0, (int)(actorA.GetChildCount()), TEST_LOCATION );
861   DALI_TEST_EQUALS( 1, (int)(actorB.GetChildCount()), TEST_LOCATION );
862   DALI_TEST_EQUALS( 0, (int)(childActor.GetChildCount()), TEST_LOCATION );
863
864   Actor child = actorB.GetChildAt(0);
865
866   DALI_TEST_CHECK( child );
867   if ( child )
868   {
869     DALI_TEST_EQUALS( "Child", child.GetProperty< std::string >( Actor::Property::NAME ), TEST_LOCATION );
870   }
871
872   // Check callback sequence
873
874   DALI_TEST_EQUALS( 4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
875   DALI_TEST_EQUALS( "OnPropertySet",        actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
876   DALI_TEST_EQUALS( "OnSceneConnection",    actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); // The mContainer added to actorA
877   DALI_TEST_EQUALS( "OnChildAdd",           actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
878   DALI_TEST_EQUALS( "OnChildRemove",        actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION ); // The actorB added to actorA
879   // mContainer will then receive OnChildAdd
880
881   DALI_TEST_EQUALS( 4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
882   DALI_TEST_EQUALS( "OnPropertySet",        actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
883   DALI_TEST_EQUALS( "OnSceneConnection",    actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
884   // The derived class are always notified, no matter the child is successfully removed or not
885   DALI_TEST_EQUALS( "OnChildRemove",        actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION );
886   DALI_TEST_EQUALS( "OnChildAdd",           actorB.GetMethodsCalled()[ 3 ], TEST_LOCATION );
887
888   DALI_TEST_EQUALS( 8, (int)(MasterCallStack.size()), TEST_LOCATION );
889
890   DALI_TEST_EQUALS( "ActorB: OnPropertySet",        MasterCallStack[ 0 ], TEST_LOCATION );
891   DALI_TEST_EQUALS( "ActorB: OnSceneConnection",    MasterCallStack[ 1 ], TEST_LOCATION );
892   DALI_TEST_EQUALS( "ActorA: OnPropertySet",        MasterCallStack[ 2 ], TEST_LOCATION );
893   DALI_TEST_EQUALS( "ActorA: OnSceneConnection",    MasterCallStack[ 3 ], TEST_LOCATION );
894   DALI_TEST_EQUALS( "ActorA: OnChildAdd",           MasterCallStack[ 4 ], TEST_LOCATION );
895   DALI_TEST_EQUALS( "ActorA: OnChildRemove",        MasterCallStack[ 5 ], TEST_LOCATION );
896   // The derived class are always notified, no matter the child is successfully removed or not
897   DALI_TEST_EQUALS( "ActorB: OnChildRemove",        MasterCallStack[ 6 ], TEST_LOCATION );
898   DALI_TEST_EQUALS( "ActorB: OnChildAdd",           MasterCallStack[ 7 ], TEST_LOCATION );
899
900   // Excercise the message passing to Update thread
901
902   application.SendNotification();
903   application.Render();
904   application.Render();
905   END_TEST;
906 }
907
908 int UtcDaliCustomActorOnPropertySet(void)
909 {
910   TestApplication application;
911   tet_infoline("Testing Dali::CustomActor::OnPropertySet()");
912
913   Test::TestCustomActor custom = Test::TestCustomActor::New();
914   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
915
916   custom.SetDaliProperty("yes");
917
918   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
919   DALI_TEST_EQUALS( "OnPropertySet", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
920   END_TEST;
921 }
922
923 int UtcDaliCustomActorOnSizeSet(void)
924 {
925   TestApplication application;
926   tet_infoline("Testing Dali::CustomActor::OnSizeSet()");
927
928   Test::TestCustomActor custom = Test::TestCustomActor::New();
929   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
930
931   custom.SetProperty( Actor::Property::SIZE, Vector2( 9.0f, 10.0f ) );
932   DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
933   DALI_TEST_EQUALS( "OnSizeSet", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
934   DALI_TEST_EQUALS( "OnPropertySet", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION );
935   DALI_TEST_EQUALS( 9.0f, custom.GetSize().width, TEST_LOCATION );
936   DALI_TEST_EQUALS( 10.0f, custom.GetSize().height, TEST_LOCATION );
937
938   custom.SetProperty( Actor::Property::SIZE, Vector3( 4.0f, 5.0f, 6.0f ) );
939   DALI_TEST_EQUALS( 4, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
940   DALI_TEST_EQUALS( "OnSizeSet", custom.GetMethodsCalled()[ 2 ], TEST_LOCATION );
941   DALI_TEST_EQUALS( "OnPropertySet", custom.GetMethodsCalled()[ 3 ], TEST_LOCATION );
942   DALI_TEST_EQUALS( 4.0f, custom.GetSize().width, TEST_LOCATION );
943   DALI_TEST_EQUALS( 5.0f, custom.GetSize().height, TEST_LOCATION );
944   DALI_TEST_EQUALS( 6.0f, custom.GetSize().depth, TEST_LOCATION );
945   END_TEST;
946 }
947
948 int UtcDaliCustomActorOnSizeAnimation(void)
949 {
950   TestApplication application;
951   tet_infoline("Testing Dali::CustomActor::OnSizeAnimation()");
952
953   Test::TestCustomActor custom = Test::TestCustomActor::New();
954   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
955
956   Animation anim = Animation::New( 1.0f );
957   anim.AnimateTo( Property( custom, Actor::Property::SIZE ), Vector3( 8.0f, 9.0f, 10.0f ) );
958   anim.Play();
959
960   application.SendNotification();
961   application.Render( static_cast<unsigned int>( 1000.0f ) );
962
963   DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
964   DALI_TEST_EQUALS( "OnSizeAnimation", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
965   DALI_TEST_EQUALS( 8.0f, custom.GetTargetSize().width, TEST_LOCATION );
966   DALI_TEST_EQUALS( 9.0f, custom.GetTargetSize().height, TEST_LOCATION );
967   DALI_TEST_EQUALS( 10.0f, custom.GetTargetSize().depth, TEST_LOCATION );
968   END_TEST;
969 }
970
971 int UtcDaliCustomActorSizeComponentAnimation(void)
972 {
973   TestApplication application;
974   tet_infoline("Testing Size component animation");
975
976   Test::TestCustomActor custom = Test::TestCustomActor::New();
977   float intialWidth( 10.0f );
978
979   DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
980   custom.SetProperty( Actor::Property::SIZE, Vector2( intialWidth, 10.0f) ); // First method
981
982   Animation anim = Animation::New( 1.0f );
983
984   DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
985
986   anim.AnimateTo( Property( custom, Actor::Property::SIZE_WIDTH ), 20.0f );
987
988   DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
989
990   anim.Play();   // Triggers second method ( OnSizeAnimation )
991
992   application.SendNotification();
993   application.Render( static_cast<unsigned int>( 1000.0f ) );
994
995   DALI_TEST_EQUALS( 3, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
996
997   DALI_TEST_EQUALS( "OnSizeAnimation", custom.GetMethodsCalled()[ 2 ], TEST_LOCATION );
998
999   END_TEST;
1000 }
1001
1002 int UtcDaliCustomActorImplOnPropertySet(void)
1003 {
1004   TestApplication application;
1005   CustomActorImpl* impl = new Test::Impl::SimpleTestCustomActor();
1006   CustomActor customActor( *impl ); // Will automatically unref at the end of this function
1007
1008   impl->OnPropertySet( 0, 0 );
1009
1010   DALI_TEST_CHECK( true );
1011
1012   END_TEST;
1013 }
1014
1015 int UtcDaliCustomActorGetImplementation(void)
1016 {
1017   TestApplication application;
1018
1019   Test::TestCustomActor custom = Test::TestCustomActor::New();
1020   CustomActorImpl& impl = custom.GetImplementation();
1021   impl.GetOwner();  // Test
1022
1023   const Test::TestCustomActor constCustom = Test::TestCustomActor::New();
1024   const CustomActorImpl& constImpl = constCustom.GetImplementation();
1025   constImpl.GetOwner();  // Test
1026
1027   DALI_TEST_CHECK( true );
1028   END_TEST;
1029 }
1030
1031 int UtcDaliCustomActorDoAction(void)
1032 {
1033   TestApplication application;
1034   tet_infoline("Testing Dali::CustomActor::DoAction()");
1035
1036   Test::TestCustomActor custom = Test::TestCustomActor::New();
1037
1038   BaseHandle customActorObject = custom;
1039
1040   DALI_TEST_CHECK(customActorObject);
1041
1042   Property::Map attributes;
1043
1044   // Check that an invalid command is not performed
1045   DALI_TEST_CHECK(customActorObject.DoAction("invalidCommand", attributes) == false);
1046
1047   // Check that the custom actor is visible
1048   custom.SetProperty( Actor::Property::VISIBLE,true);
1049   DALI_TEST_CHECK(custom.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == true);
1050
1051   // Check the custom actor performed an action to hide itself
1052   DALI_TEST_CHECK(customActorObject.DoAction("hide", attributes) == true);
1053
1054   // flush the queue and render once
1055   application.SendNotification();
1056   application.Render();
1057
1058   // Check that the custom actor is now invisible
1059   DALI_TEST_CHECK(custom.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == false);
1060
1061   // Check the custom actor performed an action to show itself
1062   DALI_TEST_CHECK(customActorObject.DoAction("show", attributes) == true);
1063
1064   // flush the queue and render once
1065   application.SendNotification();
1066   application.Render();
1067
1068   // Check that the custom actor is now visible
1069   DALI_TEST_CHECK(custom.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == true);
1070   END_TEST;
1071 }
1072
1073 int UtcDaliCustomActorCustomActor(void)
1074 {
1075   Dali::CustomActor customA;
1076   Dali::CustomActor customB( customA );
1077
1078   DALI_TEST_CHECK( customA == customB );
1079
1080   END_TEST;
1081 }
1082
1083 int UtcDaliCustomActorImplRelayoutRequest(void)
1084 {
1085   TestApplication application;
1086
1087   DALI_TEST_CHECK( gOnRelayout == false );
1088
1089   Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
1090   application.GetScene().Add(custom);
1091
1092   application.SendNotification();
1093   application.Render();
1094
1095   DALI_TEST_CHECK( gOnRelayout == true );
1096   gOnRelayout = false;
1097
1098   custom.TestRelayoutRequest();
1099   application.SendNotification();
1100   application.Render();
1101
1102   DALI_TEST_CHECK( gOnRelayout == true );
1103
1104   END_TEST;
1105 }
1106
1107 int UtcDaliCustomActorImplGetHeightForWidthBase(void)
1108 {
1109   TestApplication application;
1110   Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
1111
1112   float width = 300.0f;
1113
1114   application.SendNotification();
1115   application.Render();
1116
1117   float v = custom.TestGetHeightForWidthBase( width );
1118
1119   DALI_TEST_CHECK( v == width );
1120
1121   END_TEST;
1122 }
1123
1124 int UtcDaliCustomActorImplGetWidthForHeightBase(void)
1125 {
1126   TestApplication application;
1127   Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
1128
1129   float height = 300.0f;
1130
1131   application.SendNotification();
1132   application.Render();
1133
1134   float v = custom.TestGetWidthForHeightBase( height );
1135
1136   DALI_TEST_CHECK( v == height );
1137
1138   END_TEST;
1139 }
1140
1141 int UtcDaliCustomActorImplCalculateChildSizeBase(void)
1142 {
1143   TestApplication application;
1144   Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
1145
1146   Actor child = Actor::New();
1147   child.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS);
1148   child.SetProperty( Actor::Property::SIZE, Vector2( 150, 150 ) );
1149
1150   application.SendNotification();
1151   application.Render();
1152
1153   float v = custom.TestCalculateChildSizeBase( child, Dali::Dimension::ALL_DIMENSIONS );
1154   DALI_TEST_CHECK( v == 0.0f );
1155
1156   END_TEST;
1157 }
1158
1159 int UtcDaliCustomActorImplRelayoutDependentOnChildrenBase(void)
1160 {
1161   TestApplication application;
1162   Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
1163   custom.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::ALL_DIMENSIONS);
1164
1165   bool v = custom.TestRelayoutDependentOnChildrenBase( Dali::Dimension::ALL_DIMENSIONS );
1166   DALI_TEST_CHECK( v == true );
1167
1168   application.SendNotification();
1169   application.Render();
1170
1171   custom.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS);
1172   v = custom.TestRelayoutDependentOnChildrenBase( Dali::Dimension::WIDTH );
1173   DALI_TEST_CHECK( v == false );
1174
1175   // why is this here?
1176   application.SendNotification();
1177   application.Render();
1178
1179   END_TEST;
1180 }
1181
1182 int UtcDaliCustomActorTypeRegistry(void)
1183 {
1184   TestApplication application;
1185
1186   // Register Type
1187   TypeInfo type;
1188   type = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
1189   DALI_TEST_CHECK( type );
1190   BaseHandle handle = type.CreateInstance();
1191
1192   std::string name;
1193   std::string exception;
1194
1195   try
1196   {
1197     name = handle.GetTypeName();
1198     tet_result(TET_FAIL);
1199   }
1200   catch( DaliException& e )
1201   {
1202     exception = e.condition;
1203     DALI_TEST_EQUALS( exception, "handle && \"BaseObject handle is empty\"", TEST_LOCATION );
1204   }
1205
1206   END_TEST;
1207 }
1208
1209
1210 int UtcDaliCustomActorGetExtensionP(void)
1211 {
1212   TestApplication application;
1213
1214   Test::TestCustomActor custom = Test::TestCustomActor::NewVariant5(application.GetScene());
1215
1216   DALI_TEST_CHECK( NULL == custom.GetImplementation().GetExtension() );
1217
1218   END_TEST;
1219 }
1220
1221 int UtcDaliCustomActorOnConnectionDepth(void)
1222 {
1223   TestApplication application;
1224   tet_infoline("Testing Dali::CustomActor::OnSceneConnection() hierarchy depth");
1225
1226   Integration::Scene stage = application.GetScene();
1227
1228   /* Build tree of actors:
1229    *
1230    *                      Depth
1231    *
1232    *       A (parent)       1
1233    *      / \
1234    *     B   C              2
1235    *    / \   \
1236    *   D   E   F            3
1237    *
1238    * OnSceneConnection should return 1 for A, 2 for B and C, and 3 for D, E and F.
1239    */
1240
1241   Test::TestCustomActor actorA = Test::TestCustomActor::New();
1242   stage.Add( actorA );
1243
1244   Test::TestCustomActor actorB = Test::TestCustomActor::New();
1245   actorA.Add( actorB );
1246
1247   Test::TestCustomActor actorC = Test::TestCustomActor::New();
1248   actorA.Add( actorC );
1249
1250   Test::TestCustomActor actorD = Test::TestCustomActor::New();
1251   actorB.Add( actorD );
1252
1253   Test::TestCustomActor actorE = Test::TestCustomActor::New();
1254   actorB.Add( actorE );
1255
1256   Test::TestCustomActor actorF = Test::TestCustomActor::New();
1257   actorC.Add( actorF );
1258
1259   // Excercise the message passing to Update thread
1260   application.SendNotification();
1261   application.Render();
1262   application.Render();
1263
1264   DALI_TEST_EQUALS( 1u, actorA.GetDepth(), TEST_LOCATION );
1265   DALI_TEST_EQUALS( 2u, actorB.GetDepth(), TEST_LOCATION );
1266   DALI_TEST_EQUALS( 2u, actorC.GetDepth(), TEST_LOCATION );
1267   DALI_TEST_EQUALS( 3u, actorD.GetDepth(), TEST_LOCATION );
1268   DALI_TEST_EQUALS( 3u, actorE.GetDepth(), TEST_LOCATION );
1269   DALI_TEST_EQUALS( 3u, actorF.GetDepth(), TEST_LOCATION );
1270
1271   END_TEST;
1272 }
1273
1274
1275 int UtcDaliCustomActorSetGetProperty(void)
1276 {
1277   TestApplication application; // Need the type registry
1278
1279   Test::TestCustomActor actor = Test::TestCustomActor::New();
1280   application.GetScene().Add( actor );
1281
1282   actor.SetProperty( Test::TestCustomActor::Property::TEST_PROPERTY1, 0.5f );
1283   actor.SetProperty( Test::TestCustomActor::Property::TEST_PROPERTY2, Color::WHITE );
1284   actor.SetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY3, Color::BLUE );
1285   actor.SetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY4, 20 );
1286   actor.SetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY5, 40.0f );
1287
1288   Property::Value value = actor.GetProperty( Test::TestCustomActor::Property::TEST_PROPERTY1 );
1289   DALI_TEST_EQUALS( value.Get<float>(), 0.5f, 0.001f, TEST_LOCATION );
1290
1291   value = actor.GetProperty( Test::TestCustomActor::Property::TEST_PROPERTY2 );
1292   DALI_TEST_EQUALS( value.Get<Vector4>(), Color::WHITE, 0.001f, TEST_LOCATION );
1293
1294
1295   value = actor.GetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY3 );
1296   DALI_TEST_EQUALS( value.Get<Vector4>(), Color::BLUE, 0.001f, TEST_LOCATION );
1297
1298   value = actor.GetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY4 );
1299   DALI_TEST_EQUALS( value.Get<int>(), 20, TEST_LOCATION );
1300
1301   value = actor.GetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY5 );
1302   DALI_TEST_EQUALS( value.Get<float>(), 40.0f, 0.001f, TEST_LOCATION );
1303
1304   // Get read-only property
1305   value = actor.GetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY6 );
1306   DALI_TEST_EQUALS( value.Get<float>(), 10.0f, 0.001f, TEST_LOCATION );
1307
1308   // Attempt to set read-only property and then ensure value hasn't changed
1309   actor.SetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY6, 40.0f );
1310   DALI_TEST_EQUALS( value.Get<float>(), 10.0f, 0.001f, TEST_LOCATION );
1311
1312   END_TEST;
1313 }
1314
1315 int utcDaliActorGetTypeInfo(void)
1316 {
1317   TestApplication application;
1318   tet_infoline( "Get the type info of a derived actor" );
1319
1320   Test::TestCustomActor customActor = Test::TestCustomActor::New();
1321
1322   Dali::TypeInfo typeInfo = Dali::DevelCustomActor::GetTypeInfo( customActor );
1323
1324   DALI_TEST_EQUALS( typeInfo.GetName(), std::string("TestCustomActor"), TEST_LOCATION );
1325
1326   END_TEST;
1327 }
1328
1329 namespace Impl
1330 {
1331 /**
1332  * A custom actor that is not type registered on purpose
1333  */
1334 struct UnregisteredCustomActor : public Dali::CustomActorImpl
1335 {
1336   UnregisteredCustomActor() : CustomActorImpl( ACTOR_BEHAVIOUR_DEFAULT )
1337   { }
1338   virtual ~UnregisteredCustomActor()
1339   { }
1340   virtual void OnSceneConnection( int32_t depth )
1341   { }
1342   virtual void OnSceneDisconnection()
1343   { }
1344   virtual void OnChildAdd(Actor& child)
1345   { }
1346   virtual void OnChildRemove(Actor& child)
1347   { }
1348   virtual void OnPropertySet( Property::Index index, const Property::Value& propertyValue )
1349   { }
1350   virtual void OnSizeSet(const Vector3& targetSize)
1351   { }
1352   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
1353   { }
1354   virtual bool OnHoverEvent(const HoverEvent& event)
1355   { return false; }
1356   virtual bool OnWheelEvent(const WheelEvent& event)
1357   { return false; }
1358   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
1359   { }
1360   virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
1361   { }
1362   virtual Vector3 GetNaturalSize()
1363   { return Vector3(); }
1364   virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
1365   { return 0.f; }
1366   virtual float GetHeightForWidth( float width )
1367   { return 0.f; }
1368   virtual float GetWidthForHeight( float height )
1369   { return 0.f; }
1370   virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS )
1371   { return false; }
1372   virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
1373   { }
1374   virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
1375   { }
1376 };
1377 }
1378 struct UnregisteredCustomActor : public Dali::CustomActor
1379 {
1380   static UnregisteredCustomActor New()
1381   {
1382     Impl::UnregisteredCustomActor* impl = new Impl::UnregisteredCustomActor;
1383     UnregisteredCustomActor custom( *impl ); // takes ownership
1384     return custom;
1385   }
1386   UnregisteredCustomActor()
1387   { }
1388   ~UnregisteredCustomActor()
1389   { }
1390   UnregisteredCustomActor( Internal::CustomActor* impl )
1391   : CustomActor( impl )
1392   { }
1393   UnregisteredCustomActor( Impl::UnregisteredCustomActor& impl )
1394   : CustomActor( impl )
1395   { }
1396   static UnregisteredCustomActor DownCast( BaseHandle handle )
1397   {
1398     UnregisteredCustomActor hndl;
1399     CustomActor custom = Dali::CustomActor::DownCast( handle );
1400     if( custom )
1401     {
1402       CustomActorImpl& customImpl = custom.GetImplementation();
1403
1404       Impl::UnregisteredCustomActor* impl = dynamic_cast<Impl::UnregisteredCustomActor*>( &customImpl );
1405
1406       if( impl )
1407       {
1408         hndl = UnregisteredCustomActor( customImpl.GetOwner() );
1409       }
1410     }
1411     return hndl;
1412   }
1413 };
1414
1415 int UtcDaliCustomActorSetGetActorPropertyActionSignal(void)
1416 {
1417   TestApplication application; // Need the type registry
1418
1419   auto custom = UnregisteredCustomActor::New();
1420   application.GetScene().Add( custom );
1421
1422   // should have all actor properties
1423   DALI_TEST_EQUALS( custom.GetPropertyType( Actor::Property::COLOR ), Property::VECTOR4, TEST_LOCATION );
1424   auto actorHandle = Actor::New();
1425   DALI_TEST_EQUALS( custom.GetPropertyCount(), actorHandle.GetPropertyCount(), TEST_LOCATION );
1426
1427   DALI_TEST_EQUALS( custom.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
1428   custom.SetProperty( Actor::Property::VISIBLE, false );
1429   application.SendNotification();
1430   application.Render(); // IsVisible returns scene value
1431   DALI_TEST_EQUALS( custom.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
1432
1433   // should have custom actor typename (as it has not registered itself)
1434   DALI_TEST_EQUALS( "CustomActor", custom.GetTypeName(), TEST_LOCATION );
1435
1436   // should have actor actions
1437   custom.DoAction( "show",  Property::Map() );
1438   DALI_TEST_EQUALS( custom.GetProperty( Actor::Property::VISIBLE ).Get<bool>(), true, TEST_LOCATION );
1439
1440   Animation animation = Animation::New(0.01f); // very short animation
1441   // should be able to animate actor property
1442   animation.AnimateTo( Property( custom, Actor::Property::POSITION ), Vector3( 100.0f, 150.0f, 200.0f ) );
1443   animation.Play();
1444
1445   application.SendNotification();
1446   application.Render(1000.f);
1447
1448   DALI_TEST_EQUALS( Vector3( 100.0f, 150.0f, 200.0f ), custom.GetProperty( Actor::Property::POSITION ).Get<Vector3>(), TEST_LOCATION );
1449   DALI_TEST_EQUALS( Vector3( 100.0f, 150.0f, 200.0f ), custom.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
1450
1451   Dali::WeakHandle<UnregisteredCustomActor> weakRef( custom );
1452   // should have actor signals
1453   custom.ConnectSignal( &application, "offScene",
1454     [weakRef]()
1455       {
1456         DALI_TEST_EQUALS( weakRef.GetHandle().GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ), false, TEST_LOCATION );
1457       } );
1458
1459   application.GetScene().Remove( custom );
1460   application.GetScene().Add( custom );
1461
1462   END_TEST;
1463 }
1464
1465 namespace Impl
1466 {
1467 struct DerivedCustomActor : public UnregisteredCustomActor
1468 { };
1469 }
1470
1471 struct DerivedCustomActor : public UnregisteredCustomActor
1472 {
1473   static DerivedCustomActor New()
1474   {
1475     Impl::DerivedCustomActor* impl = new Impl::DerivedCustomActor;
1476     DerivedCustomActor custom( *impl ); // takes ownership
1477     return custom;
1478   }
1479   DerivedCustomActor()
1480   { }
1481   ~DerivedCustomActor()
1482   { }
1483   DerivedCustomActor( Internal::CustomActor* impl )
1484   : UnregisteredCustomActor( impl )
1485   { }
1486   DerivedCustomActor( Impl::UnregisteredCustomActor& impl )
1487   : UnregisteredCustomActor( impl )
1488   { }
1489 };
1490
1491 // register custom
1492 DALI_TYPE_REGISTRATION_BEGIN( DerivedCustomActor, UnregisteredCustomActor, nullptr );
1493 DALI_TYPE_REGISTRATION_END()
1494
1495 int UtcDaliCustomActorPropertyRegistrationDefaultValue(void)
1496 {
1497   TestApplication application; // Need the type registry
1498
1499   // register our base and add a property with default value for it
1500   Dali::TypeRegistration typeRegistration( typeid( UnregisteredCustomActor ), typeid( Dali::CustomActor ), nullptr );
1501
1502   auto derived = DerivedCustomActor::New();
1503   application.GetScene().Add( derived );
1504
1505   // should have all actor properties
1506   DALI_TEST_EQUALS( derived.GetPropertyType( Actor::Property::WORLD_MATRIX ), Property::MATRIX, TEST_LOCATION );
1507   auto actorHandle = Actor::New();
1508   DALI_TEST_EQUALS( derived.GetPropertyCount(), actorHandle.GetPropertyCount(), TEST_LOCATION );
1509
1510   // add a property in base class
1511   AnimatablePropertyRegistration( typeRegistration, "Foobar", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, 10.f );
1512
1513   // should be one more property now
1514   DALI_TEST_EQUALS( derived.GetPropertyCount(), actorHandle.GetPropertyCount() + 1, TEST_LOCATION );
1515   // check that the default value is set for base class
1516   DALI_TEST_EQUALS( UnregisteredCustomActor::New().GetProperty(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX).Get<float>(), 10.f, TEST_LOCATION );
1517   // check that the default value is set for the derived instance as well
1518   DALI_TEST_EQUALS( derived.GetProperty(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX).Get<float>(), 10.f, TEST_LOCATION );
1519
1520   END_TEST;
1521 }