5df2c0caa48ec8e7bf6124a6c5adefd4ff07c65e
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-ImageActor.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 #include <stdlib.h>
20 #include <dali/public-api/dali-core.h>
21 #include "dali-test-suite-utils/dali-test-suite-utils.h"
22
23 using namespace Dali;
24
25 static const char* TestImageFilename = "icon_wrt.png";
26
27 void image_actor_test_startup(void)
28 {
29   test_return_value = TET_UNDEF;
30 }
31
32 void image_actor_test_cleanup(void)
33 {
34   test_return_value = TET_PASS;
35 }
36
37
38 int UtcDaliImageActorConstructorVoid(void)
39 {
40   TestApplication application;
41   tet_infoline("Testing Dali::ImageActor::ImageActor()");
42
43   ImageActor actor;
44
45   DALI_TEST_CHECK(!actor);
46   END_TEST;
47 }
48
49 int UtcDaliImageActorDestructor(void)
50 {
51   TestApplication application;
52
53   ImageActor* actor = new ImageActor();
54   delete actor;
55
56   DALI_TEST_CHECK( true );
57   END_TEST;
58 }
59
60 int UtcDaliImageActorNew01(void)
61 {
62   TestApplication application;
63   tet_infoline("Positive test for Dali::ImageActor::New()");
64
65   Image image = ResourceImage::New(TestImageFilename);
66   ImageActor actor = ImageActor::New(image);
67   Stage::GetCurrent().Add(actor);
68
69   application.SendNotification();
70   application.Render();
71   application.Render();
72   application.SendNotification();
73
74   DALI_TEST_CHECK(application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc));
75
76   DALI_TEST_CHECK(actor);
77   END_TEST;
78 }
79
80 int UtcDaliImageActorNew02(void)
81 {
82   TestApplication application;
83   tet_infoline("Negative test for Dali::ImageActor::New()");
84
85   Image image = ResourceImage::New("hopefully-this-image-file-does-not-exist");
86   ImageActor actor = ImageActor::New(image);
87
88   DALI_TEST_CHECK(actor);
89   END_TEST;
90 }
91
92 int UtcDaliImageActorDownCast(void)
93 {
94   TestApplication application;
95   tet_infoline("Testing Dali::ImageActor::DownCast()");
96
97   Image image = ResourceImage::New("IncorrectImageName");
98   ImageActor actor1 = ImageActor::New(image);
99   Actor anActor = Actor::New();
100   anActor.Add(actor1);
101
102   Actor child = anActor.GetChildAt(0);
103   ImageActor imageActor = DownCast< ImageActor >(child);
104
105   DALI_TEST_CHECK(imageActor);
106   END_TEST;
107 }
108
109 int UtcDaliImageActorDownCast2(void)
110 {
111   TestApplication application;
112   tet_infoline("Testing Dali::ImageActor::DownCast()");
113
114   Actor actor1 = Actor::New();
115   Actor anActor = Actor::New();
116   anActor.Add(actor1);
117
118   Actor child = anActor.GetChildAt(0);
119   ImageActor imageActor = ImageActor::DownCast(child);
120   DALI_TEST_CHECK(!imageActor);
121
122   Actor unInitialzedActor;
123   imageActor = ImageActor::DownCast( unInitialzedActor );
124   DALI_TEST_CHECK(!imageActor);
125   END_TEST;
126 }
127
128 int UtcDaliImageActor9Patch(void)
129 {
130   TestApplication application;
131   tet_infoline("Positive test for Dali::ImageActor:: 9 patch api");
132
133   Image image = ResourceImage::New(TestImageFilename);
134   ImageActor actor = ImageActor::New(image);
135
136   actor.SetStyle(ImageActor::STYLE_NINE_PATCH);
137   Vector4 border(0.1,0.2,0.3,0.4);
138   actor.SetNinePatchBorder(border);
139
140   DALI_TEST_EQUALS( 0.1f, actor.GetNinePatchBorder().x, TEST_LOCATION );
141   DALI_TEST_EQUALS( 0.2f, actor.GetNinePatchBorder().y, TEST_LOCATION );
142   DALI_TEST_EQUALS( 0.3f, actor.GetNinePatchBorder().z, TEST_LOCATION );
143   DALI_TEST_EQUALS( 0.4f, actor.GetNinePatchBorder().w, TEST_LOCATION );
144   END_TEST;
145 }
146
147 int UtcDaliImageActorPixelArea(void)
148 {
149   TestApplication application;
150   tet_infoline("Positive test for Dali::ImageActor::UtcDaliImageActorPixelArea");
151
152   BufferImage img = BufferImage::New( 10, 10 );
153   ImageActor actor = ImageActor::New( img );
154
155   DALI_TEST_CHECK( actor.IsPixelAreaSet() == false );
156
157   ImageActor::PixelArea area( 1, 2, 3, 4 );
158   actor.SetPixelArea( area );
159
160   DALI_TEST_CHECK( actor.IsPixelAreaSet() == true );
161
162   DALI_TEST_EQUALS( 1, actor.GetPixelArea().x, TEST_LOCATION );
163   DALI_TEST_EQUALS( 2, actor.GetPixelArea().y, TEST_LOCATION );
164   DALI_TEST_EQUALS( 3, actor.GetPixelArea().width, TEST_LOCATION );
165   DALI_TEST_EQUALS( 4, actor.GetPixelArea().height, TEST_LOCATION );
166
167   ImageActor actor2 = ImageActor::New( img, ImageActor::PixelArea( 5, 6, 7, 8 ) );
168   DALI_TEST_CHECK( actor2.IsPixelAreaSet() == true );
169
170   DALI_TEST_EQUALS( 5, actor2.GetPixelArea().x, TEST_LOCATION );
171   DALI_TEST_EQUALS( 6, actor2.GetPixelArea().y, TEST_LOCATION );
172   DALI_TEST_EQUALS( 7, actor2.GetPixelArea().width, TEST_LOCATION );
173   DALI_TEST_EQUALS( 8, actor2.GetPixelArea().height, TEST_LOCATION );
174   END_TEST;
175 }
176
177 // Set a size that is too large on an Image with a shader that requires grid
178 int UtcDaliImageActorSetSize01(void)
179 {
180   TestApplication application;
181
182   BufferImage img = BufferImage::New( 1,1 );
183   ImageActor actor = ImageActor::New( img );
184
185   ShaderEffect effect = ShaderEffect::New( " ", " ", " ", " ", ShaderEffect::HINT_GRID );
186   actor.SetShaderEffect( effect );
187
188   const float INVALID_SIZE = float(1u<<31);
189   Vector3 vector( INVALID_SIZE, INVALID_SIZE, INVALID_SIZE );
190
191   DALI_TEST_CHECK(vector != actor.GetCurrentSize());
192
193   actor.SetSize(vector);
194   Stage::GetCurrent().Add(actor);
195
196   // flush the queue and render once
197   application.SendNotification();
198   application.Render();
199
200   DALI_TEST_EQUALS(vector, actor.GetCurrentSize(), TEST_LOCATION );
201   END_TEST;
202 }
203
204 int UtcDaliImageActorGetCurrentSize01(void)
205 {
206   TestApplication application;
207   tet_infoline("Positive test for Dali::ImageActor::GetCurrentSize");
208
209   Vector2 initialImageSize(100, 50);
210   BufferImage image = BufferImage::New( initialImageSize.width, initialImageSize.height );
211   ImageActor actor = ImageActor::New( image );
212   Stage::GetCurrent().Add(actor);
213
214   application.SendNotification();
215   application.Render();
216
217   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), initialImageSize, TEST_LOCATION );
218
219   Vector2 size(200.0f, 200.0f);
220   actor.SetSize(size);
221
222   // flush the queue and render once
223   application.SendNotification();
224   application.Render();
225   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), size, TEST_LOCATION );
226
227   size.x = 200.0f;
228   size.y = 200.0f;
229   actor.SetSize(size);
230   application.Render(8);
231
232   // Test when a pixel area is set
233   ImageActor::PixelArea area(0, 0, 10, 10);
234   actor.SetPixelArea(area);
235   application.Render(9);
236   // natural size is not used as setsize is called
237   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), size, TEST_LOCATION );
238
239   actor.SetToNaturalSize();
240   application.SendNotification();
241   application.Render(9);
242   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2( area.width, area.height ), TEST_LOCATION );
243
244   END_TEST;
245 }
246
247
248 int UtcDaliImageActorGetCurrentSize02(void)
249 {
250   TestApplication application;
251   tet_infoline("Positive test for Dali::ImageActor::GetCurrentSize - Test that using an image resource sets the actor size with it's natural size immediately rather than on load");
252
253   Vector2 initialImageSize(100, 50);
254
255   application.GetPlatform().SetClosestImageSize(initialImageSize);
256
257   Image image = ResourceImage::New("image.jpg");
258   ImageActor actor = ImageActor::New( image );
259   Stage::GetCurrent().Add(actor);
260
261   application.SendNotification(); // Flush update messages
262   application.Render();           // Process resource request
263   application.SendNotification(); // Flush update messages
264   application.Render();           // Process resource request
265
266   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), initialImageSize, TEST_LOCATION );
267
268   // Now complete the image load
269   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
270   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
271   bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  initialImageSize.width,initialImageSize.height, initialImageSize.width,initialImageSize.height );
272
273   Integration::ResourcePointer resourcePtr(bitmap); // reference it
274   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
275   application.Render();           // Process LoadComplete
276   application.SendNotification(); // Process event messages
277   application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
278   application.GetPlatform().ClearReadyResources(); //
279
280   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), initialImageSize, TEST_LOCATION );
281
282   Vector2 size(200.0f, 200.0f);
283   actor.SetSize(size);
284
285   // flush the queue and render once
286   application.SendNotification();
287   application.Render();
288   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), size, TEST_LOCATION );
289
290   actor.SetToNaturalSize();
291   application.SendNotification();
292   application.Render();
293   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), initialImageSize, TEST_LOCATION );
294   END_TEST;
295 }
296
297
298 int UtcDaliImageActorGetCurrentSize03(void)
299 {
300   TestApplication application;
301   tet_infoline("Positive test for Dali::ImageActor::GetCurrentSize - Test that using an image resource with a requested size sets the actor size with it's nearest size immediately rather than on load");
302
303   const Vector2 closestImageSize( 80, 45);
304   application.GetPlatform().SetClosestImageSize(closestImageSize);
305
306   ImageAttributes attrs;
307   const Vector2 requestedSize( 40, 30 );
308   attrs.SetSize( requestedSize.width, requestedSize.height );
309   Image image = ResourceImage::New("image.jpg", attrs);
310   ImageActor actor = ImageActor::New( image );
311   Stage::GetCurrent().Add(actor);
312
313   application.SendNotification(); // Flush update messages
314   application.Render();           // Process resource request
315   application.SendNotification(); // Flush update messages
316   application.Render();           // Process resource request
317
318   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
319
320   // Now complete the image load
321   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
322   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
323   bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
324
325   Integration::ResourcePointer resourcePtr(bitmap); // reference it
326   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
327   application.Render();           // Process LoadComplete
328   application.SendNotification(); // Process event messages
329   application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
330   application.GetPlatform().ClearReadyResources(); //
331
332   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
333
334   // Test that setting a size on the actor can be 'undone' with SetNaturalSize()
335   Vector2 size(200.0f, 200.0f);
336   actor.SetSize(size);
337
338   // flush the queue and render once
339   application.SendNotification();
340   application.Render();
341   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), size, TEST_LOCATION );
342
343   actor.SetToNaturalSize();
344   application.SendNotification();
345   application.Render();
346   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
347   END_TEST;
348 }
349
350
351 int UtcDaliImageActorGetCurrentSize04(void)
352 {
353   TestApplication application;
354   tet_infoline("Positive test for Dali::ImageActor::GetCurrentSize - check a new image doesn't change a set actor size");
355
356   const Vector2 closestImageSize( 80, 45);
357   application.GetPlatform().SetClosestImageSize(closestImageSize);
358
359   const Vector2 requestedSize( 40, 30 );
360   ImageAttributes attrs;
361   attrs.SetSize( requestedSize.width, requestedSize.height );
362   Image image = ResourceImage::New("image.jpg", attrs);
363   ImageActor actor = ImageActor::New( image );
364   Stage::GetCurrent().Add(actor);
365
366   application.SendNotification(); // Flush update messages
367   application.Render();           // Process resource request
368
369   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
370
371   // Now complete the image load
372   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
373   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
374   bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
375
376   Integration::ResourcePointer resourcePtr(bitmap); // reference it
377   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
378   application.Render();           // Process LoadComplete
379   application.SendNotification(); // Process event messages
380   application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
381   application.GetPlatform().ClearReadyResources(); //
382
383   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
384
385   Vector2 size(200.0f, 200.0f);
386   actor.SetSize(size);
387
388   // flush the queue and render once
389   application.SendNotification();
390   application.Render();
391   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), size, TEST_LOCATION );
392
393   // Load a different image
394
395   Vector2 image2ClosestSize = Vector2(240, 150); // The actual size image loader will return for the request below
396   application.GetPlatform().SetClosestImageSize(image2ClosestSize);
397
398   const Vector2 request2Size( 100, 100 );
399   attrs.SetSize( request2Size.width, request2Size.height );
400   Image image2 = ResourceImage::New("image2.jpg", attrs);
401   actor.SetImage(image2);
402
403   application.SendNotification(); // Flush update messages
404   application.Render();           // Process resource request
405   application.SendNotification(); // Flush update messages
406   application.Render();           // Process resource request
407
408   // Ensure the actor size is kept
409   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), size, TEST_LOCATION );
410
411   // Now complete the image load
412   req = application.GetPlatform().GetRequest();
413   Integration::Bitmap* bitmap2 = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
414   bitmap2->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  image2ClosestSize.width, image2ClosestSize.height, image2ClosestSize.width, image2ClosestSize.height );
415
416   Integration::ResourcePointer resourcePtr2(bitmap2); // reference it
417   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr2);
418   application.Render();           // Process LoadComplete
419   application.SendNotification(); // Process event messages
420   application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
421   application.GetPlatform().ClearReadyResources(); //
422
423   // Ensure the actor size is kept
424   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), size, TEST_LOCATION );
425
426   actor.SetToNaturalSize();
427   application.SendNotification();
428   application.Render();
429   // Ensure the actor size gets the new image's natural size
430   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), request2Size, TEST_LOCATION );
431   END_TEST;
432 }
433
434
435 int UtcDaliImageActorGetCurrentSize05(void)
436 {
437   TestApplication application;
438   tet_infoline("Positive test for Dali::ImageActor::GetCurrentSize - check a new image doens't change actor size until load complete");
439
440   Vector2 closestImageSize( 80, 45);
441   application.GetPlatform().SetClosestImageSize(closestImageSize);
442
443   ImageAttributes attrs;
444   const Vector2 requestedSize( 40, 30 );
445   attrs.SetSize( requestedSize.width, requestedSize.height );
446   Image image = ResourceImage::New("image.jpg", attrs);
447   ImageActor actor = ImageActor::New( image );
448   Stage::GetCurrent().Add(actor);
449
450   application.SendNotification(); // Flush update messages
451   application.Render();           // Process resource request
452
453   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
454
455   // Now complete the image load
456   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
457   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
458   bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
459
460   Integration::ResourcePointer resourcePtr(bitmap); // reference it
461   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
462   application.Render();           // Process LoadComplete
463   application.SendNotification(); // Process event messages
464   application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
465   application.GetPlatform().ClearReadyResources(); //
466
467   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
468
469   // Load a different image
470
471   Vector2 image2ClosestSize = Vector2(240, 150);
472   application.GetPlatform().SetClosestImageSize(image2ClosestSize);
473
474   const Vector2 requestedSize2( 100, 100 );
475   attrs.SetSize( requestedSize2.width, requestedSize2.height );
476   Image image2 = ResourceImage::New("image2.jpg", attrs);
477   actor.SetImage(image2);
478
479   application.SendNotification(); // Flush update messages
480   application.Render();           // Process resource request
481   application.SendNotification(); // Flush update messages
482   application.Render();           // Process resource request
483
484   // Ensure the actor size is kept
485   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize2, TEST_LOCATION );
486
487   // Now complete the image load
488   req = application.GetPlatform().GetRequest();
489   Integration::Bitmap* bitmap2 = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
490   bitmap2->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  image2ClosestSize.width, image2ClosestSize.height, image2ClosestSize.width, image2ClosestSize.height );
491
492   Integration::ResourcePointer resourcePtr2(bitmap2); // reference it
493   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr2);
494   application.Render();           // Process LoadComplete
495   application.SendNotification(); // Process event messages
496   application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
497   application.GetPlatform().ClearReadyResources(); //
498
499   application.SendNotification(); // Process event messages
500   application.Render();           // Process LoadComplete
501
502   // Ensure the actor size gets the new image's natural size
503   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize2, TEST_LOCATION );
504   END_TEST;
505 }
506
507 int UtcDaliImageActorNaturalPixelAreaSize01(void)
508 {
509   TestApplication application;
510   tet_infoline("Positive test for Dali::ImageActor::GetCurrentSize - check a new image doens't change actor size until load complete");
511
512 //If an image is loaded without setting size, then the actor gets the natural size of the image
513 //Setting the pixel area will change the actor size to match the pixel area
514 //Setting the actor size will not change pixel area, and will cause the partial image to stretch
515 //to the new size.
516 //Clearing the pixel area will not change actor size, and the actor will show the whole image.
517
518
519   Vector2 closestImageSize( 80, 45);
520   application.GetPlatform().SetClosestImageSize(closestImageSize);
521
522   ImageAttributes attrs;
523   const Vector2 requestedSize( 40, 30 );
524   attrs.SetSize( requestedSize.width, requestedSize.height );
525   Image image = ResourceImage::New("image.jpg", attrs);
526   ImageActor actor = ImageActor::New( image );
527   Stage::GetCurrent().Add(actor);
528
529   application.SendNotification(); // Flush update messages
530   application.Render();           // Process resource request
531
532   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
533
534   // Now complete the image load
535   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
536   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
537   bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
538
539   Integration::ResourcePointer resourcePtr(bitmap); // reference it
540   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
541   application.Render();           // Process LoadComplete
542   application.SendNotification(); // Process event messages
543   application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
544   application.GetPlatform().ClearReadyResources(); //
545
546   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
547
548   // Set a pixel area on a naturally sized actor - expect the actor to take the
549   // pixel area as size
550   actor.SetPixelArea(ImageActor::PixelArea(0, 0, 30, 30));
551   application.SendNotification(); // Process event messages
552   application.Render();           // Process LoadComplete
553   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(30, 30), TEST_LOCATION );
554
555   // Set a size. Expect the partial image to stretch to fill the new size
556   actor.SetSize(100, 100);
557   application.SendNotification(); // Process event messages
558   application.Render();           // Process LoadComplete
559   application.Render();           // Process LoadComplete
560   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(100, 100), TEST_LOCATION );
561
562   // Clear the pixel area. Expect the whole image to be shown, filling the set size.
563   actor.ClearPixelArea();
564   application.SendNotification(); // Process event messages
565   application.Render();           // Process LoadComplete
566   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(100, 100), TEST_LOCATION );
567   END_TEST;
568 }
569
570 int UtcDaliImageActorNaturalPixelAreaSize02(void)
571 {
572   TestApplication application;
573   tet_infoline("Positive test for Dali::ImageActor::GetCurrentSize - check a new image doens't change actor size until load complete");
574
575 //If an image is loaded without setting size, then the actor gets the natural size of the image
576 //Setting the pixel area will change the actor size to match the pixel area
577 //Setting the actor size will not change pixel area, and will cause the partial image to stretch
578 //to the new size.
579 //Clearing the pixel area will not change actor size, and the actor will show the whole image.
580
581
582   Vector2 closestImageSize( 80, 45);
583   application.GetPlatform().SetClosestImageSize(closestImageSize);
584
585   ImageAttributes attrs;
586   const Vector2 requestedSize( 40, 30 );
587   attrs.SetSize( requestedSize.width, requestedSize.height );
588   Image image = ResourceImage::New("image.jpg", attrs);
589   ImageActor actor = ImageActor::New( image );
590   Stage::GetCurrent().Add(actor);
591
592   application.SendNotification(); // Flush update messages
593   application.Render();           // Process resource request
594
595   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
596
597   // Now complete the image load
598   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
599   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
600   bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
601
602   Integration::ResourcePointer resourcePtr(bitmap); // reference it
603   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
604   application.Render();           // Process LoadComplete
605   application.SendNotification(); // Process event messages
606   application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
607   application.GetPlatform().ClearReadyResources(); //
608
609   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
610
611   // Set a pixel area on a naturally sized actor - expect the actor to take the
612   // pixel area as size
613   actor.SetPixelArea(ImageActor::PixelArea(0, 0, 30, 30));
614   application.SendNotification(); // Process event messages
615   application.Render();           // Process LoadComplete
616   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(30, 30), TEST_LOCATION );
617
618   // Clear the pixel area. Expect the whole image to be shown, changing actor size
619   actor.ClearPixelArea();
620   application.SendNotification(); // Process event messages
621   application.Render();           // Process LoadComplete
622   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
623
624   // Set a size. Expect the partial image to stretch to fill the new size
625   actor.SetSize(100, 100);
626   application.SendNotification(); // Process event messages
627   application.Render();           // Process LoadComplete
628   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(100, 100), TEST_LOCATION );
629
630   // Set a pixel area, don't expect size to change
631   actor.SetPixelArea(ImageActor::PixelArea(0, 0, 40, 40));
632   application.SendNotification(); // Process event messages
633   application.Render();           // Process LoadComplete
634   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(100, 100), TEST_LOCATION );
635
636   // Use natural size - expect actor to change to pixel area
637   actor.SetToNaturalSize();
638   application.SendNotification(); // Process event messages
639   application.Render();           // Process LoadComplete
640   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(40, 40), TEST_LOCATION );
641
642   // Clearing pixel area should change actor size to image size
643   actor.ClearPixelArea();
644   application.SendNotification(); // Process event messages
645   application.Render();           // Process LoadComplete
646   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
647   END_TEST;
648 }
649
650
651
652 int UtcDaliImageActorDefaultProperties(void)
653 {
654   TestApplication application;
655   tet_infoline("Testing Dali::ImageActor DefaultProperties");
656
657   BufferImage img = BufferImage::New( 10, 10 );
658   ImageActor actor = ImageActor::New( img );
659
660   std::vector<Property::Index> indices;
661   indices.push_back(ImageActor::Property::PixelArea      );
662   indices.push_back(ImageActor::Property::Style           );
663   indices.push_back(ImageActor::Property::Border          );
664   indices.push_back(ImageActor::Property::Image           );
665
666   DALI_TEST_CHECK(actor.GetPropertyCount() == ( Actor::New().GetPropertyCount() + indices.size() ) );
667
668   for(std::vector<Property::Index>::iterator iter = indices.begin(); iter != indices.end(); ++iter)
669   {
670     DALI_TEST_CHECK( *iter == actor.GetPropertyIndex(actor.GetPropertyName(*iter)) );
671     DALI_TEST_CHECK( actor.IsPropertyWritable(*iter) );
672     DALI_TEST_CHECK( !actor.IsPropertyAnimatable(*iter) );
673     DALI_TEST_CHECK( actor.GetPropertyType(*iter) == actor.GetPropertyType(*iter) );  // just checking call succeeds
674   }
675
676   // set/get one of them
677   actor.SetPixelArea(ImageActor::PixelArea( 0, 0, 0, 0 ));
678
679   ImageActor::PixelArea area( 1, 2, 3, 4 );
680   actor.SetProperty(ImageActor::Property::PixelArea, Property::Value(Rect<int>(area)));
681
682   DALI_TEST_CHECK(Property::RECTANGLE == actor.GetPropertyType(ImageActor::Property::PixelArea));
683
684   Property::Value v = actor.GetProperty(ImageActor::Property::PixelArea);
685
686   DALI_TEST_CHECK(v.Get<Rect<int> >() == area);
687
688   END_TEST;
689 }
690
691 int UtcDaliImageActorUseImageAlpha01(void)
692 {
693   TestApplication application;
694
695   tet_infoline("Testing Dali::RenderableActor::SetUseImageAlpha()");
696
697   BufferImage image = BufferImage::New( 100, 50 );
698   ImageActor actor = ImageActor::New( image );
699   actor.SetBlendMode( BlendingMode::ON );
700   actor.SetSize(100, 50);
701   application.GetGlAbstraction().EnableCullFaceCallTrace(true); // For Enable(GL_BLEND)
702   Stage::GetCurrent().Add(actor);
703
704   application.SendNotification();
705   application.Render();
706
707   const TraceCallStack& callTrace = application.GetGlAbstraction().GetCullFaceTrace();
708   DALI_TEST_EQUALS( BlendEnabled( callTrace), true, TEST_LOCATION );
709   DALI_TEST_EQUALS( BlendDisabled( callTrace ), false, TEST_LOCATION );
710   END_TEST;
711 }
712
713 int UtcDaliImageActorUseImageAlpha02(void)
714 {
715   TestApplication application;
716
717   tet_infoline("Testing Dali::RenderableActor::SetUseImageAlpha()");
718
719   BufferImage image = BufferImage::New( 100, 50 );
720   ImageActor actor = ImageActor::New( image );
721   actor.SetBlendMode( BlendingMode::OFF );
722   actor.SetSize(100, 50);
723   application.GetGlAbstraction().EnableCullFaceCallTrace(true); // For Enable(GL_BLEND)
724   Stage::GetCurrent().Add(actor);
725
726   application.SendNotification();
727   application.Render();
728
729   const TraceCallStack& callTrace = application.GetGlAbstraction().GetCullFaceTrace();
730   DALI_TEST_EQUALS( BlendDisabled( callTrace ), false, TEST_LOCATION );
731   DALI_TEST_EQUALS( BlendEnabled( callTrace), false, TEST_LOCATION );
732   END_TEST;
733 }
734
735 int UtcDaliImageActorUseImageAlpha03(void)
736 {
737   TestApplication application;
738
739   tet_infoline("Testing Dali::RenderableActor::SetUseImageAlpha()");
740
741   BufferImage image = BufferImage::New( 100, 50 );
742   ImageActor actor = ImageActor::New( image );
743   actor.SetBlendMode( BlendingMode::AUTO );
744   actor.SetColor(Vector4(1.0, 1.0, 1.0, 0.5));
745   actor.SetSize(100, 50);
746   application.GetGlAbstraction().EnableCullFaceCallTrace(true); // For Enable(GL_BLEND)
747   Stage::GetCurrent().Add(actor);
748
749   application.SendNotification();
750   application.Render();
751
752   const TraceCallStack& callTrace = application.GetGlAbstraction().GetCullFaceTrace();
753   DALI_TEST_EQUALS( BlendDisabled( callTrace ), false, TEST_LOCATION );
754   DALI_TEST_EQUALS( BlendEnabled( callTrace), true, TEST_LOCATION );
755   END_TEST;
756 }
757
758 int UtcDaliImageActorUseImageAlpha04(void)
759 {
760   TestApplication application;
761
762   tet_infoline("Testing Dali::RenderableActor::SetUseImageAlpha()");
763
764   FrameBufferImage image = FrameBufferImage::New( 100, 50, Pixel::RGBA8888 );
765   RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
766   RenderTask task = taskList.GetTask( 0u );
767   task.SetTargetFrameBuffer( image ); // To ensure frame buffer is connected
768   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
769   application.SendNotification();
770   application.Render(0);
771
772   ImageActor actor = ImageActor::New( image );
773   application.SendNotification();
774   application.Render(0);
775
776   actor.SetBlendMode( BlendingMode::ON );
777   actor.SetColor(Vector4(1.0, 1.0, 1.0, 1.0));
778   actor.SetSize(100, 50);
779   application.GetGlAbstraction().EnableCullFaceCallTrace(true); // For Enable(GL_BLEND)
780   Stage::GetCurrent().Add(actor);
781
782   application.SendNotification();
783   application.Render();
784
785   const TraceCallStack& callTrace = application.GetGlAbstraction().GetCullFaceTrace();
786   DALI_TEST_EQUALS( BlendDisabled( callTrace ), false, TEST_LOCATION );
787   DALI_TEST_EQUALS( BlendEnabled( callTrace), true, TEST_LOCATION );
788   END_TEST;
789 }
790
791 int UtcDaliImageActorUseImageAlpha05(void)
792 {
793   TestApplication application;
794
795   tet_infoline("Testing Dali::RenderableActor::SetUseImageAlpha()");
796
797   BufferImage image = BufferImage::New( 100, 50, Pixel::RGB888 );
798   ImageActor actor = ImageActor::New( image );
799   actor.SetBlendMode( BlendingMode::AUTO );
800   actor.SetColor(Vector4(1.0, 1.0, 1.0, 1.0));
801   actor.SetSize(100, 50);
802   application.GetGlAbstraction().EnableCullFaceCallTrace(true); // For Enable(GL_BLEND)
803   Stage::GetCurrent().Add(actor);
804
805   application.SendNotification();
806   application.Render();
807
808   const TraceCallStack& callTrace = application.GetGlAbstraction().GetCullFaceTrace();
809   DALI_TEST_EQUALS( BlendDisabled( callTrace ), false, TEST_LOCATION );
810   DALI_TEST_EQUALS( BlendEnabled( callTrace), false, TEST_LOCATION );
811   END_TEST;
812 }
813
814 int UtcDaliImageActorClearPixelArea(void)
815 {
816   TestApplication application;
817
818   BufferImage img = BufferImage::New( 10, 10 );
819   ImageActor actor = ImageActor::New( img );
820
821   DALI_TEST_CHECK( actor.IsPixelAreaSet() == false );
822
823   ImageActor::PixelArea area( 1, 2, 3, 4 );
824   actor.SetPixelArea( area );
825
826   DALI_TEST_CHECK( actor.IsPixelAreaSet() == true );
827
828   actor.ClearPixelArea();
829
830   DALI_TEST_CHECK( actor.IsPixelAreaSet() == false );
831   END_TEST;
832 }
833
834 int UtcDaliImageGetStyle(void)
835 {
836   TestApplication application;
837
838   Image image = ResourceImage::New(TestImageFilename);
839   ImageActor actor = ImageActor::New(image);
840
841   actor.SetStyle(ImageActor::STYLE_NINE_PATCH);
842
843   // flush the queue and render once
844   application.SendNotification();
845   application.Render();
846
847   DALI_TEST_EQUALS( ImageActor::STYLE_NINE_PATCH, actor.GetStyle(), TEST_LOCATION );
848   END_TEST;
849 }
850
851 int UtcDaliImageSetNinePatchBorder(void)
852 {
853   TestApplication application;
854
855   Image image = ResourceImage::New(TestImageFilename);
856   ImageActor actor = ImageActor::New(image);
857
858   actor.SetStyle(ImageActor::STYLE_NINE_PATCH);
859   actor.SetNinePatchBorder(Vector4( 1.0f, 2.0f, 3.0f, 4.0f));
860
861   DALI_TEST_EQUALS( 1.0f, actor.GetNinePatchBorder().x, TEST_LOCATION );
862   DALI_TEST_EQUALS( 2.0f, actor.GetNinePatchBorder().y, TEST_LOCATION );
863   DALI_TEST_EQUALS( 3.0f, actor.GetNinePatchBorder().z, TEST_LOCATION );
864   DALI_TEST_EQUALS( 4.0f, actor.GetNinePatchBorder().w, TEST_LOCATION );
865   END_TEST;
866 }
867
868 int UtcDaliImageActorNewNull(void)
869 {
870   TestApplication application;
871
872   ImageActor actor = ImageActor::New(Image());
873
874   DALI_TEST_CHECK(actor);
875   END_TEST;
876 }
877
878 int UtcDaliImageActorNewNullWithArea(void)
879 {
880   TestApplication application;
881
882   ImageActor::PixelArea area( 1, 2, 3, 4 );
883
884   ImageActor actor = ImageActor::New(Image(), area);
885
886   DALI_TEST_CHECK(actor);
887   END_TEST;
888 }
889
890 int UtcDaliImageActorSetImage(void)
891 {
892   TestApplication application;
893
894   ImageActor actor = ImageActor::New(Image());
895
896   DALI_TEST_CHECK(actor);
897
898   actor.SetImage( Image() );
899
900   DALI_TEST_CHECK(!actor.GetImage());
901   END_TEST;
902 }
903
904 int UtcDaliImageActorPropertyIndices(void)
905 {
906   TestApplication application;
907   Actor basicActor = Actor::New();
908   ImageActor imageActor = ImageActor::New();
909
910   Property::IndexContainer indices;
911   imageActor.GetPropertyIndices( indices );
912   DALI_TEST_CHECK( indices.size() > basicActor.GetPropertyCount() );
913   DALI_TEST_EQUALS( indices.size(), imageActor.GetPropertyCount(), TEST_LOCATION );
914   END_TEST;
915 }
916
917 int UtcDaliImageActorImageProperty(void)
918 {
919   TestApplication application;
920   Image image = ResourceImage::New( "MY_PATH" );
921   ImageActor imageActor = ImageActor::New( image );
922
923   Stage::GetCurrent().Add( imageActor );
924   application.SendNotification();
925   application.Render();
926
927   Property::Value imageMap = imageActor.GetProperty( ImageActor::Property::Image );
928   DALI_TEST_CHECK( imageMap.HasKey( "filename" ) );
929   DALI_TEST_EQUALS( imageMap.GetValue( "filename" ).Get< std::string >(), "MY_PATH", TEST_LOCATION );
930   END_TEST;
931 }
932
933 int UtcDaliImageActorNinePatch01(void)
934 {
935   TestApplication application;
936   TestPlatformAbstraction& platform = application.GetPlatform();
937   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
938   TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
939   TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
940
941   tet_infoline("Test the successful loading of a nine-patch image\n");
942
943   platform.SetClosestImageSize(Vector2(4, 4));
944   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
945   Integration::PixelBuffer* pixels = bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  4,4,4,4 );
946   memset( pixels, 0, 64 );
947
948   Integration::ResourcePointer resourcePtr(bitmap); // reference it
949   platform.SetResourceLoaded( 0, Dali::Integration::ResourceBitmap, resourcePtr );
950
951   Image ninePatchImage = ResourceImage::New( "blah.#.png" );
952   DALI_TEST_CHECK( ninePatchImage );
953
954   ImageActor imageActor = ImageActor::New( ninePatchImage );
955   DALI_TEST_CHECK( imageActor );
956   Stage::GetCurrent().Add( imageActor );
957
958   drawTrace.Reset();
959   textureTrace.Reset();
960   drawTrace.Enable(true);
961   textureTrace.Enable(true);
962   glAbstraction.ClearBoundTextures();
963   std::vector<GLuint> ids;
964   ids.push_back( 23 );
965   glAbstraction.SetNextTextureIds( ids );
966
967   application.SendNotification();
968   application.Render();
969
970   DALI_TEST_CHECK( drawTrace.FindMethod( "DrawArrays" ) );
971   typedef std::vector<GLuint> TexVec;
972   const TexVec& textures = glAbstraction.GetBoundTextures(GL_TEXTURE0);
973   DALI_TEST_CHECK( textures.size() > 0 );
974   if( textures.size() > 0 )
975   {
976     DALI_TEST_EQUALS( textures[0], 23u, TEST_LOCATION );
977   }
978
979   END_TEST;
980 }
981
982
983 int UtcDaliImageActorNinePatch02(void)
984 {
985   TestApplication application;
986   TestPlatformAbstraction& platform = application.GetPlatform();
987   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
988   TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
989   TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
990
991   tet_infoline("Test the failed loading of a nine-patch image\n");
992
993   platform.SetClosestImageSize(Vector2(0, 0));
994   Integration::ResourcePointer resourcePtr;
995   platform.SetResourceLoaded( 0, Dali::Integration::ResourceBitmap, resourcePtr );
996
997   Image ninePatchImage = ResourceImage::New( "blah.#.png" );
998   DALI_TEST_CHECK( ninePatchImage );
999
1000   ImageActor imageActor = ImageActor::New( ninePatchImage );
1001   DALI_TEST_CHECK( imageActor );
1002   Stage::GetCurrent().Add( imageActor );
1003
1004   drawTrace.Reset();
1005   textureTrace.Reset();
1006   drawTrace.Enable(true);
1007   textureTrace.Enable(true);
1008   glAbstraction.ClearBoundTextures();
1009   std::vector<GLuint> ids;
1010   ids.push_back( 23 );
1011   glAbstraction.SetNextTextureIds( ids );
1012
1013   application.SendNotification();
1014   application.Render();
1015
1016   // Check that nothing was drawn.
1017   DALI_TEST_CHECK( ! drawTrace.FindMethod( "DrawArrays" ) );
1018   typedef std::vector<GLuint> TexVec;
1019   const TexVec& textures = glAbstraction.GetBoundTextures(GL_TEXTURE0);
1020   DALI_TEST_CHECK( textures.size() == 0u );
1021
1022   END_TEST;
1023 }
1024
1025
1026 int UtcDaliImageActorNinePatch03(void)
1027 {
1028   TestApplication application;
1029   TestPlatformAbstraction& platform = application.GetPlatform();
1030   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
1031   TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
1032   TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
1033
1034   tet_infoline("Test the successful loading of a nine-patch image added using ImageActor::SetImage()\n");
1035
1036   platform.SetClosestImageSize(Vector2(4, 4));
1037   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
1038   Integration::PixelBuffer* pixels = bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  4,4,4,4 );
1039   memset( pixels, 0, 64 );
1040
1041   Integration::ResourcePointer resourcePtr(bitmap); // reference it
1042   platform.SetResourceLoaded( 0, Dali::Integration::ResourceBitmap, resourcePtr );
1043
1044   Image ninePatchImage = ResourceImage::New( "blah.#.png" );
1045   DALI_TEST_CHECK( ninePatchImage );
1046
1047   ImageActor imageActor = ImageActor::New();
1048   DALI_TEST_CHECK( imageActor );
1049   Stage::GetCurrent().Add( imageActor );
1050
1051   imageActor.SetImage( ninePatchImage );
1052
1053   drawTrace.Reset();
1054   textureTrace.Reset();
1055   drawTrace.Enable(true);
1056   textureTrace.Enable(true);
1057   glAbstraction.ClearBoundTextures();
1058   std::vector<GLuint> ids;
1059   ids.push_back( 23 );
1060   glAbstraction.SetNextTextureIds( ids );
1061
1062   application.SendNotification();
1063   application.Render();
1064
1065   DALI_TEST_CHECK( drawTrace.FindMethod( "DrawArrays" ) );
1066   typedef std::vector<GLuint> TexVec;
1067   const TexVec& textures = glAbstraction.GetBoundTextures(GL_TEXTURE0);
1068   DALI_TEST_CHECK( textures.size() > 0 );
1069   if( textures.size() > 0 )
1070   {
1071     DALI_TEST_EQUALS( textures[0], 23u, TEST_LOCATION );
1072   }
1073
1074   END_TEST;
1075 }
1076
1077
1078 int UtcDaliImageActorNinePatch04(void)
1079 {
1080   TestApplication application;
1081   TestPlatformAbstraction& platform = application.GetPlatform();
1082   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
1083   TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
1084   TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
1085
1086   tet_infoline("Test the failed loading of a nine-patch image using ImageActor::SetImage()\n");
1087
1088   platform.SetClosestImageSize(Vector2(0, 0));
1089   Integration::ResourcePointer resourcePtr;
1090   platform.SetResourceLoaded( 0, Dali::Integration::ResourceBitmap, resourcePtr );
1091
1092   Image ninePatchImage = ResourceImage::New( "blah.#.png" );
1093   DALI_TEST_CHECK( ninePatchImage );
1094
1095   ImageActor imageActor = ImageActor::New();
1096   DALI_TEST_CHECK( imageActor );
1097   Stage::GetCurrent().Add( imageActor );
1098
1099   imageActor.SetImage( ninePatchImage );
1100
1101   drawTrace.Reset();
1102   textureTrace.Reset();
1103   drawTrace.Enable(true);
1104   textureTrace.Enable(true);
1105   glAbstraction.ClearBoundTextures();
1106   std::vector<GLuint> ids;
1107   ids.push_back( 23 );
1108   glAbstraction.SetNextTextureIds( ids );
1109
1110   application.SendNotification();
1111   application.Render();
1112
1113   // Check that nothing was drawn.
1114   DALI_TEST_CHECK( ! drawTrace.FindMethod( "DrawArrays" ) );
1115   typedef std::vector<GLuint> TexVec;
1116   const TexVec& textures = glAbstraction.GetBoundTextures(GL_TEXTURE0);
1117   DALI_TEST_CHECK( textures.size() == 0u );
1118
1119   END_TEST;
1120 }
1121
1122 int UtcDaliImageActorGetNaturalSize(void)
1123 {
1124   TestApplication application;
1125
1126   // Standard image
1127   BufferImage img = BufferImage::New( 10, 10 );
1128   ImageActor actor = ImageActor::New( img );
1129
1130   DALI_TEST_CHECK( actor.GetNaturalSize().GetVectorXY() == Vector2( 10, 10 ) );
1131
1132   // Pixel area set
1133   ImageActor::PixelArea area( 1, 2, 3, 4 );
1134   actor.SetPixelArea( area );
1135
1136   DALI_TEST_CHECK( actor.GetNaturalSize().GetVectorXY() == Vector2( 3, 4 ) );
1137
1138   END_TEST;
1139 }