* These two properties are currently implemented with a json map encoded inside a string.
This patch replaces this string by a property map.
Change-Id: I8892d9067157c58f3d0b337e17fa6956b43b687d
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
"{\"styles\":{\n"
" \"textlabel\":\n"
" {\n"
- " \"fontStyle\":\"Regular\",\n"
+ " \"fontStyle\":{\"weight\":\"normal\"},\n"
" \"pointSize\":18\n"
" }\n"
" }\n"
keyState );
}
+bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet )
+{
+ if( fontStyleMapGet.Count() == fontStyleMapSet.Count() )
+ {
+ for( unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index )
+ {
+ const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue( index );
+
+ Property::Value* valueSet = fontStyleMapSet.Find( valueGet.first.stringKey );
+ if( NULL != valueSet )
+ {
+ if( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() )
+ {
+ tet_printf( " Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
+ return false;
+ }
+ }
+ else
+ {
+ tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
} // namespace
int UtcDaliToolkitTextEditorConstructorP(void)
// Check font properties.
editor.SetProperty( TextEditor::Property::FONT_FAMILY, "Setting font family" );
DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
- editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE ), std::string("{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}"), TEST_LOCATION );
+
+ Property::Map fontStyleMapSet;
+ Property::Map fontStyleMapGet;
+ Property::Value* slantValue = NULL;
+
+ fontStyleMapSet.Insert( "weight", "bold" );
+ fontStyleMapSet.Insert( "width", "condensed" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+
+ editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
// Reset font style.
- editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"weight\":\"normal\",\"slant\":\"oblique\"}" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE ), std::string("{\"weight\":\"normal\",\"slant\":\"oblique\"}"), TEST_LOCATION );
- editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"slant\":\"roman\"}" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE ), std::string("{\"slant\":\"normal\"}"), TEST_LOCATION );
- editor.SetProperty( TextEditor::Property::FONT_STYLE, "" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE ), std::string(""), TEST_LOCATION );
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "normal" );
+ fontStyleMapSet.Insert( "slant", "oblique" );
+ editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "slant", "roman" );
+ editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::FONT_STYLE );
+
+ // Replace 'roman' for 'normal'.
+ slantValue = fontStyleMapGet.Find( "slant" );
+ if( NULL != slantValue )
+ {
+ if( "normal" == slantValue->Get<std::string>() )
+ {
+ fontStyleMapGet["slant"] = "roman";
+ }
+ }
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+
+ editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
// Check that the Alignment properties can be correctly set
editor.SetProperty( TextEditor::Property::HORIZONTAL_ALIGNMENT, "END" );
// Check input font properties.
editor.SetProperty( TextEditor::Property::INPUT_FONT_FAMILY, "Setting input font family" );
DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_FAMILY ), "Setting input font family", TEST_LOCATION );
- editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_STYLE ), "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}", TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "bold" );
+ fontStyleMapSet.Insert( "width", "condensed" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+
+ editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
editor.SetProperty( TextEditor::Property::INPUT_POINT_SIZE, 12.f );
DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::INPUT_POINT_SIZE ), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
// Reset input font style.
- editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "{\"weight\":\"normal\",\"slant\":\"oblique\"}" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_STYLE ), std::string("{\"weight\":\"normal\",\"slant\":\"oblique\"}"), TEST_LOCATION );
- editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "{\"slant\":\"roman\"}" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_STYLE ), std::string("{\"slant\":\"normal\"}"), TEST_LOCATION );
- editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_STYLE ), std::string(""), TEST_LOCATION );
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "normal" );
+ fontStyleMapSet.Insert( "slant", "oblique" );
+
+ editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "slant", "roman" );
+
+ editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
+
+ // Replace 'roman' for 'normal'.
+ slantValue = fontStyleMapGet.Find( "slant" );
+ if( NULL != slantValue )
+ {
+ if( "normal" == slantValue->Get<std::string>() )
+ {
+ fontStyleMapGet["slant"] = "roman";
+ }
+ }
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+
+ editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
// Check the line spacing property
DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
- const std::string style = editor.GetProperty( TextEditor::Property::INPUT_FONT_STYLE ).Get<std::string>();
- DALI_TEST_EQUALS( style, "{\"weight\":\"bold\"}", TEST_LOCATION );
+ Property::Map fontStyleMapSet;
+ Property::Map fontStyleMapGet;
+
+ fontStyleMapSet.Insert( "weight", "bold" );
+
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
}
DALI_TEST_CHECK( inputStyleChangedSignal );
{
DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextEditor::InputStyle::FONT_STYLE ), TEST_LOCATION );
- const std::string style = editor.GetProperty( TextEditor::Property::INPUT_FONT_STYLE ).Get<std::string>();
- DALI_TEST_CHECK( style.empty() );
+ Property::Map fontStyleMapSet;
+ Property::Map fontStyleMapGet;
+
+ fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
}
DALI_TEST_CHECK( inputStyleChangedSignal );
editor.SetProperty( TextEditor::Property::INPUT_COLOR, Color::YELLOW );
- editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
+ Property::Map fontStyleMapSet;
+ fontStyleMapSet.Insert( "weight", "thin" );
+ fontStyleMapSet.Insert( "width", "condensed" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+
+ editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet );
editor.SetProperty( TextEditor::Property::INPUT_POINT_SIZE, 20.f );
editor.SetProperty( TextEditor::Property::INPUT_LINE_SPACING, 5.f );
inputStyleChangedSignal = false;
editor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVuSerif" );
- editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"weight\":\"black\",\"width\":\"expanded\",\"slant\":\"oblique\"}" );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "black" );
+ fontStyleMapSet.Insert( "width", "expanded" );
+ fontStyleMapSet.Insert( "slant", "oblique" );
+
+ editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet );
// Create a tap event to touch the text editor.
application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 30.f, 25.f ) ) );
return tap;
}
-
Integration::LongPressGestureEvent GenerateLongPress(
Gesture::State state,
unsigned int numberOfTouches,
keyState );
}
+bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet )
+{
+ if( fontStyleMapGet.Count() == fontStyleMapSet.Count() )
+ {
+ for( unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index )
+ {
+ const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue( index );
+
+ Property::Value* valueSet = fontStyleMapSet.Find( valueGet.first.stringKey );
+ if( NULL != valueSet )
+ {
+ if( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() )
+ {
+ tet_printf( " Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
+ return false;
+ }
+ }
+ else
+ {
+ tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
} // namespace
int UtcDaliToolkitTextFieldConstructorP(void)
// Check font properties.
field.SetProperty( TextField::Property::FONT_FAMILY, "Setting font family" );
DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
- field.SetProperty( TextField::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), std::string("{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}"), TEST_LOCATION );
+
+ Property::Map fontStyleMapSet;
+ Property::Map fontStyleMapGet;
+ Property::Value* slantValue = NULL;
+
+ fontStyleMapSet.Insert( "weight", "bold" );
+ fontStyleMapSet.Insert( "width", "condensed" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+ field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
+
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
// Reset font style.
- field.SetProperty( TextField::Property::FONT_STYLE, "{\"weight\":\"normal\",\"slant\":\"oblique\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), std::string("{\"weight\":\"normal\",\"slant\":\"oblique\"}"), TEST_LOCATION );
- field.SetProperty( TextField::Property::FONT_STYLE, "{\"slant\":\"roman\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), std::string("{\"slant\":\"normal\"}"), TEST_LOCATION );
- field.SetProperty( TextField::Property::FONT_STYLE, "" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), std::string(""), TEST_LOCATION );
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "normal" );
+ fontStyleMapSet.Insert( "slant", "oblique" );
+ field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
+
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "slant", "roman" );
+ field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+
+ // Replace 'roman' for 'normal'.
+ slantValue = fontStyleMapGet.Find( "slant" );
+ if( NULL != slantValue )
+ {
+ if( "normal" == slantValue->Get<std::string>() )
+ {
+ fontStyleMapGet["slant"] = "roman";
+ }
+ }
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+
+ field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
// Check that the MAX_LENGTH property can be correctly set
const int maxNumberOfCharacters = 20;
// Check input font properties.
field.SetProperty( TextField::Property::INPUT_FONT_FAMILY, "Setting input font family" );
DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_FAMILY ), "Setting input font family", TEST_LOCATION );
- field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}", TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "bold" );
+ fontStyleMapSet.Insert( "width", "condensed" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
field.SetProperty( TextField::Property::INPUT_POINT_SIZE, 12.f );
DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::INPUT_POINT_SIZE ), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
// Reset input font style.
- field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"weight\":\"normal\",\"slant\":\"oblique\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), std::string("{\"weight\":\"normal\",\"slant\":\"oblique\"}"), TEST_LOCATION );
- field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"slant\":\"roman\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), std::string("{\"slant\":\"normal\"}"), TEST_LOCATION );
- field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), std::string(""), TEST_LOCATION );
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "normal" );
+ fontStyleMapSet.Insert( "slant", "oblique" );
+
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "slant", "roman" );
+
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+
+ // Replace 'roman' for 'normal'.
+ slantValue = fontStyleMapGet.Find( "slant" );
+ if( NULL != slantValue )
+ {
+ if( "normal" == slantValue->Get<std::string>() )
+ {
+ fontStyleMapGet["slant"] = "roman";
+ }
+ }
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
// Check the underline property
field.SetProperty( TextField::Property::UNDERLINE, "{\"enable\":\"true\",\"color\":\"red\",\"height\":\"1\"}" );
const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
- const std::string style = field.GetProperty( TextField::Property::INPUT_FONT_STYLE ).Get<std::string>();
- DALI_TEST_EQUALS( style, "{\"weight\":\"bold\"}", TEST_LOCATION );
+ const Property::Map fontStyleMapGet = field.GetProperty( TextField::Property::INPUT_FONT_STYLE ).Get<Property::Map>();
+
+ Property::Map fontStyleMapSet;
+ fontStyleMapSet.Insert( "weight", "bold" );
+
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
}
DALI_TEST_CHECK( inputStyleChangedSignal );
field.SetProperty( TextField::Property::INPUT_COLOR, Color::YELLOW );
- field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
+ Property::Map fontStyleMapSet;
+ fontStyleMapSet.Insert( "weight", "thin" );
+ fontStyleMapSet.Insert( "width", "condensed" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
field.SetProperty( TextField::Property::INPUT_POINT_SIZE, 20.f );
field.SetProperty( TextField::Property::INPUT_UNDERLINE, "underline" );
field.SetProperty( TextField::Property::INPUT_FONT_FAMILY, "Setting input font family" );
DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_FAMILY ), "Setting input font family", TEST_LOCATION );
- field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"weight\":\"bold\",\"slant\":\"italic\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), "{\"weight\":\"bold\",\"slant\":\"italic\"}", TEST_LOCATION );
+ Property::Map fontStyleMapSet;
+ Property::Map fontStyleMapGet;
+
+ fontStyleMapSet.Insert( "weight", "bold" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "width", "expanded" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
- field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"width\":\"expanded\",\"slant\":\"italic\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), "{\"width\":\"expanded\",\"slant\":\"italic\"}", TEST_LOCATION );
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
field.SetProperty( TextField::Property::INPUT_POINT_SIZE, 12.f );
DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::INPUT_POINT_SIZE ), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
field.SetProperty( TextField::Property::TEXT_COLOR, Color::RED );
DALI_TEST_EQUALS( field.GetProperty<Vector4>( TextField::Property::TEXT_COLOR ), Color::RED, TEST_LOCATION );
- field.SetProperty( TextField::Property::FONT_STYLE, "{\"weight\":\"bold\",\"slant\":\"italic\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), "{\"weight\":\"bold\",\"slant\":\"italic\"}", TEST_LOCATION );
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "bold" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+
+ field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
+
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "width", "expanded" );
+
+ field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
- field.SetProperty( TextField::Property::FONT_STYLE, "{\"width\":\"expanded\"}" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), "{\"width\":\"expanded\"}", TEST_LOCATION );
+ fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
END_TEST;
}
const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
+bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet )
+{
+ if( fontStyleMapGet.Count() == fontStyleMapSet.Count() )
+ {
+ for( unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index )
+ {
+ const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue( index );
+
+ Property::Value* valueSet = fontStyleMapSet.Find( valueGet.first.stringKey );
+ if( NULL != valueSet )
+ {
+ if( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() )
+ {
+ tet_printf( " Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
+ return false;
+ }
+ }
+ else
+ {
+ tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
} // namespace
int UtcDaliToolkitTextLabelConstructorP(void)
// Check font properties.
label.SetProperty( TextLabel::Property::FONT_FAMILY, "Setting font family" );
DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
- label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
- DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE ), std::string("{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}"), TEST_LOCATION );
+
+ Property::Map fontStyleMapSet;
+ Property::Map fontStyleMapGet;
+
+ fontStyleMapSet.Insert( "weight", "bold" );
+ fontStyleMapSet.Insert( "width", "condensed" );
+ fontStyleMapSet.Insert( "slant", "italic" );
+ label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
+
+ fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ // Check the old font style format.
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "thin" );
+ fontStyleMapSet.Insert( "width", "expanded" );
+ fontStyleMapSet.Insert( "slant", "oblique" );
+
+ label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}" );
+ fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
label.SetProperty( TextLabel::Property::POINT_SIZE, 10.f );
DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
// Reset font style.
- label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"normal\",\"slant\":\"oblique\"}" );
- DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE ), std::string("{\"weight\":\"normal\",\"slant\":\"oblique\"}"), TEST_LOCATION );
- label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"slant\":\"roman\"}" );
- DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE ), std::string("{\"slant\":\"normal\"}"), TEST_LOCATION );
- label.SetProperty( TextLabel::Property::FONT_STYLE, "" );
- DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE ), std::string(""), TEST_LOCATION );
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "weight", "normal" );
+ fontStyleMapSet.Insert( "slant", "oblique" );
+
+ label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+ fontStyleMapSet.Insert( "slant", "roman" );
+
+ label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+
+ // Replace 'roman' for 'normal'.
+ Property::Value* slantValue = fontStyleMapGet.Find( "slant" );
+ if( NULL != slantValue )
+ {
+ if( "normal" == slantValue->Get<std::string>() )
+ {
+ fontStyleMapGet["slant"] = "roman";
+ }
+ }
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+ fontStyleMapSet.Clear();
+
+ label.SetProperty( TextLabel::Property::FONT_STYLE, fontStyleMapSet );
+ fontStyleMapGet = label.GetProperty<Property::Map>( TextLabel::Property::FONT_STYLE );
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
// Toggle multi-line
label.SetProperty( TextLabel::Property::MULTI_LINE, true );
const char* TEST_RESOURCE_LOCATION = TEST_RESOURCE_DIR "/";
const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
+
+bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet )
+{
+ if( fontStyleMapGet.Count() == fontStyleMapSet.Count() )
+ {
+ for( unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index )
+ {
+ const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue( index );
+
+ Property::Value* valueSet = fontStyleMapSet.Find( valueGet.first.stringKey );
+ if( NULL != valueSet )
+ {
+ if( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() )
+ {
+ tet_printf( " Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
+ return false;
+ }
+ }
+ else
+ {
+ tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
+ return false;
+ }
+ }
+ }
+
+ return true;
}
+} //namespace
+
void dali_visual_startup(void)
{
test_return_value = TET_UNDEF;
propertyMap.Insert( "renderingBackend", static_cast<int>( Toolkit::Text::DEFAULT_RENDERING_BACKEND ) );
propertyMap.Insert( "text", "Hello world" );
propertyMap.Insert( "fontFamily", "TizenSans" );
- propertyMap.Insert( "fontStyle", "{\"weight\":\"bold\"}" );
+
+ Property::Map fontStyleMapSet;
+ fontStyleMapSet.Insert( "weight", "bold" );
+ propertyMap.Insert( "fontStyle", fontStyleMapSet );
+
propertyMap.Insert( "pointSize", 12.f );
propertyMap.Insert( "multiLine", true );
propertyMap.Insert( "horizontalAlignment", "CENTER" );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<std::string>(), "TizenSans", TEST_LOCATION );
- value = resultMap.Find( TextVisual::Property::FONT_STYLE, Property::STRING );
+ value = resultMap.Find( TextVisual::Property::FONT_STYLE, Property::MAP );
DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( value->Get<std::string>(), "{\"weight\":\"bold\"}", TEST_LOCATION );
+
+ Property::Map fontStyleMapGet = value->Get<Property::Map>();
+ DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
value = resultMap.Find( TextVisual::Property::POINT_SIZE, Property::FLOAT );
DALI_TEST_CHECK( value );
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "text", STRING, TEXT )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "textColor", VECTOR4, TEXT_COLOR )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "fontFamily", STRING, FONT_FAMILY )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "fontStyle", STRING, FONT_STYLE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "fontStyle", MAP, FONT_STYLE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "pointSize", FLOAT, POINT_SIZE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "horizontalAlignment", STRING, HORIZONTAL_ALIGNMENT )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "scrollThreshold", FLOAT, SCROLL_THRESHOLD )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "enableMarkup", BOOLEAN, ENABLE_MARKUP )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputColor", VECTOR4, INPUT_COLOR )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputFontFamily", STRING, INPUT_FONT_FAMILY )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputFontStyle", STRING, INPUT_FONT_STYLE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputFontStyle", MAP, INPUT_FONT_STYLE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputPointSize", FLOAT, INPUT_POINT_SIZE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "lineSpacing", FLOAT, LINE_SPACING )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputLineSpacing", FLOAT, INPUT_LINE_SPACING )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "underline", STRING, UNDERLINE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputUnderline", STRING, INPUT_UNDERLINE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "shadow", STRING, SHADOW )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputShadow", STRING, INPUT_SHADOW )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "emboss", STRING, EMBOSS )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputEmboss", STRING, INPUT_EMBOSS )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "outline", STRING, OUTLINE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputOutline", STRING, INPUT_OUTLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "underline", MAP, UNDERLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputUnderline", MAP, INPUT_UNDERLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "shadow", MAP, SHADOW )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputShadow", MAP, INPUT_SHADOW )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "emboss", MAP, EMBOSS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputEmboss", MAP, INPUT_EMBOSS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "outline", MAP, OUTLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputOutline", MAP, INPUT_OUTLINE )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "placeholderText", STRING, PLACEHOLDER_TEXT )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "placeholderTextFocused", STRING, PLACEHOLDER_TEXT_FOCUSED )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "fontFamily", STRING, FONT_FAMILY )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "fontStyle", STRING, FONT_STYLE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "fontStyle", MAP, FONT_STYLE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "pointSize", FLOAT, POINT_SIZE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "maxLength", INTEGER, MAX_LENGTH )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "exceedPolicy", INTEGER, EXCEED_POLICY )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputColor", VECTOR4, INPUT_COLOR )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "enableMarkup", BOOLEAN, ENABLE_MARKUP )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputFontFamily", STRING, INPUT_FONT_FAMILY )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputFontStyle", STRING, INPUT_FONT_STYLE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputFontStyle", MAP, INPUT_FONT_STYLE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputPointSize", FLOAT, INPUT_POINT_SIZE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "underline", STRING, UNDERLINE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputUnderline", STRING, INPUT_UNDERLINE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "shadow", STRING, SHADOW )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputShadow", STRING, INPUT_SHADOW )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "emboss", STRING, EMBOSS )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputEmboss", STRING, INPUT_EMBOSS )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "outline", STRING, OUTLINE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputOutline", STRING, INPUT_OUTLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "underline", MAP, UNDERLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputUnderline", MAP, INPUT_UNDERLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "shadow", MAP, SHADOW )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputShadow", MAP, INPUT_SHADOW )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "emboss", MAP, EMBOSS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputEmboss", MAP, INPUT_EMBOSS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "outline", MAP, OUTLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputOutline", MAP, INPUT_OUTLINE )
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "renderingBackend", INTEGER, RENDERING_BACKEND )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "text", STRING, TEXT )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "fontFamily", STRING, FONT_FAMILY )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "fontStyle", STRING, FONT_STYLE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "fontStyle", MAP, FONT_STYLE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "pointSize", FLOAT, POINT_SIZE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "multiLine", BOOLEAN, MULTI_LINE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "horizontalAlignment", STRING, HORIZONTAL_ALIGNMENT )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollLoopCount", INTEGER, AUTO_SCROLL_LOOP_COUNT )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollGap", FLOAT, AUTO_SCROLL_GAP )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "lineSpacing", FLOAT, LINE_SPACING )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underline", STRING, UNDERLINE )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadow", STRING, SHADOW )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "emboss", STRING, EMBOSS )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "outline", STRING, OUTLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underline", MAP, UNDERLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadow", MAP, SHADOW )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "emboss", MAP, EMBOSS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "outline", MAP, OUTLINE )
DALI_TYPE_REGISTRATION_END()
{
if( controller )
{
- const std::string style = value.Get< std::string >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "Text Control %p FONT_STYLE %s\n", controller.Get(), style.c_str() );
-
- // Parses and applies the style.
Property::Map map;
- ParsePropertyString( style, map );
+ if( Property::STRING == value.GetType() )
+ {
+ const std::string& fontStyleProperties = value.Get<std::string>();
+
+ ParsePropertyString( fontStyleProperties, map );
+ }
+ else
+ {
+ map = value.Get<Property::Map>();
+ }
if( !map.Empty() )
{
}
}
- if( weightDefined || widthDefined || slantDefined )
+ Property::Map map;
+
+ if( weightDefined )
{
- std::string styleString("{");
- if( weightDefined )
+ if( TextAbstraction::FontWeight::NONE != weight )
{
- if( TextAbstraction::FontWeight::NONE != weight )
- {
- const std::string weightStr( GetEnumerationName( weight,
- FONT_WEIGHT_STRING_TABLE,
- FONT_WEIGHT_STRING_TABLE_COUNT ) );
+ const std::string weightStr( GetEnumerationName( weight,
+ FONT_WEIGHT_STRING_TABLE,
+ FONT_WEIGHT_STRING_TABLE_COUNT ) );
- styleString += "\"weight\":\"" + weightStr + "\"";
- }
- else
- {
- weightDefined = false;
- }
+ map.Insert( WEIGHT_KEY, weightStr );
}
+ }
- if( widthDefined )
+ if( widthDefined )
+ {
+ if( TextAbstraction::FontWidth::NONE != width )
{
- if( TextAbstraction::FontWidth::NONE != width )
- {
- const std::string widthStr( GetEnumerationName( width,
- FONT_WIDTH_STRING_TABLE,
- FONT_WIDTH_STRING_TABLE_COUNT ) );
+ const std::string widthStr( GetEnumerationName( width,
+ FONT_WIDTH_STRING_TABLE,
+ FONT_WIDTH_STRING_TABLE_COUNT ) );
- if( weightDefined )
- {
- styleString += ",";
- }
- styleString += "\"width\":\"" + widthStr + "\"";
- }
- else
- {
- widthDefined = false;
- }
+ map.Insert( WIDTH_KEY, widthStr );
}
+ }
- if( slantDefined )
+ if( slantDefined )
+ {
+ if( TextAbstraction::FontSlant::NONE != slant )
{
- if( TextAbstraction::FontSlant::NONE != slant )
- {
- const std::string slantStr( GetEnumerationName( slant,
- FONT_SLANT_STRING_TABLE,
- FONT_SLANT_STRING_TABLE_COUNT ) );
-
- if( weightDefined || widthDefined )
- {
- styleString += ",";
- }
- styleString += "\"slant\":\"" + slantStr + "\"";
- }
- else
- {
- slantDefined = false;
- }
- }
+ const std::string slantStr( GetEnumerationName( slant,
+ FONT_SLANT_STRING_TABLE,
+ FONT_SLANT_STRING_TABLE_COUNT ) );
- if( weightDefined || widthDefined || slantDefined )
- {
- styleString += "}";
+ map.Insert( SLANT_KEY, slantStr );
}
- else
- {
- styleString.clear();
- }
-
- value = styleString;
}
+
+ value = map;
}
}
TEXT, ///< name "text", The text to display in UTF-8 format, type STRING @SINCE_1_1.37
TEXT_COLOR, ///< name "textColor", The text color, type VECTOR4 @SINCE_1_1.37
FONT_FAMILY, ///< name "fontFamily", The requested font family, type STRING @SINCE_1_1.37
- FONT_STYLE, ///< name "fontStyle", The requested font style, type STRING @SINCE_1_1.37
+ FONT_STYLE, ///< name "fontStyle", The requested font style, type STRING or MAP @SINCE_1_2.13
POINT_SIZE, ///< name "pointSize", The size of font in points, type FLOAT @SINCE_1_1.37
HORIZONTAL_ALIGNMENT, ///< name "horizontalAlignment", The text horizontal alignment, type STRING, values "BEGIN", "CENTER", "END" @SINCE_1_1.37
SCROLL_THRESHOLD, ///< name "scrollThreshold" Vertical scrolling will occur if the cursor is this close to the control border, type FLOAT @SINCE_1_1.37
ENABLE_MARKUP, ///< name "enableMarkup", Whether the mark-up processing is enabled. type BOOLEAN @SINCE_1_1.37
INPUT_COLOR, ///< name "inputColor", The color of the new input text, type VECTOR4 @SINCE_1_1.37
INPUT_FONT_FAMILY, ///< name "inputFontFamily", The font's family of the new input text, type STRING @SINCE_1_1.37
- INPUT_FONT_STYLE, ///< name "inputFontStyle", The font's style of the new input text, type STRING @SINCE_1_1.37
+ INPUT_FONT_STYLE, ///< name "inputFontStyle", The font's style of the new input text, type STRING or MAP @SINCE_1_2.13
INPUT_POINT_SIZE, ///< name "inputPointSize", The font's size of the new input text in points, type FLOAT @SINCE_1_1.37
LINE_SPACING, ///< name "lineSpacing", The default extra space between lines in points, type FLOAT @SINCE_1_1.37
INPUT_LINE_SPACING, ///< name "inputLineSpacing" The extra space between lines in points. It affects the whole paragraph where the new input text is inserted, type FLOAT @SINCE_1_1.37
- UNDERLINE, ///< name "underline" The default underline parameters, type STRING @SINCE_1_1.37
- INPUT_UNDERLINE, ///< name "inputUnderline" The underline parameters of the new input text, type STRING @SINCE_1_1.37
- SHADOW, ///< name "shadow" The default shadow parameters, type STRING @SINCE_1_1.37
- INPUT_SHADOW, ///< name "inputShadow" The shadow parameters of the new input text, type STRING @SINCE_1_1.37
- EMBOSS, ///< name "emboss" The default emboss parameters, type STRING @SINCE_1_1.37
- INPUT_EMBOSS, ///< name "inputEmboss" The emboss parameters of the new input text, type STRING @SINCE_1_1.37
- OUTLINE, ///< name "outline" The default outline parameters, type STRING @SINCE_1_1.37
- INPUT_OUTLINE, ///< name "inputOutline" The outline parameters of the new input text, type STRING @SINCE_1_1.37
+ UNDERLINE, ///< name "underline" The default underline parameters, type STRING or MAP @SINCE_1_2.13
+ INPUT_UNDERLINE, ///< name "inputUnderline" The underline parameters of the new input text, type STRING or MAP @SINCE_1_2.13
+ SHADOW, ///< name "shadow" The default shadow parameters, type STRING or MAP @SINCE_1_2.13
+ INPUT_SHADOW, ///< name "inputShadow" The shadow parameters of the new input text, type STRING or MAP @SINCE_1_2.13
+ EMBOSS, ///< name "emboss" The default emboss parameters, type STRING or MAP @SINCE_1_2.13
+ INPUT_EMBOSS, ///< name "inputEmboss" The emboss parameters of the new input text, type STRING or MAP @SINCE_1_2.13
+ OUTLINE, ///< name "outline" The default outline parameters, type STRING or MAP @SINCE_1_2.13
+ INPUT_OUTLINE, ///< name "inputOutline" The outline parameters of the new input text, type STRING or MAP @SINCE_1_2.13
};
};
PLACEHOLDER_TEXT, ///< name "placeholderText", The text to display when the TextField is empty and inactive, type STRING @SINCE_1_0.0
PLACEHOLDER_TEXT_FOCUSED, ///< name "placeholderTextFocused", The text to display when the TextField is empty with key-input focus, type STRING @SINCE_1_0.0
FONT_FAMILY, ///< name "fontFamily", The requested font family, type STRING @SINCE_1_0.0
- FONT_STYLE, ///< name "fontStyle", The requested font style, type STRING @SINCE_1_0.0
+ FONT_STYLE, ///< name "fontStyle", The requested font style, type STRING or MAP @SINCE_1_2.13
POINT_SIZE, ///< name "pointSize", The size of font in points, type FLOAT @SINCE_1_0.0
MAX_LENGTH, ///< name "maxLength" The maximum number of characters that can be inserted, type INTEGER @SINCE_1_0.0
EXCEED_POLICY, ///< name "exceedPolicy" Specifies how the text is truncated when it does not fit, type INTEGER @SINCE_1_0.0
INPUT_COLOR, ///< name "inputColor", The color of the new input text, type VECTOR4 @SINCE_1_0.0
ENABLE_MARKUP, ///< name "enableMarkup", Whether the mark-up processing is enabled. type BOOLEAN @SINCE_1_0.0
INPUT_FONT_FAMILY, ///< name "inputFontFamily", The font's family of the new input text, type STRING @SINCE_1_0.0
- INPUT_FONT_STYLE, ///< name "inputFontStyle", The font's style of the new input text, type STRING @SINCE_1_0.0
+ INPUT_FONT_STYLE, ///< name "inputFontStyle", The font's style of the new input text, type STRING or MAP @SINCE_1_2.13
INPUT_POINT_SIZE, ///< name "inputPointSize", The font's size of the new input text in points, type FLOAT @SINCE_1_0.0
- UNDERLINE, ///< name "underline" The default underline parameters, type STRING @SINCE_1_1.37
- INPUT_UNDERLINE, ///< name "inputUnderline" The underline parameters of the new input text, type STRING @SINCE_1_1.37
- SHADOW, ///< name "shadow" The default shadow parameters, type STRING @SINCE_1_1.37
- INPUT_SHADOW, ///< name "inputShadow" The shadow parameters of the new input text, type STRING @SINCE_1_1.37
- EMBOSS, ///< name "emboss" The default emboss parameters, type STRING @SINCE_1_1.37
- INPUT_EMBOSS, ///< name "inputEmboss" The emboss parameters of the new input text, type STRING @SINCE_1_1.37
- OUTLINE, ///< name "outline" The default outline parameters, type STRING @SINCE_1_1.37
- INPUT_OUTLINE, ///< name "inputOutline" The outline parameters of the new input text, type STRING @SINCE_1_1.37
+ UNDERLINE, ///< name "underline" The default underline parameters, type STRING or MAP @SINCE_1_2.13
+ INPUT_UNDERLINE, ///< name "inputUnderline" The underline parameters of the new input text, type STRING or MAP @SINCE_1_2.13
+ SHADOW, ///< name "shadow" The default shadow parameters, type STRING or MAP @SINCE_1_2.13
+ INPUT_SHADOW, ///< name "inputShadow" The shadow parameters of the new input text, type STRING or MAP @SINCE_1_2.13
+ EMBOSS, ///< name "emboss" The default emboss parameters, type STRING or MAP @SINCE_1_2.13
+ INPUT_EMBOSS, ///< name "inputEmboss" The emboss parameters of the new input text, type STRING or MAP @SINCE_1_2.13
+ OUTLINE, ///< name "outline" The default outline parameters, type STRING or MAP @SINCE_1_2.13
+ INPUT_OUTLINE, ///< name "inputOutline" The outline parameters of the new input text, type STRING or MAP @SINCE_1_2.13
};
};
* Text labels are lightweight, non-editable and do not respond to user input.
*
* @section TextLabelProperties Properties
- * |%Property enum |String name |Type |Writable|Animatable|
- * |----------------------------------|---------------------|--------------|--------|----------|
- * | Property::RENDERING_BACKEND | renderingBackend | INTEGER | O | X |
- * | Property::TEXT | text | STRING | O | X |
- * | Property::FONT_FAMILY | fontFamily | STRING | O | X |
- * | Property::FONT_STYLE | fontStyle | STRING | O | X |
- * | Property::POINT_SIZE | pointSize | FLOAT | O | X |
- * | Property::MULTI_LINE | multiLine | BOOLEAN | O | X |
- * | Property::HORIZONTAL_ALIGNMENT | horizontalAlignment | STRING | O | X |
- * | Property::VERTICAL_ALIGNMENT | verticalAlignment | STRING | O | X |
- * | Property::TEXT_COLOR | textColor | VECTOR4 | O | X |
- * | Property::ENABLE_MARKUP | enableMarkup | BOOLEAN | O | X |
- * | Property::ENABLE_AUTO_SCROLL | enableAutoScroll | BOOLEAN | O | X |
- * | Property::AUTO_SCROLL_SPEED | autoScrollSpeed | INTEGER | O | X |
- * | Property::AUTO_SCROLL_LOOP_COUNT | autoScrollLoopCount | INTEGER | O | X |
- * | Property::AUTO_SCROLL_GAP | autoScrollGap | INTEGER | O | X |
- * | Property::SHADOW | shadow | STRING | O | X |
- * | Property::UNDERLINE | underline | STRING | O | X |
+ * |%Property enum |String name |Type |Writable|Animatable|
+ * |----------------------------------|---------------------|----------------|--------|----------|
+ * | Property::RENDERING_BACKEND | renderingBackend | INTEGER | O | X |
+ * | Property::TEXT | text | STRING | O | X |
+ * | Property::FONT_FAMILY | fontFamily | STRING | O | X |
+ * | Property::FONT_STYLE | fontStyle | STRING or MAP | O | X |
+ * | Property::POINT_SIZE | pointSize | FLOAT | O | X |
+ * | Property::MULTI_LINE | multiLine | BOOLEAN | O | X |
+ * | Property::HORIZONTAL_ALIGNMENT | horizontalAlignment | STRING | O | X |
+ * | Property::VERTICAL_ALIGNMENT | verticalAlignment | STRING | O | X |
+ * | Property::TEXT_COLOR | textColor | VECTOR4 | O | X |
+ * | Property::ENABLE_MARKUP | enableMarkup | BOOLEAN | O | X |
+ * | Property::ENABLE_AUTO_SCROLL | enableAutoScroll | BOOLEAN | O | X |
+ * | Property::AUTO_SCROLL_SPEED | autoScrollSpeed | INTEGER | O | X |
+ * | Property::AUTO_SCROLL_LOOP_COUNT | autoScrollLoopCount | INTEGER | O | X |
+ * | Property::AUTO_SCROLL_GAP | autoScrollGap | INTEGER | O | X |
+ * | Property::SHADOW | shadow | STRING or MAP | O | X |
+ * | Property::UNDERLINE | underline | STRING or MAP | O | X |
*
* @SINCE_1_0.0
*/
/**
* @brief The requested font style to use,
- * @details name "fontStyle", type STRING
- * @SINCE_1_0.0
+ * @details name "fontStyle", type STRING or MAP
+ * @SINCE_1_2.13
*/
FONT_STYLE,
/**
* @brief The default underline parameters.
- * @details name "underline", type STRING.
- * @SINCE_1_1.37
+ * @details name "underline", type MAP.
+ * @SINCE_1_2.13
*/
UNDERLINE,
/**
* @brief The default shadow parameters.
- * @details name "shadow", type STRING.
- * @SINCE_1_1.37
+ * @details name "shadow", type MAP.
+ * @SINCE_1_2.13
*/
SHADOW,
/**
* @brief The default emboss parameters.
- * @details name "emboss", type STRING.
- * @SINCE_1_1.37
+ * @details name "emboss", type MAP.
+ * @SINCE_1_2.13
*/
EMBOSS,
/**
* @brief The default outline parameters.
- * @details name "outline", type STRING.
- * @SINCE_1_1.37
+ * @details name "outline", type MAP.
+ * @SINCE_1_2.13
*/
OUTLINE,
};
/**
* @brief The requested font style to use,
- * @details name "fontStyle", type STRING
- * @SINCE_1_2.11
+ * @details name "fontStyle", type STRING or MAP
+ * @SINCE_1_2.13
*/
FONT_STYLE,
/**
* @brief The default underline parameters.
- * @details name "underline", type STRING.
- * @SINCE_1_2.11
+ * @details name "underline", type STRING or MAP.
+ * @SINCE_1_2.13
*/
UNDERLINE,
/**
* @brief The default shadow parameters.
- * @details name "shadow", type STRING.
- * @SINCE_1_2.11
+ * @details name "shadow", type STRING or MAP.
+ * @SINCE_1_2.13
*/
SHADOW,
/**
* @brief The default emboss parameters.
- * @details name "emboss", type STRING.
- * @SINCE_1_2.11
+ * @details name "emboss", type STRING or MAP.
+ * @SINCE_1_2.13
*/
EMBOSS,
/**
* @brief The default outline parameters.
- * @details name "outline", type STRING.
- * @SINCE_1_2.11
+ * @details name "outline", type STRING or MAP.
+ * @SINCE_1_2.13
*/
OUTLINE,
"label":
{
"pointSize":120,
- "fontStyle":"{\"weight\":\"light\"}"
+ "fontStyle":{"weight":"light"}
}
},
"TextSelectionToolbar":
"label":
{
"pointSize":8,
- "fontStyle":"{\"weight\":\"light\"}"
+ "fontStyle":{"weight":"light"}
}
},
"TextSelectionToolbar":
"label":
{
"pointSize":8,
- "fontStyle":"{\"weight\":\"light\"}"
+ "fontStyle":{"weight":"light"}
}
},
"TextSelectionToolbar":