2 * Copyright (c) 2020 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-test-suite-utils.h>
19 #include <dali/devel-api/common/stage-devel.h>
20 #include <dali/integration-api/context-notifier.h>
21 #include <dali/integration-api/events/key-event-integ.h>
22 #include <dali/integration-api/events/touch-event-integ.h>
23 #include <dali/integration-api/events/wheel-event-integ.h>
24 #include <dali/public-api/dali-core.h>
25 #include <dali/public-api/events/key-event.h>
32 void stage_test_startup(void)
34 test_return_value = TET_UNDEF;
37 void stage_test_cleanup(void)
39 test_return_value = TET_PASS;
44 const std::string DEFAULT_DEVICE_NAME("hwKeyboard");
46 // Functor for EventProcessingFinished signal
47 struct EventProcessingFinishedFunctor
50 * @param[in] eventProcessingFinished reference to a boolean variable used to check if signal has been called.
52 EventProcessingFinishedFunctor(bool& eventProcessingFinished)
53 : mEventProcessingFinished(eventProcessingFinished)
59 mEventProcessingFinished = true;
62 bool& mEventProcessingFinished;
65 // Stores data that is populated in the KeyEventGeneratedSignal callback and will be read by the TET cases
66 struct KeyEventGeneratedSignalData
68 KeyEventGeneratedSignalData()
69 : functorCalled(false)
75 functorCalled = false;
77 receivedKeyEvent.Reset();
81 KeyEvent receivedKeyEvent;
84 // Functor that sets the data when called
85 struct KeyEventGeneratedReceivedFunctor
87 KeyEventGeneratedReceivedFunctor(KeyEventGeneratedSignalData& data)
92 bool operator()(const KeyEvent& keyEvent)
94 signalData.functorCalled = true;
95 signalData.receivedKeyEvent = keyEvent;
102 signalData.functorCalled = true;
106 KeyEventGeneratedSignalData& signalData;
109 // Stores data that is populated in the key-event callback and will be read by the TET cases
110 struct KeyEventSignalData
113 : functorCalled(false)
119 functorCalled = false;
121 receivedKeyEvent.Reset();
125 KeyEvent receivedKeyEvent;
128 // Functor that sets the data when called
129 struct KeyEventReceivedFunctor
131 KeyEventReceivedFunctor(KeyEventSignalData& data)
136 bool operator()(const KeyEvent& keyEvent)
138 signalData.functorCalled = true;
139 signalData.receivedKeyEvent = keyEvent;
144 KeyEventSignalData& signalData;
147 // Stores data that is populated in the touched signal callback and will be read by the TET cases
148 struct TouchedSignalData
151 : functorCalled(false)
157 functorCalled = false;
159 receivedTouchEvent.Reset();
163 TouchEvent receivedTouchEvent;
166 // Functor that sets the data when touched signal is received
169 TouchFunctor(TouchedSignalData& data)
174 void operator()(const TouchEvent& touch)
176 signalData.functorCalled = true;
177 TouchEvent handle(touch);
178 signalData.receivedTouchEvent = handle;
181 // Allows functor to be used for signal connection by string.
182 // No data stored, though, so quite useless.
185 signalData.functorCalled = true;
188 TouchedSignalData& signalData;
191 // Stores data that is populated in the wheel-event callback and will be read by the TET cases
192 struct WheelEventSignalData
194 WheelEventSignalData()
195 : functorCalled(false)
201 functorCalled = false;
205 WheelEvent receivedWheelEvent;
208 // Functor that sets the data when wheel-event signal is received
209 struct WheelEventReceivedFunctor
211 WheelEventReceivedFunctor(WheelEventSignalData& data)
216 bool operator()(const WheelEvent& wheelEvent)
218 signalData.functorCalled = true;
219 signalData.receivedWheelEvent = wheelEvent;
224 WheelEventSignalData& signalData;
227 // Functor that sets the data when wheel-event signal is received
228 struct WheelEventReceivedVoidFunctor
230 WheelEventReceivedVoidFunctor(WheelEventSignalData& data)
235 // Signals connected through BaseObject::DoConnectSignal can only take void() methods
236 bool operator()(void)
238 signalData.functorCalled = true;
242 WheelEventSignalData& signalData;
246 bool DummyTouchCallback(Actor actor, const TouchEvent& touch)
251 struct ContextStatusFunctor
253 ContextStatusFunctor(bool& calledFlag)
254 : mCalledFlag(calledFlag)
271 struct SceneCreatedStatusFunctor
273 SceneCreatedStatusFunctor(bool& calledFlag)
274 : mCalledFlag(calledFlag)
291 struct ActorCreatedFunctor
293 ActorCreatedFunctor(bool& signalReceived)
294 : mSignalVerified(signalReceived)
298 void operator()(BaseHandle object)
300 tet_infoline("Verifying TestActorCallback()");
301 Actor actor = Actor::DownCast(object);
304 mSignalVerified = true;
308 bool& mSignalVerified;
311 void GenerateTouch(TestApplication& application, PointState::Type state, const Vector2& screenPosition)
313 Integration::TouchEvent touchEvent;
314 Integration::Point point;
315 point.SetState(state);
316 point.SetScreenPosition(screenPosition);
317 touchEvent.points.push_back(point);
318 application.ProcessEvent(touchEvent);
321 } // unnamed namespace
323 int UtcDaliStageDefaultConstructorP(void)
325 TestApplication application;
328 DALI_TEST_CHECK(!stage);
332 // Note: No negative test for default constructor.
334 int UtcDaliStageDestructorP(void)
336 TestApplication application;
337 Stage* stage = new Stage();
341 DALI_TEST_CHECK(true);
345 // Note: No negative test for default destructor.
347 int UtcDaliStageGetCurrentP(void)
349 TestApplication application;
350 Stage stage = Stage::GetCurrent();
352 DALI_TEST_CHECK(stage);
356 int UtcDaliStageGetCurrentN(void)
358 bool asserted = false;
361 Stage stage = Stage::GetCurrent();
363 catch(Dali::DaliException& e)
365 DALI_TEST_PRINT_ASSERT(e);
366 DALI_TEST_ASSERT(e, "stage && \"Stage doesn't exist\"", TEST_LOCATION);
370 DALI_TEST_CHECK(asserted);
374 int UtcDaliStageIsInstalledP(void)
376 TestApplication application;
380 DALI_TEST_CHECK(Stage::IsInstalled());
384 int UtcDaliStageIsInstalledN(void)
386 DALI_TEST_CHECK(!Stage::IsInstalled());
391 int UtcDaliStageCopyConstructorP(void)
393 TestApplication application;
394 Stage stage = Stage::GetCurrent();
396 Stage copyStage(stage);
398 DALI_TEST_CHECK(copyStage);
399 DALI_TEST_CHECK(copyStage.GetRootLayer() == stage.GetRootLayer());
404 // Note: no negative test for UtcDaliStageCopyConstructor.
406 int UtcDaliStageAssignmentOperatorP(void)
408 TestApplication application;
409 const Stage stage = Stage::GetCurrent();
411 Stage copyStage = stage;
413 DALI_TEST_CHECK(copyStage);
414 DALI_TEST_CHECK(copyStage.GetRootLayer() == stage.GetRootLayer());
419 // Note: No negative test for UtcDaliStageAssignmentOperator.
421 int UtcDaliStageAddP(void)
423 TestApplication application;
425 Stage stage = Stage::GetCurrent();
427 Actor actor = Actor::New();
428 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
431 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
435 int UtcDaliStageAddN(void)
437 TestApplication application;
439 Stage stage = Stage::GetCurrent();
442 bool asserted = false;
447 catch(Dali::DaliException& e)
449 DALI_TEST_PRINT_ASSERT(e);
450 DALI_TEST_ASSERT(e, "actor && \"Actor handle is empty\"", TEST_LOCATION);
454 DALI_TEST_CHECK(asserted);
459 int UtcDaliStageRemoveP(void)
461 TestApplication application;
463 Stage stage = Stage::GetCurrent();
465 Actor actor = Actor::New();
466 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
469 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
472 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
476 int UtcDaliStageRemoveN1(void)
478 TestApplication application;
480 Stage stage = Stage::GetCurrent();
483 bool asserted = false;
486 // Actor is not valid, confirm a removal attempt does assert.
489 catch(Dali::DaliException& e)
491 DALI_TEST_PRINT_ASSERT(e);
492 DALI_TEST_ASSERT(e, "actor && \"Actor handle is empty\"", TEST_LOCATION);
496 DALI_TEST_CHECK(asserted);
500 int UtcDaliStageRemoveN2(void)
502 TestApplication application;
504 Stage stage = Stage::GetCurrent();
505 Actor actor = Actor::New();
506 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
508 bool asserted = false;
511 // Actor is not on stage, confirm a removal attempt does not assert / segfault.
514 catch(Dali::DaliException& e)
516 DALI_TEST_PRINT_ASSERT(e);
520 DALI_TEST_CHECK(!asserted);
524 int UtcDaliStageRemoveN3(void)
526 TestApplication application;
528 Stage stage = Stage::GetCurrent();
530 // Initially we have a default layer
531 DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION);
533 // Check we cannot remove the root layer from the stage.
534 Layer layer = stage.GetRootLayer();
535 bool asserted = true;
540 catch(Dali::DaliException& e)
542 DALI_TEST_PRINT_ASSERT(e);
543 DALI_TEST_ASSERT(e, "this != &child && \"Cannot remove actor from itself\"", TEST_LOCATION);
547 DALI_TEST_CHECK(asserted);
548 DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION);
552 int UtcDaliStageGetSizeP(void)
554 TestApplication application;
556 Stage stage = Stage::GetCurrent();
558 Vector2 size = stage.GetSize();
560 DALI_TEST_EQUALS(size.width, static_cast<float>(TestApplication::DEFAULT_SURFACE_WIDTH), TEST_LOCATION);
561 DALI_TEST_EQUALS(size.height, static_cast<float>(TestApplication::DEFAULT_SURFACE_HEIGHT), TEST_LOCATION);
565 int UtcDaliStageGetSizeN(void)
567 TestApplication application;
571 bool asserted = false;
575 size = stage.GetSize();
577 catch(Dali::DaliException& e)
579 DALI_TEST_PRINT_ASSERT(e);
580 DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION);
584 DALI_TEST_CHECK(asserted);
588 int UtcDaliStageGetDpiP1(void)
590 TestApplication application; // Initializes core DPI to default values
592 Stage stage = Stage::GetCurrent();
594 // Test the default DPI.
595 Vector2 dpi = stage.GetDpi();
596 DALI_TEST_EQUALS(dpi.x, static_cast<float>(TestApplication::DEFAULT_HORIZONTAL_DPI), TEST_LOCATION);
597 DALI_TEST_EQUALS(dpi.y, static_cast<float>(TestApplication::DEFAULT_VERTICAL_DPI), TEST_LOCATION);
601 int UtcDaliStageGetDpiP2(void)
603 TestApplication application; // Initializes core DPI to default values
605 // Test that setting core DPI explicitly also sets up the Stage's DPI.
606 Dali::Integration::Scene scene = application.GetScene();
607 scene.SetDpi(Vector2(200.0f, 180.0f));
609 Stage stage = Stage::GetCurrent();
610 Vector2 dpi = stage.GetDpi();
611 DALI_TEST_EQUALS(dpi.x, 200.0f, TEST_LOCATION);
612 DALI_TEST_EQUALS(dpi.y, 180.0f, TEST_LOCATION);
616 int UtcDaliStageGetDpiP3(void)
618 TestApplication application(480, 800, 72, 120); // Initializes core DPI with specific values
620 Stage stage = Stage::GetCurrent();
622 // Test that setting core DPI explicitly also sets up the Stage's DPI.
623 Vector2 dpi = stage.GetDpi();
624 DALI_TEST_EQUALS(dpi.x, 72.0f, TEST_LOCATION);
625 DALI_TEST_EQUALS(dpi.y, 120.0f, TEST_LOCATION);
630 * This is not a true negative test, we are checking the DPI if it has not been set.
631 * A test for setting negative DPI values would be part of the application core utc tests.
633 int UtcDaliStageGetDpiN(void)
635 TestApplication application; // Initializes core DPI to default values
637 Stage stage = Stage::GetCurrent();
638 Vector2 dpi = stage.GetDpi();
640 DALI_TEST_EQUALS(dpi.x, 220.0f, TEST_LOCATION);
641 DALI_TEST_EQUALS(dpi.y, 217.0f, TEST_LOCATION);
645 int UtcDaliStageGetLayerCountP(void)
647 TestApplication application;
649 Stage stage = Stage::GetCurrent();
651 // Initially we have a default layer
652 DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION);
654 Layer layer = Layer::New();
657 DALI_TEST_EQUALS(stage.GetLayerCount(), 2u, TEST_LOCATION);
662 * Not a true negative test, but confirms layer count is not affected by an invalid removal.
664 int UtcDaliStageGetLayerCountN(void)
666 TestApplication application;
668 Stage stage = Stage::GetCurrent();
670 // Initially we have a default layer
671 DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION);
673 Layer layer = Layer::New();
676 // Still have 1 layer.
677 DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION);
681 int UtcDaliStageGetLayerP(void)
683 TestApplication application;
685 Stage stage = Stage::GetCurrent();
687 Layer rootLayer = stage.GetLayer(0);
688 DALI_TEST_CHECK(rootLayer);
690 Layer layer = Layer::New();
693 Layer sameLayer = stage.GetLayer(1);
694 DALI_TEST_CHECK(layer == sameLayer);
698 int UtcDaliStageGetLayerN(void)
700 TestApplication application;
702 Stage stage = Stage::GetCurrent();
704 bool asserted = false;
707 // Try to get a layer that doesn't exist (note: 0 is the root layer).
708 Layer layer = stage.GetLayer(1);
710 catch(Dali::DaliException& e)
712 DALI_TEST_PRINT_ASSERT(e);
713 DALI_TEST_ASSERT(e, "depth < mLayers.size()", TEST_LOCATION);
717 DALI_TEST_CHECK(asserted);
721 int UtcDaliStageGetRootLayerP(void)
723 TestApplication application;
725 Stage stage = Stage::GetCurrent();
727 Layer layer = stage.GetLayer(0);
728 DALI_TEST_CHECK(layer);
730 // Check that GetRootLayer() correctly retreived layer 0.
731 DALI_TEST_CHECK(stage.GetRootLayer() == layer);
736 int UtcDaliStageGetRootLayerN(void)
738 TestApplication application;
740 Stage stage = Stage::GetCurrent();
742 Layer rootLayer = stage.GetLayer(0);
743 DALI_TEST_CHECK(rootLayer);
744 DALI_TEST_CHECK(stage.GetRootLayer() == rootLayer);
746 // Create a new layer and attempt to lower it below the root layer.
747 Layer layer = Layer::New();
749 layer.LowerToBottom();
751 // Check that GetRootLayer still retrieves the same original layer.
752 DALI_TEST_CHECK(stage.GetRootLayer() == rootLayer);
754 // Check modifying the root layer is also blocked.
755 rootLayer.RaiseToTop();
756 DALI_TEST_CHECK(stage.GetRootLayer() == rootLayer);
761 int UtcDaliStageSetBackgroundColorP(void)
763 TestApplication application;
765 Stage stage = Stage::GetCurrent();
767 Vector4 testColor(0.1f, 0.2f, 0.3f, 1.0f);
768 stage.SetBackgroundColor(testColor);
770 DALI_TEST_EQUALS(testColor, stage.GetBackgroundColor(), TEST_LOCATION);
774 // Note: No negative test for UtcDaliStageSetBackgroundColor as we do not wish to implement
775 // range checking for colors due to speed. Colors are clamped with glclampf within GL anyway.
777 int UtcDaliStageGetBackgroundColorP(void)
779 TestApplication application;
781 Stage stage = Stage::GetCurrent();
783 DALI_TEST_EQUALS(DEFAULT_BACKGROUND_COLOR, stage.GetBackgroundColor(), TEST_LOCATION);
787 // Note: No negative test for UtcDaliStageGetBackgroundColor as this is covered by UtcDaliStageSetBackgroundColorN.
789 int UtcDaliStageKeepRenderingP(void)
791 TestApplication application;
793 Stage stage = Stage::GetCurrent();
795 // Run core until it wants to sleep
796 bool keepUpdating(true);
799 application.SendNotification();
800 keepUpdating = application.Render(1000.0f /*1 second*/);
803 // Force rendering for the next 5 seconds
804 stage.KeepRendering(5.0f);
806 application.SendNotification();
808 // Test that core wants to sleep after 10 seconds
809 keepUpdating = application.Render(1000.0f /*1 second*/);
810 DALI_TEST_CHECK(keepUpdating);
811 keepUpdating = application.Render(1000.0f /*2 seconds*/);
812 DALI_TEST_CHECK(keepUpdating);
813 keepUpdating = application.Render(1000.0f /*3 seconds*/);
814 DALI_TEST_CHECK(keepUpdating);
815 keepUpdating = application.Render(1000.0f /*4 seconds*/);
816 DALI_TEST_CHECK(keepUpdating);
817 keepUpdating = application.Render(1000.0f /*5 seconds*/);
818 DALI_TEST_CHECK(!keepUpdating);
822 int UtcDaliStageKeepRenderingN(void)
824 TestApplication application;
826 Stage stage = Stage::GetCurrent();
828 // Run core until it wants to sleep
829 bool keepUpdating(true);
832 application.SendNotification();
833 keepUpdating = application.Render(1000.0f /*1 second*/);
836 // Force rendering for the next 5 seconds
837 stage.KeepRendering(-1.0f);
839 application.SendNotification();
841 // Test that core wants to sleep after 10 seconds
842 keepUpdating = application.Render(1000.0f /*1 second*/);
843 DALI_TEST_CHECK(!keepUpdating);
848 int UtcDaliStageEventProcessingFinishedP(void)
850 TestApplication application;
851 Stage stage = Stage::GetCurrent();
853 bool eventProcessingFinished = false;
854 EventProcessingFinishedFunctor functor(eventProcessingFinished);
855 stage.EventProcessingFinishedSignal().Connect(&application, functor);
857 Actor actor(Actor::New());
860 application.SendNotification();
861 application.Render();
863 DALI_TEST_CHECK(eventProcessingFinished);
868 int UtcDaliStageEventProcessingFinishedP2(void)
870 TestApplication application;
871 Stage stage = Stage::GetCurrent();
872 tet_printf("UtcDaliStageEventProcessingFinishedSignalP2 - check event processing finished signal connection by name\n");
874 bool eventProcessingFinished = false;
875 EventProcessingFinishedFunctor functor(eventProcessingFinished);
876 GetImplementation(stage).ConnectSignal(&application, "eventProcessingFinished", functor);
878 Actor actor(Actor::New());
881 application.SendNotification();
882 application.Render();
884 DALI_TEST_CHECK(eventProcessingFinished);
889 int UtcDaliStageEventProcessingFinishedN(void)
891 TestApplication application;
892 Stage stage = Stage::GetCurrent();
894 bool eventProcessingFinished = false;
895 EventProcessingFinishedFunctor functor(eventProcessingFinished);
896 stage.EventProcessingFinishedSignal().Connect(&application, functor);
898 Actor actor(Actor::New());
901 // Do not complete event processing and confirm the signal has not been emitted.
902 DALI_TEST_CHECK(!eventProcessingFinished);
907 int UtcDaliStageKeyEventGeneratedSignalP(void)
909 TestApplication application;
910 Stage stage = Stage::GetCurrent();
912 KeyEventGeneratedSignalData data;
913 KeyEventGeneratedReceivedFunctor functor(data);
914 DevelStage::KeyEventGeneratedSignal(stage).Connect(&application, functor);
916 KeyEventGeneratedSignalData data2;
917 KeyEventGeneratedReceivedFunctor functor2(data2);
918 GetImplementation(stage).ConnectSignal(&application, "keyEventGenerated", functor2);
920 Integration::KeyEvent event("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
921 application.ProcessEvent(event);
923 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
924 DALI_TEST_CHECK(event.keyModifier == data.receivedKeyEvent.GetKeyModifier());
925 DALI_TEST_CHECK(event.keyName == data.receivedKeyEvent.GetKeyName());
926 DALI_TEST_CHECK(event.keyString == data.receivedKeyEvent.GetKeyString());
927 DALI_TEST_CHECK(event.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
931 Integration::KeyEvent event2("i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
932 application.ProcessEvent(event2);
934 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
935 DALI_TEST_CHECK(event2.keyModifier == data.receivedKeyEvent.GetKeyModifier());
936 DALI_TEST_CHECK(event2.keyName == data.receivedKeyEvent.GetKeyName());
937 DALI_TEST_CHECK(event2.keyString == data.receivedKeyEvent.GetKeyString());
938 DALI_TEST_CHECK(event2.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
942 Integration::KeyEvent event3("a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
943 application.ProcessEvent(event3);
945 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
946 DALI_TEST_CHECK(event3.keyModifier == data.receivedKeyEvent.GetKeyModifier());
947 DALI_TEST_CHECK(event3.keyName == data.receivedKeyEvent.GetKeyName());
948 DALI_TEST_CHECK(event3.keyString == data.receivedKeyEvent.GetKeyString());
949 DALI_TEST_CHECK(event3.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
953 Integration::KeyEvent event4("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
954 application.ProcessEvent(event4);
956 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
957 DALI_TEST_CHECK(event4.keyModifier == data.receivedKeyEvent.GetKeyModifier());
958 DALI_TEST_CHECK(event4.keyName == data.receivedKeyEvent.GetKeyName());
959 DALI_TEST_CHECK(event4.keyString == data.receivedKeyEvent.GetKeyString());
960 DALI_TEST_CHECK(event4.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
964 int UtcDaliStageSignalKeyEventP(void)
966 TestApplication application;
967 Stage stage = Stage::GetCurrent();
969 KeyEventSignalData data;
970 KeyEventReceivedFunctor functor(data);
971 stage.KeyEventSignal().Connect(&application, functor);
973 Integration::KeyEvent event("i", "", "i", 0, 0, 0, Integration::KeyEvent::DOWN, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
974 application.ProcessEvent(event);
976 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
977 DALI_TEST_CHECK(event.keyModifier == data.receivedKeyEvent.GetKeyModifier());
978 DALI_TEST_CHECK(event.keyName == data.receivedKeyEvent.GetKeyName());
979 DALI_TEST_CHECK(event.keyString == data.receivedKeyEvent.GetKeyString());
980 DALI_TEST_CHECK(event.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
984 Integration::KeyEvent event2("i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
985 application.ProcessEvent(event2);
987 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
988 DALI_TEST_CHECK(event2.keyModifier == data.receivedKeyEvent.GetKeyModifier());
989 DALI_TEST_CHECK(event2.keyName == data.receivedKeyEvent.GetKeyName());
990 DALI_TEST_CHECK(event2.keyString == data.receivedKeyEvent.GetKeyString());
991 DALI_TEST_CHECK(event2.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
995 Integration::KeyEvent event3("a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
996 application.ProcessEvent(event3);
998 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
999 DALI_TEST_CHECK(event3.keyModifier == data.receivedKeyEvent.GetKeyModifier());
1000 DALI_TEST_CHECK(event3.keyName == data.receivedKeyEvent.GetKeyName());
1001 DALI_TEST_CHECK(event3.keyString == data.receivedKeyEvent.GetKeyString());
1002 DALI_TEST_CHECK(event3.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
1006 Integration::KeyEvent event4("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
1007 application.ProcessEvent(event4);
1009 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1010 DALI_TEST_CHECK(event4.keyModifier == data.receivedKeyEvent.GetKeyModifier());
1011 DALI_TEST_CHECK(event4.keyName == data.receivedKeyEvent.GetKeyName());
1012 DALI_TEST_CHECK(event4.keyString == data.receivedKeyEvent.GetKeyString());
1013 DALI_TEST_CHECK(event4.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
1017 int UtcDaliStageSignalKeyEventN(void)
1019 TestApplication application;
1020 Stage stage = Stage::GetCurrent();
1022 KeyEventSignalData data;
1023 KeyEventReceivedFunctor functor(data);
1024 stage.KeyEventSignal().Connect(&application, functor);
1026 // Check that a non-pressed key events data is not modified.
1027 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1032 int UtcDaliStageTouchedSignalP(void)
1034 TestApplication application;
1035 Stage stage = Stage::GetCurrent();
1037 TouchedSignalData data;
1038 TouchFunctor functor(data);
1039 stage.TouchedSignal().Connect(&application, functor);
1041 // Render and notify.
1042 application.SendNotification();
1043 application.Render();
1045 // Basic test: No actors, single touch (down then up).
1047 GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
1049 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1050 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1051 DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
1054 GenerateTouch(application, PointState::UP, Vector2(10.0f, 10.0f));
1056 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1057 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1058 DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
1063 // Add an actor to the scene.
1064 Actor actor = Actor::New();
1065 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1066 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1067 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1068 actor.TouchedSignal().Connect(&DummyTouchCallback);
1071 // Render and notify.
1072 application.SendNotification();
1073 application.Render();
1075 // Actor on scene, single touch, down in actor, motion, then up outside actor.
1077 GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
1079 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1080 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1081 DALI_TEST_CHECK(data.receivedTouchEvent.GetHitActor(0));
1084 GenerateTouch(application, PointState::MOTION, Vector2(150.0f, 10.0f)); // Some motion
1086 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1089 GenerateTouch(application, PointState::UP, Vector2(150.0f, 10.0f)); // Some motion
1091 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1092 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1093 DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
1097 // Multiple touch. Should only receive a touch on first down and last up.
1099 Integration::TouchEvent touchEvent;
1100 Integration::Point point;
1103 point.SetState(PointState::DOWN);
1104 point.SetScreenPosition(Vector2(10.0f, 10.0f));
1105 touchEvent.points.push_back(point);
1106 application.ProcessEvent(touchEvent);
1107 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1108 DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION);
1112 touchEvent.points[0].SetState(PointState::STATIONARY);
1113 point.SetDeviceId(1);
1114 point.SetScreenPosition(Vector2(50.0f, 50.0f));
1115 touchEvent.points.push_back(point);
1116 application.ProcessEvent(touchEvent);
1117 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1118 DALI_TEST_EQUALS((bool)data.receivedTouchEvent, false, TEST_LOCATION);
1121 // Primary point is up
1122 touchEvent.points[0].SetState(PointState::UP);
1123 touchEvent.points[1].SetState(PointState::STATIONARY);
1124 application.ProcessEvent(touchEvent);
1125 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1126 DALI_TEST_EQUALS((bool)data.receivedTouchEvent, false, TEST_LOCATION);
1129 // Remove 1st point now, 2nd point is now in motion
1130 touchEvent.points.erase(touchEvent.points.begin());
1131 touchEvent.points[0].SetState(PointState::MOTION);
1132 touchEvent.points[0].SetScreenPosition(Vector2(150.0f, 50.0f));
1133 application.ProcessEvent(touchEvent);
1134 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1135 DALI_TEST_EQUALS((bool)data.receivedTouchEvent, false, TEST_LOCATION);
1139 touchEvent.points[0].SetState(PointState::UP);
1140 application.ProcessEvent(touchEvent);
1141 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1142 DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION);
1149 int UtcDaliStageTouchedSignalP2(void)
1151 TestApplication application;
1152 Stage stage = Stage::GetCurrent();
1153 tet_printf("UtcDaliStageTouchedSignalP2 - check touched signal connection by name\n");
1155 TouchedSignalData data;
1156 TouchFunctor functor(data);
1157 GetImplementation(stage).ConnectSignal(&application, "touched", functor);
1159 // Render and notify.
1160 application.SendNotification();
1161 application.Render();
1163 // Basic test: No actors, single touch (down then up).
1165 GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
1167 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1170 GenerateTouch(application, PointState::UP, Vector2(10.0f, 10.0f));
1171 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1177 int UtcDaliStageTouchedSignalN(void)
1179 TestApplication application;
1180 Stage stage = Stage::GetCurrent();
1182 TouchedSignalData data;
1183 TouchFunctor functor(data);
1184 stage.TouchedSignal().Connect(&application, functor);
1186 // Render and notify.
1187 application.SendNotification();
1188 application.Render();
1190 // Confirm functor not called before there has been any touch event.
1191 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1193 // No actors, single touch, down, motion then up.
1195 GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
1197 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1198 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1199 DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
1202 // Confirm there is no signal when the touchpoint is only moved.
1203 GenerateTouch(application, PointState::MOTION, Vector2(1200.0f, 10.0f)); // Some motion
1205 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1208 // Confirm a following up event generates a signal.
1209 GenerateTouch(application, PointState::UP, Vector2(1200.0f, 10.0f));
1211 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1212 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1213 DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
1217 // Add an actor to the scene.
1218 Actor actor = Actor::New();
1219 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1220 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1221 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1222 actor.TouchedSignal().Connect(&DummyTouchCallback);
1225 // Render and notify.
1226 application.SendNotification();
1227 application.Render();
1229 // Actor on scene. Interrupted before down and interrupted after down.
1231 GenerateTouch(application, PointState::INTERRUPTED, Vector2(10.0f, 10.0f));
1233 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1234 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1235 DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
1236 DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED);
1239 GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
1241 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1242 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1243 DALI_TEST_CHECK(data.receivedTouchEvent.GetHitActor(0) == actor);
1244 DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::DOWN);
1247 GenerateTouch(application, PointState::INTERRUPTED, Vector2(10.0f, 10.0f));
1249 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1250 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1251 DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
1252 DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED);
1254 DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION);
1256 // Check that getting info about a non-existent point causes an assert.
1257 DALI_TEST_EQUALS(data.receivedTouchEvent.GetState(1), PointState::FINISHED, TEST_LOCATION);
1265 int UtcDaliStageSignalWheelEventP(void)
1267 TestApplication application;
1268 Stage stage = Stage::GetCurrent();
1270 WheelEventSignalData data;
1271 WheelEventReceivedFunctor functor(data);
1272 stage.WheelEventSignal().Connect(&application, functor);
1274 Integration::WheelEvent event(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), 1, 1000u);
1275 application.ProcessEvent(event);
1277 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1278 DALI_TEST_CHECK(static_cast<WheelEvent::Type>(event.type) == data.receivedWheelEvent.GetType());
1279 DALI_TEST_CHECK(event.direction == data.receivedWheelEvent.GetDirection());
1280 DALI_TEST_CHECK(event.modifiers == data.receivedWheelEvent.GetModifiers());
1281 DALI_TEST_CHECK(event.point == data.receivedWheelEvent.GetPoint());
1282 DALI_TEST_CHECK(event.delta == data.receivedWheelEvent.GetDelta());
1283 DALI_TEST_CHECK(event.timeStamp == data.receivedWheelEvent.GetTime());
1287 Integration::WheelEvent event2(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), -1, 1000u);
1288 application.ProcessEvent(event2);
1290 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1291 DALI_TEST_CHECK(static_cast<WheelEvent::Type>(event2.type) == data.receivedWheelEvent.GetType());
1292 DALI_TEST_CHECK(event2.direction == data.receivedWheelEvent.GetDirection());
1293 DALI_TEST_CHECK(event2.modifiers == data.receivedWheelEvent.GetModifiers());
1294 DALI_TEST_CHECK(event2.point == data.receivedWheelEvent.GetPoint());
1295 DALI_TEST_CHECK(event2.delta == data.receivedWheelEvent.GetDelta());
1296 DALI_TEST_CHECK(event2.timeStamp == data.receivedWheelEvent.GetTime());
1301 int UtcDaliStageSignalWheelEventP2(void)
1303 TestApplication application;
1304 Stage stage = Stage::GetCurrent();
1305 tet_printf("UtcDaliStageSignalWheelEventP2 - check wheel signal connection by name\n");
1307 WheelEventSignalData data;
1308 WheelEventReceivedVoidFunctor functor(data);
1309 GetImplementation(stage).ConnectSignal(&application, "wheelEvent", functor);
1311 Integration::WheelEvent event(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), 1, 1000u);
1312 application.ProcessEvent(event);
1314 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1315 // It's meaningless, since there's no data passed to the functor :/
1319 Integration::WheelEvent event2(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), -1, 1000u);
1320 application.ProcessEvent(event2);
1322 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1326 int UtcDaliStageContextLostSignalP(void)
1328 TestApplication application;
1329 Stage stage = Stage::GetCurrent();
1331 bool contextLost = false;
1332 ContextStatusFunctor contextLostFunctor(contextLost);
1333 stage.ContextLostSignal().Connect(&application, contextLostFunctor);
1335 Integration::ContextNotifierInterface* notifier = application.GetCore().GetContextNotifier();
1336 notifier->NotifyContextLost();
1337 DALI_TEST_EQUALS(contextLost, true, TEST_LOCATION);
1342 int UtcDaliStageContextLostSignalP2(void)
1344 TestApplication application;
1345 Stage stage = Stage::GetCurrent();
1346 tet_printf("UtcDaliStageContextLostSignalP2 - check context loss signal connection by name\n");
1348 bool contextLost = false;
1349 ContextStatusFunctor contextLostFunctor(contextLost);
1350 GetImplementation(stage).ConnectSignal(&application, "contextLost", contextLostFunctor);
1352 Integration::ContextNotifierInterface* notifier = application.GetCore().GetContextNotifier();
1353 notifier->NotifyContextLost();
1354 DALI_TEST_EQUALS(contextLost, true, TEST_LOCATION);
1359 int UtcDaliStageContextLostSignalN(void)
1361 TestApplication application;
1364 // Check that connecting to the signal with a bad stage instance causes an assert.
1365 bool asserted = false;
1366 bool contextLost = false;
1367 ContextStatusFunctor contextLostFunctor(contextLost);
1370 stage.ContextLostSignal().Connect(&application, contextLostFunctor);
1372 catch(Dali::DaliException& e)
1374 DALI_TEST_PRINT_ASSERT(e);
1375 DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION);
1378 DALI_TEST_CHECK(asserted);
1383 int UtcDaliStageContextRegainedSignalP(void)
1385 TestApplication application;
1386 Stage stage = Stage::GetCurrent();
1388 bool contextRegained = false;
1389 ContextStatusFunctor contextRegainedFunctor(contextRegained);
1390 stage.ContextRegainedSignal().Connect(&application, contextRegainedFunctor);
1392 Integration::ContextNotifierInterface* notifier = application.GetCore().GetContextNotifier();
1393 notifier->NotifyContextLost();
1394 notifier->NotifyContextRegained();
1395 DALI_TEST_EQUALS(contextRegained, true, TEST_LOCATION);
1400 int UtcDaliStageContextRegainedSignalP2(void)
1402 TestApplication application;
1403 Stage stage = Stage::GetCurrent();
1404 tet_printf("UtcDaliStageContextRegainedSignalP2 - check context regained signal connection by name\n");
1406 bool contextRegained = false;
1407 ContextStatusFunctor contextRegainedFunctor(contextRegained);
1408 GetImplementation(stage).ConnectSignal(&application, "contextRegained", contextRegainedFunctor);
1410 Integration::ContextNotifierInterface* notifier = application.GetCore().GetContextNotifier();
1411 notifier->NotifyContextLost();
1412 notifier->NotifyContextRegained();
1413 DALI_TEST_EQUALS(contextRegained, true, TEST_LOCATION);
1421 int UtcDaliStageContextRegainedSignalN(void)
1423 TestApplication application;
1426 // Check that connecting to the signal with a bad stage instance causes an assert.
1427 bool asserted = false;
1428 bool contextRegained = false;
1429 ContextStatusFunctor contextRegainedFunctor(contextRegained);
1432 stage.ContextRegainedSignal().Connect(&application, contextRegainedFunctor);
1434 catch(Dali::DaliException& e)
1436 DALI_TEST_PRINT_ASSERT(e);
1437 DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION);
1440 DALI_TEST_CHECK(asserted);
1445 int UtcDaliStageSceneCreatedSignalP(void)
1447 TestApplication application;
1448 Stage stage = Stage::GetCurrent();
1450 bool signalCalled = false;
1451 SceneCreatedStatusFunctor sceneCreatedFunctor(signalCalled);
1452 stage.SceneCreatedSignal().Connect(&application, sceneCreatedFunctor);
1454 Integration::Core& core = application.GetCore();
1455 core.SceneCreated();
1456 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
1461 int UtcDaliStageSceneCreatedSignalP2(void)
1463 TestApplication application;
1464 Stage stage = Stage::GetCurrent();
1466 bool signalCalled = false;
1467 SceneCreatedStatusFunctor sceneCreatedFunctor(signalCalled);
1468 GetImplementation(stage).ConnectSignal(&application, "sceneCreated", sceneCreatedFunctor);
1470 Integration::Core& core = application.GetCore();
1471 core.SceneCreated();
1472 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
1477 int UtcDaliStageSceneCreatedSignalN(void)
1479 TestApplication application;
1482 // Check that connecting to the signal with a bad stage instance causes an assert.
1483 bool asserted = false;
1484 bool signalCalled = false;
1485 SceneCreatedStatusFunctor sceneCreatedFunctor(signalCalled);
1488 stage.SceneCreatedSignal().Connect(&application, sceneCreatedFunctor);
1490 catch(Dali::DaliException& e)
1492 DALI_TEST_PRINT_ASSERT(e);
1493 DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION);
1496 DALI_TEST_CHECK(asserted);
1501 int UtcDaliStageGetRenderTaskListP(void)
1503 TestApplication application;
1504 Stage stage = Stage::GetCurrent();
1506 // Check we get a valid instance.
1507 const RenderTaskList& tasks = stage.GetRenderTaskList();
1509 // There should be 1 task by default.
1510 DALI_TEST_EQUALS(tasks.GetTaskCount(), 1u, TEST_LOCATION);
1512 // RenderTaskList has it's own UTC tests.
1513 // But we can confirm that GetRenderTaskList in Stage retrieves the same RenderTaskList each time.
1514 RenderTask newTask = stage.GetRenderTaskList().CreateTask();
1516 DALI_TEST_EQUALS(stage.GetRenderTaskList().GetTask(1), newTask, TEST_LOCATION);
1521 int UtcDaliStageGetRenderTaskListN(void)
1523 TestApplication application;
1526 // Check that getting the render task list with a bad stage instance causes an assert.
1527 bool asserted = false;
1530 stage.GetRenderTaskList();
1532 catch(Dali::DaliException& e)
1534 DALI_TEST_PRINT_ASSERT(e);
1535 DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION);
1538 DALI_TEST_CHECK(asserted);
1543 int UtcDaliStageGetObjectRegistryP(void)
1545 TestApplication application;
1546 Stage stage = Stage::GetCurrent();
1548 ObjectRegistry objectRegistry = stage.GetObjectRegistry();
1550 // Object registry tests are covered in their own module.
1551 // However we want a basic test to confirm the returned registry is valid and works.
1552 bool verified = false;
1553 ActorCreatedFunctor test(verified);
1554 objectRegistry.ObjectCreatedSignal().Connect(&application, test);
1556 Actor actor = Actor::New();
1557 DALI_TEST_CHECK(test.mSignalVerified);
1562 int UtcDaliStageGetObjectRegistryN(void)
1564 TestApplication application;
1567 // Check that getting the object registry with a bad stage instance DOES NOT cause an assert.
1568 // This is because GetCurrent() is used, always creating a stage if one does not exist.
1569 bool asserted = false;
1572 stage.GetObjectRegistry();
1574 catch(Dali::DaliException& e)
1576 DALI_TEST_PRINT_ASSERT(e);
1579 DALI_TEST_CHECK(!asserted);
1584 int UtcDaliStageOperatorAssign(void)
1586 TestApplication application;
1588 DALI_TEST_CHECK(!stage);
1590 stage = Stage::GetCurrent();
1591 DALI_TEST_CHECK(stage);
1596 int UtcDaliStageRenderingBehavior(void)
1598 TestApplication application;
1599 Stage stage = Stage::GetCurrent();
1601 tet_infoline("Check default rendering behavior is only if required");
1602 DALI_TEST_CHECK(DevelStage::GetRenderingBehavior(stage) == DevelStage::Rendering::IF_REQUIRED);
1604 tet_infoline("No update required with an empty application");
1605 application.SendNotification();
1606 DALI_TEST_CHECK(application.UpdateOnly() == false);
1607 application.RenderOnly();
1609 tet_infoline("Change to continuous rendering, further updates should be required");
1610 DevelStage::SetRenderingBehavior(stage, DevelStage::Rendering::CONTINUOUSLY);
1612 DALI_TEST_CHECK(DevelStage::GetRenderingBehavior(stage) == DevelStage::Rendering::CONTINUOUSLY);
1614 application.SendNotification();
1615 DALI_TEST_CHECK(application.UpdateOnly() == true);
1616 application.RenderOnly();
1618 application.SendNotification();
1619 DALI_TEST_CHECK(application.UpdateOnly() == true);
1620 application.RenderOnly();
1622 tet_infoline("Change to rendering only if required, further updates should NOT be required");
1623 DevelStage::SetRenderingBehavior(stage, DevelStage::Rendering::IF_REQUIRED);
1625 DALI_TEST_CHECK(DevelStage::GetRenderingBehavior(stage) == DevelStage::Rendering::IF_REQUIRED);
1627 application.SendNotification();
1628 DALI_TEST_CHECK(application.UpdateOnly() == false);
1629 application.RenderOnly();
1631 tet_infoline("The next update is not required so TestApplication should print a warning");
1632 application.SendNotification();
1633 DALI_TEST_CHECK(application.UpdateOnly() == false);
1634 application.RenderOnly();