X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-TextEditor.cpp;h=557be57d03e7365f7376d59047900f8d04243b2a;hb=1a97610fdd1db086680bf33ef0b7b138cd2a9f96;hp=b95f6c75d2626c626c40b54dc308f5da98f91c2e;hpb=1c6aa75cb7b66fdab6bff180c19066204171ef1e;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 b95f6c7..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); @@ -5124,6 +5124,44 @@ int utcDaliTextEditorGeometryOneGlyph(void) END_TEST; } +int utcDaliTextEditorGeometryNullPtr(void) +{ + ToolkitTestApplication application; + tet_infoline("utcDaliTextEditorGeometryNullPtr"); + + 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(200.f, 200.f)); + editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true); + editor.SetProperty(TextEditor::Property::TEXT, ""); + + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); + + unsigned int expectedCount = 0; + unsigned int startIndex = 0; + unsigned int endIndex = 0; + + Vector positionsList = DevelTextEditor::GetTextPosition(editor, startIndex, endIndex); + Vector sizeList = DevelTextEditor::GetTextSize(editor, startIndex, endIndex); + + // Render and notify + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION); + DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION); + + END_TEST; +} + + int utcDaliTextEditorSelectionClearedSignal(void) { ToolkitTestApplication application; @@ -6358,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