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