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