Fixing issue: On Text, reducing font-point-size when the Glyph-block-size be larger...
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-internal / utc-Dali-TextEditor-internal.cpp
index ca724ff..bef3f33 100755 (executable)
@@ -21,6 +21,7 @@
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
 
+#include <dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h>
 #include <dali-toolkit/internal/controls/text-controls/text-editor-impl.h>
 #include <dali-toolkit/internal/text/text-controller.h>
 #include <dali-toolkit/internal/text/text-controller-impl.h>
@@ -108,4 +109,61 @@ int UtcDaliTextEditorMarkupUnderline(void)
 
   END_TEST;
 
+int UtcDaliTextEditorFontPointSizeLargerThanAtlas(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliTextEditorFontPointSizeLargerThanAtlas ");
+
+  // Create a text editor
+  TextEditor textEditor = TextEditor::New();
+  //Set size to avoid automatic eliding
+  textEditor.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025));
+  //Set very large font-size using point-size
+  textEditor.SetProperty( TextEditor::Property::POINT_SIZE, 1000);
+  //Specify font-family
+  textEditor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
+  //Set text to check if appear or not
+  textEditor.SetProperty(TextEditor::Property::TEXT, "A");
+
+  application.GetScene().Add( textEditor );
+
+  application.SendNotification();
+  application.Render();
+
+  //Check if Glyph is added to AtlasGlyphManger or not
+  int countAtlas = AtlasGlyphManager::Get().GetMetrics().mAtlasMetrics.mAtlasCount;
+  DALI_TEST_EQUALS( countAtlas, 1, TEST_LOCATION );
+
+  END_TEST;
+}
+
+
+int UtcDaliTextEditorFontPointSizeLargerThanAtlasPlaceholderCase(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliTextEditorFontPointSizeLargerThanAtlasPlaceholderCase ");
+
+  //Set Map of placeholder: text, font-family and point-size
+  Property::Map placeholderMapSet;
+  placeholderMapSet["text"] = "A";
+  placeholderMapSet["fontFamily"] = "DejaVu Sans";
+  placeholderMapSet["pixelSize"] = 1000.0f;
+
+  // Create a text editor
+  TextEditor textEditor = TextEditor::New();
+  //Set size to avoid automatic eliding
+  textEditor.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025));
+  //Set placeholder
+  textEditor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet) ;
+
+  application.GetScene().Add( textEditor );
+
+  application.SendNotification();
+  application.Render();
+
+  //Check if Glyph is added to AtlasGlyphManger or not
+  int countAtlas = AtlasGlyphManager::Get().GetMetrics().mAtlasMetrics.mAtlasCount;
+  DALI_TEST_EQUALS( countAtlas, 1, TEST_LOCATION );
+
+  END_TEST;
 }
\ No newline at end of file