Revert "[Tizen] Revert "Support multiple window rendering""
[platform/core/uifw/dali-adaptor.git] / automated-tests / src / dali-adaptor / dali-test-suite-utils / test-application.cpp
index a20ef6d..1562d27 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -20,6 +20,7 @@
 namespace Dali
 {
 
+bool TestApplication::mLoggingEnabled = true;
 
 TestApplication::TestApplication( uint32_t surfaceWidth,
                                   uint32_t surfaceHeight,
@@ -53,8 +54,6 @@ void TestApplication::Initialize()
                                         Integration::StencilBufferAvailable::TRUE );
 
   mCore->ContextCreated();
-  mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight );
-  mCore->SetDpi( mDpi.x, mDpi.y );
 
   Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage);
   Dali::Integration::Log::InstallLogFunction(logFunction);
@@ -64,12 +63,22 @@ void TestApplication::Initialize()
 
   Dali::Integration::Trace::LogContext( true, "Test" );
 
+  mRenderSurface = new TestRenderSurface( Dali::PositionSize( 0, 0, mSurfaceWidth, mSurfaceHeight ) );
+  mScene = Dali::Integration::Scene::New( Vector2( static_cast<float>( mSurfaceWidth ), static_cast<float>( mSurfaceHeight ) ) );
+  mScene.SetSurface( *mRenderSurface );
+
+  mScene.SetDpi( Vector2( static_cast<float>( mDpi.x ), static_cast<float>( mDpi.y ) ) );
+
+  mCore->SurfaceResized( mRenderSurface );
+
   mCore->SceneCreated();
+  mCore->Initialize();
 }
 
 TestApplication::~TestApplication()
 {
   Dali::Integration::Log::UninstallLogFunction();
+  delete mRenderSurface;
   delete mCore;
 }
 
@@ -77,30 +86,33 @@ void TestApplication::LogContext( bool start, const char* tag )
 {
   if( start )
   {
-    fprintf(stderr, "INFO: Trace Start: %s", tag);
+    fprintf(stderr, "INFO: Trace Start: %s\n", tag);
   }
   else
   {
-    fprintf(stderr, "INFO: Trace End: %s", tag);
+    fprintf(stderr, "INFO: Trace End: %s\n", tag);
   }
 }
 
 void TestApplication::LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message)
 {
-  switch(level)
+  if( mLoggingEnabled )
   {
-    case Dali::Integration::Log::DebugInfo:
-      fprintf(stderr, "INFO: %s", message.c_str());
-      break;
-    case Dali::Integration::Log::DebugWarning:
-      fprintf(stderr, "WARN: %s", message.c_str());
-      break;
-    case Dali::Integration::Log::DebugError:
-      fprintf(stderr, "ERROR: %s", message.c_str());
-      break;
-    default:
-      fprintf(stderr, "DEFAULT: %s", message.c_str());
-      break;
+    switch(level)
+    {
+      case Dali::Integration::Log::DebugInfo:
+        fprintf(stderr, "INFO: %s", message.c_str());
+        break;
+      case Dali::Integration::Log::DebugWarning:
+        fprintf(stderr, "WARN: %s", message.c_str());
+        break;
+      case Dali::Integration::Log::DebugError:
+        fprintf(stderr, "ERROR: %s", message.c_str());
+        break;
+      default:
+        fprintf(stderr, "DEFAULT: %s", message.c_str());
+        break;
+    }
   }
 }
 
@@ -145,19 +157,6 @@ void TestApplication::SendNotification()
   mCore->ProcessEvents();
 }
 
-void TestApplication::SetSurfaceWidth( uint32_t width, uint32_t height )
-{
-  mSurfaceWidth = width;
-  mSurfaceHeight = height;
-
-  mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight );
-}
-
-void TestApplication::SetTopMargin( uint32_t margin )
-{
-  mCore->SetTopMargin( margin );
-}
-
 void TestApplication::DoUpdate( uint32_t intervalMilliseconds, const char* location )
 {
   if( GetUpdateStatus() == 0 &&