Revert "[Tizen] Appendix log for ttrace + Print keycode and timestamp"
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-SignalDelegate.cpp
index d4743e1..8595a27 100644 (file)
@@ -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.
  */
 
 // EXTERNAL INCLUDES
-#include <iostream>
 #include <stdlib.h>
 
+#include <iostream>
+
 // INTERNAL INCLUDES
-#include <dali/public-api/dali-core.h>
-#include <dali/devel-api/signals/signal-delegate.h>
 #include <dali-test-suite-utils.h>
+#include <dali/devel-api/signals/signal-delegate.h>
+#include <dali/public-api/dali-core.h>
 
 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;
 }