X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit-internal%2Futc-Dali-Text-Typesetter.cpp;h=8ec03d6160b0f3d457d3e5bf22fd1a90bc94a92f;hp=14f352c26b63bf90e41ab0165a915104ec2e2e5a;hb=610495b8647d1a25c98bf0773ccc0dd6d1996263;hpb=b5b774f066e74e54a2e6f4bf923d1501f21f1284 diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Typesetter.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Typesetter.cpp index 14f352c..8ec03d6 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Typesetter.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Typesetter.cpp @@ -27,6 +27,9 @@ #include #include #include +#include +#include +#include using namespace Dali; using namespace Toolkit; @@ -108,7 +111,7 @@ int UtcDaliTextRenderingControllerRender(void) DALI_TEST_CHECK( renderingController ); // Renders the text and creates the final bitmap. - PixelData bitmap = renderingController->Render( relayoutSize ); + PixelData bitmap = renderingController->Render( relayoutSize, Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ); DALI_TEST_CHECK( bitmap ); DALI_TEST_EQUALS( 120u, bitmap.GetWidth(), TEST_LOCATION ); @@ -120,7 +123,7 @@ int UtcDaliTextRenderingControllerRender(void) controller->Relayout( relayoutSize ); // Renders the text and creates the final bitmap. - bitmap = renderingController->Render( relayoutSize ); + bitmap = renderingController->Render( relayoutSize, Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ); DALI_TEST_CHECK( bitmap ); DALI_TEST_EQUALS( 120u, bitmap.GetWidth(), TEST_LOCATION ); @@ -131,7 +134,7 @@ int UtcDaliTextRenderingControllerRender(void) controller->Relayout( relayoutSize ); // Renders the text and creates the final bitmap. - bitmap = renderingController->Render( relayoutSize ); + bitmap = renderingController->Render( relayoutSize, Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ); DALI_TEST_CHECK( bitmap ); DALI_TEST_EQUALS( 120u, bitmap.GetWidth(), TEST_LOCATION ); @@ -166,32 +169,82 @@ int UtcDaliTextTypesetterVerticalLineAlignment(void) DALI_TEST_CHECK( renderingController ); { - controller->SetVerticalLineAlignment(Dali::Toolkit::DevelText::VerticalLineAlignment::TOP); - controller->Relayout(relayoutSize); + controller->SetVerticalLineAlignment( Dali::Toolkit::DevelText::VerticalLineAlignment::TOP ); + controller->Relayout( relayoutSize ); // Renders the text and creates the final bitmap. - auto bitmap = renderingController->Render(relayoutSize); + auto bitmap = renderingController->Render( relayoutSize, Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ); DALI_TEST_EQUALS( 60u, bitmap.GetHeight(), TEST_LOCATION ); } { - controller->SetVerticalLineAlignment(Dali::Toolkit::DevelText::VerticalLineAlignment::MIDDLE); - controller->Relayout(relayoutSize); + controller->SetVerticalLineAlignment( Dali::Toolkit::DevelText::VerticalLineAlignment::MIDDLE ); + controller->Relayout( relayoutSize ); // Renders the text and creates the final bitmap. - auto bitmap = renderingController->Render(relayoutSize); + auto bitmap = renderingController->Render( relayoutSize, Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ); DALI_TEST_EQUALS( 60u, bitmap.GetHeight(), TEST_LOCATION ); } { - controller->SetVerticalLineAlignment(Dali::Toolkit::DevelText::VerticalLineAlignment::BOTTOM); - controller->Relayout(relayoutSize); + controller->SetVerticalLineAlignment( Dali::Toolkit::DevelText::VerticalLineAlignment::BOTTOM ); + controller->Relayout( relayoutSize ); // Renders the text and creates the final bitmap. - auto bitmap = renderingController->Render(relayoutSize); + auto bitmap = renderingController->Render( relayoutSize, Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ); DALI_TEST_EQUALS( 60u, bitmap.GetHeight(), TEST_LOCATION ); } tet_result(TET_PASS); END_TEST; -} \ No newline at end of file +} + +int UtcDaliTextTypesetterBitmapFont(void) +{ + tet_infoline("UtcDaliTextTypesetterBitmapFont "); + ToolkitTestApplication application; + + DevelText::BitmapFontDescription fontDescription; + fontDescription.name = "Digits"; + fontDescription.underlinePosition = 0.f; + fontDescription.underlineThickness = 0.f; + fontDescription.isColorFont = true; + + fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0031.png", "0", 34.f, 0.f } ); + fontDescription.glyphs.push_back( { TEST_RESOURCE_DIR "/fonts/bitmap/u0032.png", "1", 34.f, 0.f } ); + + TextAbstraction::BitmapFont bitmapFont; + DevelText::CreateBitmapFont( fontDescription, bitmapFont ); + + TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get(); + fontClient.GetFontId( bitmapFont ); + + // Creates a text controller. + ControllerPtr controller = Controller::New(); + + // Configures the text controller similarly to the text-label. + ConfigureTextLabel( controller ); + + // Sets the text. + controller->SetMarkupProcessorEnabled( true ); + controller->SetText( "0" ); + + // Creates the text's model and relais-out the text. + const Size relayoutSize( 31.f, 34.f ); + controller->Relayout( relayoutSize ); + + // Tests the rendering controller has been created. + TypesetterPtr renderingController = Typesetter::New( controller->GetTextModel() ); + DALI_TEST_CHECK( renderingController ); + + controller->Relayout( relayoutSize ); + + // Renders the text and creates the final bitmap. + auto bitmap = renderingController->Render( relayoutSize, Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ); + + DALI_TEST_EQUALS( 31u, bitmap.GetWidth(), TEST_LOCATION ); + DALI_TEST_EQUALS( 34u, bitmap.GetHeight(), TEST_LOCATION ); + + tet_result(TET_PASS); + END_TEST; +}