X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit-internal%2Futc-Dali-TextField-internal.cpp;h=1fbc13e88dfcc41ecbafff8f475aaf695e84f8aa;hb=b22b9008628e11531fc1dfa0a9f8632061aee112;hp=1d899d9de4545d119f3d80bd9bad2930c1bdbd43;hpb=ac501f02feab8e2fb7e613f936d3d5a511603001;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextField-internal.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextField-internal.cpp index 1d899d9..1fbc13e 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextField-internal.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextField-internal.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -190,4 +191,159 @@ int UtcDaliTextFieldMarkupUnderline(void) END_TEST; +} + +int UtcDaliTextFieldFontPointSizeLargerThanAtlas(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliTextFieldFontPointSizeLargerThanAtlas "); + + // Create a Text field + TextField textField = TextField::New(); + //Set size to avoid automatic eliding + textField.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025)); + //Set very large font-size using point-size + textField.SetProperty( TextField::Property::POINT_SIZE, 1000) ; + //Specify font-family + textField.SetProperty( TextField::Property::FONT_FAMILY, "DejaVu Sans"); + //Set text to check if appear or not + textField.SetProperty( TextField::Property::TEXT, "A"); + + application.GetScene().Add( textField ); + + 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 UtcDaliTextFieldFontPointSizeLargerThanAtlasPlaceholderCase(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliTextFieldFontPointSizeLargerThanAtlasPlaceholderCase "); + + //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 + TextField textField = TextField::New(); + //Set size to avoid automatic eliding + textField.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025)); + //Set placeholder + textField.SetProperty( TextField::Property::PLACEHOLDER, placeholderMapSet) ; + + application.GetScene().Add( textField ); + + 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 UtcDaliTextFieldBackgroundTag(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliTextFieldBackgroundTag\n"); + + TextField field = TextField::New(); + DALI_TEST_CHECK( field ); + + field.SetProperty( TextField ::Property::ENABLE_MARKUP, true ); + field.SetProperty( TextField::Property::TEXT, "He World" ); + application.GetScene().Add( field ); + application.SendNotification(); + application.Render(); + + Toolkit::Internal::TextField& fieldImpl = GetImpl( field ); + const ColorIndex* const backgroundColorIndicesBuffer = fieldImpl.getController()->GetTextModel()->GetBackgroundColorIndices(); + + DALI_TEST_CHECK( backgroundColorIndicesBuffer ); + + //default color + DALI_TEST_EQUALS( backgroundColorIndicesBuffer[0], 0u, TEST_LOCATION); + + //red color + DALI_TEST_EQUALS( backgroundColorIndicesBuffer[1], 1u, TEST_LOCATION); + + //yellow color + DALI_TEST_EQUALS( backgroundColorIndicesBuffer[7], 2u, TEST_LOCATION); + + END_TEST; +} + +int UtcDaliTextFieldTextWithSpan(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliTextFieldTextWithSpan\n"); + + TextField field = TextField::New(); + DALI_TEST_CHECK( field ); + + field.SetProperty( TextField ::Property::ENABLE_MARKUP, true ); + field.SetProperty( TextField::Property::TEXT, "Hello Span" ); + application.GetScene().Add( field ); + + application.SendNotification(); + application.Render(); + + Vector3 originalSize = field.GetNaturalSize(); + field.SetProperty( TextField::Property::TEXT, "Hello Span" ); + + application.SendNotification(); + application.Render(); + + Vector3 spanSize = field.GetNaturalSize(); + + DALI_TEST_GREATER(spanSize.width, originalSize.width, TEST_LOCATION); + + Toolkit::Internal::TextField& fieldImpl = GetImpl( field ); + const ColorIndex* const colorIndicesBuffer1 = fieldImpl.getController()->GetTextModel()->GetColorIndices(); + + DALI_TEST_CHECK( colorIndicesBuffer1 ); + + //default color + DALI_TEST_EQUALS( colorIndicesBuffer1[0], 0u, TEST_LOCATION); + + //span color + DALI_TEST_EQUALS( colorIndicesBuffer1[1], 1u, TEST_LOCATION); + + //default color + DALI_TEST_EQUALS( colorIndicesBuffer1[6], 0u, TEST_LOCATION); + + + field.SetProperty( TextField::Property::TEXT, "Hello Span" ); + + application.SendNotification(); + application.Render(); + + const ColorIndex* const colorIndicesBuffer2 = fieldImpl.getController()->GetTextModel()->GetColorIndices(); + + DALI_TEST_CHECK( colorIndicesBuffer2 ); + + //default color + DALI_TEST_EQUALS( colorIndicesBuffer2[0], 0u, TEST_LOCATION); + + //default color + DALI_TEST_EQUALS( colorIndicesBuffer2[1], 0u, TEST_LOCATION); + + //span color + DALI_TEST_EQUALS( colorIndicesBuffer2[6], 1u, TEST_LOCATION); + + //default color + DALI_TEST_EQUALS( colorIndicesBuffer2[7], 0u, TEST_LOCATION); + + END_TEST; } \ No newline at end of file