Adding 'override', removing 'virtual' from overriding functions' declarations in...
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-platform-abstraction.h
index 42e2d98..1adedd4 100644 (file)
@@ -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) 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.
@@ -26,6 +26,7 @@
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/platform-abstraction.h>
+#include <dali/public-api/math/vector2.h>
 
 #include "test-trace-call-stack.h"
 
@@ -35,13 +36,11 @@ 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:
 
-  typedef Vector< Integration::ResourceRequest* > ResourceRequestContainer;
-
   /**
    * Constructor
    */
@@ -50,116 +49,64 @@ public:
   /**
    * Destructor
    */
-  virtual ~TestPlatformAbstraction();
-
-  /**
-   * @copydoc PlatformAbstraction::Suspend()
-   */
-  virtual void Suspend();
-
-  /**
-   * @copydoc PlatformAbstraction::Resume()
-   */
-  virtual void Resume();
+  ~TestPlatformAbstraction() override;
 
   /**
    * @copydoc PlatformAbstraction::GetClosestImageSize()
    */
-  virtual ImageDimensions GetClosestImageSize( const std::string& filename,
+  ImageDimensions GetClosestImageSize( const std::string& filename,
                                                  ImageDimensions size,
                                                  FittingMode::Type fittingMode,
                                                  SamplingMode::Type samplingMode,
-                                                 bool orientationCorrection );
+                                                 bool orientationCorrection ) override;
 
   /**
    * @copydoc PlatformAbstraction::GetClosestImageSize()
    */
-  virtual ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
+  ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
                                                ImageDimensions size,
                                                FittingMode::Type fittingMode,
                                                SamplingMode::Type samplingMode,
-                                               bool orientationCorrection );
-
-  /**
-   * @copydoc PlatformAbstraction::LoadResource()
-   */
-  virtual void LoadResource(const Integration::ResourceRequest& request);
+                                               bool orientationCorrection ) override;
 
   /**
    * @copydoc PlatformAbstraction::LoadResourceSynchronously()
    */
-  virtual Integration::ResourcePointer LoadResourceSynchronously( const Integration::ResourceType& 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::ResourceType& resourceType, uint8_t * buffer, size_t size );
-
-  /**
-   * @copydoc PlatformAbstraction::CancelLoad()
-   */
-  virtual void CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId);
-
-  /**
-   * @copydoc PlatformAbstraction::GetResources()
-   */
-  virtual void GetResources(Integration::ResourceCache& cache);
+  Integration::BitmapPtr DecodeBuffer( const Dali::Integration::BitmapResourceType& resourceType, uint8_t * buffer, size_t size ) override;
 
   /**
-   * @copydoc PlatformAbstraction::IsLoading()
-   */
-  virtual bool IsLoading();
-
-  /**
-   * @copydoc PlatformAbstraction::GetDefaultFontSize()
+   * @copydoc PlatformAbstraction::LoadShaderBinaryFile()
    */
-  virtual int GetDefaultFontSize() const;
+  bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const override;
 
   /**
-   * @copydoc PlatformAbstraction::SetDpi()
+   * @copydoc PlatformAbstraction::SaveShaderBinaryFile()
    */
-  virtual void SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical);
+  virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const override { return true; }
 
   /**
-   * @copydoc PlatformAbstraction::LoadFile()
+   * @copydoc PlatformAbstraction::StartTimer()
    */
-  virtual bool LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
+  uint32_t StartTimer( uint32_t milliseconds, CallbackBase* callback ) override;
 
-  /**
-   * @copydoc PlatformAbstraction::LoadShaderBinaryFile()
+  /*
+   * @copydoc PlatformAbstraction::CancelTimer()
    */
-  virtual bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
-
-  /**
-   * @copydoc PlatformAbstraction::SaveFile()
-   */
-  virtual bool SaveFile(const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const;
-
- /**
-  * @copydoc PlatformAbstraction::SaveShaderBinaryFile()
-  */
-  virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const { return true; }
-
-  virtual void JoinLoaderThreads();
+  void CancelTimer ( uint32_t timerId ) override;
 
 public: // TEST FUNCTIONS
 
   // Enumeration of Platform Abstraction methods
   typedef enum
   {
-    SuspendFunc,
-    ResumeFunc,
-    LoadResourceFunc,
     LoadResourceSynchronouslyFunc,
-    SaveFileFunc,
-    LoadFileFunc,
     LoadShaderBinaryFileFunc,
-    SaveShaderBinaryFileFunc,
-    CancelLoadFunc,
-    GetResourcesFunc,
-    IsLoadingFunc,
-    SetDpiFunc,
-    JoinLoaderThreadsFunc,
+    SaveShaderBinaryFileFunc
   } TestFuncEnum;
 
   /** Call this every test */
@@ -183,67 +130,15 @@ public: // TEST FUNCTIONS
   void SetIsLoadingResult(bool result);
 
   /**
-   * @brief Sets the value returned by GetDefaultFontSize
-   * @param[in] result The value to return
-   */
-  void SetGetDefaultFontSizeResult(float result);
-
-  /**
    * @brief Clears all resource queues
    */
   void ClearReadyResources();
 
   /**
-   * @brief Sets a particular resource request as loaded.
-   * @param[in] loadedId The ResourceID of the resource that has been loaded.
-   * @param[in] loadedType The type of resource that has been loaded.
-   * @param[in] loadedResource A pointer to the resource that has been loaded.
-   */
-  void SetResourceLoaded(Integration::ResourceId  loadedId,
-                         Integration::ResourceTypeId  loadedType,
-                         Integration::ResourcePointer loadedResource);
-
-  /**
-   * @brief Sets a particular resource request as load failure.
-   * @param[in] id The ID of the failed resource request.
-   * @param[in] failure The type of failure.
-   */
-  void SetResourceLoadFailed(Integration::ResourceId  id,
-                             Integration::ResourceFailure failure);
-
-  /**
-   * @brief Retrieves the latest resource request
-   * @return A pointer to the latest resource request.
-   */
-  Integration::ResourceRequest* GetRequest();
-
-  /**
-   * @brief Retrieves a reference to a container of all the resource requests.
-   * @return A reference to a container of all the resource requests.
-   */
-  const ResourceRequestContainer& GetAllRequests() const;
-
-  /**
-   * @brief Sets all resource requests as loaded.
-   */
-  void SetAllResourceRequestsAsLoaded();
-
-  /**
-   * @brief Sets all resource requests as loaded.
-   * @param[in] failure The failure type
-   */
-  void SetAllResourceRequestsAsFailed( Integration::ResourceFailure failure );
-
-  /**
-   * @brief Discards all current resource requests.
-   */
-  void DiscardRequest();
-
-  /**
    * @brief Sets the value returned by GetClosestImageSize.
    * @param[in] size The size that should be returned.
    */
-  void SetClosestImageSize(const Vector2& size);
+  void SetClosestImageSize( const Vector2& size );
 
   /**
    * @brief Sets the result return by LoadFile.
@@ -270,6 +165,11 @@ public: // TEST FUNCTIONS
    */
   void SetDecodedBitmap( Integration::BitmapPtr bitmap );
 
+  /**
+   * @brief Triggers the previously stored callback function
+   */
+  void TriggerTimer();
+
 private:
 
   TestPlatformAbstraction( const TestPlatformAbstraction& ); ///< Undefined
@@ -277,19 +177,6 @@ private:
 
 private:
 
-  struct LoadedResource
-  {
-    Integration::ResourceId      id;
-    Integration::ResourceTypeId  type;
-    Integration::ResourcePointer resource;
-  };
-
-  struct FailedLoad
-  {
-    Integration::ResourceId      id;
-    Integration::ResourceFailure failure;
-  };
-
   struct LoadFileResult
   {
     inline LoadFileResult()
@@ -302,25 +189,20 @@ private:
     Dali::Vector< unsigned char> buffer;
   };
 
-  typedef std::vector< LoadedResource > LoadedResourceContainer;
-  typedef std::vector< FailedLoad > FailedLoadContainer;
-
   mutable TraceCallStack        mTrace;
   bool                          mIsLoadingResult;
-  int                           mGetDefaultFontSizeResult;
-  LoadedResourceContainer       mLoadedResourcesQueue;
-  FailedLoadContainer           mFailedLoadQueue;
-  ResourceRequestContainer      mResourceRequests;
-  Vector2                       mSize;
-  Vector2                       mClosestSize;
+  ImageDimensions               mClosestSize;
 
   LoadFileResult                mLoadFileResult;
   bool                          mSaveFileResult;
 
   Integration::ResourcePointer  mSynchronouslyLoadedResource;
   Integration::BitmapPtr        mDecodedBitmap;
+
+  uint32_t                      mTimerId;
+  CallbackBase*                 mCallbackFunction;
 };
 
 } // Dali
 
-#endif /* __DALI_TET_PLATFORM_ABSTRACTION_H__ */
+#endif /* DALI_TEST_PLATFORM_ABSTRACTION_H */