From: Bowon Ryu Date: Thu, 13 Jan 2022 05:53:38 +0000 (+0000) Subject: Merge "Extending Text Styles - Adding Dashed/Double Underline" into devel/master X-Git-Tag: dali_2.1.5~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=b7108fc5f28fd650a1ea08a8692c822a63baf5bd;hp=29a52105283ce8ced672ed92545daeacf882316a Merge "Extending Text Styles - Adding Dashed/Double Underline" into devel/master --- diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp index 2887613..9b733f2 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp @@ -292,16 +292,32 @@ int UtcDaliDebugRenderingGetVisual3(void) // 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(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; @@ -404,4 +420,4 @@ int UtcDaliDebugRenderingRenderText(void) } END_TEST; -} \ No newline at end of file +} diff --git a/dali-toolkit/internal/controls/image-view/image-view-impl.cpp b/dali-toolkit/internal/controls/image-view/image-view-impl.cpp index 1d9deec..0011c02 100644 --- a/dali-toolkit/internal/controls/image-view/image-view-impl.cpp +++ b/dali-toolkit/internal/controls/image-view/image-view-impl.cpp @@ -171,6 +171,19 @@ void ImageView::SetImage(const std::string& url, ImageDimensions size) // 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) @@ -477,20 +490,12 @@ void ImageView::SetProperty(BaseObject* object, Property::Index index, const Pro 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 { @@ -520,6 +525,11 @@ void ImageView::SetProperty(BaseObject* object, Property::Index index, const Pro } } } + else + { + // invalid property value comes. Unregister visual. + impl.ClearImageVisual(); + } } break; } diff --git a/dali-toolkit/internal/controls/image-view/image-view-impl.h b/dali-toolkit/internal/controls/image-view/image-view-impl.h index ef48839..cf288ab 100644 --- a/dali-toolkit/internal/controls/image-view/image-view-impl.h +++ b/dali-toolkit/internal/controls/image-view/image-view-impl.h @@ -2,7 +2,7 @@ #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. @@ -68,6 +68,13 @@ public: 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 * * @param[in] preMultipled whether alpha is pre-multiplied.