API was already implemented, this patch adds it n Text Label, Field and Editor.
To be able to add it on NUI too.
Change-Id: I98120cc70c805a2bb1fee7abaf6625cc3ec42d65
END_TEST;
}
+
+int utcDaliTextEditorGetTextBoundingRectangle(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorGeometryEllipsisMiddle");
+
+ 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(100.f, 50.f));
+ editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ editor.SetProperty(TextEditor::Property::TEXT, "Hello this is the Text Bounding Rectangle TC");
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ unsigned int startIndex = 0;
+ unsigned int endIndex = 15;
+
+ Rect<> textBoundingRectangle = DevelTextEditor::GetTextBoundingRectangle(editor, startIndex, endIndex);
+ Rect<> expectedTextBoundingRectangle = {0, 0, 100, 50};
+
+ TestTextGeometryUtils::CheckRectGeometryResult(textBoundingRectangle, expectedTextBoundingRectangle);
+
+ END_TEST;
+}
\ No newline at end of file
END_TEST;
}
+
+int utcDaliTextFieldGetTextBoundingRectangle(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldGeometryEllipsisMiddle");
+
+ 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(100.f, 50.f));
+ field.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ field.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ field.SetProperty(TextField::Property::TEXT, "Hello this is the Text Bounding Rectangle TC");
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ unsigned int startIndex = 0;
+ unsigned int endIndex = 15;
+
+ Rect<> textBoundingRectangle = DevelTextField::GetTextBoundingRectangle(field, startIndex, endIndex);
+ Rect<> expectedTextBoundingRectangle = {0, 0, 100, 25};
+
+ TestTextGeometryUtils::CheckRectGeometryResult(textBoundingRectangle, expectedTextBoundingRectangle);
+
+ END_TEST;
+}
\ No newline at end of file
application.Render();
END_TEST;
+}
+
+int utcDaliTextLabelGetTextBoundingRectangle(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextLabelGeometryEllipsisMiddle");
+
+ 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(100.f, 50.f));
+ label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ label.SetProperty(TextLabel::Property::TEXT, "Hello this is the Text Bounding Rectangle TC");
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ unsigned int startIndex = 0;
+ unsigned int endIndex = 15;
+
+ Rect<> textBoundingRectangle = DevelTextLabel::GetTextBoundingRectangle(label, startIndex, endIndex);
+ Rect<> expectedTextBoundingRectangle = {0, 0, 100, 25};
+
+ TestTextGeometryUtils::CheckRectGeometryResult(textBoundingRectangle, expectedTextBoundingRectangle);
+
+ END_TEST;
}
\ No newline at end of file
return GetImpl(textEditor).GetTextPosition(startIndex, endIndex);
}
+Rect<> GetTextBoundingRectangle(TextEditor textEditor, uint32_t startIndex, uint32_t endIndex)
+{
+ return GetImpl(textEditor).GetTextBoundingRectangle(startIndex, endIndex);
+}
+
string CopyText(TextEditor textEditor)
{
return GetImpl(textEditor).CopyText();
DALI_TOOLKIT_API Vector<Vector2> GetTextPosition(TextEditor textEditor, const uint32_t startIndex, const uint32_t endIndex);
/**
+ * @brief Gets the bounding box of a specific text range.
+ *
+ * @param[in] textEditor The instance of textEditor.
+ * @param[in] startIndex start index of the text requested to get bounding box to.
+ * @param[in] endIndex end index(included) of the text requested to get bounding box to.
+ * @return bounding box of the requested text.
+ */
+DALI_TOOLKIT_API Rect<> GetTextBoundingRectangle(TextEditor textEditor, uint32_t startIndex, uint32_t endIndex);
+
+/**
* @brief Copy and return the selected text of TextEditor.
*
* @param[in] textEditor The instance of TextEditor.
return GetImpl(textField).GetTextPosition(startIndex, endIndex);
}
+Rect<> GetTextBoundingRectangle(TextField textField, uint32_t startIndex, uint32_t endIndex)
+{
+ return GetImpl(textField).GetTextBoundingRectangle(startIndex, endIndex);
+}
+
string CopyText(TextField textField)
{
return GetImpl(textField).CopyText();
DALI_TOOLKIT_API Vector<Vector2> GetTextPosition(TextField textField, const uint32_t startIndex, const uint32_t endIndex);
/**
+ * @brief Gets the bounding box of a specific text range.
+ *
+ * @param[in] textField The instance of textField.
+ * @param[in] startIndex start index of the text requested to get bounding box to.
+ * @param[in] endIndex end index(included) of the text requested to get bounding box to.
+ * @return bounding box of the requested text.
+ */
+DALI_TOOLKIT_API Rect<> GetTextBoundingRectangle(TextField textField, uint32_t startIndex, uint32_t endIndex);
+
+/**
* @brief Select the whole text of TextField.
*
* @param[in] textField The instance of TextField.
return GetImpl(textLabel).GetTextPosition(startIndex, endIndex);
}
+Rect<> GetTextBoundingRectangle(TextLabel textLabel, uint32_t startIndex, uint32_t endIndex)
+{
+ return GetImpl(textLabel).GetTextBoundingRectangle(startIndex, endIndex);
+}
+
} // namespace DevelTextLabel
} // namespace Toolkit
DALI_TOOLKIT_API Vector<Vector2> GetTextPosition(TextLabel textLabel, const uint32_t startIndex, const uint32_t endIndex);
/**
+ * @brief Gets the bounding box of a specific text range.
+ *
+ * @param[in] textLabel The instance of TextLabel.
+ * @param[in] startIndex start index of the text requested to get bounding box to.
+ * @param[in] endIndex end index(included) of the text requested to get bounding box to.
+ * @return bounding box of the requested text.
+ */
+DALI_TOOLKIT_API Rect<> GetTextBoundingRectangle(TextLabel textLabel, uint32_t startIndex, uint32_t endIndex);
+
+/**
* @brief Anchor clicked signal type.
*
* @note Signal
return mController->GetCharacterIndexAtPosition(visualX, visualY);
}
+Rect<> TextEditor::GetTextBoundingRectangle(uint32_t startIndex, uint32_t endIndex) const
+{
+ return mController->GetTextBoundingRectangle(startIndex, endIndex);
+}
+
void TextEditor::SetSpannedText(const Text::Spanned& spannedText)
{
mController->SetSpannedText(spannedText);
int GetCharacterIndexAtPosition(float visualX, float visualY) const;
/**
+ * @brief Gets the bounding box of a specific text range.
+ *
+ * @param[in] startIndex start index of the text requested to get bounding box to.
+ * @param[in] endIndex end index(included) of the text requested to get bounding box to.
+ * @return bounding box of the requested text.
+ */
+ Rect<> GetTextBoundingRectangle(uint32_t startIndex, uint32_t endIndex) const;
+
+ /**
* @brief Set the @p spannedText into current textEditor
* the spanned text contains content (text) and format (spans with ranges)
* the text is copied into text-controller and the spans are applied on ranges
return mController->GetCharacterIndexAtPosition(visualX, visualY);
}
+Rect<> TextField::GetTextBoundingRectangle(uint32_t startIndex, uint32_t endIndex) const
+{
+ return mController->GetTextBoundingRectangle(startIndex, endIndex);
+}
+
void TextField::SetSpannedText(const Text::Spanned& spannedText)
{
mController->SetSpannedText(spannedText);
int GetCharacterIndexAtPosition(float visualX, float visualY) const;
/**
+ * @brief Gets the bounding box of a specific text range.
+ *
+ * @param[in] startIndex start index of the text requested to get bounding box to.
+ * @param[in] endIndex end index(included) of the text requested to get bounding box to.
+ * @return bounding box of the requested text.
+ */
+ Rect<> GetTextBoundingRectangle(uint32_t startIndex, uint32_t endIndex) const;
+
+ /**
* @brief Set the @p spannedText into current textField
* the spanned text contains content (text) and format (spans with ranges)
* the text is copied into text-controller and the spans are applied on ranges
return mController->GetCharacterIndexAtPosition(visualX, visualY);
}
+Rect<> TextLabel::GetTextBoundingRectangle(uint32_t startIndex, uint32_t endIndex) const
+{
+ return mController->GetTextBoundingRectangle(startIndex, endIndex);
+}
+
void TextLabel::SetSpannedText(const Text::Spanned& spannedText)
{
mController->SetSpannedText(spannedText);
int GetCharacterIndexAtPosition(float visualX, float visualY) const;
/**
+ * @brief Gets the bounding box of a specific text range.
+ *
+ * @param[in] startIndex start index of the text requested to get bounding box to.
+ * @param[in] endIndex end index(included) of the text requested to get bounding box to.
+ * @return bounding box of the requested text.
+ */
+ Rect<> GetTextBoundingRectangle(uint32_t startIndex, uint32_t endIndex) const;
+
+ /**
* @brief Set the @p spannedText into current textLabel
* the spanned text contains content (text) and format (spans with ranges)
* the text is copied into text-controller and the spans are applied on ranges