[Tizen] Fix multiline text size issue in label 86/288686/1
authorBowon Ryu <bowon.ryu@samsung.com>
Mon, 20 Feb 2023 06:38:25 +0000 (15:38 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Tue, 21 Feb 2023 07:16:43 +0000 (16:16 +0900)
When font validation in the relayout process, if text update info is initialized,
font data should be cleared before UpdateModel() to ensure the number of characters removed and added.
Without this condition, incorrect text updates will occur due to incorrect number of characters.

Change-Id: Ic0a56dc355b746b2e718aa87ae61c507ade427b5
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp
dali-toolkit/internal/text/text-controller-relayouter.cpp

index 6072c97..7d01f07 100755 (executable)
@@ -863,6 +863,19 @@ int UtcDaliTextControllerCheckBufferIndices(void)
   // Perform a relayout
   controller->Relayout(size);
 
+  // Set the text
+  controller->SetText(text);
+
+  // Set the text size
+  controller->SetDefaultFontSize(10.f, Controller::POINT_SIZE);
+
+  // Tweak some parameters to make the indices to access the text buffer invalid
+  mImpl.mTextUpdateInfo.Clear();
+
+  // Perform a relayout
+  controller->GetHeightForWidth(size.width / 2.f);
+  controller->Relayout(size);
+
   tet_result(TET_PASS);
 
   END_TEST;
index a88d648..0fabadf 100644 (file)
@@ -94,6 +94,13 @@ Size Controller::Relayouter::CalculateLayoutSizeOnRequiredControllerSize(Control
 
   if(!isEditable)
   {
+    if(NO_OPERATION != (VALIDATE_FONTS & operationsPending) &&
+       textUpdateInfo.mCharacterIndex == static_cast<CharacterIndex>(-1))
+    {
+      impl.ClearFontData();
+      updateInfoCharIndexBackup = textUpdateInfo.mCharacterIndex;
+    }
+
     impl.UpdateModel(onlyOnceOperations);
 
     // Layout the text for the new width.