Update common test util
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-button.cpp
index cbecb9b..3d25205 100644 (file)
@@ -17,7 +17,6 @@
 #include <dali/dali.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <test-button.h>
-#include <dali/devel-api/object/type-registry-helper.h>
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -72,6 +71,7 @@ void TestButton::SetProperty( BaseObject* object, Property::Index index, const P
 
   if ( button )
   {
+    TestButton& buttonImpl = GetImpl(button);
     switch ( index )
     {
       case Test::TestButton::Property::PRESS_TRANSITION:
@@ -79,19 +79,28 @@ void TestButton::SetProperty( BaseObject* object, Property::Index index, const P
         if( value.GetType() == Property::MAP )
         {
           Property::Map* valueMap = value.GetMap();
-          TestButton& buttonImpl = GetImpl(button);
           buttonImpl.mPressTransitionData.Clear();
           NewAnimation( *valueMap, buttonImpl.mPressTransitionData );
         }
         else if( value.GetType() == Property::ARRAY )
         {
           Property::Array* valueArray = value.GetArray();
-          TestButton& buttonImpl = GetImpl(button);
           buttonImpl.mPressTransitionData.Clear();
           NewAnimation( *valueArray, buttonImpl.mPressTransitionData );
         }
         break;
       }
+      case Test::TestButton::Property::BACKGROUND_COLOR:
+      {
+        buttonImpl.mBackgroundColor = value.Get<Vector4>();
+        break;
+      }
+
+      case Test::TestButton::Property::FOREGROUND_COLOR:
+      {
+        buttonImpl.mForegroundColor = value.Get<Vector4>();
+        break;
+      }
     }
   }
 }
@@ -100,6 +109,8 @@ Property::Value TestButton::GetProperty( BaseObject* object, Property::Index pro
 {
   Test::TestButton button = Test::TestButton::DownCast( Dali::BaseHandle( object ) );
 
+  Property::Value value;
+
   if ( button )
   {
     TestButton& buttonImpl = GetImpl(button);
@@ -108,22 +119,26 @@ Property::Value TestButton::GetProperty( BaseObject* object, Property::Index pro
       case Test::TestButton::Property::PRESS_TRANSITION:
       {
         return ConvertAnimationMap(buttonImpl.mPressTransitionData);
-        break;
       }
       case Test::TestButton::Property::RELEASE_TRANSITION:
       {
         return ConvertAnimationMap(buttonImpl.mReleaseTransitionData);
-        break;
       }
       case Test::TestButton::Property::DISABLED_TRANSITION:
       {
         return ConvertAnimationMap(buttonImpl.mDisabledTransitionData);
-        break;
       }
       case Test::TestButton::Property::ENABLED_TRANSITION:
       {
         return ConvertAnimationMap(buttonImpl.mEnabledTransitionData);
-        break;
+      }
+      case Test::TestButton::Property::BACKGROUND_COLOR:
+      {
+        return Property::Value(buttonImpl.mBackgroundColor);
+      }
+      case Test::TestButton::Property::FOREGROUND_COLOR:
+      {
+        return Property::Value(buttonImpl.mForegroundColor);
       }
     }
   }
@@ -142,6 +157,8 @@ DALI_PROPERTY_REGISTRATION( Test, TestButton, "pressTransition", ARRAY, PRESS_TR
 DALI_PROPERTY_REGISTRATION( Test, TestButton, "releaseTransition", ARRAY, RELEASE_TRANSITION)
 DALI_PROPERTY_REGISTRATION( Test, TestButton, "disabledTransition", ARRAY, DISABLED_TRANSITION )
 DALI_PROPERTY_REGISTRATION( Test, TestButton, "enabledTransition", ARRAY, ENABLED_TRANSITION )
+DALI_PROPERTY_REGISTRATION( Test, TestButton, "backgroundColor", VECTOR4, BACKGROUND_COLOR )
+DALI_PROPERTY_REGISTRATION( Test, TestButton, "foregroundColor", VECTOR4, FOREGROUND_COLOR )
 
 DALI_TYPE_REGISTRATION_END()