+ control.SetProperty( Control::Property::BACKGROUND, emptyMap );
+ DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND ).Get< Property::Map >().Empty() );
+
+ // set as URL
+ control.SetProperty( Control::Property::BACKGROUND, "Foobar.png" );
+ propValue = control.GetProperty( Control::Property::BACKGROUND );
+ resultMap = propValue.GetMap();
+ DALI_TEST_EQUALS( resultMap->Find( Visual::Property::TYPE )->Get<int>(), (int)Visual::IMAGE, TEST_LOCATION );
+ DALI_TEST_EQUALS( resultMap->Find( ImageVisual::Property::URL )->Get<std::string>(), "Foobar.png", TEST_LOCATION );
+
+ // Deprecated Properties
+ control.SetProperty( Control::Property::BACKGROUND_COLOR, Color::YELLOW );
+ DALI_TEST_EQUALS( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >(), Color::YELLOW, TEST_LOCATION );
+ DALI_TEST_EQUALS( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >(), control.GetBackgroundColor(), TEST_LOCATION );
+
+ control.ClearBackground();
+
+ Property::Map deprecatedImageMap;
+ deprecatedImageMap[ "filename" ] = "TestImage";
+ control.SetProperty( Control::Property::BACKGROUND_IMAGE, deprecatedImageMap );
+ propValue = control.GetProperty( Control::Property::BACKGROUND_IMAGE );
+ resultMap = propValue.GetMap();
+ DALI_TEST_EQUALS( resultMap->Find( ImageVisual::Property::URL )->Get< std::string >(), "TestImage" , TEST_LOCATION );
+
+ control.SetProperty( Control::Property::BACKGROUND_IMAGE, emptyMap );
+ DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND_IMAGE ).Get< Property::Map >().Empty() );
+
+ END_TEST;
+}
+
+int UtcDaliControlKeyProperties(void)
+{
+ ToolkitTestApplication application;
+
+ Control control = Control::New();
+ Stage::GetCurrent().Add( control );
+
+ DALI_TEST_EQUALS( control.HasKeyInputFocus(), control.GetProperty( Control::Property::KEY_INPUT_FOCUS ).Get< bool >(), TEST_LOCATION );
+
+ control.SetKeyInputFocus();
+ DALI_TEST_EQUALS( true, control.GetProperty( Control::Property::KEY_INPUT_FOCUS ).Get< bool >(), TEST_LOCATION );
+
+ control.ClearKeyInputFocus();
+ DALI_TEST_EQUALS( false, control.GetProperty( Control::Property::KEY_INPUT_FOCUS ).Get< bool >(), TEST_LOCATION );
+
+ control.SetProperty( Control::Property::KEY_INPUT_FOCUS, true );
+ DALI_TEST_EQUALS( true, control.HasKeyInputFocus(), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliControlGestureSignals(void)
+{
+ ToolkitTestApplication application;
+ ConnectionTracker connectionTracker;
+ Control control = Control::New();
+
+ // Each gesture detector gets created when connecting to the gesture signals
+ DALI_TEST_CHECK( !control.GetTapGestureDetector() );
+ control.ConnectSignal( &connectionTracker, "tapped", &TestVoidCallback );
+ DALI_TEST_CHECK( control.GetTapGestureDetector() );
+
+ DALI_TEST_CHECK( !control.GetPanGestureDetector() );
+ control.ConnectSignal( &connectionTracker, "panned", &TestVoidCallback );
+ DALI_TEST_CHECK( control.GetPanGestureDetector() );
+
+ DALI_TEST_CHECK( !control.GetPinchGestureDetector() );
+ control.ConnectSignal( &connectionTracker, "pinched", &TestVoidCallback );
+ DALI_TEST_CHECK( control.GetPinchGestureDetector() );
+
+ DALI_TEST_CHECK( !control.GetLongPressGestureDetector() );
+ control.ConnectSignal( &connectionTracker, "longPressed", &TestVoidCallback );
+ DALI_TEST_CHECK( control.GetLongPressGestureDetector() );
+
+ END_TEST;
+}
+
+int UtcDaliControlImplKeyInputFocusGainedSignal(void)
+{
+ ToolkitTestApplication application;
+
+ Control control = Control::New();
+ Stage::GetCurrent().Add( control );
+
+ gKeyInputFocusCallBackCalled = false;
+ control.KeyInputFocusGainedSignal().Connect(&TestKeyInputFocusCallback);
+
+ application.SendNotification();
+ application.Render();
+
+ control.SetKeyInputFocus();
+
+ DALI_TEST_CHECK( control.HasKeyInputFocus() );
+
+ DALI_TEST_CHECK( gKeyInputFocusCallBackCalled );
+
+ END_TEST;
+}
+
+int UtcDaliControlImplKeyInputFocusLostSignal(void)
+{
+ ToolkitTestApplication application;
+
+ Control control = Control::New();
+ Stage::GetCurrent().Add( control );
+
+ gKeyInputFocusCallBackCalled = false;
+ control.KeyInputFocusLostSignal().Connect(&TestKeyInputFocusCallback);
+
+ application.SendNotification();
+ application.Render();
+
+ control.SetKeyInputFocus();
+
+ DALI_TEST_CHECK( control.HasKeyInputFocus() );
+
+ control.ClearKeyInputFocus();
+
+ DALI_TEST_CHECK( gKeyInputFocusCallBackCalled );
+
+ END_TEST;
+}
+
+int UtcDaliControlImplGetControlExtensionP(void)
+{
+ ToolkitTestApplication application;
+ Control control = Control::New();
+
+ Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( control );
+
+ DALI_TEST_CHECK( NULL == controlImpl.GetControlExtension() );
+
+ END_TEST;
+}
+
+int UtcDaliControlAutoClipping(void)
+{
+ ToolkitTestApplication application;
+ Control control = Control::New();
+
+ tet_infoline( "Test to see if a renderer gets added when we are clipping children" );
+
+ DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION );
+
+ control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
+
+ Stage::GetCurrent().Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliControlAutoClippingN(void)
+{
+ ToolkitTestApplication application;
+ Control control = Control::New();
+ control.SetProperty( Control::Property::BACKGROUND, Property::Map().Add( Visual::Property::TYPE, Visual::COLOR )
+ .Add( ColorVisual::Property::MIX_COLOR, Color::RED ) );
+
+ tet_infoline( "Test to ensure that a renderer does NOT get added when we are clipping children and already have renderers/visuals" );
+
+ DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION );
+
+ control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
+
+ Stage::GetCurrent().Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION ); // Only 1, not 2
+
+ // Ensure the background color is still RED rather than what's set by the automatic clipping
+ Property::Value value = control.GetProperty( Control::Property::BACKGROUND );
+ Property::Map* map = value.GetMap();
+ DALI_TEST_CHECK( map );
+ Property::Value* colorValue = map->Find(ColorVisual::Property::MIX_COLOR );
+ DALI_TEST_CHECK( colorValue );
+ DALI_TEST_EQUALS( colorValue->Get< Vector4 >(), Color::RED, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliControlAutoClippingWhenAlreadyOnStage(void)
+{
+ ToolkitTestApplication application;
+ Control control = Control::New();
+
+ tet_infoline( "Test to see if a renderer gets added when we are clipping children and when already on stage" );
+
+ DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION );
+
+ Stage::GetCurrent().Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION );
+
+ control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliControlAutoClippingWhenAlreadyOnStageN(void)
+{
+ ToolkitTestApplication application;
+ Control control = Control::New();
+ control.SetProperty( Control::Property::BACKGROUND, Property::Map().Add( Visual::Property::TYPE, Visual::COLOR )
+ .Add( ColorVisual::Property::MIX_COLOR, Color::RED ) );
+
+ 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" );
+
+ DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION );
+
+ Stage::GetCurrent().Add( control );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION );
+
+ control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION ); // Still should be 1
+
+ // Ensure the background color is still RED rather than what's set by the automatic clipping
+ Property::Value value = control.GetProperty( Control::Property::BACKGROUND );
+ Property::Map* map = value.GetMap();
+ DALI_TEST_CHECK( map );
+ Property::Value* colorValue = map->Find(ColorVisual::Property::MIX_COLOR );
+ DALI_TEST_CHECK( colorValue );
+ DALI_TEST_EQUALS( colorValue->Get< Vector4 >(), Color::RED, TEST_LOCATION );