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=10af18a43a7bfe726b5c97f3f62233a025f0af12;hp=3e91406e013c7b7872733af4d80b44a19d95a0c6;hb=427f642f46df778c141cc7ab9718ce33d0ce01e1;hpb=88c5b0c17407122db7d6422b2b7a65ac96874653 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp index 3e91406..10af18a 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp @@ -97,6 +97,9 @@ const char* const PROPERTY_NAME_OUTLINE = "outline" const char* const PROPERTY_NAME_INPUT_OUTLINE = "inputOutline"; const char* const PROPERTY_NAME_HIDDEN_INPUT_SETTINGS = "hiddenInputSettings"; +const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize"; +const char* const PROPERTY_NAME_ENABLE_SELECTION = "enableSelection"; +const char* const PROPERTY_NAME_PLACEHOLDER = "placeholder"; const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND; @@ -505,6 +508,9 @@ int UtcDaliTextFieldGetPropertyP(void) DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextField::Property::OUTLINE ); DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_OUTLINE ) == TextField::Property::INPUT_OUTLINE ); DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_HIDDEN_INPUT_SETTINGS ) == DevelTextField::Property::HIDDEN_INPUT_SETTINGS ); + 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 ); END_TEST; } @@ -839,6 +845,78 @@ int UtcDaliTextFieldSetPropertyP(void) DALI_TEST_EQUALS( hiddenMapSet.Count(), hiddenMapGet.Count(), TEST_LOCATION ); DALI_TEST_EQUALS( DaliTestCheckMaps( hiddenMapSet, hiddenMapGet ), true, TEST_LOCATION ); + // Check the pixel size of font + field.SetProperty( DevelTextField::Property::PIXEL_SIZE, 20.f ); + DALI_TEST_EQUALS( field.GetProperty( DevelTextField::Property::PIXEL_SIZE ), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + + // Check the enable selection property + field.SetProperty( DevelTextField::Property::ENABLE_SELECTION, false ); + DALI_TEST_EQUALS( field.GetProperty( DevelTextField::Property::ENABLE_SELECTION ), false, TEST_LOCATION ); + + // Check the placeholder property with pixel size + Property::Map placeholderPixelSizeMapSet; + Property::Map placeholderPixelSizeMapGet; + Property::Map placeholderFontstyleMap; + placeholderPixelSizeMapSet["placeholderText"] = "Setting Placeholder Text"; + placeholderPixelSizeMapSet["placeholderColor"] = Color::BLUE; + placeholderPixelSizeMapSet["placeholderFontFamily"] = "Arial"; + placeholderPixelSizeMapSet["placeholderPixelSize"] = 15.0f; + + placeholderFontstyleMap.Insert( "weight", "bold" ); + placeholderPixelSizeMapSet["placeholderFontStyle"] = placeholderFontstyleMap; + field.SetProperty( DevelTextField::Property::PLACEHOLDER, placeholderPixelSizeMapSet ); + + placeholderPixelSizeMapGet = field.GetProperty( DevelTextField::Property::PLACEHOLDER ); + DALI_TEST_EQUALS( placeholderPixelSizeMapGet.Count(), placeholderPixelSizeMapSet.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderPixelSizeMapGet, placeholderPixelSizeMapSet ), true, TEST_LOCATION ); + + // Check the placeholder property with point size + Property::Map placeholderMapSet; + Property::Map placeholderMapGet; + placeholderMapSet["placeholderText"] = "Setting Placeholder Text"; + placeholderMapSet["placeholderColor"] = Color::RED; + placeholderMapSet["placeholderFontFamily"] = "Arial"; + placeholderMapSet["placeholderPointSize"] = 12.0f; + + // Check the placeholder font style property + placeholderFontstyleMap.Clear(); + + placeholderFontstyleMap.Insert( "weight", "bold" ); + placeholderFontstyleMap.Insert( "width", "condensed" ); + placeholderFontstyleMap.Insert( "slant", "italic" ); + placeholderMapSet["placeholderFontStyle"] = placeholderFontstyleMap; + field.SetProperty( DevelTextField::Property::PLACEHOLDER, placeholderMapSet ); + + placeholderMapGet = field.GetProperty( DevelTextField::Property::PLACEHOLDER ); + DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderMapSet ), true, TEST_LOCATION ); + + // Reset font style. + placeholderFontstyleMap.Clear(); + placeholderFontstyleMap.Insert( "weight", "normal" ); + placeholderFontstyleMap.Insert( "slant", "oblique" ); + placeholderMapSet["placeholderFontStyle"] = placeholderFontstyleMap; + field.SetProperty( DevelTextField::Property::PLACEHOLDER, placeholderMapSet ); + + placeholderMapGet = field.GetProperty( DevelTextField::Property::PLACEHOLDER ); + DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderMapSet ), true, TEST_LOCATION ); + + placeholderFontstyleMap.Clear(); + placeholderFontstyleMap.Insert( "slant", "roman" ); + placeholderMapSet["placeholderFontStyle"] = placeholderFontstyleMap; + field.SetProperty( DevelTextField::Property::PLACEHOLDER, placeholderMapSet ); + + placeholderMapGet = field.GetProperty( DevelTextField::Property::PLACEHOLDER ); + + placeholderFontstyleMap.Clear(); + placeholderMapSet["placeholderFontStyle"] = placeholderFontstyleMap; + + field.SetProperty( DevelTextField::Property::PLACEHOLDER, placeholderMapSet ); + placeholderMapGet = field.GetProperty( DevelTextField::Property::PLACEHOLDER ); + DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderMapSet ), true, TEST_LOCATION ); + END_TEST; } @@ -1696,17 +1774,18 @@ int utcDaliTextFieldEvent03(void) // The offscreen root actor should have two actors: the renderer and the highlight actor. Actor stencil = field.GetChildAt( 0u ); + // The highlight actor is drawn first, so is the first actor in the list + Renderer highlight = stencil.GetChildAt( 0u ).GetRendererAt( 0u ); + DALI_TEST_CHECK( highlight ); + // The offscreen root actor has a container with all the actors which contain the text renderers. - Actor container = stencil.GetChildAt( 0u ); + Actor container = stencil.GetChildAt( 1u ); for( unsigned int index = 0; index < container.GetChildCount(); ++index ) { Renderer renderer = container.GetChildAt( index ).GetRendererAt( 0u ); DALI_TEST_CHECK( renderer ); } - Renderer highlight = stencil.GetChildAt( 1u ).GetRendererAt( 0u ); - DALI_TEST_CHECK( highlight ); - END_TEST; }