#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/tap-gesture-event.h>
#include <dali/integration-api/events/pan-gesture-event.h>
+#include <dali/integration-api/events/long-press-gesture-event.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
return tap;
}
+Integration::LongPressGestureEvent GenerateLongPress(
+ Gesture::State state,
+ unsigned int numberOfTouches,
+ Vector2 point)
+{
+ Integration::LongPressGestureEvent longPress( state );
+
+ longPress.numberOfTouches = numberOfTouches;
+ longPress.point = point;
+ return longPress;
+}
+
// Generate a PanGestureEvent to send to Core
Integration::PanGestureEvent GeneratePan( Gesture::State state,
const Vector2& previousPosition,
{
const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue( index );
- Property::Value* valueSet = fontStyleMapSet.Find( valueGet.first.stringKey );
+ Property::Value* valueSet = NULL;
+ if ( valueGet.first.type == Property::Key::INDEX )
+ {
+ valueSet = fontStyleMapSet.Find( valueGet.first.indexKey );
+ }
+ else
+ {
+ // Get Key is a string so searching Set Map for a string key
+ valueSet = fontStyleMapSet.Find( valueGet.first.stringKey );
+ }
+
if( NULL != valueSet )
{
if( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() )
}
else
{
- tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
+ if ( valueGet.first.type == Property::Key::INDEX )
+ {
+ tet_printf( " The key %d doesn't exist.", valueGet.first.indexKey );
+ }
+ else
+ {
+ tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
+ }
return false;
}
}
Property::Map shadowMapSet;
Property::Map shadowMapGet;
- shadowMapSet.Insert( "color", "green" );
- shadowMapSet.Insert( "offset", "2 2" );
+ shadowMapSet.Insert( "color", Color::GREEN );
+ shadowMapSet.Insert( "offset", Vector2(2.0f, 2.0f) );
+ shadowMapSet.Insert( "blurRadius", 3.0f );
editor.SetProperty( TextEditor::Property::SHADOW, shadowMapSet );
Property::Map placeholderPixelSizeMapSet;
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["text"] = "Setting Placeholder Text";
+ placeholderPixelSizeMapSet["textFocused"] = "Setting Placeholder Text Focused";
+ placeholderPixelSizeMapSet["color"] = Color::BLUE;
+ placeholderPixelSizeMapSet["fontFamily"] = "Arial";
+ placeholderPixelSizeMapSet["pixelSize"] = 15.0f;
placeholderFontstyleMap.Insert( "weight", "bold" );
- placeholderPixelSizeMapSet["placeholderFontStyle"] = placeholderFontstyleMap;
+ placeholderPixelSizeMapSet["fontStyle"] = placeholderFontstyleMap;
editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderPixelSizeMapSet );
placeholderPixelSizeMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::PLACEHOLDER );
DALI_TEST_EQUALS( placeholderPixelSizeMapGet.Count(), placeholderPixelSizeMapSet.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderPixelSizeMapGet, placeholderPixelSizeMapSet ), true, TEST_LOCATION );
+
+ tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value");
+ Property::Map placeholderConversionMap;
+ placeholderConversionMap[ Text::PlaceHolder::Property::TEXT ] = placeholderPixelSizeMapSet["text"];
+ placeholderConversionMap[ Text::PlaceHolder::Property::TEXT_FOCUSED ] = placeholderPixelSizeMapSet["textFocused"] ;
+ placeholderConversionMap[ Text::PlaceHolder::Property::COLOR ] = placeholderPixelSizeMapSet["color"];
+ placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderPixelSizeMapSet["fontStyle"];
+ placeholderConversionMap[ Text::PlaceHolder::Property::FONT_FAMILY ] = placeholderPixelSizeMapSet["fontFamily"];
+ placeholderConversionMap[ Text::PlaceHolder::Property::PIXEL_SIZE ] = placeholderPixelSizeMapSet["pixelSize"];
+
+ DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderPixelSizeMapGet, placeholderConversionMap ), true, TEST_LOCATION );
// Check the placeholder property with point size
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["text"] = "Setting Placeholder Text";
+ placeholderMapSet["textFocused"] = "Setting Placeholder Text Focused";
+ placeholderMapSet["color"] = Color::RED;
+ placeholderMapSet["fontFamily"] = "Arial";
+ placeholderMapSet["pointSize"] = 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;
+ placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet );
placeholderMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::PLACEHOLDER );
DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderMapSet ), true, TEST_LOCATION );
+
+ tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value");
+ placeholderConversionMap.Clear();
+ placeholderConversionMap[ Text::PlaceHolder::Property::TEXT ] = placeholderMapSet["text"];
+ placeholderConversionMap[ Text::PlaceHolder::Property::TEXT_FOCUSED ] = placeholderMapSet["textFocused"] ;
+ placeholderConversionMap[ Text::PlaceHolder::Property::COLOR ] = placeholderMapSet["color"];
+ placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderPixelSizeMapSet["fontStyle"];
+ placeholderConversionMap[ Text::PlaceHolder::Property::FONT_FAMILY ] = placeholderMapSet["fontFamily"];
+ placeholderConversionMap[ Text::PlaceHolder::Property::POINT_SIZE ] = placeholderMapSet["pointSize"];
+ DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderConversionMap ), true, TEST_LOCATION );
// Reset font style.
placeholderFontstyleMap.Clear();
placeholderFontstyleMap.Insert( "weight", "normal" );
placeholderFontstyleMap.Insert( "slant", "oblique" );
- placeholderMapSet["placeholderFontStyle"] = placeholderFontstyleMap;
+ placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet );
placeholderMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::PLACEHOLDER );
DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderMapSet ), true, TEST_LOCATION );
+ placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderMapSet["fontStyle"];
+ DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderConversionMap ), true, TEST_LOCATION );
placeholderFontstyleMap.Clear();
placeholderFontstyleMap.Insert( "slant", "roman" );
- placeholderMapSet["placeholderFontStyle"] = placeholderFontstyleMap;
+ placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet );
placeholderMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::PLACEHOLDER );
placeholderFontstyleMap.Clear();
- placeholderMapSet["placeholderFontStyle"] = placeholderFontstyleMap;
+ placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet );
placeholderMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::PLACEHOLDER );
DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderMapSet ), true, TEST_LOCATION );
+ placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderMapSet["fontStyle"];
+ DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderConversionMap ), true, TEST_LOCATION );
+
+ editor.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
+ DALI_TEST_EQUALS( editor.GetProperty<int>( Actor::Property::LAYOUT_DIRECTION ), static_cast<int>( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
END_TEST;
}
DALI_TEST_CHECK( renderer );
}
+ // Long Press
+ application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) );
+ application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
END_TEST;
}
TextEditor editor = TextEditor::New();
- std::string shadowSettings( "{\"color\":\"green\",\"offset\":\"2 2\"}" );
+ std::string shadowSettings( "{\"color\":\"green\",\"offset\":\"2 2\",\"blurRadius\":\"0\"}" );
Stage::GetCurrent().Add( editor );
- editor.SetProperty( TextEditor::Property::SHADOW, "{\"color\":\"green\",\"offset\":\"2 2\"}" );
+ editor.SetProperty( TextEditor::Property::SHADOW, "{\"color\":\"green\",\"offset\":\"2 2\",\"blurRadius\":\"0\"}" );
Property::Value value = editor.GetProperty<std::string>( TextEditor::Property::SHADOW );
std::string result;
END_TEST;
}
-int UtcDaliToolkitTextEditorTextWarpMode(void)
+
+int UtcDaliToolkitTextEditorTextWrapMode(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliToolkitTextEditorTextWarpMode");
Stage::GetCurrent().Add( editor );
editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, "WORD" );
+ DALI_TEST_EQUALS( editor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
application.SendNotification();
application.Render();
lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
+ editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, "CHARACTER" );
+ DALI_TEST_EQUALS( editor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
+ application.SendNotification();
+ application.Render();
- editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, "CHARACTER" );
+ lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+ DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );
+
+ editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, Text::LineWrap::WORD );
+ DALI_TEST_EQUALS( editor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
application.SendNotification();
application.Render();
+ lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+ DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
+
+ editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, Text::LineWrap::CHARACTER );
+ DALI_TEST_EQUALS( editor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );
END_TEST;
}
+
+int UtcDaliTextEditorSetPaddingProperty(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliTextEditorSetPaddingProperty\n");
+
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK( editor );
+ editor.SetSize( 300.f, 50.f );
+ editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ Stage::GetCurrent().Add( editor );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector3 originalSize = editor.GetNaturalSize();
+
+ editor.SetProperty( Toolkit::Control::Property::PADDING, Extents( 10, 10, 10, 10 ) );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( editor.GetProperty<Extents>( Toolkit::Control::Property::PADDING ), Extents( 10, 10, 10, 10 ), TEST_LOCATION );
+
+ Vector3 paddingAddedSize = editor.GetNaturalSize();
+
+ DALI_TEST_EQUALS( originalSize.width + 10 + 10 , paddingAddedSize.width, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( originalSize.height + 10 + 10 , paddingAddedSize.height, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ END_TEST;
+}