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=f8b2799d25ad8ce8717643aa7a010ab778ced7ba;hp=acf34a6453f304e7300063996d4a603de86eae2f;hb=a4a06c5a4c6c02861972d1ea9029c64d60bed192;hpb=960870f0f39490cf3679ab54b3f32c258bb4ab03 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp index acf34a6..f8b2799 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -1920,7 +1920,7 @@ int utcDaliTextEditorEvent02(void) application.SendNotification(); application.Render(); - Actor layer = editor.GetChildAt(1u); + Actor layer = editor.GetChildAt(2u); DALI_TEST_EQUALS(layer.GetChildCount(), 1u, TEST_LOCATION); // The cursor. DALI_TEST_EQUALS(stencil.GetChildCount(), 0u, TEST_LOCATION); @@ -1934,7 +1934,7 @@ int utcDaliTextEditorEvent02(void) // Checks the cursor and the renderer have been created. DALI_TEST_EQUALS(layer.GetChildCount(), 1u, TEST_LOCATION); // The cursor. - DALI_TEST_EQUALS(stencil.GetChildCount(), 1u, TEST_LOCATION); // The renderer + DALI_TEST_EQUALS(stencil.GetChildCount(), 2u, TEST_LOCATION); // The renderer, clipped cursor Control cursor = Control::DownCast(layer.GetChildAt(0u)); DALI_TEST_CHECK(cursor); @@ -2011,8 +2011,8 @@ int utcDaliTextEditorEvent02(void) DALI_TEST_EQUALS(position2, position6, TEST_LOCATION); // Should be in the same position2. - // Should not be a renderer. - DALI_TEST_EQUALS(stencil.GetChildCount(), 0u, TEST_LOCATION); + // Should not be a renderer, there is only a clipped cursor. + DALI_TEST_EQUALS(stencil.GetChildCount(), 1u, TEST_LOCATION); END_TEST; } @@ -2830,7 +2830,7 @@ int utcDaliTextEditorHandles(void) Actor activeLayer = editor.GetChildAt(1u); // Get the handle's actor. - Actor handle = activeLayer.GetChildAt(1u); + Actor handle = activeLayer.GetChildAt(0u); handle.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f)); // Render and notify @@ -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; @@ -5748,3 +5823,42 @@ int UtcDaliTextEditorCharacterSpacing(void) END_TEST; } + +int UtcDaliToolkitTexteditorParagraphTag(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolkitTexteditorParagraphTag"); + TextEditor editorNewlineSeparator = TextEditor::New(); + TextEditor editorParagraphTag = TextEditor::New(); + DALI_TEST_CHECK(editorNewlineSeparator); + DALI_TEST_CHECK(editorParagraphTag); + + application.GetScene().Add(editorNewlineSeparator); + application.GetScene().Add(editorParagraphTag); + + //Same utterance uses new-line to split paragraphs should give similar results for paragraph tag. + editorNewlineSeparator.SetProperty(TextEditor::Property::ENABLE_MARKUP, true); + editorNewlineSeparator.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f)); + editorNewlineSeparator.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + editorNewlineSeparator.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + editorNewlineSeparator.SetProperty(TextEditor::Property::TEXT, "test paragraph tag \ntest paragraph tag \ntest paragraph tag "); + + editorParagraphTag.SetProperty(TextEditor::Property::ENABLE_MARKUP, true); + editorParagraphTag.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f)); + editorParagraphTag.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + editorParagraphTag.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + editorParagraphTag.SetProperty(TextEditor::Property::TEXT, "test paragraph tag

test paragraph tag

test paragraph tag "); + + application.SendNotification(); + application.Render(); + + Vector3 textNaturalSizeNewlineSeparator = editorNewlineSeparator.GetNaturalSize(); + Vector3 textNaturalSizeParagraphTag = editorParagraphTag.GetNaturalSize(); + + DALI_TEST_EQUALS(textNaturalSizeNewlineSeparator, textNaturalSizeParagraphTag, TEST_LOCATION); + + application.SendNotification(); + application.Render(); + + END_TEST; +} \ No newline at end of file