[dali_1.4.32] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-Control.cpp
1 /*
2  * Copyright (c) 2019 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
21 // Need to override adaptor classes for toolkit test harness, so include
22 // test harness headers before dali headers.
23 #include <dali-toolkit-test-suite-utils.h>
24
25 #include <dali.h>
26 #include <dali-toolkit/dali-toolkit.h>
27 #include <dali-toolkit/public-api/align-enumerations.h>
28 #include <dali-toolkit/devel-api/controls/control-devel.h>
29 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
30 #include <dali-toolkit/devel-api/visuals/image-visual-actions-devel.h>
31
32
33 #include <toolkit-event-thread-callback.h>
34
35 #include "dummy-control.h"
36
37 using namespace Dali;
38 using namespace Dali::Toolkit;
39
40 void utc_dali_toolkit_control_startup(void)
41 {
42   test_return_value = TET_UNDEF;
43 }
44
45 void utc_dali_toolkit_control_cleanup(void)
46 {
47   test_return_value = TET_PASS;
48 }
49
50 ///////////////////////////////////////////////////////////////////////////////////////////////////
51
52 namespace
53 {
54
55 bool gObjectCreatedCallBackCalled;
56
57 void TestCallback(BaseHandle handle)
58 {
59   gObjectCreatedCallBackCalled = true;
60 }
61
62 void TestVoidCallback()
63 {
64 }
65
66 static bool gKeyInputFocusCallBackCalled;
67
68 static void TestKeyInputFocusCallback( Control control )
69 {
70   tet_infoline(" TestKeyInputFocusCallback");
71
72   gKeyInputFocusCallBackCalled = true;
73 }
74
75 const char* TEST_LARGE_IMAGE_FILE_NAME =  TEST_RESOURCE_DIR "/tbcol.png";
76 const char* TEST_IMAGE_FILE_NAME =  TEST_RESOURCE_DIR "/gallery-small-1.jpg";
77
78 Vector4 GetControlBackgroundColor( Control& control )
79 {
80   Property::Value propValue = control.GetProperty( Control::Property::BACKGROUND );
81   Property::Map* resultMap = propValue.GetMap();
82   DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR ) );
83
84   Vector4 color;
85   resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get( color );
86
87   return color;
88 }
89
90 } // namespace
91
92 ///////////////////////////////////////////////////////////////////////////////////////////////////
93
94
95 int UtcDaliControlConstructor(void)
96 {
97   ToolkitTestApplication application;  // Exceptions require ToolkitTestApplication
98
99   DummyControl dummy;
100
101   DALI_TEST_CHECK( !Control::DownCast(dummy) );
102
103   dummy = DummyControl::New();
104
105   DALI_TEST_CHECK( Control::DownCast(dummy) );
106   END_TEST;
107 }
108
109 int UtcDaliControlNew(void)
110 {
111   ToolkitTestApplication application;  // Exceptions require ToolkitTestApplication
112
113   Control control;
114
115   DALI_TEST_CHECK( !Control::DownCast(control) );
116
117   control = Control::New();
118
119   DALI_TEST_CHECK( Control::DownCast(control) );
120   END_TEST;
121 }
122
123
124 int UtcDaliControlRegister(void)
125 {
126   ToolkitTestApplication application;
127
128   // Ensure the object is registered after creation
129   ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
130   DALI_TEST_CHECK( registry );
131
132   gObjectCreatedCallBackCalled = false;
133   registry.ObjectCreatedSignal().Connect( &TestCallback );
134   {
135     Alignment alignment = Alignment::New();
136   }
137   DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
138   END_TEST;
139 }
140
141 int UtcDaliControlCopyAndAssignment(void)
142 {
143   ToolkitTestApplication application;
144
145   DummyControl control = DummyControl::New();
146   Control emptyControl;
147
148   Control controlCopy( control );
149   DALI_TEST_CHECK( control == controlCopy );
150
151   Control emptyControlCopy( emptyControl );
152   DALI_TEST_CHECK( emptyControl == emptyControlCopy );
153
154   Control controlEquals;
155   controlEquals = control;
156   DALI_TEST_CHECK( control == controlEquals );
157
158   Control emptyControlEquals;
159   emptyControlEquals = emptyControl;
160   DALI_TEST_CHECK( emptyControl == emptyControlEquals );
161
162   // Self assignment
163   control = control;
164   DALI_TEST_CHECK( control == controlCopy );
165   END_TEST;
166 }
167
168 int UtcDaliControlDownCast(void)
169 {
170   ToolkitTestApplication application;
171
172   DummyControl control;
173
174   DALI_TEST_CHECK( !Control::DownCast( control ) );
175
176   control = DummyControl::New();
177
178   DALI_TEST_CHECK( Control::DownCast( control ) );
179
180   Actor actor;
181
182   DALI_TEST_CHECK( !Control::DownCast( actor ) );
183
184   actor = Actor::New();
185
186   DALI_TEST_CHECK( !Control::DownCast( actor ) );
187   END_TEST;
188 }
189
190 int UtcDaliControlDownCastTemplate(void)
191 {
192   ToolkitTestApplication application;
193
194   DummyControl control;
195
196   DALI_TEST_CHECK( !DummyControl::DownCast( control ));
197
198   control = DummyControl::New();
199
200   DALI_TEST_CHECK( DummyControl::DownCast( control ) );
201
202   Actor actor;
203
204   DALI_TEST_CHECK( !DummyControl::DownCast( actor ) );
205
206   actor = Actor::New();
207
208   DALI_TEST_CHECK( !DummyControl::DownCast( actor ) );
209   END_TEST;
210 }
211
212 int UtcDaliControlNavigationProperties(void)
213 {
214   ToolkitTestApplication application;
215
216   Control control = Control::New();
217   Stage::GetCurrent().Add( control );
218
219   DALI_TEST_EQUALS( -1, control.GetProperty( DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
220   DALI_TEST_EQUALS( -1, control.GetProperty( DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
221   DALI_TEST_EQUALS( -1, control.GetProperty( DevelControl::Property::UP_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
222   DALI_TEST_EQUALS( -1, control.GetProperty( DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
223
224   control.SetProperty( DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID, 1 );
225   DALI_TEST_EQUALS( 1, control.GetProperty( DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
226   control.SetProperty( DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID, 2 );
227   DALI_TEST_EQUALS( 2, control.GetProperty( DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
228   control.SetProperty( DevelControl::Property::UP_FOCUSABLE_ACTOR_ID, 3 );
229   DALI_TEST_EQUALS( 3, control.GetProperty( DevelControl::Property::UP_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
230   control.SetProperty( DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID, 4 );
231   DALI_TEST_EQUALS( 4, control.GetProperty( DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
232
233   control.SetProperty( DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID, 15 );
234   DALI_TEST_EQUALS( 15, control.GetProperty( DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
235   control.SetProperty( DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID, 16 );
236   DALI_TEST_EQUALS( 16, control.GetProperty( DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
237   control.SetProperty( DevelControl::Property::UP_FOCUSABLE_ACTOR_ID, 17 );
238   DALI_TEST_EQUALS( 17, control.GetProperty( DevelControl::Property::UP_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
239   control.SetProperty( DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID, 18 );
240   DALI_TEST_EQUALS( 18, control.GetProperty( DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
241
242   END_TEST;
243 }
244
245 int UtcDaliControlKeyInputFocus(void)
246 {
247   ToolkitTestApplication application;
248   Stage stage = Stage::GetCurrent();
249
250   DummyControl control;
251
252   PushButton pushButton1 = PushButton::New();
253   stage.Add( pushButton1 );
254
255   pushButton1.SetKeyInputFocus();
256   DALI_TEST_CHECK( pushButton1.HasKeyInputFocus() );
257
258   pushButton1.ClearKeyInputFocus();
259   DALI_TEST_CHECK( !pushButton1.HasKeyInputFocus() );
260   END_TEST;
261 }
262
263 int UtcDaliControlGetImplementationN(void)
264 {
265   ToolkitTestApplication application;
266   DummyControl control;
267
268   // Get Empty
269   {
270     try
271     {
272       Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( control );
273       (void)controlImpl; // Avoid unused warning
274       tet_result(TET_FAIL);
275     }
276     catch (DaliException &exception)
277     {
278       tet_result(TET_PASS);
279     }
280   }
281   END_TEST;
282 }
283
284 int UtcDaliControlGetImplementationConstN(void)
285 {
286   ToolkitTestApplication application;
287   DummyControl control;
288
289   // Get Const Empty
290   {
291     try
292     {
293       const DummyControl constControl(control);
294       const Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( constControl );
295       (void)controlImpl; // Avoid unused warning
296       tet_result(TET_FAIL);
297     }
298     catch (DaliException &exception)
299     {
300       tet_result(TET_PASS);
301     }
302   }
303   END_TEST;
304 }
305
306 int UtcDaliControlGetImplementationP(void)
307 {
308   ToolkitTestApplication application;
309   DummyControl control = DummyControl::New();
310
311   // Get
312   {
313     try
314     {
315       Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( control );
316       (void)controlImpl; // Avoid unused warning
317       tet_result(TET_PASS);
318     }
319     catch (DaliException &exception)
320     {
321       tet_result(TET_FAIL);
322     }
323   }
324   END_TEST;
325 }
326
327 int UtcDaliControlGetImplementationConstP(void)
328 {
329   ToolkitTestApplication application;
330   DummyControl control = DummyControl::New();
331   // Get Const
332   {
333     try
334     {
335       const DummyControl constControl(control);
336       const Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( constControl );
337       (void)controlImpl; // Avoid unused warning
338       tet_result(TET_PASS);
339     }
340     catch (DaliException &exception)
341     {
342       tet_result(TET_FAIL);
343     }
344   }
345   END_TEST;
346 }
347
348 int UtcDaliControlSignalConnectDisconnect(void)
349 {
350   ToolkitTestApplication application;
351
352   {
353     DummyControl dummy = DummyControlImpl::New();
354
355     Actor actor = Actor::New();
356     DALI_TEST_EQUALS( actor.OnStageSignal().GetConnectionCount(), 0u, TEST_LOCATION );
357     Toolkit::Internal::Control& control = Toolkit::Internal::GetImplementation( dummy );
358     DummyControlImpl* dummyImpl = dynamic_cast<DummyControlImpl*>(&control);
359
360     if( dummyImpl == NULL )
361     {
362       tet_result( TET_FAIL );
363       END_TEST;
364     }
365
366     actor.OnStageSignal().Connect( dummyImpl, &DummyControlImpl::CustomSlot1 );
367     DALI_TEST_EQUALS( actor.OnStageSignal().GetConnectionCount(), 1u, TEST_LOCATION );
368     DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Called, false, TEST_LOCATION );
369
370     Stage::GetCurrent().Add( actor );
371     DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Called, true, TEST_LOCATION );
372
373     dummyImpl->mCustomSlot1Called = false;
374     actor.OnStageSignal().Disconnect( dummyImpl, &DummyControlImpl::CustomSlot1 );
375     DALI_TEST_EQUALS( actor.OnStageSignal().GetConnectionCount(), 0u, TEST_LOCATION );
376     Stage::GetCurrent().Remove( actor );
377     Stage::GetCurrent().Add( actor );
378     DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Called, false, TEST_LOCATION );
379   }
380   END_TEST;
381 }
382
383 int UtcDaliControlSignalAutomaticDisconnect(void)
384 {
385   ToolkitTestApplication application;
386
387   Actor actor = Actor::New();
388
389   {
390     DummyControl dummy = DummyControlImpl::New();
391     Toolkit::Internal::Control& control = Toolkit::Internal::GetImplementation( dummy );
392     DummyControlImpl* dummyImpl = dynamic_cast<DummyControlImpl*>(&control);
393
394     if( dummyImpl == NULL )
395     {
396       tet_result( TET_FAIL );
397       END_TEST;
398     }
399
400     actor.OnStageSignal().Connect( dummyImpl, &DummyControlImpl::CustomSlot1 );
401     DALI_TEST_EQUALS( actor.OnStageSignal().GetConnectionCount(), 1u, TEST_LOCATION );
402     DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Called, false, TEST_LOCATION );
403
404     Stage::GetCurrent().Add( actor );
405     DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Called, true, TEST_LOCATION );
406     Stage::GetCurrent().Remove( actor );
407   }
408   // dummyControl automatically disconnects
409
410   DALI_TEST_EQUALS( actor.OnStageSignal().GetConnectionCount(), 0u, TEST_LOCATION );
411
412   const Vector3 ignoredSize( 20, 20, 0 );
413   actor.SetSize( ignoredSize );
414   END_TEST;
415 }
416
417 int UtcDaliControlTestParameters(void)
418 {
419   ToolkitTestApplication application;
420   DummyControl test = DummyControl::New();
421
422   test.SetSize( 0.7f, 0.7f, 0.7f );
423
424   Stage::GetCurrent().Add( test );
425
426   application.SendNotification();
427   application.Render();
428
429   float width = 640.0f;
430   float height = test.GetHeightForWidth( width );
431   DALI_TEST_EQUALS( 640.0f, height, TEST_LOCATION );
432   DALI_TEST_EQUALS( 640.0f, test.GetWidthForHeight( height ), TEST_LOCATION );
433
434   test.KeyEventSignal();
435
436   // Provide coverage for pointer destructor
437   Control* testControlPtr = new Control;
438   DALI_TEST_CHECK( testControlPtr );
439   delete testControlPtr;
440   END_TEST;
441 }
442
443 int UtcDaliControlBackgroundColor(void)
444 {
445   ToolkitTestApplication application;
446   Control control = Control::New();
447
448   DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND ).Get< Property::Map >().Empty() );
449
450   control.SetProperty( Control::Property::BACKGROUND, Color::RED );
451
452   Property::Value propValue = control.GetProperty( Control::Property::BACKGROUND );
453   Property::Map* resultMap = propValue.GetMap();
454   DALI_TEST_CHECK( resultMap->Find( Toolkit::Visual::Property::TYPE ) );
455   DALI_TEST_CHECK( resultMap->Find( Toolkit::Visual::Property::TYPE )->Get<int>() == Visual::COLOR );
456   DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR ) );
457   DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get<Vector4>() == Color::RED );
458
459   control.SetProperty( Control::Property::BACKGROUND, Color::YELLOW );
460
461   propValue = control.GetProperty( Control::Property::BACKGROUND );
462   resultMap = propValue.GetMap();
463   DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR ) );
464   DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get<Vector4>() == Color::YELLOW );
465
466   END_TEST;
467 }
468
469 int UtcDaliControlBackgroundColorRendererCount(void)
470 {
471   tet_infoline( "Test ensures we only create renderers when non-transparent color is requested or if we our clipping-mode is set to CLIP_CHILDREN" );
472
473   ToolkitTestApplication application;
474   Control control = Control::New();
475   Stage::GetCurrent().Add( control );
476
477   tet_infoline( "Set transparent, no renderers should be created" );
478   control.SetBackgroundColor( Color::TRANSPARENT );
479   application.SendNotification();
480   application.Render();
481   DALI_TEST_EQUALS( control.GetRendererCount(), 0u, TEST_LOCATION );
482
483   tet_infoline( "Set transparent alpha with positive RGB values, no renderers should be created, but returned color should reflect what we set" );
484   const Vector4 alphaZero( 1.0f, 0.5f, 0.25f, 0.0f );
485   control.SetBackgroundColor( alphaZero );
486   application.SendNotification();
487   application.Render();
488   DALI_TEST_EQUALS( control.GetRendererCount(), 0u, TEST_LOCATION );
489   DALI_TEST_EQUALS( GetControlBackgroundColor( control ), alphaZero, TEST_LOCATION );
490
491   tet_infoline( "Set semi transparent alpha with positive RGB values, 1 renderer should be created, but returned color should reflect what we set" );
492   const Vector4 semiTransparent( 1.0f, 0.75f, 0.5f, 0.5f );
493   control.SetBackgroundColor( semiTransparent );
494   application.SendNotification();
495   application.Render();
496   DALI_TEST_EQUALS( control.GetRendererCount(), 1u, TEST_LOCATION );
497   DALI_TEST_EQUALS( GetControlBackgroundColor( control ), semiTransparent, TEST_LOCATION );
498
499   tet_infoline( "Set transparent, ensure no renderers are created" );
500   control.SetBackgroundColor( Color::TRANSPARENT );
501   application.SendNotification();
502   application.Render();
503   DALI_TEST_EQUALS( control.GetRendererCount(), 0u, TEST_LOCATION );
504   DALI_TEST_EQUALS( GetControlBackgroundColor( control ), Color::TRANSPARENT, TEST_LOCATION );
505
506   tet_infoline( "Set control to clip its children, a renderer should be created which will be transparent" );
507   control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
508   application.SendNotification();
509   application.Render();
510   DALI_TEST_EQUALS( control.GetRendererCount(), 1u, TEST_LOCATION );
511   DALI_TEST_EQUALS( GetControlBackgroundColor( control ), Color::TRANSPARENT, TEST_LOCATION );
512
513   tet_infoline( "Set a color, only 1 renderer should exist" );
514   control.SetBackgroundColor( Color::RED );
515   application.SendNotification();
516   application.Render();
517   DALI_TEST_EQUALS( control.GetRendererCount(), 1u, TEST_LOCATION );
518   DALI_TEST_EQUALS( GetControlBackgroundColor( control ), Color::RED, TEST_LOCATION );
519
520   tet_infoline( "Clear the background, no renderers" );
521   control.ClearBackground();
522   application.SendNotification();
523   application.Render();
524   DALI_TEST_EQUALS( control.GetRendererCount(), 0u, TEST_LOCATION );
525
526   tet_infoline( "Set control to clip its children again, a renderer should be created which will be transparent" );
527   control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
528   application.SendNotification();
529   application.Render();
530   DALI_TEST_EQUALS( control.GetRendererCount(), 1u, TEST_LOCATION );
531   DALI_TEST_EQUALS( GetControlBackgroundColor( control ), Color::TRANSPARENT, TEST_LOCATION );
532
533   tet_infoline( "Disable clipping, no renderers" );
534   control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED );
535   application.SendNotification();
536   application.Render();
537   DALI_TEST_EQUALS( control.GetRendererCount(), 0u, TEST_LOCATION );
538   DALI_TEST_EQUALS( GetControlBackgroundColor( control ), Color::TRANSPARENT, TEST_LOCATION );
539
540   END_TEST;
541 }
542
543 int UtcDaliControlBackgroundImage(void)
544 {
545   ToolkitTestApplication application;
546   Control control = Control::New();
547
548   tet_infoline( "Set first background image" );
549   control.SetProperty( Control::Property::BACKGROUND, "TestImage" );
550
551   Property::Value propValue = control.GetProperty( Control::Property::BACKGROUND );
552   Property::Map* resultMap = propValue.GetMap();
553   DALI_TEST_CHECK( resultMap->Find( Toolkit::Visual::Property::TYPE ) );
554   DALI_TEST_CHECK( resultMap->Find( Toolkit::Visual::Property::TYPE )->Get<int>() == Visual::IMAGE );
555   DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL ) );
556   DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL )->Get<std::string>() == "TestImage" );
557
558   tet_infoline( "Set replacement background image" );
559   control.SetProperty( Control::Property::BACKGROUND, "TestImage2" );
560
561   propValue = control.GetProperty( Control::Property::BACKGROUND );
562   resultMap = propValue.GetMap();
563   DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL ) );
564   DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL )->Get<std::string>() == "TestImage2" );
565
566   END_TEST;
567 }
568
569 int UtcDaliControlBackgroundProperties(void)
570 {
571   ToolkitTestApplication application;
572   Control control = Control::New();
573
574   DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND ).Get< Property::Map >().Empty() );
575
576   Property::Map imageMap;
577   imageMap[ Toolkit::Visual::Property::TYPE ] = Visual::IMAGE;
578   imageMap[ ImageVisual::Property::URL ] = "TestImage";
579   control.SetProperty( Control::Property::BACKGROUND, imageMap );
580   Property::Value propValue = control.GetProperty( Control::Property::BACKGROUND );
581   Property::Map* resultMap = propValue.GetMap();
582   DALI_TEST_CHECK( resultMap->Find( Toolkit::Visual::Property::TYPE ) );
583   DALI_TEST_EQUALS( resultMap->Find( Toolkit::Visual::Property::TYPE )->Get<int>(),(int)Visual::IMAGE, TEST_LOCATION );
584   DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL ) );
585   DALI_TEST_EQUALS( resultMap->Find( ImageVisual::Property::URL )->Get<std::string>(), "TestImage", TEST_LOCATION );
586
587   Property::Map rendererMap;
588   rendererMap[Visual::Property::TYPE] = Visual::COLOR;
589   rendererMap[ColorVisual::Property::MIX_COLOR] = Color::CYAN;
590   control.SetProperty( Control::Property::BACKGROUND, rendererMap );
591   propValue = control.GetProperty( Control::Property::BACKGROUND );
592   resultMap = propValue.GetMap();
593   DALI_TEST_CHECK( resultMap->Find( Toolkit::Visual::Property::TYPE ) );
594   DALI_TEST_EQUALS( resultMap->Find( Toolkit::Visual::Property::TYPE )->Get<int>(), (int)Visual::COLOR, TEST_LOCATION );
595   DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR ) );
596   DALI_TEST_EQUALS( resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get<Vector4>(), Color::CYAN, TEST_LOCATION );
597
598   Property::Map emptyMap;
599   control.SetProperty( Control::Property::BACKGROUND, emptyMap );
600   DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND ).Get< Property::Map >().Empty() );
601
602   // set as URL
603   control.SetProperty( Control::Property::BACKGROUND, "Foobar.png" );
604   propValue = control.GetProperty( Control::Property::BACKGROUND );
605   resultMap = propValue.GetMap();
606   DALI_TEST_EQUALS( resultMap->Find( Toolkit::Visual::Property::TYPE )->Get<int>(), (int)Visual::IMAGE, TEST_LOCATION );
607   DALI_TEST_EQUALS( resultMap->Find( ImageVisual::Property::URL )->Get<std::string>(), "Foobar.png", TEST_LOCATION );
608
609   // set as Color
610   control.SetProperty( Control::Property::BACKGROUND, Color::RED );
611   propValue = control.GetProperty( Control::Property::BACKGROUND );
612   resultMap = propValue.GetMap();
613   DALI_TEST_EQUALS( resultMap->Find( Toolkit::Visual::Property::TYPE )->Get<int>(), (int)Visual::COLOR, TEST_LOCATION );
614   DALI_TEST_EQUALS( resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get<Vector4>(), Color::RED, TEST_LOCATION );
615
616   END_TEST;
617 }
618
619 int UtcDaliControlKeyProperties(void)
620 {
621   ToolkitTestApplication application;
622
623   Control control = Control::New();
624   Stage::GetCurrent().Add( control );
625
626   DALI_TEST_EQUALS( control.HasKeyInputFocus(), control.GetProperty( Control::Property::KEY_INPUT_FOCUS ).Get< bool >(), TEST_LOCATION );
627
628   control.SetKeyInputFocus();
629   DALI_TEST_EQUALS( true, control.GetProperty( Control::Property::KEY_INPUT_FOCUS ).Get< bool >(), TEST_LOCATION );
630
631   control.ClearKeyInputFocus();
632   DALI_TEST_EQUALS( false, control.GetProperty( Control::Property::KEY_INPUT_FOCUS ).Get< bool >(), TEST_LOCATION );
633
634   control.SetProperty( Control::Property::KEY_INPUT_FOCUS, true );
635   DALI_TEST_EQUALS( true, control.HasKeyInputFocus(), TEST_LOCATION );
636
637   END_TEST;
638 }
639
640 int UtcDaliControlGestureSignals(void)
641 {
642   ToolkitTestApplication application;
643   ConnectionTracker connectionTracker;
644   Control control = Control::New();
645
646   // Each gesture detector gets created when connecting to the gesture signals
647   DALI_TEST_CHECK( !control.GetTapGestureDetector() );
648   control.ConnectSignal( &connectionTracker, "tapped", &TestVoidCallback );
649   DALI_TEST_CHECK( control.GetTapGestureDetector() );
650
651   DALI_TEST_CHECK( !control.GetPanGestureDetector() );
652   control.ConnectSignal( &connectionTracker, "panned", &TestVoidCallback );
653   DALI_TEST_CHECK( control.GetPanGestureDetector() );
654
655   DALI_TEST_CHECK( !control.GetPinchGestureDetector() );
656   control.ConnectSignal( &connectionTracker, "pinched", &TestVoidCallback );
657   DALI_TEST_CHECK( control.GetPinchGestureDetector() );
658
659   DALI_TEST_CHECK( !control.GetLongPressGestureDetector() );
660   control.ConnectSignal( &connectionTracker, "longPressed",  &TestVoidCallback );
661   DALI_TEST_CHECK( control.GetLongPressGestureDetector() );
662
663   END_TEST;
664 }
665
666 int UtcDaliControlImplKeyInputFocusGainedSignal(void)
667 {
668   ToolkitTestApplication application;
669
670   Control control = Control::New();
671   Stage::GetCurrent().Add( control );
672
673   gKeyInputFocusCallBackCalled = false;
674   control.KeyInputFocusGainedSignal().Connect(&TestKeyInputFocusCallback);
675
676   application.SendNotification();
677   application.Render();
678
679   control.SetKeyInputFocus();
680
681   DALI_TEST_CHECK( control.HasKeyInputFocus() );
682
683   DALI_TEST_CHECK( gKeyInputFocusCallBackCalled );
684
685   END_TEST;
686 }
687
688 int UtcDaliControlImplKeyInputFocusLostSignal(void)
689 {
690   ToolkitTestApplication application;
691
692   Control control = Control::New();
693   Stage::GetCurrent().Add( control );
694
695   gKeyInputFocusCallBackCalled = false;
696   control.KeyInputFocusLostSignal().Connect(&TestKeyInputFocusCallback);
697
698   application.SendNotification();
699   application.Render();
700
701   control.SetKeyInputFocus();
702
703   DALI_TEST_CHECK( control.HasKeyInputFocus() );
704
705   control.ClearKeyInputFocus();
706
707   DALI_TEST_CHECK( gKeyInputFocusCallBackCalled );
708
709   END_TEST;
710 }
711
712 int UtcDaliControlImplGetControlExtensionP(void)
713 {
714   ToolkitTestApplication application;
715   Control control = Control::New();
716
717   Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( control );
718
719   DALI_TEST_CHECK( NULL == controlImpl.GetControlExtension() );
720
721   END_TEST;
722 }
723
724 int UtcDaliControlAutoClipping(void)
725 {
726   ToolkitTestApplication application;
727   Control control = Control::New();
728
729   tet_infoline( "Test to see if a renderer gets added when we are clipping children" );
730
731   DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION );
732
733   control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
734
735   Stage::GetCurrent().Add( control );
736
737   application.SendNotification();
738   application.Render();
739
740   DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION );
741
742   END_TEST;
743 }
744
745 int UtcDaliControlAutoClippingN(void)
746 {
747   ToolkitTestApplication application;
748   Control control = Control::New();
749   control.SetProperty( Control::Property::BACKGROUND, Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::COLOR )
750                                                                      .Add( ColorVisual::Property::MIX_COLOR, Color::RED ) );
751
752   tet_infoline( "Test to ensure that a renderer does NOT get added when we are clipping children and already have renderers/visuals" );
753
754   DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION );
755
756   control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
757
758   Stage::GetCurrent().Add( control );
759
760   application.SendNotification();
761   application.Render();
762
763   DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION ); // Only 1, not 2
764
765   // Ensure the background color is still RED rather than what's set by the automatic clipping
766   Property::Value value = control.GetProperty( Control::Property::BACKGROUND );
767   Property::Map* map = value.GetMap();
768   DALI_TEST_CHECK( map );
769   Property::Value* colorValue = map->Find(ColorVisual::Property::MIX_COLOR );
770   DALI_TEST_CHECK( colorValue );
771   DALI_TEST_EQUALS( colorValue->Get< Vector4 >(), Color::RED, TEST_LOCATION );
772
773   END_TEST;
774 }
775
776 int UtcDaliControlAutoClippingWhenAlreadyOnStage(void)
777 {
778   ToolkitTestApplication application;
779   Control control = Control::New();
780
781   tet_infoline( "Test to see if a renderer gets added when we are clipping children and when already on stage" );
782
783   DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION );
784
785   Stage::GetCurrent().Add( control );
786
787   application.SendNotification();
788   application.Render();
789
790   DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION );
791
792   control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
793
794   application.SendNotification();
795   application.Render();
796
797   DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION );
798
799   END_TEST;
800 }
801
802 int UtcDaliControlAutoClippingWhenAlreadyOnStageN(void)
803 {
804   ToolkitTestApplication application;
805   Control control = Control::New();
806   control.SetProperty( Control::Property::BACKGROUND, Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::COLOR )
807                                                                      .Add( ColorVisual::Property::MIX_COLOR, Color::RED ) );
808
809   tet_infoline( "Test to ensure that a renderer does NOT get added when we are clipping children and already have renderers/visuals and when already on stage" );
810
811   DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION );
812
813   Stage::GetCurrent().Add( control );
814
815   application.SendNotification();
816   application.Render();
817
818   DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION );
819
820   control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
821
822   application.SendNotification();
823   application.Render();
824
825   DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION ); // Still should be 1
826
827   // Ensure the background color is still RED rather than what's set by the automatic clipping
828   Property::Value value = control.GetProperty( Control::Property::BACKGROUND );
829   Property::Map* map = value.GetMap();
830   DALI_TEST_CHECK( map );
831   Property::Value* colorValue = map->Find(ColorVisual::Property::MIX_COLOR );
832   DALI_TEST_CHECK( colorValue );
833   DALI_TEST_EQUALS( colorValue->Get< Vector4 >(), Color::RED, TEST_LOCATION );
834
835   END_TEST;
836 }
837
838 int UtcDaliControlSetTransformSize(void)
839 {
840   ToolkitTestApplication application;
841   Control control = Control::New();
842
843   Property::Map transformMap;
844   transformMap.Add( Visual::Transform::Property::OFFSET, Vector2( 10, 10 ) )
845               .Add( Visual::Transform::Property::ANCHOR_POINT, Align::BOTTOM_END )
846               .Add( Visual::Transform::Property::ORIGIN, Align::BOTTOM_END )
847               .Add( Visual::Transform::Property::SIZE, Vector2( 10, 20 ) );
848
849   control.SetProperty( Control::Property::BACKGROUND, Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::COLOR )
850                                                                      .Add( Visual::Property::TRANSFORM, transformMap ) );
851
852   tet_infoline( "Test to ensure that the control background transform does not get overwritten when adding to the stage" );
853
854   Stage::GetCurrent().Add( control );
855
856   application.SendNotification();
857   application.Render();
858
859   // Ensure the transform property still matches what we set
860   Property::Value value = control.GetProperty( Control::Property::BACKGROUND );
861   Property::Map* map = value.GetMap();
862   DALI_TEST_CHECK( map );
863   Property::Value* transformValue = map->Find( Visual::Property::TRANSFORM );
864   DALI_TEST_CHECK( transformValue );
865
866   Property::Map* retMap = transformValue->GetMap();
867   DALI_TEST_CHECK( retMap );
868   DALI_TEST_EQUALS( retMap->Find( Visual::Transform::Property::OFFSET )->Get< Vector2 >(), Vector2( 10, 10 ), TEST_LOCATION );
869   DALI_TEST_EQUALS( retMap->Find( Visual::Transform::Property::ANCHOR_POINT )->Get< int >(), (int)Align::BOTTOM_END, TEST_LOCATION );
870   DALI_TEST_EQUALS( retMap->Find( Visual::Transform::Property::ORIGIN )->Get< int >(), (int)Align::BOTTOM_END, TEST_LOCATION );
871   DALI_TEST_EQUALS( retMap->Find( Visual::Transform::Property::SIZE )->Get< Vector2 >(), Vector2( 10, 20 ), TEST_LOCATION );
872
873   END_TEST;
874 }
875
876
877 int UtcDaliControlResourcesReady(void)
878 {
879   ToolkitTestApplication application;
880   tet_infoline( "Register 2 visuals and check ResourceReady when a visual is disabled" );
881
882   VisualFactory factory = VisualFactory::Get();
883   DALI_TEST_CHECK( factory );
884
885   Property::Map propertyMapLarge;
886   propertyMapLarge.Insert( Toolkit::Visual::Property::TYPE,  Visual::IMAGE );
887   propertyMapLarge.Insert( ImageVisual::Property::URL,  TEST_LARGE_IMAGE_FILE_NAME );
888
889   Property::Map propertyMapSmall;
890   propertyMapSmall.Insert( Toolkit::Visual::Property::TYPE,  Visual::IMAGE );
891   propertyMapSmall.Insert( ImageVisual::Property::URL,  TEST_IMAGE_FILE_NAME );
892
893   Visual::Base smallVisual = factory.CreateVisual( propertyMapSmall );
894   smallVisual.SetName("smallVisual");
895   DALI_TEST_CHECK( smallVisual );
896
897   DummyControl actor = DummyControl::New();
898   DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
899
900   dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, smallVisual );
901
902   actor.SetSize( 200.f, 200.f );
903
904   Toolkit::Visual::ResourceStatus resourceStatus = actor.GetVisualResourceStatus(DummyControl::Property::TEST_VISUAL);
905   DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
906   DALI_TEST_EQUALS( actor.IsResourceReady(), false, TEST_LOCATION );
907   DALI_TEST_EQUALS( static_cast<int>(resourceStatus), static_cast<int>(Toolkit::Visual::ResourceStatus::PREPARING), TEST_LOCATION );
908
909   Stage::GetCurrent().Add( actor );
910   application.SendNotification();
911   application.Render();
912
913   DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
914
915   application.SendNotification();
916   application.Render();
917
918   resourceStatus = actor.GetVisualResourceStatus(DummyControl::Property::TEST_VISUAL);
919   DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
920   DALI_TEST_EQUALS( actor.IsResourceReady(), true, TEST_LOCATION );
921   DALI_TEST_EQUALS( static_cast<int>(resourceStatus), static_cast<int>(Toolkit::Visual::ResourceStatus::READY), TEST_LOCATION );
922
923   Visual::Base largeVisual = factory.CreateVisual( propertyMapLarge );
924   largeVisual.SetName("largeVisual");
925   DALI_TEST_CHECK( largeVisual );
926
927   tet_infoline( "Register Visual but set disabled, IsResourceReady should be true" );
928
929   dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL2, largeVisual, false );
930
931   resourceStatus = actor.GetVisualResourceStatus(DummyControl::Property::TEST_VISUAL2);
932   DALI_TEST_EQUALS( static_cast<int>(resourceStatus), static_cast<int>(Toolkit::Visual::ResourceStatus::PREPARING), TEST_LOCATION );
933
934   application.SendNotification();
935
936   resourceStatus = actor.GetVisualResourceStatus(DummyControl::Property::TEST_VISUAL2);
937   DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
938   DALI_TEST_EQUALS( actor.IsResourceReady(), true, TEST_LOCATION );
939   DALI_TEST_EQUALS( static_cast<int>(resourceStatus), static_cast<int>(Toolkit::Visual::ResourceStatus::PREPARING), TEST_LOCATION );
940
941   dummyImpl.EnableVisual( DummyControl::Property::TEST_VISUAL2, true );
942
943   DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
944
945   application.SendNotification();
946
947   resourceStatus = actor.GetVisualResourceStatus(DummyControl::Property::TEST_VISUAL2);
948   DALI_TEST_EQUALS( static_cast<int>(resourceStatus), static_cast<int>(Toolkit::Visual::ResourceStatus::READY), TEST_LOCATION );
949
950   END_TEST;
951 }
952
953 int UtcDaliControlMarginProperty(void)
954 {
955   ToolkitTestApplication application;
956
957   Control control = Control::New();
958   control.SetBackgroundColor( Color::BLUE );
959
960   control.SetProperty( Control::Property::MARGIN, Extents( 20, 10, 0, 0 ) );
961
962   Stage::GetCurrent().Add( control );
963
964   application.SendNotification();
965   application.Render();
966
967   DALI_TEST_EQUALS( control.GetProperty<Extents>( Control::Property::MARGIN ), Extents( 20, 10, 0, 0 ), TEST_LOCATION );
968
969   // Parent control has one ImageView as a Child.
970   ImageView image = ImageView::New();
971   image.SetBackgroundColor( Color::RED );
972   image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
973   image.SetProperty( Control::Property::PADDING, Extents( 10, 10, 10, 10 ) );
974   control.Add( image );
975
976   application.SendNotification();
977   application.Render();
978
979   DALI_TEST_EQUALS( image.GetProperty<Extents>( Control::Property::PADDING ), Extents( 10, 10, 10, 10 ), TEST_LOCATION );
980
981   END_TEST;
982 }
983
984 int UtcDaliControlPaddingProperty(void)
985 {
986   ToolkitTestApplication application;
987
988   Control control = Control::New();
989   control.SetBackgroundColor( Color::BLUE );
990
991   control.SetProperty( Control::Property::PADDING, Extents( 15, 10, 5, 10 ) );
992
993   Stage::GetCurrent().Add( control );
994
995   application.SendNotification();
996   application.Render();
997
998   DALI_TEST_EQUALS( control.GetProperty<Extents>( Control::Property::PADDING ), Extents( 15, 10, 5, 10 ), TEST_LOCATION );
999
1000   Control child = Control::New();
1001   control.Add(child);
1002
1003   application.SendNotification();
1004   application.Render();
1005
1006   DALI_TEST_EQUALS( child.GetProperty<Vector3>( Dali::Actor::Property::POSITION ), Vector3( 15, 5, 0 ), TEST_LOCATION );
1007
1008   control.SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION,  Dali::LayoutDirection::RIGHT_TO_LEFT);
1009   application.SendNotification();
1010   application.Render();
1011   DALI_TEST_EQUALS( child.GetProperty<Vector3>( Dali::Actor::Property::POSITION ), Vector3( 10, 5, 0 ), TEST_LOCATION );
1012
1013   control.SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION,  Dali::LayoutDirection::LEFT_TO_RIGHT);
1014   application.SendNotification();
1015   application.Render();
1016
1017   DALI_TEST_EQUALS( child.GetProperty<Vector3>( Dali::Actor::Property::POSITION ), Vector3( 15, 5, 0 ), TEST_LOCATION );
1018
1019   END_TEST;
1020 }
1021
1022 int UtcDaliControlDoAction(void)
1023 {
1024   ToolkitTestApplication application;
1025   tet_infoline( "DoAction on a visual registered with a control" );
1026
1027   // Set up trace debug
1028   TestGlAbstraction& gl = application.GetGlAbstraction();
1029   TraceCallStack& textureTrace = gl.GetTextureTrace();
1030   textureTrace.Enable( true );
1031
1032   //Created AnimatedImageVisual
1033   VisualFactory factory = VisualFactory::Get();
1034   Visual::Base imageVisual = factory.CreateVisual( TEST_IMAGE_FILE_NAME, ImageDimensions() );
1035
1036   DummyControl dummyControl = DummyControl::New(true);
1037   Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
1038
1039   dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, imageVisual );
1040   dummyControl.SetSize(200.f, 200.f);
1041   Stage::GetCurrent().Add( dummyControl );
1042
1043   DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
1044
1045   application.SendNotification();
1046   application.Render();
1047   DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 0, TEST_LOCATION );
1048   DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
1049   textureTrace.Reset();
1050
1051   Property::Map attributes;
1052   DevelControl::DoAction( dummyControl,  DummyControl::Property::TEST_VISUAL, DevelImageVisual::Action::RELOAD, attributes );
1053
1054   tet_infoline( "Perform RELOAD action. should reload Image and generate a texture" );
1055   DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
1056
1057   application.SendNotification();
1058   application.Render();
1059   DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 1, TEST_LOCATION );
1060   DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
1061   END_TEST;
1062 }
1063
1064 int UtcDaliControlDoActionWhenNotStage(void)
1065 {
1066   ToolkitTestApplication application;
1067   tet_infoline( "DoAction on a visual registered with a control but not staged" );
1068
1069   // Set up trace debug
1070   TestGlAbstraction& gl = application.GetGlAbstraction();
1071   TraceCallStack& textureTrace = gl.GetTextureTrace();
1072   textureTrace.Enable( true );
1073
1074   //Created AnimatedImageVisual
1075   VisualFactory factory = VisualFactory::Get();
1076   Visual::Base imageVisual = factory.CreateVisual( TEST_IMAGE_FILE_NAME, ImageDimensions() );
1077
1078   DummyControl dummyControl = DummyControl::New(true);
1079   Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
1080
1081   dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, imageVisual );
1082   dummyControl.SetSize(200.f, 200.f);
1083
1084   application.SendNotification();
1085   application.Render();
1086   DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 0, TEST_LOCATION );
1087   DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), false, TEST_LOCATION );
1088   textureTrace.Reset();
1089
1090   Property::Map attributes;
1091   DevelControl::DoAction( dummyControl,  DummyControl::Property::TEST_VISUAL, DevelImageVisual::Action::RELOAD, attributes );
1092
1093   tet_infoline( "Perform RELOAD action. should reload Image and generate a texture" );
1094   DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
1095
1096   application.SendNotification();
1097   application.Render();
1098   DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
1099   textureTrace.Reset();
1100
1101   tet_infoline( "Adding control to stage will in turn add the visual to the stage" );
1102
1103   Stage::GetCurrent().Add( dummyControl );
1104   application.SendNotification();
1105   application.Render();
1106   tet_infoline( "No change in textures could occurs as already loaded and cached texture will be used" );
1107
1108   DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 0, TEST_LOCATION );
1109   DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), false, TEST_LOCATION );
1110   textureTrace.Reset();
1111
1112   END_TEST;
1113 }