Merge "Fix downcast issue for C# CustomView" into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 6 Mar 2017 13:47:30 +0000 (05:47 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Mon, 6 Mar 2017 13:47:31 +0000 (05:47 -0800)
19 files changed:
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.h
automated-tests/src/dali-toolkit/utc-Dali-Button.cpp
automated-tests/src/dali-toolkit/utc-Dali-CheckBoxButton.cpp
automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp
automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp
dali-toolkit/internal/controls/buttons/radio-button-impl.cpp
dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp
dali-toolkit/internal/controls/text-controls/text-editor-impl.h
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.h
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp
dali-toolkit/internal/text/rendering/text-typesetter.cpp
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller-impl.h
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h

index b92f090..9b8217b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -437,3 +437,36 @@ int UtcDaliTextControllerSetGetAutoScrollEnabled(void)
   tet_result(TET_PASS);
   END_TEST;
 }
+
+int UtcDaliTextControllerSetGetCheckProperty(void)
+{
+  tet_infoline(" UtcDaliTextControllerSetGetCheckProperty");
+  ToolkitTestApplication application;
+
+  // Creates a text controller.
+  ControllerPtr controller = Controller::New();
+
+  DALI_TEST_CHECK( controller );
+
+  // Enable the text input.
+  // Creates a decorator.
+  Text::DecoratorPtr decorator = Text::Decorator::New( *controller, *controller );
+
+  // Enables the text input.
+  controller->EnableTextInput( decorator );
+
+  DALI_TEST_CHECK( !controller->IsInputModePassword() );
+
+  // Set the text input to password.
+  controller->SetInputModePassword( true );
+
+  DALI_TEST_CHECK( controller->IsInputModePassword() );
+
+  // Unset the text input to password.
+  controller->SetInputModePassword( false );
+
+  DALI_TEST_CHECK( !controller->IsInputModePassword() );
+
+  tet_result(TET_PASS);
+  END_TEST;
+}
index 11dfca9..edb97ba 100644 (file)
@@ -36,6 +36,8 @@ class ImfManager : public Dali::BaseObject
 public:
   typedef Dali::ImfManager::ImfManagerSignalType ImfManagerSignalType;
   typedef Dali::ImfManager::ImfEventSignalType ImfEventSignalType;
+  typedef Dali::ImfManager::StatusSignalType ImfStatusSignalType;
+  typedef Dali::ImfManager::VoidSignalType ImfVoidSignalType;
 
 public:
   static Dali::ImfManager Get();
@@ -54,10 +56,14 @@ public:
   unsigned int GetCursorPosition() const;
   void SetSurroundingText( const std::string& text );
   const std::string& GetSurroundingText() const;
+  void ApplyOptions( const InputMethodOptions& options );
 
 public:  // Signals
   ImfManagerSignalType& ActivatedSignal() { return mActivatedSignal; }
   ImfEventSignalType& EventReceivedSignal() { return mEventSignal; }
+  ImfStatusSignalType& StatusChangedSignal() { return mKeyboardStatusSignal; }
+  ImfVoidSignalType& ResizedSignal() { return mKeyboardResizeSignal; }
+  ImfVoidSignalType& LanguageChangedSignal() { return mKeyboardLanguageChangedSignal; }
 
 protected:
   virtual ~ImfManager();
@@ -76,10 +82,13 @@ private:
   std::string mSurroundingText;
   bool mRestoreAfterFocusLost:1;             ///< Whether the keyboard needs to be restored (activated ) after focus regained.
   bool mIdleCallbackConnected:1;             ///< Whether the idle callback is already connected.
+  InputMethodOptions        mOptions;
 
   ImfManagerSignalType      mActivatedSignal;
   ImfEventSignalType        mEventSignal;
-
+  ImfStatusSignalType       mKeyboardStatusSignal;
+  ImfVoidSignalType         mKeyboardResizeSignal;
+  ImfVoidSignalType         mKeyboardLanguageChangedSignal;
 
   static Dali::ImfManager mToolkitImfManager;
 
@@ -195,6 +204,10 @@ const std::string& ImfManager::GetSurroundingText() const
   return mSurroundingText;
 }
 
+void ImfManager::ApplyOptions( const InputMethodOptions& options )
+{
+}
+
 } // Adaptor
 
 } // Internal
@@ -271,6 +284,11 @@ void ImfManager::NotifyTextInputMultiLine( bool multiLine )
 {
 }
 
+void ImfManager::ApplyOptions( const InputMethodOptions& options )
+{
+  Internal::Adaptor::ImfManager::GetImplementation(*this).ApplyOptions( options );
+}
+
 ImfManager::ImfManagerSignalType& ImfManager::ActivatedSignal()
 {
   return Internal::Adaptor::ImfManager::GetImplementation(*this).ActivatedSignal();
@@ -281,6 +299,21 @@ ImfManager::ImfEventSignalType& ImfManager::EventReceivedSignal()
   return Internal::Adaptor::ImfManager::GetImplementation(*this).EventReceivedSignal();
 }
 
+ImfManager::StatusSignalType& ImfManager::StatusChangedSignal()
+{
+  return Internal::Adaptor::ImfManager::GetImplementation(*this).StatusChangedSignal();
+}
+
+ImfManager::VoidSignalType& ImfManager::ResizedSignal()
+{
+  return Internal::Adaptor::ImfManager::GetImplementation(*this).ResizedSignal();
+}
+
+ImfManager::VoidSignalType& ImfManager::LanguageChangedSignal()
+{
+  return Internal::Adaptor::ImfManager::GetImplementation(*this).LanguageChangedSignal();
+}
+
 ImfManager::ImfManager(Internal::Adaptor::ImfManager *impl)
   : BaseHandle(impl)
 {
index 7049354..a777d95 100644 (file)
@@ -22,6 +22,7 @@
 #define __DALI_IMF_MANAGER_H__
 #include <dali/public-api/object/base-handle.h>
 #include <dali/public-api/signals/dali-signal.h>
+#include <dali/devel-api/adaptor-framework/input-method-options.h>
 
 namespace Dali DALI_IMPORT_API
 {
@@ -133,6 +134,8 @@ public:
 
   typedef Signal< void (ImfManager&) > ImfManagerSignalType; ///< Keyboard actived signal
   typedef Signal< ImfCallbackData ( ImfManager&, const ImfEventData& ) > ImfEventSignalType; ///< keyboard events
+  typedef Signal< void () > VoidSignalType;
+  typedef Signal< void (bool) > StatusSignalType;
 
 public:
 
@@ -217,6 +220,12 @@ public:
   */
   void NotifyTextInputMultiLine( bool multiLine );
 
+  /**
+   * @brief Set one or more of the Input Method options
+   * @param[in] options The options to be applied
+   */
+  void ApplyOptions( const InputMethodOptions& options );
+
 public:
 
   // Signals
@@ -235,6 +244,27 @@ public:
    */
   ImfEventSignalType& EventReceivedSignal();
 
+  /**
+   * @brief Connect to this signal to be notified when the virtual keyboard is shown or hidden.
+   *
+   * @return The signal connect to status changed event.
+   */
+  StatusSignalType& StatusChangedSignal();
+
+  /**
+   * @brief Connect to this signal to be notified when the virtual keyboard is resized.
+   *
+   * @return The signal to connect to resized event.
+   */
+  VoidSignalType& ResizedSignal();
+
+  /**
+   * @brief Connect to this signal to be notified when the virtual keyboard's language is changed.
+   *
+   * @return The signal to connect to language changed event.
+   */
+  VoidSignalType& LanguageChangedSignal();
+
   // Construction & Destruction
 
   /**
index 244f667..79d5cef 100644 (file)
@@ -47,8 +47,6 @@ void utc_dali_toolkit_button_cleanup(void)
 
 namespace
 {
-static const char* TEST_IMAGE_ONE = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
-
 static bool gIsCalledButtonCallback = false;
 
 const int RENDER_FRAME_INTERVAL = 16;
@@ -207,27 +205,29 @@ int UtcDaliButtonDownCastN(void)
   END_TEST;
 }
 
-int UtcDaliButtonSetDisabledP(void)
+int UtcDaliButtonDisabledPropertyP(void)
 {
   ToolkitTestApplication application;
 
   Button button = PushButton::New();
 
-  button.SetDisabled( true );
 
-  DALI_TEST_CHECK( button.IsDisabled() );
+  button.SetProperty( button.GetPropertyIndex("disabled"), true );
 
-  button.SetDisabled( false );
+  DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("disabled")), true, TEST_LOCATION );
 
-  DALI_TEST_CHECK( !button.IsDisabled() );
+  button.SetProperty( button.GetPropertyIndex("disabled"), false );
 
-  button.SetDisabled( true );
+  DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("disabled")), false, TEST_LOCATION );
 
-  DALI_TEST_CHECK( button.IsDisabled() );
+  button.SetProperty( button.GetPropertyIndex("disabled"), true );
 
-  button.SetDisabled( false );
+  DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("disabled")), true, TEST_LOCATION );
+
+  button.SetProperty( button.GetPropertyIndex("disabled"), false );
+
+  DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("disabled")), false, TEST_LOCATION );
 
-  DALI_TEST_CHECK( !button.IsDisabled() );
   END_TEST;
 }
 
@@ -311,23 +311,23 @@ int UtcDaliButtonIsDisabledP(void)
   END_TEST;
 }
 
-int UtcDaliButtonSetAutoRepeatingP(void)
+int UtcDaliButtonAutoRepeatingPropertyP(void)
 {
   ToolkitTestApplication application;
 
   Button button = PushButton::New();
 
-  button.SetAutoRepeating( true );
+  button.SetProperty( button.GetPropertyIndex("autoRepeating"), true );
 
-  DALI_TEST_CHECK( button.IsAutoRepeating() );
+  DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("autoRepeating")), true, TEST_LOCATION );
 
-  button.SetAutoRepeating( false );
+  button.SetProperty( button.GetPropertyIndex("autoRepeating"), false );
 
-  DALI_TEST_CHECK( !button.IsAutoRepeating() );
+  DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("autoRepeating")), false, TEST_LOCATION );
 
-  button.SetAutoRepeating( true );
+  button.SetProperty( button.GetPropertyIndex("autoRepeating"), true );
 
-  DALI_TEST_CHECK( button.IsAutoRepeating() );
+  DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("autoRepeating")), true, TEST_LOCATION );
 
   button.SetAutoRepeating( false );
 
@@ -411,68 +411,69 @@ int UtcDaliButtonAutoRepeatingP(void)
   END_TEST;
 }
 
-int UtcDaliButtonSetInitialAutoRepeatingDelayP(void)
+int UtcDaliButtonInitialAutoRepeatingDelayPropertyP(void)
 {
   ToolkitTestApplication application;
 
   Button button = PushButton::New();
 
-  button.SetInitialAutoRepeatingDelay( 0.5f );
+  button.SetProperty( button.GetPropertyIndex("initialAutoRepeatingDelay"), 0.5f );
 
-  DALI_TEST_EQUALS( button.GetInitialAutoRepeatingDelay(), 0.5f, TEST_LOCATION );
+  DALI_TEST_EQUALS( button.GetProperty<float>( button.GetPropertyIndex("initialAutoRepeatingDelay")), 0.5f, TEST_LOCATION );
 
-  button.SetInitialAutoRepeatingDelay( 0.2f );
+  button.SetProperty( button.GetPropertyIndex("initialAutoRepeatingDelay"), 0.2f );
+
+  DALI_TEST_EQUALS( button.GetProperty<float>( button.GetPropertyIndex("initialAutoRepeatingDelay")), 0.2f, TEST_LOCATION );
 
-  DALI_TEST_EQUALS( button.GetInitialAutoRepeatingDelay(), 0.2f, TEST_LOCATION );
   END_TEST;
 }
 
-int UtcDaliButtonSetNextAutoRepeatingDelayP(void)
+int UtcDaliButtonNextAutoRepeatingDelayPropertyP(void)
 {
   ToolkitTestApplication application;
 
   Button button = PushButton::New();
 
-  button.SetNextAutoRepeatingDelay( 0.5f );
+  button.SetProperty( button.GetPropertyIndex("nextAutoRepeatingDelay"), 0.5f );
 
-  DALI_TEST_EQUALS( button.GetNextAutoRepeatingDelay(), 0.5f, TEST_LOCATION );
+  DALI_TEST_EQUALS( button.GetProperty<float>( button.GetPropertyIndex("nextAutoRepeatingDelay")), 0.5f, TEST_LOCATION );
 
-  button.SetProperty( Button::Property::NEXT_AUTO_REPEATING_DELAY, 0.2f );
+  button.SetProperty( button.GetPropertyIndex("nextAutoRepeatingDelay"), 0.2f );
 
-  DALI_TEST_EQUALS( button.GetNextAutoRepeatingDelay(), 0.2f, TEST_LOCATION );
+  DALI_TEST_EQUALS( button.GetProperty<float>( button.GetPropertyIndex("nextAutoRepeatingDelay")), 0.2f, TEST_LOCATION );
   END_TEST;
 }
 
-int UtcDaliButtonSetTogglableButtonP(void)
+int UtcDaliButtonTogglableButtonPropertyP(void)
 {
   ToolkitTestApplication application;
 
   Button button = PushButton::New();
 
-  button.SetTogglableButton( true );
+  button.SetProperty( button.GetPropertyIndex("togglable"), true );
 
-  DALI_TEST_CHECK( button.IsTogglableButton() );
+  DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("togglable")), true, TEST_LOCATION );
 
-  button.SetTogglableButton( false );
+  button.SetProperty( button.GetPropertyIndex("togglable"), false );
 
-  DALI_TEST_CHECK( !button.IsTogglableButton() );
+  DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("togglable")), false, TEST_LOCATION );
   END_TEST;
 }
 
-int UtcDaliButtonSetSelectedP(void)
+int UtcDaliButtonSelectedPropertyP(void)
 {
   ToolkitTestApplication application;
 
   Button button = PushButton::New();
-  button.SetTogglableButton( true );
+  button.SetProperty( button.GetPropertyIndex("togglable"), true );
 
-  button.SetSelected( true );
+  button.SetProperty( button.GetPropertyIndex("selected"), true );
 
-  DALI_TEST_CHECK( button.IsSelected() );
+  DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("selected")), true, TEST_LOCATION );
 
-  button.SetSelected( false );
+  button.SetProperty( button.GetPropertyIndex("selected"), false );
 
-  DALI_TEST_CHECK( !button.IsSelected() );
+  DALI_TEST_EQUALS( button.GetProperty<bool>( button.GetPropertyIndex("selected")), false, TEST_LOCATION );
   END_TEST;
 }
 
@@ -595,48 +596,6 @@ int UtcDaliButtonSetLabelPropertyP(void)
   END_TEST;
 }
 
-int UtcDaliButtonSetUnselectedImageP(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline(" UtcDaliButtonSetUnselectedImageP");
-
-  PushButton pushButton = PushButton::New();
-  Stage::GetCurrent().Add( pushButton );
-
-  application.SendNotification();
-  application.Render();
-
-  pushButton.SetUnselectedImage( "Image.jpg" );
-
-  application.SendNotification();
-  application.Render();
-
-  DALI_TEST_CHECK( pushButton );
-
-  END_TEST;
-}
-
-int UtcDaliButtonSetSelectedImageP(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline(" UtcDaliButtonSetButtonImage");
-
-  PushButton pushButton = PushButton::New();
-  Stage::GetCurrent().Add( pushButton );
-
-  application.SendNotification();
-  application.Render();
-
-  pushButton.SetSelectedImage( "Image.jpg" );
-
-  application.SendNotification();
-  application.Render();
-
-  DALI_TEST_CHECK( pushButton );
-
-  END_TEST;
-}
-
 int UtcDaliButtonPressedSignalP(void)
 {
   ToolkitTestApplication application;
@@ -843,7 +802,8 @@ int UtcDaliButtonStateChangedSignalP(void)
   tet_infoline(" UtcDaliButtonStateChangedSignalP");
 
   Button button = PushButton::New();
-  button.SetTogglableButton( true );
+
+  button.SetProperty( Button::Property::TOGGLABLE, true);
 
   Stage::GetCurrent().Add( button );
 
@@ -857,7 +817,7 @@ int UtcDaliButtonStateChangedSignalP(void)
   button.ConnectSignal( testTracker, "stateChanged",   CallbackFunctor(&stateChangedSignal) );
 
   gIsCalledButtonCallback = false;
-  button.SetSelected( true );
+  button.SetProperty( Button::Property::SELECTED, true);
 
   DALI_TEST_CHECK( gIsCalledButtonCallback );
   DALI_TEST_CHECK( stateChangedSignal );
@@ -865,8 +825,7 @@ int UtcDaliButtonStateChangedSignalP(void)
   gIsCalledButtonCallback = false;
   stateChangedSignal = false;
 
-  button.SetSelected( false );
-
+  button.SetProperty( Button::Property::SELECTED, false);
   DALI_TEST_CHECK( gIsCalledButtonCallback );
   DALI_TEST_CHECK( stateChangedSignal );
   END_TEST;
@@ -880,469 +839,126 @@ int UtcDaliButtonSetProperty(void)
   PushButton pushButton = PushButton::New();
 
   pushButton.SetProperty(pushButton.GetPropertyIndex("disabled"), false);
-  DALI_TEST_CHECK( false == pushButton.IsDisabled() );
-
-  pushButton.SetProperty(pushButton.GetPropertyIndex("disabled"), true);
-  DALI_TEST_CHECK( true == pushButton.IsDisabled() );
-
-  END_TEST;
-}
-
-int UtcDaliButtonSize(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline(" UtcDaliButtonSize");
-
-  // First an image is set, then SetSize is called.
-  PushButton pushButton = PushButton::New();
-  Stage::GetCurrent().Add( pushButton );
-
-  pushButton.SetBackgroundImage( "Image.jpg" );
-  pushButton.SetSize( 10.f, 10.f );
-
-  application.SendNotification();
-  application.Render();
-
-  Vector3 size = pushButton.GetCurrentSize();
-
-  DALI_TEST_EQUALS( size.width, 10.f, TEST_LOCATION );
-  DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION );
-  END_TEST;
-}
-
-int UtcDaliButtonSetSelectedBackgroundImageP(void)
-{
-  ToolkitTestApplication application;
-
-  PushButton button = PushButton::New();
-  Stage::GetCurrent().Add( button );
-
-  try
-  {
-    button.SetSelectedBackgroundImage( "TestImage.jpg");
-    DALI_TEST_CHECK( true );
-  }
-  catch(...)
-  {
-    DALI_TEST_CHECK( false );
-  }
-
-  END_TEST;
-}
-
-int UtcDaliButtonSetSelectedBackgroundImageN(void)
-{
-  ToolkitTestApplication application;
-
-  PushButton button;
-
-  try
-  {
-    button.SetSelectedBackgroundImage( "TestImage.jpg");
-    DALI_TEST_CHECK( false );
-  }
-  catch(...)
-  {
-    DALI_TEST_CHECK( true );
-  }
-
-  END_TEST;
-}
-
-int UtcDaliButtonSetDisabledImageP(void)
-{
-  ToolkitTestApplication application;
-
-  PushButton button = PushButton::New();
-  Stage::GetCurrent().Add( button );
-
-  try
-  {
-    button.SetDisabledImage( "TestImage.jpg");
-    DALI_TEST_CHECK( true );
-  }
-  catch(...)
-  {
-    DALI_TEST_CHECK( false );
-  }
-
-  END_TEST;
-}
-
-int UtcDaliButtonSetDisabledImageN(void)
-{
-  ToolkitTestApplication application;
-
-  PushButton button;
-
-  try
-  {
-    button.SetDisabledImage( "TestImage.jpg");
-    DALI_TEST_CHECK( false );
-  }
-  catch(...)
-  {
-    DALI_TEST_CHECK( true );
-  }
-
-  END_TEST;
-}
-
-int UtcDaliButtonSetDisabledSelectedImageP(void)
-{
-  ToolkitTestApplication application;
-
-  PushButton button = PushButton::New();
-  Stage::GetCurrent().Add( button );
-
-  try
-  {
-    button.SetDisabledSelectedImage( "TestImage.jpg");
-    DALI_TEST_CHECK( true );
-  }
-  catch(...)
-  {
-    DALI_TEST_CHECK( false );
-  }
-
-  END_TEST;
-}
-
-int UtcDaliButtonSetDisabledSelectedImageN(void)
-{
-  ToolkitTestApplication application;
-
-  PushButton button;
-
-  try
-  {
-    button.SetDisabledSelectedImage( "TestImage.jpg");
-    DALI_TEST_CHECK( false );
-  }
-  catch(...)
-  {
-    DALI_TEST_CHECK( true );
-  }
-
-  END_TEST;
-}
 
-int UtcDaliButtonSetLabeActorlP(void)
-{
-  ToolkitTestApplication application;
-
-  PushButton button = PushButton::New();
-  Stage::GetCurrent().Add( button );
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>( pushButton.GetPropertyIndex("disabled")), false, TEST_LOCATION );
 
-  try
-  {
-    button.SetLabel( TextLabel::New("Hello") );
-    DALI_TEST_CHECK( true );
-  }
-  catch(...)
-  {
-    DALI_TEST_CHECK( false );
-  }
+  pushButton.SetProperty(pushButton.GetPropertyIndex("disabled"), true);
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>( pushButton.GetPropertyIndex("disabled")), true, TEST_LOCATION );
 
   END_TEST;
 }
 
-int UtcDaliButtonSetLabelN(void)
-{
-  ToolkitTestApplication application;
-
-  PushButton button;
-
-  try
-  {
-    button.SetLabel( TextLabel::New("Hello") );
-    DALI_TEST_CHECK( false );
-  }
-  catch(...)
-  {
-    DALI_TEST_CHECK( true );
-  }
+// Deprecated API Tests
 
-  END_TEST;
-}
-
-int UtcDaliButtonSetButtonImageP(void)
+int UtcDaliButtonSetDisabledP(void)
 {
   ToolkitTestApplication application;
 
-  PushButton button = PushButton::New();
-  Stage::GetCurrent().Add( button );
-
-  try
-  {
-    ResourceImage image1 = ResourceImage::New( TEST_IMAGE_ONE );
-    button.SetButtonImage( image1 );
-
-    Property::Value value = button.GetProperty(Button::Property::UNSELECTED_STATE_IMAGE );
-    DALI_TEST_CHECK( value.Get<std::string>() == TEST_IMAGE_ONE );
-  }
-  catch(...)
-  {
-    DALI_TEST_CHECK( false );
-  }
-
-  std::string imageUrl;
-
-  Dali::Actor actor = button.GetButtonImage();
+  Button button = PushButton::New();
 
-  Toolkit::ImageView imageView = Toolkit::ImageView ::DownCast( actor );
+  button.SetDisabled( true );
 
-  tet_infoline(" UtcDaliButtonSetButtonImageP Ensure an ImageView is returned\n");
-  DALI_TEST_CHECK ( imageView )
+  DALI_TEST_CHECK( button.IsDisabled() );
 
-  END_TEST;
-}
+  button.SetDisabled( false );
 
-int UtcDaliButtonSetButtonImageN(void)
-{
-  ToolkitTestApplication application;
+  DALI_TEST_CHECK( !button.IsDisabled() );
 
-  PushButton button;
+  button.SetDisabled( true );
 
-  try
-  {
-    ResourceImage image1 = ResourceImage::New( TEST_IMAGE_ONE );
-    button.SetButtonImage( image1 );
+  DALI_TEST_CHECK( button.IsDisabled() );
 
-    DALI_TEST_CHECK( false );
-  }
-  catch(...)
-  {
-    DALI_TEST_CHECK( true );
-  }
+  button.SetDisabled( false );
 
+  DALI_TEST_CHECK( !button.IsDisabled() );
   END_TEST;
 }
 
-int UtcDaliButtonSetSelectedImageWithImageP(void)
+int UtcDaliButtonSetAutoRepeatingP(void)
 {
   ToolkitTestApplication application;
 
-  PushButton button = PushButton::New();
-  Stage::GetCurrent().Add( button );
-  ResourceImage image1 = ResourceImage::New( TEST_IMAGE_ONE );
-
-  try
-  {
-    button.SetSelectedImage( image1 );
-    Property::Value value = button.GetProperty( Button::Property::SELECTED_STATE_IMAGE );
-    DALI_TEST_CHECK( value.Get<std::string>() == TEST_IMAGE_ONE );
-  }
-  catch(...)
-  {
-    DALI_TEST_CHECK( false );
-  }
-
-  std::string imageUrl;
+  Button button = PushButton::New();
 
-  Dali::Actor actor = button.GetSelectedImage();
+  button.SetAutoRepeating( true );
 
-  Toolkit::ImageView imageView = Toolkit::ImageView::DownCast( actor );
+  DALI_TEST_CHECK( button.IsAutoRepeating() );
 
-  tet_infoline(" UtcDaliButtonSetSelectedImageWithImageP Ensure an ImageView is returned\n");
+  button.SetAutoRepeating( false );
 
-  END_TEST;
-}
+  DALI_TEST_CHECK( !button.IsAutoRepeating() );
 
-int UtcDaliButtonSetSelectedImageWithImageN(void)
-{
-  ToolkitTestApplication application;
+  button.SetAutoRepeating( true );
 
-  PushButton button;
+  DALI_TEST_CHECK( button.IsAutoRepeating() );
 
-  try
-  {
-    button.SetSelectedImage( CreateBufferImage( 10, 10, Color::WHITE ) );
-    DALI_TEST_CHECK( false );
-  }
-  catch(...)
-  {
-    DALI_TEST_CHECK( true );
-  }
+  button.SetAutoRepeating( false );
 
+  DALI_TEST_CHECK( !button.IsAutoRepeating() );
   END_TEST;
 }
 
-int UtcDaliButtonSetSelectedColorP(void)
+int UtcDaliButtonSetInitialAutoRepeatingDelayP(void)
 {
   ToolkitTestApplication application;
-  tet_infoline(" UtcDaliButtonSetSelectedColorP");
 
-  PushButton pushButton = PushButton::New();
-  Stage::GetCurrent().Add( pushButton );
-
-  application.SendNotification();
-  application.Render();
-
-  const Vector4 SET_COLOR = Color::BLUE;
-
-  pushButton.SetSize( Vector2( 20.0f, 20.0f ) );
-  pushButton.SetProperty( Button::Property::SELECTED_COLOR, SET_COLOR );
+  Button button = PushButton::New();
 
-  application.SendNotification();
-  application.Render();
+  button.SetInitialAutoRepeatingDelay( 0.5f );
 
-  Vector4 color = pushButton.GetProperty<Vector4>( Button::Property::SELECTED_COLOR );
+  DALI_TEST_EQUALS( button.GetInitialAutoRepeatingDelay(), 0.5f, TEST_LOCATION );
 
-  DALI_TEST_EQUALS( color, SET_COLOR, TEST_LOCATION );
+  button.SetInitialAutoRepeatingDelay( 0.2f );
 
+  DALI_TEST_EQUALS( button.GetInitialAutoRepeatingDelay(), 0.2f, TEST_LOCATION );
   END_TEST;
 }
 
-int UtcDaliButtonSetUnSelectedColorP(void)
+int UtcDaliButtonSetNextAutoRepeatingDelayP(void)
 {
   ToolkitTestApplication application;
-  tet_infoline(" UtcDaliButtonSetUnSelectedColorP");
-
-  PushButton pushButton = PushButton::New();
-  Stage::GetCurrent().Add( pushButton );
-
-  application.SendNotification();
-  application.Render();
 
-  const Vector4 SET_COLOR = Color::BLUE;
-
-  pushButton.SetSize( Vector2( 20.0f, 20.0f ) );
-  pushButton.SetProperty( Button::Property::UNSELECTED_COLOR, SET_COLOR );
+  Button button = PushButton::New();
 
-  application.SendNotification();
-  application.Render();
+  button.SetNextAutoRepeatingDelay( 0.5f );
 
-  Vector4 color = pushButton.GetProperty<Vector4>( Button::Property::UNSELECTED_COLOR );
+  DALI_TEST_EQUALS( button.GetNextAutoRepeatingDelay(), 0.5f, TEST_LOCATION );
 
-  DALI_TEST_EQUALS( color, SET_COLOR, TEST_LOCATION );
+  button.SetProperty( Button::Property::NEXT_AUTO_REPEATING_DELAY, 0.2f );
 
+  DALI_TEST_EQUALS( button.GetNextAutoRepeatingDelay(), 0.2f, TEST_LOCATION );
   END_TEST;
 }
 
-int UtcDaliButtonResetSelectedColorP(void)
+int UtcDaliButtonSetTogglableButtonP(void)
 {
   ToolkitTestApplication application;
-  tet_infoline(" UtcDaliButtonSetSelectedColorP");
-
-  PushButton pushButton = PushButton::New();
-  Stage::GetCurrent().Add( pushButton );
-
-  application.SendNotification();
-  application.Render();
-
-  const Vector4 FIRST_COLOR = Color::BLUE;
-  const Vector4 SECOND_COLOR = Color::BLUE;
-
-  pushButton.SetSize( Vector2( 20.0f, 20.0f ) );
-  pushButton.SetProperty( Button::Property::SELECTED_COLOR, FIRST_COLOR );
 
-  application.SendNotification();
-  application.Render();
-
-  Vector4 color = pushButton.GetProperty<Vector4>( Button::Property::SELECTED_COLOR );
-
-  DALI_TEST_EQUALS( color, FIRST_COLOR, TEST_LOCATION );
-
-  pushButton.SetProperty( Button::Property::SELECTED_COLOR, SECOND_COLOR );
+  Button button = PushButton::New();
 
-  application.SendNotification();
-  application.Render();
+  button.SetTogglableButton( true );
 
-  color = pushButton.GetProperty<Vector4>( Button::Property::SELECTED_COLOR );
+  DALI_TEST_CHECK( button.IsTogglableButton() );
 
-  DALI_TEST_EQUALS( color, SECOND_COLOR, TEST_LOCATION );
+  button.SetTogglableButton( false );
 
+  DALI_TEST_CHECK( !button.IsTogglableButton() );
   END_TEST;
 }
 
-int UtcDaliButtonSetImagesWithDeprecatedProperties(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline(" UtcDaliButtonSetImagesWithDeprecatedProperties");
-
-  PushButton pushButton = PushButton::New();
-
-  Stage::GetCurrent().Add( pushButton );
-
-  Property::Map propertyMap;
-  propertyMap.Insert(Visual::Property::TYPE,  Visual::COLOR);
-  propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
-
-  DALI_TEST_EQUALS( pushButton.GetRendererCount(), 0, TEST_LOCATION );
-
-  pushButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, propertyMap );
-  application.SendNotification();
-  application.Render();
-  DALI_TEST_EQUALS( pushButton.GetRendererCount(), 1, TEST_LOCATION );
-
-  tet_infoline(" Set state to selected and provide SELECTED visual");
-  pushButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, propertyMap );
-  pushButton.SetProperty( Toolkit::Button::Property::SELECTED, true );
-  application.SendNotification();
-  application.Render();
-  DALI_TEST_EQUALS( pushButton.GetRendererCount(), 1, TEST_LOCATION );
-
-  tet_infoline(" Set state to selected, disabled and provide DISABLED_STATE_IMAGE visual");
-  pushButton.SetProperty( Toolkit::Button::Property::SELECTED, false );
-  pushButton.SetProperty( Toolkit::Button::Property::DISABLED, true );
-  pushButton.SetProperty( Toolkit::Button::Property::DISABLED_STATE_IMAGE, propertyMap );
-  application.SendNotification();
-  application.Render();
-  DALI_TEST_EQUALS( pushButton.GetRendererCount(), 1, TEST_LOCATION );
-
-END_TEST;
-}
-
-int UtcDaliButtonSetGetDepreciatedPropertiesWithURL(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline(" UtcDaliButtonSetGetDepreciatedPropertiesWithURL");
-
-  PushButton button = PushButton::New();
-  Stage::GetCurrent().Add( button );
-
-  tet_infoline(" Set state to selected, disabled and provide DISABLED_STATE_IMAGE visual");
-  button.SetProperty( Toolkit::Button::Property::DISABLED, true );
-  button.SetProperty( Toolkit::Button::Property::DISABLED_STATE_IMAGE, TEST_IMAGE_ONE );
-
-  Property::Value value = button.GetProperty(Button::Property::DISABLED_STATE_IMAGE );
-  DALI_TEST_EQUALS( value.Get<std::string>(),  TEST_IMAGE_ONE, TEST_LOCATION );
-
-END_TEST;
-}
-
-int UtcDaliButtonSetLabelTextDeprecatedPropertyP(void)
+int UtcDaliButtonSetSelectedP(void)
 {
   ToolkitTestApplication application;
-  tet_infoline(" UtcDaliButtonSetLabelTextDeprecatedPropertyP");
-
-  const std::string TEST_LABEL1 = "test label one";
-  const std::string TEST_LABEL2 = "test label two";
 
   Button button = PushButton::New();
+  button.SetTogglableButton( true );
 
-  button.SetProperty( Toolkit::Button::Property::LABEL,
-                        Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
-                                       .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f )
-                     );
-
-  button.SetProperty( Button::Property::LABEL_TEXT, TEST_LABEL1 );
-
-  std::string labelText = button.GetProperty<std::string>( Button::Property::LABEL_TEXT );
-
-  DALI_TEST_EQUALS( labelText, TEST_LABEL1,  TEST_LOCATION );
-
-  Property::Map propertyMap;
-  propertyMap.Insert( Toolkit::Visual::Property::TYPE,  Toolkit::DevelVisual::TEXT );
-  propertyMap.Insert( Toolkit::TextVisual::Property::TEXT,  TEST_LABEL2 );
-  propertyMap.Insert( Toolkit::TextVisual::Property::TEXT_COLOR, Color::BLUE );
-  propertyMap.Insert( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f );
-  button.SetProperty( Button::Property::LABEL, propertyMap );
+  button.SetSelected( true );
 
-  labelText = button.GetProperty<std::string>( Button::Property::LABEL_TEXT );
+  DALI_TEST_CHECK( button.IsSelected() );
 
-  DALI_TEST_EQUALS( labelText, TEST_LABEL2,  TEST_LOCATION );
+  button.SetSelected( false );
 
+  DALI_TEST_CHECK( !button.IsSelected() );
   END_TEST;
 }
index 1606d71..443dd30 100644 (file)
@@ -34,13 +34,29 @@ namespace
 static bool gCheckBoxButtonState = false;
 bool CheckBoxButtonClicked( Button button )
 {
-  gCheckBoxButtonState = button.IsSelected();
+  gCheckBoxButtonState = button.GetProperty<bool>(button.GetPropertyIndex("selected")) ;
   return true;
 }
 
 static const char* TEST_IMAGE_ONE = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
 const Vector2 TEST_IMAGE_SIZE = Vector2( 66.0f, 66.0f );
 
+static std::string GetButtonText( Button button )
+{
+  Property::Value value = button.GetProperty( Toolkit::Button::Property::LABEL );
+
+  Property::Map *labelProperty = value.GetMap();
+
+  std::string textLabel;
+
+  if ( labelProperty )
+  {
+    Property::Value* value = labelProperty->Find( Toolkit::TextVisual::Property::TEXT );
+    value->Get( textLabel );
+  }
+
+  return textLabel;
+}
 
 } // namespace
 
@@ -129,7 +145,7 @@ int UtcDaliCheckBoxButtonDownCastN(void)
   END_TEST;
 }
 
-int UtcDaliCheckBoxButtonSetGetSelected(void)
+int UtcDaliCheckBoxButtonSelectedPropertyP(void)
 {
   ToolkitTestApplication application;
   tet_infoline(" UtcDaliCheckBoxButtonSetGetSelected");
@@ -140,19 +156,19 @@ int UtcDaliCheckBoxButtonSetGetSelected(void)
   // global var used to check if CheckBoxButtonClicked is called;
   gCheckBoxButtonState = false;
 
-  checkBoxButton.SetSelected( true );
+  checkBoxButton.SetProperty( checkBoxButton.GetPropertyIndex("selected"), true );
 
-  DALI_TEST_CHECK( checkBoxButton.IsSelected() );
+  DALI_TEST_EQUALS( checkBoxButton.GetProperty<bool>(checkBoxButton.GetPropertyIndex("selected")), true, TEST_LOCATION );
   DALI_TEST_CHECK( gCheckBoxButtonState );
 
-  checkBoxButton.SetSelected( false );
+  checkBoxButton.SetProperty( checkBoxButton.GetPropertyIndex("selected"), false );
 
-  DALI_TEST_CHECK( !checkBoxButton.IsSelected() );
+  DALI_TEST_EQUALS( checkBoxButton.GetProperty<bool>(checkBoxButton.GetPropertyIndex("selected")), false, TEST_LOCATION );
   DALI_TEST_CHECK( !gCheckBoxButtonState );
 
-  checkBoxButton.SetSelected( true );
+  checkBoxButton.SetProperty( checkBoxButton.GetPropertyIndex("selected"), true );
 
-  DALI_TEST_CHECK( checkBoxButton.IsSelected() );
+  DALI_TEST_EQUALS( checkBoxButton.GetProperty<bool>(checkBoxButton.GetPropertyIndex("selected")), true, TEST_LOCATION );
   DALI_TEST_CHECK( gCheckBoxButtonState );
   END_TEST;
 }
@@ -171,11 +187,11 @@ int UtcDaliCheckBoxSetLabelP(void)
 
   checkBox.SetProperty( checkBox.GetPropertyIndex("label"), propertyMap );
 
-  DALI_TEST_EQUALS( checkBox.GetLabelText(), "activate", TEST_LOCATION ); // Change to use GerProperty once that code is implemented
+  DALI_TEST_EQUALS( GetButtonText( checkBox ) , "activate", TEST_LOCATION );
   END_TEST;
 }
 
-int UtcDaliCheckBoxSetLabelDisabledP(void)
+int UtcDaliCheckBoxSetDisabledPropertyP(void)
 {
   TestApplication application;
 
@@ -183,7 +199,7 @@ int UtcDaliCheckBoxSetLabelDisabledP(void)
   Stage::GetCurrent().Add( checkBox );
 
   checkBox.SetSize( Vector2( 20.0f, 20.0f ) );
-  checkBox.SetDisabledBackgroundImage( "Image.jpg" );
+  checkBox.SetProperty(checkBox.GetPropertyIndex("disabledUnselectedBackgroundVisual"),  "Image.jpg" );
 
   application.SendNotification();
   application.Render();
@@ -197,8 +213,8 @@ int UtcDaliCheckBoxSetLabelDisabledP(void)
   checkBox.SetProperty(checkBox.GetPropertyIndex("disabled"), true);
   checkBox.SetProperty( checkBox.GetPropertyIndex("label"), propertyMap );
 
-  DALI_TEST_CHECK(  checkBox.GetProperty<bool>(checkBox.GetPropertyIndex("disabled")) );
-  DALI_TEST_EQUALS( checkBox.GetLabelText(), "activate", TEST_LOCATION ); // Change to use GetProperty once that code is implemented
+  DALI_TEST_EQUALS( checkBox.GetProperty<bool>(checkBox.GetPropertyIndex("disabled")), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( GetButtonText( checkBox ) , "activate", TEST_LOCATION );
 
   END_TEST;
 }
@@ -315,3 +331,61 @@ int UtcDaliCheckBoxSetForegroundPadding(void)
 
   END_TEST;
 }
+
+// Deprecated API Tests
+
+int UtcDaliCheckBoxButtonSetGetSelected(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliCheckBoxButtonSetGetSelected");
+
+  CheckBoxButton checkBoxButton = CheckBoxButton::New();
+  checkBoxButton.StateChangedSignal().Connect( &CheckBoxButtonClicked );
+
+  // global var used to check if CheckBoxButtonClicked is called;
+  gCheckBoxButtonState = false;
+
+  checkBoxButton.SetSelected( true );
+
+  DALI_TEST_CHECK( checkBoxButton.IsSelected() );
+  DALI_TEST_CHECK( gCheckBoxButtonState );
+
+  checkBoxButton.SetSelected( false );
+
+  DALI_TEST_CHECK( !checkBoxButton.IsSelected() );
+  DALI_TEST_CHECK( !gCheckBoxButtonState );
+
+  checkBoxButton.SetSelected( true );
+
+  DALI_TEST_CHECK( checkBoxButton.IsSelected() );
+  DALI_TEST_CHECK( gCheckBoxButtonState );
+  END_TEST;
+}
+
+int UtcDaliCheckBoxSetLabelDisabledP(void)
+{
+  TestApplication application;
+
+  CheckBoxButton checkBox = CheckBoxButton::New();
+  Stage::GetCurrent().Add( checkBox );
+
+  checkBox.SetSize( Vector2( 20.0f, 20.0f ) );
+  checkBox.SetDisabledBackgroundImage( "Image.jpg" );
+
+  application.SendNotification();
+  application.Render();
+
+  Property::Map propertyMap;
+
+  propertyMap.Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
+             .Add( Toolkit::TextVisual::Property::TEXT, "activate" )
+             .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f );
+
+  checkBox.SetProperty(checkBox.GetPropertyIndex("disabled"), true);
+  checkBox.SetProperty( checkBox.GetPropertyIndex("label"), propertyMap );
+
+  DALI_TEST_CHECK(  checkBox.GetProperty<bool>(checkBox.GetPropertyIndex("disabled")) );
+  DALI_TEST_EQUALS( checkBox.GetLabelText(), "activate", TEST_LOCATION );
+
+  END_TEST;
+}
\ No newline at end of file
index 7ff4e3a..421083f 100644 (file)
@@ -54,7 +54,7 @@ static const Size BUTTON_SIZE_TO_GET_INSIDE_TOUCH_EVENTS  = Size( 100, 100 );
 static bool gPushButtonSelectedState = false;
 bool PushButtonSelected( Button button )
 {
-  gPushButtonSelectedState = button.IsSelected();
+  gPushButtonSelectedState = button.GetProperty<bool>(button.GetPropertyIndex("selected") );
   return true;
 }
 
@@ -146,6 +146,23 @@ void SetupButtonForTestTouchEvents( ToolkitTestApplication& application, Button&
   }
 }
 
+static std::string GetButtonText( Button button )
+{
+  Property::Value value = button.GetProperty( Toolkit::Button::Property::LABEL );
+
+  Property::Map *labelProperty = value.GetMap();
+
+  std::string textLabel;
+
+  if ( labelProperty )
+  {
+    Property::Value* value = labelProperty->Find( Toolkit::TextVisual::Property::TEXT );
+    value->Get( textLabel );
+  }
+
+  return textLabel;
+}
+
 } //namespace
 
 int UtcDaliPushButtonConstructorP(void)
@@ -223,25 +240,23 @@ int UtcDaliPushButtonDownCastN(void)
   END_TEST;
 }
 
-int UtcDaliPushButtonSetGetAutoRepeating(void)
+int UtcDaliPushButtonAutoRepeatingProperty(void)
 {
   ToolkitTestApplication application;
   tet_infoline(" UtcDaliPushButtonSetGetAutoRepeating");
 
   PushButton pushButton = PushButton::New();
 
-  pushButton.SetAutoRepeating( true );
+  pushButton.SetProperty( pushButton.GetPropertyIndex("autoRepeating"), true );
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("autoRepeating")), true, TEST_LOCATION );
 
-  DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
+  pushButton.SetProperty( pushButton.GetPropertyIndex("autoRepeating"), false );
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("autoRepeating")), false, TEST_LOCATION );
 
-  pushButton.SetAutoRepeating( false );
+  pushButton.SetProperty( pushButton.GetPropertyIndex("autoRepeating"), true );
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("autoRepeating")), true, TEST_LOCATION );
 
-  DALI_TEST_CHECK( !pushButton.IsAutoRepeating() );
-
-  pushButton.SetAutoRepeating( true );
-
-  DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
-  END_TEST;
+    END_TEST;
 }
 
 int UtcDaliPushButtonSetAutoRepeating(void)
@@ -267,122 +282,120 @@ int UtcDaliPushButtonSetAutoRepeating(void)
   END_TEST;
 }
 
-int UtcDaliPushButtonSetGetTogglableButton(void)
+int UtcDaliPushButtonTogglableProperty(void)
 {
   ToolkitTestApplication application;
   tet_infoline(" UtcDaliPushButtonSetGetTogglableButton");
 
   PushButton pushButton = PushButton::New();
 
-  pushButton.SetTogglableButton( true );
+  pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), true );
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("togglable")), true, TEST_LOCATION );
 
-  DALI_TEST_CHECK( pushButton.IsTogglableButton() );
+  pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), false );
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("togglable")), false, TEST_LOCATION );
 
-  pushButton.SetTogglableButton( false );
-
-  DALI_TEST_CHECK( !pushButton.IsTogglableButton() );
-
-  pushButton.SetTogglableButton( true );
+  pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), true );
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("togglable")), true, TEST_LOCATION );
 
-  DALI_TEST_CHECK( pushButton.IsTogglableButton() );
   END_TEST;
 }
 
-int UtcDaliPushButtonSetGetAutoRepeatingAndTogglableButton(void)
+int UtcDaliPushButtonAutoRepeatingPropertyAndTogglableButton(void)
 {
   ToolkitTestApplication application;
   tet_infoline(" UtcDaliPushButtonSetGetAutoRepeatingAndTogglableButton");
 
   PushButton pushButton = PushButton::New();
 
-  pushButton.SetAutoRepeating( true );
-  pushButton.SetTogglableButton( true );
+  pushButton.SetProperty( Button::Property::AUTO_REPEATING, true );
+  pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), true );
 
-  DALI_TEST_CHECK( pushButton.IsTogglableButton() );
-  DALI_TEST_CHECK( !pushButton.IsAutoRepeating() );
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("togglable")), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("autoRepeating")), false, TEST_LOCATION );
 
-  pushButton.SetTogglableButton( true );
-  pushButton.SetAutoRepeating( true );
+  pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), true );
+  pushButton.SetProperty( Button::Property::AUTO_REPEATING, true );
 
-  DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
-  DALI_TEST_CHECK( !pushButton.IsTogglableButton() );
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("autoRepeating")), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("togglable")), false, TEST_LOCATION );
   END_TEST;
 }
 
-int UtcDaliPushButtonSetGetSelected01(void)
+int UtcDaliPushButtonSelectedProperty01(void)
 {
   ToolkitTestApplication application;
   tet_infoline(" UtcDaliPushButtonSetGetSelected01");
 
   PushButton pushButton = PushButton::New();
 
-  pushButton.SetTogglableButton( true );
+  pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), true );
+
   pushButton.StateChangedSignal().Connect( &PushButtonSelected );
 
   gPushButtonSelectedState = false;
-  pushButton.SetSelected( true );
+  pushButton.SetProperty( Button::Property::SELECTED, true );
 
-  DALI_TEST_CHECK( pushButton.IsSelected() );
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED  ), true , TEST_LOCATION );
   DALI_TEST_CHECK( gPushButtonSelectedState );
 
-  pushButton.SetSelected( false );
+  pushButton.SetProperty( Button::Property::SELECTED, false );
 
-  DALI_TEST_CHECK( !pushButton.IsSelected() );
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED  ), false , TEST_LOCATION );
   DALI_TEST_CHECK( !gPushButtonSelectedState );
 
-  pushButton.SetSelected( true );
+  pushButton.SetProperty( Button::Property::SELECTED, true );
 
-  DALI_TEST_CHECK( pushButton.IsSelected() );
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED  ), true , TEST_LOCATION );
   DALI_TEST_CHECK( gPushButtonSelectedState );
   END_TEST;
 }
 
-int UtcDaliPushButtonSetGetSelected02(void)
+int UtcDaliPushButtonSelectedProperty02(void)
 {
   ToolkitTestApplication application;
   tet_infoline(" UtcDaliPushButtonSetGetSelected02");
 
   PushButton pushButton = PushButton::New();
 
-  pushButton.SetTogglableButton( false );
+  pushButton.SetProperty( pushButton.GetPropertyIndex("togglable"), false );
   pushButton.StateChangedSignal().Connect( &PushButtonSelected );
 
   gPushButtonSelectedState = false;
-  pushButton.SetSelected( true );
+  pushButton.SetProperty( Button::Property::SELECTED, true );
 
-  DALI_TEST_CHECK( !pushButton.IsSelected() );
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED  ), false , TEST_LOCATION );
   DALI_TEST_CHECK( !gPushButtonSelectedState );
 
-  pushButton.SetSelected( false );
+  pushButton.SetProperty( Button::Property::SELECTED, false );
 
-  DALI_TEST_CHECK( !pushButton.IsSelected() );
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED  ), false , TEST_LOCATION );
   DALI_TEST_CHECK( !gPushButtonSelectedState );
 
-  pushButton.SetSelected( true );
+  pushButton.SetProperty( Button::Property::SELECTED, true );
 
-  DALI_TEST_CHECK( !pushButton.IsSelected() );
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>( Button::Property::SELECTED  ), false , TEST_LOCATION );
   DALI_TEST_CHECK( !gPushButtonSelectedState );
   END_TEST;
 }
 
-int UtcDaliPushButtonSetGetAutorepeatingDelayValues01(void)
+int UtcDaliPushButtonAutorepeatingDelayPropertyValues01(void)
 {
   ToolkitTestApplication application;
   tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues01");
 
   PushButton pushButton = PushButton::New();
 
-  pushButton.SetAutoRepeating( true );
+  pushButton.SetProperty( Button::Property::AUTO_REPEATING, true );
 
-  pushButton.SetInitialAutoRepeatingDelay( 1.f );
-  DALI_TEST_EQUALS( pushButton.GetInitialAutoRepeatingDelay(), 1.f, TEST_LOCATION );
+  pushButton.SetProperty( Button::Property::INITIAL_AUTO_REPEATING_DELAY, 1.f );
+
+  DALI_TEST_EQUALS( pushButton.GetProperty<float>(pushButton.GetPropertyIndex("initialAutoRepeatingDelay") ), 1.f, TEST_LOCATION );
 
-  pushButton.SetNextAutoRepeatingDelay( 1.f );
-  DALI_TEST_EQUALS( pushButton.GetNextAutoRepeatingDelay(), 1.f, TEST_LOCATION );
   END_TEST;
 }
 
-int UtcDaliPushButtonSetGetAutorepeatingDelayValues02(void)
+int UtcDaliPushButtonAutorepeatingDelayPropertyValues02(void)
 {
   ToolkitTestApplication application;
   tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues02");
@@ -392,11 +405,11 @@ int UtcDaliPushButtonSetGetAutorepeatingDelayValues02(void)
   bool assert1( false );
   bool assert2( false );
 
-  pushButton.SetAutoRepeating( true );
+  pushButton.SetProperty( Button::Property::AUTO_REPEATING, true );
 
   try
   {
-    pushButton.SetInitialAutoRepeatingDelay( -1.f );
+    pushButton.SetProperty( Button::Property::INITIAL_AUTO_REPEATING_DELAY, -1.f );
   }
   catch( Dali::DaliException& e )
   {
@@ -407,7 +420,7 @@ int UtcDaliPushButtonSetGetAutorepeatingDelayValues02(void)
 
   try
   {
-    pushButton.SetNextAutoRepeatingDelay( -1.f );
+    pushButton.SetProperty( Button::Property::NEXT_AUTO_REPEATING_DELAY, -1.f );
   }
   catch( Dali::DaliException& e )
   {
@@ -420,7 +433,7 @@ int UtcDaliPushButtonSetGetAutorepeatingDelayValues02(void)
   END_TEST;
 }
 
-int UtcDaliPushButtonSetLabelText(void)
+int UtcDaliPushButtonLabelProperty(void)
 {
   ToolkitTestApplication application;
   tet_infoline(" UtcDaliPushButtonSetLabelText");
@@ -429,17 +442,18 @@ int UtcDaliPushButtonSetLabelText(void)
 
   PushButton pushButton = PushButton::New();
 
-  pushButton.SetProperty( Toolkit::Button::Property::LABEL,
-                          Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
-                                         .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f )
-                        );
-
   application.SendNotification();
   application.Render();
 
-  pushButton.SetLabelText( STR );
+  pushButton.SetProperty( Toolkit::Button::Property::LABEL,
+                            Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
+                                           .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f )
+                          );
 
-  DALI_TEST_EQUALS( pushButton.GetLabelText(), STR, TEST_LOCATION );
+
+  pushButton.SetProperty( Toolkit::Button::Property::LABEL, STR );
+
+  DALI_TEST_EQUALS( GetButtonText( pushButton ), STR, TEST_LOCATION );
 
   END_TEST;
 }
@@ -595,7 +609,7 @@ int UtcDaliPushButtonSelected(void)
   DALI_TEST_CHECK( !gPushButtonSelectedState );
 
   // Set togglable property.
-  pushButton.SetTogglableButton( true );
+  pushButton.SetProperty( Button::Property::TOGGLABLE, true );
 
   // Test2. Touch point down and up inside the button twice.
   gPushButtonSelectedState = false;
@@ -652,7 +666,8 @@ int UtcDaliPushButtonSelected(void)
   // Test5. Touch point down outside and up inside the button.
   // Start in unselected state
   pushButton.SetProperty( Button::Property::SELECTED, false );
-  DALI_TEST_CHECK( !pushButton.IsSelected());
+
+  DALI_TEST_EQUALS( pushButton.GetProperty<bool>(pushButton.GetPropertyIndex("selected") ),false , TEST_LOCATION );
 
   gPushButtonSelectedState = false;
   event = Dali::Integration::TouchEvent();
@@ -749,7 +764,7 @@ int UtcDaliPushButtonPaddingLayout(void)
   DALI_TEST_EQUALS( size, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
 
   // Check label only padding
-  pushButton.SetLabelText( "Label" );
+  pushButton.SetProperty( Toolkit::Button::Property::LABEL, "Label" );
 
   application.SendNotification();
   application.Render();
@@ -813,7 +828,8 @@ int UtcDaliPushButtonPaddingLayout(void)
   DALI_TEST_EQUALS( size, expectedIconAndPaddingSize, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
 
   // Now test padding for both label and icon simultaneously.
-  pushButton.SetLabelText( "Label" );
+  pushButton.SetProperty( Toolkit::Button::Property::LABEL, "Label" );
+
   application.SendNotification();
   application.Render();
 
@@ -881,7 +897,7 @@ int UtcDaliPushButtonAlignmentLayout(void)
   Stage::GetCurrent().Add( pushButton );
 
   // Add a label and get size of control
-  pushButton.SetLabelText( "Label" );
+  pushButton.SetProperty( Toolkit::Button::Property::LABEL, "Label" );
   application.SendNotification();
   application.Render();
 
@@ -1303,3 +1319,203 @@ int UtcDaliPushButtonToggleSignalP(void)
 
   END_TEST;
 }
+
+// Deprecated API Tests
+
+int UtcDaliPushButtonSetGetAutoRepeating(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliPushButtonSetGetAutoRepeating");
+
+  PushButton pushButton = PushButton::New();
+
+  pushButton.SetAutoRepeating( true );
+
+  DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
+
+  pushButton.SetAutoRepeating( false );
+
+  DALI_TEST_CHECK( !pushButton.IsAutoRepeating() );
+
+  pushButton.SetAutoRepeating( true );
+
+  DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetGetTogglableButton(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliPushButtonSetGetTogglableButton");
+
+  PushButton pushButton = PushButton::New();
+
+  pushButton.SetTogglableButton( true );
+
+  DALI_TEST_CHECK( pushButton.IsTogglableButton() );
+
+  pushButton.SetTogglableButton( false );
+
+  DALI_TEST_CHECK( !pushButton.IsTogglableButton() );
+
+  pushButton.SetTogglableButton( true );
+
+  DALI_TEST_CHECK( pushButton.IsTogglableButton() );
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetGetAutoRepeatingAndTogglableButton(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliPushButtonSetGetAutoRepeatingAndTogglableButton");
+
+  PushButton pushButton = PushButton::New();
+
+  pushButton.SetAutoRepeating( true );
+  pushButton.SetTogglableButton( true );
+
+  DALI_TEST_CHECK( pushButton.IsTogglableButton() );
+  DALI_TEST_CHECK( !pushButton.IsAutoRepeating() );
+
+  pushButton.SetTogglableButton( true );
+  pushButton.SetAutoRepeating( true );
+
+  DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
+  DALI_TEST_CHECK( !pushButton.IsTogglableButton() );
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetGetSelected01(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliPushButtonSetGetSelected01");
+
+  PushButton pushButton = PushButton::New();
+
+  pushButton.SetTogglableButton( true );
+  pushButton.StateChangedSignal().Connect( &PushButtonSelected );
+
+  gPushButtonSelectedState = false;
+  pushButton.SetSelected( true );
+
+  DALI_TEST_CHECK( pushButton.IsSelected() );
+  DALI_TEST_CHECK( gPushButtonSelectedState );
+
+  pushButton.SetSelected( false );
+
+  DALI_TEST_CHECK( !pushButton.IsSelected() );
+  DALI_TEST_CHECK( !gPushButtonSelectedState );
+
+  pushButton.SetSelected( true );
+
+  DALI_TEST_CHECK( pushButton.IsSelected() );
+  DALI_TEST_CHECK( gPushButtonSelectedState );
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetGetSelected02(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliPushButtonSetGetSelected02");
+
+  PushButton pushButton = PushButton::New();
+
+  pushButton.SetTogglableButton( false );
+  pushButton.StateChangedSignal().Connect( &PushButtonSelected );
+
+  gPushButtonSelectedState = false;
+  pushButton.SetSelected( true );
+
+  DALI_TEST_CHECK( !pushButton.IsSelected() );
+  DALI_TEST_CHECK( !gPushButtonSelectedState );
+
+  pushButton.SetSelected( false );
+
+  DALI_TEST_CHECK( !pushButton.IsSelected() );
+  DALI_TEST_CHECK( !gPushButtonSelectedState );
+
+  pushButton.SetSelected( true );
+
+  DALI_TEST_CHECK( !pushButton.IsSelected() );
+  DALI_TEST_CHECK( !gPushButtonSelectedState );
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetGetAutorepeatingDelayValues01(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues01");
+
+  PushButton pushButton = PushButton::New();
+
+  pushButton.SetAutoRepeating( true );
+
+  pushButton.SetInitialAutoRepeatingDelay( 1.f );
+  DALI_TEST_EQUALS( pushButton.GetInitialAutoRepeatingDelay(), 1.f, TEST_LOCATION );
+
+  pushButton.SetNextAutoRepeatingDelay( 1.f );
+  DALI_TEST_EQUALS( pushButton.GetNextAutoRepeatingDelay(), 1.f, TEST_LOCATION );
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetGetAutorepeatingDelayValues02(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues02");
+
+  PushButton pushButton = PushButton::New();
+
+  bool assert1( false );
+  bool assert2( false );
+
+  pushButton.SetAutoRepeating( true );
+
+  try
+  {
+    pushButton.SetInitialAutoRepeatingDelay( -1.f );
+  }
+  catch( Dali::DaliException& e )
+  {
+    DALI_TEST_PRINT_ASSERT( e );
+    DALI_TEST_EQUALS(e.condition, "initialAutoRepeatingDelay > 0.f", TEST_LOCATION);
+    assert1 = true;
+  }
+
+  try
+  {
+    pushButton.SetNextAutoRepeatingDelay( -1.f );
+  }
+  catch( Dali::DaliException& e )
+  {
+    DALI_TEST_PRINT_ASSERT( e );
+    DALI_TEST_EQUALS(e.condition, "nextAutoRepeatingDelay > 0.f", TEST_LOCATION);
+    assert2 = true;
+  }
+
+  DALI_TEST_CHECK( assert1 && assert2 );
+  END_TEST;
+}
+
+int UtcDaliPushButtonSetLabelText(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliPushButtonSetLabelText");
+
+  const std::string STR( "Hola!" );
+
+  PushButton pushButton = PushButton::New();
+
+  pushButton.SetProperty( Toolkit::Button::Property::LABEL,
+                          Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
+                                         .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f )
+                        );
+
+  application.SendNotification();
+  application.Render();
+
+  pushButton.SetLabelText( STR );
+
+  DALI_TEST_EQUALS( pushButton.GetLabelText(), STR, TEST_LOCATION );
+
+  END_TEST;
+}
index 24b4964..85cced6 100644 (file)
@@ -47,6 +47,23 @@ static void TestCallback(BaseHandle handle)
   gObjectCreatedCallBackCalled = true;
 }
 
+static std::string GetButtonText( Button button )
+{
+  Property::Value value = button.GetProperty( Toolkit::Button::Property::LABEL );
+
+  Property::Map *labelProperty = value.GetMap();
+
+  std::string textLabel;
+
+  if ( labelProperty )
+  {
+    Property::Value* value = labelProperty->Find( Toolkit::TextVisual::Property::TEXT );
+    value->Get( textLabel );
+  }
+
+  return textLabel;
+}
+
 }
 
 int UtcDaliRadioButtonConstructorP(void)
@@ -138,11 +155,11 @@ int UtcDaliRadioButtonDownCast(void)
   END_TEST;
 }
 
-int UtcDaliRadioButtonLabelActor(void)
+int UtcDaliRadioButtonLabelProperty(void)
 {
   ToolkitTestApplication application;
 
-  std::string labelText = "test actor 1";
+  const std::string labelText = "test actor 1";
 
   RadioButton radioButton = RadioButton::New();
 
@@ -151,37 +168,14 @@ int UtcDaliRadioButtonLabelActor(void)
                                          .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f )
                         );
 
-  radioButton.SetLabelText( labelText );
+  radioButton.SetProperty( Toolkit::Button::Property::LABEL, labelText );
+  DALI_TEST_EQUALS( GetButtonText( radioButton ), labelText, TEST_LOCATION );
 
-  DALI_TEST_EQUALS( radioButton.GetLabelText(), labelText, TEST_LOCATION );
 
   std::string labelText2 = "test actor 2";
-  radioButton.SetLabelText( labelText2 );
-  DALI_TEST_EQUALS( radioButton.GetLabelText(), labelText2, TEST_LOCATION );
-
-  END_TEST;
-}
+  radioButton.SetProperty( Toolkit::Button::Property::LABEL, labelText2 );
 
-int UtcDaliRadioButtonSelected(void)
-{
-  ToolkitTestApplication application;
-
-  RadioButton radioButton = RadioButton::New();
-
-  // Default selected
-  DALI_TEST_CHECK( radioButton.IsSelected() == false );
-
-  // False
-  radioButton.SetSelected( false );
-  DALI_TEST_CHECK( radioButton.IsSelected() == false );
-
-  // True
-  radioButton.SetSelected( true );
-  DALI_TEST_CHECK( radioButton.IsSelected() == true );
-
-  // False
-  radioButton.SetSelected( false );
-  DALI_TEST_CHECK( radioButton.IsSelected() == false );
+  DALI_TEST_EQUALS( GetButtonText( radioButton ), labelText2, TEST_LOCATION );
 
   END_TEST;
 }
@@ -343,3 +337,55 @@ int UtcDaliRadioButtonSelectedProperty(void)
 
   END_TEST;
 }
+
+
+// Deprecated API Tests
+
+int UtcDaliRadioButtonLabelActor(void)
+{
+  ToolkitTestApplication application;
+
+  std::string labelText = "test actor 1";
+
+  RadioButton radioButton = RadioButton::New();
+
+  radioButton.SetProperty( Toolkit::Button::Property::LABEL,
+                          Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT )
+                                         .Add( Toolkit::TextVisual::Property::POINT_SIZE, 15.0f )
+                        );
+
+  radioButton.SetLabelText( labelText );
+
+  DALI_TEST_EQUALS( radioButton.GetLabelText(), labelText, TEST_LOCATION );
+
+  std::string labelText2 = "test actor 2";
+  radioButton.SetLabelText( labelText2 );
+  DALI_TEST_EQUALS( radioButton.GetLabelText(), labelText2, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliRadioButtonSelected(void)
+{
+  ToolkitTestApplication application;
+
+  RadioButton radioButton = RadioButton::New();
+
+  // Default selected
+  DALI_TEST_CHECK( radioButton.IsSelected() == false );
+
+  // False
+  radioButton.SetSelected( false );
+  DALI_TEST_CHECK( radioButton.IsSelected() == false );
+
+  // True
+  radioButton.SetSelected( true );
+  DALI_TEST_CHECK( radioButton.IsSelected() == true );
+
+  // False
+  radioButton.SetSelected( false );
+  DALI_TEST_CHECK( radioButton.IsSelected() == false );
+
+  END_TEST;
+}
+
index 1ea11be..a4b3c70 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -648,6 +648,38 @@ int UtcDaliTextFieldSetPropertyP(void)
   field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( 0, 0, 1, 1 ) );
   DALI_TEST_EQUALS( field.GetProperty<Rect <int > >( TextField::Property::DECORATION_BOUNDING_BOX ), Rect<int>( 0, 0, 1, 1 ), TEST_LOCATION );
 
+  // Check the input method setting
+  Property::Map propertyMap;
+  InputMethod::PanelLayout::Type panelLayout = InputMethod::PanelLayout::NUMBER;
+  InputMethod::AutoCapital::Type autoCapital = InputMethod::AutoCapital::WORD;
+  InputMethod::ActionButtonTitle::Type actionButton = InputMethod::ActionButtonTitle::GO;
+  int inputVariation = 1;
+  propertyMap["PANEL_LAYOUT"] = panelLayout;
+  propertyMap["AUTO_CAPITALISE"] = autoCapital;
+  propertyMap["ACTION_BUTTON"] = actionButton;
+  propertyMap["VARIATION"] = inputVariation;
+  field.SetProperty( TextField::Property::INPUT_METHOD_SETTINGS, propertyMap );
+
+  Property::Value value = field.GetProperty( TextField::Property::INPUT_METHOD_SETTINGS );
+  Property::Map map;
+  DALI_TEST_CHECK( value.Get( map ) );
+
+  int layout = 0;
+  DALI_TEST_CHECK( map[ "PANEL_LAYOUT" ].Get( layout ) );
+  DALI_TEST_EQUALS( static_cast<int>(panelLayout), layout, TEST_LOCATION );
+
+  int capital = 0;
+  DALI_TEST_CHECK( map[ "AUTO_CAPITALISE" ].Get( capital ) );
+  DALI_TEST_EQUALS( static_cast<int>(autoCapital), capital, TEST_LOCATION );
+
+  int action = 0;
+  DALI_TEST_CHECK( map[ "ACTION_BUTTON" ].Get( action ) );
+  DALI_TEST_EQUALS( static_cast<int>(actionButton), action, TEST_LOCATION );
+
+  int variation = 0;
+  DALI_TEST_CHECK( map[ "VARIATION" ].Get( variation ) );
+  DALI_TEST_EQUALS( inputVariation, variation, TEST_LOCATION );
+
   // Check input color property.
   field.SetProperty( TextField::Property::INPUT_COLOR, Color::YELLOW );
   DALI_TEST_EQUALS( field.GetProperty<Vector4>( TextField::Property::INPUT_COLOR ), Color::YELLOW, TEST_LOCATION );
@@ -1834,6 +1866,9 @@ int utcDaliTextFieldEvent07(void)
   field.SetSize( 300.f, 50.f );
   field.SetParentOrigin( ParentOrigin::TOP_LEFT );
   field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+  Property::Map propertyMap;
+  propertyMap["PANEL_LAYOUT"] = InputMethod::PanelLayout::PASSWORD;
+  field.SetProperty( TextField::Property::INPUT_METHOD_SETTINGS, propertyMap );
 
   // Avoid a crash when core load gl resources.
   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
index e54ad82..bbd151a 100644 (file)
@@ -81,13 +81,7 @@ void RadioButton::OnInitialize()
 bool RadioButton::OnToggleReleased()
 {
   // Radio button overrides toggle release (button up) as doesn't allow un-selection to be performed on it directly.
-  bool stateChanged = false;
-  if( !IsSelected() )
-  {
-    Button::SetSelected( true ); // Set button to selected as previously unselected
-    stateChanged = true;
-  }
-  return stateChanged;
+  return false;
 }
 
 void RadioButton::OnStateChange( State newState )
index 469ea3e..a5aa7ff 100644 (file)
@@ -24,7 +24,6 @@
 #include <dali/public-api/adaptor-framework/key.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/images/resource-image.h>
-#include <dali/devel-api/adaptor-framework/virtual-keyboard.h>
 #include <dali/devel-api/object/property-helper-devel.h>
 #include <dali/public-api/object/type-registry-helper.h>
 #include <dali/integration-api/adaptors/adaptor.h>
@@ -995,6 +994,8 @@ void TextEditor::OnInitialize()
   EnableGestureDetection( static_cast<Gesture::Type>( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) );
   GetTapGestureDetector().SetMaximumTapsRequired( 2 );
 
+  mImfManager = ImfManager::Get();
+
   self.TouchSignal().Connect( this, &TextEditor::OnTouched );
 
   // Set BoundingBox to stage size if not already set.
@@ -1162,20 +1163,15 @@ void TextEditor::OnKeyInputFocusGained()
 {
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor::OnKeyInputFocusGained %p\n", mController.Get() );
 
-  VirtualKeyboard::StatusChangedSignal().Connect( this, &TextEditor::KeyboardStatusChanged );
+  mImfManager.StatusChangedSignal().Connect( this, &TextEditor::KeyboardStatusChanged );
 
-  ImfManager imfManager = ImfManager::Get();
+  mImfManager.EventReceivedSignal().Connect( this, &TextEditor::OnImfEvent );
 
-  if ( imfManager )
-  {
-    imfManager.EventReceivedSignal().Connect( this, &TextEditor::OnImfEvent );
+  // Notify that the text editing start.
+  mImfManager.Activate();
 
-    // Notify that the text editing start.
-    imfManager.Activate();
-
-    // When window gain lost focus, the imf manager is deactivated. Thus when window gain focus again, the imf manager must be activated.
-    imfManager.SetRestoreAfterFocusLost( true );
-  }
+  // When window gain lost focus, the imf manager is deactivated. Thus when window gain focus again, the imf manager must be activated.
+  mImfManager.SetRestoreAfterFocusLost( true );
 
    ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
 
@@ -1193,19 +1189,15 @@ void TextEditor::OnKeyInputFocusLost()
 {
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor:OnKeyInputFocusLost %p\n", mController.Get() );
 
-  VirtualKeyboard::StatusChangedSignal().Disconnect( this, &TextEditor::KeyboardStatusChanged );
+  mImfManager.StatusChangedSignal().Disconnect( this, &TextEditor::KeyboardStatusChanged );
 
-  ImfManager imfManager = ImfManager::Get();
-  if ( imfManager )
-  {
-    // The text editing is finished. Therefore the imf manager don't have restore activation.
-    imfManager.SetRestoreAfterFocusLost( false );
+  // The text editing is finished. Therefore the imf manager don't have restore activation.
+  mImfManager.SetRestoreAfterFocusLost( false );
 
-    // Notify that the text editing finish.
-    imfManager.Deactivate();
+  // Notify that the text editing finish.
+  mImfManager.Deactivate();
 
-    imfManager.EventReceivedSignal().Disconnect( this, &TextEditor::OnImfEvent );
-  }
+  mImfManager.EventReceivedSignal().Disconnect( this, &TextEditor::OnImfEvent );
 
   ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
 
@@ -1223,11 +1215,7 @@ void TextEditor::OnTap( const TapGesture& gesture )
 {
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor::OnTap %p\n", mController.Get() );
 
-  // Show the keyboard if it was hidden.
-  if (!VirtualKeyboard::IsVisible())
-  {
-    VirtualKeyboard::Show();
-  }
+  mImfManager.Activate();
 
   // Deliver the tap before the focus event to controller; this allows us to detect when focus is gained due to tap-gestures
   mController->TapEvent( gesture.numberOfTaps, gesture.localPoint.x, gesture.localPoint.y );
@@ -1242,11 +1230,7 @@ void TextEditor::OnPan( const PanGesture& gesture )
 
 void TextEditor::OnLongPress( const LongPressGesture& gesture )
 {
-  // Show the keyboard if it was hidden.
-  if (!VirtualKeyboard::IsVisible())
-  {
-    VirtualKeyboard::Show();
-  }
+  mImfManager.Activate();
 
   mController->LongPressEvent( gesture.state, gesture.localPoint.x, gesture.localPoint.y );
 
index 09465a8..40f5e03 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_TEXT_EDITOR_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -262,6 +262,7 @@ private: // Data
   Toolkit::TextEditor::TextChangedSignalType mTextChangedSignal;
   Toolkit::TextEditor::InputStyleChangedSignalType mInputStyleChangedSignal;
 
+  ImfManager          mImfManager;
   Text::ControllerPtr mController;
   Text::RendererPtr mRenderer;
   Text::DecoratorPtr mDecorator;
index a32e7f5..3e2c606 100644 (file)
@@ -23,7 +23,6 @@
 #include <dali/public-api/adaptor-framework/key.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/images/resource-image.h>
-#include <dali/devel-api/adaptor-framework/virtual-keyboard.h>
 #include <dali/public-api/object/type-registry-helper.h>
 #include <dali/integration-api/adaptors/adaptor.h>
 #include <dali/integration-api/debug.h>
@@ -32,6 +31,7 @@
 #include <dali-toolkit/public-api/text/rendering-backend.h>
 #include <dali-toolkit/public-api/visuals/color-visual-properties.h>
 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
+#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 #include <dali-toolkit/internal/text/rendering/text-backend.h>
 #include <dali-toolkit/internal/text/text-effects-style.h>
@@ -590,8 +590,18 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       }
       case Toolkit::TextField::Property::INPUT_METHOD_SETTINGS:
       {
-        const Property::Map map = value.Get<Property::Map>();
-        VirtualKeyboard::ApplySettings( map );
+        const Property::Map* map = value.GetMap();
+        if (map)
+        {
+          impl.mInputMethodOptions.ApplyProperty( *map );
+        }
+        impl.mController->SetInputModePassword( impl.mInputMethodOptions.IsPassword() );
+
+        Toolkit::Control control = Toolkit::KeyInputFocusManager::Get().GetCurrentFocusControl();
+        if (control == textField)
+        {
+          impl.mImfManager.ApplyOptions( impl.mInputMethodOptions );
+        }
         break;
       }
       case Toolkit::TextField::Property::INPUT_COLOR:
@@ -994,6 +1004,9 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde
       }
       case Toolkit::TextField::Property::INPUT_METHOD_SETTINGS:
       {
+        Property::Map map;
+        impl.mInputMethodOptions.RetrieveProperty( map );
+        value = map;
         break;
       }
       case Toolkit::TextField::Property::INPUT_COLOR:
@@ -1153,6 +1166,8 @@ void TextField::OnInitialize()
   EnableGestureDetection( static_cast<Gesture::Type>( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) );
   GetTapGestureDetector().SetMaximumTapsRequired( 2 );
 
+  mImfManager = ImfManager::Get();
+
   self.TouchSignal().Connect( this, &TextField::OnTouched );
 
   // Set BoundingBox to stage size if not already set.
@@ -1308,20 +1323,17 @@ void TextField::OnKeyInputFocusGained()
 {
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnKeyInputFocusGained %p\n", mController.Get() );
 
-  VirtualKeyboard::StatusChangedSignal().Connect( this, &TextField::KeyboardStatusChanged );
+  mImfManager.ApplyOptions( mInputMethodOptions );
 
-  ImfManager imfManager = ImfManager::Get();
+  mImfManager.StatusChangedSignal().Connect( this, &TextField::KeyboardStatusChanged );
 
-  if ( imfManager )
-  {
-    imfManager.EventReceivedSignal().Connect( this, &TextField::OnImfEvent );
+  mImfManager.EventReceivedSignal().Connect( this, &TextField::OnImfEvent );
 
-    // Notify that the text editing start.
-    imfManager.Activate();
+  // Notify that the text editing start.
+  mImfManager.Activate();
 
-    // When window gain lost focus, the imf manager is deactivated. Thus when window gain focus again, the imf manager must be activated.
-    imfManager.SetRestoreAfterFocusLost( true );
-  }
+  // When window gain lost focus, the imf manager is deactivated. Thus when window gain focus again, the imf manager must be activated.
+  mImfManager.SetRestoreAfterFocusLost( true );
 
    ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
 
@@ -1339,19 +1351,14 @@ void TextField::OnKeyInputFocusLost()
 {
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField:OnKeyInputFocusLost %p\n", mController.Get() );
 
-  VirtualKeyboard::StatusChangedSignal().Disconnect( this, &TextField::KeyboardStatusChanged );
+  mImfManager.StatusChangedSignal().Disconnect( this, &TextField::KeyboardStatusChanged );
+  // The text editing is finished. Therefore the imf manager don't have restore activation.
+  mImfManager.SetRestoreAfterFocusLost( false );
 
-  ImfManager imfManager = ImfManager::Get();
-  if ( imfManager )
-  {
-    // The text editing is finished. Therefore the imf manager don't have restore activation.
-    imfManager.SetRestoreAfterFocusLost( false );
-
-    // Notify that the text editing finish.
-    imfManager.Deactivate();
+  // Notify that the text editing finish.
+  mImfManager.Deactivate();
 
-    imfManager.EventReceivedSignal().Disconnect( this, &TextField::OnImfEvent );
-  }
+  mImfManager.EventReceivedSignal().Disconnect( this, &TextField::OnImfEvent );
 
   ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
 
@@ -1369,11 +1376,7 @@ void TextField::OnTap( const TapGesture& gesture )
 {
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnTap %p\n", mController.Get() );
 
-  // Show the keyboard if it was hidden.
-  if (!VirtualKeyboard::IsVisible())
-  {
-    VirtualKeyboard::Show();
-  }
+  mImfManager.Activate();
 
   // Deliver the tap before the focus event to controller; this allows us to detect when focus is gained due to tap-gestures
   mController->TapEvent( gesture.numberOfTaps, gesture.localPoint.x, gesture.localPoint.y );
@@ -1388,11 +1391,7 @@ void TextField::OnPan( const PanGesture& gesture )
 
 void TextField::OnLongPress( const LongPressGesture& gesture )
 {
-  // Show the keyboard if it was hidden.
-  if (!VirtualKeyboard::IsVisible())
-  {
-    VirtualKeyboard::Show();
-  }
+  mImfManager.Activate();
 
   mController->LongPressEvent( gesture.state, gesture.localPoint.x, gesture.localPoint.y );
 
index 796e57f..0b7b629 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -265,11 +265,13 @@ private: // Data
   Toolkit::TextField::MaxLengthReachedSignalType mMaxLengthReachedSignal;
   Toolkit::TextField::InputStyleChangedSignalType mInputStyleChangedSignal;
 
+  ImfManager         mImfManager;
   Text::ControllerPtr mController;
   Text::RendererPtr mRenderer;
   Text::DecoratorPtr mDecorator;
   Toolkit::Control mStencil; ///< For EXCEED_POLICY_CLIP
   std::vector<Actor> mClippingDecorationActors;   ///< Decoration actors which need clipping.
+  Dali::InputMethodOptions mInputMethodOptions;
 
   Actor mRenderableActor;
   CallbackBase* mIdleCallback;
index 6d95ac2..6ea83c0 100644 (file)
@@ -32,6 +32,7 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
 #include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
@@ -672,7 +673,6 @@ std::string TextSelectionPopup::GetPressedImage() const
 
    Toolkit::PushButton option = Toolkit::PushButton::New();
    option.SetName( button.name );
-   option.SetAnimationTime( 0.0f );
    option.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
 
    switch( button.id )
@@ -736,11 +736,11 @@ std::string TextSelectionPopup::GetPressedImage() const
    }
 
    // 3. Set the normal option image (blank / Transparent).
-   option.SetUnselectedImage( "" );
+   option.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, "" );
 
    // 4. Set the pressed option image.
    // The image can be blank, the color can be used regardless.
-   option.SetSelectedImage( mPressedImage );
+   option.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, mPressedImage );
    option.SetProperty( Toolkit::Button::Property::SELECTED_COLOR, mPressedColor );
    option.SetProperty( Toolkit::Control::Property::STYLE_NAME, TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME );
 
index 3df8bbe..a55fd8d 100644 (file)
@@ -260,6 +260,10 @@ PixelData Typesetter::Render( const Vector2& size )
         TypesetGlyph( glyphData,
                       position,
                       color );
+        // delete the glyphBitmap.buffer as it is now copied into glyphData.bitmapBuffer
+        delete []glyphData.glyphBitmap.buffer;
+        glyphData.glyphBitmap.buffer = NULL;
+
       }
     }
 
index e250542..2c1b772 100644 (file)
@@ -55,6 +55,7 @@ struct SelectionBoxInfo
 const float MAX_FLOAT = std::numeric_limits<float>::max();
 const float MIN_FLOAT = std::numeric_limits<float>::min();
 const Dali::Toolkit::Text::CharacterDirection LTR = false; ///< Left To Right direction
+const uint32_t STAR = 0x2A;
 
 } // namespace
 
@@ -100,7 +101,8 @@ EventData::EventData( DecoratorPtr decorator )
   mScrollAfterUpdatePosition( false ),
   mScrollAfterDelete( false ),
   mAllTextSelected( false ),
-  mUpdateInputStyle( false )
+  mUpdateInputStyle( false ),
+  mPasswordInput( false )
 {
   mImfManager = ImfManager::Get();
 }
@@ -767,8 +769,24 @@ bool Controller::Impl::UpdateModel( OperationsMask operationsRequired )
     return false;
   }
 
-  Vector<Character>& utf32Characters = mModel->mLogicalModel->mText;
+  Vector<Character> utf32CharactersStar;
+  const Length characterCount = mModel->mLogicalModel->mText.Count();
+  const bool isPasswordInput = ( mEventData != NULL && mEventData->mPasswordInput &&
+        !mEventData->mIsShowingPlaceholderText && characterCount > 0 );
+
+  if (isPasswordInput)
+  {
+    utf32CharactersStar.Resize( characterCount );
+
+    uint32_t* begin = utf32CharactersStar.Begin();
+    uint32_t* end = begin + characterCount;
+    while ( begin < end )
+    {
+      *begin++ = STAR;
+    }
+  }
 
+  Vector<Character>& utf32Characters = isPasswordInput ? utf32CharactersStar : mModel->mLogicalModel->mText;
   const Length numberOfCharacters = utf32Characters.Count();
 
   // Index to the first character of the first paragraph to be updated.
@@ -2562,7 +2580,7 @@ CharacterIndex Controller::Impl::CalculateNewCursorIndex( CharacterIndex index )
     const Script script = mModel->mLogicalModel->GetScript( index );
     if( HasLigatureMustBreak( script ) )
     {
-      // Prevents to jump the whole Latin ligatures like fi, ff, or Arabic ﻻ,  ...
+      // Prevents to jump the whole Latin ligatures like fi, ff, or Arabic ﻻ, ...
       numberOfCharacters = 1u;
     }
   }
index 424ac0b..0eb8451 100644 (file)
@@ -148,6 +148,7 @@ struct EventData
   bool mScrollAfterDelete               : 1;   ///< Whether to scroll after delete characters.
   bool mAllTextSelected                 : 1;   ///< True if the selection handles are selecting all the text.
   bool mUpdateInputStyle                : 1;   ///< Whether to update the input style after moving the cursor.
+  bool mPasswordInput                   : 1;   ///< True if password input is enabled.
   bool mCheckScrollAmount               : 1;   ///< Whether to check scrolled amount after updating the position
 };
 
index 1bb0fed..8500659 100644 (file)
@@ -1313,6 +1313,23 @@ const std::string& Controller::GetInputOutlineProperties() const
   return GetDefaultOutlineProperties();
 }
 
+void Controller::SetInputModePassword( bool passwordInput )
+{
+  if( NULL != mImpl->mEventData )
+  {
+    mImpl->mEventData->mPasswordInput = passwordInput;
+  }
+}
+
+bool Controller::IsInputModePassword()
+{
+  if( NULL != mImpl->mEventData )
+  {
+    return mImpl->mEventData->mPasswordInput;
+  }
+  return false;
+}
+
 // public : Queries & retrieves.
 
 Layout::Engine& Controller::GetLayoutEngine()
index f5b825e..4bb6f7c 100644 (file)
@@ -334,6 +334,22 @@ public: // Configure the text controller.
    */
   bool IsTextElideEnabled() const;
 
+  /**
+   * @brief Sets input type to password
+   *
+   * @note The string is displayed continuous "*"
+   *
+   * @param[in] passwordInput True if password input is enabled.
+   */
+  void SetInputModePassword( bool passwordInput );
+
+  /**
+   * @brief Returns whether the input mode type is set as password.
+   *
+   * @return True if input mode type is password
+   */
+  bool IsInputModePassword();
+
 public: // Update.
 
   /**