END_TEST;
}
-int UtcDaliLayerRaise(void)
+int UtcDaliLayerRaise1(void)
{
tet_infoline("Testing Dali::Layer::Raise()");
TestApplication application;
END_TEST;
}
-int UtcDaliLayerLower(void)
+int UtcDaliLayerRaise2(void)
+{
+ tet_infoline("Testing Dali::Layer raise Action");
+ TestApplication application;
+ Layer layer1 = Layer::New();
+ Layer layer2 = Layer::New();
+
+ application.GetScene().Add(layer1);
+ application.GetScene().Add(layer2);
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+
+ layer1.Raise();
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+
+ // get root
+ Layer root = application.GetScene().GetLayer(0);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+
+ GetImplementation(root).DoAction("raise", Property::Map());
+
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ END_TEST;
+}
+
+
+int UtcDaliLayerLower1(void)
{
tet_infoline("Testing Dali::Layer::Lower()");
TestApplication application;
END_TEST;
}
-int UtcDaliLayerRaiseToTop(void)
+
+int UtcDaliLayerLower2(void)
+{
+ tet_infoline("Testing Dali::Layer lower Action");
+ TestApplication application;
+ Layer layer1 = Layer::New();
+ Layer layer2 = Layer::New();
+
+ application.GetScene().Add(layer1);
+ application.GetScene().Add(layer2);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+
+ layer2.Lower();
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+
+ // get root
+ Layer root = application.GetScene().GetLayer(0);
+ GetImplementation(root).DoAction("lower", Property::Map());
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+
+ GetImplementation(layer2).DoAction("lower", Property::Map());
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliLayerRaiseToTop1(void)
{
tet_infoline("Testing Dali::Layer::RaiseToTop()");
TestApplication application;
END_TEST;
}
-int UtcDaliLayerLowerToBottom(void)
+int UtcDaliLayerRaiseToTop2(void)
+{
+ tet_infoline("Testing Dali::Layer raiseToTop Action");
+ TestApplication application;
+ Layer layer1 = Layer::New();
+ Layer layer2 = Layer::New();
+ Layer layer3 = Layer::New();
+
+ application.GetScene().Add(layer1);
+ application.GetScene().Add(layer2);
+ application.GetScene().Add(layer3);
+ Layer root = application.GetScene().GetLayer(0);
+
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer3.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
+
+ GetImplementation(layer1).DoAction("raiseToTop", Property::Map());
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
+
+ GetImplementation(root).DoAction("raiseToTop", Property::Map());
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliLayerLowerToBottom1(void)
{
tet_infoline("Testing Dali::Layer::LowerToBottom()");
TestApplication application;
END_TEST;
}
+int UtcDaliLayerLowerToBottom2(void)
+{
+ tet_infoline("Testing Dali::Layer lowerToBottom Action");
+ TestApplication application;
+ Layer layer1 = Layer::New();
+ Layer layer2 = Layer::New();
+ Layer layer3 = Layer::New();
+
+ application.GetScene().Add(layer1);
+ application.GetScene().Add(layer2);
+ application.GetScene().Add(layer3);
+
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer3.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
+
+ GetImplementation(layer3).DoAction("lowerToBottom", Property::Map());
+ DALI_TEST_EQUALS(layer3.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ END_TEST;
+}
+
+
int UtcDaliLayerSetClipping(void)
{
tet_infoline("Testing Dali::Layer::SetClipping()");
signalData.receivedTouchEvent = handle;
}
+ // Allows functor to be used for signal connection by string.
+ // No data stored, though, so quite useless.
void operator()()
{
signalData.functorCalled = true;
WheelEventSignalData& signalData;
};
+// Functor that sets the data when wheel-event signal is received
+struct WheelEventReceivedVoidFunctor
+{
+ WheelEventReceivedVoidFunctor(WheelEventSignalData& data)
+ : signalData(data)
+ {
+ }
+
+ // Signals connected through BaseObject::DoConnectSignal can only take void() methods
+ bool operator()(void)
+ {
+ signalData.functorCalled = true;
+ return true;
+ }
+
+ WheelEventSignalData& signalData;
+};
+
+
bool DummyTouchCallback(Actor actor, const TouchEvent& touch)
{
return true;
END_TEST;
}
+int UtcDaliStageEventProcessingFinishedP2(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+ tet_printf("UtcDaliStageEventProcessingFinishedSignalP2 - check event processing finished signal connection by name\n");
+
+ bool eventProcessingFinished = false;
+ EventProcessingFinishedFunctor functor(eventProcessingFinished);
+ GetImplementation(stage).ConnectSignal(&application, "eventProcessingFinished", functor);
+
+ Actor actor(Actor::New());
+ stage.Add(actor);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(eventProcessingFinished);
+
+ END_TEST;
+}
+
int UtcDaliStageEventProcessingFinishedN(void)
{
TestApplication application;
END_TEST;
}
+
+int UtcDaliStageTouchedSignalP2(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+ tet_printf("UtcDaliStageTouchedSignalP2 - check touched signal connection by name\n");
+
+ TouchedSignalData data;
+ TouchFunctor functor(data);
+ GetImplementation(stage).ConnectSignal(&application, "touched", functor);
+
+ // Render and notify.
+ application.SendNotification();
+ application.Render();
+
+ // Basic test: No actors, single touch (down then up).
+ {
+ GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
+
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ data.Reset();
+
+ GenerateTouch(application, PointState::UP, Vector2(10.0f, 10.0f));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ data.Reset();
+ }
+ END_TEST;
+}
+
int UtcDaliStageTouchedSignalN(void)
{
TestApplication application;
END_TEST;
}
+
+int UtcDaliStageSignalWheelEventP2(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+ tet_printf("UtcDaliStageSignalWheelEventP2 - check wheel signal connection by name\n");
+
+ WheelEventSignalData data;
+ WheelEventReceivedVoidFunctor functor(data);
+ GetImplementation(stage).ConnectSignal(&application, "wheelEvent", functor);
+
+ Integration::WheelEvent event(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), 1, 1000u);
+ application.ProcessEvent(event);
+
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ // It's meaningless, since there's no data passed to the functor :/
+
+ data.Reset();
+
+ Integration::WheelEvent event2(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), -1, 1000u);
+ application.ProcessEvent(event2);
+
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ END_TEST;
+}
+
int UtcDaliStageContextLostSignalP(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliStageContextLostSignalP2(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+ tet_printf("UtcDaliStageContextLostSignalP2 - check context loss signal connection by name\n");
+
+ bool contextLost = false;
+ ContextStatusFunctor contextLostFunctor(contextLost);
+ GetImplementation(stage).ConnectSignal(&application, "contextLost", contextLostFunctor);
+
+ Integration::ContextNotifierInterface* notifier = application.GetCore().GetContextNotifier();
+ notifier->NotifyContextLost();
+ DALI_TEST_EQUALS(contextLost, true, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliStageContextLostSignalN(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliStageContextRegainedSignalP2(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+ tet_printf("UtcDaliStageContextRegainedSignalP2 - check context regained signal connection by name\n");
+
+ bool contextRegained = false;
+ ContextStatusFunctor contextRegainedFunctor(contextRegained);
+ GetImplementation(stage).ConnectSignal(&application, "contextRegained", contextRegainedFunctor);
+
+ Integration::ContextNotifierInterface* notifier = application.GetCore().GetContextNotifier();
+ notifier->NotifyContextLost();
+ notifier->NotifyContextRegained();
+ DALI_TEST_EQUALS(contextRegained, true, TEST_LOCATION);
+
+ END_TEST;
+}
+
+
+
+
int UtcDaliStageContextRegainedSignalN(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliStageSceneCreatedSignalP2(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ bool signalCalled = false;
+ SceneCreatedStatusFunctor sceneCreatedFunctor(signalCalled);
+ GetImplementation(stage).ConnectSignal(&application, "sceneCreated", sceneCreatedFunctor);
+
+ Integration::Core& core = application.GetCore();
+ core.SceneCreated();
+ DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliStageSceneCreatedSignalN(void)
{
TestApplication application;
// Signals
-const char* const SIGNAL_HOVERED = "hovered";
-const char* const SIGNAL_WHEEL_EVENT = "wheelEvent";
-const char* const SIGNAL_ON_SCENE = "onScene";
-const char* const SIGNAL_OFF_SCENE = "offScene";
-const char* const SIGNAL_ON_RELAYOUT = "onRelayout";
-const char* const SIGNAL_TOUCHED = "touched";
-const char* const SIGNAL_VISIBILITY_CHANGED = "visibilityChanged";
-const char* const SIGNAL_LAYOUT_DIRECTION_CHANGED = "layoutDirectionChanged";
-const char* const SIGNAL_CHILD_ADDED = "childAdded";
-const char* const SIGNAL_CHILD_REMOVED = "childRemoved";
+static constexpr std::string_view SIGNAL_HOVERED = "hovered";
+static constexpr std::string_view SIGNAL_WHEEL_EVENT = "wheelEvent";
+static constexpr std::string_view SIGNAL_ON_SCENE = "onScene";
+static constexpr std::string_view SIGNAL_OFF_SCENE = "offScene";
+static constexpr std::string_view SIGNAL_ON_RELAYOUT = "onRelayout";
+static constexpr std::string_view SIGNAL_TOUCHED = "touched";
+static constexpr std::string_view SIGNAL_VISIBILITY_CHANGED = "visibilityChanged";
+static constexpr std::string_view SIGNAL_LAYOUT_DIRECTION_CHANGED = "layoutDirectionChanged";
+static constexpr std::string_view SIGNAL_CHILD_ADDED = "childAdded";
+static constexpr std::string_view SIGNAL_CHILD_REMOVED = "childRemoved";
// Actions
-const char* const ACTION_SHOW = "show";
-const char* const ACTION_HIDE = "hide";
+static constexpr std::string_view ACTION_SHOW = "show";
+static constexpr std::string_view ACTION_HIDE = "hide";
BaseHandle CreateActor()
{
TypeRegistration mType( typeid(Dali::Actor), typeid(Dali::Handle), CreateActor, ActorDefaultProperties );
-SignalConnectorType signalConnector2( mType, SIGNAL_HOVERED, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector3( mType, SIGNAL_WHEEL_EVENT, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector4( mType, SIGNAL_ON_SCENE, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector5( mType, SIGNAL_OFF_SCENE, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector6( mType, SIGNAL_ON_RELAYOUT, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector7( mType, SIGNAL_TOUCHED, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector8( mType, SIGNAL_VISIBILITY_CHANGED, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector9( mType, SIGNAL_LAYOUT_DIRECTION_CHANGED, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector10( mType, SIGNAL_CHILD_ADDED, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector11( mType, SIGNAL_CHILD_REMOVED, &Actor::DoConnectSignal );
+SignalConnectorType signalConnector2(mType, std::string(SIGNAL_HOVERED), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector3(mType, std::string(SIGNAL_WHEEL_EVENT), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector4(mType, std::string(SIGNAL_ON_SCENE), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector5(mType, std::string(SIGNAL_OFF_SCENE), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector6(mType, std::string(SIGNAL_ON_RELAYOUT), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector7(mType, std::string(SIGNAL_TOUCHED), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector8(mType, std::string(SIGNAL_VISIBILITY_CHANGED), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector9(mType, std::string(SIGNAL_LAYOUT_DIRECTION_CHANGED), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector10(mType, std::string(SIGNAL_CHILD_ADDED), &Actor::DoConnectSignal);
+SignalConnectorType signalConnector11(mType, std::string(SIGNAL_CHILD_REMOVED), &Actor::DoConnectSignal);
-TypeAction a1( mType, ACTION_SHOW, &Actor::DoAction );
-TypeAction a2( mType, ACTION_HIDE, &Actor::DoAction );
+TypeAction a1(mType, std::string(ACTION_SHOW), &Actor::DoAction);
+TypeAction a2(mType, std::string(ACTION_HIDE), &Actor::DoAction);
/**
* @brief Extract a given dimension from a Vector2
bool connected( true );
Actor* actor = static_cast< Actor* >( object ); // TypeRegistry guarantees that this is the correct type.
- if( 0 == signalName.compare( SIGNAL_HOVERED ) )
+ std::string_view name(signalName);
+
+ if(name == SIGNAL_HOVERED)
{
actor->HoveredSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_WHEEL_EVENT ) )
+ else if(signalName == SIGNAL_WHEEL_EVENT)
{
actor->WheelEventSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_ON_SCENE ) )
+ else if(name == SIGNAL_ON_SCENE)
{
actor->OnSceneSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_OFF_SCENE ) )
+ else if(name == SIGNAL_OFF_SCENE)
{
actor->OffSceneSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_ON_RELAYOUT ) )
+ else if(name == SIGNAL_ON_RELAYOUT)
{
actor->OnRelayoutSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_TOUCHED ) )
+ else if(name == SIGNAL_TOUCHED)
{
actor->TouchedSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_VISIBILITY_CHANGED ) )
+ else if(name == SIGNAL_VISIBILITY_CHANGED)
{
actor->VisibilityChangedSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_LAYOUT_DIRECTION_CHANGED ) )
+ else if(name == SIGNAL_LAYOUT_DIRECTION_CHANGED)
{
actor->LayoutDirectionChangedSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_CHILD_ADDED ) )
+ else if(name == SIGNAL_CHILD_ADDED)
{
actor->ChildAddedSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_CHILD_REMOVED ) )
+ else if(name == SIGNAL_CHILD_REMOVED)
{
actor->ChildRemovedSignal().Connect( tracker, functor );
}
if( actor )
{
- if( 0 == actionName.compare( ACTION_SHOW ) )
+ std::string_view name(actionName);
+ if(name == ACTION_SHOW)
{
actor->SetVisible( true );
done = true;
}
- else if( 0 == actionName.compare( ACTION_HIDE ) )
+ else if(name == ACTION_HIDE)
{
actor->SetVisible( false );
done = true;
// Actions
-const char* const ACTION_RAISE = "raise";
-const char* const ACTION_LOWER = "lower";
-const char* const ACTION_RAISE_TO_TOP = "raiseToTop";
-const char* const ACTION_LOWER_TO_BOTTOM = "lowerToBottom";
+static constexpr std::string_view ACTION_RAISE = "raise";
+static constexpr std::string_view ACTION_LOWER = "lower";
+static constexpr std::string_view ACTION_RAISE_TO_TOP = "raiseToTop";
+static constexpr std::string_view ACTION_LOWER_TO_BOTTOM = "lowerToBottom";
BaseHandle Create()
{
TypeRegistration mType( typeid( Dali::Layer ), typeid( Dali::Actor ), Create, LayerDefaultProperties );
-TypeAction a1( mType, ACTION_RAISE, &Layer::DoAction );
-TypeAction a2( mType, ACTION_LOWER, &Layer::DoAction );
-TypeAction a3( mType, ACTION_RAISE_TO_TOP, &Layer::DoAction );
-TypeAction a4( mType, ACTION_LOWER_TO_BOTTOM, &Layer::DoAction );
+TypeAction a1(mType, std::string(ACTION_RAISE), &Layer::DoAction);
+TypeAction a2(mType, std::string(ACTION_LOWER), &Layer::DoAction);
+TypeAction a3(mType, std::string(ACTION_RAISE_TO_TOP), &Layer::DoAction);
+TypeAction a4(mType, std::string(ACTION_LOWER_TO_BOTTOM), &Layer::DoAction);
} // unnamed namespace
if( layer )
{
- if( 0 == actionName.compare( ACTION_RAISE ) )
+ std::string_view name(actionName);
+
+ if(name == ACTION_RAISE)
{
layer->Raise();
done = true;
}
- else if( 0 == actionName.compare( ACTION_LOWER ) )
+ else if(name == ACTION_LOWER)
{
layer->Lower();
done = true;
}
- else if( 0 == actionName.compare( ACTION_RAISE_TO_TOP ) )
+ else if(name == ACTION_RAISE_TO_TOP)
{
layer->RaiseToTop();
done = true;
}
- else if( 0 == actionName.compare( ACTION_LOWER_TO_BOTTOM ) )
+ else if(name == ACTION_LOWER_TO_BOTTOM)
{
layer->LowerToBottom();
done = true;
// Signals
-const char* const SIGNAL_FINISHED = "finished";
+static constexpr std::string_view SIGNAL_FINISHED = "finished";
// Actions
-const char* const ACTION_PLAY = "play";
-const char* const ACTION_STOP = "stop";
-const char* const ACTION_PAUSE = "pause";
+static constexpr std::string_view ACTION_PLAY = "play";
+static constexpr std::string_view ACTION_STOP = "stop";
+static constexpr std::string_view ACTION_PAUSE = "pause";
BaseHandle Create()
{
TypeRegistration mType( typeid( Dali::Animation ), typeid( Dali::BaseHandle ), Create );
-SignalConnectorType signalConnector1( mType, SIGNAL_FINISHED, &Animation::DoConnectSignal );
+SignalConnectorType signalConnector1(mType, std::string(SIGNAL_FINISHED), &Animation::DoConnectSignal);
-TypeAction action1( mType, ACTION_PLAY, &Animation::DoAction );
-TypeAction action2( mType, ACTION_STOP, &Animation::DoAction );
-TypeAction action3( mType, ACTION_PAUSE, &Animation::DoAction );
+TypeAction action1(mType, std::string(ACTION_PLAY), &Animation::DoAction);
+TypeAction action2(mType, std::string(ACTION_STOP), &Animation::DoAction);
+TypeAction action3(mType, std::string(ACTION_PAUSE), &Animation::DoAction);
const Dali::Animation::EndAction DEFAULT_END_ACTION( Dali::Animation::BAKE );
const Dali::Animation::EndAction DEFAULT_DISCONNECT_ACTION( Dali::Animation::BAKE_FINAL );
bool connected( false );
Animation* animation = static_cast< Animation* >(object); // TypeRegistry guarantees that this is the correct type.
- if( 0 == signalName.compare( SIGNAL_FINISHED ) )
+ if(SIGNAL_FINISHED == signalName)
{
animation->FinishedSignal().Connect( tracker, functor );
connected = true;
if( animation )
{
- if( 0 == actionName.compare( ACTION_PLAY ) )
+ std::string_view name(actionName);
+
+ if(name == ACTION_PLAY)
{
if( Property::Value* value = attributes.Find("duration", Property::FLOAT) )
{
animation->Play();
done = true;
}
- else if( 0 == actionName.compare( ACTION_STOP ) )
+ else if(name == ACTION_STOP)
{
animation->Stop();
done = true;
}
- else if( 0 == actionName.compare( ACTION_PAUSE ) )
+ else if(name == ACTION_PAUSE)
{
animation->Pause();
done = true;
// Signals
-const char* const SIGNAL_KEY_EVENT = "keyEvent";
-const char* const SIGNAL_KEY_EVENT_GENERATED = "keyEventGenerated";
-const char* const SIGNAL_EVENT_PROCESSING_FINISHED = "eventProcessingFinished";
-const char* const SIGNAL_TOUCHED = "touched";
-const char* const SIGNAL_WHEEL_EVENT = "wheelEvent";
-const char* const SIGNAL_CONTEXT_LOST = "contextLost";
-const char* const SIGNAL_CONTEXT_REGAINED = "contextRegained";
-const char* const SIGNAL_SCENE_CREATED = "sceneCreated";
+static constexpr std::string_view SIGNAL_KEY_EVENT = "keyEvent";
+static constexpr std::string_view SIGNAL_KEY_EVENT_GENERATED = "keyEventGenerated";
+static constexpr std::string_view SIGNAL_EVENT_PROCESSING_FINISHED = "eventProcessingFinished";
+static constexpr std::string_view SIGNAL_TOUCHED = "touched";
+static constexpr std::string_view SIGNAL_WHEEL_EVENT = "wheelEvent";
+static constexpr std::string_view SIGNAL_CONTEXT_LOST = "contextLost";
+static constexpr std::string_view SIGNAL_CONTEXT_REGAINED = "contextRegained";
+static constexpr std::string_view SIGNAL_SCENE_CREATED = "sceneCreated";
TypeRegistration mType( typeid(Dali::Stage), typeid(Dali::BaseHandle), nullptr );
-SignalConnectorType signalConnector1( mType, SIGNAL_KEY_EVENT, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector2( mType, SIGNAL_EVENT_PROCESSING_FINISHED, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector4( mType, SIGNAL_WHEEL_EVENT, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector5( mType, SIGNAL_CONTEXT_LOST, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector6( mType, SIGNAL_CONTEXT_REGAINED, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector7( mType, SIGNAL_SCENE_CREATED, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector8( mType, SIGNAL_KEY_EVENT_GENERATED, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector9( mType, SIGNAL_TOUCHED, &Stage::DoConnectSignal );
+SignalConnectorType signalConnector1(mType, std::string(SIGNAL_KEY_EVENT), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector2(mType, std::string(SIGNAL_EVENT_PROCESSING_FINISHED), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector4(mType, std::string(SIGNAL_WHEEL_EVENT), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector5(mType, std::string(SIGNAL_CONTEXT_LOST), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector6(mType, std::string(SIGNAL_CONTEXT_REGAINED), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector7(mType, std::string(SIGNAL_SCENE_CREATED), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector8(mType, std::string(SIGNAL_KEY_EVENT_GENERATED), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector9(mType, std::string(SIGNAL_TOUCHED), &Stage::DoConnectSignal);
} // unnamed namespace
{
bool connected( true );
Stage* stage = static_cast< Stage* >(object); // TypeRegistry guarantees that this is the correct type.
+ std::string_view name(signalName);
- if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT ) )
+ if(name == SIGNAL_KEY_EVENT)
{
stage->KeyEventSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT_GENERATED ) )
+ else if(name == SIGNAL_KEY_EVENT_GENERATED)
{
stage->KeyEventGeneratedSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_EVENT_PROCESSING_FINISHED ) )
+ else if(name == SIGNAL_EVENT_PROCESSING_FINISHED)
{
stage->EventProcessingFinishedSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_TOUCHED ) )
+ else if(name == SIGNAL_TOUCHED)
{
stage->TouchedSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_WHEEL_EVENT ) )
+ else if(name == SIGNAL_WHEEL_EVENT)
{
stage->WheelEventSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_CONTEXT_LOST ) )
+ else if(name == SIGNAL_CONTEXT_LOST)
{
stage->ContextLostSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_CONTEXT_REGAINED ) )
+ else if(name == SIGNAL_CONTEXT_REGAINED)
{
stage->ContextRegainedSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_SCENE_CREATED ) )
+ else if(name == SIGNAL_SCENE_CREATED)
{
stage->SceneCreatedSignal().Connect( tracker, functor );
}