Change-Id: I4d26e3332d6998e453bbdb6f66adb422743a3145
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<bool>() == true );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<bool>() == true );
+ // Test the properties..
+ Property::Value imageValue = imageVisual.GetProperty( ImageVisual::Property::URL );
+ DALI_TEST_CHECK( imageValue.Get<std::string>() == TEST_IMAGE_FILE_NAME );
+
+ // Other Properties for Image Visual can be tested here once implemented in the Visual
+
+ tet_infoline( "UtcDaliVisualGetPropertyMap5 Ensuring Property without a Getter is not problematic" );
+ imageValue = imageVisual.GetProperty( ImageVisual::Property::DESIRED_HEIGHT );
+ DALI_TEST_CHECK( imageValue.Get<int>() != 30 );
+
+
+ // Rest of test uses Image not an url ( legacy )
+
// Get an image visual with an image handle, and test the default property values
Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME, ImageDimensions(100, 200));
imageVisual = factory.CreateVisual(image);
// Get an image visual with an image handle, and test the default property values
Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME, ImageDimensions(100, 200));
imageVisual = factory.CreateVisual(image);
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<bool>() == false );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<bool>() == false );
- // Test the properties. TODO: to be completed.
- imageVisual.SetProperty( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
- Property::Value imageValue = imageVisual.GetProperty( ImageVisual::Property::URL );
-
ToolkitTestApplication application;
tet_infoline( "UtcDaliVisualGetPropertyMap6: NPatchVisual" );
ToolkitTestApplication application;
tet_infoline( "UtcDaliVisualGetPropertyMap6: NPatchVisual" );
+ bool BORDER_ONLY_SETTING = true;
+
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
propertyMap.Insert( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME );
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
propertyMap.Insert( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME );
- propertyMap.Insert( ImageVisual::Property::BORDER_ONLY, true );
+ propertyMap.Insert( ImageVisual::Property::BORDER_ONLY, BORDER_ONLY_SETTING );
Visual::Base nPatchVisual = factory.CreateVisual( propertyMap );
Property::Map resultMap;
Visual::Base nPatchVisual = factory.CreateVisual( propertyMap );
Property::Map resultMap;
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<bool>() );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<bool>() );
- // Test the properties. TODO: to be completed.
- nPatchVisual.SetProperty( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME );
+ // Test the properties via Index.
+ nPatchVisual.SetProperty( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME ); // May not able to change URL in future using SetProperty
Property::Value nPatchValue = nPatchVisual.GetProperty( ImageVisual::Property::URL );
Property::Value nPatchValue = nPatchVisual.GetProperty( ImageVisual::Property::URL );
+ DALI_TEST_CHECK( nPatchValue.Get<std::string>() == TEST_NPATCH_FILE_NAME );
+
+ nPatchValue = nPatchVisual.GetProperty( ImageVisual::Property::BORDER_ONLY );
+ DALI_TEST_CHECK( nPatchValue.Get<bool>() == BORDER_ONLY_SETTING );
+
+ // Other Properties for N-Patch Visual can be tested here once implemented in the Visual
+
+ tet_infoline( "UtcDaliVisualGetPropertyMap6 Ensuring Property without a Getter is not problematic" );
+ nPatchValue = nPatchVisual.GetProperty( ImageVisual::Property::DESIRED_HEIGHT );
+ DALI_TEST_CHECK( nPatchValue.Get<int>() != 30 );
void ImageVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
{
void ImageVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
{
+ // This is where specific Properties can be set.
}
Dali::Property::Value ImageVisual::DoGetProperty( Dali::Property::Index index )
{
}
Dali::Property::Value ImageVisual::DoGetProperty( Dali::Property::Index index )
{
- // TODO
- return Dali::Property::Value();
+ Dali::Property::Value value;
+
+ switch( index )
+ {
+ case Toolkit::ImageVisual::Property::URL:
+ {
+ value = mImageUrl;
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ return value;
}
void ImageVisual::OnSetTransform()
}
void ImageVisual::OnSetTransform()
void NPatchVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
{
void NPatchVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
{
+ // This is where specific Properties can be set.
}
Dali::Property::Value NPatchVisual::DoGetProperty( Dali::Property::Index index )
{
}
Dali::Property::Value NPatchVisual::DoGetProperty( Dali::Property::Index index )
{
- // TODO
- return Dali::Property::Value();
+ Dali::Property::Value value;
+
+ switch( index )
+ {
+ case Toolkit::ImageVisual::Property::URL:
+ {
+ value = mImageUrl;
+ break;
+ }
+ case Toolkit::ImageVisual::Property::BORDER_ONLY:
+ {
+ value = mBorderOnly;
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ return value;
}
void NPatchVisual::OnSetTransform()
}
void NPatchVisual::OnSetTransform()