X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-TextLabel.cpp;h=a29a7fdd8048ec6b6d5396f6670542da2ca4412e;hb=65fe4d97a7a58199b2f5ad2d84e26acbb2b6ae39;hp=d8c5f70e4cc545776848e399e1a74502ddee7e2d;hpb=6d96d7c0b6a74a5fe927dcaa2d9b1fae932af08d;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp index d8c5f70..a29a7fd 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include using namespace Dali; @@ -636,6 +637,11 @@ int UtcDaliToolkitTextLabelSetPropertyP(void) label.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT ); DALI_TEST_EQUALS( label.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION ); + // Check the line size property + DALI_TEST_EQUALS( label.GetProperty( DevelTextLabel::Property::MIN_LINE_SIZE ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + label.SetProperty( DevelTextLabel::Property::MIN_LINE_SIZE, 50.f ); + DALI_TEST_EQUALS( label.GetProperty( DevelTextLabel::Property::MIN_LINE_SIZE ), 50.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + application.SendNotification(); application.Render(); @@ -1024,7 +1030,7 @@ int UtcDaliToolkitTextlabelScrollingInterruptedP(void) // Avoid a crash when core load gl resources. application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); Stage::GetCurrent().Add( label ); - label.SetSize( 360.0f, 20.f ); + label.SetProperty( Actor::Property::SIZE, Vector2( 360.0f, 20.f ) ); // Turn on all the effects label.SetProperty( TextLabel::Property::MULTI_LINE, false ); label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f ); @@ -1099,6 +1105,51 @@ int UtcDaliToolkitTextlabelScrollingN(void) END_TEST; } +int UtcDaliToolkitTextlabelScrollingWithEllipsis(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolkitTextlabelScrollingWithEllipsis"); + + TextLabel label = TextLabel::New("Some text to scroll"); + DALI_TEST_CHECK( label ); + + Stage::GetCurrent().Add( label ); + + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + + // Turn on all the effects. + label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f ); + label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 ); + label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f ); + + try + { + // Enable the auto scrolling effect. + label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true ); + label.SetProperty( TextLabel::Property::AUTO_SCROLL_STOP_MODE, TextLabel::AutoScrollStopMode::IMMEDIATE ); + + // Disable the ellipsis + label.SetProperty( TextLabel::Property::ELLIPSIS, false ); + + // Render the text. + application.SendNotification(); + application.Render(); + + // Stop auto scrolling + label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false ); + + // Check the ellipsis property + DALI_TEST_CHECK( !label.GetProperty( TextLabel::Property::ELLIPSIS ) ); + } + catch( ... ) + { + tet_result(TET_FAIL); + } + + END_TEST; +} + int UtcDaliToolkitTextlabelEllipsis(void) { ToolkitTestApplication application; @@ -1113,9 +1164,9 @@ int UtcDaliToolkitTextlabelEllipsis(void) Stage::GetCurrent().Add( label ); // Turn on all the effects - label.SetAnchorPoint( AnchorPoint::CENTER ); - label.SetParentOrigin( ParentOrigin::CENTER ); - label.SetSize( 360.0f, 10.f ); + label.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + label.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + label.SetProperty( Actor::Property::SIZE, Vector2( 360.0f, 10.f ) ); try { @@ -1130,7 +1181,7 @@ int UtcDaliToolkitTextlabelEllipsis(void) label.SetProperty( TextLabel::Property::TEXT, "Hello world " ); label.SetProperty( DevelTextLabel::Property::IGNORE_SPACES_AFTER_TEXT, false ); - label.SetSize( 400.0f, 10.f ); + label.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 10.f ) ); try { @@ -1146,7 +1197,7 @@ int UtcDaliToolkitTextlabelEllipsis(void) label.SetProperty( TextLabel::Property::TEXT, "Hello world" ); label.SetProperty( DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true ); - label.SetSize( 400.0f, 10.f ); + label.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 10.f ) ); try { @@ -1170,7 +1221,7 @@ int UtcDaliToolkitTextlabelTextWrapMode(void) int lineCount =0 ; TextLabel label = TextLabel::New(); - label.SetSize( 300.0f, 300.f ); + label.SetProperty( Actor::Property::SIZE, Vector2( 300.0f, 300.f ) ); label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" ); label.SetProperty( TextLabel::Property::MULTI_LINE, true ); @@ -1288,7 +1339,7 @@ int UtcDaliToolkitTextlabelTextStyle01(void) tet_infoline(" UtcDaliToolkitTextlabelTextStyle Setting Outline after Shadow"); TextLabel label = TextLabel::New(); - label.SetSize( 300.0f, 300.f ); + label.SetProperty( Actor::Property::SIZE, Vector2( 300.0f, 300.f ) ); label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world" ); label.SetProperty( TextLabel::Property::POINT_SIZE, 12 ); Stage::GetCurrent().Add( label ); @@ -1475,7 +1526,7 @@ int UtcDaliToolkitTextLabelBitmapFont(void) application.Render(); // The text has been rendered if the height of the text-label is the height of the line. - DALI_TEST_EQUALS( label.GetCurrentSize().height, 34.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + DALI_TEST_EQUALS( label.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, 34.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); END_TEST; } @@ -1496,7 +1547,7 @@ int UtcDaliToolkitTextlabelTextFit(void) tet_infoline(" UtcDaliToolkitTextlabelTextFit"); TextLabel label = TextLabel::New(); Vector2 size( 460.0f, 100.0f ); - label.SetSize( size ); + label.SetProperty( Actor::Property::SIZE, size ); label.SetProperty( TextLabel::Property::TEXT, "Hello world" ); // check point size @@ -1535,3 +1586,48 @@ int UtcDaliToolkitTextlabelTextFit(void) END_TEST; } + +int UtcDaliToolkitTextlabelMaxTextureSet(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolkitTextlabelMaxTextureSet"); + + DevelText::BitmapFontDescription fontDescription; + fontDescription.name = "Digits"; + fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0030.png", ":", 200.f, 0.f } ); + + TextAbstraction::BitmapFont bitmapFont; + DevelText::CreateBitmapFont( fontDescription, bitmapFont ); + + TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get(); + fontClient.GetFontId( bitmapFont ); + + TextLabel label = TextLabel::New(); + label.SetProperty( TextLabel::Property::FONT_FAMILY, "Digits" ); + label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true ); + label.SetProperty( TextLabel::Property::TEXT, ":This is a long sample text made to allow max texture size to be exceeded." ); + label.SetProperty( TextLabel::Property::POINT_SIZE, 200.f ); + label.SetProperty( TextLabel::Property::MULTI_LINE, true ); + + Property::Map underlineMapSet; + underlineMapSet.Clear(); + underlineMapSet.Insert( "enable", true ); + underlineMapSet.Insert( "color", Color::RED ); + underlineMapSet.Insert( "height", 1 ); + label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet ); + label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE ); + + Stage::GetCurrent().Add( label ); + + application.SendNotification(); + application.Render(); + + const int maxTextureSize = Dali::GetMaxTextureSize(); + // Whether the rendered text is greater than maxTextureSize + DALI_TEST_CHECK( label.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height > maxTextureSize ); + + // Check if the number of renderers is greater than 1. + DALI_TEST_CHECK( label.GetRendererCount() > 1u ); + + END_TEST; +}