X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-TextEditor.cpp;h=c3a08ed5ba116f6f870bdcc1c661fd2cbdbf681c;hp=9db4289d04677e30cac9db8759abcab6dab805b8;hb=cd5b6f3ff9138207df66d93e95a750fa9f56c70b;hpb=11ac31ab089b6b0d6cb8b06381724ac8c0ce126e diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp index 9db4289..c3a08ed 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -691,6 +691,14 @@ int UtcDaliTextEditorSetPropertyP(void) editor.SetProperty(TextEditor::Property::HORIZONTAL_ALIGNMENT, "END"); DALI_TEST_EQUALS(editor.GetProperty(TextEditor::Property::HORIZONTAL_ALIGNMENT), "END", TEST_LOCATION); + // Check that the Alignment properties can be correctly set + editor.SetProperty(DevelTextEditor::Property::VERTICAL_ALIGNMENT, "BOTTOM"); + DALI_TEST_EQUALS(editor.GetProperty(DevelTextEditor::Property::VERTICAL_ALIGNMENT), "BOTTOM", TEST_LOCATION); + editor.SetProperty(DevelTextEditor::Property::VERTICAL_ALIGNMENT, "CENTER"); + DALI_TEST_EQUALS(editor.GetProperty(DevelTextEditor::Property::VERTICAL_ALIGNMENT), "CENTER", TEST_LOCATION); + editor.SetProperty(DevelTextEditor::Property::VERTICAL_ALIGNMENT, "TOP"); + DALI_TEST_EQUALS(editor.GetProperty(DevelTextEditor::Property::VERTICAL_ALIGNMENT), "TOP", TEST_LOCATION); + // Check scroll properties. editor.SetProperty(TextEditor::Property::SCROLL_THRESHOLD, 1.f); DALI_TEST_EQUALS(editor.GetProperty(TextEditor::Property::SCROLL_THRESHOLD), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION); @@ -4852,7 +4860,7 @@ int utcDaliTextEditorGeometryEllipsisEnd(void) expectedSizes.PushBack(Vector2(59, 25)); expectedPositions.PushBack(Vector2(-1, 25)); - expectedSizes.PushBack(Vector2(25, 25)); + expectedSizes.PushBack(Vector2(38, 25)); TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes); @@ -4958,6 +4966,51 @@ int utcDaliTextEditorGeometryGlyphMiddle(void) END_TEST; } +int utcDaliTextEditorGeometryOneGlyph(void) +{ + ToolkitTestApplication application; + tet_infoline(" utcDaliTextEditorGeometryOneGlyph "); + + TextEditor label = TextEditor::New(); + DALI_TEST_CHECK(label); + + application.GetScene().Add(label); + + label.SetProperty(TextEditor::Property::POINT_SIZE, 7.f); + label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 200.f)); + label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + label.SetProperty(TextEditor::Property::ENABLE_MARKUP, true); + label.SetProperty(TextEditor::Property::TEXT, "H"); + + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); + + // Render and notify + application.SendNotification(); + application.Render(); + + unsigned int expectedCount = 1; + unsigned int startIndex = 0; + unsigned int endIndex = 0; + + Vector positionsList = DevelTextEditor::GetTextPosition(label, startIndex, endIndex); + Vector sizeList = DevelTextEditor::GetTextSize(label, startIndex, endIndex); + + DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION); + DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION); + + Vector expectedSizes; + Vector expectedPositions; + + expectedPositions.PushBack(Vector2(-2, 0)); + expectedSizes.PushBack(Vector2(16, 25)); + + TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes); + + END_TEST; +} + int utcDaliTextEditorSelectionClearedSignal(void) { ToolkitTestApplication application; @@ -5832,7 +5885,7 @@ int UtcDaliToolkitTextEditorMarkupRelativeLineHeight(void) //no effect of relative line size for paragraph with single line DALI_TEST_EQUALS(naturalSize.y, relativeSingleNaturalSize.y, Math::MACHINE_EPSILON_1000, TEST_LOCATION); - DALI_TEST_EQUALS(lineSize*8.5f, relativeMultiNaturalSize.y, Math::MACHINE_EPSILON_1000, TEST_LOCATION); + DALI_TEST_EQUALS(lineSize * 8.5f, relativeMultiNaturalSize.y, Math::MACHINE_EPSILON_1000, TEST_LOCATION); END_TEST; }