X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftest-platform-abstraction.h;h=7c1b0108bc27171141e8da732f0fd1e5d6cd60c3;hp=201e29d4e33c9cd891e34591d02eddddf1d7d34e;hb=HEAD;hpb=96d995c2f22cb20080496e7442c4683eccc62a99 diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.h index 201e29d..3146e2d 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TEST_PLATFORM_ABSTRACTION_H__ -#define __DALI_TEST_PLATFORM_ABSTRACTION_H__ +#ifndef DALI_TEST_PLATFORM_ABSTRACTION_H +#define DALI_TEST_PLATFORM_ABSTRACTION_H /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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 @@ // EXTERNAL INCLUDES #include + #include #include #include @@ -32,15 +33,12 @@ namespace Dali { - /** * Concrete implementation of the platform abstraction class. */ -class DALI_IMPORT_API TestPlatformAbstraction : public Dali::Integration::PlatformAbstraction +class DALI_CORE_API TestPlatformAbstraction : public Dali::Integration::PlatformAbstraction { - public: - /** * Constructor */ @@ -49,49 +47,60 @@ public: /** * Destructor */ - virtual ~TestPlatformAbstraction(); + ~TestPlatformAbstraction() override; /** * @copydoc PlatformAbstraction::GetClosestImageSize() */ - virtual ImageDimensions GetClosestImageSize( const std::string& filename, - ImageDimensions size, - FittingMode::Type fittingMode, - SamplingMode::Type samplingMode, - bool orientationCorrection ); + ImageDimensions GetClosestImageSize(const std::string& filename, + ImageDimensions size, + FittingMode::Type fittingMode, + SamplingMode::Type samplingMode, + bool orientationCorrection) override; /** * @copydoc PlatformAbstraction::GetClosestImageSize() */ - virtual ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer, - ImageDimensions size, - FittingMode::Type fittingMode, - SamplingMode::Type samplingMode, - bool orientationCorrection ); + ImageDimensions GetClosestImageSize(Integration::ResourcePointer resourceBuffer, + ImageDimensions size, + FittingMode::Type fittingMode, + SamplingMode::Type samplingMode, + bool orientationCorrection) override; /** * @copydoc PlatformAbstraction::LoadResourceSynchronously() */ - virtual Integration::ResourcePointer LoadImageSynchronously( const Integration::BitmapResourceType& resourceType, const std::string& resourcePath ); + Integration::ResourcePointer LoadImageSynchronously(const Integration::BitmapResourceType& resourceType, const std::string& resourcePath) override; /** * @copydoc PlatformAbstraction::DecodeBuffer() */ - virtual Integration::BitmapPtr DecodeBuffer( const Dali::Integration::BitmapResourceType& resourceType, uint8_t * buffer, size_t size ); + Integration::BitmapPtr DecodeBuffer(const Dali::Integration::BitmapResourceType& resourceType, uint8_t* buffer, size_t size) override; /** * @copydoc PlatformAbstraction::LoadShaderBinaryFile() */ - virtual bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const; + bool LoadShaderBinaryFile(const std::string& filename, Dali::Vector& buffer) const override; /** * @copydoc PlatformAbstraction::SaveShaderBinaryFile() */ - virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const { return true; } + virtual bool SaveShaderBinaryFile(const std::string& filename, const unsigned char* buffer, unsigned int numBytes) const override + { + return true; + } + + /** + * @copydoc PlatformAbstraction::StartTimer() + */ + uint32_t StartTimer(uint32_t milliseconds, CallbackBase* callback) override; + /* + * @copydoc PlatformAbstraction::CancelTimer() + */ + void CancelTimer(uint32_t timerId) override; public: // TEST FUNCTIONS - // Enumeration of Platform Abstraction methods typedef enum { @@ -103,9 +112,18 @@ public: // TEST FUNCTIONS /** Call this every test */ void Initialize(); - inline void EnableTrace(bool enable) { mTrace.Enable(enable); } - inline void ResetTrace() { mTrace.Reset(); } - inline TraceCallStack& GetTrace() { return mTrace; } + inline void EnableTrace(bool enable) + { + mTrace.Enable(enable); + } + inline void ResetTrace() + { + mTrace.Reset(); + } + inline TraceCallStack& GetTrace() + { + return mTrace; + } /** * @brief Checks if a platform function was called @@ -136,56 +154,61 @@ public: // TEST FUNCTIONS * @param[in] result The value that LoadFile should return. * @param[in] buffer The buffer of the loaded file. */ - void SetLoadFileResult( bool result, Dali::Vector< unsigned char >& buffer ); + void SetLoadFileResult(bool result, Dali::Vector& buffer); /** * @brief Sets the SaveFile result * @param[in] result The value that SaveFile should return */ - void SetSaveFileResult( bool result ); + void SetSaveFileResult(bool result); /** * @brief Sets the resource loaded by LoadResourceSynchronously * @param[in] resource The loaded resource */ - void SetSynchronouslyLoadedResource( Integration::ResourcePointer resource ); + void SetSynchronouslyLoadedResource(Integration::ResourcePointer resource); /** * @brief Sets the bitmap returned by DecodeBuffer() * @param[in] bitmap The decoded bitmap */ - void SetDecodedBitmap( Integration::BitmapPtr bitmap ); - -private: + void SetDecodedBitmap(Integration::BitmapPtr bitmap); - TestPlatformAbstraction( const TestPlatformAbstraction& ); ///< Undefined - TestPlatformAbstraction& operator=( const TestPlatformAbstraction& ); ///< Undefined + /** + * @brief Triggers the previously stored callback function + */ + void TriggerTimer(); private: + TestPlatformAbstraction(const TestPlatformAbstraction&); ///< Undefined + TestPlatformAbstraction& operator=(const TestPlatformAbstraction&); ///< Undefined +private: struct LoadFileResult { inline LoadFileResult() : loadResult(false) { - } - bool loadResult; - Dali::Vector< unsigned char> buffer; + bool loadResult; + Dali::Vector buffer; }; - mutable TraceCallStack mTrace; - bool mIsLoadingResult; - Vector2 mClosestSize; + mutable TraceCallStack mTrace{true, "PlatformAbstraction::"}; + bool mIsLoadingResult; + ImageDimensions mClosestSize; + + LoadFileResult mLoadFileResult; + bool mSaveFileResult; - LoadFileResult mLoadFileResult; - bool mSaveFileResult; + Integration::ResourcePointer mSynchronouslyLoadedResource; + Integration::BitmapPtr mDecodedBitmap; - Integration::ResourcePointer mSynchronouslyLoadedResource; - Integration::BitmapPtr mDecodedBitmap; + uint32_t mTimerId; + CallbackBase* mCallbackFunction; }; -} // Dali +} // namespace Dali -#endif /* __DALI_TEST_PLATFORM_ABSTRACTION_H__ */ +#endif /* DALI_TEST_PLATFORM_ABSTRACTION_H */