Support paragraph tag <p> in markup
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TextEditor.cpp
index 0247a3b..b2e1f16 100644 (file)
@@ -5719,8 +5719,71 @@ int UtcDaliToolkitTextEditorUnderlineTypesGeneration3(void)
   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet1, underlineMapSet1), true, TEST_LOCATION);
 
   application.GetScene().Add(textEditor1);
+
   application.SendNotification();
   application.Render();
 
   END_TEST;
 }
+
+int UtcDaliTextEditorCharacterSpacing(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliTextEditorCharacterSpacing ");
+
+  TextEditor textEditor = TextEditor::New();
+
+  textEditor.SetProperty(Actor::Property::SIZE, Vector2(150.0f, 300.f));
+
+  application.GetScene().Add(textEditor);
+  application.SendNotification();
+  application.Render();
+
+  textEditor.SetProperty(TextEditor::Property::TEXT, "Hi Experiment");
+  textEditor.SetProperty(DevelTextEditor::Property::CHARACTER_SPACING, 10.f);
+  DALI_TEST_EQUALS(textEditor.GetProperty<float>(DevelTextEditor::Property::CHARACTER_SPACING), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+
+  application.SendNotification();
+  application.Render();
+
+  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 <p>test paragraph tag </p>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