From: Bowon Ryu Date: Thu, 28 Apr 2022 08:51:47 +0000 (+0000) Subject: Merge "Add ECORE_IMF_CALLBACK_SELECTION_SET to IMFContext" into devel/master X-Git-Tag: dali_2.1.20~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=7027b808143d4f086636c21597336d37678ccb2b;hp=b33878720fce34aaa873feea5d4b83290b2db9b5 Merge "Add ECORE_IMF_CALLBACK_SELECTION_SET to IMFContext" into devel/master --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp b/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp index d0bb94b..05ae1c4 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp @@ -2307,4 +2307,47 @@ int UtcDaliKeyboardFocusManagerWithHide(void) END_TEST; +} + +int UtcDaliKeyboardFocusManagerWithVisible(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliKeyboardFocusManagerWithVisible"); + + KeyboardFocusManager manager = KeyboardFocusManager::Get(); + DALI_TEST_CHECK(manager); + + // Create the first actor and add it to the stage + Actor first = Actor::New(); + first.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true); + application.GetScene().Add(first); + + // Create the second actor and add it to the first actor. + Actor second = Actor::New(); + second.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true); + first.Add(second); + + // Check that no actor is being focused yet. + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); + + // Check that the focus is set on the first actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + + // Set visible false. + first.SetProperty(Actor::Property::VISIBLE, false); + + // Check that it will fail to set focus on the second actor as it's not focusable + DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == false); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); + + // Set visible true. + first.SetProperty(Actor::Property::VISIBLE, true); + + // Check that the focus is set on the second actor + DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true); + DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); + + END_TEST; } \ No newline at end of file diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp index 476da78..c3a08ed 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -4860,7 +4860,7 @@ int utcDaliTextEditorGeometryEllipsisEnd(void) expectedSizes.PushBack(Vector2(59, 25)); expectedPositions.PushBack(Vector2(-1, 25)); - expectedSizes.PushBack(Vector2(25, 25)); + expectedSizes.PushBack(Vector2(38, 25)); TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes); @@ -4966,6 +4966,51 @@ int utcDaliTextEditorGeometryGlyphMiddle(void) END_TEST; } +int utcDaliTextEditorGeometryOneGlyph(void) +{ + ToolkitTestApplication application; + tet_infoline(" utcDaliTextEditorGeometryOneGlyph "); + + TextEditor label = TextEditor::New(); + DALI_TEST_CHECK(label); + + application.GetScene().Add(label); + + label.SetProperty(TextEditor::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(TextEditor::Property::ENABLE_MARKUP, true); + label.SetProperty(TextEditor::Property::TEXT, "H"); + + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); + + // Render and notify + application.SendNotification(); + application.Render(); + + unsigned int expectedCount = 1; + unsigned int startIndex = 0; + unsigned int endIndex = 0; + + Vector positionsList = DevelTextEditor::GetTextPosition(label, startIndex, endIndex); + Vector sizeList = DevelTextEditor::GetTextSize(label, startIndex, endIndex); + + DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION); + DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION); + + Vector expectedSizes; + Vector expectedPositions; + + expectedPositions.PushBack(Vector2(-2, 0)); + expectedSizes.PushBack(Vector2(16, 25)); + + TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes); + + END_TEST; +} + int utcDaliTextEditorSelectionClearedSignal(void) { ToolkitTestApplication application; @@ -5840,7 +5885,7 @@ int UtcDaliToolkitTextEditorMarkupRelativeLineHeight(void) //no effect of relative line size for paragraph with single line DALI_TEST_EQUALS(naturalSize.y, relativeSingleNaturalSize.y, Math::MACHINE_EPSILON_1000, TEST_LOCATION); - DALI_TEST_EQUALS(lineSize*8.5f, relativeMultiNaturalSize.y, Math::MACHINE_EPSILON_1000, TEST_LOCATION); + DALI_TEST_EQUALS(lineSize * 8.5f, relativeMultiNaturalSize.y, Math::MACHINE_EPSILON_1000, TEST_LOCATION); END_TEST; } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp index 30aaade..c810939 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp @@ -2525,8 +2525,53 @@ int utcDaliTextLabelGeometryGlyphMiddle(void) Vector expectedSizes; Vector expectedPositions; - expectedPositions.PushBack(Vector2(12, 0)); - expectedSizes.PushBack(Vector2(118, 25)); + expectedPositions.PushBack(Vector2(6, 0)); + expectedSizes.PushBack(Vector2(124, 25)); + + TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes); + + END_TEST; +} + +int utcDaliTextLabelGeometryOneGlyph(void) +{ + ToolkitTestApplication application; + tet_infoline(" utcDaliTextLabelGeometryOneGlyph "); + + 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, "H"); + + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); + + // Render and notify + application.SendNotification(); + application.Render(); + + unsigned int expectedCount = 1; + unsigned int startIndex = 0; + unsigned int endIndex = 0; + + Vector positionsList = DevelTextLabel::GetTextPosition(label, startIndex, endIndex); + Vector sizeList = DevelTextLabel::GetTextSize(label, startIndex, endIndex); + + DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION); + DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION); + + Vector expectedSizes; + Vector expectedPositions; + + expectedPositions.PushBack(Vector2(-2, 0)); + expectedSizes.PushBack(Vector2(16, 25)); TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes); @@ -2679,7 +2724,7 @@ int UtcDaliToolkitTextLabelMarkupRelativeLineHeight(void) //no effect of relative line size for paragraph with single line DALI_TEST_EQUALS(naturalSize.y, relativeSingleNaturalSize.y, Math::MACHINE_EPSILON_1000, TEST_LOCATION); - DALI_TEST_EQUALS(lineSize*8.5f, relativeMultiNaturalSize.y, Math::MACHINE_EPSILON_1000, TEST_LOCATION); + DALI_TEST_EQUALS(lineSize * 8.5f, relativeMultiNaturalSize.y, Math::MACHINE_EPSILON_1000, TEST_LOCATION); END_TEST; } diff --git a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp index a64690e..d0daa9f 100644 --- a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp +++ b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp @@ -205,53 +205,44 @@ bool KeyboardFocusManager::DoSetCurrentFocusActor(Actor actor) { bool success = false; - // If the parent's KEYBOARD_FOCUSABLE_CHILDREN is false, it cannot have focus. - if(actor) + // Check whether the actor is in the stage and is keyboard focusable. + if(actor && + actor.GetProperty(Actor::Property::KEYBOARD_FOCUSABLE) && + actor.GetProperty(DevelActor::Property::USER_INTERACTION_ENABLED) && + actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE) && + actor.GetProperty(Actor::Property::VISIBLE)) { + // If the parent's KEYBOARD_FOCUSABLE_CHILDREN is false or VISIBLE is false, it cannot have focus. Actor parent = actor.GetParent(); while(parent) { - if(!parent.GetProperty(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN)) + if(!parent.GetProperty(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) || !parent.GetProperty(Actor::Property::VISIBLE)) { - DALI_LOG_INFO(gLogFilter, Debug::General, "[%s:%d] Parent Actor has KEYBOARD_FOCUSABLE_CHILDREN false,\n", __FUNCTION__, __LINE__); + DALI_LOG_INFO(gLogFilter, Debug::General, "[%s:%d] Parent Actor has KEYBOARD_FOCUSABLE_CHILDREN false or VISIBLE false,\n", __FUNCTION__, __LINE__); return false; } parent = parent.GetParent(); } - } - if(actor && actor.GetProperty(Actor::Property::KEYBOARD_FOCUSABLE) && actor.GetProperty(DevelActor::Property::USER_INTERACTION_ENABLED) && actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE)) - { - Integration::SceneHolder currentWindow = Integration::SceneHolder::Get(actor); + // If developer set focus on same actor, doing nothing + Actor currentFocusedActor = GetCurrentFocusActor(); + if(actor == currentFocusedActor) + { + return true; + } + Integration::SceneHolder currentWindow = Integration::SceneHolder::Get(actor); if(currentWindow.GetRootLayer() != mCurrentFocusedWindow.GetHandle()) { Layer rootLayer = currentWindow.GetRootLayer(); mCurrentFocusedWindow = rootLayer; } - } - - Actor currentFocusedActor = GetCurrentFocusActor(); - - // If developer set focus on same actor, doing nothing - if(actor == currentFocusedActor) - { - if(!actor) - { - return false; - } - return true; - } - // Check whether the actor is in the stage and is keyboard focusable. - if(actor && actor.GetProperty(Actor::Property::KEYBOARD_FOCUSABLE) && actor.GetProperty(DevelActor::Property::USER_INTERACTION_ENABLED) && actor.GetProperty(Actor::Property::CONNECTED_TO_SCENE)) - { if((mIsFocusIndicatorShown == SHOW) && (mEnableFocusIndicator == ENABLE)) { actor.Add(GetFocusIndicatorActor()); } - Toolkit::Control currentlyFocusedControl = Toolkit::Control::DownCast(currentFocusedActor); if(currentlyFocusedControl) { diff --git a/dali-toolkit/internal/text/text-controller-background-actor.cpp b/dali-toolkit/internal/text/text-controller-background-actor.cpp index 7def7e8..bc7c79b 100644 --- a/dali-toolkit/internal/text/text-controller-background-actor.cpp +++ b/dali-toolkit/internal/text/text-controller-background-actor.cpp @@ -112,7 +112,6 @@ Actor CreateControllerBackgroundActor(const View& textView, const VisualModelPtr Length yLineOffset = 0; Length prevLineIndex = 0; LineIndex lineIndex; - Length numberOfLines; for(uint32_t i = 0, glyphSize = glyphs.Size(); i < glyphSize; ++i) { @@ -125,7 +124,7 @@ Actor CreateControllerBackgroundActor(const View& textView, const VisualModelPtr const bool isDefaultBackgroundColor = (0u == backgroundColorIndex); const Vector4& backgroundColor = isDefaultBackgroundColor ? defaultBackgroundColor : *(backgroundColorsBuffer + backgroundColorIndex - 1u); - textVisualModel->GetNumberOfLines(i, 1, lineIndex, numberOfLines); + lineIndex = textVisualModel->GetLineOfGlyph(i); Length lineHeight = CalculateBackgroundLineHeight(lineRun[lineIndex]); if(lineIndex != prevLineIndex) diff --git a/dali-toolkit/internal/text/text-geometry.cpp b/dali-toolkit/internal/text/text-geometry.cpp index bde5517..6c90665 100644 --- a/dali-toolkit/internal/text/text-geometry.cpp +++ b/dali-toolkit/internal/text/text-geometry.cpp @@ -160,7 +160,7 @@ void GetTextGeometry(ModelPtr textModel, CharacterIndex startIndex, CharacterInd } else { - if((ellipsisPosition == DevelText::EllipsisPosition::END) && (index >= endIndexOfGlyphs)) + if((ellipsisPosition == DevelText::EllipsisPosition::END) && (index > endIndexOfGlyphs)) { //skip remaining elided glyphs break; diff --git a/dali-toolkit/internal/text/text-view.cpp b/dali-toolkit/internal/text/text-view.cpp index 697dc04..9c067de 100644 --- a/dali-toolkit/internal/text/text-view.cpp +++ b/dali-toolkit/internal/text/text-view.cpp @@ -114,7 +114,6 @@ Length View::GetGlyphs(GlyphInfo* glyphs, float calculatedAdvance = 0.f; const Character* textBuffer = mImpl->mLogicalModel->mText.Begin(); - if(mImpl->mVisualModel) { // Get the character-spacing runs. @@ -125,7 +124,7 @@ Length View::GetGlyphs(GlyphInfo* glyphs, //Reset indices of ElidedGlyphs mImpl->mVisualModel->SetStartIndexOfElidedGlyphs(0u); - mImpl->mVisualModel->SetEndIndexOfElidedGlyphs(numberOfGlyphs); + mImpl->mVisualModel->SetEndIndexOfElidedGlyphs(numberOfGlyphs - 1u); // Initialization is the last index of Glyphs mImpl->mVisualModel->SetFirstMiddleIndexOfElidedGlyphs(0u); mImpl->mVisualModel->SetSecondMiddleIndexOfElidedGlyphs(0u); diff --git a/dali-toolkit/internal/text/visual-model-impl.cpp b/dali-toolkit/internal/text/visual-model-impl.cpp index 5ef2b50..490bae3 100644 --- a/dali-toolkit/internal/text/visual-model-impl.cpp +++ b/dali-toolkit/internal/text/visual-model-impl.cpp @@ -254,6 +254,12 @@ void VisualModel::GetNumberOfLines(GlyphIndex glyphIndex, } } +LineIndex VisualModel::GetLineOfGlyph( GlyphIndex glyphIndex ) +{ + const CharacterIndex characterIndex = *(mGlyphsToCharacters.Begin() + glyphIndex); + return GetLineOfCharacter(characterIndex); +} + void VisualModel::GetLinesOfGlyphRange(LineRun* lines, GlyphIndex glyphIndex, Length numberOfGlyphs) const diff --git a/dali-toolkit/internal/text/visual-model-impl.h b/dali-toolkit/internal/text/visual-model-impl.h index 9c0af3a..eebbe18 100644 --- a/dali-toolkit/internal/text/visual-model-impl.h +++ b/dali-toolkit/internal/text/visual-model-impl.h @@ -144,6 +144,15 @@ public: Length& numberOfLines) const; /** + * @brief Retrieves the line index where the glyph is laid-out. + * + * @param[in] glyphIndex The glyph's index. + * + * @return The line index. + */ + LineIndex GetLineOfGlyph(GlyphIndex glyphIndex); + + /** * @brief Retrieves the lines where the given range of glyphs is laid out. * * The size of the @p lines buffer needs to be big enough to copy the @p numberOfLines.