this will fix the selection highlighting height & grape handles position.
Editor.SetProperty(TextEditor::Property::TEXT, "A<font size=40>B</font>\nCD");
Editor.SetProperty(TextEditor::Property::LINE_SPACING, -20);
Change-Id: I08dad34722584ff7d3815cd4f8a7b577be6d81cf
END_TEST;
}
+int UtcDaliTextEditorSelectionWithLineSpacing(void)
+{
+ //Only for test coverage
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorSelectionWithLineSpacing ");
+
+ TextEditor textEditor = TextEditor::New();
+ textEditor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.f));
+ application.GetScene().Add(textEditor);
+ application.SendNotification();
+ application.Render();
+
+ textEditor.SetProperty(TextEditor::Property::TEXT, "Line #1\nLine #2\nLine #3");
+ textEditor.SetProperty(DevelTextEditor::Property::LINE_SPACING, -20);
+
+ application.SendNotification();
+ application.Render();
+
+ DevelTextEditor::SelectWholeText(textEditor);
+
+ application.SendNotification();
+ application.Render();
+
+ DevelTextEditor::SelectNone(textEditor);
+ textEditor.SetProperty(DevelTextEditor::Property::LINE_SPACING, 20);
+
+ application.SendNotification();
+ application.Render();
+
+ DevelTextEditor::SelectWholeText(textEditor);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(textEditor.GetProperty<float>(DevelTextEditor::Property::LINE_SPACING), 20.0f, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliTextEditorMinLineSize(void)
{
ToolkitTestApplication application;
cursorInfo.lineOffset = CalculateLineOffset(parameters.visualModel->mLines,
newLineIndex);
- cursorInfo.lineHeight = GetLineHeight(newLine);
+ // The line height is the addition of the line ascender and the line descender.
+ // However, the line descender has a negative value, hence the subtraction also line spacing should not be included in cursor height.
+ cursorInfo.lineHeight = newLine.ascender - newLine.descender;
index = 0u;
const Length totalNumberOfCharacters = parameters.logicalModel->mText.Count();
cursorInfo.lineOffset = CalculateLineOffset(parameters.visualModel->mLines,
lineIndex);
- cursorInfo.lineHeight = GetLineHeight(line);
+ // The line height is the addition of the line ascender and the line descender.
+ // However, the line descender has a negative value, hence the subtraction also line spacing should not be included in cursor height.
+ cursorInfo.lineHeight = line.ascender - line.descender;
// Calculate the primary cursor.
lineRun += firstLineIndex;
- selectionBoxInfo->lineHeight = GetLineHeight(*lineRun);
+ // The line height is the addition of the line ascender and the line descender.
+ // However, the line descender has a negative value, hence the subtraction also line spacing should not be included in selection height.
+ selectionBoxInfo->lineHeight = lineRun->ascender - lineRun->descender;
GlyphIndex lastGlyphOfLine = lineRun->glyphRun.glyphIndex + lineRun->glyphRun.numberOfGlyphs - 1u;
++lineIndex;
if(lineIndex < firstLineIndex + numberOfLines)
{
+ float currentLineSpacing = lineRun->lineSpacing;
+
// Retrieve the next line.
++lineRun;
// Update the line's vertical offset.
selectionBoxInfo->lineOffset = currentLineOffset + currentLineHeight;
- selectionBoxInfo->lineHeight = GetLineHeight(*lineRun);
+ if(currentLineSpacing < 0)
+ {
+ selectionBoxInfo->lineOffset += currentLineSpacing;
+ }
+
+ // The line height is the addition of the line ascender and the line descender.
+ // However, the line descender has a negative value, hence the subtraction also line spacing should not be included in selection height.
+ selectionBoxInfo->lineHeight = lineRun->ascender - lineRun->descender;
+
+ if(lineRun->lineSpacing > 0)
+ {
+ selectionBoxInfo->lineHeight += lineRun->lineSpacing;
+ }
}
}
}