From: EverLEEst(SangHyeon Lee) Date: Tue, 30 Aug 2022 06:26:54 +0000 (+0900) Subject: Merge branch 'devel/master' into tizen X-Git-Tag: accepted/tizen/unified/20220830.133736~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=93e3e67c208208776a7877312a097c502c19f5ce;hp=03666bf124551fdf6afed6bbcba3cd998c776748;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git Merge branch 'devel/master' into tizen --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp index b95f6c7..fac21a0 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -5124,6 +5124,44 @@ int utcDaliTextEditorGeometryOneGlyph(void) END_TEST; } +int utcDaliTextEditorGeometryNullPtr(void) +{ + ToolkitTestApplication application; + tet_infoline("utcDaliTextEditorGeometryNullPtr"); + + TextEditor editor = TextEditor::New(); + DALI_TEST_CHECK(editor); + + application.GetScene().Add(editor); + + editor.SetProperty(TextEditor::Property::POINT_SIZE, 7.f); + editor.SetProperty(Actor::Property::SIZE, Vector2(200.f, 200.f)); + editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true); + editor.SetProperty(TextEditor::Property::TEXT, ""); + + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); + + unsigned int expectedCount = 0; + unsigned int startIndex = 0; + unsigned int endIndex = 0; + + Vector positionsList = DevelTextEditor::GetTextPosition(editor, startIndex, endIndex); + Vector sizeList = DevelTextEditor::GetTextSize(editor, startIndex, endIndex); + + // Render and notify + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION); + DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION); + + END_TEST; +} + + int utcDaliTextEditorSelectionClearedSignal(void) { ToolkitTestApplication application; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp index f762e8d..df1c60b 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp @@ -513,7 +513,7 @@ int UtcDaliToolkitTextFieldCopyConstructorP(void) TextField copy(textField); DALI_TEST_CHECK(copy); - DALI_TEST_CHECK(copy.GetProperty(TextLabel::Property::TEXT) == textField.GetProperty(TextLabel::Property::TEXT)); + DALI_TEST_CHECK(copy.GetProperty(TextField::Property::TEXT) == textField.GetProperty(TextField::Property::TEXT)); END_TEST; } @@ -4875,6 +4875,44 @@ int utcDaliTextFieldGeometryGlyphMiddle(void) END_TEST; } + +int utcDaliTextFieldGeometryNullPtr(void) +{ + ToolkitTestApplication application; + tet_infoline("utcDaliTextFieldGeometryNullPtr"); + + TextField field = TextField::New(); + DALI_TEST_CHECK(field); + + application.GetScene().Add(field); + + field.SetProperty(TextField::Property::POINT_SIZE, 7.f); + field.SetProperty(Actor::Property::SIZE, Vector2(200.f, 200.f)); + field.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + field.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + field.SetProperty(TextField::Property::ENABLE_MARKUP, true); + field.SetProperty(TextField::Property::TEXT, ""); + + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); + + unsigned int expectedCount = 0; + unsigned int startIndex = 0; + unsigned int endIndex = 0; + + Vector positionsList = DevelTextField::GetTextPosition(field, startIndex, endIndex); + Vector sizeList = DevelTextField::GetTextSize(field, startIndex, endIndex); + + // Render and notify + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION); + DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION); + + END_TEST; +} + int utcDaliTextFieldSelectionClearedSignal(void) { ToolkitTestApplication application; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp index 0ece717..23febac 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp @@ -1508,6 +1508,45 @@ int UtcDaliToolkitTextlabelScrollingN(void) const bool enabled = label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get(); DALI_TEST_CHECK(!enabled); + + label.SetProperty(TextLabel::Property::MULTI_LINE, false); + label.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 1); + label.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 9999.0f); + label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true); + + try + { + // Render the text. + application.SendNotification(); + application.Render(1000); + + application.GetScene().Remove(label); + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK(!label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get()); + + label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, true); + application.GetScene().Add(label); + + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK(label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get()); + + label.SetProperty(TextLabel::Property::AUTO_SCROLL_STOP_MODE, (Toolkit::TextLabel::AutoScrollStopMode::Type)2); // invalid type + label.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL, false); + + application.SendNotification(); + application.Render(); + + DALI_TEST_CHECK(label.GetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL).Get()); + } + catch(...) + { + tet_result(TET_FAIL); + } + END_TEST; } @@ -2637,6 +2676,44 @@ int utcDaliTextLabelGeometryOneGlyph(void) END_TEST; } + +int utcDaliTextLabelGeometryNullPtr(void) +{ + ToolkitTestApplication application; + tet_infoline("utcDaliTextLabelGeometryNullPtr"); + + TextLabel label = TextLabel::New(); + DALI_TEST_CHECK(label); + + application.GetScene().Add(label); + + label.SetProperty(TextLabel::Property::POINT_SIZE, 7.f); + label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 200.f)); + label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true); + label.SetProperty(TextLabel::Property::TEXT, ""); + + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); + + unsigned int expectedCount = 0; + unsigned int startIndex = 0; + unsigned int endIndex = 0; + + Vector positionsList = DevelTextLabel::GetTextPosition(label, startIndex, endIndex); + Vector sizeList = DevelTextLabel::GetTextSize(label, startIndex, endIndex); + + // Render and notify + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION); + DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION); + + END_TEST; +} + int UtcDaliToolkitTextlabelEllipsisPositionProperty(void) { ToolkitTestApplication application; 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 2d2368b..d9e413f 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -351,6 +351,7 @@ void TextLabel::SetProperty(BaseObject* object, Property::Index index, const Pro case Toolkit::TextLabel::Property::ENABLE_AUTO_SCROLL: { const bool enableAutoScroll = value.Get(); + impl.mLastAutoScrollEnabled = enableAutoScroll; // If request to auto scroll is the same as current state then do nothing. if(enableAutoScroll != impl.mController->IsAutoScrollEnabled()) { @@ -1008,6 +1009,32 @@ void TextLabel::OnPropertySet(Property::Index index, const Property::Value& prop } } +void TextLabel::OnSceneConnection(int depth) +{ + if(mController->IsAutoScrollEnabled() || mLastAutoScrollEnabled) + { + mController->SetAutoScrollEnabled(true); + } + Control::OnSceneConnection(depth); +} + +void TextLabel::OnSceneDisconnection() +{ + if(mTextScroller) + { + if(mLastAutoScrollEnabled && !mController->IsAutoScrollEnabled()) + { + mLastAutoScrollEnabled = false; + } + + const Toolkit::TextLabel::AutoScrollStopMode::Type stopMode = mTextScroller->GetStopMode(); + mTextScroller->SetStopMode(Toolkit::TextLabel::AutoScrollStopMode::IMMEDIATE); + mTextScroller->StopScrolling(); + mTextScroller->SetStopMode(stopMode); + } + Control::OnSceneDisconnection(); +} + void TextLabel::OnRelayout(const Vector2& size, RelayoutContainer& container) { DALI_LOG_INFO(gLogFilter, Debug::General, "TextLabel::OnRelayout\n"); @@ -1190,7 +1217,8 @@ void TextLabel::OnAccessibilityStatusChanged() TextLabel::TextLabel(ControlBehaviour additionalBehavior) : Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT | additionalBehavior)), mRenderingBackend(DEFAULT_RENDERING_BACKEND), - mTextUpdateNeeded(false) + mTextUpdateNeeded(false), + mLastAutoScrollEnabled(false) { } diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.h b/dali-toolkit/internal/controls/text-controls/text-label-impl.h index f4dac1d..31167d8 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.h @@ -19,6 +19,7 @@ */ // EXTERNAL INCLUDES +#include #include #include #include @@ -165,6 +166,16 @@ private: // From Control */ void OnPropertySet(Property::Index index, const Property::Value& propertyValue) override; + /** + * @copydoc Control::OnSceneConnection() + */ + void OnSceneConnection(int depth) override; + + /** + * @copydoc Control::OnSceneDisconnection() + */ + void OnSceneDisconnection() override; + // From ControlInterface /** @@ -247,6 +258,7 @@ private: // Data int mRenderingBackend; bool mTextUpdateNeeded : 1; + bool mLastAutoScrollEnabled : 1; protected: /** diff --git a/dali-toolkit/internal/graphics/shaders/color-visual-shader.frag b/dali-toolkit/internal/graphics/shaders/color-visual-shader.frag index 36a4104..662121e 100644 --- a/dali-toolkit/internal/graphics/shaders/color-visual-shader.frag +++ b/dali-toolkit/internal/graphics/shaders/color-visual-shader.frag @@ -71,7 +71,8 @@ void calculatePotential() void setupMinMaxPotential() { - gPotentialRange = 1.0; + // Set soft anti-alias range at most 2% of visual size + gPotentialRange = min(1.0, max(vRectSize.x, vRectSize.y) * 0.02); gMaxOutlinePotential = gRadius + gPotentialRange; gMinOutlinePotential = gRadius - gPotentialRange; @@ -118,7 +119,7 @@ lowp vec4 convertBorderlineColor(lowp vec4 textureColor) borderlineOpacity = smoothstep(gMinInlinePotential, gMaxInlinePotential, potential); // Muliply borderlineWidth to resolve very thin borderline - borderlineOpacity *= min(1.0, borderlineWidth); + borderlineOpacity *= min(1.0, borderlineWidth / gPotentialRange); } lowp vec3 borderlineColorRGB = borderlineColor.rgb * uActorColor.rgb; diff --git a/dali-toolkit/internal/graphics/shaders/gradient-visual-shader.frag b/dali-toolkit/internal/graphics/shaders/gradient-visual-shader.frag index 1812cd3..0d24481 100644 --- a/dali-toolkit/internal/graphics/shaders/gradient-visual-shader.frag +++ b/dali-toolkit/internal/graphics/shaders/gradient-visual-shader.frag @@ -69,7 +69,8 @@ void calculatePotential() void setupMinMaxPotential() { - gPotentialRange = 1.0; + // Set soft anti-alias range at most 2% of visual size + gPotentialRange = min(1.0, max(vRectSize.x, vRectSize.y) * 0.02); gMaxOutlinePotential = gRadius + gPotentialRange; gMinOutlinePotential = gRadius - gPotentialRange; @@ -113,7 +114,7 @@ lowp vec4 convertBorderlineColor(lowp vec4 textureColor) borderlineOpacity = smoothstep(gMinInlinePotential, gMaxInlinePotential, potential); // Muliply borderlineWidth to resolve very thin borderline - borderlineOpacity *= min(1.0, borderlineWidth); + borderlineOpacity *= min(1.0, borderlineWidth / gPotentialRange); } lowp vec3 borderlineColorRGB = borderlineColor.rgb * uActorColor.rgb; diff --git a/dali-toolkit/internal/graphics/shaders/image-visual-shader.frag b/dali-toolkit/internal/graphics/shaders/image-visual-shader.frag index a0f39d9..cb5e765 100644 --- a/dali-toolkit/internal/graphics/shaders/image-visual-shader.frag +++ b/dali-toolkit/internal/graphics/shaders/image-visual-shader.frag @@ -99,7 +99,8 @@ void calculatePotential() void setupMinMaxPotential() { - gPotentialRange = 1.0; + // Set soft anti-alias range at most 2% of visual size + gPotentialRange = min(1.0, max(vRectSize.x, vRectSize.y) * 0.02); gMaxOutlinePotential = gRadius + gPotentialRange; gMinOutlinePotential = gRadius - gPotentialRange; @@ -142,7 +143,7 @@ lowp vec4 convertBorderlineColor(lowp vec4 textureColor) borderlineOpacity = smoothstep(gMinInlinePotential, gMaxInlinePotential, potential); // Muliply borderlineWidth to resolve very thin borderline - borderlineOpacity *= min(1.0, borderlineWidth); + borderlineOpacity *= min(1.0, borderlineWidth / gPotentialRange); } lowp vec3 borderlineColorRGB = borderlineColor.rgb * uActorColor.rgb; diff --git a/dali-toolkit/internal/graphics/shaders/image-visual-shader.vert b/dali-toolkit/internal/graphics/shaders/image-visual-shader.vert index 7443aa1..ceedb74 100644 --- a/dali-toolkit/internal/graphics/shaders/image-visual-shader.vert +++ b/dali-toolkit/internal/graphics/shaders/image-visual-shader.vert @@ -44,9 +44,14 @@ vec4 ComputeVertexPosition() vOptRectSize = vRectSize; #endif +#ifdef IS_REQUIRED_BORDERLINE + // Extend size of visual by borderline. + mediump float outerBorderlineSize = (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth; +#endif + #ifdef IS_REQUIRED_ROUNDED_CORNER #ifdef IS_REQUIRED_BORDERLINE - mediump float minSize = min(visualSize.x, visualSize.y) + (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth; + mediump float minSize = min(visualSize.x, visualSize.y) + outerBorderlineSize; #else mediump float minSize = min(visualSize.x, visualSize.y); #endif @@ -58,8 +63,8 @@ vec4 ComputeVertexPosition() #endif #ifdef IS_REQUIRED_BORDERLINE - vPosition = aPosition * (visualSize + (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth); - vOptRectSize -= (1.0 - clamp(borderlineOffset, -1.0, 1.0)) * 0.5 * borderlineWidth + 1.0; + vPosition = aPosition * (visualSize + outerBorderlineSize); + vOptRectSize -= (borderlineWidth - outerBorderlineSize * 0.5) + 1.0; #elif defined(IS_REQUIRED_ROUNDED_CORNER) vPosition = aPosition * visualSize; #else @@ -74,9 +79,17 @@ vec4 ComputeVertexPosition() pixelArea.zw * maskTextureRatio ), cropToMask); - vMaskTexCoord = pixelArea.xy + pixelArea.zw * (vPosition.xy / max(vec2(1.0), visualSize) + vec2(0.5)); + vMaskTexCoord = pixelArea.xy + pixelArea.zw * (vec2(0.5) + aPosition.xy +#ifdef IS_REQUIRED_BORDERLINE + * (1.0 + outerBorderlineSize / visualSize) +#endif + ); +#endif + vTexCoord = finalPixelArea.xy + finalPixelArea.zw * (vec2(0.5) + aPosition.xy +#ifdef IS_REQUIRED_BORDERLINE + * (1.0 + outerBorderlineSize / visualSize) #endif - vTexCoord = finalPixelArea.xy + finalPixelArea.zw * (vPosition.xy / max(vec2(1.0), visualSize) + vec2(0.5)); + ); return vec4(vPosition + anchorPoint * visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0); } diff --git a/dali-toolkit/internal/text/text-geometry.cpp b/dali-toolkit/internal/text/text-geometry.cpp index 6c90665..6f173cb 100644 --- a/dali-toolkit/internal/text/text-geometry.cpp +++ b/dali-toolkit/internal/text/text-geometry.cpp @@ -68,14 +68,29 @@ void GetTextGeometry(ModelPtr textModel, CharacterIndex startIndex, CharacterInd const CharacterIndex* const glyphToCharacterBuffer = visualModel->mGlyphsToCharacters.Begin(); const CharacterDirection* const modelCharacterDirectionsBuffer = (0u != logicalModel->mCharacterDirections.Count()) ? logicalModel->mCharacterDirections.Begin() : NULL; + //Clear the lists + sizesList.Clear(); + positionsList.Clear(); + + if(charactersToGlyphBuffer == nullptr || glyphsPerCharacterBuffer == nullptr || charactersPerGlyphBuffer == nullptr || glyphToCharacterBuffer == nullptr ) + { + return; + } + if(startIndex >= logicalModel->mText.Count() && endIndex >= logicalModel->mText.Count()) + { return; + } if(startIndex >= logicalModel->mText.Count()) + { startIndex = logicalModel->mText.Count() - 1; + } if(endIndex >= logicalModel->mText.Count()) + { endIndex = logicalModel->mText.Count() - 1; + } if(startIndex > endIndex) { diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index 5e08bba..a3bdd3c 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -29,7 +29,7 @@ namespace Toolkit { const unsigned int TOOLKIT_MAJOR_VERSION = 2; const unsigned int TOOLKIT_MINOR_VERSION = 1; -const unsigned int TOOLKIT_MICRO_VERSION = 36; +const unsigned int TOOLKIT_MICRO_VERSION = 37; const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 064a36e..93d710d 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali2-toolkit Summary: Dali 3D engine Toolkit -Version: 2.1.36 +Version: 2.1.37 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT