2 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
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>
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/controls/alignment/alignment.h>
30 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
31 #include <dali-toolkit/devel-api/visuals/image-visual-actions-devel.h>
34 #include <toolkit-event-thread-callback.h>
36 #include "dummy-control.h"
39 using namespace Dali::Toolkit;
41 void utc_dali_toolkit_control_startup(void)
43 test_return_value = TET_UNDEF;
46 void utc_dali_toolkit_control_cleanup(void)
48 test_return_value = TET_PASS;
51 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 bool gObjectCreatedCallBackCalled;
58 void TestCallback(BaseHandle handle)
60 gObjectCreatedCallBackCalled = true;
63 void TestVoidCallback()
67 static bool gKeyInputFocusCallBackCalled;
69 static void TestKeyInputFocusCallback( Control control )
71 tet_infoline(" TestKeyInputFocusCallback");
73 gKeyInputFocusCallBackCalled = true;
76 const char* TEST_LARGE_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/tbcol.png";
77 const char* TEST_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
78 const char* TEST_SVG_FILE_NAME = TEST_RESOURCE_DIR "/Kid1.svg";
80 Vector4 GetControlBackgroundColor( Control& control )
82 Property::Value propValue = control.GetProperty( Control::Property::BACKGROUND );
83 Property::Map* resultMap = propValue.GetMap();
84 DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR ) );
87 resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get( color );
92 bool gResourceReadySignalFired = false;
94 void ResourceReadySignal( Control control )
96 if( control.GetVisualResourceStatus( Control::Property::BACKGROUND ) == Visual::ResourceStatus::FAILED )
98 Property::Map propertyMap;
99 propertyMap.Insert( ImageVisual::Property::URL, TEST_SVG_FILE_NAME );
100 control.SetProperty( Control::Property::BACKGROUND, propertyMap );
103 gResourceReadySignalFired = true;
108 ///////////////////////////////////////////////////////////////////////////////////////////////////
111 int UtcDaliControlConstructor(void)
113 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
117 DALI_TEST_CHECK( !Control::DownCast(dummy) );
119 dummy = DummyControl::New();
121 DALI_TEST_CHECK( Control::DownCast(dummy) );
125 int UtcDaliControlNew(void)
127 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
131 DALI_TEST_CHECK( !Control::DownCast(control) );
133 control = Control::New();
135 DALI_TEST_CHECK( Control::DownCast(control) );
140 int UtcDaliControlRegister(void)
142 ToolkitTestApplication application;
144 // Ensure the object is registered after creation
145 ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
146 DALI_TEST_CHECK( registry );
148 gObjectCreatedCallBackCalled = false;
149 registry.ObjectCreatedSignal().Connect( &TestCallback );
151 Alignment alignment = Alignment::New();
153 DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
157 int UtcDaliControlCopyAndAssignment(void)
159 ToolkitTestApplication application;
161 DummyControl control = DummyControl::New();
162 Control emptyControl;
164 Control controlCopy( control );
165 DALI_TEST_CHECK( control == controlCopy );
167 Control emptyControlCopy( emptyControl );
168 DALI_TEST_CHECK( emptyControl == emptyControlCopy );
170 Control controlEquals;
171 controlEquals = control;
172 DALI_TEST_CHECK( control == controlEquals );
174 Control emptyControlEquals;
175 emptyControlEquals = emptyControl;
176 DALI_TEST_CHECK( emptyControl == emptyControlEquals );
180 DALI_TEST_CHECK( control == controlCopy );
184 int UtcDaliControlDownCast(void)
186 ToolkitTestApplication application;
188 DummyControl control;
190 DALI_TEST_CHECK( !Control::DownCast( control ) );
192 control = DummyControl::New();
194 DALI_TEST_CHECK( Control::DownCast( control ) );
198 DALI_TEST_CHECK( !Control::DownCast( actor ) );
200 actor = Actor::New();
202 DALI_TEST_CHECK( !Control::DownCast( actor ) );
206 int UtcDaliControlDownCastTemplate(void)
208 ToolkitTestApplication application;
210 DummyControl control;
212 DALI_TEST_CHECK( !DummyControl::DownCast( control ));
214 control = DummyControl::New();
216 DALI_TEST_CHECK( DummyControl::DownCast( control ) );
220 DALI_TEST_CHECK( !DummyControl::DownCast( actor ) );
222 actor = Actor::New();
224 DALI_TEST_CHECK( !DummyControl::DownCast( actor ) );
228 int UtcDaliControlNavigationProperties(void)
230 ToolkitTestApplication application;
232 Control control = Control::New();
233 application.GetScene().Add( control );
235 DALI_TEST_EQUALS( -1, control.GetProperty( DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
236 DALI_TEST_EQUALS( -1, control.GetProperty( DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
237 DALI_TEST_EQUALS( -1, control.GetProperty( DevelControl::Property::UP_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
238 DALI_TEST_EQUALS( -1, control.GetProperty( DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
240 control.SetProperty( DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID, 1 );
241 DALI_TEST_EQUALS( 1, control.GetProperty( DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
242 control.SetProperty( DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID, 2 );
243 DALI_TEST_EQUALS( 2, control.GetProperty( DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
244 control.SetProperty( DevelControl::Property::UP_FOCUSABLE_ACTOR_ID, 3 );
245 DALI_TEST_EQUALS( 3, control.GetProperty( DevelControl::Property::UP_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
246 control.SetProperty( DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID, 4 );
247 DALI_TEST_EQUALS( 4, control.GetProperty( DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
249 control.SetProperty( DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID, 15 );
250 DALI_TEST_EQUALS( 15, control.GetProperty( DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
251 control.SetProperty( DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID, 16 );
252 DALI_TEST_EQUALS( 16, control.GetProperty( DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
253 control.SetProperty( DevelControl::Property::UP_FOCUSABLE_ACTOR_ID, 17 );
254 DALI_TEST_EQUALS( 17, control.GetProperty( DevelControl::Property::UP_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
255 control.SetProperty( DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID, 18 );
256 DALI_TEST_EQUALS( 18, control.GetProperty( DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION );
261 int UtcDaliControlKeyInputFocus(void)
263 ToolkitTestApplication application;
264 Integration::Scene stage = application.GetScene();
266 DummyControl control;
268 PushButton pushButton1 = PushButton::New();
269 stage.Add( pushButton1 );
271 pushButton1.SetKeyInputFocus();
272 DALI_TEST_CHECK( pushButton1.HasKeyInputFocus() );
274 pushButton1.ClearKeyInputFocus();
275 DALI_TEST_CHECK( !pushButton1.HasKeyInputFocus() );
279 int UtcDaliControlGetImplementationN(void)
281 ToolkitTestApplication application;
282 DummyControl control;
288 Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( control );
289 (void)controlImpl; // Avoid unused warning
290 tet_result(TET_FAIL);
292 catch (DaliException &exception)
294 tet_result(TET_PASS);
300 int UtcDaliControlGetImplementationConstN(void)
302 ToolkitTestApplication application;
303 DummyControl control;
309 const DummyControl constControl(control);
310 const Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( constControl );
311 (void)controlImpl; // Avoid unused warning
312 tet_result(TET_FAIL);
314 catch (DaliException &exception)
316 tet_result(TET_PASS);
322 int UtcDaliControlGetImplementationP(void)
324 ToolkitTestApplication application;
325 DummyControl control = DummyControl::New();
331 Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( control );
332 (void)controlImpl; // Avoid unused warning
333 tet_result(TET_PASS);
335 catch (DaliException &exception)
337 tet_result(TET_FAIL);
343 int UtcDaliControlGetImplementationConstP(void)
345 ToolkitTestApplication application;
346 DummyControl control = DummyControl::New();
351 const DummyControl constControl(control);
352 const Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( constControl );
353 (void)controlImpl; // Avoid unused warning
354 tet_result(TET_PASS);
356 catch (DaliException &exception)
358 tet_result(TET_FAIL);
364 int UtcDaliControlSignalConnectDisconnect(void)
366 ToolkitTestApplication application;
369 DummyControl dummy = DummyControlImpl::New();
371 Actor actor = Actor::New();
372 DALI_TEST_EQUALS( actor.OnStageSignal().GetConnectionCount(), 0u, TEST_LOCATION );
373 Toolkit::Internal::Control& control = Toolkit::Internal::GetImplementation( dummy );
374 DummyControlImpl* dummyImpl = dynamic_cast<DummyControlImpl*>(&control);
376 if( dummyImpl == NULL )
378 tet_result( TET_FAIL );
382 actor.OnStageSignal().Connect( dummyImpl, &DummyControlImpl::CustomSlot1 );
383 DALI_TEST_EQUALS( actor.OnStageSignal().GetConnectionCount(), 1u, TEST_LOCATION );
384 DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Called, false, TEST_LOCATION );
386 application.GetScene().Add( actor );
387 DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Called, true, TEST_LOCATION );
389 dummyImpl->mCustomSlot1Called = false;
390 actor.OnStageSignal().Disconnect( dummyImpl, &DummyControlImpl::CustomSlot1 );
391 DALI_TEST_EQUALS( actor.OnStageSignal().GetConnectionCount(), 0u, TEST_LOCATION );
392 application.GetScene().Remove( actor );
393 application.GetScene().Add( actor );
394 DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Called, false, TEST_LOCATION );
399 int UtcDaliControlSignalAutomaticDisconnect(void)
401 ToolkitTestApplication application;
403 Actor actor = Actor::New();
406 DummyControl dummy = DummyControlImpl::New();
407 Toolkit::Internal::Control& control = Toolkit::Internal::GetImplementation( dummy );
408 DummyControlImpl* dummyImpl = dynamic_cast<DummyControlImpl*>(&control);
410 if( dummyImpl == NULL )
412 tet_result( TET_FAIL );
416 actor.OnStageSignal().Connect( dummyImpl, &DummyControlImpl::CustomSlot1 );
417 DALI_TEST_EQUALS( actor.OnStageSignal().GetConnectionCount(), 1u, TEST_LOCATION );
418 DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Called, false, TEST_LOCATION );
420 application.GetScene().Add( actor );
421 DALI_TEST_EQUALS( dummyImpl->mCustomSlot1Called, true, TEST_LOCATION );
422 application.GetScene().Remove( actor );
424 // dummyControl automatically disconnects
426 DALI_TEST_EQUALS( actor.OnStageSignal().GetConnectionCount(), 0u, TEST_LOCATION );
428 const Vector3 ignoredSize( 20, 20, 0 );
429 actor.SetProperty( Actor::Property::SIZE, ignoredSize );
433 int UtcDaliControlTestParameters(void)
435 ToolkitTestApplication application;
436 DummyControl test = DummyControl::New();
438 test.SetProperty( Actor::Property::SIZE, Vector3( 0.7f, 0.7f, 0.7f ) );
440 application.GetScene().Add( test );
442 application.SendNotification();
443 application.Render();
445 float width = 640.0f;
446 float height = test.GetHeightForWidth( width );
447 DALI_TEST_EQUALS( 640.0f, height, TEST_LOCATION );
448 DALI_TEST_EQUALS( 640.0f, test.GetWidthForHeight( height ), TEST_LOCATION );
450 test.KeyEventSignal();
452 // Provide coverage for pointer destructor
453 Control* testControlPtr = new Control;
454 DALI_TEST_CHECK( testControlPtr );
455 delete testControlPtr;
459 int UtcDaliControlBackgroundColor(void)
461 ToolkitTestApplication application;
462 Control control = Control::New();
464 DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND ).Get< Property::Map >().Empty() );
466 control.SetProperty( Control::Property::BACKGROUND, Color::RED );
468 Property::Value propValue = control.GetProperty( Control::Property::BACKGROUND );
469 Property::Map* resultMap = propValue.GetMap();
470 DALI_TEST_CHECK( resultMap->Find( Toolkit::Visual::Property::TYPE ) );
471 DALI_TEST_CHECK( resultMap->Find( Toolkit::Visual::Property::TYPE )->Get<int>() == Visual::COLOR );
472 DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR ) );
473 DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get<Vector4>() == Color::RED );
475 control.SetProperty( Control::Property::BACKGROUND, Color::YELLOW );
477 propValue = control.GetProperty( Control::Property::BACKGROUND );
478 resultMap = propValue.GetMap();
479 DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR ) );
480 DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get<Vector4>() == Color::YELLOW );
485 int UtcDaliControlBackgroundColorRendererCount(void)
487 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" );
489 ToolkitTestApplication application;
490 Control control = Control::New();
491 application.GetScene().Add( control );
493 tet_infoline( "Set transparent, no renderers should be created" );
494 control.SetBackgroundColor( Color::TRANSPARENT );
495 application.SendNotification();
496 application.Render();
497 DALI_TEST_EQUALS( control.GetRendererCount(), 0u, TEST_LOCATION );
499 tet_infoline( "Set transparent alpha with positive RGB values, no renderers should be created, but returned color should reflect what we set" );
500 const Vector4 alphaZero( 1.0f, 0.5f, 0.25f, 0.0f );
501 control.SetBackgroundColor( alphaZero );
502 application.SendNotification();
503 application.Render();
504 DALI_TEST_EQUALS( control.GetRendererCount(), 0u, TEST_LOCATION );
505 DALI_TEST_EQUALS( GetControlBackgroundColor( control ), alphaZero, TEST_LOCATION );
507 tet_infoline( "Set semi transparent alpha with positive RGB values, 1 renderer should be created, but returned color should reflect what we set" );
508 const Vector4 semiTransparent( 1.0f, 0.75f, 0.5f, 0.5f );
509 control.SetBackgroundColor( semiTransparent );
510 application.SendNotification();
511 application.Render();
512 DALI_TEST_EQUALS( control.GetRendererCount(), 1u, TEST_LOCATION );
513 DALI_TEST_EQUALS( GetControlBackgroundColor( control ), semiTransparent, TEST_LOCATION );
515 tet_infoline( "Set transparent, ensure no renderers are created" );
516 control.SetBackgroundColor( Color::TRANSPARENT );
517 application.SendNotification();
518 application.Render();
519 DALI_TEST_EQUALS( control.GetRendererCount(), 0u, TEST_LOCATION );
520 DALI_TEST_EQUALS( GetControlBackgroundColor( control ), Color::TRANSPARENT, TEST_LOCATION );
522 tet_infoline( "Set control to clip its children, a renderer should be created which will be transparent" );
523 control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
524 application.SendNotification();
525 application.Render();
526 DALI_TEST_EQUALS( control.GetRendererCount(), 1u, TEST_LOCATION );
527 DALI_TEST_EQUALS( GetControlBackgroundColor( control ), Color::TRANSPARENT, TEST_LOCATION );
529 tet_infoline( "Set a color, only 1 renderer should exist" );
530 control.SetBackgroundColor( Color::RED );
531 application.SendNotification();
532 application.Render();
533 DALI_TEST_EQUALS( control.GetRendererCount(), 1u, TEST_LOCATION );
534 DALI_TEST_EQUALS( GetControlBackgroundColor( control ), Color::RED, TEST_LOCATION );
536 tet_infoline( "Clear the background, no renderers" );
537 control.ClearBackground();
538 application.SendNotification();
539 application.Render();
540 DALI_TEST_EQUALS( control.GetRendererCount(), 0u, TEST_LOCATION );
542 tet_infoline( "Set control to clip its children again, a renderer should be created which will be transparent" );
543 control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
544 application.SendNotification();
545 application.Render();
546 DALI_TEST_EQUALS( control.GetRendererCount(), 1u, TEST_LOCATION );
547 DALI_TEST_EQUALS( GetControlBackgroundColor( control ), Color::TRANSPARENT, TEST_LOCATION );
549 tet_infoline( "Disable clipping, no renderers" );
550 control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED );
551 application.SendNotification();
552 application.Render();
553 DALI_TEST_EQUALS( control.GetRendererCount(), 0u, TEST_LOCATION );
554 DALI_TEST_EQUALS( GetControlBackgroundColor( control ), Color::TRANSPARENT, TEST_LOCATION );
559 int UtcDaliControlBackgroundImage(void)
561 ToolkitTestApplication application;
562 Control control = Control::New();
564 tet_infoline( "Set first background image" );
565 control.SetProperty( Control::Property::BACKGROUND, "TestImage" );
567 Property::Value propValue = control.GetProperty( Control::Property::BACKGROUND );
568 Property::Map* resultMap = propValue.GetMap();
569 DALI_TEST_CHECK( resultMap->Find( Toolkit::Visual::Property::TYPE ) );
570 DALI_TEST_CHECK( resultMap->Find( Toolkit::Visual::Property::TYPE )->Get<int>() == Visual::IMAGE );
571 DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL ) );
572 DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL )->Get<std::string>() == "TestImage" );
574 tet_infoline( "Set replacement background image" );
575 control.SetProperty( Control::Property::BACKGROUND, "TestImage2" );
577 propValue = control.GetProperty( Control::Property::BACKGROUND );
578 resultMap = propValue.GetMap();
579 DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL ) );
580 DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL )->Get<std::string>() == "TestImage2" );
585 int UtcDaliControlBackgroundProperties(void)
587 ToolkitTestApplication application;
588 Control control = Control::New();
590 DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND ).Get< Property::Map >().Empty() );
592 Property::Map imageMap;
593 imageMap[ Toolkit::Visual::Property::TYPE ] = Visual::IMAGE;
594 imageMap[ ImageVisual::Property::URL ] = "TestImage";
595 control.SetProperty( Control::Property::BACKGROUND, imageMap );
596 Property::Value propValue = control.GetProperty( Control::Property::BACKGROUND );
597 Property::Map* resultMap = propValue.GetMap();
598 DALI_TEST_CHECK( resultMap->Find( Toolkit::Visual::Property::TYPE ) );
599 DALI_TEST_EQUALS( resultMap->Find( Toolkit::Visual::Property::TYPE )->Get<int>(),(int)Visual::IMAGE, TEST_LOCATION );
600 DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL ) );
601 DALI_TEST_EQUALS( resultMap->Find( ImageVisual::Property::URL )->Get<std::string>(), "TestImage", TEST_LOCATION );
603 Property::Map rendererMap;
604 rendererMap[Visual::Property::TYPE] = Visual::COLOR;
605 rendererMap[ColorVisual::Property::MIX_COLOR] = Color::CYAN;
606 control.SetProperty( Control::Property::BACKGROUND, rendererMap );
607 propValue = control.GetProperty( Control::Property::BACKGROUND );
608 resultMap = propValue.GetMap();
609 DALI_TEST_CHECK( resultMap->Find( Toolkit::Visual::Property::TYPE ) );
610 DALI_TEST_EQUALS( resultMap->Find( Toolkit::Visual::Property::TYPE )->Get<int>(), (int)Visual::COLOR, TEST_LOCATION );
611 DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR ) );
612 DALI_TEST_EQUALS( resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get<Vector4>(), Color::CYAN, TEST_LOCATION );
614 Property::Map emptyMap;
615 control.SetProperty( Control::Property::BACKGROUND, emptyMap );
616 DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND ).Get< Property::Map >().Empty() );
619 control.SetProperty( Control::Property::BACKGROUND, "Foobar.png" );
620 propValue = control.GetProperty( Control::Property::BACKGROUND );
621 resultMap = propValue.GetMap();
622 DALI_TEST_EQUALS( resultMap->Find( Toolkit::Visual::Property::TYPE )->Get<int>(), (int)Visual::IMAGE, TEST_LOCATION );
623 DALI_TEST_EQUALS( resultMap->Find( ImageVisual::Property::URL )->Get<std::string>(), "Foobar.png", TEST_LOCATION );
626 control.SetProperty( Control::Property::BACKGROUND, Color::RED );
627 propValue = control.GetProperty( Control::Property::BACKGROUND );
628 resultMap = propValue.GetMap();
629 DALI_TEST_EQUALS( resultMap->Find( Toolkit::Visual::Property::TYPE )->Get<int>(), (int)Visual::COLOR, TEST_LOCATION );
630 DALI_TEST_EQUALS( resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get<Vector4>(), Color::RED, TEST_LOCATION );
635 int UtcDaliControlShadowProperties(void)
637 ToolkitTestApplication application;
638 Control control = Control::New();
640 DALI_TEST_CHECK( control.GetProperty( DevelControl::Property::SHADOW ).Get< Property::Map >().Empty() );
642 Property::Map imageMap;
643 imageMap[ Toolkit::Visual::Property::TYPE ] = Visual::IMAGE;
644 imageMap[ ImageVisual::Property::URL ] = "TestImage";
645 control.SetProperty( DevelControl::Property::SHADOW, imageMap );
646 Property::Value propValue = control.GetProperty( DevelControl::Property::SHADOW );
647 Property::Map* resultMap = propValue.GetMap();
648 DALI_TEST_CHECK( resultMap->Find( Toolkit::Visual::Property::TYPE ) );
649 DALI_TEST_EQUALS( resultMap->Find( Toolkit::Visual::Property::TYPE )->Get<int>(),(int)Visual::IMAGE, TEST_LOCATION );
650 DALI_TEST_CHECK( resultMap->Find( ImageVisual::Property::URL ) );
651 DALI_TEST_EQUALS( resultMap->Find( ImageVisual::Property::URL )->Get<std::string>(), "TestImage", TEST_LOCATION );
653 Property::Map colorMap;
654 colorMap[Visual::Property::TYPE] = Visual::COLOR;
655 colorMap[ColorVisual::Property::MIX_COLOR] = Color::CYAN;
656 control.SetProperty( DevelControl::Property::SHADOW, colorMap );
657 propValue = control.GetProperty( DevelControl::Property::SHADOW );
658 resultMap = propValue.GetMap();
659 DALI_TEST_CHECK( resultMap->Find( Toolkit::Visual::Property::TYPE ) );
660 DALI_TEST_EQUALS( resultMap->Find( Toolkit::Visual::Property::TYPE )->Get<int>(), (int)Visual::COLOR, TEST_LOCATION );
661 DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR ) );
662 DALI_TEST_EQUALS( resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get<Vector4>(), Color::CYAN, TEST_LOCATION );
664 Property::Map emptyMap;
665 control.SetProperty( DevelControl::Property::SHADOW, emptyMap );
666 DALI_TEST_CHECK( control.GetProperty( DevelControl::Property::SHADOW ).Get< Property::Map >().Empty() );
671 int UtcDaliControlKeyProperties(void)
673 ToolkitTestApplication application;
675 Control control = Control::New();
676 application.GetScene().Add( control );
678 DALI_TEST_EQUALS( control.HasKeyInputFocus(), control.GetProperty( Control::Property::KEY_INPUT_FOCUS ).Get< bool >(), TEST_LOCATION );
680 control.SetKeyInputFocus();
681 DALI_TEST_EQUALS( true, control.GetProperty( Control::Property::KEY_INPUT_FOCUS ).Get< bool >(), TEST_LOCATION );
683 control.ClearKeyInputFocus();
684 DALI_TEST_EQUALS( false, control.GetProperty( Control::Property::KEY_INPUT_FOCUS ).Get< bool >(), TEST_LOCATION );
686 control.SetProperty( Control::Property::KEY_INPUT_FOCUS, true );
687 DALI_TEST_EQUALS( true, control.HasKeyInputFocus(), TEST_LOCATION );
692 int UtcDaliControlGestureSignals(void)
694 ToolkitTestApplication application;
695 ConnectionTracker connectionTracker;
696 Control control = Control::New();
698 // Each gesture detector gets created when connecting to the gesture signals
699 DALI_TEST_CHECK( !control.GetTapGestureDetector() );
700 control.ConnectSignal( &connectionTracker, "tapped", &TestVoidCallback );
701 DALI_TEST_CHECK( control.GetTapGestureDetector() );
703 DALI_TEST_CHECK( !control.GetPanGestureDetector() );
704 control.ConnectSignal( &connectionTracker, "panned", &TestVoidCallback );
705 DALI_TEST_CHECK( control.GetPanGestureDetector() );
707 DALI_TEST_CHECK( !control.GetPinchGestureDetector() );
708 control.ConnectSignal( &connectionTracker, "pinched", &TestVoidCallback );
709 DALI_TEST_CHECK( control.GetPinchGestureDetector() );
711 DALI_TEST_CHECK( !control.GetLongPressGestureDetector() );
712 control.ConnectSignal( &connectionTracker, "longPressed", &TestVoidCallback );
713 DALI_TEST_CHECK( control.GetLongPressGestureDetector() );
718 int UtcDaliControlImplKeyInputFocusGainedSignal(void)
720 ToolkitTestApplication application;
722 Control control = Control::New();
723 application.GetScene().Add( control );
725 gKeyInputFocusCallBackCalled = false;
726 control.KeyInputFocusGainedSignal().Connect(&TestKeyInputFocusCallback);
728 application.SendNotification();
729 application.Render();
731 control.SetKeyInputFocus();
733 DALI_TEST_CHECK( control.HasKeyInputFocus() );
735 DALI_TEST_CHECK( gKeyInputFocusCallBackCalled );
740 int UtcDaliControlImplKeyInputFocusLostSignal(void)
742 ToolkitTestApplication application;
744 Control control = Control::New();
745 application.GetScene().Add( control );
747 gKeyInputFocusCallBackCalled = false;
748 control.KeyInputFocusLostSignal().Connect(&TestKeyInputFocusCallback);
750 application.SendNotification();
751 application.Render();
753 control.SetKeyInputFocus();
755 DALI_TEST_CHECK( control.HasKeyInputFocus() );
757 control.ClearKeyInputFocus();
759 DALI_TEST_CHECK( gKeyInputFocusCallBackCalled );
764 int UtcDaliControlImplGetControlExtensionP(void)
766 ToolkitTestApplication application;
767 Control control = Control::New();
769 Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( control );
771 DALI_TEST_CHECK( NULL == controlImpl.GetControlExtension() );
776 int UtcDaliControlAutoClipping(void)
778 ToolkitTestApplication application;
779 Control control = Control::New();
781 tet_infoline( "Test to see if a renderer gets added when we are clipping children" );
783 DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION );
785 control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
787 application.GetScene().Add( control );
789 application.SendNotification();
790 application.Render();
792 DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION );
797 int UtcDaliControlAutoClippingN(void)
799 ToolkitTestApplication application;
800 Control control = Control::New();
801 control.SetProperty( Control::Property::BACKGROUND, Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::COLOR )
802 .Add( ColorVisual::Property::MIX_COLOR, Color::RED ) );
804 tet_infoline( "Test to ensure that a renderer does NOT get added when we are clipping children and already have renderers/visuals" );
806 DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION );
808 control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
810 application.GetScene().Add( control );
812 application.SendNotification();
813 application.Render();
815 DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION ); // Only 1, not 2
817 // Ensure the background color is still RED rather than what's set by the automatic clipping
818 Property::Value value = control.GetProperty( Control::Property::BACKGROUND );
819 Property::Map* map = value.GetMap();
820 DALI_TEST_CHECK( map );
821 Property::Value* colorValue = map->Find(ColorVisual::Property::MIX_COLOR );
822 DALI_TEST_CHECK( colorValue );
823 DALI_TEST_EQUALS( colorValue->Get< Vector4 >(), Color::RED, TEST_LOCATION );
828 int UtcDaliControlAutoClippingWhenAlreadyOnStage(void)
830 ToolkitTestApplication application;
831 Control control = Control::New();
833 tet_infoline( "Test to see if a renderer gets added when we are clipping children and when already on stage" );
835 DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION );
837 application.GetScene().Add( control );
839 application.SendNotification();
840 application.Render();
842 DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION );
844 control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
846 application.SendNotification();
847 application.Render();
849 DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION );
854 int UtcDaliControlAutoClippingWhenAlreadyOnStageN(void)
856 ToolkitTestApplication application;
857 Control control = Control::New();
858 control.SetProperty( Control::Property::BACKGROUND, Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::COLOR )
859 .Add( ColorVisual::Property::MIX_COLOR, Color::RED ) );
861 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" );
863 DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION );
865 application.GetScene().Add( control );
867 application.SendNotification();
868 application.Render();
870 DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION );
872 control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
874 application.SendNotification();
875 application.Render();
877 DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION ); // Still should be 1
879 // Ensure the background color is still RED rather than what's set by the automatic clipping
880 Property::Value value = control.GetProperty( Control::Property::BACKGROUND );
881 Property::Map* map = value.GetMap();
882 DALI_TEST_CHECK( map );
883 Property::Value* colorValue = map->Find(ColorVisual::Property::MIX_COLOR );
884 DALI_TEST_CHECK( colorValue );
885 DALI_TEST_EQUALS( colorValue->Get< Vector4 >(), Color::RED, TEST_LOCATION );
890 int UtcDaliControlSetTransformSize(void)
892 ToolkitTestApplication application;
893 Control control = Control::New();
895 Property::Map transformMap;
896 transformMap.Add( Visual::Transform::Property::OFFSET, Vector2( 10, 10 ) )
897 .Add( Visual::Transform::Property::ANCHOR_POINT, Align::BOTTOM_END )
898 .Add( Visual::Transform::Property::ORIGIN, Align::BOTTOM_END )
899 .Add( Visual::Transform::Property::SIZE, Vector2( 10, 20 ) );
901 control.SetProperty( Control::Property::BACKGROUND, Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::COLOR )
902 .Add( Visual::Property::TRANSFORM, transformMap ) );
904 tet_infoline( "Test to ensure that the control background transform does not get overwritten when adding to the stage" );
906 application.GetScene().Add( control );
908 application.SendNotification();
909 application.Render();
911 // Ensure the transform property still matches what we set
912 Property::Value value = control.GetProperty( Control::Property::BACKGROUND );
913 Property::Map* map = value.GetMap();
914 DALI_TEST_CHECK( map );
915 Property::Value* transformValue = map->Find( Visual::Property::TRANSFORM );
916 DALI_TEST_CHECK( transformValue );
918 Property::Map* retMap = transformValue->GetMap();
919 DALI_TEST_CHECK( retMap );
920 DALI_TEST_EQUALS( retMap->Find( Visual::Transform::Property::OFFSET )->Get< Vector2 >(), Vector2( 10, 10 ), TEST_LOCATION );
921 DALI_TEST_EQUALS( retMap->Find( Visual::Transform::Property::ANCHOR_POINT )->Get< int >(), (int)Align::BOTTOM_END, TEST_LOCATION );
922 DALI_TEST_EQUALS( retMap->Find( Visual::Transform::Property::ORIGIN )->Get< int >(), (int)Align::BOTTOM_END, TEST_LOCATION );
923 DALI_TEST_EQUALS( retMap->Find( Visual::Transform::Property::SIZE )->Get< Vector2 >(), Vector2( 10, 20 ), TEST_LOCATION );
929 int UtcDaliControlResourcesReady(void)
931 ToolkitTestApplication application;
932 tet_infoline( "Register 2 visuals and check ResourceReady when a visual is disabled" );
934 VisualFactory factory = VisualFactory::Get();
935 DALI_TEST_CHECK( factory );
937 Property::Map propertyMapLarge;
938 propertyMapLarge.Insert( Toolkit::Visual::Property::TYPE, Visual::IMAGE );
939 propertyMapLarge.Insert( ImageVisual::Property::URL, TEST_LARGE_IMAGE_FILE_NAME );
941 Property::Map propertyMapSmall;
942 propertyMapSmall.Insert( Toolkit::Visual::Property::TYPE, Visual::IMAGE );
943 propertyMapSmall.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
945 Visual::Base smallVisual = factory.CreateVisual( propertyMapSmall );
946 smallVisual.SetName("smallVisual");
947 DALI_TEST_CHECK( smallVisual );
949 DummyControl actor = DummyControl::New();
950 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
952 dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, smallVisual );
954 actor.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
956 Toolkit::Visual::ResourceStatus resourceStatus = actor.GetVisualResourceStatus(DummyControl::Property::TEST_VISUAL);
957 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
958 DALI_TEST_EQUALS( actor.IsResourceReady(), false, TEST_LOCATION );
959 DALI_TEST_EQUALS( static_cast<int>(resourceStatus), static_cast<int>(Toolkit::Visual::ResourceStatus::PREPARING), TEST_LOCATION );
961 application.GetScene().Add( actor );
962 application.SendNotification();
963 application.Render();
965 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
967 application.SendNotification();
968 application.Render();
970 resourceStatus = actor.GetVisualResourceStatus(DummyControl::Property::TEST_VISUAL);
971 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
972 DALI_TEST_EQUALS( actor.IsResourceReady(), true, TEST_LOCATION );
973 DALI_TEST_EQUALS( static_cast<int>(resourceStatus), static_cast<int>(Toolkit::Visual::ResourceStatus::READY), TEST_LOCATION );
975 Visual::Base largeVisual = factory.CreateVisual( propertyMapLarge );
976 largeVisual.SetName("largeVisual");
977 DALI_TEST_CHECK( largeVisual );
979 tet_infoline( "Register Visual but set disabled, IsResourceReady should be true" );
981 dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL2, largeVisual, false );
983 resourceStatus = actor.GetVisualResourceStatus(DummyControl::Property::TEST_VISUAL2);
984 DALI_TEST_EQUALS( static_cast<int>(resourceStatus), static_cast<int>(Toolkit::Visual::ResourceStatus::PREPARING), TEST_LOCATION );
986 application.SendNotification();
988 resourceStatus = actor.GetVisualResourceStatus(DummyControl::Property::TEST_VISUAL2);
989 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
990 DALI_TEST_EQUALS( actor.IsResourceReady(), true, TEST_LOCATION );
991 DALI_TEST_EQUALS( static_cast<int>(resourceStatus), static_cast<int>(Toolkit::Visual::ResourceStatus::PREPARING), TEST_LOCATION );
993 dummyImpl.EnableVisual( DummyControl::Property::TEST_VISUAL2, true );
995 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
997 application.SendNotification();
999 resourceStatus = actor.GetVisualResourceStatus(DummyControl::Property::TEST_VISUAL2);
1000 DALI_TEST_EQUALS( static_cast<int>(resourceStatus), static_cast<int>(Toolkit::Visual::ResourceStatus::READY), TEST_LOCATION );
1005 int UtcDaliControlResourcesReady02(void)
1007 ToolkitTestApplication application;
1008 tet_infoline( "Change a resource during ResourceReady callback" );
1010 gResourceReadySignalFired = false;
1012 Control control = Control::New();
1013 control.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
1014 control.ResourceReadySignal().Connect( &ResourceReadySignal );
1016 Property::Map propertyMap;
1017 propertyMap.Insert( ImageVisual::Property::URL, "invalid.jpg" );
1018 control.SetProperty( Control::Property::BACKGROUND, propertyMap );
1020 application.GetScene().Add( control );
1022 application.SendNotification();
1023 application.Render();
1025 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
1027 application.SendNotification();
1028 application.Render();
1030 DALI_TEST_EQUALS( control.IsResourceReady(), true, TEST_LOCATION );
1031 DALI_TEST_EQUALS( gResourceReadySignalFired, true, TEST_LOCATION );
1032 gResourceReadySignalFired = false;
1037 int UtcDaliControlMarginProperty(void)
1039 ToolkitTestApplication application;
1041 Control control = Control::New();
1042 control.SetBackgroundColor( Color::BLUE );
1044 control.SetProperty( Control::Property::MARGIN, Extents( 20, 10, 0, 0 ) );
1046 application.GetScene().Add( control );
1048 application.SendNotification();
1049 application.Render();
1051 DALI_TEST_EQUALS( control.GetProperty<Extents>( Control::Property::MARGIN ), Extents( 20, 10, 0, 0 ), TEST_LOCATION );
1053 // Parent control has one ImageView as a Child.
1054 ImageView image = ImageView::New();
1055 image.SetBackgroundColor( Color::RED );
1056 image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
1057 image.SetProperty( Control::Property::PADDING, Extents( 10, 10, 10, 10 ) );
1058 control.Add( image );
1060 application.SendNotification();
1061 application.Render();
1063 DALI_TEST_EQUALS( image.GetProperty<Extents>( Control::Property::PADDING ), Extents( 10, 10, 10, 10 ), TEST_LOCATION );
1068 int UtcDaliControlPaddingProperty(void)
1070 ToolkitTestApplication application;
1072 Control control = Control::New();
1073 control.SetBackgroundColor( Color::BLUE );
1075 control.SetProperty( Control::Property::PADDING, Extents( 15, 10, 5, 10 ) );
1077 application.GetScene().Add( control );
1079 application.SendNotification();
1080 application.Render();
1082 DALI_TEST_EQUALS( control.GetProperty<Extents>( Control::Property::PADDING ), Extents( 15, 10, 5, 10 ), TEST_LOCATION );
1084 Control child = Control::New();
1087 application.SendNotification();
1088 application.Render();
1090 DALI_TEST_EQUALS( child.GetProperty<Vector3>( Dali::Actor::Property::POSITION ), Vector3( 15, 5, 0 ), TEST_LOCATION );
1092 control.SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION, Dali::LayoutDirection::RIGHT_TO_LEFT);
1093 application.SendNotification();
1094 application.Render();
1095 DALI_TEST_EQUALS( child.GetProperty<Vector3>( Dali::Actor::Property::POSITION ), Vector3( 10, 5, 0 ), TEST_LOCATION );
1097 control.SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION, Dali::LayoutDirection::LEFT_TO_RIGHT);
1098 application.SendNotification();
1099 application.Render();
1101 DALI_TEST_EQUALS( child.GetProperty<Vector3>( Dali::Actor::Property::POSITION ), Vector3( 15, 5, 0 ), TEST_LOCATION );
1106 int UtcDaliControlDoAction(void)
1108 ToolkitTestApplication application;
1109 tet_infoline( "DoAction on a visual registered with a control" );
1111 // Set up trace debug
1112 TestGlAbstraction& gl = application.GetGlAbstraction();
1113 TraceCallStack& textureTrace = gl.GetTextureTrace();
1114 textureTrace.Enable( true );
1116 //Created AnimatedImageVisual
1117 VisualFactory factory = VisualFactory::Get();
1118 Visual::Base imageVisual = factory.CreateVisual( TEST_IMAGE_FILE_NAME, ImageDimensions() );
1120 DummyControl dummyControl = DummyControl::New(true);
1121 Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
1123 dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, imageVisual );
1124 dummyControl.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
1125 application.GetScene().Add( dummyControl );
1127 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
1129 application.SendNotification();
1130 application.Render();
1131 DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 0, TEST_LOCATION );
1132 DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
1133 textureTrace.Reset();
1135 Property::Map attributes;
1136 DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, DevelImageVisual::Action::RELOAD, attributes );
1138 tet_infoline( "Perform RELOAD action. should reload Image and generate a texture" );
1139 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
1141 application.SendNotification();
1142 application.Render();
1143 DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 1, TEST_LOCATION );
1144 DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
1148 int UtcDaliControlDoActionWhenNotStage(void)
1150 ToolkitTestApplication application;
1151 tet_infoline( "DoAction on a visual registered with a control but not staged" );
1153 // Set up trace debug
1154 TestGlAbstraction& gl = application.GetGlAbstraction();
1155 TraceCallStack& textureTrace = gl.GetTextureTrace();
1156 textureTrace.Enable( true );
1158 //Created AnimatedImageVisual
1159 VisualFactory factory = VisualFactory::Get();
1160 Visual::Base imageVisual = factory.CreateVisual( TEST_IMAGE_FILE_NAME, ImageDimensions() );
1162 DummyControl dummyControl = DummyControl::New(true);
1163 Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
1165 dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, imageVisual );
1166 dummyControl.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 200.f ) );
1168 application.SendNotification();
1169 application.Render();
1170 DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 0, TEST_LOCATION );
1171 DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), false, TEST_LOCATION );
1172 textureTrace.Reset();
1174 Property::Map attributes;
1175 DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, DevelImageVisual::Action::RELOAD, attributes );
1177 tet_infoline( "Perform RELOAD action. should reload Image and generate a texture" );
1178 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
1180 application.SendNotification();
1181 application.Render();
1182 DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
1183 textureTrace.Reset();
1185 tet_infoline( "Adding control to stage will in turn add the visual to the stage" );
1187 application.GetScene().Add( dummyControl );
1188 application.SendNotification();
1189 application.Render();
1190 tet_infoline( "No change in textures could occurs as already loaded and cached texture will be used" );
1192 DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 0, TEST_LOCATION );
1193 DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), false, TEST_LOCATION );
1194 textureTrace.Reset();