// Test that image view with empty property map don't make visual even DebugRendering is enabled.
map.Clear();
- ImageView imageView = ImageView::New();
- imageView.SetProperty(Control::Property::BACKGROUND, map);
- imageView.SetProperty(ImageView::Property::IMAGE, map);
-
- application.GetScene().Add(imageView);
+ ImageView imageView1 = ImageView::New();
+ imageView1.SetProperty(Control::Property::BACKGROUND, map);
+ imageView1.SetProperty(ImageView::Property::IMAGE, map);
+
+ // Test that image view with empty property value don't make visual even DebugRendering is enabled.
+ Property::Value emptyValue;
+ ImageView imageView2 = ImageView::New();
+ imageView2.SetProperty(Control::Property::BACKGROUND, emptyValue);
+ imageView2.SetProperty(ImageView::Property::IMAGE, emptyValue);
+
+ // Test that image view with invalid property value don't make visual even DebugRendering is enabled.
+ Property::Value invalidValue(static_cast<int>(3));
+ ImageView imageView3 = ImageView::New();
+ imageView3.SetProperty(Control::Property::BACKGROUND, invalidValue);
+ imageView3.SetProperty(ImageView::Property::IMAGE, invalidValue);
+
+ application.GetScene().Add(imageView1);
+ application.GetScene().Add(imageView2);
+ application.GetScene().Add(imageView3);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( imageView.GetRendererCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( imageView1.GetRendererCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( imageView2.GetRendererCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( imageView3.GetRendererCount(), 0u, TEST_LOCATION );
EnvironmentVariable::SetTestingEnvironmentVariable(false);
END_TEST;
}
END_TEST;
-}
\ No newline at end of file
+}
// Signal that a Relayout may be needed
}
+void ImageView::ClearImageVisual()
+{
+ // Clear cached properties
+ mPropertyMap.Clear();
+ mUrl.clear();
+
+ // Unregister the exsiting visual
+ DevelControl::UnregisterVisual(*this, Toolkit::ImageView::Property::IMAGE);
+
+ // Trigger a size negotiation request that may be needed when unregistering a visual.
+ RelayoutRequest();
+}
+
void ImageView::EnablePreMultipliedAlpha(bool preMultipled)
{
if(mVisual)
else
{
map = value.GetMap();
- if(map)
+ if(DALI_LIKELY(map))
{
// the property map is emtpy map. Unregister visual.
if(DALI_UNLIKELY(map->Count() == 0u))
{
- // Clear cached properties
- impl.mPropertyMap.Clear();
- impl.mUrl.clear();
-
- // Unregister the exsiting visual
- DevelControl::UnregisterVisual(impl, Toolkit::ImageView::Property::IMAGE);
-
- // Trigger a size negotiation request that may be needed when unregistering a visual.
- impl.RelayoutRequest();
+ impl.ClearImageVisual();
}
else
{
}
}
}
+ else
+ {
+ // invalid property value comes. Unregister visual.
+ impl.ClearImageVisual();
+ }
}
break;
}
#define DALI_TOOLKIT_INTERNAL_IMAGE_VIEW_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
*/
void SetImage(const std::string& imageUrl, ImageDimensions size);
+ /**
+ * @brief Unregister ImageView IMAGE visual
+ *
+ * ImageView will display nothing
+ */
+ void ClearImageVisual();
+
/**
* @brief Set whether the Pre-multiplied Alpha Blending is required
*