Merge "Remove unsafe new-delete pair from program and change unoptimal resizes to...
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / dali-test-suite-utils / test-platform-abstraction.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include "test-platform-abstraction.h"
19 #include "dali-test-suite-utils.h"
20 #include <dali/integration-api/bitmap.h>
21
22 namespace Dali
23 {
24
25 /**
26  * Constructor
27  */
28 TestPlatformAbstraction::TestPlatformAbstraction()
29 : mRequest(0),
30   mDynamicsFactory(NULL)
31 {
32   Initialize();
33 }
34
35 /**
36  * Destructor
37  */
38 TestPlatformAbstraction::~TestPlatformAbstraction()
39 {
40   delete mDynamicsFactory;
41 }
42
43 /**
44  * @copydoc PlatformAbstraction::GetTimeMicroseconds()
45  */
46 void TestPlatformAbstraction::GetTimeMicroseconds(unsigned int &seconds, unsigned int &microSeconds)
47 {
48   seconds = mSeconds;
49   microSeconds = mMicroSeconds;
50   mTrace.PushCall("GetTimeMicroseconds", "");
51 }
52
53 /**
54  * @copydoc PlatformAbstraction::Suspend()
55  */
56 void TestPlatformAbstraction::Suspend()
57 {
58   mTrace.PushCall("Suspend", "");
59 }
60
61 /**
62  * @copydoc PlatformAbstraction::Resume()
63  */
64 void TestPlatformAbstraction::Resume()
65 {
66   mTrace.PushCall("Resume", "");
67 }
68
69 void TestPlatformAbstraction::GetClosestImageSize( const std::string& filename,
70                                                    const ImageAttributes& attributes,
71                                                    Vector2& closestSize)
72 {
73   closestSize = mClosestSize;
74   mTrace.PushCall("GetClosestImageSize", "");
75 }
76
77 void TestPlatformAbstraction::GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
78                                                    const ImageAttributes& attributes,
79                                                    Vector2& closestSize)
80 {
81   closestSize = mClosestSize;
82   mTrace.PushCall("GetClosestImageSize", "");
83 }
84
85
86 /**
87  * @copydoc PlatformAbstraction::LoadResource()
88  */
89 void TestPlatformAbstraction::LoadResource(const Integration::ResourceRequest& request)
90 {
91   std::ostringstream out;
92   out << "Type:";
93   if( request.GetType()->id == Integration::ResourceText )
94   {
95     out << "Text";
96   }
97   else
98   {
99     out << request.GetType()->id;
100   }
101   out << ", Path: " << request.GetPath() << std::endl ;
102
103   mTrace.PushCall("LoadResource", out.str());
104   if(mRequest != NULL)
105   {
106     delete mRequest;
107     tet_infoline ("Warning: multiple resource requests not handled by Test Suite. You may see unexpected errors");
108   }
109   mRequest = new Integration::ResourceRequest(request);
110 }
111
112 Integration::ResourcePointer TestPlatformAbstraction::LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath )
113 {
114   mTrace.PushCall("LoadResourceSynchronously", "");
115   return mResources.loadedResource;
116 }
117
118 /**
119  * @copydoc PlatformAbstraction::SaveResource()
120  */
121 void TestPlatformAbstraction::SaveResource(const Integration::ResourceRequest& request)
122 {
123   mTrace.PushCall("SaveResource", "");
124   if(mRequest != NULL)
125   {
126     delete mRequest;
127     tet_infoline ("Warning: multiple resource requests not handled by Test Suite. You may see unexpected errors");
128   }
129   mRequest = new Integration::ResourceRequest(request);
130 }
131
132 /**
133  * @copydoc PlatformAbstraction::CancelLoad()
134  */
135 void TestPlatformAbstraction::CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId)
136 {
137   mTrace.PushCall("CancelLoad", "");
138 }
139
140 /**
141  * @copydoc PlatformAbstraction::GetResources()
142  */
143 void TestPlatformAbstraction::GetResources(Integration::ResourceCache& cache)
144 {
145   mTrace.PushCall("GetResources", "");
146
147   if(mResources.loaded)
148   {
149     cache.LoadResponse( mResources.loadedId, mResources.loadedType, mResources.loadedResource, Integration::RESOURCE_COMPLETELY_LOADED );
150   }
151   if(mResources.loadFailed)
152   {
153     cache.LoadFailed( mResources.loadFailedId, mResources.loadFailure );
154   }
155   if(mResources.saved)
156   {
157     cache.SaveComplete( mResources.savedId, mResources.savedType );
158   }
159   if(mResources.saveFailed)
160   {
161     cache.SaveFailed( mResources.saveFailedId, mResources.saveFailure );
162   }
163 }
164
165 /**
166  * @copydoc PlatformAbstraction::IsLoading()
167  */
168 bool TestPlatformAbstraction::IsLoading()
169 {
170   mTrace.PushCall("IsLoading", "");
171   return mIsLoadingResult;
172 }
173
174 /**
175  * @copydoc PlatformAbstraction::GetDefaultFontFamily()
176  */
177 const std::string& TestPlatformAbstraction::GetDefaultFontFamily() const
178 {
179   mTrace.PushCall("GetDefaultFontFamily", "");
180   return mGetDefaultFontFamilyResult;
181 }
182
183 /**
184  * @copydoc PlatformAbstraction::GetDefaultFontSize()
185  */
186 float TestPlatformAbstraction::GetDefaultFontSize() const
187 {
188   mTrace.PushCall("GetDefaultFontSize", "");
189   return mGetDefaultFontSizeResult;
190 }
191
192 PixelSize TestPlatformAbstraction::GetFontLineHeightFromCapsHeight(const std::string& fontFamily, const std::string& fontStyle, CapsHeight capsHeight) const
193 {
194   mTrace.PushCall("GetFontLineHeightFromCapsHeight", "");
195   // LineHeight will be bigger than CapsHeight, so return capsHeight + 1
196   return PixelSize(capsHeight + 1);
197 }
198
199 /**
200  * @copydoc PlatformAbstraction::GetGlyphData()
201  */
202
203 Integration::GlyphSet* TestPlatformAbstraction::GetGlyphData ( const Integration::TextResourceType& textRequest,
204                                                                const std::string& fontFamily,
205                                                                bool getBitmap) const
206 {
207   if( getBitmap )
208   {
209     mTrace.PushCall("GetGlyphData", "getBitmap:true");
210   }
211   else
212   {
213     mTrace.PushCall("GetGlyphData", "getBitmap:false");
214   }
215
216   // It creates fake metrics for the received characters.
217
218   Integration::GlyphSet* set = new Dali::Integration::GlyphSet();
219   Integration::BitmapPtr bitmapData;
220
221   std::set<uint32_t> characters;
222
223   for( Integration::TextResourceType::CharacterList::const_iterator it = textRequest.mCharacterList.begin(), endIt = textRequest.mCharacterList.end(); it != endIt; ++it )
224   {
225     if( characters.find( it->character ) == characters.end() )
226     {
227       characters.insert( it->character );
228       Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::LOW_QUALITY,  10.0f,  10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition };
229
230       if( getBitmap )
231       {
232         bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD);
233         bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
234         PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
235         memset( pixelBuffer, it->character, 64*64 );
236       }
237
238       set->AddCharacter(bitmapData, character);
239     }
240   }
241
242   set->mLineHeight = 10.0f;
243   set->mAscender = 9.0f;
244   set->mUnitsPerEM = 2048.0f/64.0f;
245   set->SetAtlasResourceId( textRequest.mTextureAtlasId );
246   set->mFontHash = textRequest.mFontHash;
247
248   return set;
249 }
250
251 /**
252  * @copydoc PlatformAbstraction::GetCachedGlyphData()
253  */
254
255 Integration::GlyphSet* TestPlatformAbstraction::GetCachedGlyphData( const Integration::TextResourceType& textRequest,
256                                                                     const std::string& fontFamily ) const
257 {
258   mTrace.PushCall("GetCachedGlyphData", "");
259
260   // It creates fake metrics and bitmap for received numeric characters '0' through '9'.
261   Integration::GlyphSet* set = new Dali::Integration::GlyphSet();
262   Integration::BitmapPtr bitmapData;
263
264   std::set<uint32_t> characters;
265
266   for( Integration::TextResourceType::CharacterList::const_iterator it = textRequest.mCharacterList.begin(), endIt = textRequest.mCharacterList.end(); it != endIt; ++it )
267   {
268     if( it->character >= '0' && it->character <= '9' && characters.find( it->character ) == characters.end() )
269     {
270       characters.insert( it->character );
271       Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::HIGH_QUALITY,  10.0f,  10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition };
272
273       bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD);
274       bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
275       PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
276       memset( pixelBuffer, it->character, 64*64 );
277       set->AddCharacter(bitmapData, character);
278     }
279   }
280
281   set->mLineHeight = 10.0f;
282   set->mAscender = 9.0f;
283   set->mUnitsPerEM = 2048.0f/64.0f;
284   set->SetAtlasResourceId( textRequest.mTextureAtlasId );
285   set->mFontHash = textRequest.mFontHash;
286
287   return set;
288 }
289
290
291 /**
292  * @copydoc PlatformAbstraction::GetGlobalMetrics()
293  */
294 void TestPlatformAbstraction::GetGlobalMetrics( const std::string& fontFamily,
295                                                 const std::string& fontStyle,
296                                                 Integration::GlobalMetrics& globalMetrics ) const
297 {
298   globalMetrics.lineHeight = 10.0f;
299   globalMetrics.ascender = 9.0f;
300   globalMetrics.unitsPerEM = 2048.0f/64.0f;
301   globalMetrics.underlineThickness = 2.f;
302   globalMetrics.underlinePosition = 1.f;
303 }
304
305 /**
306  * @copydoc PlatformAbstraction::GetFontPath()
307  */
308 std::string TestPlatformAbstraction::GetFontPath(const std::string& family, bool bold, bool italic) const
309 {
310   mTrace.PushCall("GetFontPath", "");
311   return mGetFontPathResult;
312
313   // Do nothing with arguments
314 }
315
316 /**
317  * @copydoc PlatformAbstraction::SetDpi()
318  */
319 void TestPlatformAbstraction::SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical)
320 {
321   mTrace.PushCall("SetDpi", "");
322 }
323
324 /**
325  * @copydoc PlatformAbstraction::GetFontFamilyForChars()
326  */
327 const std::string& TestPlatformAbstraction::GetFontFamilyForChars(const Integration::TextArray& charsRequested) const
328 {
329   mTrace.PushCall("GetFontFamilyForChars", "");
330   return mGetDefaultFontFamilyResult;
331 }
332
333 /**
334  * @copydoc PlatformAbstraction::AllGlyphsSupported()
335  */
336 bool TestPlatformAbstraction::AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const Integration::TextArray& text) const
337 {
338   mTrace.PushCall("AllGlyphsSupported", "");
339   return true;
340 }
341
342 /**
343  * @copydoc PlatformAbstraction::ValidateFontFamilyName()
344  */
345 bool TestPlatformAbstraction::ValidateFontFamilyName(const std::string& fontFamily, const std::string& fontStyle, bool& isDefaultSystemFont, std::string& closestMatch, std::string& closestStyleMatch) const
346 {
347   mTrace.PushCall("ValidateFontFamilyName", "");
348   return true;
349 }
350
351 /**
352  * @copydoc PlatformAbstraction::GetFontList()
353  */
354 void TestPlatformAbstraction::GetFontList( PlatformAbstraction::FontListMode mode, std::vector<std::string>& fontList ) const
355 {
356   mFontListMode = mode;
357   mTrace.PushCall("ValidateGetFontList", "");
358 }
359
360 /**
361  * @copydoc PlatformAbstraction::LoadFile()
362  */
363 bool TestPlatformAbstraction::LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const
364 {
365   mTrace.PushCall("LoadFile", "");
366   if( mLoadFileResult.loadResult )
367   {
368     buffer = mLoadFileResult.buffer;
369   }
370
371   return mLoadFileResult.loadResult;
372 }
373
374 /**
375  * @copydoc PlatformAbstraction::LoadShaderBinFile()
376  */
377 bool TestPlatformAbstraction::LoadShaderBinFile( const std::string& filename, std::vector< unsigned char >& buffer ) const
378 {
379   mTrace.PushCall("LoadShaderBinFile", "");
380   if( mLoadFileResult.loadResult )
381   {
382     buffer = mLoadFileResult.buffer;
383   }
384
385   return mLoadFileResult.loadResult;
386 }
387
388 /**
389  * @copydoc PlatformAbstraction::SaveFile()
390  */
391 bool TestPlatformAbstraction::SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const
392 {
393   mTrace.PushCall("SaveFile", "");
394   return false;
395 }
396
397 void TestPlatformAbstraction::JoinLoaderThreads()
398 {
399   mTrace.PushCall("JoinLoaderThreads", "");
400 }
401
402 void TestPlatformAbstraction::UpdateDefaultsFromDevice()
403 {
404   mTrace.PushCall("UpdateDefaultsFromDevice", "");
405   mGetDefaultFontFamilyResult+=1.0f;
406 }
407
408 Integration::DynamicsFactory* TestPlatformAbstraction::GetDynamicsFactory()
409 {
410   mTrace.PushCall("GetDynamicsFactory", "");
411   if( mDynamicsFactory == NULL )
412   {
413     mDynamicsFactory = new TestDynamicsFactory( mTrace );
414   }
415   return mDynamicsFactory;
416 }
417
418 bool TestPlatformAbstraction::ReadGlobalMetricsFromCache( const std::string& fontFamily,
419                                                           const std::string& fontStyle,
420                                                           Integration::GlobalMetrics& globalMetrics )
421 {
422   mTrace.PushCall("ReadGlobalMetricsFromCacheFile", "");
423   globalMetrics = mReadGlobalMetrics; // Want to copy contents...
424   return mReadGlobalMetricsResult; // Default false (will be set to true on subsequent write)
425 }
426
427 void TestPlatformAbstraction::WriteGlobalMetricsToCache( const std::string& fontFamily,
428                                                          const std::string& fontStyle,
429                                                          const Integration::GlobalMetrics& globalMetrics )
430 {
431   // Copy so next read uses written values. TODO: Could add method
432   // to turn this behaviour off for more extensive testing.
433   mReadGlobalMetrics = globalMetrics;
434   mReadGlobalMetricsResult = true;
435
436   mTrace.PushCall("WriteGlobalMetricsToCacheFile", "");
437 }
438
439 bool TestPlatformAbstraction::ReadMetricsFromCache( const std::string& fontFamily,
440                                                     const std::string& fontStyle,
441                                                     std::vector<Integration::GlyphMetrics>& glyphMetricsContainer )
442 {
443   mTrace.PushCall("ReadMetricsFromCacheFile", "");
444   glyphMetricsContainer = mReadMetrics;
445   return mReadMetricsResult; // Default false (will be set to true on subsequent write)
446 }
447
448 void TestPlatformAbstraction::WriteMetricsToCache( const std::string& fontFamily,
449                                                    const std::string& fontStyle,
450                                                    const Integration::GlyphSet& glyphSet )
451 {
452   // Copy so next read uses written values. TODO: Could add method
453   // to turn this behaviour off for more extensive testing.
454   const Integration::GlyphSet::CharacterList& charList =  glyphSet.GetCharacterList();
455   mReadMetrics.clear();
456   for(std::size_t i=0, end=charList.size(); i<end; ++i)
457   {
458     mReadMetrics.push_back(charList[i].second);
459   }
460   mReadMetricsResult = true;
461
462   mTrace.PushCall("WriteMetricsToCacheFile", "");
463 }
464
465 void TestPlatformAbstraction::GetFileNamesFromDirectory( const std::string& directoryName,
466                                                          std::vector<std::string>& fileNames )
467 {
468   fileNames.push_back( std::string( "u1f004.png" ) );
469   fileNames.push_back( std::string( "u1f0cf.png" ) );
470   fileNames.push_back( std::string( "u1f170.png" ) );
471   fileNames.push_back( std::string( "u1f601.png" ) );
472 }
473
474 Integration::BitmapPtr TestPlatformAbstraction::GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const
475 {
476   Integration::BitmapPtr image = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
477   image->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 1, 1 );
478
479   mTrace.PushCall("GetGlyphImage", "");
480
481   return image;
482 }
483
484 /** Call this every test */
485 void TestPlatformAbstraction::Initialize()
486 {
487   mTrace.Reset();
488   mTrace.Enable(true);
489   memset(&mResources, 0, sizeof(Resources));
490   memset(&mReadGlobalMetrics, 0, sizeof(Integration::GlobalMetrics));
491   mSeconds=0;
492   mMicroSeconds=0;
493   mIsLoadingResult=false;
494   mGetDefaultFontFamilyResult = "HelveticaNeue";
495   mGetDefaultFontSizeResult=12.0f;
496   mGetFontPathResult="helvetica-12";
497   mReadMetricsResult=false;
498   mReadGlobalMetricsResult=false;
499
500   if(mRequest)
501   {
502     delete mRequest;
503     mRequest = 0;
504   }
505 }
506
507
508 bool TestPlatformAbstraction::WasCalled(TestFuncEnum func)
509 {
510   switch(func)
511   {
512     case GetTimeMicrosecondsFunc:             return mTrace.FindMethod("GetTimeMicroseconds");
513     case SuspendFunc:                         return mTrace.FindMethod("Suspend");
514     case ResumeFunc:                          return mTrace.FindMethod("Resume");
515     case LoadResourceFunc:                    return mTrace.FindMethod("LoadResource");
516     case SaveResourceFunc:                    return mTrace.FindMethod("SaveResource");
517     case LoadFileFunc:                        return mTrace.FindMethod("LoadFile");
518     case SaveFileFunc:                        return mTrace.FindMethod("SaveFile");
519     case CancelLoadFunc:                      return mTrace.FindMethod("CancelLoad");
520     case GetResourcesFunc:                    return mTrace.FindMethod("GetResources");
521     case IsLoadingFunc:                       return mTrace.FindMethod("IsLoading");
522     case GetDefaultFontFamilyFunc:            return mTrace.FindMethod("GetDefaultFontFamily");
523     case GetDefaultFontSizeFunc:              return mTrace.FindMethod("GetDefaultFontSize");
524     case GetFontLineHeightFromCapsHeightFunc: return mTrace.FindMethod("GetFontLineHeightFromCapsHeight");
525     case GetGlyphDataFunc:                    return mTrace.FindMethod("GetGlyphData");
526     case GetCachedGlyphDataFunc:              return mTrace.FindMethod("GetCachedGlyphData");
527     case GetFontPathFunc:                     return mTrace.FindMethod("GetFontPath");
528     case SetDpiFunc:                          return mTrace.FindMethod("SetDpi");
529     case JoinLoaderThreadsFunc:               return mTrace.FindMethod("JoinLoaderThreads");
530     case GetFontFamilyForCharsFunc:           return mTrace.FindMethod("GetFontFamilyForChars");
531     case AllGlyphsSupportedFunc:              return mTrace.FindMethod("AllGlyphsSupported");
532     case ValidateFontFamilyNameFunc:          return mTrace.FindMethod("ValidateFontFamilyName");
533     case UpdateDefaultsFromDeviceFunc:        return mTrace.FindMethod("UpdateDefaultsFromDevice");
534     case GetDynamicsFactoryFunc:              return mTrace.FindMethod("GetDynamicsFactory");
535     case ValidateGetFontListFunc:             return mTrace.FindMethod("ValidateGetFontList");
536     case ReadGlobalMetricsFromCacheFileFunc:  return mTrace.FindMethod("ReadGlobalMetricsFromCacheFile");
537     case WriteGlobalMetricsToCacheFileFunc:   return mTrace.FindMethod("WriteGlobalMetricsToCacheFile");
538     case ReadMetricsFromCacheFileFunc:        return mTrace.FindMethod("ReadMetricsFromCacheFile");
539     case WriteMetricsToCacheFileFunc:         return mTrace.FindMethod("WriteMetricsToCacheFile");
540   }
541   return false;
542 }
543
544 void TestPlatformAbstraction::SetGetTimeMicrosecondsResult(size_t sec, size_t usec)
545 {
546   mSeconds = sec;
547   mMicroSeconds = usec;
548 }
549
550 void TestPlatformAbstraction::IncrementGetTimeResult(size_t milliseconds)
551 {
552   mMicroSeconds += milliseconds * 1000u;
553   unsigned int additionalSeconds = mMicroSeconds / 1000000u;
554
555   mSeconds += additionalSeconds;
556   mMicroSeconds -= additionalSeconds * 1000000u;
557 }
558
559 void TestPlatformAbstraction::SetIsLoadingResult(bool result)
560 {
561   mIsLoadingResult = result;
562 }
563
564 void TestPlatformAbstraction::SetGetDefaultFontFamilyResult(std::string result)
565 {
566   mGetDefaultFontFamilyResult = result;
567 }
568
569 void TestPlatformAbstraction::SetGetDefaultFontSizeResult(float result)
570 {
571   mGetDefaultFontSizeResult = result;
572 }
573
574 void TestPlatformAbstraction::SetGetFontPathResult(std::string& result)
575 {
576   mGetFontPathResult = result;
577 }
578
579 void TestPlatformAbstraction::ClearReadyResources()
580 {
581   memset(&mResources, 0, sizeof(Resources));
582 }
583
584 void TestPlatformAbstraction::SetResourceLoaded(Integration::ResourceId  loadedId,
585                                                 Integration::ResourceTypeId  loadedType,
586                                                 Integration::ResourcePointer loadedResource)
587 {
588   mResources.loaded = true;
589   mResources.loadedId = loadedId;
590   mResources.loadedType = loadedType;
591   mResources.loadedResource = loadedResource;
592 }
593
594 void TestPlatformAbstraction::SetResourceLoadFailed(Integration::ResourceId  id,
595                                                     Integration::ResourceFailure failure)
596 {
597   mResources.loadFailed = true;
598   mResources.loadFailedId = id;
599   mResources.loadFailure = failure;
600 }
601
602 void TestPlatformAbstraction::SetResourceSaved(Integration::ResourceId      savedId,
603                                                Integration::ResourceTypeId  savedType)
604 {
605   mResources.saved = true;
606   mResources.savedId = savedId;
607   mResources.savedType = savedType;
608 }
609
610 void TestPlatformAbstraction::SetResourceSaveFailed(Integration::ResourceId  id,
611                                                     Integration::ResourceFailure failure)
612 {
613   mResources.saveFailed = true;
614   mResources.saveFailedId = id;
615   mResources.saveFailure = failure;
616 }
617
618 Integration::ResourceRequest* TestPlatformAbstraction::GetRequest()
619 {
620   return mRequest;
621 }
622
623 void TestPlatformAbstraction::DiscardRequest()
624 {
625   delete mRequest;
626   mRequest = NULL;
627 }
628
629 void TestPlatformAbstraction::SetClosestImageSize(const Vector2& size)
630 {
631   mClosestSize = size;
632 }
633
634 void TestPlatformAbstraction::SetLoadFileResult( bool result, std::vector< unsigned char >& buffer )
635 {
636   mLoadFileResult.loadResult = result;
637   if( result )
638   {
639     mLoadFileResult.buffer = buffer;
640   }
641 }
642
643 void TestPlatformAbstraction::SetSaveFileResult( bool result )
644 {
645   mSaveFileResult = result;
646 }
647
648 Integration::PlatformAbstraction::FontListMode TestPlatformAbstraction::GetLastFontListMode( )
649 {
650   return mFontListMode;
651 }
652
653 void TestPlatformAbstraction::SetReadGlobalMetricsResult( bool success, Integration::GlobalMetrics& globalMetrics )
654 {
655   mReadGlobalMetricsResult = success;
656   mReadGlobalMetrics = globalMetrics;
657 }
658
659 void TestPlatformAbstraction::SetReadMetricsResult( bool success, std::vector<Integration::GlyphMetrics>& glyphMetricsContainer )
660 {
661   mReadMetricsResult = success;
662   mReadMetrics = glyphMetricsContainer; // copy
663 }
664
665 } // namespace Dali