Dali 3D User Interface Engine
test-platform-abstraction.h
Go to the documentation of this file.
1 #ifndef __DALI_TEST_PLATFORM_ABSTRACTION_H__
2 #define __DALI_TEST_PLATFORM_ABSTRACTION_H__
3 
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20 
21 // EXTERNAL INCLUDES
22 #include <stdint.h>
23 #include <cstring>
24 #include <string>
25 
26 // INTERNAL INCLUDES
28 
29 #include "test-trace-call-stack.h"
30 
31 namespace Dali
32 {
33 
38 {
39 
40 public:
41 
42  struct Resources
43  {
44  bool loaded;
48 
49  bool loadFailed;
52  };
53 
55  {
56  inline LoadFileResult()
57  : loadResult(false)
58  {
59 
60  }
61 
62  bool loadResult;
64  };
65 
70 
74  virtual ~TestPlatformAbstraction();
75 
79  virtual void Suspend();
80 
84  virtual void Resume();
85 
89  virtual ImageDimensions GetClosestImageSize( const std::string& filename,
90  ImageDimensions size,
91  FittingMode::Type fittingMode,
92  SamplingMode::Type samplingMode,
93  bool orientationCorrection );
94 
99  ImageDimensions size,
100  FittingMode::Type fittingMode,
101  SamplingMode::Type samplingMode,
102  bool orientationCorrection );
103 
107  virtual void LoadResource(const Integration::ResourceRequest& request);
108 
112  virtual Integration::ResourcePointer LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath );
113 
117  virtual Integration::BitmapPtr DecodeBuffer( const Dali::Integration::ResourceType& resourceType, uint8_t * buffer, size_t size );
118 
122  virtual void CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId);
123 
127  virtual void GetResources(Integration::ResourceCache& cache);
128 
132  virtual bool IsLoading();
133 
137  virtual int GetDefaultFontSize() const;
138 
142  virtual void SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical);
143 
147  virtual bool LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
148 
152  virtual bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
153 
157  virtual bool SaveFile(const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const;
158 
162  virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const { return true; }
163 
164  virtual void JoinLoaderThreads();
165 
166 public: // TEST FUNCTIONS
167 
168  // Enumeration of Platform Abstraction methods
169  typedef enum
170  {
183  } TestFuncEnum;
184 
186  void Initialize();
187 
188  inline void EnableTrace(bool enable) { mTrace.Enable(enable); }
189  inline void ResetTrace() { mTrace.Reset(); }
190  inline TraceCallStack& GetTrace() { return mTrace; }
191 
192  bool WasCalled(TestFuncEnum func);
193 
194  void SetIsLoadingResult(bool result);
195 
196  void SetGetDefaultFontSizeResult(float result);
197 
198  void ClearReadyResources();
199 
200  void SetResourceLoaded(Integration::ResourceId loadedId,
201  Integration::ResourceTypeId loadedType,
202  Integration::ResourcePointer loadedResource);
203 
204  void SetResourceLoadFailed(Integration::ResourceId id,
206 
207  Integration::ResourceRequest* GetRequest();
208 
209  void DiscardRequest();
210 
211  void SetClosestImageSize(const Vector2& size);
212 
213  void SetLoadFileResult( bool result, Dali::Vector< unsigned char >& buffer );
214 
215  void SetSaveFileResult( bool result );
216 
217 private:
225 
228 };
229 
230 } // Dali
231 
232 #endif /* __DALI_TET_PLATFORM_ABSTRACTION_H__ */
Dali Docs Home
Read more about Dali