(AutomatedTests) Merged managed & unmanaged tests
[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::SaveFile()
376  */
377 bool TestPlatformAbstraction::SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const
378 {
379   mTrace.PushCall("SaveFile", "");
380   return false;
381 }
382
383 void TestPlatformAbstraction::JoinLoaderThreads()
384 {
385   mTrace.PushCall("JoinLoaderThreads", "");
386 }
387
388 void TestPlatformAbstraction::UpdateDefaultsFromDevice()
389 {
390   mTrace.PushCall("UpdateDefaultsFromDevice", "");
391   mGetDefaultFontFamilyResult+=1.0f;
392 }
393
394 Integration::DynamicsFactory* TestPlatformAbstraction::GetDynamicsFactory()
395 {
396   mTrace.PushCall("GetDynamicsFactory", "");
397   if( mDynamicsFactory == NULL )
398   {
399     mDynamicsFactory = new TestDynamicsFactory( mTrace );
400   }
401   return mDynamicsFactory;
402 }
403
404 bool TestPlatformAbstraction::ReadGlobalMetricsFromCache( const std::string& fontFamily,
405                                                           const std::string& fontStyle,
406                                                           Integration::GlobalMetrics& globalMetrics )
407 {
408   mTrace.PushCall("ReadGlobalMetricsFromCacheFile", "");
409   globalMetrics = mReadGlobalMetrics; // Want to copy contents...
410   return mReadGlobalMetricsResult; // Default false (will be set to true on subsequent write)
411 }
412
413 void TestPlatformAbstraction::WriteGlobalMetricsToCache( const std::string& fontFamily,
414                                                          const std::string& fontStyle,
415                                                          const Integration::GlobalMetrics& globalMetrics )
416 {
417   // Copy so next read uses written values. TODO: Could add method
418   // to turn this behaviour off for more extensive testing.
419   mReadGlobalMetrics = globalMetrics;
420   mReadGlobalMetricsResult = true;
421
422   mTrace.PushCall("WriteGlobalMetricsToCacheFile", "");
423 }
424
425 bool TestPlatformAbstraction::ReadMetricsFromCache( const std::string& fontFamily,
426                                                     const std::string& fontStyle,
427                                                     std::vector<Integration::GlyphMetrics>& glyphMetricsContainer )
428 {
429   mTrace.PushCall("ReadMetricsFromCacheFile", "");
430   glyphMetricsContainer = mReadMetrics;
431   return mReadMetricsResult; // Default false (will be set to true on subsequent write)
432 }
433
434 void TestPlatformAbstraction::WriteMetricsToCache( const std::string& fontFamily,
435                                                    const std::string& fontStyle,
436                                                    const Integration::GlyphSet& glyphSet )
437 {
438   // Copy so next read uses written values. TODO: Could add method
439   // to turn this behaviour off for more extensive testing.
440   const Integration::GlyphSet::CharacterList& charList =  glyphSet.GetCharacterList();
441   mReadMetrics.clear();
442   for(std::size_t i=0, end=charList.size(); i<end; ++i)
443   {
444     mReadMetrics.push_back(charList[i].second);
445   }
446   mReadMetricsResult = true;
447
448   mTrace.PushCall("WriteMetricsToCacheFile", "");
449 }
450
451 void TestPlatformAbstraction::GetFileNamesFromDirectory( const std::string& directoryName,
452                                                          std::vector<std::string>& fileNames )
453 {
454   fileNames.push_back( std::string( "u1f004.png" ) );
455   fileNames.push_back( std::string( "u1f0cf.png" ) );
456   fileNames.push_back( std::string( "u1f170.png" ) );
457   fileNames.push_back( std::string( "u1f601.png" ) );
458 }
459
460 Integration::BitmapPtr TestPlatformAbstraction::GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const
461 {
462   Integration::BitmapPtr image = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
463   image->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 1, 1 );
464
465   mTrace.PushCall("GetGlyphImage", "");
466
467   return image;
468 }
469
470 /** Call this every test */
471 void TestPlatformAbstraction::Initialize()
472 {
473   mTrace.Reset();
474   mTrace.Enable(true);
475   memset(&mResources, 0, sizeof(Resources));
476   memset(&mReadGlobalMetrics, 0, sizeof(Integration::GlobalMetrics));
477   mSeconds=0;
478   mMicroSeconds=0;
479   mIsLoadingResult=false;
480   mGetDefaultFontFamilyResult = "HelveticaNeue";
481   mGetDefaultFontSizeResult=12.0f;
482   mGetFontPathResult="helvetica-12";
483   mReadMetricsResult=false;
484   mReadGlobalMetricsResult=false;
485
486   if(mRequest)
487   {
488     delete mRequest;
489     mRequest = 0;
490   }
491 }
492
493
494 bool TestPlatformAbstraction::WasCalled(TestFuncEnum func)
495 {
496   switch(func)
497   {
498     case GetTimeMicrosecondsFunc:             return mTrace.FindMethod("GetTimeMicroseconds");
499     case SuspendFunc:                         return mTrace.FindMethod("Suspend");
500     case ResumeFunc:                          return mTrace.FindMethod("Resume");
501     case LoadResourceFunc:                    return mTrace.FindMethod("LoadResource");
502     case SaveResourceFunc:                    return mTrace.FindMethod("SaveResource");
503     case LoadFileFunc:                        return mTrace.FindMethod("LoadFile");
504     case SaveFileFunc:                        return mTrace.FindMethod("SaveFile");
505     case CancelLoadFunc:                      return mTrace.FindMethod("CancelLoad");
506     case GetResourcesFunc:                    return mTrace.FindMethod("GetResources");
507     case IsLoadingFunc:                       return mTrace.FindMethod("IsLoading");
508     case GetDefaultFontFamilyFunc:            return mTrace.FindMethod("GetDefaultFontFamily");
509     case GetDefaultFontSizeFunc:              return mTrace.FindMethod("GetDefaultFontSize");
510     case GetFontLineHeightFromCapsHeightFunc: return mTrace.FindMethod("GetFontLineHeightFromCapsHeight");
511     case GetGlyphDataFunc:                    return mTrace.FindMethod("GetGlyphData");
512     case GetCachedGlyphDataFunc:              return mTrace.FindMethod("GetCachedGlyphData");
513     case GetFontPathFunc:                     return mTrace.FindMethod("GetFontPath");
514     case SetDpiFunc:                          return mTrace.FindMethod("SetDpi");
515     case JoinLoaderThreadsFunc:               return mTrace.FindMethod("JoinLoaderThreads");
516     case GetFontFamilyForCharsFunc:           return mTrace.FindMethod("GetFontFamilyForChars");
517     case AllGlyphsSupportedFunc:              return mTrace.FindMethod("AllGlyphsSupported");
518     case ValidateFontFamilyNameFunc:          return mTrace.FindMethod("ValidateFontFamilyName");
519     case UpdateDefaultsFromDeviceFunc:        return mTrace.FindMethod("UpdateDefaultsFromDevice");
520     case GetDynamicsFactoryFunc:              return mTrace.FindMethod("GetDynamicsFactory");
521     case ValidateGetFontListFunc:             return mTrace.FindMethod("ValidateGetFontList");
522     case ReadGlobalMetricsFromCacheFileFunc:  return mTrace.FindMethod("ReadGlobalMetricsFromCacheFile");
523     case WriteGlobalMetricsToCacheFileFunc:   return mTrace.FindMethod("WriteGlobalMetricsToCacheFile");
524     case ReadMetricsFromCacheFileFunc:        return mTrace.FindMethod("ReadMetricsFromCacheFile");
525     case WriteMetricsToCacheFileFunc:         return mTrace.FindMethod("WriteMetricsToCacheFile");
526   }
527   return false;
528 }
529
530 void TestPlatformAbstraction::SetGetTimeMicrosecondsResult(size_t sec, size_t usec)
531 {
532   mSeconds = sec;
533   mMicroSeconds = usec;
534 }
535
536 void TestPlatformAbstraction::IncrementGetTimeResult(size_t milliseconds)
537 {
538   mMicroSeconds += milliseconds * 1000u;
539   unsigned int additionalSeconds = mMicroSeconds / 1000000u;
540
541   mSeconds += additionalSeconds;
542   mMicroSeconds -= additionalSeconds * 1000000u;
543 }
544
545 void TestPlatformAbstraction::SetIsLoadingResult(bool result)
546 {
547   mIsLoadingResult = result;
548 }
549
550 void TestPlatformAbstraction::SetGetDefaultFontFamilyResult(std::string result)
551 {
552   mGetDefaultFontFamilyResult = result;
553 }
554
555 void TestPlatformAbstraction::SetGetDefaultFontSizeResult(float result)
556 {
557   mGetDefaultFontSizeResult = result;
558 }
559
560 void TestPlatformAbstraction::SetGetFontPathResult(std::string& result)
561 {
562   mGetFontPathResult = result;
563 }
564
565 void TestPlatformAbstraction::ClearReadyResources()
566 {
567   memset(&mResources, 0, sizeof(Resources));
568 }
569
570 void TestPlatformAbstraction::SetResourceLoaded(Integration::ResourceId  loadedId,
571                                                 Integration::ResourceTypeId  loadedType,
572                                                 Integration::ResourcePointer loadedResource)
573 {
574   mResources.loaded = true;
575   mResources.loadedId = loadedId;
576   mResources.loadedType = loadedType;
577   mResources.loadedResource = loadedResource;
578 }
579
580 void TestPlatformAbstraction::SetResourceLoadFailed(Integration::ResourceId  id,
581                                                     Integration::ResourceFailure failure)
582 {
583   mResources.loadFailed = true;
584   mResources.loadFailedId = id;
585   mResources.loadFailure = failure;
586 }
587
588 void TestPlatformAbstraction::SetResourceSaved(Integration::ResourceId      savedId,
589                                                Integration::ResourceTypeId  savedType)
590 {
591   mResources.saved = true;
592   mResources.savedId = savedId;
593   mResources.savedType = savedType;
594 }
595
596 void TestPlatformAbstraction::SetResourceSaveFailed(Integration::ResourceId  id,
597                                                     Integration::ResourceFailure failure)
598 {
599   mResources.saveFailed = true;
600   mResources.saveFailedId = id;
601   mResources.saveFailure = failure;
602 }
603
604 Integration::ResourceRequest* TestPlatformAbstraction::GetRequest()
605 {
606   return mRequest;
607 }
608
609 void TestPlatformAbstraction::DiscardRequest()
610 {
611   delete mRequest;
612   mRequest = NULL;
613 }
614
615 void TestPlatformAbstraction::SetClosestImageSize(const Vector2& size)
616 {
617   mClosestSize = size;
618 }
619
620 void TestPlatformAbstraction::SetLoadFileResult( bool result, std::vector< unsigned char >& buffer )
621 {
622   mLoadFileResult.loadResult = result;
623   if( result )
624   {
625     mLoadFileResult.buffer = buffer;
626   }
627 }
628
629 void TestPlatformAbstraction::SetSaveFileResult( bool result )
630 {
631   mSaveFileResult = result;
632 }
633
634 Integration::PlatformAbstraction::FontListMode TestPlatformAbstraction::GetLastFontListMode( )
635 {
636   return mFontListMode;
637 }
638
639 void TestPlatformAbstraction::SetReadGlobalMetricsResult( bool success, Integration::GlobalMetrics& globalMetrics )
640 {
641   mReadGlobalMetricsResult = success;
642   mReadGlobalMetrics = globalMetrics;
643 }
644
645 void TestPlatformAbstraction::SetReadMetricsResult( bool success, std::vector<Integration::GlyphMetrics>& glyphMetricsContainer )
646 {
647   mReadMetricsResult = success;
648   mReadMetrics = glyphMetricsContainer; // copy
649 }
650
651 } // namespace Dali