X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-TextField.cpp;h=007508bf9e7620525c7543907eb12c9b954da5c0;hb=5c413e9b53670f574b9dd09078cac702834643ed;hp=19e9fd68853d5e83578f7bcc1347947ad557170e;hpb=7f55d5645df42e2a662dec8566db41a2f4a28122;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp index 19e9fd6..007508b 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp @@ -100,6 +100,7 @@ const char* const PROPERTY_NAME_HIDDEN_INPUT_SETTINGS = "hiddenIn const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize"; const char* const PROPERTY_NAME_ENABLE_SELECTION = "enableSelection"; const char* const PROPERTY_NAME_PLACEHOLDER = "placeholder"; +const char* const PROPERTY_NAME_ELLIPSIS = "ellipsis"; const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND; @@ -513,6 +514,7 @@ int UtcDaliTextFieldGetPropertyP(void) DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PIXEL_SIZE ) == DevelTextField::Property::PIXEL_SIZE ); DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_SELECTION ) == DevelTextField::Property::ENABLE_SELECTION ); DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER ) == DevelTextField::Property::PLACEHOLDER ); + DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == DevelTextField::Property::ELLIPSIS ); END_TEST; } @@ -827,9 +829,27 @@ int UtcDaliTextFieldSetPropertyP(void) DALI_TEST_EQUALS( field.GetProperty( TextField::Property::INPUT_EMBOSS ), std::string("Emboss input properties"), TEST_LOCATION ); // Check the outline property + + // Test string type first + // This is purely to maintain backward compatibility, but we don't support string as the outline property type. field.SetProperty( TextField::Property::OUTLINE, "Outline properties" ); DALI_TEST_EQUALS( field.GetProperty( TextField::Property::OUTLINE ), std::string("Outline properties"), TEST_LOCATION ); + // Then test the property map type + Property::Map outlineMapSet; + Property::Map outlineMapGet; + + outlineMapSet["color"] = Color::RED; + outlineMapSet["width"] = 2.0f; + + field.SetProperty( TextField::Property::OUTLINE, outlineMapSet ); + + outlineMapSet["color"] = "red"; + outlineMapSet["width"] = "2"; + outlineMapGet = field.GetProperty( TextField::Property::OUTLINE ); + DALI_TEST_EQUALS( outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS( DaliTestCheckMaps( outlineMapGet, outlineMapSet ), true, TEST_LOCATION ); + // Check the input outline property field.SetProperty( TextField::Property::INPUT_OUTLINE, "Outline input properties" ); DALI_TEST_EQUALS( field.GetProperty( TextField::Property::INPUT_OUTLINE ), std::string("Outline input properties"), TEST_LOCATION ); @@ -860,9 +880,11 @@ int UtcDaliTextFieldSetPropertyP(void) Property::Map placeholderPixelSizeMapGet; Property::Map placeholderFontstyleMap; placeholderPixelSizeMapSet["placeholderText"] = "Setting Placeholder Text"; + placeholderPixelSizeMapSet["placeholderTextFocused"] = "Setting Placeholder Text Focused"; placeholderPixelSizeMapSet["placeholderColor"] = Color::BLUE; placeholderPixelSizeMapSet["placeholderFontFamily"] = "Arial"; placeholderPixelSizeMapSet["placeholderPixelSize"] = 15.0f; + placeholderPixelSizeMapSet["placeholderEllipsis"] = true; placeholderFontstyleMap.Insert( "weight", "bold" ); placeholderPixelSizeMapSet["placeholderFontStyle"] = placeholderFontstyleMap; @@ -876,9 +898,11 @@ int UtcDaliTextFieldSetPropertyP(void) Property::Map placeholderMapSet; Property::Map placeholderMapGet; placeholderMapSet["placeholderText"] = "Setting Placeholder Text"; + placeholderMapSet["placeholderTextFocused"] = "Setting Placeholder Text Focused"; placeholderMapSet["placeholderColor"] = Color::RED; placeholderMapSet["placeholderFontFamily"] = "Arial"; placeholderMapSet["placeholderPointSize"] = 12.0f; + placeholderMapSet["placeholderEllipsis"] = false; // Check the placeholder font style property placeholderFontstyleMap.Clear(); @@ -919,6 +943,11 @@ int UtcDaliTextFieldSetPropertyP(void) DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION ); DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderMapSet ), true, TEST_LOCATION ); + // Check the ellipsis property + DALI_TEST_CHECK( !field.GetProperty( DevelTextField::Property::ELLIPSIS ) ); + field.SetProperty( DevelTextField::Property::ELLIPSIS, true ); + DALI_TEST_CHECK( field.GetProperty( DevelTextField::Property::ELLIPSIS ) ); + END_TEST; } @@ -1728,6 +1757,16 @@ int utcDaliTextFieldEvent02(void) // Should not be a renderer. DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION ); + // Chanege exceed policy (EXCEED_POLICY_ORIGINAL doesn't use stencil ) + field.SetProperty( TextField::Property::TEXT, "This is a long text for the size of the text-field." ); + field.SetProperty( TextField::Property::EXCEED_POLICY, Dali::Toolkit::TextField::EXCEED_POLICY_ORIGINAL ); + + application.SendNotification(); + application.Render(); + + // There are renderer and decorator layer + DALI_TEST_EQUALS( field.GetChildCount(), 2u, TEST_LOCATION ); + END_TEST; } @@ -2443,3 +2482,101 @@ int utcDaliTextFieldSomeSpecialKeys(void) END_TEST; } + +int utcDaliTextFieldSizeUpdate(void) +{ + ToolkitTestApplication application; + tet_infoline("utcDaliTextFieldSizeUpdate"); + + // Checks some special keys when the text is selected. + TextField field = TextField::New(); + DALI_TEST_CHECK( field ); + Stage::GetCurrent().Add( field ); + + float previousHeight = 0.0f; + float currentHeight = 0.0f; + const float fieldWidth = 1920.0f; + + + // "ㅁ" is bigger then "ኢ" + field.SetSize( Vector2( fieldWidth ,10.0f ) ); + field.SetResizePolicy( ResizePolicy::FIXED , Dimension::WIDTH ); + field.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY , Dimension::HEIGHT ); + + field.SetProperty( TextField::Property::TEXT, "ኢ"); + field.SetParentOrigin( ParentOrigin::TOP_LEFT ); + field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + + field.SetKeyboardFocusable(true); + KeyboardFocusManager::Get().SetCurrentFocusActor( field ); + + application.SendNotification(); + application.Render(); + + previousHeight = field.GetHeightForWidth( fieldWidth ); + DALI_TEST_EQUALS( previousHeight, field.GetProperty( Actor::Property::SIZE_HEIGHT ) , TEST_LOCATION ); + + // Add another script characters ( glyph height is defferent ) + application.ProcessEvent( GenerateKey( "ㅁ", "ㅁ", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) ); + application.ProcessEvent( GenerateKey( "ㅁ", "ㅁ", KEY_A_CODE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) ); + + application.SendNotification(); + application.Render(); + + currentHeight = field.GetHeightForWidth( fieldWidth ); + DALI_TEST_EQUALS( currentHeight, field.GetProperty( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION ); + DALI_TEST_EQUALS( (previousHeight < currentHeight), true , TEST_LOCATION ); + + END_TEST; +} + +int utcDaliTextFieldExtremlyLargePointSize(void) +{ + ToolkitTestApplication application; + tet_infoline(" utcDaliTextFieldExtremlyLargePointSize"); + + TextField field = TextField::New(); + + field.SetProperty( TextField::Property::TEXT, "Text" ); + field.SetSize( 300.f, 50.f ); + field.SetParentOrigin( ParentOrigin::TOP_LEFT ); + field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + Stage::GetCurrent().Add( field ); + + try + { + field.SetProperty( TextField::Property::POINT_SIZE, 160.0f ); + application.SendNotification(); + DALI_TEST_CHECK( field ); + } + catch (...) + { + tet_result(TET_FAIL); + } + END_TEST; +} + +int UtcDaliTextFieldDefaultFontStylePropertyCoverage(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliTextFieldFontStylePorpertyCoverage"); + TextField field = TextField::New(); + DALI_TEST_CHECK( field ); + Stage::GetCurrent().Add( field ); + + Property::Map fontStyleMapGet; + + fontStyleMapGet = field.GetProperty( TextField::Property::FONT_STYLE ); + + Property::Value* weightValue = NULL; + Property::Value* widthValue = NULL; + Property::Value* slantValue = NULL; + weightValue = fontStyleMapGet.Find( "weight" ); + widthValue = fontStyleMapGet.Find( "width" ); + slantValue = fontStyleMapGet.Find( "slant" ); + DALI_TEST_CHECK( !weightValue ); + DALI_TEST_CHECK( !widthValue ); + DALI_TEST_CHECK( !slantValue ); + + END_TEST; +}