From: Bowon Ryu Date: Mon, 20 Jun 2022 04:40:19 +0000 (+0000) Subject: Merge "Fix uint16 max issue in TextLabel" into devel/master X-Git-Tag: dali_2.1.28~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=be883932dce8ff3fde1d0db358adbc611de65adc;hp=011809b172571db7e51c419448da590e13c936e1 Merge "Fix uint16 max issue in TextLabel" into devel/master --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp index dab40a2..2ff4a7d 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp @@ -2087,6 +2087,13 @@ int UtcDaliToolkitTextlabelMaxTextureSet(void) // Check if the number of renderers is greater than 1. DALI_TEST_CHECK(label.GetRendererCount() > 1u); + // Coverage test for case of layoutSize is bigger than maxTextureSize + float max_value = static_cast(std::numeric_limits::max()); + label.SetProperty(Actor::Property::SIZE, Vector2(max_value, 30.0f)); + application.SendNotification(); + application.Render(); + + END_TEST; } diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index 97ccc81..2d2368b 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -1062,6 +1062,13 @@ void TextLabel::OnRelayout(const Vector2& size, RelayoutContainer& container) alignmentOffset.x = 0.0f; alignmentOffset.y = (contentSize.y - layoutSize.y) * VERTICAL_ALIGNMENT_TABLE[mController->GetVerticalAlignment()]; + const int maxTextureSize = Dali::GetMaxTextureSize(); + if(layoutSize.width > maxTextureSize) + { + DALI_LOG_WARNING("layoutSize(%f) > maxTextureSize(%d): To guarantee the behavior of Texture::New, layoutSize must not be bigger than maxTextureSize\n", layoutSize.width, maxTextureSize); + layoutSize.width = maxTextureSize; + } + Property::Map visualTransform; visualTransform.Add(Toolkit::Visual::Transform::Property::SIZE, layoutSize) .Add(Toolkit::Visual::Transform::Property::SIZE_POLICY, Vector2(Toolkit::Visual::Transform::Policy::ABSOLUTE, Toolkit::Visual::Transform::Policy::ABSOLUTE))