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