X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-TextEditor.cpp;h=06ef3fbdc38736a0c17d398ceed464f8b2690c12;hb=85cc4dec9417a45d031bc8bc968e82df3339159e;hp=537207c01e796ab82d9319267a7685817a226400;hpb=7946b5a1a7188e31803ac8de5c4a8ea3cbc560cc;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 537207c..06ef3fb 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -4516,6 +4516,45 @@ int UtcDaliTextEditorLineSpacing(void) END_TEST; } +int UtcDaliTextEditorSelectionWithLineSpacing(void) +{ + //Only for test coverage + ToolkitTestApplication application; + tet_infoline(" UtcDaliTextEditorSelectionWithLineSpacing "); + + TextEditor textEditor = TextEditor::New(); + textEditor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.f)); + application.GetScene().Add(textEditor); + application.SendNotification(); + application.Render(); + + textEditor.SetProperty(TextEditor::Property::TEXT, "Line #1\nLine #2\nLine #3"); + textEditor.SetProperty(DevelTextEditor::Property::LINE_SPACING, -20); + + application.SendNotification(); + application.Render(); + + DevelTextEditor::SelectWholeText(textEditor); + + application.SendNotification(); + application.Render(); + + DevelTextEditor::SelectNone(textEditor); + textEditor.SetProperty(DevelTextEditor::Property::LINE_SPACING, 20); + + application.SendNotification(); + application.Render(); + + DevelTextEditor::SelectWholeText(textEditor); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::LINE_SPACING), 20.0f, TEST_LOCATION); + + END_TEST; +} + int UtcDaliTextEditorMinLineSize(void) { ToolkitTestApplication application; @@ -5726,6 +5765,42 @@ int UtcDaliToolkitTextEditorUnderlineTypesGeneration3(void) END_TEST; } +int UtcDaliToolkitTextEditorRelativeLineHeight(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolkitTextEditorRelativeLineHeight"); + + TextEditor editor = TextEditor::New(); + editor.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 300.f)); + editor.SetProperty(TextEditor::Property::POINT_SIZE, 10); + editor.SetProperty(TextEditor::Property::TEXT, "Hello\nWorld"); + + application.GetScene().Add(editor); + application.SendNotification(); + application.Render(); + + Vector3 naturalSize = editor.GetNaturalSize(); + + editor.SetProperty(DevelTextEditor::Property::RELATIVE_LINE_SIZE, 0.5f); + + application.SendNotification(); + application.Render(); + + Vector3 relativeNaturalSize = editor.GetNaturalSize(); + + DALI_TEST_EQUALS(naturalSize.y, relativeNaturalSize.y * 2, TEST_LOCATION); + + editor.SetProperty(DevelTextEditor::Property::RELATIVE_LINE_SIZE, 2.0f); + + application.SendNotification(); + application.Render(); + + relativeNaturalSize = editor.GetNaturalSize(); + + DALI_TEST_EQUALS(naturalSize.y * 2, relativeNaturalSize.y, TEST_LOCATION); + END_TEST; +} + int UtcDaliTextEditorCharacterSpacing(void) { ToolkitTestApplication application; @@ -5749,6 +5824,39 @@ int UtcDaliTextEditorCharacterSpacing(void) END_TEST; } +int UtcDaliTextEditorTextSizeNegativeLineSpacing(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliTextEditorTextSizeNegativeLineSpacing"); + + TextEditor editor = TextEditor::New(); + + float lineSpacing = -20.f; + + editor.SetProperty(Actor::Property::SIZE, Vector2(450.0f, 300.f)); + editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f); + editor.SetProperty(DevelTextEditor::Property::LINE_SPACING, lineSpacing); + editor.SetProperty(TextEditor::Property::TEXT, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."); + + application.GetScene().Add(editor); + application.SendNotification(); + application.Render(); + + Vector positionsList = DevelTextEditor::GetTextPosition(editor, 0, 123); + Vector sizeList = DevelTextEditor::GetTextSize(editor, 0, 123); + + Vector2 lastLinePos = positionsList[positionsList.Size() - 1]; + Vector2 lastLineSize = sizeList[sizeList.Size() - 1]; + + DALI_TEST_EQUALS(sizeList[0].y * (sizeList.Size() - 1), lastLinePos.y, Math::MACHINE_EPSILON_1000, TEST_LOCATION); + DALI_TEST_EQUALS(sizeList[0].y - lineSpacing, lastLineSize.y, Math::MACHINE_EPSILON_1000, TEST_LOCATION); + + application.SendNotification(); + application.Render(); + + END_TEST; +} + int UtcDaliToolkitTexteditorParagraphTag(void) { ToolkitTestApplication application;