X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-TextEditor.cpp;h=557be57d03e7365f7376d59047900f8d04243b2a;hb=3c3eb69051c03ed8d04db1294f8839da7469b536;hp=fac21a0dc59a87f342ec888d228566eeea6244d6;hpb=887acc93b8ad0c9ef2f5039ae79efd672cfe315a;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp index fac21a0..557be57 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -4867,11 +4867,11 @@ int utcDaliTextEditorGeometryEllipsisStart(void) Vector expectedSizes; Vector expectedPositions; - expectedPositions.PushBack(Vector2(37, 0)); - expectedSizes.PushBack(Vector2(20, 25)); + expectedPositions.PushBack(Vector2(38, 0)); + expectedSizes.PushBack(Vector2(21, 25)); expectedPositions.PushBack(Vector2(-1, 25)); - expectedSizes.PushBack(Vector2(52, 25)); + expectedSizes.PushBack(Vector2(53, 25)); TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes); @@ -4919,10 +4919,10 @@ int utcDaliTextEditorGeometryEllipsisMiddle(void) Vector expectedPositions; expectedPositions.PushBack(Vector2(-1, 0)); - expectedSizes.PushBack(Vector2(25, 25)); + expectedSizes.PushBack(Vector2(26, 25)); expectedPositions.PushBack(Vector2(-1, 25)); - expectedSizes.PushBack(Vector2(52, 25)); + expectedSizes.PushBack(Vector2(53, 25)); TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes); @@ -4970,10 +4970,10 @@ int utcDaliTextEditorGeometryEllipsisEnd(void) Vector expectedPositions; expectedPositions.PushBack(Vector2(-1, 0)); - expectedSizes.PushBack(Vector2(59, 25)); + expectedSizes.PushBack(Vector2(60, 25)); expectedPositions.PushBack(Vector2(-1, 25)); - expectedSizes.PushBack(Vector2(38, 25)); + expectedSizes.PushBack(Vector2(39, 25)); TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes); @@ -5017,16 +5017,16 @@ int utcDaliTextEditorGeometryRTL(void) Vector expectedSizes; Vector expectedPositions; - expectedPositions.PushBack(Vector2(24, 0)); - expectedSizes.PushBack(Vector2(33, 25)); + expectedPositions.PushBack(Vector2(25, 0)); + expectedSizes.PushBack(Vector2(34, 25)); expectedPositions.PushBack(Vector2(-1, 25)); - expectedSizes.PushBack(Vector2(52, 25)); + expectedSizes.PushBack(Vector2(53, 25)); expectedPositions.PushBack(Vector2(-1, 50)); - expectedSizes.PushBack(Vector2(59, 25)); + expectedSizes.PushBack(Vector2(60, 25)); - expectedPositions.PushBack(Vector2(61, 75)); + expectedPositions.PushBack(Vector2(63, 75)); expectedSizes.PushBack(Vector2(37, 25)); TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes); @@ -5072,7 +5072,7 @@ int utcDaliTextEditorGeometryGlyphMiddle(void) Vector expectedPositions; expectedPositions.PushBack(Vector2(6, 0)); - expectedSizes.PushBack(Vector2(124, 25)); + expectedSizes.PushBack(Vector2(125, 25)); TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes); @@ -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