2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
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>
29 #include "dali-test-suite-utils/dali-test-suite-utils.h"
30 #include "test-custom-actor.h"
36 void Doubler(float& current, const PropertyInputContainer& inputs)
38 current = 2.0f * inputs[0]->GetFloat();
42 void custom_actor_test_startup(void)
44 test_return_value = TET_UNDEF;
47 void custom_actor_test_cleanup(void)
49 test_return_value = TET_PASS;
54 int UtcDaliCustomActorDestructor(void)
56 TestApplication application;
58 CustomActor* actor = new CustomActor();
61 DALI_TEST_CHECK(true);
65 int UtcDaliCustomActorImplDestructor(void)
67 TestApplication application;
68 CustomActorImpl* actor = new Test::Impl::TestCustomActor();
69 CustomActor customActor(*actor); // Will automatically unref at the end of this function
71 DALI_TEST_CHECK(true);
75 // Positive test case for a method
76 int UtcDaliCustomActorDownCast(void)
78 TestApplication application;
79 tet_infoline("Testing Dali::CustomActor::DownCast()");
81 Test::TestCustomActor custom = Test::TestCustomActor::New();
83 Actor anActor = Actor::New();
86 Actor child = anActor.GetChildAt(0);
87 CustomActor customActor = CustomActor::DownCast(child);
88 DALI_TEST_CHECK(customActor);
91 DALI_TEST_CHECK(!customActor);
93 customActor = DownCast<CustomActor>(child);
94 DALI_TEST_CHECK(customActor);
98 // Negative test case for a method
99 int UtcDaliCustomActorDownCastNegative(void)
101 TestApplication application;
102 tet_infoline("Testing Dali::CustomActor::DownCast()");
104 Actor actor1 = Actor::New();
105 Actor anActor = Actor::New();
108 Actor child = anActor.GetChildAt(0);
109 CustomActor customActor = CustomActor::DownCast(child);
110 DALI_TEST_CHECK(!customActor);
112 Actor unInitialzedActor;
113 customActor = CustomActor::DownCast(unInitialzedActor);
114 DALI_TEST_CHECK(!customActor);
116 customActor = DownCast<CustomActor>(unInitialzedActor);
117 DALI_TEST_CHECK(!customActor);
121 int UtcDaliCustomActorMoveConstructor(void)
123 TestApplication application;
125 Test::TestCustomActor custom = Test::TestCustomActor::New();
126 DALI_TEST_CHECK(custom);
127 DALI_TEST_EQUALS(1, custom.GetBaseObject().ReferenceCount(), TEST_LOCATION);
129 int id = custom.GetProperty<int>(Actor::Property::ID);
131 Test::TestCustomActor moved = std::move(custom);
132 DALI_TEST_CHECK(moved);
133 DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
134 DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
135 DALI_TEST_CHECK(!custom);
140 int UtcDaliCustomActorMoveAssignment(void)
142 TestApplication application;
144 Test::TestCustomActor custom = Test::TestCustomActor::New();
145 DALI_TEST_CHECK(custom);
146 DALI_TEST_EQUALS(1, custom.GetBaseObject().ReferenceCount(), TEST_LOCATION);
148 int id = custom.GetProperty<int>(Actor::Property::ID);
150 Test::TestCustomActor moved;
151 moved = std::move(custom);
152 DALI_TEST_CHECK(moved);
153 DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
154 DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
155 DALI_TEST_CHECK(!custom);
160 int UtcDaliCustomActorOnSceneConnectionDisconnection(void)
162 TestApplication application;
163 tet_infoline("Testing Dali::CustomActor::OnSceneConnection() & OnSceneDisconnection");
165 Test::TestCustomActor custom = Test::TestCustomActor::New();
166 DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
168 // add the custom actor to stage
169 application.GetScene().Add(custom);
171 DALI_TEST_EQUALS(1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
172 DALI_TEST_EQUALS("OnSceneConnection", custom.GetMethodsCalled()[0], TEST_LOCATION);
174 application.GetScene().Remove(custom);
176 DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
177 DALI_TEST_EQUALS("OnSceneDisconnection", custom.GetMethodsCalled()[1], TEST_LOCATION);
179 // Excercise the message passing to Update thread
181 application.SendNotification();
182 application.Render();
183 application.Render();
187 int UtcDaliCustomActorOnSceneConnectionOrder(void)
189 TestApplication application;
190 tet_infoline("Testing Dali::CustomActor::OnSceneConnection() order");
192 MasterCallStack.clear();
194 /* Build tree of actors:
202 * OnSceneConnection should be received for A, B, D, E, C, and finally F
205 Test::TestCustomActor actorA = Test::TestCustomActor::New();
206 actorA.SetProperty(Actor::Property::NAME, "ActorA");
208 Test::TestCustomActor actorB = Test::TestCustomActor::New();
209 actorB.SetProperty(Actor::Property::NAME, "ActorB");
212 Test::TestCustomActor actorC = Test::TestCustomActor::New();
213 actorC.SetProperty(Actor::Property::NAME, "ActorC");
216 Test::TestCustomActor actorD = Test::TestCustomActor::New();
217 actorD.SetProperty(Actor::Property::NAME, "ActorD");
220 Test::TestCustomActor actorE = Test::TestCustomActor::New();
221 actorE.SetProperty(Actor::Property::NAME, "ActorE");
224 Test::TestCustomActor actorF = Test::TestCustomActor::New();
225 actorF.SetProperty(Actor::Property::NAME, "ActorF");
228 // add the custom actor to stage
229 application.GetScene().Add(actorA);
231 DALI_TEST_EQUALS(4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
232 DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION);
233 DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION);
234 DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION);
235 DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[3], TEST_LOCATION);
237 DALI_TEST_EQUALS(4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
238 DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION);
239 DALI_TEST_EQUALS("OnChildAdd", actorB.GetMethodsCalled()[1], TEST_LOCATION);
240 DALI_TEST_EQUALS("OnChildAdd", actorB.GetMethodsCalled()[2], TEST_LOCATION);
241 DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[3], TEST_LOCATION);
243 DALI_TEST_EQUALS(3, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION);
244 DALI_TEST_EQUALS("OnPropertySet", actorC.GetMethodsCalled()[0], TEST_LOCATION);
245 DALI_TEST_EQUALS("OnChildAdd", actorC.GetMethodsCalled()[1], TEST_LOCATION);
246 DALI_TEST_EQUALS("OnSceneConnection", actorC.GetMethodsCalled()[2], TEST_LOCATION);
248 DALI_TEST_EQUALS(2, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION);
249 DALI_TEST_EQUALS("OnPropertySet", actorD.GetMethodsCalled()[0], TEST_LOCATION);
250 DALI_TEST_EQUALS("OnSceneConnection", actorD.GetMethodsCalled()[1], TEST_LOCATION);
252 DALI_TEST_EQUALS(2, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION);
253 DALI_TEST_EQUALS("OnPropertySet", actorE.GetMethodsCalled()[0], TEST_LOCATION);
254 DALI_TEST_EQUALS("OnSceneConnection", actorE.GetMethodsCalled()[1], TEST_LOCATION);
256 DALI_TEST_EQUALS(2, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION);
257 DALI_TEST_EQUALS("OnPropertySet", actorF.GetMethodsCalled()[0], TEST_LOCATION);
258 DALI_TEST_EQUALS("OnSceneConnection", actorF.GetMethodsCalled()[1], TEST_LOCATION);
260 // Check sequence is correct in MasterCallStack
262 DALI_TEST_EQUALS(4 + 4 + 3 + 2 + 2 + 2, (int)(MasterCallStack.size()), TEST_LOCATION);
264 DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION);
265 DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[1], TEST_LOCATION);
266 DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[2], TEST_LOCATION);
267 DALI_TEST_EQUALS("ActorC: OnPropertySet", MasterCallStack[3], TEST_LOCATION);
268 DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION);
269 DALI_TEST_EQUALS("ActorD: OnPropertySet", MasterCallStack[5], TEST_LOCATION);
271 DALI_TEST_EQUALS("ActorB: OnChildAdd", MasterCallStack[6], TEST_LOCATION);
272 DALI_TEST_EQUALS("ActorE: OnPropertySet", MasterCallStack[7], TEST_LOCATION);
273 DALI_TEST_EQUALS("ActorB: OnChildAdd", MasterCallStack[8], TEST_LOCATION);
274 DALI_TEST_EQUALS("ActorF: OnPropertySet", MasterCallStack[9], TEST_LOCATION);
275 DALI_TEST_EQUALS("ActorC: OnChildAdd", MasterCallStack[10], TEST_LOCATION);
277 DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[11], TEST_LOCATION);
278 DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[12], TEST_LOCATION);
279 DALI_TEST_EQUALS("ActorD: OnSceneConnection", MasterCallStack[13], TEST_LOCATION);
280 DALI_TEST_EQUALS("ActorE: OnSceneConnection", MasterCallStack[14], TEST_LOCATION);
281 DALI_TEST_EQUALS("ActorC: OnSceneConnection", MasterCallStack[15], TEST_LOCATION);
282 DALI_TEST_EQUALS("ActorF: OnSceneConnection", MasterCallStack[16], TEST_LOCATION);
284 // Excercise the message passing to Update thread
286 application.SendNotification();
287 application.Render();
288 application.Render();
292 int UtcDaliCustomActorOnSceneDisconnectionOrder(void)
294 TestApplication application;
295 tet_infoline("Testing Dali::CustomActor::OnSceneDisconnection() order");
297 Integration::Scene stage = application.GetScene();
299 /* Build tree of actors:
307 * OnSceneDisconnection should be received for D, E, B, F, C, and finally A.
310 Test::TestCustomActor actorA = Test::TestCustomActor::New();
311 actorA.SetProperty(Actor::Property::NAME, "ActorA");
314 Test::TestCustomActor actorB = Test::TestCustomActor::New();
315 actorB.SetProperty(Actor::Property::NAME, "ActorB");
318 Test::TestCustomActor actorC = Test::TestCustomActor::New();
319 actorC.SetProperty(Actor::Property::NAME, "ActorC");
322 Test::TestCustomActor actorD = Test::TestCustomActor::New();
323 actorD.SetProperty(Actor::Property::NAME, "ActorD");
326 Test::TestCustomActor actorE = Test::TestCustomActor::New();
327 actorE.SetProperty(Actor::Property::NAME, "ActorE");
330 Test::TestCustomActor actorF = Test::TestCustomActor::New();
331 actorF.SetProperty(Actor::Property::NAME, "ActorF");
334 // Excercise the message passing to Update thread
336 application.SendNotification();
337 application.Render();
338 application.Render();
340 // Clear call stacks before disconnection
341 actorA.ResetCallStack();
342 actorB.ResetCallStack();
343 actorC.ResetCallStack();
344 actorD.ResetCallStack();
345 actorE.ResetCallStack();
346 actorF.ResetCallStack();
347 MasterCallStack.clear();
349 stage.Remove(actorA);
351 DALI_TEST_EQUALS(1, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
352 DALI_TEST_EQUALS("OnSceneDisconnection", actorA.GetMethodsCalled()[0], TEST_LOCATION);
354 DALI_TEST_EQUALS(1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
355 DALI_TEST_EQUALS("OnSceneDisconnection", actorB.GetMethodsCalled()[0], TEST_LOCATION);
357 DALI_TEST_EQUALS(1, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION);
358 DALI_TEST_EQUALS("OnSceneDisconnection", actorC.GetMethodsCalled()[0], TEST_LOCATION);
360 DALI_TEST_EQUALS(1, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION);
361 DALI_TEST_EQUALS("OnSceneDisconnection", actorD.GetMethodsCalled()[0], TEST_LOCATION);
363 DALI_TEST_EQUALS(1, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION);
364 DALI_TEST_EQUALS("OnSceneDisconnection", actorE.GetMethodsCalled()[0], TEST_LOCATION);
366 DALI_TEST_EQUALS(1, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION);
367 DALI_TEST_EQUALS("OnSceneDisconnection", actorF.GetMethodsCalled()[0], TEST_LOCATION);
369 // Check sequence is correct in MasterCallStack
371 DALI_TEST_EQUALS(6, (int)(MasterCallStack.size()), TEST_LOCATION);
373 DALI_TEST_EQUALS("ActorD: OnSceneDisconnection", MasterCallStack[0], TEST_LOCATION);
374 DALI_TEST_EQUALS("ActorE: OnSceneDisconnection", MasterCallStack[1], TEST_LOCATION);
375 DALI_TEST_EQUALS("ActorB: OnSceneDisconnection", MasterCallStack[2], TEST_LOCATION);
376 DALI_TEST_EQUALS("ActorF: OnSceneDisconnection", MasterCallStack[3], TEST_LOCATION);
377 DALI_TEST_EQUALS("ActorC: OnSceneDisconnection", MasterCallStack[4], TEST_LOCATION);
378 DALI_TEST_EQUALS("ActorA: OnSceneDisconnection", MasterCallStack[5], TEST_LOCATION);
380 // Excercise the message passing to Update thread
382 application.SendNotification();
383 application.Render();
384 application.Render();
388 int UtcDaliCustomActorAddDuringOnSceneConnection(void)
390 TestApplication application;
391 tet_infoline("Testing Actor::Add behaviour during Dali::CustomActor::OnSceneConnection() callback");
393 Integration::Scene stage = application.GetScene();
395 MasterCallStack.clear();
397 /* The actorA is a special variant which adds a child to itself during OnSceneConnection()
398 * The actorB is provided as the child
401 Test::TestCustomActor actorB = Test::TestCustomActor::New();
402 actorB.SetProperty(Actor::Property::NAME, "ActorB");
404 Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant1(actorB);
405 actorA.SetProperty(Actor::Property::NAME, "ActorA");
408 // Check callback sequence
410 DALI_TEST_EQUALS(3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
411 DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION);
412 DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[1], TEST_LOCATION);
413 DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION); // Called from within OnSceneConnection()
415 DALI_TEST_EQUALS(2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
416 DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION);
417 DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION);
419 DALI_TEST_EQUALS(5, (int)(MasterCallStack.size()), TEST_LOCATION);
421 DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[0], TEST_LOCATION);
422 DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[1], TEST_LOCATION);
423 DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[2], TEST_LOCATION);
424 DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[3], TEST_LOCATION); // Occurs during Actor::Add from within from within OnSceneConnection()
425 DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION); // Occurs after Actor::Add from within from within OnSceneConnection()
427 // Excercise the message passing to Update thread
429 application.SendNotification();
430 application.Render();
431 application.Render();
433 // Check everything is ok after Actors are removed
435 stage.Remove(actorA);
436 application.SendNotification();
437 application.Render();
438 application.Render();
442 int UtcDaliCustomActorRemoveDuringOnSceneConnection(void)
444 TestApplication application;
445 tet_infoline("Testing Actor::Remove behaviour during Dali::CustomActor::OnSceneConnection() callback");
447 Integration::Scene stage = application.GetScene();
449 MasterCallStack.clear();
451 /* The actorA is a special variant which removes its children during OnSceneConnection()
452 * Actors B & C are provided as the children
455 Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant2();
456 actorA.SetProperty(Actor::Property::NAME, "ActorA");
458 Test::TestCustomActor actorB = Test::TestCustomActor::New();
459 actorB.SetProperty(Actor::Property::NAME, "ActorB");
462 Test::TestCustomActor actorC = Test::TestCustomActor::New();
463 actorC.SetProperty(Actor::Property::NAME, "ActorC");
468 // Check callback sequence
470 DALI_TEST_EQUALS(6, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
471 DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION);
472 DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION);
473 DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION);
474 DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[3], TEST_LOCATION);
475 DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[4], TEST_LOCATION); // Called from within OnSceneConnection()
476 DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[5], TEST_LOCATION); // Called from within OnSceneConnection()
478 DALI_TEST_EQUALS(8, (int)(MasterCallStack.size()), TEST_LOCATION);
480 DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION);
481 DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[1], TEST_LOCATION);
482 DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[2], TEST_LOCATION);
483 DALI_TEST_EQUALS("ActorC: OnPropertySet", MasterCallStack[3], TEST_LOCATION);
484 DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION);
485 DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[5], TEST_LOCATION);
486 DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[6], TEST_LOCATION);
487 DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[7], TEST_LOCATION);
489 /* Actors B & C should be removed before the point where they could receive an OnSceneConnection callback
490 * Therefore they shouldn't receive either OnSceneConnection or OnSceneDisconnection
492 DALI_TEST_EQUALS(1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
493 DALI_TEST_EQUALS(1, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION);
495 // Excercise the message passing to Update thread
497 application.SendNotification();
498 application.Render();
499 application.Render();
501 // Check everything is ok after last actor is removed
503 stage.Remove(actorA);
504 application.SendNotification();
505 application.Render();
506 application.Render();
510 int UtcDaliCustomActorAddDuringOnSceneDisconnection(void)
512 TestApplication application;
513 tet_infoline("Testing Actor::Add behaviour during Dali::CustomActor::OnSceneDisonnection() callback");
515 Integration::Scene stage = application.GetScene();
517 /* The actorA is a special variant which adds a child to itself during OnSceneDisconnection()
518 * The actorB is provided as the child
521 Test::TestCustomActor actorB = Test::TestCustomActor::New();
522 actorB.SetProperty(Actor::Property::NAME, "ActorB");
524 Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant3(actorB);
525 actorA.SetProperty(Actor::Property::NAME, "ActorA");
528 // Excercise the message passing to Update thread
530 application.SendNotification();
531 application.Render();
532 application.Render();
534 // Clear call stacks before disconnection
535 actorA.ResetCallStack();
536 actorB.ResetCallStack();
537 MasterCallStack.clear();
539 stage.Remove(actorA);
541 // Check callback sequence
543 DALI_TEST_EQUALS(2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
544 DALI_TEST_EQUALS("OnSceneDisconnection", actorA.GetMethodsCalled()[0], TEST_LOCATION);
545 DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION);
547 // Child was added after parent disconnection, so should not receive OnSceneConnection()
548 DALI_TEST_EQUALS(0, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
550 DALI_TEST_EQUALS(2, (int)(MasterCallStack.size()), TEST_LOCATION);
552 DALI_TEST_EQUALS("ActorA: OnSceneDisconnection", MasterCallStack[0], TEST_LOCATION);
553 DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[1], TEST_LOCATION);
555 // Excercise the message passing to Update thread
557 application.SendNotification();
558 application.Render();
559 application.Render();
563 int UtcDaliCustomActorRemoveDuringOnSceneDisconnection(void)
565 TestApplication application;
566 tet_infoline("Testing Actor::Remove behaviour during Dali::CustomActor::OnSceneDisconnection() callback");
568 Integration::Scene stage = application.GetScene();
570 /* The actorA is a special variant which removes its children during OnSceneDisconnection()
571 * The actorB is provided as the child
574 Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant4();
575 actorA.SetProperty(Actor::Property::NAME, "ActorA");
578 Test::TestCustomActor actorB = Test::TestCustomActor::New();
579 actorB.SetProperty(Actor::Property::NAME, "ActorB");
582 // Excercise the message passing to Update thread
584 application.SendNotification();
585 application.Render();
586 application.Render();
588 // Clear call stacks before disconnection
589 actorA.ResetCallStack();
590 actorB.ResetCallStack();
591 MasterCallStack.clear();
593 stage.Remove(actorA);
595 // Check callback sequence
597 DALI_TEST_EQUALS(2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
598 DALI_TEST_EQUALS("OnSceneDisconnection", actorA.GetMethodsCalled()[0], TEST_LOCATION);
599 DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[1], TEST_LOCATION);
601 DALI_TEST_EQUALS(1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
602 DALI_TEST_EQUALS("OnSceneDisconnection", actorB.GetMethodsCalled()[0], TEST_LOCATION);
604 DALI_TEST_EQUALS(3, (int)(MasterCallStack.size()), TEST_LOCATION);
606 DALI_TEST_EQUALS("ActorB: OnSceneDisconnection", MasterCallStack[0], TEST_LOCATION);
607 DALI_TEST_EQUALS("ActorA: OnSceneDisconnection", MasterCallStack[1], TEST_LOCATION);
608 DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[2], TEST_LOCATION);
610 // Excercise the message passing to Update thread
612 application.SendNotification();
613 application.Render();
614 application.Render();
618 int UtcDaliCustomActorRemoveParentDuringOnSceneConnection(void)
620 TestApplication application;
621 tet_infoline("Weird test where child removes its own parent from Stage during Dali::CustomActor::OnSceneConnection() callback");
623 Integration::Scene scene = application.GetScene();
625 MasterCallStack.clear();
627 /* The actorA is the parent of actorB
628 * The actorB is a special variant which removes its own parent during OnSceneConnection()
629 * The child actor is interrupting the parent's connection to stage, therefore the parent should not get an OnSceneDisconnection()
632 Test::TestCustomActor actorA = Test::TestCustomActor::New();
633 actorA.SetProperty(Actor::Property::NAME, "ActorA");
635 Test::TestCustomActor actorB = Test::TestCustomActor::NewVariant5(scene);
636 actorB.SetProperty(Actor::Property::NAME, "ActorB");
641 // Check callback sequence
643 DALI_TEST_EQUALS(4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
644 DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION);
645 DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION);
646 DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[2], TEST_LOCATION);
647 DALI_TEST_EQUALS("OnSceneDisconnection", actorA.GetMethodsCalled()[3], TEST_LOCATION);
649 DALI_TEST_EQUALS(2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
650 DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION);
651 DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION);
653 DALI_TEST_EQUALS(6, (int)(MasterCallStack.size()), TEST_LOCATION);
655 DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION);
656 DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[1], TEST_LOCATION);
657 DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[2], TEST_LOCATION);
658 DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[3], TEST_LOCATION);
659 DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[4], TEST_LOCATION);
660 DALI_TEST_EQUALS("ActorA: OnSceneDisconnection", MasterCallStack[5], TEST_LOCATION);
662 // Excercise the message passing to Update thread
664 application.SendNotification();
665 application.Render();
666 application.Render();
670 int UtcDaliCustomActorAddParentDuringOnSceneDisconnection(void)
672 TestApplication application;
673 tet_infoline("Weird test where child adds its own parent to Stage during Dali::CustomActor::OnSceneDisconnection() callback");
675 Integration::Scene scene = application.GetScene();
677 MasterCallStack.clear();
679 /* The actorA is the parent of actorB
680 * The actorB is a special variant which (weirdly) adds its own parent during OnSceneDisconnection()
681 * The child actor is interrupting the disconnection, such that parent should not get a OnSceneDisconnection()
684 Test::TestCustomActor actorA = Test::TestCustomActor::New();
685 actorA.SetProperty(Actor::Property::NAME, "ActorA");
688 Test::TestCustomActor actorB = Test::TestCustomActor::NewVariant6(scene);
689 actorB.SetProperty(Actor::Property::NAME, "ActorB");
692 scene.Remove(actorA);
694 // Check callback sequence
696 DALI_TEST_EQUALS(3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
697 DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION);
698 DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[1], TEST_LOCATION);
699 DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION);
701 DALI_TEST_EQUALS(3, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
702 DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION);
703 DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION);
704 DALI_TEST_EQUALS("OnSceneDisconnection", actorB.GetMethodsCalled()[2], TEST_LOCATION);
705 // Disconnect was interrupted, so we should only get one OnSceneConnection() for actorB
707 DALI_TEST_EQUALS(6, (int)(MasterCallStack.size()), TEST_LOCATION);
709 DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION);
710 DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[1], TEST_LOCATION);
711 DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[2], TEST_LOCATION);
712 DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[3], TEST_LOCATION);
713 DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION);
714 DALI_TEST_EQUALS("ActorB: OnSceneDisconnection", MasterCallStack[5], TEST_LOCATION);
716 // Excercise the message passing to Update thread
718 application.SendNotification();
719 application.Render();
720 application.Render();
724 int UtcDaliCustomActorOnChildAddRemove(void)
726 TestApplication application;
727 tet_infoline("Testing Dali::CustomActor::OnChildAdd() & OnChildRemove()");
729 Test::TestCustomActor custom = Test::TestCustomActor::New();
730 DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
732 Actor aChild = Actor::New();
735 DALI_TEST_EQUALS(1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
736 DALI_TEST_EQUALS("OnChildAdd", custom.GetMethodsCalled()[0], TEST_LOCATION);
738 custom.Remove(aChild);
740 DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
741 DALI_TEST_EQUALS("OnChildRemove", custom.GetMethodsCalled()[1], TEST_LOCATION);
745 int UtcDaliCustomActorReparentDuringOnChildAdd(void)
747 TestApplication application;
748 tet_infoline("Testing Actor:Add (reparenting) behaviour during Dali::CustomActor::OnChildAdd() callback");
750 Integration::Scene stage = application.GetScene();
752 MasterCallStack.clear();
754 /* The actorA is a special variant which reparents children added into a separate container child
755 * The actorB is the child of actorA
758 Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant7("ActorA");
761 Test::TestCustomActor actorB = Test::TestCustomActor::New();
762 actorB.SetProperty(Actor::Property::NAME, "ActorB");
765 // Check hierarchy is as follows:
772 DALI_TEST_EQUALS(1, (int)(actorA.GetChildCount()), TEST_LOCATION);
774 Actor container = actorA.GetChildAt(0);
775 Actor containerChild;
777 DALI_TEST_CHECK(container);
780 DALI_TEST_EQUALS("Container", container.GetProperty<std::string>(Actor::Property::NAME), TEST_LOCATION);
781 DALI_TEST_EQUALS(1, (int)(container.GetChildCount()), TEST_LOCATION);
782 containerChild = container.GetChildAt(0);
785 DALI_TEST_CHECK(containerChild);
788 DALI_TEST_EQUALS("ActorB", containerChild.GetProperty<std::string>(Actor::Property::NAME), TEST_LOCATION);
789 DALI_TEST_EQUALS(0, (int)(containerChild.GetChildCount()), TEST_LOCATION);
792 // Check callback sequence
794 DALI_TEST_EQUALS(5, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
795 DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION);
796 DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION); // The mContainer added to actorA
797 DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[2], TEST_LOCATION);
798 DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[3], TEST_LOCATION); // The actorB added to actorA
799 DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[4], TEST_LOCATION);
800 // mContainer will then receive OnChildAdd
802 DALI_TEST_EQUALS(4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
803 DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION);
804 DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION);
805 DALI_TEST_EQUALS("OnSceneDisconnection", actorB.GetMethodsCalled()[2], TEST_LOCATION);
806 DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[3], TEST_LOCATION);
808 DALI_TEST_EQUALS(9, (int)(MasterCallStack.size()), TEST_LOCATION);
810 DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION);
811 DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[1], TEST_LOCATION);
812 DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[2], TEST_LOCATION);
813 DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[3], TEST_LOCATION);
814 DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[4], TEST_LOCATION);
815 DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[5], TEST_LOCATION);
816 DALI_TEST_EQUALS("ActorB: OnSceneDisconnection", MasterCallStack[6], TEST_LOCATION);
817 DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[7], TEST_LOCATION);
818 DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[8], TEST_LOCATION);
820 // Excercise the message passing to Update thread
822 application.SendNotification();
823 application.Render();
824 application.Render();
829 * Test that Remove can be called (a NOOP) during the OnChildRemove
830 * triggered when reparenting an actor
832 int UtcDaliCustomActorRemoveDuringOnChildRemove(void)
834 TestApplication application;
835 tet_infoline("Testing Actor:Remove behaviour during OnChildRemove() callback triggered when reparenting");
837 Integration::Scene stage = application.GetScene();
839 MasterCallStack.clear();
841 /* The childActor will be reparented from actorA to actorB
842 * The actorA is a special variant which attempts to remove a child from actorB, during the OnChildRemove callback()
843 * This should be a NOOP since the reparenting has not occured yet
846 Test::TestCustomActor actorB = Test::TestCustomActor::New();
847 actorB.SetProperty(Actor::Property::NAME, "ActorB");
850 Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant8(actorB);
851 actorA.SetProperty(Actor::Property::NAME, "ActorA");
854 Actor childActor = Actor::New();
855 childActor.SetProperty(Actor::Property::NAME, "Child");
856 // Reparent from actorA to actorB
857 actorA.Add(childActor);
858 actorB.Add(childActor);
860 // Check hierarchy is as follows:
865 DALI_TEST_EQUALS(0, (int)(actorA.GetChildCount()), TEST_LOCATION);
866 DALI_TEST_EQUALS(1, (int)(actorB.GetChildCount()), TEST_LOCATION);
867 DALI_TEST_EQUALS(0, (int)(childActor.GetChildCount()), TEST_LOCATION);
869 Actor child = actorB.GetChildAt(0);
871 DALI_TEST_CHECK(child);
874 DALI_TEST_EQUALS("Child", child.GetProperty<std::string>(Actor::Property::NAME), TEST_LOCATION);
877 // Check callback sequence
879 DALI_TEST_EQUALS(4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
880 DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION);
881 DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[1], TEST_LOCATION); // The mContainer added to actorA
882 DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION);
883 DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[3], TEST_LOCATION); // The actorB added to actorA
884 // mContainer will then receive OnChildAdd
886 DALI_TEST_EQUALS(4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
887 DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION);
888 DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION);
889 // The derived class are always notified, no matter the child is successfully removed or not
890 DALI_TEST_EQUALS("OnChildRemove", actorB.GetMethodsCalled()[2], TEST_LOCATION);
891 DALI_TEST_EQUALS("OnChildAdd", actorB.GetMethodsCalled()[3], TEST_LOCATION);
893 DALI_TEST_EQUALS(8, (int)(MasterCallStack.size()), TEST_LOCATION);
895 DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[0], TEST_LOCATION);
896 DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[1], TEST_LOCATION);
897 DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[2], TEST_LOCATION);
898 DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[3], TEST_LOCATION);
899 DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION);
900 DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[5], TEST_LOCATION);
901 // The derived class are always notified, no matter the child is successfully removed or not
902 DALI_TEST_EQUALS("ActorB: OnChildRemove", MasterCallStack[6], TEST_LOCATION);
903 DALI_TEST_EQUALS("ActorB: OnChildAdd", MasterCallStack[7], TEST_LOCATION);
905 // Excercise the message passing to Update thread
907 application.SendNotification();
908 application.Render();
909 application.Render();
913 int UtcDaliCustomActorOnPropertySet(void)
915 TestApplication application;
916 tet_infoline("Testing Dali::CustomActor::OnPropertySet()");
918 Test::TestCustomActor custom = Test::TestCustomActor::New();
919 DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
921 custom.SetDaliProperty("yes");
923 DALI_TEST_EQUALS(1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
924 DALI_TEST_EQUALS("OnPropertySet", custom.GetMethodsCalled()[0], TEST_LOCATION);
928 int UtcDaliCustomActorOnSizeSet(void)
930 TestApplication application;
931 tet_infoline("Testing Dali::CustomActor::OnSizeSet()");
933 Test::TestCustomActor custom = Test::TestCustomActor::New();
934 DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
936 custom.SetProperty(Actor::Property::SIZE, Vector2(9.0f, 10.0f));
937 DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
938 DALI_TEST_EQUALS("OnSizeSet", custom.GetMethodsCalled()[0], TEST_LOCATION);
939 DALI_TEST_EQUALS("OnPropertySet", custom.GetMethodsCalled()[1], TEST_LOCATION);
940 DALI_TEST_EQUALS(9.0f, custom.GetSize().width, TEST_LOCATION);
941 DALI_TEST_EQUALS(10.0f, custom.GetSize().height, TEST_LOCATION);
943 custom.SetProperty(Actor::Property::SIZE, Vector3(4.0f, 5.0f, 6.0f));
944 DALI_TEST_EQUALS(4, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
945 DALI_TEST_EQUALS("OnSizeSet", custom.GetMethodsCalled()[2], TEST_LOCATION);
946 DALI_TEST_EQUALS("OnPropertySet", custom.GetMethodsCalled()[3], TEST_LOCATION);
947 DALI_TEST_EQUALS(4.0f, custom.GetSize().width, TEST_LOCATION);
948 DALI_TEST_EQUALS(5.0f, custom.GetSize().height, TEST_LOCATION);
949 DALI_TEST_EQUALS(6.0f, custom.GetSize().depth, TEST_LOCATION);
953 int UtcDaliCustomActorOnSizeAnimation(void)
955 TestApplication application;
956 tet_infoline("Testing Dali::CustomActor::OnSizeAnimation()");
958 Test::TestCustomActor custom = Test::TestCustomActor::New();
959 DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
961 application.GetScene().Add(custom);
963 Animation anim = Animation::New(1.0f);
964 anim.AnimateTo(Property(custom, Actor::Property::SIZE), Vector3(8.0f, 9.0f, 10.0f));
967 application.SendNotification();
968 application.Render(static_cast<unsigned int>(1000.0f));
970 DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
971 DALI_TEST_EQUALS("OnSizeAnimation", custom.GetMethodsCalled()[1], TEST_LOCATION);
972 DALI_TEST_EQUALS(8.0f, custom.GetTargetSize().width, TEST_LOCATION);
973 DALI_TEST_EQUALS(9.0f, custom.GetTargetSize().height, TEST_LOCATION);
974 DALI_TEST_EQUALS(10.0f, custom.GetTargetSize().depth, TEST_LOCATION);
978 int UtcDaliCustomActorSizeComponentAnimation(void)
980 TestApplication application;
981 tet_infoline("Testing Size component animation");
983 Test::TestCustomActor custom = Test::TestCustomActor::New();
984 float intialWidth(10.0f);
986 DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
988 custom.SetProperty(Actor::Property::SIZE, Vector2(intialWidth, 10.0f)); // First method
989 application.GetScene().Add(custom);
991 Animation anim = Animation::New(1.0f);
993 DALI_TEST_EQUALS(3, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
995 anim.AnimateTo(Property(custom, Actor::Property::SIZE_WIDTH), 20.0f);
997 DALI_TEST_EQUALS(3, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
999 anim.Play(); // Triggers second method ( OnSizeAnimation )
1001 application.SendNotification();
1002 application.Render(static_cast<unsigned int>(1000.0f));
1004 DALI_TEST_EQUALS(4, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
1006 DALI_TEST_EQUALS("OnSizeAnimation", custom.GetMethodsCalled()[3], TEST_LOCATION);
1011 int UtcDaliCustomActorImplOnPropertySet(void)
1013 TestApplication application;
1014 CustomActorImpl* impl = new Test::Impl::SimpleTestCustomActor();
1015 CustomActor customActor(*impl); // Will automatically unref at the end of this function
1017 impl->OnPropertySet(0, 0);
1019 DALI_TEST_CHECK(true);
1024 int UtcDaliCustomActorGetImplementation(void)
1026 TestApplication application;
1028 Test::TestCustomActor custom = Test::TestCustomActor::New();
1029 CustomActorImpl& impl = custom.GetImplementation();
1030 impl.GetOwner(); // Test
1032 const Test::TestCustomActor constCustom = Test::TestCustomActor::New();
1033 const CustomActorImpl& constImpl = constCustom.GetImplementation();
1034 constImpl.GetOwner(); // Test
1036 DALI_TEST_CHECK(true);
1040 int UtcDaliCustomActorDoAction(void)
1042 TestApplication application;
1043 tet_infoline("Testing Dali::CustomActor::DoAction()");
1045 Test::TestCustomActor custom = Test::TestCustomActor::New();
1047 BaseHandle customActorObject = custom;
1049 DALI_TEST_CHECK(customActorObject);
1051 Property::Map attributes;
1053 // Check that an invalid command is not performed
1054 DALI_TEST_CHECK(customActorObject.DoAction("invalidCommand", attributes) == false);
1056 // Check that the custom actor is visible
1057 custom.SetProperty(Actor::Property::VISIBLE, true);
1058 DALI_TEST_CHECK(custom.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
1060 // Check the custom actor performed an action to hide itself
1061 DALI_TEST_CHECK(customActorObject.DoAction("hide", attributes) == true);
1063 // flush the queue and render once
1064 application.SendNotification();
1065 application.Render();
1067 // Check that the custom actor is now invisible
1068 DALI_TEST_CHECK(custom.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == false);
1070 // Check the custom actor performed an action to show itself
1071 DALI_TEST_CHECK(customActorObject.DoAction("show", attributes) == true);
1073 // flush the queue and render once
1074 application.SendNotification();
1075 application.Render();
1077 // Check that the custom actor is now visible
1078 DALI_TEST_CHECK(custom.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
1082 int UtcDaliCustomActorCustomActor(void)
1084 Dali::CustomActor customA;
1085 Dali::CustomActor customB(customA);
1087 DALI_TEST_CHECK(customA == customB);
1092 int UtcDaliCustomActorImplSetTransparent(void)
1094 TestApplication application; // Need the type registry
1096 Test::TestCustomActor actor = Test::TestCustomActor::New();
1097 application.GetScene().Add(actor);
1098 actor.SetProperty(Actor::Property::OPACITY, 0.1f);
1099 actor.SetProperty(Actor::Property::SIZE, Vector2(400, 400));
1101 DALI_TEST_EQUALS(false, actor.IsTransparent(), TEST_LOCATION);
1103 actor.SetTransparent(true);
1105 // flush the queue and render once
1106 application.SendNotification();
1107 application.Render();
1109 DALI_TEST_EQUALS(true, actor.IsTransparent(), TEST_LOCATION);
1111 application.GetScene().Remove(actor);
1115 int UtcDaliCustomActorImplRelayoutRequest(void)
1117 TestApplication application;
1119 DALI_TEST_CHECK(gOnRelayout == false);
1121 Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
1122 application.GetScene().Add(custom);
1124 application.SendNotification();
1125 application.Render();
1127 DALI_TEST_CHECK(gOnRelayout == true);
1128 gOnRelayout = false;
1130 custom.TestRelayoutRequest();
1131 application.SendNotification();
1132 application.Render();
1134 DALI_TEST_CHECK(gOnRelayout == true);
1139 int UtcDaliCustomActorImplGetHeightForWidthBase(void)
1141 TestApplication application;
1142 Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
1144 float width = 300.0f;
1146 application.SendNotification();
1147 application.Render();
1149 float v = custom.TestGetHeightForWidthBase(width);
1151 DALI_TEST_CHECK(v == width);
1156 int UtcDaliCustomActorImplGetWidthForHeightBase(void)
1158 TestApplication application;
1159 Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
1161 float height = 300.0f;
1163 application.SendNotification();
1164 application.Render();
1166 float v = custom.TestGetWidthForHeightBase(height);
1168 DALI_TEST_CHECK(v == height);
1173 int UtcDaliCustomActorImplCalculateChildSizeBase(void)
1175 TestApplication application;
1176 Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
1178 Actor child = Actor::New();
1179 child.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS);
1180 child.SetProperty(Actor::Property::SIZE, Vector2(150, 150));
1182 application.SendNotification();
1183 application.Render();
1185 float v = custom.TestCalculateChildSizeBase(child, Dali::Dimension::ALL_DIMENSIONS);
1186 DALI_TEST_CHECK(v == 0.0f);
1191 int UtcDaliCustomActorImplRelayoutDependentOnChildrenBase(void)
1193 TestApplication application;
1194 Test::TestCustomActor customNego = Test::TestCustomActor::NewNegoSize();
1195 Test::TestCustomActor customNotNego = Test::TestCustomActor::New();
1197 // A custom actor with default flags has relayouting enabled on initialization,
1198 // and the default resize policy is USE_NATURAL_SIZE.
1199 bool v = customNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::ALL_DIMENSIONS);
1200 DALI_TEST_CHECK(v == true);
1202 // A custom actor with size negotiation explicitly switched off has no relayouting,
1203 // and will not have any relayout dependencies. However, default resize policy when
1204 // there is no relayouting is to return USE_NATURAL_SIZE, so this will actually return true,
1205 // and is consistent.
1206 v = customNotNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::ALL_DIMENSIONS);
1207 DALI_TEST_CHECK(v == true);
1209 customNego.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::ALL_DIMENSIONS);
1210 customNotNego.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::ALL_DIMENSIONS);
1212 v = customNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::ALL_DIMENSIONS);
1213 DALI_TEST_CHECK(v == true);
1214 v = customNotNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::ALL_DIMENSIONS);
1215 DALI_TEST_CHECK(v == true);
1217 application.SendNotification();
1218 application.Render();
1220 customNego.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS);
1221 customNotNego.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS);
1222 v = customNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::WIDTH);
1223 DALI_TEST_CHECK(v == false);
1224 v = customNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::HEIGHT);
1225 DALI_TEST_CHECK(v == false);
1226 v = customNotNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::WIDTH);
1227 DALI_TEST_CHECK(v == false);
1228 v = customNotNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::HEIGHT);
1229 DALI_TEST_CHECK(v == false);
1231 application.SendNotification();
1232 application.Render();
1234 customNego.SetResizePolicy(Dali::ResizePolicy::USE_NATURAL_SIZE, Dali::Dimension::WIDTH);
1235 customNotNego.SetResizePolicy(Dali::ResizePolicy::USE_NATURAL_SIZE, Dali::Dimension::HEIGHT);
1236 v = customNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::WIDTH);
1237 DALI_TEST_CHECK(v == true);
1238 v = customNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::HEIGHT);
1239 DALI_TEST_CHECK(v == false);
1240 v = customNotNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::WIDTH);
1241 DALI_TEST_CHECK(v == false);
1242 v = customNotNego.TestRelayoutDependentOnChildrenBase(Dali::Dimension::HEIGHT);
1243 DALI_TEST_CHECK(v == true);
1248 int UtcDaliCustomActorTypeRegistry(void)
1250 TestApplication application;
1254 type = TypeRegistry::Get().GetTypeInfo("CustomActor");
1255 DALI_TEST_CHECK(type);
1256 BaseHandle handle = type.CreateInstance();
1259 std::string exception;
1263 name = handle.GetTypeName();
1264 tet_result(TET_FAIL);
1266 catch(DaliException& e)
1268 exception = e.condition;
1269 DALI_TEST_EQUALS(exception, "handle && \"BaseObject handle is empty\"", TEST_LOCATION);
1275 int UtcDaliCustomActorGetExtensionP(void)
1277 TestApplication application;
1279 Test::TestCustomActor custom = Test::TestCustomActor::NewVariant5(application.GetScene());
1281 DALI_TEST_CHECK(NULL == custom.GetImplementation().GetExtension());
1286 int UtcDaliCustomActorOnConnectionDepth(void)
1288 TestApplication application;
1289 tet_infoline("Testing Dali::CustomActor::OnSceneConnection() hierarchy depth");
1291 Integration::Scene stage = application.GetScene();
1293 /* Build tree of actors:
1303 * OnSceneConnection should return 1 for A, 2 for B and C, and 3 for D, E and F.
1306 Test::TestCustomActor actorA = Test::TestCustomActor::New();
1309 Test::TestCustomActor actorB = Test::TestCustomActor::New();
1312 Test::TestCustomActor actorC = Test::TestCustomActor::New();
1315 Test::TestCustomActor actorD = Test::TestCustomActor::New();
1318 Test::TestCustomActor actorE = Test::TestCustomActor::New();
1321 Test::TestCustomActor actorF = Test::TestCustomActor::New();
1324 // Excercise the message passing to Update thread
1325 application.SendNotification();
1326 application.Render();
1327 application.Render();
1329 DALI_TEST_EQUALS(1u, actorA.GetDepth(), TEST_LOCATION);
1330 DALI_TEST_EQUALS(2u, actorB.GetDepth(), TEST_LOCATION);
1331 DALI_TEST_EQUALS(2u, actorC.GetDepth(), TEST_LOCATION);
1332 DALI_TEST_EQUALS(3u, actorD.GetDepth(), TEST_LOCATION);
1333 DALI_TEST_EQUALS(3u, actorE.GetDepth(), TEST_LOCATION);
1334 DALI_TEST_EQUALS(3u, actorF.GetDepth(), TEST_LOCATION);
1339 int UtcDaliCustomActorSetGetProperty(void)
1341 TestApplication application; // Need the type registry
1343 Test::TestCustomActor actor = Test::TestCustomActor::New();
1344 application.GetScene().Add(actor);
1346 actor.SetProperty(Test::TestCustomActor::Property::TEST_PROPERTY1, 0.5f);
1347 actor.SetProperty(Test::TestCustomActor::Property::TEST_PROPERTY2, Color::WHITE);
1348 actor.SetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY3, Color::BLUE);
1349 actor.SetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY4, 20);
1350 actor.SetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY5, 40.0f);
1352 Property::Value value = actor.GetProperty(Test::TestCustomActor::Property::TEST_PROPERTY1);
1353 DALI_TEST_EQUALS(value.Get<float>(), 0.5f, 0.001f, TEST_LOCATION);
1355 value = actor.GetProperty(Test::TestCustomActor::Property::TEST_PROPERTY2);
1356 DALI_TEST_EQUALS(value.Get<Vector4>(), Color::WHITE, 0.001f, TEST_LOCATION);
1358 value = actor.GetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY3);
1359 DALI_TEST_EQUALS(value.Get<Vector4>(), Color::BLUE, 0.001f, TEST_LOCATION);
1361 value = actor.GetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY4);
1362 DALI_TEST_EQUALS(value.Get<int>(), 20, TEST_LOCATION);
1364 value = actor.GetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY5);
1365 DALI_TEST_EQUALS(value.Get<float>(), 40.0f, 0.001f, TEST_LOCATION);
1367 // Get read-only property
1368 value = actor.GetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY6);
1369 DALI_TEST_EQUALS(value.Get<float>(), 10.0f, 0.001f, TEST_LOCATION);
1371 // Attempt to set read-only property and then ensure value hasn't changed
1372 actor.SetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY6, 40.0f);
1373 DALI_TEST_EQUALS(value.Get<float>(), 10.0f, 0.001f, TEST_LOCATION);
1378 int utcDaliActorGetTypeInfo(void)
1380 TestApplication application;
1381 tet_infoline("Get the type info of a derived actor");
1383 Test::TestCustomActor customActor = Test::TestCustomActor::New();
1385 Dali::TypeInfo typeInfo = Dali::DevelCustomActor::GetTypeInfo(customActor);
1387 DALI_TEST_EQUALS(typeInfo.GetName(), std::string("TestCustomActor"), TEST_LOCATION);
1395 * A custom actor that is not type registered on purpose
1397 struct UnregisteredCustomActor : public Dali::CustomActorImpl
1399 UnregisteredCustomActor()
1400 : CustomActorImpl(ACTOR_BEHAVIOUR_DEFAULT)
1403 virtual ~UnregisteredCustomActor()
1406 virtual void OnSceneConnection(int32_t depth)
1409 virtual void OnSceneDisconnection()
1412 virtual void OnChildAdd(Actor& child)
1415 virtual void OnChildRemove(Actor& child)
1418 virtual void OnPropertySet(Property::Index index, const Property::Value& propertyValue)
1421 virtual void OnSizeSet(const Vector3& targetSize)
1424 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
1427 virtual bool OnHoverEvent(const HoverEvent& event)
1431 virtual bool OnWheelEvent(const WheelEvent& event)
1435 virtual void OnRelayout(const Vector2& size, RelayoutContainer& container)
1438 virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
1441 virtual Vector3 GetNaturalSize()
1445 virtual float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension)
1449 virtual float GetHeightForWidth(float width)
1453 virtual float GetWidthForHeight(float height)
1457 virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS)
1461 virtual void OnCalculateRelayoutSize(Dimension::Type dimension)
1464 virtual void OnLayoutNegotiated(float size, Dimension::Type dimension)
1469 struct UnregisteredCustomActor : public Dali::CustomActor
1471 static UnregisteredCustomActor New()
1473 Impl::UnregisteredCustomActor* impl = new Impl::UnregisteredCustomActor;
1474 UnregisteredCustomActor custom(*impl); // takes ownership
1477 UnregisteredCustomActor()
1480 ~UnregisteredCustomActor()
1483 UnregisteredCustomActor(Internal::CustomActor* impl)
1487 UnregisteredCustomActor(Impl::UnregisteredCustomActor& impl)
1491 static UnregisteredCustomActor DownCast(BaseHandle handle)
1493 UnregisteredCustomActor hndl;
1494 CustomActor custom = Dali::CustomActor::DownCast(handle);
1497 CustomActorImpl& customImpl = custom.GetImplementation();
1499 Impl::UnregisteredCustomActor* impl = dynamic_cast<Impl::UnregisteredCustomActor*>(&customImpl);
1503 hndl = UnregisteredCustomActor(customImpl.GetOwner());
1510 int UtcDaliCustomActorSetGetActorPropertyActionSignal(void)
1512 TestApplication application; // Need the type registry
1514 auto custom = UnregisteredCustomActor::New();
1515 application.GetScene().Add(custom);
1517 // should have all actor properties
1518 DALI_TEST_EQUALS(custom.GetPropertyType(Actor::Property::COLOR), Property::VECTOR4, TEST_LOCATION);
1519 auto actorHandle = Actor::New();
1520 DALI_TEST_EQUALS(custom.GetPropertyCount(), actorHandle.GetPropertyCount(), TEST_LOCATION);
1522 DALI_TEST_EQUALS(custom.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
1523 custom.SetProperty(Actor::Property::VISIBLE, false);
1524 application.SendNotification();
1525 application.Render(); // IsVisible returns scene value
1526 DALI_TEST_EQUALS(custom.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
1528 // should have custom actor typename (as it has not registered itself)
1529 DALI_TEST_EQUALS("CustomActor", custom.GetTypeName(), TEST_LOCATION);
1531 // should have actor actions
1532 custom.DoAction("show", Property::Map());
1533 DALI_TEST_EQUALS(custom.GetProperty(Actor::Property::VISIBLE).Get<bool>(), true, TEST_LOCATION);
1535 Animation animation = Animation::New(0.01f); // very short animation
1536 // should be able to animate actor property
1537 animation.AnimateTo(Property(custom, Actor::Property::POSITION), Vector3(100.0f, 150.0f, 200.0f));
1540 application.SendNotification();
1541 application.Render(1000.f);
1543 DALI_TEST_EQUALS(Vector3(100.0f, 150.0f, 200.0f), custom.GetProperty(Actor::Property::POSITION).Get<Vector3>(), TEST_LOCATION);
1544 DALI_TEST_EQUALS(Vector3(100.0f, 150.0f, 200.0f), custom.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
1546 Dali::WeakHandle<UnregisteredCustomActor> weakRef(custom);
1547 // should have actor signals
1548 custom.ConnectSignal(&application, "offScene", [weakRef]() {
1549 DALI_TEST_EQUALS(weakRef.GetHandle().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE), false, TEST_LOCATION);
1552 application.GetScene().Remove(custom);
1553 application.GetScene().Add(custom);
1560 struct DerivedCustomActor : public UnregisteredCustomActor
1565 struct DerivedCustomActor : public UnregisteredCustomActor
1567 static DerivedCustomActor New()
1569 Impl::DerivedCustomActor* impl = new Impl::DerivedCustomActor;
1570 DerivedCustomActor custom(*impl); // takes ownership
1573 DerivedCustomActor()
1576 ~DerivedCustomActor()
1579 DerivedCustomActor(Internal::CustomActor* impl)
1580 : UnregisteredCustomActor(impl)
1583 DerivedCustomActor(Impl::UnregisteredCustomActor& impl)
1584 : UnregisteredCustomActor(impl)
1590 DALI_TYPE_REGISTRATION_BEGIN(DerivedCustomActor, UnregisteredCustomActor, nullptr);
1591 DALI_TYPE_REGISTRATION_END()
1593 int UtcDaliCustomActorPropertyRegistrationDefaultValue(void)
1595 TestApplication application; // Need the type registry
1597 // register our base and add a property with default value for it
1598 Dali::TypeRegistration typeRegistration(typeid(UnregisteredCustomActor), typeid(Dali::CustomActor), nullptr);
1600 auto derived = DerivedCustomActor::New();
1601 application.GetScene().Add(derived);
1603 // should have all actor properties
1604 DALI_TEST_EQUALS(derived.GetPropertyType(Actor::Property::WORLD_MATRIX), Property::MATRIX, TEST_LOCATION);
1605 auto actorHandle = Actor::New();
1606 DALI_TEST_EQUALS(derived.GetPropertyCount(), actorHandle.GetPropertyCount(), TEST_LOCATION);
1608 // add a property in base class
1609 AnimatablePropertyRegistration(typeRegistration, "Foobar", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, 10.f);
1611 // should be one more property now
1612 DALI_TEST_EQUALS(derived.GetPropertyCount(), actorHandle.GetPropertyCount() + 1, TEST_LOCATION);
1613 // check that the default value is set for base class
1614 DALI_TEST_EQUALS(UnregisteredCustomActor::New().GetProperty(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX).Get<float>(), 10.f, TEST_LOCATION);
1615 // check that the default value is set for the derived instance as well
1616 DALI_TEST_EQUALS(derived.GetProperty(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX).Get<float>(), 10.f, TEST_LOCATION);
1621 int UtcDaliCustomActorComponentPropertyConstraintsP(void)
1623 TestApplication application; // Need the type registry
1625 // register our base and add a property with default value for it
1626 Dali::TypeRegistration typeRegistration(typeid(UnregisteredCustomActor), typeid(Dali::CustomActor), nullptr);
1628 auto derived = DerivedCustomActor::New();
1629 application.GetScene().Add(derived);
1631 // should have all actor properties
1632 auto actorHandle = Actor::New();
1633 DALI_TEST_EQUALS(derived.GetPropertyCount(), actorHandle.GetPropertyCount(), TEST_LOCATION);
1635 // add a property in base class
1636 const Property::Index foobarIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
1637 const Property::Index fooIndex = foobarIndex + 1;
1638 const Property::Index barIndex = foobarIndex + 2;
1640 AnimatablePropertyRegistration(typeRegistration, "Foobar", foobarIndex, Vector2(10.0f, 20.0f));
1641 AnimatablePropertyComponentRegistration(typeRegistration, "Foobar.x", fooIndex, foobarIndex, 0);
1642 AnimatablePropertyComponentRegistration(typeRegistration, "Foobar.y", barIndex, foobarIndex, 1);
1644 tet_infoline("Test the default values of the registered property");
1645 // should be more properties now
1646 DALI_TEST_EQUALS(derived.GetPropertyCount(), actorHandle.GetPropertyCount() + 3, TEST_LOCATION);
1647 // check that the default value is set for base class
1648 DALI_TEST_EQUALS(UnregisteredCustomActor::New().GetProperty(foobarIndex).Get<Vector2>(), Vector2(10.f, 20.0f), 0.0001f, TEST_LOCATION);
1649 // check that the default value is set for the derived instance as well
1650 DALI_TEST_EQUALS(derived.GetProperty(foobarIndex).Get<Vector2>(), Vector2(10.f, 20.0f), 0.0001f, TEST_LOCATION);
1652 tet_infoline("Test that the components of the registered property can be constrained");
1654 // Try constraining the properties
1655 Constraint fooCons = Constraint::New<float>(derived, fooIndex, &Test::Doubler);
1656 fooCons.AddSource(LocalSource(Actor::Property::POSITION_X));
1658 Constraint barCons = Constraint::New<float>(derived, barIndex, &Test::Doubler);
1659 barCons.AddSource(LocalSource(fooIndex));
1662 for(int i = 1; i < 10; ++i)
1664 derived[Actor::Property::POSITION_X] = i * 1.0f;
1665 application.SendNotification();
1666 application.Render();
1667 DALI_TEST_EQUALS(derived.GetCurrentProperty(foobarIndex).Get<Vector2>(), Vector2(i * 2.0f, i * 4.0f), 0.0001f, TEST_LOCATION);
1670 // Add a Vector3 property and its components for completeness
1671 const Property::Index vec3PropIndex = barIndex + 1;
1672 const Property::Index vec3xPropIndex = vec3PropIndex + 1;
1673 const Property::Index vec3yPropIndex = vec3PropIndex + 2;
1674 const Property::Index vec3zPropIndex = vec3PropIndex + 3;
1676 AnimatablePropertyRegistration(typeRegistration, "vec3Prop", vec3PropIndex, Vector3(10.0f, 20.0f, 30.0f));
1677 AnimatablePropertyComponentRegistration(typeRegistration, "vec3Prop.x", vec3xPropIndex, vec3PropIndex, 0);
1678 AnimatablePropertyComponentRegistration(typeRegistration, "vec3Prop.y", vec3yPropIndex, vec3PropIndex, 1);
1679 AnimatablePropertyComponentRegistration(typeRegistration, "vec3Prop.z", vec3zPropIndex, vec3PropIndex, 2);
1681 tet_infoline("Test the default values of the registered vec3 property");
1682 // should be more properties now
1683 DALI_TEST_EQUALS(derived.GetPropertyCount(), actorHandle.GetPropertyCount() + 7, TEST_LOCATION);
1684 // check that the default value is set for base class
1685 DALI_TEST_EQUALS(UnregisteredCustomActor::New().GetProperty(vec3PropIndex).Get<Vector3>(), Vector3(10.f, 20.0f, 30.0f), 0.0001f, TEST_LOCATION);
1686 // check that the default value is set for the derived instance as well
1687 DALI_TEST_EQUALS(derived.GetProperty(vec3PropIndex).Get<Vector3>(), Vector3(10.f, 20.0f, 30.0f), 0.0001f, TEST_LOCATION);
1689 tet_infoline("Test that the components of the registered property can be constrained");
1691 // Try constraining the properties
1692 Constraint vec3xConstraint = Constraint::New<float>(derived, vec3xPropIndex, &Test::Doubler);
1693 vec3xConstraint.AddSource(LocalSource(Actor::Property::POSITION_X));
1694 vec3xConstraint.Apply();
1695 Constraint vec3yConstraint = Constraint::New<float>(derived, vec3yPropIndex, &Test::Doubler);
1696 vec3yConstraint.AddSource(LocalSource(vec3xPropIndex));
1697 vec3yConstraint.Apply();
1698 Constraint vec3zConstraint = Constraint::New<float>(derived, vec3zPropIndex, &Test::Doubler);
1699 vec3zConstraint.AddSource(LocalSource(vec3yPropIndex));
1700 vec3zConstraint.Apply();
1702 for(int i = 1; i < 10; ++i)
1704 derived[Actor::Property::POSITION_X] = i * 1.0f;
1705 application.SendNotification();
1706 application.Render();
1707 DALI_TEST_EQUALS(derived.GetCurrentProperty(vec3PropIndex).Get<Vector3>(), Vector3(i * 2.0f, i * 4.0f, i * 8.0f), 0.0001f, TEST_LOCATION);