2 * Copyright (c) 2021 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;
245 bool DummyTouchCallback(Actor actor, const TouchEvent& touch)
250 struct ContextStatusFunctor
252 ContextStatusFunctor(bool& calledFlag)
253 : mCalledFlag(calledFlag)
270 struct SceneCreatedStatusFunctor
272 SceneCreatedStatusFunctor(bool& calledFlag)
273 : mCalledFlag(calledFlag)
290 struct ActorCreatedFunctor
292 ActorCreatedFunctor(bool& signalReceived)
293 : mSignalVerified(signalReceived)
297 void operator()(BaseHandle object)
299 tet_infoline("Verifying TestActorCallback()");
300 Actor actor = Actor::DownCast(object);
303 mSignalVerified = true;
307 bool& mSignalVerified;
310 void GenerateTouch(TestApplication& application, PointState::Type state, const Vector2& screenPosition)
312 Integration::TouchEvent touchEvent;
313 Integration::Point point;
314 point.SetState(state);
315 point.SetScreenPosition(screenPosition);
316 touchEvent.points.push_back(point);
317 application.ProcessEvent(touchEvent);
320 } // unnamed namespace
322 int UtcDaliStageDefaultConstructorP(void)
324 TestApplication application;
327 DALI_TEST_CHECK(!stage);
331 // Note: No negative test for default constructor.
333 int UtcDaliStageDestructorP(void)
335 TestApplication application;
336 Stage* stage = new Stage();
340 DALI_TEST_CHECK(true);
344 // Note: No negative test for default destructor.
346 int UtcDaliStageGetCurrentP(void)
348 TestApplication application;
349 Stage stage = Stage::GetCurrent();
351 DALI_TEST_CHECK(stage);
355 int UtcDaliStageGetCurrentN(void)
357 bool asserted = false;
360 Stage stage = Stage::GetCurrent();
362 catch(Dali::DaliException& e)
364 DALI_TEST_PRINT_ASSERT(e);
365 DALI_TEST_ASSERT(e, "stage && \"Stage doesn't exist\"", TEST_LOCATION);
369 DALI_TEST_CHECK(asserted);
373 int UtcDaliStageIsInstalledP(void)
375 TestApplication application;
379 DALI_TEST_CHECK(Stage::IsInstalled());
383 int UtcDaliStageIsInstalledN(void)
385 DALI_TEST_CHECK(!Stage::IsInstalled());
390 int UtcDaliStageCopyConstructorP(void)
392 TestApplication application;
393 Stage stage = Stage::GetCurrent();
395 Stage copyStage(stage);
397 DALI_TEST_CHECK(copyStage);
398 DALI_TEST_CHECK(copyStage.GetRootLayer() == stage.GetRootLayer());
403 // Note: no negative test for UtcDaliStageCopyConstructor.
405 int UtcDaliStageAssignmentOperatorP(void)
407 TestApplication application;
408 const Stage stage = Stage::GetCurrent();
410 Stage copyStage = stage;
412 DALI_TEST_CHECK(copyStage);
413 DALI_TEST_CHECK(copyStage.GetRootLayer() == stage.GetRootLayer());
418 // Note: No negative test for UtcDaliStageAssignmentOperator.
420 int UtcDaliStageAddP(void)
422 TestApplication application;
424 Stage stage = Stage::GetCurrent();
426 Actor actor = Actor::New();
427 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
430 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
434 int UtcDaliStageAddN(void)
436 TestApplication application;
438 Stage stage = Stage::GetCurrent();
441 bool asserted = false;
446 catch(Dali::DaliException& e)
448 DALI_TEST_PRINT_ASSERT(e);
449 DALI_TEST_ASSERT(e, "actor && \"Actor handle is empty\"", TEST_LOCATION);
453 DALI_TEST_CHECK(asserted);
458 int UtcDaliStageRemoveP(void)
460 TestApplication application;
462 Stage stage = Stage::GetCurrent();
464 Actor actor = Actor::New();
465 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
468 DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
471 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
475 int UtcDaliStageRemoveN1(void)
477 TestApplication application;
479 Stage stage = Stage::GetCurrent();
482 bool asserted = false;
485 // Actor is not valid, confirm a removal attempt does assert.
488 catch(Dali::DaliException& e)
490 DALI_TEST_PRINT_ASSERT(e);
491 DALI_TEST_ASSERT(e, "actor && \"Actor handle is empty\"", TEST_LOCATION);
495 DALI_TEST_CHECK(asserted);
499 int UtcDaliStageRemoveN2(void)
501 TestApplication application;
503 Stage stage = Stage::GetCurrent();
504 Actor actor = Actor::New();
505 DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
507 bool asserted = false;
510 // Actor is not on stage, confirm a removal attempt does not assert / segfault.
513 catch(Dali::DaliException& e)
515 DALI_TEST_PRINT_ASSERT(e);
519 DALI_TEST_CHECK(!asserted);
523 int UtcDaliStageRemoveN3(void)
525 TestApplication application;
527 Stage stage = Stage::GetCurrent();
529 // Initially we have a default layer
530 DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION);
532 // Check we cannot remove the root layer from the stage.
533 Layer layer = stage.GetRootLayer();
534 bool asserted = true;
539 catch(Dali::DaliException& e)
541 DALI_TEST_PRINT_ASSERT(e);
542 DALI_TEST_ASSERT(e, "this != &child && \"Cannot remove actor from itself\"", TEST_LOCATION);
546 DALI_TEST_CHECK(asserted);
547 DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION);
551 int UtcDaliStageGetSizeP(void)
553 TestApplication application;
555 Stage stage = Stage::GetCurrent();
557 Vector2 size = stage.GetSize();
559 DALI_TEST_EQUALS(size.width, static_cast<float>(TestApplication::DEFAULT_SURFACE_WIDTH), TEST_LOCATION);
560 DALI_TEST_EQUALS(size.height, static_cast<float>(TestApplication::DEFAULT_SURFACE_HEIGHT), TEST_LOCATION);
564 int UtcDaliStageGetSizeN(void)
566 TestApplication application;
570 bool asserted = false;
574 size = stage.GetSize();
576 catch(Dali::DaliException& e)
578 DALI_TEST_PRINT_ASSERT(e);
579 DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION);
583 DALI_TEST_CHECK(asserted);
587 int UtcDaliStageGetDpiP1(void)
589 TestApplication application; // Initializes core DPI to default values
591 Stage stage = Stage::GetCurrent();
593 // Test the default DPI.
594 Vector2 dpi = stage.GetDpi();
595 DALI_TEST_EQUALS(dpi.x, static_cast<float>(TestApplication::DEFAULT_HORIZONTAL_DPI), TEST_LOCATION);
596 DALI_TEST_EQUALS(dpi.y, static_cast<float>(TestApplication::DEFAULT_VERTICAL_DPI), TEST_LOCATION);
600 int UtcDaliStageGetDpiP2(void)
602 TestApplication application; // Initializes core DPI to default values
604 // Test that setting core DPI explicitly also sets up the Stage's DPI.
605 Dali::Integration::Scene scene = application.GetScene();
606 scene.SetDpi(Vector2(200.0f, 180.0f));
608 Stage stage = Stage::GetCurrent();
609 Vector2 dpi = stage.GetDpi();
610 DALI_TEST_EQUALS(dpi.x, 200.0f, TEST_LOCATION);
611 DALI_TEST_EQUALS(dpi.y, 180.0f, TEST_LOCATION);
615 int UtcDaliStageGetDpiP3(void)
617 TestApplication application(480, 800, 72, 120); // Initializes core DPI with specific values
619 Stage stage = Stage::GetCurrent();
621 // Test that setting core DPI explicitly also sets up the Stage's DPI.
622 Vector2 dpi = stage.GetDpi();
623 DALI_TEST_EQUALS(dpi.x, 72.0f, TEST_LOCATION);
624 DALI_TEST_EQUALS(dpi.y, 120.0f, TEST_LOCATION);
629 * This is not a true negative test, we are checking the DPI if it has not been set.
630 * A test for setting negative DPI values would be part of the application core utc tests.
632 int UtcDaliStageGetDpiN(void)
634 TestApplication application; // Initializes core DPI to default values
636 Stage stage = Stage::GetCurrent();
637 Vector2 dpi = stage.GetDpi();
639 DALI_TEST_EQUALS(dpi.x, 220.0f, TEST_LOCATION);
640 DALI_TEST_EQUALS(dpi.y, 217.0f, TEST_LOCATION);
644 int UtcDaliStageGetLayerCountP(void)
646 TestApplication application;
648 Stage stage = Stage::GetCurrent();
650 // Initially we have a default layer
651 DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION);
653 Layer layer = Layer::New();
656 DALI_TEST_EQUALS(stage.GetLayerCount(), 2u, TEST_LOCATION);
661 * Not a true negative test, but confirms layer count is not affected by an invalid removal.
663 int UtcDaliStageGetLayerCountN(void)
665 TestApplication application;
667 Stage stage = Stage::GetCurrent();
669 // Initially we have a default layer
670 DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION);
672 Layer layer = Layer::New();
675 // Still have 1 layer.
676 DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION);
680 int UtcDaliStageGetLayerP(void)
682 TestApplication application;
684 Stage stage = Stage::GetCurrent();
686 Layer rootLayer = stage.GetLayer(0);
687 DALI_TEST_CHECK(rootLayer);
689 Layer layer = Layer::New();
692 Layer sameLayer = stage.GetLayer(1);
693 DALI_TEST_CHECK(layer == sameLayer);
697 int UtcDaliStageGetLayerN(void)
699 TestApplication application;
701 Stage stage = Stage::GetCurrent();
703 bool asserted = false;
706 // Try to get a layer that doesn't exist (note: 0 is the root layer).
707 Layer layer = stage.GetLayer(1);
709 catch(Dali::DaliException& e)
711 DALI_TEST_PRINT_ASSERT(e);
712 DALI_TEST_ASSERT(e, "depth < mLayers.size()", TEST_LOCATION);
716 DALI_TEST_CHECK(asserted);
720 int UtcDaliStageGetRootLayerP(void)
722 TestApplication application;
724 Stage stage = Stage::GetCurrent();
726 Layer layer = stage.GetLayer(0);
727 DALI_TEST_CHECK(layer);
729 // Check that GetRootLayer() correctly retreived layer 0.
730 DALI_TEST_CHECK(stage.GetRootLayer() == layer);
735 int UtcDaliStageGetRootLayerN(void)
737 TestApplication application;
739 Stage stage = Stage::GetCurrent();
741 Layer rootLayer = stage.GetLayer(0);
742 DALI_TEST_CHECK(rootLayer);
743 DALI_TEST_CHECK(stage.GetRootLayer() == rootLayer);
745 // Create a new layer and attempt to lower it below the root layer.
746 Layer layer = Layer::New();
748 layer.LowerToBottom();
750 // Check that GetRootLayer still retrieves the same original layer.
751 DALI_TEST_CHECK(stage.GetRootLayer() == rootLayer);
753 // Check modifying the root layer is also blocked.
754 rootLayer.RaiseToTop();
755 DALI_TEST_CHECK(stage.GetRootLayer() == rootLayer);
760 int UtcDaliStageSetBackgroundColorP(void)
762 TestApplication application;
764 Stage stage = Stage::GetCurrent();
766 Vector4 testColor(0.1f, 0.2f, 0.3f, 1.0f);
767 stage.SetBackgroundColor(testColor);
769 DALI_TEST_EQUALS(testColor, stage.GetBackgroundColor(), TEST_LOCATION);
773 // Note: No negative test for UtcDaliStageSetBackgroundColor as we do not wish to implement
774 // range checking for colors due to speed. Colors are clamped with glclampf within GL anyway.
776 int UtcDaliStageGetBackgroundColorP(void)
778 TestApplication application;
780 Stage stage = Stage::GetCurrent();
782 DALI_TEST_EQUALS(DEFAULT_BACKGROUND_COLOR, stage.GetBackgroundColor(), TEST_LOCATION);
786 // Note: No negative test for UtcDaliStageGetBackgroundColor as this is covered by UtcDaliStageSetBackgroundColorN.
788 int UtcDaliStageKeepRenderingP(void)
790 TestApplication application;
792 Stage stage = Stage::GetCurrent();
794 // Run core until it wants to sleep
795 bool keepUpdating(true);
798 application.SendNotification();
799 keepUpdating = application.Render(1000.0f /*1 second*/);
802 // Force rendering for the next 5 seconds
803 stage.KeepRendering(5.0f);
805 application.SendNotification();
807 // Test that core wants to sleep after 10 seconds
808 keepUpdating = application.Render(1000.0f /*1 second*/);
809 DALI_TEST_CHECK(keepUpdating);
810 keepUpdating = application.Render(1000.0f /*2 seconds*/);
811 DALI_TEST_CHECK(keepUpdating);
812 keepUpdating = application.Render(1000.0f /*3 seconds*/);
813 DALI_TEST_CHECK(keepUpdating);
814 keepUpdating = application.Render(1000.0f /*4 seconds*/);
815 DALI_TEST_CHECK(keepUpdating);
816 keepUpdating = application.Render(1000.0f /*5 seconds*/);
817 DALI_TEST_CHECK(!keepUpdating);
821 int UtcDaliStageKeepRenderingN(void)
823 TestApplication application;
825 Stage stage = Stage::GetCurrent();
827 // Run core until it wants to sleep
828 bool keepUpdating(true);
831 application.SendNotification();
832 keepUpdating = application.Render(1000.0f /*1 second*/);
835 // Force rendering for the next 5 seconds
836 stage.KeepRendering(-1.0f);
838 application.SendNotification();
840 // Test that core wants to sleep after 10 seconds
841 keepUpdating = application.Render(1000.0f /*1 second*/);
842 DALI_TEST_CHECK(!keepUpdating);
847 int UtcDaliStageEventProcessingFinishedP(void)
849 TestApplication application;
850 Stage stage = Stage::GetCurrent();
852 bool eventProcessingFinished = false;
853 EventProcessingFinishedFunctor functor(eventProcessingFinished);
854 stage.EventProcessingFinishedSignal().Connect(&application, functor);
856 Actor actor(Actor::New());
859 application.SendNotification();
860 application.Render();
862 DALI_TEST_CHECK(eventProcessingFinished);
867 int UtcDaliStageEventProcessingFinishedP2(void)
869 TestApplication application;
870 Stage stage = Stage::GetCurrent();
871 tet_printf("UtcDaliStageEventProcessingFinishedSignalP2 - check event processing finished signal connection by name\n");
873 bool eventProcessingFinished = false;
874 EventProcessingFinishedFunctor functor(eventProcessingFinished);
875 GetImplementation(stage).ConnectSignal(&application, "eventProcessingFinished", functor);
877 Actor actor(Actor::New());
880 application.SendNotification();
881 application.Render();
883 DALI_TEST_CHECK(eventProcessingFinished);
888 int UtcDaliStageEventProcessingFinishedN(void)
890 TestApplication application;
891 Stage stage = Stage::GetCurrent();
893 bool eventProcessingFinished = false;
894 EventProcessingFinishedFunctor functor(eventProcessingFinished);
895 stage.EventProcessingFinishedSignal().Connect(&application, functor);
897 Actor actor(Actor::New());
900 // Do not complete event processing and confirm the signal has not been emitted.
901 DALI_TEST_CHECK(!eventProcessingFinished);
906 int UtcDaliStageKeyEventGeneratedSignalP(void)
908 TestApplication application;
909 Stage stage = Stage::GetCurrent();
911 KeyEventGeneratedSignalData data;
912 KeyEventGeneratedReceivedFunctor functor(data);
913 DevelStage::KeyEventGeneratedSignal(stage).Connect(&application, functor);
915 KeyEventGeneratedSignalData data2;
916 KeyEventGeneratedReceivedFunctor functor2(data2);
917 GetImplementation(stage).ConnectSignal(&application, "keyEventGenerated", functor2);
919 Integration::KeyEvent event("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
920 application.ProcessEvent(event);
922 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
923 DALI_TEST_CHECK(event.keyModifier == data.receivedKeyEvent.GetKeyModifier());
924 DALI_TEST_CHECK(event.keyName == data.receivedKeyEvent.GetKeyName());
925 DALI_TEST_CHECK(event.keyString == data.receivedKeyEvent.GetKeyString());
926 DALI_TEST_CHECK(event.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
930 Integration::KeyEvent event2("i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
931 application.ProcessEvent(event2);
933 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
934 DALI_TEST_CHECK(event2.keyModifier == data.receivedKeyEvent.GetKeyModifier());
935 DALI_TEST_CHECK(event2.keyName == data.receivedKeyEvent.GetKeyName());
936 DALI_TEST_CHECK(event2.keyString == data.receivedKeyEvent.GetKeyString());
937 DALI_TEST_CHECK(event2.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
941 Integration::KeyEvent event3("a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
942 application.ProcessEvent(event3);
944 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
945 DALI_TEST_CHECK(event3.keyModifier == data.receivedKeyEvent.GetKeyModifier());
946 DALI_TEST_CHECK(event3.keyName == data.receivedKeyEvent.GetKeyName());
947 DALI_TEST_CHECK(event3.keyString == data.receivedKeyEvent.GetKeyString());
948 DALI_TEST_CHECK(event3.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
952 Integration::KeyEvent event4("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
953 application.ProcessEvent(event4);
955 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
956 DALI_TEST_CHECK(event4.keyModifier == data.receivedKeyEvent.GetKeyModifier());
957 DALI_TEST_CHECK(event4.keyName == data.receivedKeyEvent.GetKeyName());
958 DALI_TEST_CHECK(event4.keyString == data.receivedKeyEvent.GetKeyString());
959 DALI_TEST_CHECK(event4.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
963 int UtcDaliStageSignalKeyEventP(void)
965 TestApplication application;
966 Stage stage = Stage::GetCurrent();
968 KeyEventSignalData data;
969 KeyEventReceivedFunctor functor(data);
970 stage.KeyEventSignal().Connect(&application, functor);
972 Integration::KeyEvent event("i", "", "i", 0, 0, 0, Integration::KeyEvent::DOWN, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
973 application.ProcessEvent(event);
975 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
976 DALI_TEST_CHECK(event.keyModifier == data.receivedKeyEvent.GetKeyModifier());
977 DALI_TEST_CHECK(event.keyName == data.receivedKeyEvent.GetKeyName());
978 DALI_TEST_CHECK(event.keyString == data.receivedKeyEvent.GetKeyString());
979 DALI_TEST_CHECK(event.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
983 Integration::KeyEvent event2("i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
984 application.ProcessEvent(event2);
986 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
987 DALI_TEST_CHECK(event2.keyModifier == data.receivedKeyEvent.GetKeyModifier());
988 DALI_TEST_CHECK(event2.keyName == data.receivedKeyEvent.GetKeyName());
989 DALI_TEST_CHECK(event2.keyString == data.receivedKeyEvent.GetKeyString());
990 DALI_TEST_CHECK(event2.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
994 Integration::KeyEvent event3("a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
995 application.ProcessEvent(event3);
997 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
998 DALI_TEST_CHECK(event3.keyModifier == data.receivedKeyEvent.GetKeyModifier());
999 DALI_TEST_CHECK(event3.keyName == data.receivedKeyEvent.GetKeyName());
1000 DALI_TEST_CHECK(event3.keyString == data.receivedKeyEvent.GetKeyString());
1001 DALI_TEST_CHECK(event3.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
1005 Integration::KeyEvent event4("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
1006 application.ProcessEvent(event4);
1008 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1009 DALI_TEST_CHECK(event4.keyModifier == data.receivedKeyEvent.GetKeyModifier());
1010 DALI_TEST_CHECK(event4.keyName == data.receivedKeyEvent.GetKeyName());
1011 DALI_TEST_CHECK(event4.keyString == data.receivedKeyEvent.GetKeyString());
1012 DALI_TEST_CHECK(event4.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
1016 int UtcDaliStageSignalKeyEventN(void)
1018 TestApplication application;
1019 Stage stage = Stage::GetCurrent();
1021 KeyEventSignalData data;
1022 KeyEventReceivedFunctor functor(data);
1023 stage.KeyEventSignal().Connect(&application, functor);
1025 // Check that a non-pressed key events data is not modified.
1026 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1031 int UtcDaliStageTouchedSignalP(void)
1033 TestApplication application;
1034 Stage stage = Stage::GetCurrent();
1036 TouchedSignalData data;
1037 TouchFunctor functor(data);
1038 stage.TouchedSignal().Connect(&application, functor);
1040 // Render and notify.
1041 application.SendNotification();
1042 application.Render();
1044 // Basic test: No actors, single touch (down then up).
1046 GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
1048 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1049 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1050 DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
1053 GenerateTouch(application, PointState::UP, Vector2(10.0f, 10.0f));
1055 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1056 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1057 DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
1062 // Add an actor to the scene.
1063 Actor actor = Actor::New();
1064 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1065 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1066 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1067 actor.TouchedSignal().Connect(&DummyTouchCallback);
1070 // Render and notify.
1071 application.SendNotification();
1072 application.Render();
1074 // Actor on scene, single touch, down in actor, motion, then up outside actor.
1076 GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
1078 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1079 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1080 DALI_TEST_CHECK(data.receivedTouchEvent.GetHitActor(0));
1083 GenerateTouch(application, PointState::MOTION, Vector2(150.0f, 10.0f)); // Some motion
1085 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1088 GenerateTouch(application, PointState::UP, Vector2(150.0f, 10.0f)); // Some motion
1090 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1091 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1092 DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
1096 // Multiple touch. Should only receive a touch on first down and last up.
1098 Integration::TouchEvent touchEvent;
1099 Integration::Point point;
1102 point.SetState(PointState::DOWN);
1103 point.SetScreenPosition(Vector2(10.0f, 10.0f));
1104 touchEvent.points.push_back(point);
1105 application.ProcessEvent(touchEvent);
1106 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1107 DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION);
1111 touchEvent.points[0].SetState(PointState::STATIONARY);
1112 point.SetDeviceId(1);
1113 point.SetScreenPosition(Vector2(50.0f, 50.0f));
1114 touchEvent.points.push_back(point);
1115 application.ProcessEvent(touchEvent);
1116 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1117 DALI_TEST_EQUALS((bool)data.receivedTouchEvent, false, TEST_LOCATION);
1120 // Primary point is up
1121 touchEvent.points[0].SetState(PointState::UP);
1122 touchEvent.points[1].SetState(PointState::STATIONARY);
1123 application.ProcessEvent(touchEvent);
1124 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1125 DALI_TEST_EQUALS((bool)data.receivedTouchEvent, false, TEST_LOCATION);
1128 // Remove 1st point now, 2nd point is now in motion
1129 touchEvent.points.erase(touchEvent.points.begin());
1130 touchEvent.points[0].SetState(PointState::MOTION);
1131 touchEvent.points[0].SetScreenPosition(Vector2(150.0f, 50.0f));
1132 application.ProcessEvent(touchEvent);
1133 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1134 DALI_TEST_EQUALS((bool)data.receivedTouchEvent, false, TEST_LOCATION);
1138 touchEvent.points[0].SetState(PointState::UP);
1139 application.ProcessEvent(touchEvent);
1140 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1141 DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION);
1147 int UtcDaliStageTouchedSignalP2(void)
1149 TestApplication application;
1150 Stage stage = Stage::GetCurrent();
1151 tet_printf("UtcDaliStageTouchedSignalP2 - check touched signal connection by name\n");
1153 TouchedSignalData data;
1154 TouchFunctor functor(data);
1155 GetImplementation(stage).ConnectSignal(&application, "touched", functor);
1157 // Render and notify.
1158 application.SendNotification();
1159 application.Render();
1161 // Basic test: No actors, single touch (down then up).
1163 GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
1165 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1168 GenerateTouch(application, PointState::UP, Vector2(10.0f, 10.0f));
1169 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1175 int UtcDaliStageTouchedSignalN(void)
1177 TestApplication application;
1178 Stage stage = Stage::GetCurrent();
1180 TouchedSignalData data;
1181 TouchFunctor functor(data);
1182 stage.TouchedSignal().Connect(&application, functor);
1184 // Render and notify.
1185 application.SendNotification();
1186 application.Render();
1188 // Confirm functor not called before there has been any touch event.
1189 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1191 // No actors, single touch, down, motion then up.
1193 GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
1195 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1196 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1197 DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
1200 // Confirm there is no signal when the touchpoint is only moved.
1201 GenerateTouch(application, PointState::MOTION, Vector2(1200.0f, 10.0f)); // Some motion
1203 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1206 // Confirm a following up event generates a signal.
1207 GenerateTouch(application, PointState::UP, Vector2(1200.0f, 10.0f));
1209 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1210 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1211 DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
1215 // Add an actor to the scene.
1216 Actor actor = Actor::New();
1217 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1218 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1219 actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1220 actor.TouchedSignal().Connect(&DummyTouchCallback);
1223 // Render and notify.
1224 application.SendNotification();
1225 application.Render();
1227 // Actor on scene. Interrupted before down and interrupted after down.
1229 GenerateTouch(application, PointState::INTERRUPTED, Vector2(10.0f, 10.0f));
1231 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1232 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1233 DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
1234 DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED);
1237 GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
1239 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1240 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1241 DALI_TEST_CHECK(data.receivedTouchEvent.GetHitActor(0) == actor);
1242 DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::DOWN);
1245 GenerateTouch(application, PointState::INTERRUPTED, Vector2(10.0f, 10.0f));
1247 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1248 DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
1249 DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
1250 DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED);
1252 DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION);
1254 // Check that getting info about a non-existent point causes an assert.
1255 DALI_TEST_EQUALS(data.receivedTouchEvent.GetState(1), PointState::FINISHED, TEST_LOCATION);
1263 int UtcDaliStageSignalWheelEventP(void)
1265 TestApplication application;
1266 Stage stage = Stage::GetCurrent();
1268 WheelEventSignalData data;
1269 WheelEventReceivedFunctor functor(data);
1270 stage.WheelEventSignal().Connect(&application, functor);
1272 Integration::WheelEvent event(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), 1, 1000u);
1273 application.ProcessEvent(event);
1275 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1276 DALI_TEST_CHECK(static_cast<WheelEvent::Type>(event.type) == data.receivedWheelEvent.GetType());
1277 DALI_TEST_CHECK(event.direction == data.receivedWheelEvent.GetDirection());
1278 DALI_TEST_CHECK(event.modifiers == data.receivedWheelEvent.GetModifiers());
1279 DALI_TEST_CHECK(event.point == data.receivedWheelEvent.GetPoint());
1280 DALI_TEST_CHECK(event.delta == data.receivedWheelEvent.GetDelta());
1281 DALI_TEST_CHECK(event.timeStamp == data.receivedWheelEvent.GetTime());
1285 Integration::WheelEvent event2(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), -1, 1000u);
1286 application.ProcessEvent(event2);
1288 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1289 DALI_TEST_CHECK(static_cast<WheelEvent::Type>(event2.type) == data.receivedWheelEvent.GetType());
1290 DALI_TEST_CHECK(event2.direction == data.receivedWheelEvent.GetDirection());
1291 DALI_TEST_CHECK(event2.modifiers == data.receivedWheelEvent.GetModifiers());
1292 DALI_TEST_CHECK(event2.point == data.receivedWheelEvent.GetPoint());
1293 DALI_TEST_CHECK(event2.delta == data.receivedWheelEvent.GetDelta());
1294 DALI_TEST_CHECK(event2.timeStamp == data.receivedWheelEvent.GetTime());
1298 int UtcDaliStageSignalWheelEventP2(void)
1300 TestApplication application;
1301 Stage stage = Stage::GetCurrent();
1302 tet_printf("UtcDaliStageSignalWheelEventP2 - check wheel signal connection by name\n");
1304 WheelEventSignalData data;
1305 WheelEventReceivedVoidFunctor functor(data);
1306 GetImplementation(stage).ConnectSignal(&application, "wheelEvent", functor);
1308 Integration::WheelEvent event(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), 1, 1000u);
1309 application.ProcessEvent(event);
1311 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1312 // It's meaningless, since there's no data passed to the functor :/
1316 Integration::WheelEvent event2(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), -1, 1000u);
1317 application.ProcessEvent(event2);
1319 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1323 int UtcDaliStageContextLostSignalP(void)
1325 TestApplication application;
1326 Stage stage = Stage::GetCurrent();
1328 bool contextLost = false;
1329 ContextStatusFunctor contextLostFunctor(contextLost);
1330 stage.ContextLostSignal().Connect(&application, contextLostFunctor);
1332 Integration::ContextNotifierInterface* notifier = application.GetCore().GetContextNotifier();
1333 notifier->NotifyContextLost();
1334 DALI_TEST_EQUALS(contextLost, true, TEST_LOCATION);
1339 int UtcDaliStageContextLostSignalP2(void)
1341 TestApplication application;
1342 Stage stage = Stage::GetCurrent();
1343 tet_printf("UtcDaliStageContextLostSignalP2 - check context loss signal connection by name\n");
1345 bool contextLost = false;
1346 ContextStatusFunctor contextLostFunctor(contextLost);
1347 GetImplementation(stage).ConnectSignal(&application, "contextLost", contextLostFunctor);
1349 Integration::ContextNotifierInterface* notifier = application.GetCore().GetContextNotifier();
1350 notifier->NotifyContextLost();
1351 DALI_TEST_EQUALS(contextLost, true, TEST_LOCATION);
1356 int UtcDaliStageContextLostSignalN(void)
1358 TestApplication application;
1361 // Check that connecting to the signal with a bad stage instance causes an assert.
1362 bool asserted = false;
1363 bool contextLost = false;
1364 ContextStatusFunctor contextLostFunctor(contextLost);
1367 stage.ContextLostSignal().Connect(&application, contextLostFunctor);
1369 catch(Dali::DaliException& e)
1371 DALI_TEST_PRINT_ASSERT(e);
1372 DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION);
1375 DALI_TEST_CHECK(asserted);
1380 int UtcDaliStageContextRegainedSignalP(void)
1382 TestApplication application;
1383 Stage stage = Stage::GetCurrent();
1385 bool contextRegained = false;
1386 ContextStatusFunctor contextRegainedFunctor(contextRegained);
1387 stage.ContextRegainedSignal().Connect(&application, contextRegainedFunctor);
1389 Integration::ContextNotifierInterface* notifier = application.GetCore().GetContextNotifier();
1390 notifier->NotifyContextLost();
1391 notifier->NotifyContextRegained();
1392 DALI_TEST_EQUALS(contextRegained, true, TEST_LOCATION);
1397 int UtcDaliStageContextRegainedSignalP2(void)
1399 TestApplication application;
1400 Stage stage = Stage::GetCurrent();
1401 tet_printf("UtcDaliStageContextRegainedSignalP2 - check context regained signal connection by name\n");
1403 bool contextRegained = false;
1404 ContextStatusFunctor contextRegainedFunctor(contextRegained);
1405 GetImplementation(stage).ConnectSignal(&application, "contextRegained", contextRegainedFunctor);
1407 Integration::ContextNotifierInterface* notifier = application.GetCore().GetContextNotifier();
1408 notifier->NotifyContextLost();
1409 notifier->NotifyContextRegained();
1410 DALI_TEST_EQUALS(contextRegained, true, TEST_LOCATION);
1415 int UtcDaliStageContextRegainedSignalN(void)
1417 TestApplication application;
1420 // Check that connecting to the signal with a bad stage instance causes an assert.
1421 bool asserted = false;
1422 bool contextRegained = false;
1423 ContextStatusFunctor contextRegainedFunctor(contextRegained);
1426 stage.ContextRegainedSignal().Connect(&application, contextRegainedFunctor);
1428 catch(Dali::DaliException& e)
1430 DALI_TEST_PRINT_ASSERT(e);
1431 DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION);
1434 DALI_TEST_CHECK(asserted);
1439 int UtcDaliStageSceneCreatedSignalP(void)
1441 TestApplication application;
1442 Stage stage = Stage::GetCurrent();
1444 bool signalCalled = false;
1445 SceneCreatedStatusFunctor sceneCreatedFunctor(signalCalled);
1446 stage.SceneCreatedSignal().Connect(&application, sceneCreatedFunctor);
1448 Integration::Core& core = application.GetCore();
1449 core.SceneCreated();
1450 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
1455 int UtcDaliStageSceneCreatedSignalP2(void)
1457 TestApplication application;
1458 Stage stage = Stage::GetCurrent();
1460 bool signalCalled = false;
1461 SceneCreatedStatusFunctor sceneCreatedFunctor(signalCalled);
1462 GetImplementation(stage).ConnectSignal(&application, "sceneCreated", sceneCreatedFunctor);
1464 Integration::Core& core = application.GetCore();
1465 core.SceneCreated();
1466 DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
1471 int UtcDaliStageSceneCreatedSignalN(void)
1473 TestApplication application;
1476 // Check that connecting to the signal with a bad stage instance causes an assert.
1477 bool asserted = false;
1478 bool signalCalled = false;
1479 SceneCreatedStatusFunctor sceneCreatedFunctor(signalCalled);
1482 stage.SceneCreatedSignal().Connect(&application, sceneCreatedFunctor);
1484 catch(Dali::DaliException& e)
1486 DALI_TEST_PRINT_ASSERT(e);
1487 DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION);
1490 DALI_TEST_CHECK(asserted);
1495 int UtcDaliStageGetRenderTaskListP(void)
1497 TestApplication application;
1498 Stage stage = Stage::GetCurrent();
1500 // Check we get a valid instance.
1501 const RenderTaskList& tasks = stage.GetRenderTaskList();
1503 // There should be 1 task by default.
1504 DALI_TEST_EQUALS(tasks.GetTaskCount(), 1u, TEST_LOCATION);
1506 // RenderTaskList has it's own UTC tests.
1507 // But we can confirm that GetRenderTaskList in Stage retrieves the same RenderTaskList each time.
1508 RenderTask newTask = stage.GetRenderTaskList().CreateTask();
1510 DALI_TEST_EQUALS(stage.GetRenderTaskList().GetTask(1), newTask, TEST_LOCATION);
1515 int UtcDaliStageGetRenderTaskListN(void)
1517 TestApplication application;
1520 // Check that getting the render task list with a bad stage instance causes an assert.
1521 bool asserted = false;
1524 stage.GetRenderTaskList();
1526 catch(Dali::DaliException& e)
1528 DALI_TEST_PRINT_ASSERT(e);
1529 DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION);
1532 DALI_TEST_CHECK(asserted);
1537 int UtcDaliStageGetObjectRegistryP(void)
1539 TestApplication application;
1540 Stage stage = Stage::GetCurrent();
1542 ObjectRegistry objectRegistry = stage.GetObjectRegistry();
1544 // Object registry tests are covered in their own module.
1545 // However we want a basic test to confirm the returned registry is valid and works.
1546 bool verified = false;
1547 ActorCreatedFunctor test(verified);
1548 objectRegistry.ObjectCreatedSignal().Connect(&application, test);
1550 Actor actor = Actor::New();
1551 DALI_TEST_CHECK(test.mSignalVerified);
1556 int UtcDaliStageGetObjectRegistryN(void)
1558 TestApplication application;
1561 // Check that getting the object registry with a bad stage instance DOES NOT cause an assert.
1562 // This is because GetCurrent() is used, always creating a stage if one does not exist.
1563 bool asserted = false;
1566 stage.GetObjectRegistry();
1568 catch(Dali::DaliException& e)
1570 DALI_TEST_PRINT_ASSERT(e);
1573 DALI_TEST_CHECK(!asserted);
1578 int UtcDaliStageOperatorAssign(void)
1580 TestApplication application;
1582 DALI_TEST_CHECK(!stage);
1584 stage = Stage::GetCurrent();
1585 DALI_TEST_CHECK(stage);
1590 int UtcDaliStageRenderingBehavior(void)
1592 TestApplication application;
1593 Stage stage = Stage::GetCurrent();
1595 tet_infoline("Check default rendering behavior is only if required");
1596 DALI_TEST_CHECK(DevelStage::GetRenderingBehavior(stage) == DevelStage::Rendering::IF_REQUIRED);
1598 tet_infoline("No update required with an empty application");
1599 application.SendNotification();
1600 DALI_TEST_CHECK(application.UpdateOnly() == false);
1601 application.RenderOnly();
1603 tet_infoline("Change to continuous rendering, further updates should be required");
1604 DevelStage::SetRenderingBehavior(stage, DevelStage::Rendering::CONTINUOUSLY);
1606 DALI_TEST_CHECK(DevelStage::GetRenderingBehavior(stage) == DevelStage::Rendering::CONTINUOUSLY);
1608 application.SendNotification();
1609 DALI_TEST_CHECK(application.UpdateOnly() == true);
1610 application.RenderOnly();
1612 application.SendNotification();
1613 DALI_TEST_CHECK(application.UpdateOnly() == true);
1614 application.RenderOnly();
1616 tet_infoline("Change to rendering only if required, further updates should NOT be required");
1617 DevelStage::SetRenderingBehavior(stage, DevelStage::Rendering::IF_REQUIRED);
1619 DALI_TEST_CHECK(DevelStage::GetRenderingBehavior(stage) == DevelStage::Rendering::IF_REQUIRED);
1621 application.SendNotification();
1622 DALI_TEST_CHECK(application.UpdateOnly() == false);
1623 application.RenderOnly();
1625 tet_infoline("The next update is not required so TestApplication should print a warning");
1626 application.SendNotification();
1627 DALI_TEST_CHECK(application.UpdateOnly() == false);
1628 application.RenderOnly();