From a87f0b5178c771c683fd50b2347d118d526ca441 Mon Sep 17 00:00:00 2001 From: David Steele Date: Thu, 27 Jun 2024 18:12:20 +0100 Subject: [PATCH] Making test-render-surface.h/cpp common across repos Change-Id: I03cb1f37ad9f51bc96b08bb31b6ee9d7d20cd083 Signed-off-by: David Steele --- automated-tests/src/dali-internal/CMakeLists.txt | 1 + automated-tests/src/dali/CMakeLists.txt | 8 ++- .../render-surface-interface.h | 66 ++++++++++++++++++++++ .../test-render-surface-if.cpp | 23 ++++++++ .../dali-test-suite-utils/test-render-surface.cpp | 10 ++-- .../dali-test-suite-utils/test-render-surface.h | 49 +--------------- build/tizen/CMakeLists.txt | 1 + 7 files changed, 103 insertions(+), 55 deletions(-) create mode 100644 automated-tests/src/dali/dali-test-suite-utils/render-surface-interface.h create mode 100644 automated-tests/src/dali/dali-test-suite-utils/test-render-surface-if.cpp diff --git a/automated-tests/src/dali-internal/CMakeLists.txt b/automated-tests/src/dali-internal/CMakeLists.txt index f306035..a469157 100644 --- a/automated-tests/src/dali-internal/CMakeLists.txt +++ b/automated-tests/src/dali-internal/CMakeLists.txt @@ -61,6 +61,7 @@ LIST(APPEND TC_SOURCES ../dali/dali-test-suite-utils/test-render-surface.cpp ../dali/dali-test-suite-utils/test-trace-call-stack.cpp ../dali/dali-test-suite-utils/test-addon-manager.cpp + ../dali/dali-test-suite-utils/test-render-surface-if.cpp ) PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED diff --git a/automated-tests/src/dali/CMakeLists.txt b/automated-tests/src/dali/CMakeLists.txt index 5687677..f7cdf6e 100644 --- a/automated-tests/src/dali/CMakeLists.txt +++ b/automated-tests/src/dali/CMakeLists.txt @@ -136,6 +136,7 @@ LIST(APPEND TC_SOURCES dali-test-suite-utils/test-render-surface.cpp dali-test-suite-utils/test-trace-call-stack.cpp dali-test-suite-utils/test-addon-manager.cpp + dali-test-suite-utils/test-render-surface-if.cpp ) PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED @@ -151,9 +152,10 @@ FOREACH(directory ${${CAPI_LIB}_LIBRARY_DIRS}) ENDFOREACH(directory ${CAPI_LIB_LIBRARY_DIRS}) INCLUDE_DIRECTORIES( - ../../../ - ${${CAPI_LIB}_INCLUDE_DIRS} - dali-test-suite-utils + ../../../ + . + ${${CAPI_LIB}_INCLUDE_DIRS} + dali-test-suite-utils ) ADD_DEFINITIONS( -DADDON_LIBS_PATH=\"${CMAKE_CURRENT_BINARY_DIR}\" ) diff --git a/automated-tests/src/dali/dali-test-suite-utils/render-surface-interface.h b/automated-tests/src/dali/dali-test-suite-utils/render-surface-interface.h new file mode 100644 index 0000000..60f6a8f --- /dev/null +++ b/automated-tests/src/dali/dali-test-suite-utils/render-surface-interface.h @@ -0,0 +1,66 @@ +#pragma once + +/* + * Copyright (c) 2024 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include + +namespace Dali +{ +using PositionSize = Dali::Rect; +class ThreadSynchronizationInterface; + +namespace Integration +{ +class RenderSurfaceInterface +{ +public: + enum Type + { + WINDOW_RENDER_SURFACE, + PIXMAP_RENDER_SURFACE, + NATIVE_RENDER_SURFACE + }; + RenderSurfaceInterface(); + + virtual Dali::PositionSize GetPositionSize() const = 0; + virtual void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) = 0; + virtual int GetSurfaceOrientation() const = 0; + virtual int GetScreenOrientation() const = 0; + virtual void InitializeGraphics() = 0; + virtual void CreateSurface() = 0; + virtual void DestroySurface() = 0; + virtual bool ReplaceGraphicsSurface() = 0; + virtual void MoveResize(Dali::PositionSize positionSize) = 0; + virtual void StartRender() = 0; + virtual bool PreRender(bool resizingSurface, const std::vector>& damageRects, Rect& clippingRect) = 0; + virtual void PostRender() = 0; + virtual void StopRender() = 0; + virtual void ReleaseLock() = 0; + virtual void SetThreadSynchronization(ThreadSynchronizationInterface& threadSynchronization) = 0; + virtual Dali::Integration::RenderSurfaceInterface::Type GetSurfaceType() = 0; + virtual void MakeContextCurrent() = 0; + virtual Integration::DepthBufferAvailable GetDepthBufferRequired() = 0; + virtual Integration::StencilBufferAvailable GetStencilBufferRequired() = 0; + +protected: + virtual ~RenderSurfaceInterface(); +}; +} // namespace Integration +} // namespace Dali diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-render-surface-if.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-render-surface-if.cpp new file mode 100644 index 0000000..dffa491 --- /dev/null +++ b/automated-tests/src/dali/dali-test-suite-utils/test-render-surface-if.cpp @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "render-surface-interface.h" + +namespace Dali::Integration +{ +RenderSurfaceInterface::RenderSurfaceInterface() = default; +RenderSurfaceInterface::~RenderSurfaceInterface() = default; +} // namespace Dali::Integration diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-render-surface.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-render-surface.cpp index 2f8865b..60a0ad0 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-render-surface.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-render-surface.cpp @@ -19,18 +19,16 @@ namespace Dali { -namespace Integration -{ -RenderSurfaceInterface::RenderSurfaceInterface() = default; -RenderSurfaceInterface::~RenderSurfaceInterface() = default; -} // namespace Integration - TestRenderSurface::TestRenderSurface(Dali::PositionSize positionSize) : mPositionSize(positionSize), mBackgroundColor() { } +TestRenderSurface::~TestRenderSurface() +{ +} + Dali::PositionSize TestRenderSurface::GetPositionSize() const { return mPositionSize; diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-render-surface.h b/automated-tests/src/dali/dali-test-suite-utils/test-render-surface.h index 17fdaa2..b0f7a94 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-render-surface.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-render-surface.h @@ -19,54 +19,10 @@ */ // INTERNAL INCLUDES -#include -#include -#include -#include +#include "render-surface-interface.h" namespace Dali { -using PositionSize = Dali::Rect; -class ThreadSynchronizationInterface; - -namespace Integration -{ -class RenderSurfaceInterface -{ -public: - enum Type - { - WINDOW_RENDER_SURFACE, - PIXMAP_RENDER_SURFACE, - NATIVE_RENDER_SURFACE - }; - RenderSurfaceInterface(); - - virtual Dali::PositionSize GetPositionSize() const = 0; - virtual void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) = 0; - virtual int GetSurfaceOrientation() const = 0; - virtual int GetScreenOrientation() const = 0; - virtual void InitializeGraphics() = 0; - virtual void CreateSurface() = 0; - virtual void DestroySurface() = 0; - virtual bool ReplaceGraphicsSurface() = 0; - virtual void MoveResize(Dali::PositionSize positionSize) = 0; - virtual void StartRender() = 0; - virtual bool PreRender(bool resizingSurface, const std::vector>& damageRects, Rect& clippingRect) = 0; - virtual void PostRender() = 0; - virtual void StopRender() = 0; - virtual void ReleaseLock() = 0; - virtual void SetThreadSynchronization(ThreadSynchronizationInterface& threadSynchronization) = 0; - virtual Dali::Integration::RenderSurfaceInterface::Type GetSurfaceType() = 0; - virtual void MakeContextCurrent() = 0; - virtual Integration::DepthBufferAvailable GetDepthBufferRequired() = 0; - virtual Integration::StencilBufferAvailable GetStencilBufferRequired() = 0; - -protected: - virtual ~RenderSurfaceInterface(); -}; -} // namespace Integration - /** * Concrete implementation of the RenderSurface class. */ @@ -81,7 +37,7 @@ public: /** * @copydoc Dali::Integration::RenderSurface::~RenderSurface */ - ~TestRenderSurface() override = default; + ~TestRenderSurface() override; /** * @copydoc Dali::Integration::RenderSurface::GetPositionSize @@ -154,6 +110,7 @@ public: void ReleaseLock() override; void SetThreadSynchronization(ThreadSynchronizationInterface& threadSynchronization) override; + /** * @copydoc Dali::Integration::RenderSurface::GetSurfaceType */ diff --git a/build/tizen/CMakeLists.txt b/build/tizen/CMakeLists.txt index 68760c3..85da650 100644 --- a/build/tizen/CMakeLists.txt +++ b/build/tizen/CMakeLists.txt @@ -404,6 +404,7 @@ IF( ENABLE_LINK_TEST ) ${DALI_TEST_SUITE_DIR}/test-render-controller.cpp ${DALI_TEST_SUITE_DIR}/test-render-surface.cpp ${DALI_TEST_SUITE_DIR}/test-trace-call-stack.cpp + ${DALI_TEST_SUITE_DIR}/test-render-surface-if.cpp ) ADD_EXECUTABLE( ${LINKER_TEST_NAME} ${LINKER_TEST_SOURCES} ) TARGET_LINK_LIBRARIES(${LINKER_TEST_NAME} ${name}) -- 2.7.4