Size negotiation patch 4: Remove SetRelayoutEnabled
[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( " ", " ", GEOMETRY_TYPE_IMAGE, 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   END_TEST;
240 }
241
242
243 int UtcDaliImageActorGetCurrentSize02(void)
244 {
245   TestApplication application;
246   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");
247
248   Vector2 initialImageSize(100, 50);
249
250   application.GetPlatform().SetClosestImageSize(initialImageSize);
251
252   Image image = ResourceImage::New("image.jpg");
253   ImageActor actor = ImageActor::New( image );
254   Stage::GetCurrent().Add(actor);
255
256   application.SendNotification(); // Flush update messages
257   application.Render();           // Process resource request
258   application.SendNotification(); // Flush update messages
259   application.Render();           // Process resource request
260
261   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), initialImageSize, TEST_LOCATION );
262
263   // Now complete the image load
264   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
265   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
266   bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  initialImageSize.width,initialImageSize.height, initialImageSize.width,initialImageSize.height );
267
268   Integration::ResourcePointer resourcePtr(bitmap); // reference it
269   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
270   application.Render();           // Process LoadComplete
271   application.SendNotification(); // Process event messages
272   application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
273   application.GetPlatform().ClearReadyResources(); //
274
275   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), initialImageSize, TEST_LOCATION );
276
277   Vector2 size(200.0f, 200.0f);
278   actor.SetSize(size);
279
280   // flush the queue and render once
281   application.SendNotification();
282   application.Render();
283   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), size, TEST_LOCATION );
284
285   END_TEST;
286 }
287
288
289 int UtcDaliImageActorGetCurrentSize03(void)
290 {
291   TestApplication application;
292   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");
293
294   const Vector2 closestImageSize( 80, 45);
295   application.GetPlatform().SetClosestImageSize(closestImageSize);
296
297   ImageAttributes attrs;
298   const Vector2 requestedSize( 40, 30 );
299   attrs.SetSize( requestedSize.width, requestedSize.height );
300   Image image = ResourceImage::New("image.jpg", attrs);
301   ImageActor actor = ImageActor::New( image );
302   Stage::GetCurrent().Add(actor);
303
304   application.SendNotification(); // Flush update messages
305   application.Render();           // Process resource request
306   application.SendNotification(); // Flush update messages
307   application.Render();           // Process resource request
308
309   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
310
311   // Now complete the image load
312   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
313   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
314   bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
315
316   Integration::ResourcePointer resourcePtr(bitmap); // reference it
317   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
318   application.Render();           // Process LoadComplete
319   application.SendNotification(); // Process event messages
320   application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
321   application.GetPlatform().ClearReadyResources(); //
322
323   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
324
325   END_TEST;
326 }
327
328
329 int UtcDaliImageActorGetCurrentSize04(void)
330 {
331   TestApplication application;
332   tet_infoline("Positive test for Dali::ImageActor::GetCurrentSize - check a new image doesn't change a set actor size");
333
334   const Vector2 closestImageSize( 80, 45);
335   application.GetPlatform().SetClosestImageSize(closestImageSize);
336
337   const Vector2 requestedSize( 40, 30 );
338   ImageAttributes attrs;
339   attrs.SetSize( requestedSize.width, requestedSize.height );
340   Image image = ResourceImage::New("image.jpg", attrs);
341   ImageActor actor = ImageActor::New( image );
342   Stage::GetCurrent().Add(actor);
343
344   application.SendNotification(); // Flush update messages
345   application.Render();           // Process resource request
346
347   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
348
349   // Now complete the image load
350   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
351   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
352   bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
353
354   Integration::ResourcePointer resourcePtr(bitmap); // reference it
355   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
356   application.Render();           // Process LoadComplete
357   application.SendNotification(); // Process event messages
358   application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
359   application.GetPlatform().ClearReadyResources(); //
360
361   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
362
363   Vector2 size(200.0f, 200.0f);
364   actor.SetSize(size);
365
366   // flush the queue and render once
367   application.SendNotification();
368   application.Render();
369   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), size, TEST_LOCATION );
370
371   // Load a different image
372
373   Vector2 image2ClosestSize = Vector2(240, 150); // The actual size image loader will return for the request below
374   application.GetPlatform().SetClosestImageSize(image2ClosestSize);
375
376   const Vector2 request2Size( 100, 100 );
377   attrs.SetSize( request2Size.width, request2Size.height );
378   Image image2 = ResourceImage::New("image2.jpg", attrs);
379   actor.SetImage(image2);
380
381   application.SendNotification(); // Flush update messages
382   application.Render();           // Process resource request
383   application.SendNotification(); // Flush update messages
384   application.Render();           // Process resource request
385
386   // Ensure the actor size is kept
387   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), size, TEST_LOCATION );
388
389   // Now complete the image load
390   req = application.GetPlatform().GetRequest();
391   Integration::Bitmap* bitmap2 = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
392   bitmap2->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  image2ClosestSize.width, image2ClosestSize.height, image2ClosestSize.width, image2ClosestSize.height );
393
394   Integration::ResourcePointer resourcePtr2(bitmap2); // reference it
395   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr2);
396   application.Render();           // Process LoadComplete
397   application.SendNotification(); // Process event messages
398   application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
399   application.GetPlatform().ClearReadyResources(); //
400
401   // Ensure the actor size is kept
402   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), size, TEST_LOCATION );
403
404   END_TEST;
405 }
406
407
408 int UtcDaliImageActorGetCurrentSize05(void)
409 {
410   TestApplication application;
411   tet_infoline("Positive test for Dali::ImageActor::GetCurrentSize - check a new image doens't change actor size until load complete");
412
413   Vector2 closestImageSize( 80, 45);
414   application.GetPlatform().SetClosestImageSize(closestImageSize);
415
416   ImageAttributes attrs;
417   const Vector2 requestedSize( 40, 30 );
418   attrs.SetSize( requestedSize.width, requestedSize.height );
419   Image image = ResourceImage::New("image.jpg", attrs);
420   ImageActor actor = ImageActor::New( image );
421   Stage::GetCurrent().Add(actor);
422
423   application.SendNotification(); // Flush update messages
424   application.Render();           // Process resource request
425
426   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
427
428   // Now complete the image load
429   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
430   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
431   bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
432
433   Integration::ResourcePointer resourcePtr(bitmap); // reference it
434   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
435   application.Render();           // Process LoadComplete
436   application.SendNotification(); // Process event messages
437   application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
438   application.GetPlatform().ClearReadyResources(); //
439
440   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
441
442   // Load a different image
443
444   Vector2 image2ClosestSize = Vector2(240, 150);
445   application.GetPlatform().SetClosestImageSize(image2ClosestSize);
446
447   const Vector2 requestedSize2( 100, 100 );
448   attrs.SetSize( requestedSize2.width, requestedSize2.height );
449   Image image2 = ResourceImage::New("image2.jpg", attrs);
450   actor.SetImage(image2);
451
452   application.SendNotification(); // Flush update messages
453   application.Render();           // Process resource request
454   application.SendNotification(); // Flush update messages
455   application.Render();           // Process resource request
456
457   // Ensure the actor size is kept
458   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize2, TEST_LOCATION );
459
460   // Now complete the image load
461   req = application.GetPlatform().GetRequest();
462   Integration::Bitmap* bitmap2 = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
463   bitmap2->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  image2ClosestSize.width, image2ClosestSize.height, image2ClosestSize.width, image2ClosestSize.height );
464
465   Integration::ResourcePointer resourcePtr2(bitmap2); // reference it
466   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr2);
467   application.Render();           // Process LoadComplete
468   application.SendNotification(); // Process event messages
469   application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
470   application.GetPlatform().ClearReadyResources(); //
471
472   application.SendNotification(); // Process event messages
473   application.Render();           // Process LoadComplete
474
475   // Ensure the actor size gets the new image's natural size
476   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize2, TEST_LOCATION );
477   END_TEST;
478 }
479
480 int UtcDaliImageActorNaturalPixelAreaSize01(void)
481 {
482   TestApplication application;
483   tet_infoline("Positive test for Dali::ImageActor::GetCurrentSize - check a new image doens't change actor size until load complete");
484
485 //If an image is loaded without setting size, then the actor gets the natural size of the image
486 //Setting the pixel area will change the actor size to match the pixel area
487 //Setting the actor size will not change pixel area, and will cause the partial image to stretch
488 //to the new size.
489 //Clearing the pixel area will not change actor size, and the actor will show the whole image.
490
491
492   Vector2 closestImageSize( 80, 45);
493   application.GetPlatform().SetClosestImageSize(closestImageSize);
494
495   ImageAttributes attrs;
496   const Vector2 requestedSize( 40, 30 );
497   attrs.SetSize( requestedSize.width, requestedSize.height );
498   Image image = ResourceImage::New("image.jpg", attrs);
499   ImageActor actor = ImageActor::New( image );
500   Stage::GetCurrent().Add(actor);
501
502   application.SendNotification(); // Flush update messages
503   application.Render();           // Process resource request
504
505   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
506
507   // Now complete the image load
508   Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
509   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
510   bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
511
512   Integration::ResourcePointer resourcePtr(bitmap); // reference it
513   application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
514   application.Render();           // Process LoadComplete
515   application.SendNotification(); // Process event messages
516   application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
517   application.GetPlatform().ClearReadyResources(); //
518
519   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION );
520
521   // Set a pixel area on a naturally sized actor - expect the actor to take the
522   // pixel area as size
523   actor.SetPixelArea(ImageActor::PixelArea(0, 0, 30, 30));
524   application.SendNotification(); // Process event messages
525   application.Render();           // Process LoadComplete
526   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(30, 30), TEST_LOCATION );
527
528   // Set a size. Expect the partial image to stretch to fill the new size
529   actor.SetSize(100, 100);
530   application.SendNotification(); // Process event messages
531   application.Render();           // Process LoadComplete
532   application.Render();           // Process LoadComplete
533   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(100, 100), TEST_LOCATION );
534
535   // Clear the pixel area. Expect the whole image to be shown, filling the set size.
536   actor.ClearPixelArea();
537   application.SendNotification(); // Process event messages
538   application.Render();           // Process LoadComplete
539   DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(100, 100), TEST_LOCATION );
540   END_TEST;
541 }
542
543 int UtcDaliImageActorNaturalPixelAreaSize02(void)
544 {
545   TestApplication application;
546   tet_infoline("Positive test for Dali::ImageActor::GetCurrentSize - check a new image doens't change actor size until load complete");
547
548 //If an image is loaded without setting size, then the actor gets the natural size of the image
549 //Setting the pixel area will change the actor size to match the pixel area
550 //Setting the actor size will not change pixel area, and will cause the partial image to stretch
551 //to the new size.
552 //Clearing the pixel area will not change actor size, and the actor will show the whole image.
553
554
555   Vector2 closestImageSize( 80, 45);
556   application.GetPlatform().SetClosestImageSize(closestImageSize);
557
558   ImageAttributes attrs;
559   const Vector2 requestedSize( 40, 30 );
560   attrs.SetSize( requestedSize.width, requestedSize.height );
561   Image image = ResourceImage::New("image.jpg", attrs);
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.ClearPixelArea();
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.ClearPixelArea();
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 UtcDaliImageActorClearPixelArea(void)
783 {
784   TestApplication application;
785
786   BufferImage img = BufferImage::New( 10, 10 );
787   ImageActor actor = ImageActor::New( img );
788
789   DALI_TEST_CHECK( actor.IsPixelAreaSet() == false );
790
791   ImageActor::PixelArea area( 1, 2, 3, 4 );
792   actor.SetPixelArea( area );
793
794   DALI_TEST_CHECK( actor.IsPixelAreaSet() == true );
795
796   actor.ClearPixelArea();
797
798   DALI_TEST_CHECK( actor.IsPixelAreaSet() == false );
799   END_TEST;
800 }
801
802 int UtcDaliImageGetStyle(void)
803 {
804   TestApplication application;
805
806   Image image = ResourceImage::New(TestImageFilename);
807   ImageActor actor = ImageActor::New(image);
808
809   actor.SetStyle(ImageActor::STYLE_NINE_PATCH);
810
811   // flush the queue and render once
812   application.SendNotification();
813   application.Render();
814
815   DALI_TEST_EQUALS( ImageActor::STYLE_NINE_PATCH, actor.GetStyle(), TEST_LOCATION );
816   END_TEST;
817 }
818
819 int UtcDaliImageSetNinePatchBorder(void)
820 {
821   TestApplication application;
822
823   Image image = ResourceImage::New(TestImageFilename);
824   ImageActor actor = ImageActor::New(image);
825
826   actor.SetStyle(ImageActor::STYLE_NINE_PATCH);
827   actor.SetNinePatchBorder(Vector4( 1.0f, 2.0f, 3.0f, 4.0f));
828
829   DALI_TEST_EQUALS( 1.0f, actor.GetNinePatchBorder().x, TEST_LOCATION );
830   DALI_TEST_EQUALS( 2.0f, actor.GetNinePatchBorder().y, TEST_LOCATION );
831   DALI_TEST_EQUALS( 3.0f, actor.GetNinePatchBorder().z, TEST_LOCATION );
832   DALI_TEST_EQUALS( 4.0f, actor.GetNinePatchBorder().w, TEST_LOCATION );
833   END_TEST;
834 }
835
836 int UtcDaliImageActorNewNull(void)
837 {
838   TestApplication application;
839
840   ImageActor actor = ImageActor::New(Image());
841
842   DALI_TEST_CHECK(actor);
843   END_TEST;
844 }
845
846 int UtcDaliImageActorNewNullWithArea(void)
847 {
848   TestApplication application;
849
850   ImageActor::PixelArea area( 1, 2, 3, 4 );
851
852   ImageActor actor = ImageActor::New(Image(), area);
853
854   DALI_TEST_CHECK(actor);
855   END_TEST;
856 }
857
858 int UtcDaliImageActorSetImage(void)
859 {
860   TestApplication application;
861
862   ImageActor actor = ImageActor::New(Image());
863
864   DALI_TEST_CHECK(actor);
865
866   actor.SetImage( Image() );
867
868   DALI_TEST_CHECK(!actor.GetImage());
869   END_TEST;
870 }
871
872 int UtcDaliImageActorPropertyIndices(void)
873 {
874   TestApplication application;
875   Actor basicActor = Actor::New();
876   ImageActor imageActor = ImageActor::New();
877
878   Property::IndexContainer indices;
879   imageActor.GetPropertyIndices( indices );
880   DALI_TEST_CHECK( indices.size() > basicActor.GetPropertyCount() );
881   DALI_TEST_EQUALS( indices.size(), imageActor.GetPropertyCount(), TEST_LOCATION );
882   END_TEST;
883 }
884
885 int UtcDaliImageActorImageProperty(void)
886 {
887   TestApplication application;
888   Image image = ResourceImage::New( "MY_PATH" );
889   ImageActor imageActor = ImageActor::New( image );
890
891   Stage::GetCurrent().Add( imageActor );
892   application.SendNotification();
893   application.Render();
894
895   Property::Value imageMap = imageActor.GetProperty( ImageActor::Property::IMAGE );
896   DALI_TEST_CHECK( imageMap.HasKey( "filename" ) );
897   DALI_TEST_EQUALS( imageMap.GetValue( "filename" ).Get< std::string >(), "MY_PATH", TEST_LOCATION );
898   END_TEST;
899 }
900
901 int UtcDaliImageActorNinePatch01(void)
902 {
903   TestApplication application;
904   TestPlatformAbstraction& platform = application.GetPlatform();
905   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
906   TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
907   TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
908
909   tet_infoline("Test the successful loading of a nine-patch image\n");
910
911   platform.SetClosestImageSize(Vector2(4, 4));
912   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
913   Integration::PixelBuffer* pixels = bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  4,4,4,4 );
914   memset( pixels, 0, 64 );
915
916   Integration::ResourcePointer resourcePtr(bitmap); // reference it
917   platform.SetResourceLoaded( 0, Dali::Integration::ResourceBitmap, resourcePtr );
918
919   Image ninePatchImage = ResourceImage::New( "blah.#.png" );
920   DALI_TEST_CHECK( ninePatchImage );
921
922   ImageActor imageActor = ImageActor::New( ninePatchImage );
923   DALI_TEST_CHECK( imageActor );
924   Stage::GetCurrent().Add( imageActor );
925
926   drawTrace.Reset();
927   textureTrace.Reset();
928   drawTrace.Enable(true);
929   textureTrace.Enable(true);
930   glAbstraction.ClearBoundTextures();
931   std::vector<GLuint> ids;
932   ids.push_back( 23 );
933   glAbstraction.SetNextTextureIds( ids );
934
935   application.SendNotification();
936   application.Render();
937
938   DALI_TEST_CHECK( drawTrace.FindMethod( "DrawArrays" ) );
939   typedef std::vector<GLuint> TexVec;
940   const TexVec& textures = glAbstraction.GetBoundTextures(GL_TEXTURE0);
941   DALI_TEST_CHECK( textures.size() > 0 );
942   if( textures.size() > 0 )
943   {
944     DALI_TEST_EQUALS( textures[0], 23u, TEST_LOCATION );
945   }
946
947   END_TEST;
948 }
949
950
951 int UtcDaliImageActorNinePatch02(void)
952 {
953   TestApplication application;
954   TestPlatformAbstraction& platform = application.GetPlatform();
955   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
956   TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
957   TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
958
959   tet_infoline("Test the failed loading of a nine-patch image\n");
960
961   platform.SetClosestImageSize(Vector2(0, 0));
962   Integration::ResourcePointer resourcePtr;
963   platform.SetResourceLoaded( 0, Dali::Integration::ResourceBitmap, resourcePtr );
964
965   Image ninePatchImage = ResourceImage::New( "blah.#.png" );
966   DALI_TEST_CHECK( ninePatchImage );
967
968   ImageActor imageActor = ImageActor::New( ninePatchImage );
969   DALI_TEST_CHECK( imageActor );
970   Stage::GetCurrent().Add( imageActor );
971
972   drawTrace.Reset();
973   textureTrace.Reset();
974   drawTrace.Enable(true);
975   textureTrace.Enable(true);
976   glAbstraction.ClearBoundTextures();
977   std::vector<GLuint> ids;
978   ids.push_back( 23 );
979   glAbstraction.SetNextTextureIds( ids );
980
981   application.SendNotification();
982   application.Render();
983
984   // Check that nothing was drawn.
985   DALI_TEST_CHECK( ! drawTrace.FindMethod( "DrawArrays" ) );
986   typedef std::vector<GLuint> TexVec;
987   const TexVec& textures = glAbstraction.GetBoundTextures(GL_TEXTURE0);
988   DALI_TEST_CHECK( textures.size() == 0u );
989
990   END_TEST;
991 }
992
993
994 int UtcDaliImageActorNinePatch03(void)
995 {
996   TestApplication application;
997   TestPlatformAbstraction& platform = application.GetPlatform();
998   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
999   TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
1000   TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
1001
1002   tet_infoline("Test the successful loading of a nine-patch image added using ImageActor::SetImage()\n");
1003
1004   platform.SetClosestImageSize(Vector2(4, 4));
1005   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN );
1006   Integration::PixelBuffer* pixels = bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  4,4,4,4 );
1007   memset( pixels, 0, 64 );
1008
1009   Integration::ResourcePointer resourcePtr(bitmap); // reference it
1010   platform.SetResourceLoaded( 0, Dali::Integration::ResourceBitmap, resourcePtr );
1011
1012   Image ninePatchImage = ResourceImage::New( "blah.#.png" );
1013   DALI_TEST_CHECK( ninePatchImage );
1014
1015   ImageActor imageActor = ImageActor::New();
1016   DALI_TEST_CHECK( imageActor );
1017   Stage::GetCurrent().Add( imageActor );
1018
1019   imageActor.SetImage( ninePatchImage );
1020
1021   drawTrace.Reset();
1022   textureTrace.Reset();
1023   drawTrace.Enable(true);
1024   textureTrace.Enable(true);
1025   glAbstraction.ClearBoundTextures();
1026   std::vector<GLuint> ids;
1027   ids.push_back( 23 );
1028   glAbstraction.SetNextTextureIds( ids );
1029
1030   application.SendNotification();
1031   application.Render();
1032
1033   DALI_TEST_CHECK( drawTrace.FindMethod( "DrawArrays" ) );
1034   typedef std::vector<GLuint> TexVec;
1035   const TexVec& textures = glAbstraction.GetBoundTextures(GL_TEXTURE0);
1036   DALI_TEST_CHECK( textures.size() > 0 );
1037   if( textures.size() > 0 )
1038   {
1039     DALI_TEST_EQUALS( textures[0], 23u, TEST_LOCATION );
1040   }
1041
1042   END_TEST;
1043 }
1044
1045
1046 int UtcDaliImageActorNinePatch04(void)
1047 {
1048   TestApplication application;
1049   TestPlatformAbstraction& platform = application.GetPlatform();
1050   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
1051   TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
1052   TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
1053
1054   tet_infoline("Test the failed loading of a nine-patch image using ImageActor::SetImage()\n");
1055
1056   platform.SetClosestImageSize(Vector2(0, 0));
1057   Integration::ResourcePointer resourcePtr;
1058   platform.SetResourceLoaded( 0, Dali::Integration::ResourceBitmap, resourcePtr );
1059
1060   Image ninePatchImage = ResourceImage::New( "blah.#.png" );
1061   DALI_TEST_CHECK( ninePatchImage );
1062
1063   ImageActor imageActor = ImageActor::New();
1064   DALI_TEST_CHECK( imageActor );
1065   Stage::GetCurrent().Add( imageActor );
1066
1067   imageActor.SetImage( ninePatchImage );
1068
1069   drawTrace.Reset();
1070   textureTrace.Reset();
1071   drawTrace.Enable(true);
1072   textureTrace.Enable(true);
1073   glAbstraction.ClearBoundTextures();
1074   std::vector<GLuint> ids;
1075   ids.push_back( 23 );
1076   glAbstraction.SetNextTextureIds( ids );
1077
1078   application.SendNotification();
1079   application.Render();
1080
1081   // Check that nothing was drawn.
1082   DALI_TEST_CHECK( ! drawTrace.FindMethod( "DrawArrays" ) );
1083   typedef std::vector<GLuint> TexVec;
1084   const TexVec& textures = glAbstraction.GetBoundTextures(GL_TEXTURE0);
1085   DALI_TEST_CHECK( textures.size() == 0u );
1086
1087   END_TEST;
1088 }
1089
1090 int UtcDaliImageActorGetNaturalSize(void)
1091 {
1092   TestApplication application;
1093
1094   // Standard image
1095   BufferImage img = BufferImage::New( 10, 10 );
1096   ImageActor actor = ImageActor::New( img );
1097
1098   DALI_TEST_CHECK( actor.GetNaturalSize().GetVectorXY() == Vector2( 10, 10 ) );
1099
1100   // Pixel area set
1101   ImageActor::PixelArea area( 1, 2, 3, 4 );
1102   actor.SetPixelArea( area );
1103
1104   DALI_TEST_CHECK( actor.GetNaturalSize().GetVectorXY() == Vector2( 3, 4 ) );
1105
1106   END_TEST;
1107 }