X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-SignalDelegate.cpp;h=8595a278e69396967ccd73e65bd17a6048dc7ac7;hb=fe58df83b2d72c4beceb101eb9cffcc5442f3d6e;hp=d4743e117c352dbf90f54f301d4b839354b23f80;hpb=679e2ae09e17cd5daf74b4309d6ea5cbb7051d1b;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/utc-Dali-SignalDelegate.cpp b/automated-tests/src/dali/utc-Dali-SignalDelegate.cpp index d4743e1..8595a27 100644 --- a/automated-tests/src/dali/utc-Dali-SignalDelegate.cpp +++ b/automated-tests/src/dali/utc-Dali-SignalDelegate.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,17 +16,17 @@ */ // EXTERNAL INCLUDES -#include #include +#include + // INTERNAL INCLUDES -#include -#include #include +#include +#include using namespace Dali; - void utc_dali_signal_delegate_startup(void) { test_return_value = TET_UNDEF; @@ -47,15 +47,14 @@ static bool gSignalReceived = false; class SignalDelegateTestClass : public Dali::ConnectionTracker { public: - - SignalDelegateTestClass( Actor connectActor, std::string connectSignal ) + SignalDelegateTestClass(Actor connectActor, std::string connectSignal) { - mSignalDelegate = new SignalDelegate( connectActor, connectSignal ); + mSignalDelegate = new SignalDelegate(connectActor, connectSignal); } void ConnectToInternalMember() { - mSignalDelegate->Connect( this, &SignalDelegateTestClass::SignalHandlerMemberFunction ); + mSignalDelegate->Connect(this, &SignalDelegateTestClass::SignalHandlerMemberFunction); } bool IsConnected() @@ -64,10 +63,9 @@ public: } private: - void SignalHandlerMemberFunction() { - tet_infoline( "Got signal in member function\n" ); + tet_infoline("Got signal in member function\n"); gSignalReceived = true; } @@ -96,26 +94,25 @@ struct SignalDelegateTestFunctor } }; - // Test cases: int UtcDaliSignalDelegateIsConnectedP(void) { TestApplication application; - tet_infoline( " UtcDaliSignalDelegateIsConnectedP" ); + tet_infoline(" UtcDaliSignalDelegateIsConnectedP"); // Set up an actor with a signal to connect to. - Actor connectActor = Actor::New(); - std::string connectSignal = "onStage"; + Actor connectActor = Actor::New(); + std::string connectSignal = "onScene"; // Create the test class (this will create the delegate, but not connect to it yet. - SignalDelegateTestClass testObject( connectActor, connectSignal ); + SignalDelegateTestClass testObject(connectActor, connectSignal); // Tell the test class to connect the delegate to it's internal member. // Note: It is at this point that the delegate internally makes the connection. testObject.ConnectToInternalMember(); - DALI_TEST_CHECK( testObject.IsConnected() ); + DALI_TEST_CHECK(testObject.IsConnected()); END_TEST; } @@ -123,16 +120,16 @@ int UtcDaliSignalDelegateIsConnectedP(void) int UtcDaliSignalDelegateIsConnectedN(void) { TestApplication application; - tet_infoline( " UtcDaliSignalDelegateIsConnectedN" ); + tet_infoline(" UtcDaliSignalDelegateIsConnectedN"); // Set up an actor with a signal to connect to. - Actor connectActor = Actor::New(); - std::string connectSignal = "onStage"; + Actor connectActor = Actor::New(); + std::string connectSignal = "onScene"; // Create the test class (this will create the delegate, but not connect to it yet. - SignalDelegateTestClass testObject( connectActor, connectSignal ); + SignalDelegateTestClass testObject(connectActor, connectSignal); - DALI_TEST_CHECK( !testObject.IsConnected() ); + DALI_TEST_CHECK(!testObject.IsConnected()); END_TEST; } @@ -140,28 +137,28 @@ int UtcDaliSignalDelegateIsConnectedN(void) int UtcDaliSignalDelegateConnectToMemberP(void) { TestApplication application; - tet_infoline( " UtcDaliSignalDelegateConnectToMemberP" ); + tet_infoline(" UtcDaliSignalDelegateConnectToMemberP"); // Set up an actor with a signal to connect to. - Actor connectActor = Actor::New(); - std::string connectSignal = "onStage"; + Actor connectActor = Actor::New(); + std::string connectSignal = "onScene"; gSignalReceived = false; // Create the test class (this will create the delegate, but not connect to it yet. - SignalDelegateTestClass testObject( connectActor, connectSignal ); + SignalDelegateTestClass testObject(connectActor, connectSignal); // Tell the test class to connect the delegate to it's internal member. // Note: It is at this point that the delegate internally makes the connection. testObject.ConnectToInternalMember(); - // Add the actor to the stage to trigger it's "onStage" signal. + // Add the actor to the scene to trigger it's "onScene" signal. // If the delegate connected correctly, this will call the member // function in the test object and set a global flag. - Stage::GetCurrent().Add( connectActor ); + application.GetScene().Add(connectActor); // Check the global flag to confirm the signal was received. - DALI_TEST_CHECK( gSignalReceived ); + DALI_TEST_CHECK(gSignalReceived); END_TEST; } @@ -169,23 +166,23 @@ int UtcDaliSignalDelegateConnectToMemberP(void) int UtcDaliSignalDelegateConnectToMemberN(void) { TestApplication application; - tet_infoline( " UtcDaliSignalDelegateConnectToMemberN" ); + tet_infoline(" UtcDaliSignalDelegateConnectToMemberN"); // Set up an actor with a signal to connect to. - Actor connectActor = Actor::New(); - std::string connectSignal = "onStage"; + Actor connectActor = Actor::New(); + std::string connectSignal = "onScene"; gSignalReceived = false; // Create the test class (this will create the delegate, but not connect to it yet. - SignalDelegateTestClass testObject( connectActor, connectSignal ); + SignalDelegateTestClass testObject(connectActor, connectSignal); // Tell the test class to connect the delegate to it's internal member. // Note: It is at this point that the delegate internally makes the connection. testObject.ConnectToInternalMember(); // Check the global flag to confirm the signal was not received. - DALI_TEST_CHECK( !gSignalReceived ); + DALI_TEST_CHECK(!gSignalReceived); END_TEST; } @@ -193,14 +190,14 @@ int UtcDaliSignalDelegateConnectToMemberN(void) int UtcDaliSignalDelegateConnectToFunctorP(void) { TestApplication application; - tet_infoline( " UtcDaliSignalDelegateConnectToFunctorP" ); + tet_infoline(" UtcDaliSignalDelegateConnectToFunctorP"); // Set up an actor with a signal to connect to. - Actor connectActor = Actor::New(); - std::string connectSignal = "onStage"; + Actor connectActor = Actor::New(); + std::string connectSignal = "onScene"; // Initialise the signal delegate with the actor to connect to and it's signal. - SignalDelegate signalDelegate( connectActor, connectSignal ); + SignalDelegate signalDelegate(connectActor, connectSignal); // We need a connection tracker object to associated with the connection. // This could normally be "this", but since we are not within a class, we pass @@ -208,22 +205,22 @@ int UtcDaliSignalDelegateConnectToFunctorP(void) TestConnectionTrackerObject* testTracker = new TestConnectionTrackerObject(); // Check the signal delegate currently has no connection. - DALI_TEST_CHECK( !signalDelegate.IsConnected() ); + DALI_TEST_CHECK(!signalDelegate.IsConnected()); // Tell the signal delegate to connect to the given functor (via a functor delegate). // Note: It is at this point that the delegate internally makes the connection. - signalDelegate.Connect( testTracker, FunctorDelegate::New( SignalDelegateTestFunctor() ) ); + signalDelegate.Connect(testTracker, FunctorDelegate::New(SignalDelegateTestFunctor())); // Check the signal delegate has made the connection. - DALI_TEST_CHECK( signalDelegate.IsConnected() ); + DALI_TEST_CHECK(signalDelegate.IsConnected()); - // Add the actor to the stage to trigger it's "onStage" signal. + // Add the actor to the scene to trigger it's "onScene" signal. // If the delegate connected correctly, this will call the () operator of our // passed-in functor, the functor will in turn set a global flag. - Stage::GetCurrent().Add( connectActor ); + application.GetScene().Add(connectActor); // Check the global flag to confirm the signal was received. - DALI_TEST_CHECK( gSignalReceived ); + DALI_TEST_CHECK(gSignalReceived); END_TEST; } @@ -231,14 +228,14 @@ int UtcDaliSignalDelegateConnectToFunctorP(void) int UtcDaliSignalDelegateConnectToFunctorN(void) { TestApplication application; - tet_infoline( " UtcDaliSignalDelegateConnectToFunctorN" ); + tet_infoline(" UtcDaliSignalDelegateConnectToFunctorN"); // Set up an actor with a signal to connect to. - Actor connectActor = Actor::New(); - std::string connectSignal = "onStage"; + Actor connectActor = Actor::New(); + std::string connectSignal = "onScene"; // Initialise the signal delegate with the actor to connect to and it's signal. - SignalDelegate signalDelegate( connectActor, connectSignal ); + SignalDelegate signalDelegate(connectActor, connectSignal); // We need a connection tracker object to associated with the connection. // This could normally be "this", but since we are not within a class, we pass @@ -246,17 +243,17 @@ int UtcDaliSignalDelegateConnectToFunctorN(void) TestConnectionTrackerObject* testTracker = new TestConnectionTrackerObject(); // Check the signal delegate currently has no connection. - DALI_TEST_CHECK( !signalDelegate.IsConnected() ); + DALI_TEST_CHECK(!signalDelegate.IsConnected()); // Tell the signal delegate to connect to the given functor (via a functor delegate). // Note: It is at this point that the delegate internally makes the connection. - signalDelegate.Connect( testTracker, FunctorDelegate::New( SignalDelegateTestFunctor() ) ); + signalDelegate.Connect(testTracker, FunctorDelegate::New(SignalDelegateTestFunctor())); // Check the signal delegate has made the connection. - DALI_TEST_CHECK( signalDelegate.IsConnected() ); + DALI_TEST_CHECK(signalDelegate.IsConnected()); // Check the global flag to confirm the signal was received. - DALI_TEST_CHECK( !gSignalReceived ); + DALI_TEST_CHECK(!gSignalReceived); END_TEST; }