editor.SetProperty(TextEditor::Property::HORIZONTAL_ALIGNMENT, "END");
DALI_TEST_EQUALS(editor.GetProperty<std::string>(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<std::string>(DevelTextEditor::Property::VERTICAL_ALIGNMENT), "BOTTOM", TEST_LOCATION);
+ editor.SetProperty(DevelTextEditor::Property::VERTICAL_ALIGNMENT, "CENTER");
+ DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::VERTICAL_ALIGNMENT), "CENTER", TEST_LOCATION);
+ editor.SetProperty(DevelTextEditor::Property::VERTICAL_ALIGNMENT, "TOP");
+ DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::VERTICAL_ALIGNMENT), "TOP", TEST_LOCATION);
+
// Check scroll properties.
editor.SetProperty(TextEditor::Property::SCROLL_THRESHOLD, 1.f);
DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_THRESHOLD), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
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);
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<Vector2> positionsList = DevelTextEditor::GetTextPosition(label, startIndex, endIndex);
+ Vector<Vector2> sizeList = DevelTextEditor::GetTextSize(label, startIndex, endIndex);
+
+ DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
+ DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
+
+ Vector<Vector2> expectedSizes;
+ Vector<Vector2> expectedPositions;
+
+ expectedPositions.PushBack(Vector2(-2, 0));
+ expectedSizes.PushBack(Vector2(16, 25));
+
+ TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
+
+ END_TEST;
+}
+
int utcDaliTextEditorSelectionClearedSignal(void)
{
ToolkitTestApplication application;
END_TEST;
}
+int UtcDaliToolkitTextEditorMarkupRelativeLineHeight(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextEditorMarkupRelativeLineHeight");
+
+ 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, "line 1\nline 2\nline 3\nline 4\nline 5");
+ editor.SetProperty(DevelTextEditor::Property::RELATIVE_LINE_SIZE, 1.0f);
+ editor.SetProperty(DevelTextEditor::Property::ELLIPSIS, false);
+ editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
+
+ TextEditor editorSingleLineParagraph = TextEditor::New();
+ editorSingleLineParagraph.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 300.f));
+ editorSingleLineParagraph.SetProperty(TextEditor::Property::POINT_SIZE, 10);
+ editorSingleLineParagraph.SetProperty(TextEditor::Property::TEXT, "<p>line 1</p><p rel-line-height=0.5>line 2</p>line 3<p rel-line-height=3>line 4</p>line 5");
+ editorSingleLineParagraph.SetProperty(DevelTextEditor::Property::RELATIVE_LINE_SIZE, 1.0f);
+ editorSingleLineParagraph.SetProperty(DevelTextEditor::Property::ELLIPSIS, false);
+ editorSingleLineParagraph.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
+
+ TextEditor editorMultiLineParagraph = TextEditor::New();
+ editorMultiLineParagraph.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 300.f));
+ editorMultiLineParagraph.SetProperty(TextEditor::Property::POINT_SIZE, 10);
+ editorMultiLineParagraph.SetProperty(TextEditor::Property::TEXT, "<p>line 1</p><p rel-line-height=0.5>line\n2</p>line 3<p rel-line-height=3>line\n4</p>line 5");
+ editorMultiLineParagraph.SetProperty(DevelTextEditor::Property::RELATIVE_LINE_SIZE, 1.0f);
+ editorMultiLineParagraph.SetProperty(DevelTextEditor::Property::ELLIPSIS, false);
+ editorMultiLineParagraph.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
+
+ application.GetScene().Add(editor);
+ application.GetScene().Add(editorSingleLineParagraph);
+ application.GetScene().Add(editorMultiLineParagraph);
+ application.SendNotification();
+ application.Render();
+
+ Vector3 naturalSize = editor.GetNaturalSize();
+ Vector3 relativeSingleNaturalSize = editorSingleLineParagraph.GetNaturalSize();
+ Vector3 relativeMultiNaturalSize = editorMultiLineParagraph.GetNaturalSize();
+
+ float lineSize = naturalSize.y / 5.0f; //total size/number of lines
+
+ //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);
+
+ END_TEST;
+}
+
int UtcDaliToolkitTextEditorRelativeLineHeight(void)
{
ToolkitTestApplication application;
END_TEST;
}
+int UtcDaliTextEditorLineSpacingKeyArrowDown(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliTextEditorLineSpacingKeyArrowDown");
+
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK(editor);
+
+ application.GetScene().Add(editor);
+
+ std::string cutText = "";
+ std::string copiedText = "";
+
+ editor.SetProperty(TextEditor::Property::TEXT, "l1\nl2\nl3\n4");
+ editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
+ editor.SetProperty(Actor::Property::SIZE, Vector2(300.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::LINE_SPACING, -15);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Tap on the text editor
+ TestGenerateTap(application, 1.0f, 1.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Move to second line of the text.
+ application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(editor.GetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION).Get<int>(), 3, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliTextEditorNegativeLineSpacingWithEllipsis(void)
{
ToolkitTestApplication application;