From 32a183d3a7f55354a0fb14c11ecc8add9608985e Mon Sep 17 00:00:00 2001 From: David Steele Date: Fri, 21 Jan 2022 11:38:00 +0000 Subject: [PATCH] Synchronizing test harness Change-Id: Icf349509f0c61595b2b8a756e560825b7ea82bf7 --- .../dali-toolkit-test-utils/test-application.cpp | 7 +++-- .../test-graphics-controller.cpp | 11 +++++-- .../test-trace-call-stack.h | 21 ++++++++++++- .../toolkit-test-application.cpp | 34 ++++++++++------------ 4 files changed, 48 insertions(+), 25 deletions(-) diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp index 440270a..2862284 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -82,8 +82,9 @@ void TestApplication::CreateScene() // Create render target for the scene Graphics::RenderTargetCreateInfo rtInfo{}; rtInfo.SetExtent({mSurfaceWidth, mSurfaceHeight}); - mRenderTarget = mGraphicsController.CreateRenderTarget(rtInfo, nullptr); - mScene.SetSurfaceRenderTarget(mRenderTarget.get()); + rtInfo.SetSurface(&mSurfaceWidth); // Can point to anything, really. + + mScene.SetSurfaceRenderTarget(rtInfo); } void TestApplication::InitializeCore() diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp index fb2afda..3ed6b56 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -1028,9 +1028,11 @@ void TestGraphicsController::BindPipeline(TestGraphicsPipeline* pipeline) */ void TestGraphicsController::PresentRenderTarget(Graphics::RenderTarget* renderTarget) { + auto* rt = static_cast(renderTarget); TraceCallStack::NamedParams namedParams; namedParams["renderTarget"] << std::hex << renderTarget; - mCallStack.PushCall("PresentRenderTarget", "", namedParams); + namedParams["surface"] << std::hex << rt->mCreateInfo.surface; + mCallStack.PushCall("PresentRenderTarget", namedParams.str(), namedParams); } /** @@ -1237,7 +1239,10 @@ Graphics::UniquePtr TestGraphicsController::CreateSampler(con Graphics::UniquePtr TestGraphicsController::CreateRenderTarget(const Graphics::RenderTargetCreateInfo& renderTargetCreateInfo, Graphics::UniquePtr&& oldRenderTarget) { - mCallStack.PushCall("CreateRenderTarget", ""); + TraceCallStack::NamedParams namedParams; + namedParams["surface"] << std::hex << renderTargetCreateInfo.surface; + mCallStack.PushCall("CreateRenderTarget", namedParams.str(), namedParams); + return Graphics::MakeUnique(mGl, renderTargetCreateInfo); } diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h index 7631630..6f720c5 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h @@ -2,7 +2,7 @@ #define TEST_TRACE_CALL_STACK_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -121,6 +121,25 @@ public: } } + const std::ostringstream& operator[](std::string name) const + { + static std::ostringstream empty; + auto iter = mParams.begin(); + for(; iter != mParams.end(); ++iter) + { + if(!iter->parameterName.compare(name)) + { + break; + } + } + + if(iter != mParams.end()) + { + return iter->value; + } + return empty; + } + std::string str() const { std::ostringstream out; diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-test-application.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-test-application.cpp index cccb922..07b1013 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-test-application.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-test-application.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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,54 +20,52 @@ // INTERNAL INCLUDES #include -#include #include #include +#include #include #include #include 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, 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 +ToolkitTestApplication::ToolkitTestApplication(size_t surfaceWidth, size_t surfaceHeight, float horizontalDpi, float verticalDpi) +: 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 CreateCore(); // Override Scene creation in TestApplication by creating a window. // The window will create a Scene & surface and set up the scene's surface appropriately. - *mMainWindow = Window::New( PositionSize( 0, 0, surfaceWidth, surfaceHeight ), "" ); - mScene = AdaptorImpl::GetScene( *mMainWindow ); - mScene.SetDpi( Vector2( horizontalDpi, verticalDpi ) ); + *mMainWindow = Window::New(PositionSize(0, 0, surfaceWidth, surfaceHeight), ""); + mScene = AdaptorImpl::GetScene(*mMainWindow); + mScene.SetDpi(Vector2(horizontalDpi, verticalDpi)); // Create render target for the scene Graphics::RenderTargetCreateInfo rtInfo{}; - rtInfo.SetExtent( {mSurfaceWidth, mSurfaceHeight }); - mRenderTarget = mGraphicsController.CreateRenderTarget( rtInfo, nullptr ); - mScene.SetSurfaceRenderTarget( mRenderTarget.get() ); + rtInfo.SetExtent({mSurfaceWidth, mSurfaceHeight}); + mScene.SetSurfaceRenderTarget(rtInfo); // Core needs to be initialized next before we start the adaptor InitializeCore(); Accessibility::Accessible::SetObjectRegistry(mCore->GetObjectRegistry()); // This will also emit the window created signals - AdaptorImpl::GetImpl( *mAdaptor ).Start( *mMainWindow ); - AdaptorImpl::GetImpl( *mAdaptor ).SetApplication( *this ); + AdaptorImpl::GetImpl(*mAdaptor).Start(*mMainWindow); + AdaptorImpl::GetImpl(*mAdaptor).SetApplication(*this); Dali::LifecycleController lifecycleController = Dali::LifecycleController::Get(); lifecycleController.InitSignal().Emit(); // set the DPI value for font rendering TextAbstraction::FontClient fontClient = Dali::TextAbstraction::FontClient::Get(); - if( fontClient ) + if(fontClient) { - fontClient.SetDpi( mDpi.x, mDpi.y ); + fontClient.SetDpi(mDpi.x, mDpi.y); } } @@ -80,7 +78,7 @@ ToolkitTestApplication::~ToolkitTestApplication() void ToolkitTestApplication::RunIdles() { - AdaptorImpl::GetImpl( *mAdaptor.get() ).RunIdles(); + AdaptorImpl::GetImpl(*mAdaptor.get()).RunIdles(); } } // namespace Dali -- 2.7.4