(ImageView) Reinstated RESOURCE_URL property for source compatibility with release 43/56243/4
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 5 Jan 2016 15:08:39 +0000 (15:08 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 5 Jan 2016 18:16:48 +0000 (18:16 +0000)
- But marked as deprecated

Change-Id: I000b9684d9e94a77d477997a3b5fdfaea7b6cacd

automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp
dali-toolkit/internal/controls/image-view/image-view-impl.cpp
dali-toolkit/public-api/controls/image-view/image-view.h

index cfe23c3..2feeee2 100644 (file)
@@ -551,3 +551,16 @@ int UtcDaliImageViewSetImageTypeChangesP(void)
 
   END_TEST;
 }
+
+int UtcDaliImageViewResourceUrlP(void)
+{
+  ToolkitTestApplication application;
+
+  ImageView imageView = ImageView::New();
+  DALI_TEST_CHECK( imageView.GetProperty( ImageView::Property::RESOURCE_URL ).Get< std::string >().empty() );
+
+  imageView.SetProperty( ImageView::Property::RESOURCE_URL, "TestString" );
+  DALI_TEST_EQUALS( imageView.GetProperty( ImageView::Property::RESOURCE_URL ).Get< std::string >(), "TestString", TEST_LOCATION );
+
+  END_TEST;
+}
index 714701a..e98f539 100644 (file)
@@ -33,6 +33,7 @@ BaseHandle Create()
 
 // Setup properties, signals and actions using the type-registry.
 DALI_TYPE_REGISTRATION_BEGIN( Toolkit::ImageView, Toolkit::Control, Create );
+DALI_PROPERTY_REGISTRATION( Toolkit, ImageView, "resourceUrl", STRING, RESOURCE_URL )
 DALI_PROPERTY_REGISTRATION( Toolkit, ImageView, "image", MAP, IMAGE )
 DALI_TYPE_REGISTRATION_END()
 
@@ -231,6 +232,16 @@ void ImageView::SetProperty( BaseObject* object, Property::Index index, const Pr
   {
     switch ( index )
     {
+      case Toolkit::ImageView::Property::RESOURCE_URL:
+      {
+        std::string imageUrl;
+        if( value.Get( imageUrl ) )
+        {
+          GetImpl( imageView ).SetImage( imageUrl, ImageDimensions() );
+        }
+        break;
+      }
+
       case Toolkit::ImageView::Property::IMAGE:
       {
         std::string imageUrl;
@@ -264,6 +275,16 @@ Property::Value ImageView::GetProperty( BaseObject* object, Property::Index prop
   {
     switch ( propertyIndex )
     {
+      case Toolkit::ImageView::Property::RESOURCE_URL:
+      {
+        ImageView& impl = GetImpl( imageview );
+        if ( !impl.mUrl.empty() )
+        {
+          value = impl.mUrl;
+        }
+        break;
+      }
+
       case Toolkit::ImageView::Property::IMAGE:
       {
         ImageView& impl = GetImpl( imageview );
index f3b5416..efbc884 100644 (file)
@@ -62,7 +62,8 @@ public:
   {
     enum
     {
-      IMAGE = PROPERTY_START_INDEX, ///< name "image", @see SetImage(), type string if it is a url, map otherwise
+      RESOURCE_URL = PROPERTY_START_INDEX, ///< name "resourceUrl",  @deprecated DALi 1.1.16 Use IMAGE instead.  type string
+      IMAGE,                               ///< name "image",        @see SetImage(),                            type string if it is a url, map otherwise
     };
   };