[Tizen] Fix multiline text size issue in label 11/288611/1 accepted/tizen/7.0/unified/20230223.015618
authorBowon Ryu <bowon.ryu@samsung.com>
Mon, 20 Feb 2023 06:38:25 +0000 (15:38 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Mon, 20 Feb 2023 09:35:49 +0000 (18:35 +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/controller/text-controller-relayouter.cpp

index 00426ee868a3aca9b39a870e55f83dd2b38c908e..a8ec273be5dacad302854f3e79fa2bfb95669264 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 fec850ec2114dc75eb6a5526ff8fc182e9cca170..c956187d40f0fb2887f0d550ae415d22264f0352 100644 (file)
@@ -99,6 +99,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.