X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-TextField.cpp;h=b8fd9db652c0882843d4224c56601dcb0ccbeb09;hp=5e89ab68c1c08300ae5ff2e2225f4f04b0fbd4f2;hb=85b83b75993f7e01302d67c19aa53c3e1fc63586;hpb=927df4637ee383b08a2c0b89ce615690ef064f3d diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp index 5e89ab6..b8fd9db 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp @@ -17,9 +17,9 @@ #include #include +#include #include #include -#include #include #include #include @@ -72,10 +72,10 @@ const char* const PROPERTY_NAME_SELECTION_HIGHLIGHT_COLOR = "selectio const char* const PROPERTY_NAME_DECORATION_BOUNDING_BOX = "decoration-bounding-box"; const char* const PROPERTY_NAME_INPUT_METHOD_SETTINGS = "input-method-settings"; -const unsigned int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND; +const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND; const Vector4 PLACEHOLDER_TEXT_COLOR( 0.8f, 0.8f, 0.8f, 0.8f ); -const Dali::Vector4 LIGHT_BLUE( (0xb2 / 255.0f), (0xeb / 255.0f), (0xf2 / 255.0f), 0.5f ); // The text highlight color. +const Dali::Vector4 LIGHT_BLUE( 0.75f, 0.96f, 1.f, 1.f ); // The text highlight color. const unsigned int CURSOR_BLINK_INTERVAL = 500u; // Cursor blink interval const float TO_MILLISECONDS = 1000.f; @@ -267,34 +267,11 @@ int UtcDaliTextFieldSetPropertyP(void) TextField field = TextField::New(); DALI_TEST_CHECK( field ); - // Check defaults. - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::RENDERING_BACKEND ), DEFAULT_RENDERING_BACKEND, TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::TEXT ), std::string(""), TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::PLACEHOLDER_TEXT ), std::string(""), TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::PLACEHOLDER_TEXT_FOCUSED ), std::string(""), TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::FONT_FAMILY ), std::string(""), TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::FONT_STYLE ), std::string(""), TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::POINT_SIZE ), 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::MAX_LENGTH ), 50u, TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::EXCEED_POLICY ), TextField::EXCEED_POLICY_CLIP, TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::HORIZONTAL_ALIGNMENT ), "BEGIN", TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::VERTICAL_ALIGNMENT ), "TOP", TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::TEXT_COLOR ), Color::BLACK, TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::SHADOW_OFFSET ), Vector2::ZERO, TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::PLACEHOLDER_TEXT_COLOR ), PLACEHOLDER_TEXT_COLOR, TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::SHADOW_COLOR ), Color::BLACK, TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::PRIMARY_CURSOR_COLOR ), Color::BLACK, TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::SECONDARY_CURSOR_COLOR ), Color::BLACK, TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::ENABLE_CURSOR_BLINK ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::CURSOR_BLINK_INTERVAL ), CURSOR_BLINK_INTERVAL * TO_SECONDS, TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::CURSOR_BLINK_DURATION ), 0.f, TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::SCROLL_THRESHOLD ), SCROLL_THRESHOLD, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::SCROLL_SPEED ), SCROLL_SPEED, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::SELECTION_HIGHLIGHT_COLOR ), LIGHT_BLUE, TEST_LOCATION ); + // Note - we can't check the defaults since the stylesheets are platform-specific // Check the render backend property. - field.SetProperty( TextField::Property::RENDERING_BACKEND, Text::RENDERING_BASIC ); - DALI_TEST_EQUALS( field.GetProperty( TextField::Property::RENDERING_BACKEND ), Text::RENDERING_BASIC, TEST_LOCATION ); + field.SetProperty( TextField::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS ); + DALI_TEST_EQUALS( field.GetProperty( TextField::Property::RENDERING_BACKEND ), Text::RENDERING_SHARED_ATLAS, TEST_LOCATION ); // Check text property. field.SetProperty( TextField::Property::TEXT, "Setting Text" ); @@ -387,34 +364,6 @@ int UtcDaliTextFieldSetPropertyP(void) END_TEST; } -// Positive Basic Text Renderer test -int utcDaliTextFieldBasicRenderP(void) -{ - ToolkitTestApplication application; - tet_infoline("UtcDaliToolkitTextFieldBasicRenderP"); - TextField field = TextField::New(); - DALI_TEST_CHECK( field ); - - field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "BEGIN" ); - - application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - - Stage::GetCurrent().Add( field ); - - try - { - // Render some text with the basic backend - field.SetProperty( TextField::Property::RENDERING_BACKEND, Text::RENDERING_BASIC ); - application.SendNotification(); - application.Render(); - } - catch( ... ) - { - tet_result(TET_FAIL); - } - END_TEST; -} - // Positive Atlas Text Renderer test int utcDaliTextFieldAtlasRenderP(void) { @@ -638,6 +587,7 @@ int utcDaliTextFieldEvent02(void) // Checks if the right number of actors are created. TextField field = TextField::New(); + field.SetProperty( TextField::Property::POINT_SIZE, 10.f ); DALI_TEST_CHECK( field ); Stage::GetCurrent().Add( field ); @@ -696,7 +646,7 @@ int utcDaliTextFieldEvent02(void) CameraActor camera = CameraActor::DownCast( offscreenRoot.GetChildAt( 0u ) ); DALI_TEST_CHECK( camera ); - RenderableActor renderer = RenderableActor::DownCast( offscreenRoot.GetChildAt( 1u ) ); + Renderer renderer = offscreenRoot.GetChildAt( 1u ).GetRendererAt( 0u ); DALI_TEST_CHECK( renderer ); // Move the cursor and check the position changes. @@ -739,7 +689,7 @@ int utcDaliTextFieldEvent02(void) DALI_TEST_EQUALS( position2, position4, TEST_LOCATION ); // Should be in the same position2. - // Try to tap at the end. + // Tap away from the start position. application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 13.f, 25.0f ) ) ); application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 13.0f, 25.0f ) ) ); @@ -747,14 +697,14 @@ int utcDaliTextFieldEvent02(void) application.SendNotification(); application.Render(); - // Cursor position should be the same than position1. Vector3 position5 = cursor.GetCurrentPosition(); - DALI_TEST_EQUALS( position1, position5, TEST_LOCATION ); // Should be in the same position1. + DALI_TEST_CHECK( position5.x > position4.x ); - // Remove some text. + // Remove all the text. application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down ) ); application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down ) ); + field.SetProperty( TextField::Property::TEXT, "" ); // Render and notify application.SendNotification(); @@ -784,6 +734,7 @@ int utcDaliTextFieldEvent03(void) Stage::GetCurrent().Add( field ); field.SetProperty( TextField::Property::TEXT, "This is a long text for the size of the text-field." ); + field.SetProperty( TextField::Property::POINT_SIZE, 10.f ); field.SetSize( 30.f, 50.f ); field.SetParentOrigin( ParentOrigin::TOP_LEFT ); field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); @@ -818,10 +769,10 @@ int utcDaliTextFieldEvent03(void) CameraActor camera = CameraActor::DownCast( offscreenRoot.GetChildAt( 0u ) ); DALI_TEST_CHECK( camera ); - RenderableActor renderer = RenderableActor::DownCast( offscreenRoot.GetChildAt( 1u ) ); + Renderer renderer = offscreenRoot.GetChildAt( 1u ).GetRendererAt( 0u ); DALI_TEST_CHECK( renderer ); - MeshActor highlight = MeshActor::DownCast( offscreenRoot.GetChildAt( 2u ) ); + Renderer highlight = offscreenRoot.GetChildAt( 2u ).GetRendererAt( 0u ); DALI_TEST_CHECK( highlight ); END_TEST;