+
+int UtcDaliControlBackgroundColor(void)
+{
+ ToolkitTestApplication application;
+ Control control = Control::New();
+
+ DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
+
+ control.SetBackgroundColor( Color::RED );
+ DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::RED, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliControlBackgroundImage(void)
+{
+ ToolkitTestApplication application;
+ Control control = Control::New();
+
+ DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
+
+ Image image = ResourceImage::New("TestImage");
+ control.SetBackgroundImage( image );
+ DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::WHITE, TEST_LOCATION );
+
+ control.SetBackgroundColor( Color::GREEN );
+ DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::GREEN, TEST_LOCATION );
+
+ control.ClearBackground();
+ DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
+
+ control.SetBackgroundColor( Color::YELLOW );
+ control.SetBackgroundImage( image );
+ DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::YELLOW, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliControlBackgroundProperties(void)
+{
+ ToolkitTestApplication application;
+ Control control = Control::New();
+
+ DALI_TEST_CHECK( control.GetChildCount() == 0 );
+ DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
+ DALI_TEST_EQUALS( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >(), Color::TRANSPARENT, TEST_LOCATION );
+ DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND_IMAGE ).Get< Property::Map >().Empty() );
+
+ control.SetProperty( Control::Property::BACKGROUND_COLOR, Color::RED );
+ DALI_TEST_CHECK( control.GetChildCount() > 0 );
+ DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::RED, TEST_LOCATION );
+ DALI_TEST_EQUALS( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >(), Color::RED, TEST_LOCATION );
+
+ Property::Map imageMap;
+ imageMap[ "filename" ] = "TestImage";
+ control.SetProperty( Control::Property::BACKGROUND_IMAGE, imageMap );
+ DALI_TEST_CHECK( control.GetChildCount() > 0 );
+ DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::RED, TEST_LOCATION );
+ DALI_TEST_EQUALS( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >(), Color::RED, TEST_LOCATION );
+
+ Property::Value propValue = control.GetProperty( Control::Property::BACKGROUND_IMAGE );
+ Property::Map* resultMap = propValue.GetMap();
+ DALI_TEST_CHECK( resultMap->Find( "filename" ) );
+ DALI_TEST_CHECK( resultMap->Find( "filename" )->Get< std::string>() == "TestImage" );
+
+ Property::Map emptyMap;
+ control.SetProperty( Control::Property::BACKGROUND_IMAGE, emptyMap );
+ DALI_TEST_CHECK( control.GetChildCount() == 0 );
+ DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
+ DALI_TEST_EQUALS( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >(), Color::TRANSPARENT, TEST_LOCATION );
+ 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, "long-pressed", &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;
+}