ResourceImage/Image split
[platform/core/uifw/dali-core.git] / automated-tests / src / dali-internal / utc-Dali-Internal-ImageFactory.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 <iostream>
19
20 #include <stdlib.h>
21 #include <dali/public-api/dali-core.h>
22 #include <dali-test-suite-utils.h>
23
24 // Internal headers are allowed here
25 #include <dali/internal/event/common/thread-local-storage.h>
26 #include <dali/internal/event/images/image-factory.h>
27 #include <dali/internal/event/resources/resource-ticket.h>
28
29 using namespace Dali;
30
31 using Internal::ResourceTicketPtr;
32 using Internal::ImageFactory;
33 using Internal::ImageFactoryCache::RequestPtr;
34
35
36 namespace
37 {
38
39 static const char* gTestImageFilename = "icon_wrt.png";
40
41 static void EmulateImageLoaded( TestApplication& application, unsigned int width, unsigned int height )
42 {
43   // emulate load success
44   Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
45   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS,  ResourcePolicy::DISCARD );
46   Integration::ResourcePointer resource( bitmap );
47   bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, width, height, width, height );
48   if( request )
49   {
50     application.GetPlatform().SetResourceLoaded( request->GetId(), request->GetType()->id, resource );
51   }
52
53   application.SendNotification();
54   application.Render();
55
56   application.SendNotification();
57   application.Render();
58 }
59
60 } //anonymous namespace
61
62
63 // High-level test for image factory request cache
64 int UtcDaliImageFactoryUseCachedRequest01(void)
65 {
66   TestApplication application;
67
68   tet_infoline( "UtcDaliImageFactoryCachedRequest01 - Request same image more than once" );
69
70   Image image = ResourceImage::New( gTestImageFilename );
71
72   application.SendNotification();
73   application.Render();
74   DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
75   application.GetPlatform().ResetTrace();
76
77   Image image2 = ResourceImage::New( gTestImageFilename );
78
79   application.SendNotification();
80   application.Render();
81
82   // check resource is not loaded twice
83   DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
84   application.GetPlatform().ResetTrace();
85
86   Image image3 = ResourceImage::New( gTestImageFilename );
87
88   application.SendNotification();
89   application.Render();
90   DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
91   END_TEST;
92 }
93
94 // High-level test for image factory request cache
95 int UtcDaliImageFactoryUseCachedRequest02(void)
96 {
97   TestApplication application;
98
99   // testing resource deletion when taken off stage
100   tet_infoline( "UtcDaliImageFactoryCachedRequest02 - Discard previously requested resource" );
101
102   Image image = ResourceImage::New( gTestImageFilename, ResourceImage::IMMEDIATE, Image::UNUSED );
103   ImageActor actor = ImageActor::New( image );
104
105   application.SendNotification();
106   application.Render();
107
108   DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
109   application.GetPlatform().ResetTrace();
110
111   // Add actor to stage
112   Stage::GetCurrent().Add( actor );
113
114   application.Render();
115   application.SendNotification();
116   application.Render();
117   application.SendNotification();
118
119   // Release the resource, request is still cached
120   Stage::GetCurrent().Remove( actor );
121   application.Render();
122   application.SendNotification();
123   application.Render();
124   application.SendNotification();
125
126   // Should find stale request in cache, so load image from filesystem
127   Image image2 = ResourceImage::New( gTestImageFilename );
128
129   application.SendNotification();
130   application.Render();
131
132   DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
133   application.GetPlatform().ResetTrace();
134
135   // Resource is reloaded
136   Image image3 = ResourceImage::New( gTestImageFilename );
137
138   application.SendNotification();
139   application.Render();
140   application.SendNotification();
141   application.Render();
142
143   DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
144   END_TEST;
145 }
146
147 // Low-level test for image factory request cache
148 int UtcDaliImageFactoryUseCachedRequest03(void)
149 {
150   TestApplication application;
151   tet_infoline( "UtcDaliImageFactoryCachedRequest03 - Request same image more than once - Request Ids" );
152
153   ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();
154
155   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
156   ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
157
158   RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, NULL );
159   ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );
160   DALI_TEST_EQUALS( req, req2, TEST_LOCATION );
161   DALI_TEST_EQUALS( ticket, ticket2, TEST_LOCATION );
162
163   req2 = imageFactory.RegisterRequest( gTestImageFilename, NULL );
164   ResourceTicketPtr ticket3 = imageFactory.Load( *req2.Get() );
165   DALI_TEST_EQUALS( req, req2, TEST_LOCATION );
166   DALI_TEST_EQUALS( ticket, ticket3, TEST_LOCATION );
167
168   // request differs in scaled size - not default size
169   ImageAttributes attr = ImageAttributes::New( 80, 160, Pixel::BGR8888 );
170   req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
171   ResourceTicketPtr ticket4 = imageFactory.Load( *req2.Get() );
172   DALI_TEST_CHECK( req != req2 );
173   END_TEST;
174 }
175
176 // Low-level test for image factory request cache
177 int UtcDaliImageFactoryUseCachedRequest04(void)
178 {
179   TestApplication application;
180   tet_infoline( "UtcDaliImageFactoryCachedRequest04 - Request same image with different Image objects - Request Ids" );
181
182   ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();
183
184   ImageAttributes attr = ImageAttributes::New( 80, 160, Pixel::BGR8888 );
185   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, &attr );
186
187   ImageAttributes attr2 = ImageAttributes::New( 80, 160, Pixel::BGR8888 );
188   RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr2 );
189   DALI_TEST_EQUALS( req, req2, TEST_LOCATION );
190   END_TEST;
191 }
192
193 // Different requests, compatible resource
194 int UtcDaliImageFactoryCompatibleResource01(void)
195 {
196   TestApplication application;
197   tet_infoline( "UtcDaliImageFactoryCompatibleResource01 - Two requests mapping to same resource" );
198
199   ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();
200
201   Vector2 testSize(80.0f, 80.0f);
202   application.GetPlatform().SetClosestImageSize(testSize);
203
204   // request with default attributes ( size is 0,0 )
205   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
206   ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
207
208   application.SendNotification();
209   application.Render();
210   application.SendNotification();
211   application.Render();
212
213   // emulate load success
214   EmulateImageLoaded( application, 80, 80 );
215
216   // Request a second load using exact-match image size:
217   ImageAttributes attr = ImageAttributes::New();
218   attr.SetSize( 80, 80 );
219   RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
220   ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );
221
222   DALI_TEST_CHECK( req != req2 ); // different requests
223   DALI_TEST_EQUALS( ticket->GetId(), ticket2->GetId(), TEST_LOCATION ); // same resource
224   END_TEST;
225 }
226
227 // Different requests, compatible resource
228 int UtcDaliImageFactoryCompatibleResource02(void)
229 {
230   TestApplication application;
231   tet_infoline( "UtcDaliImageFactoryCompatibleResource02 - Two requests mapping to same resource." );
232
233   ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();
234
235   Vector2 testSize( 2048.0f, 2048.0f );
236   application.GetPlatform().SetClosestImageSize( testSize );
237
238   // request with default attributes ( size is 0,0 )
239   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
240   ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
241
242   application.SendNotification();
243   application.Render();
244   application.SendNotification();
245   application.Render();
246
247   // emulate load success
248   EmulateImageLoaded( application, testSize.x, testSize.y );
249
250   // Request slightly bigger size than actual image.
251   // This will load the same resource as the ImageFactory cache uses a small fudge factor in matching.
252   // See UtcDaliImageFactoryReload06
253   ImageAttributes attr = ImageAttributes::New();
254   attr.SetSize( testSize.x + 1, testSize.y + 1 );
255   RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
256   ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );
257
258   DALI_TEST_CHECK( req != req2 ); // different requests
259   DALI_TEST_EQUALS( ticket->GetId(), ticket2->GetId(), TEST_LOCATION ); // same resource
260   END_TEST;
261 }
262
263 // Different requests, incompatible resource, so two loads result:
264 int UtcDaliImageFactoryInCompatibleResource(void)
265 {
266   TestApplication application;
267   tet_infoline( "UtcDaliImageFactoryCompatibleResource02 - Two requests mapping to same resource." );
268
269   ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();
270
271   Vector2 testSize(2048.0f, 2048.0f);
272   application.GetPlatform().SetClosestImageSize(testSize);
273
274   // request with default attributes ( size is 0,0 )
275   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
276   ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
277
278   application.SendNotification();
279   application.Render();
280   application.SendNotification();
281   application.Render();
282
283   // emulate load success
284   EmulateImageLoaded( application, testSize.x, testSize.y );
285
286   // Request substantially different size than actual image.
287   // This will issue a second resource load as difference in sizes is greater than
288   // the small fudge factor used in the ImageFactory cache.
289   ImageAttributes attr = ImageAttributes::New();
290   attr.SetSize( testSize.x - 16, testSize.y - 16 );
291   RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
292   ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );
293
294   DALI_TEST_CHECK( req != req2 ); // different requests
295   DALI_TEST_CHECK( ticket->GetId() != ticket2->GetId() ); // differnet resources
296   END_TEST;
297 }
298
299 // Different requests, compatible resource
300 int UtcDaliImageFactoryCompatibleResource03(void)
301 {
302   TestApplication application;
303   tet_infoline( "UtcDaliImageFactoryCompatibleResource03 - Two requests mapping to same resource" );
304
305   ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();
306
307   Vector2 testSize(80.0f, 80.0f);
308   application.GetPlatform().SetClosestImageSize(testSize);
309
310   // this time use defined attributes, nut just NULL
311   ImageAttributes attr = ImageAttributes::New();
312   attr.SetSize( 120, 120 );
313
314   // request with default attributes ( size is 0,0 )
315   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, &attr );
316   ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
317
318   application.SendNotification();
319   application.Render();
320   application.SendNotification();
321   application.Render();
322
323   // emulate load success
324   EmulateImageLoaded( application, 80, 80 );
325
326   ImageAttributes attr2 = ImageAttributes::New();
327   attr2.SetSize( 80, 80 );
328   RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr2 );
329   ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );
330
331   DALI_TEST_CHECK( req != req2 ); // different requests
332   DALI_TEST_EQUALS( ticket->GetId(), ticket2->GetId(), TEST_LOCATION ); // same resource
333   END_TEST;
334 }
335
336 // Test for reloading image
337 int UtcDaliImageFactoryReload01(void)
338 {
339   TestApplication application;
340   tet_infoline( "UtcDaliImageFactoryReload01 - Reload unchanged image" );
341
342   Vector2 testSize(80.0f, 80.0f);
343   application.GetPlatform().SetClosestImageSize(testSize);
344
345   ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();
346
347   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
348   ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
349
350   ResourceTicketPtr ticket2 = imageFactory.Reload( *req.Get() );
351   DALI_TEST_EQUALS( ticket, ticket2, TEST_LOCATION );
352
353   ResourceTicketPtr ticket3 = imageFactory.Reload( *req.Get() );
354   DALI_TEST_EQUALS( ticket, ticket3, TEST_LOCATION );
355   END_TEST;
356 }
357
358 // Testing file system access when reloading image
359 int UtcDaliImageFactoryReload02(void)
360 {
361   TestApplication application;
362   tet_infoline( "UtcDaliImageFactoryReload02 - Reload unchanged image" );
363
364   ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();
365
366   Vector2 testSize(80.0f, 80.0f);
367   application.GetPlatform().SetClosestImageSize(testSize);
368
369   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
370   ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
371
372   application.SendNotification();
373   application.Render();
374   application.SendNotification();
375   application.Render();
376
377   DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
378   application.GetPlatform().ResetTrace();
379
380   ResourceTicketPtr ticket2 = imageFactory.Reload( *req.Get() );
381
382   application.SendNotification();
383   application.Render();
384   application.SendNotification();
385   application.Render();
386
387   DALI_TEST_EQUALS( ticket, ticket2, TEST_LOCATION );
388   // resource is still loading, do not issue another request
389   DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
390
391   // emulate load success
392   EmulateImageLoaded( application, 80, 80 );
393
394   ResourceTicketPtr ticket3 = imageFactory.Reload( *req.Get() );
395
396   application.SendNotification();
397   application.Render();
398   application.SendNotification();
399   application.Render();
400
401   DALI_TEST_EQUALS( ticket, ticket3, TEST_LOCATION );
402   DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
403   application.GetPlatform().ResetTrace();
404
405   ticket3 = imageFactory.Reload( *req.Get() );
406
407   application.SendNotification();
408   application.Render();
409   application.SendNotification();
410   application.Render();
411
412   DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
413   END_TEST;
414 }
415
416 // Test for reloading changed image
417 int UtcDaliImageFactoryReload03(void)
418 {
419   TestApplication application;
420   tet_infoline( "UtcDaliImageFactoryReload03 - Reload changed image" );
421
422   ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();
423
424   Vector2 testSize( 80.0f, 80.0f );
425   application.GetPlatform().SetClosestImageSize( testSize );
426
427   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
428   ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
429
430   application.SendNotification();
431   application.Render();
432
433   // emulate load success
434   EmulateImageLoaded( application, 80, 80 );
435
436   Vector2 newSize( 192.0f, 192.0f );
437   application.GetPlatform().SetClosestImageSize( newSize );
438
439   // Image file changed size, new resource request should be issued
440   ResourceTicketPtr ticket2 = imageFactory.Reload( *req.Get() );
441   DALI_TEST_CHECK( ticket != ticket2 );
442
443   ResourceTicketPtr ticket3 = imageFactory.Reload( *req.Get() );
444   DALI_TEST_EQUALS( ticket2, ticket3, TEST_LOCATION );
445   END_TEST;
446 }
447
448 // Testing file system access when reloading image
449 int UtcDaliImageFactoryReload04(void)
450 {
451   TestApplication application;
452   tet_infoline( "UtcDaliImageFactoryReload04 - Reload unchanged image" );
453
454   ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();
455
456   Vector2 testSize(80.0f, 80.0f);
457   application.GetPlatform().SetClosestImageSize(testSize);
458
459   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
460   ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
461
462   application.SendNotification();
463   application.Render();
464
465   DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
466   application.GetPlatform().ResetTrace();
467
468   ResourceTicketPtr ticket2 = imageFactory.Reload( *req.Get() );
469
470   application.SendNotification();
471   application.Render();
472   application.SendNotification();
473   application.Render();
474
475   DALI_TEST_EQUALS( ticket, ticket2, TEST_LOCATION );
476   // resource is still loading, do not issue another request
477   DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
478
479   // emulate load success
480   EmulateImageLoaded( application, 80, 80 );
481
482   ResourceTicketPtr ticket3 = imageFactory.Reload( *req.Get() );
483
484   application.SendNotification();
485   application.Render();
486   application.SendNotification();
487   application.Render();
488
489   // size didn't change, using same ticket
490   DALI_TEST_EQUALS( ticket, ticket3, TEST_LOCATION );
491   DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
492   application.GetPlatform().ResetTrace();
493
494   // still loading
495   ticket3 = imageFactory.Reload( *req.Get() );
496   application.SendNotification();
497   application.Render();
498   application.SendNotification();
499   application.Render();
500
501   DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
502   END_TEST;
503 }
504
505 // Testing OnDemand + Reload
506 // Reload should have no effect if OnDemand Image is not loaded yet, as stated in the API documentation
507 int UtcDaliImageFactoryReload05(void)
508 {
509   TestApplication application;
510
511   tet_infoline( "UtcDaliImageFactoryReload05 - Reload OnDemand image" );
512
513   ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();
514
515   Vector2 testSize(80.0f, 80.0f);
516   application.GetPlatform().SetClosestImageSize(testSize);
517
518   RequestPtr req;
519   ImageAttributes attr = ImageAttributes::New();
520   attr.SetSize( 80, 80 );
521
522   // this happens first when loading Image OnDemand
523   req = imageFactory.RegisterRequest( gTestImageFilename, &attr );
524
525   application.SendNotification();
526   application.Render();
527
528   ResourceTicketPtr ticket = imageFactory.Reload( *req.Get() );
529
530   DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
531   DALI_TEST_CHECK( !ticket );
532
533   // this happens when Image is put on stage
534   ticket = imageFactory.Load( *req.Get() );
535
536   application.SendNotification();
537   application.Render();
538
539   DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
540   DALI_TEST_CHECK( ticket );
541   application.GetPlatform().ResetTrace();
542
543   ticket = imageFactory.Reload( *req.Get() );
544
545   application.SendNotification();
546   application.Render();
547   application.SendNotification();
548   application.Render();
549
550   // still loading, no new request
551   DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
552
553   // emulate load success
554   EmulateImageLoaded( application, 80, 80 );
555
556   ticket = imageFactory.Reload( *req.Get() );
557
558   application.SendNotification();
559   application.Render();
560
561   application.SendNotification();
562   application.Render();
563
564
565   DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
566   END_TEST;
567 }
568
569 // Initally two different requests map to same resource.
570 // After overwriting the file, they load different image resources.
571 int UtcDaliImageFactoryReload06(void)
572 {
573   TestApplication application;
574   tet_infoline( "UtcDaliImageFactoryReload06 - Two requests first mapping to same resource, then different resources." );
575
576   ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();
577
578   Vector2 testSize(2048.0f, 2048.0f);
579     application.GetPlatform().SetClosestImageSize( testSize );
580
581   // request with default attributes ( size is 0,0 )
582   RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
583   ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
584
585   application.SendNotification();
586   application.Render();
587   application.SendNotification();
588   application.Render();
589
590   // emulate load success
591   EmulateImageLoaded( application, testSize.x, testSize.y );
592
593   // Request bigger size than actual image.
594   // This will load the same resource.
595   // However if image size changes later on to eg. 512*512 (file is overwritten),
596   // reissuing these two requests will load different resources.
597   ImageAttributes attr = ImageAttributes::New();
598   attr.SetSize( testSize.x + 1, testSize.y + 1 );
599   RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
600   ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );
601
602   DALI_TEST_CHECK( req != req2 ); // different requests
603   DALI_TEST_EQUALS( ticket->GetId(), ticket2->GetId(), TEST_LOCATION ); // same resource
604
605   Vector2 newSize(512.0f, 512.0f);
606   application.GetPlatform().SetClosestImageSize(newSize);
607
608   // reload fixed size (192,192) request
609   ticket2 = imageFactory.Reload( *req2.Get() );
610
611   // emulate load success
612   // note: this is the only way to emulate what size is loaded by platform abstraction
613   EmulateImageLoaded( application, testSize.x + 1, testSize.y + 1 );
614
615   // reload default size request
616   ticket = imageFactory.Reload( *req.Get() );
617
618   DALI_TEST_CHECK( ticket->GetId() != ticket2->GetId() ); // different resources
619   END_TEST;
620 }