Merge changes I89471ca9,I866ffdec into devel/master
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TextEditor.cpp
index fac21a0..17d7d30 100644 (file)
@@ -6396,3 +6396,37 @@ int utcDaliTextEditorPanGesturePropagation(void)
 
   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