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