Remove RenderSurface from Core
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-test-application.cpp
index 53cd1d9..d3bdd42 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 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.
@@ -21,9 +21,8 @@
 // INTERNAL INCLUDES
 #include <dali-test-suite-utils.h>
 #include <dali/devel-api/text-abstraction/font-client.h>
-#include <dali/integration-api/adaptors/adaptor.h>
+#include <dali/integration-api/adaptor-framework/adaptor.h>
 #include <toolkit-adaptor-impl.h>
-#include <toolkit-singleton-service.h>
 #include <toolkit-lifecycle-controller.h>
 
 namespace Dali
@@ -32,7 +31,8 @@ namespace Dali
 using AdaptorImpl = Dali::Internal::Adaptor::Adaptor;
 
 ToolkitTestApplication::ToolkitTestApplication( size_t surfaceWidth, size_t surfaceHeight, float  horizontalDpi, float verticalDpi )
-: TestApplication( surfaceWidth, surfaceHeight, horizontalDpi, verticalDpi, ResourcePolicy::DALI_DISCARDS_ALL_DATA, false /* Do not Initialize Core */ ),
+: TestApplication( surfaceWidth, surfaceHeight, horizontalDpi, verticalDpi, false /* Do not Initialize Core */ ),
+  mMainWindow( new Dali::Window ),
   mAdaptor( &AdaptorImpl::New() ) // Need to create Adaptor first as many singletons in dali-adaptor need it
 {
   // Create Core next
@@ -40,19 +40,15 @@ ToolkitTestApplication::ToolkitTestApplication( size_t surfaceWidth, size_t surf
 
   // Override Scene creation in TestApplication by creating a window.
   // The window will create a Scene & surface and set up the scene's surface appropriately.
-  Window window( Window::New( PositionSize( 0, 0, surfaceWidth, surfaceHeight ), "" ) );
-  mScene = AdaptorImpl::GetScene( window );
-  mRenderSurface = dynamic_cast< TestRenderSurface* >( mScene.GetSurface() );
+  *mMainWindow = Window::New( PositionSize( 0, 0, surfaceWidth, surfaceHeight ), "" );
+  mScene = AdaptorImpl::GetScene( *mMainWindow );
   mScene.SetDpi( Vector2( horizontalDpi, verticalDpi ) );
 
   // Core needs to be initialized next before we start the adaptor
   InitializeCore();
 
-  auto singletonService = SingletonService::Get();
-  Test::SetApplication( singletonService, *this );
-
   // This will also emit the window created signals
-  AdaptorImpl::GetImpl( *mAdaptor ).Start( window );
+  AdaptorImpl::GetImpl( *mAdaptor ).Start( *mMainWindow );
 
   Dali::LifecycleController lifecycleController = Dali::LifecycleController::Get();
   lifecycleController.InitSignal().Emit();
@@ -70,9 +66,6 @@ ToolkitTestApplication::~ToolkitTestApplication()
   // Need to delete core before we delete the adaptor.
   delete mCore;
   mCore = NULL;
-
-  // Set mRenderSurface to null, it will be deleted by the window that owns it
-  mRenderSurface = nullptr;
 }
 
 void ToolkitTestApplication::RunIdles()