const char* const PROPERTY_NAME_INPUT_EMBOSS = "inputEmboss";
const char* const PROPERTY_NAME_OUTLINE = "outline";
const char* const PROPERTY_NAME_INPUT_OUTLINE = "inputOutline";
+ const char* const PROPERTY_NAME_STRIKETHROUGH = "strikethrough";
+ const char* const PROPERTY_NAME_INPUT_STRIKETHROUGH = "inputStrikethrough";
const char* const PROPERTY_NAME_SMOOTH_SCROLL = "smoothScroll";
const char* const PROPERTY_NAME_SMOOTH_SCROLL_DURATION = "smoothScrollDuration";
const char* const PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION = "matchSystemLanguageDirection";
const char* const PROPERTY_NAME_MAX_LENGTH = "maxLength";
const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
+const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE = "enableFontSizeScale";
const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR = "grabHandleColor";
const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP = "enableGrabHandlePopup";
const char* const PROPERTY_NAME_INPUT_METHOD_SETTINGS = "inputMethodSettings";
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_EMBOSS ) == TextEditor::Property::INPUT_EMBOSS );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextEditor::Property::OUTLINE );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_OUTLINE ) == TextEditor::Property::INPUT_OUTLINE );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_STRIKETHROUGH ) == DevelTextEditor::Property::STRIKETHROUGH );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_STRIKETHROUGH ) == DevelTextEditor::Property::INPUT_STRIKETHROUGH );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SMOOTH_SCROLL ) == TextEditor::Property::SMOOTH_SCROLL );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SMOOTH_SCROLL_DURATION ) == TextEditor::Property::SMOOTH_SCROLL_DURATION );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_SCROLL_BAR ) == TextEditor::Property::ENABLE_SCROLL_BAR );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_SELECTION ) == TextEditor::Property::ENABLE_SELECTION );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER ) == TextEditor::Property::PLACEHOLDER );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextEditor::Property::FONT_SIZE_SCALE );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE ) == DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT ) == DevelTextEditor::Property::PLACEHOLDER_TEXT );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR ) == DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_SHIFT_SELECTION ) == DevelTextEditor::Property::ENABLE_SHIFT_SELECTION );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP ) == DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_METHOD_SETTINGS ) == DevelTextEditor::Property::INPUT_METHOD_SETTINGS );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_FILTER ) == DevelTextEditor::Property::INPUT_FILTER );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_STRIKETHROUGH ) == DevelTextEditor::Property::STRIKETHROUGH );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_STRIKETHROUGH ) == DevelTextEditor::Property::INPUT_STRIKETHROUGH );
END_TEST;
}
DALI_TEST_EQUALS( editor.GetProperty<float>( DevelTextEditor::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
editor.SetProperty( DevelTextEditor::Property::FONT_SIZE_SCALE, 1.0f );
+ editor.SetProperty( DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, false );
+ DALI_TEST_EQUALS( editor.GetProperty<bool>( DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE ), false, TEST_LOCATION );
+ editor.SetProperty( DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, true );
+
// Reset font style.
fontStyleMapSet.Clear();
fontStyleMapSet.Insert( "weight", "normal" );
inputFilterMapSet.Clear();
editor.SetProperty(DevelTextEditor::Property::INPUT_FILTER, inputFilterMapSet);
+ // Check the strikethrough property
+
+ Property::Map strikethroughMapSet;
+ Property::Map strikethroughMapGet;
+
+ application.SendNotification();
+ application.Render();
+
+ // Check the input strikethrough property
+
+ strikethroughMapSet.Clear();
+ strikethroughMapGet.Clear();
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::BLUE );
+ strikethroughMapSet.Insert( "height", 2.0f );
+
+ editor.SetProperty( DevelTextEditor::Property::STRIKETHROUGH, strikethroughMapSet );
+
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapGet = editor.GetProperty<Property::Map>( DevelTextEditor::Property::STRIKETHROUGH );
+
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapSet, strikethroughMapGet ), true, TEST_LOCATION );
+
+ // Check the input strikethrough property
+ editor.SetProperty( DevelTextEditor::Property::INPUT_STRIKETHROUGH, "Strikethrough input properties" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( DevelTextEditor::Property::INPUT_STRIKETHROUGH ), std::string("Strikethrough input properties"), TEST_LOCATION );
+
application.SendNotification();
application.Render();
editor.SetProperty( TextEditor::Property::INPUT_SHADOW, "shadow" );
editor.SetProperty( TextEditor::Property::INPUT_EMBOSS, "emboss" );
editor.SetProperty( TextEditor::Property::INPUT_OUTLINE, "outline" );
+ editor.SetProperty( DevelTextEditor::Property::INPUT_STRIKETHROUGH, "strikethrough" );
application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
END_TEST;
}
+ int utcDaliTextEditorStrikethroughPropertyStringP(void)
+ {
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorStrikethroughPropertyStringP");
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK( editor );
+
+ std::string strikethroughSettings1( "{\"enable\":\"true\",\"color\":\"red\",\"height\":\"2\"}" );
+
+ application.GetScene().Add( editor );
+
+ editor.SetProperty( DevelTextEditor::Property::STRIKETHROUGH, strikethroughSettings1 );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( DevelTextEditor::Property::STRIKETHROUGH ), strikethroughSettings1, TEST_LOCATION );
+
+ tet_infoline("Set strikethrough settings with a map");
+ // Check the input strikethrough property
+ Property::Map strikethroughMapSet;
+ Property::Map strikethroughMapGet;
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::BLUE );
+ strikethroughMapSet.Insert( "height", 2.0f );
+
+ editor.SetProperty( DevelTextEditor::Property::STRIKETHROUGH, strikethroughMapSet );
+ strikethroughMapGet = editor.GetProperty<Property::Map>( DevelTextEditor::Property::STRIKETHROUGH );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapSet, strikethroughMapGet ), true, TEST_LOCATION );
+
+ tet_infoline("Set strikethrough settings with a string");
+ editor.SetProperty( DevelTextEditor::Property::STRIKETHROUGH, strikethroughSettings1 );
+ Property::Value value = editor.GetProperty( DevelTextEditor::Property::STRIKETHROUGH );
+ std::string result;
+ value.Get(result);
+ DALI_TEST_EQUALS( result , strikethroughSettings1, TEST_LOCATION );
+
+ tet_infoline("Trying to set invalid strikethrough settings, should not update and stay at previous settings");
+ std::string strikethroughSettingsVoid( "{\"enable\":\"true\",\"coooolor\":\"blue\",\"height\":\"2\"}" );
+ editor.SetProperty( DevelTextEditor::Property::STRIKETHROUGH, strikethroughSettingsVoid );
+ value = editor.GetProperty( TextEditor::Property::UNDERLINE );
+ value.Get(result);
+ DALI_TEST_EQUALS( result , strikethroughSettings1, TEST_LOCATION );
+
+ END_TEST;
+ }
+
int utcDaliTextEditorShadowPropertyStringP(void)
{
ToolkitTestApplication application;
END_TEST;
}
+int utcDaliTextEditorSelectionWithSecondaryCursor(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorSelectionWithSecondaryCursor");
+
+ // Checks if the actor is created.
+
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK( editor );
+
+ application.GetScene().Add( editor );
+
+ editor.SetProperty( TextEditor::Property::ENABLE_MARKUP, true );
+ editor.SetProperty( TextEditor::Property::TEXT, "اللغة العربية\nمرحبا بالجميع\nالسلام عليكم <span font-size='12' font-family='DejaVu Sans' >Hello world</span>" );
+ editor.SetProperty( TextEditor::Property::POINT_SIZE, 12.f );
+ editor.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 50.f ) );
+ editor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ editor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ editor.SetProperty( DevelTextEditor::Property::MIN_LINE_SIZE, 50.f );
+ editor.SetProperty( DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, false );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Tap on the text editor
+ TestGenerateTap( application, 3.0f, 25.0f );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ //Select the last Arabic word (RTL) & some the space before the English (LTR) letters.
+ DevelTextEditor::SelectText( editor, 35, 41 );// This will activate the alternative cursor position and thus 'cursorInfo.isSecondaryCursor' will be true.
+
+ application.SendNotification();
+ application.Render();
+
+ std::string selectedText = editor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT ).Get<std::string>();
+ DALI_TEST_EQUALS( "عليكم ", selectedText, TEST_LOCATION );
+
+ END_TEST;
+}
+
int utcDaliTextEditorSelectionChangedSignal(void)
{
ToolkitTestApplication application;
END_TEST;
}
+ int UtcDaliToolkitTextEditorStrikethroughGeneration(void)
+ {
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextEditorStrikethroughGeneration");
+
+ TextEditor textEditor = TextEditor::New();
+ textEditor.SetProperty( TextEditor::Property::TEXT, "Test" );
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 100.f ) );
+ textEditor.SetProperty( TextEditor::Property::POINT_SIZE, 10) ;
+ textEditor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
+
+ application.GetScene().Add( textEditor );
+ application.SendNotification();
+ application.Render();
+
+ Property::Map strikethroughMapSet;
+ Property::Map strikethroughMapGet;
+
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::RED );
+ strikethroughMapSet.Insert( "height", 2.0f );
+
+ // Check the strikethrough property
+ textEditor.SetProperty( DevelTextEditor::Property::STRIKETHROUGH, strikethroughMapSet );
+ strikethroughMapGet = textEditor.GetProperty<Property::Map>( DevelTextEditor::Property::STRIKETHROUGH );
+ textEditor.SetProperty( TextEditor::Property::TEXT, "Test1" );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapSet.Clear();
+ strikethroughMapGet.Clear();
+
+ END_TEST;
+ }
int utcDaliTextEditorInsertCharacterAfterInitWithResizePolicyNaturalSize(void)
{
application.Render();
END_TEST;
- }
+ }
const char* const PROPERTY_NAME_INPUT_EMBOSS = "inputEmboss";
const char* const PROPERTY_NAME_OUTLINE = "outline";
const char* const PROPERTY_NAME_INPUT_OUTLINE = "inputOutline";
+ const char* const PROPERTY_NAME_STRIKETHROUGH = "strikethrough";
+ const char* const PROPERTY_NAME_INPUT_STRIKETHROUGH = "inputStrikethrough";
const char* const PROPERTY_NAME_HIDDEN_INPUT_SETTINGS = "hiddenInputSettings";
const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP = "enableGrabHandlePopup";
const char* const PROPERTY_NAME_BACKGROUND = "textBackground";
const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
+const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE = "enableFontSizeScale";
const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR = "grabHandleColor";
const char* const PROPERTY_NAME_INPUT_FILTER = "inputFilter";
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER ) == TextField::Property::PLACEHOLDER );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextField::Property::ELLIPSIS );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextField::Property::FONT_SIZE_SCALE );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE ) == DevelTextField::Property::ENABLE_FONT_SIZE_SCALE );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_SHIFT_SELECTION ) == DevelTextField::Property::ENABLE_SHIFT_SELECTION );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_GRAB_HANDLE ) == DevelTextField::Property::ENABLE_GRAB_HANDLE );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION ) == DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_BACKGROUND ) == DevelTextField::Property::BACKGROUND );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_GRAB_HANDLE_COLOR ) == DevelTextField::Property::GRAB_HANDLE_COLOR );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_FILTER ) == DevelTextField::Property::INPUT_FILTER );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_STRIKETHROUGH ) == DevelTextField::Property::STRIKETHROUGH );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_STRIKETHROUGH ) == DevelTextField::Property::INPUT_STRIKETHROUGH );
END_TEST;
}
DALI_TEST_EQUALS( field.GetProperty<float>( DevelTextField::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
field.SetProperty( DevelTextField::Property::FONT_SIZE_SCALE, 1.0f );
+ field.SetProperty( DevelTextField::Property::ENABLE_FONT_SIZE_SCALE, false );
+ DALI_TEST_EQUALS( field.GetProperty<bool>( DevelTextField::Property::ENABLE_FONT_SIZE_SCALE ), false, TEST_LOCATION );
+ field.SetProperty( DevelTextField::Property::ENABLE_FONT_SIZE_SCALE, true );
+
// Reset font style.
fontStyleMapSet.Clear();
fontStyleMapSet.Insert( "weight", "normal" );
DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+ Property::Map strikethroughMapSet;
+ Property::Map strikethroughMapGet;
+
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::RED );
+ strikethroughMapSet.Insert( "height", 2.0f );
+
+ // Check the strikethrough property
+ field.SetProperty( DevelTextField::Property::STRIKETHROUGH, strikethroughMapSet );
+
+ strikethroughMapGet = field.GetProperty<Property::Map>( DevelTextField::Property::STRIKETHROUGH );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
+
+ // Check the input strikethrough property
+ field.SetProperty( DevelTextField::Property::INPUT_STRIKETHROUGH, "Strikethrough input properties" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( DevelTextField::Property::INPUT_STRIKETHROUGH ), std::string("Strikethrough input properties"), TEST_LOCATION );
+
Property::Map underlineMapSet;
Property::Map underlineMapGet;
field.SetProperty( TextField::Property::INPUT_SHADOW, "shadow" );
field.SetProperty( TextField::Property::INPUT_EMBOSS, "emboss" );
field.SetProperty( TextField::Property::INPUT_OUTLINE, "outline" );
+ field.SetProperty( DevelTextField::Property::INPUT_STRIKETHROUGH, "strikethrough" );
// Render and notify
application.SendNotification();
application.SendNotification();
application.Render();
+ // Even if resize, selection should remain.
+ textField.SetProperty( Actor::Property::SIZE, Vector2( 150.f, 50.f ) );
+
+ application.SendNotification();
+ application.Render();
+
// Should be 2 children, the stencil and the layer
DALI_TEST_EQUALS( 2u, textField.GetChildCount(), TEST_LOCATION );
DALI_TEST_EQUALS(oldSelectionEnd, 23, TEST_LOCATION);
END_TEST;
- }
+ }
+
+ int UtcDaliToolkitTextFieldStrikethroughGeneration(void)
+ {
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldStrikethroughGeneration");
+
+ TextField textField = TextField::New();
+ textField.SetProperty( TextField::Property::TEXT, "Test" );
+ textField.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 100.f ) );
+ textField.SetProperty( TextField::Property::POINT_SIZE, 10) ;
+ textField.SetProperty( TextField::Property::FONT_FAMILY, "DejaVu Sans");
+
+ application.GetScene().Add( textField );
+ application.SendNotification();
+ application.Render();
+
+ Property::Map strikethroughMapSet;
+ Property::Map strikethroughMapGet;
+
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::RED );
+ strikethroughMapSet.Insert( "height", 2.0f );
+
+ // Check the strikethrough property
+ textField.SetProperty( DevelTextField::Property::STRIKETHROUGH, strikethroughMapSet );
+ strikethroughMapGet = textField.GetProperty<Property::Map>( DevelTextField::Property::STRIKETHROUGH );
+ textField.SetProperty( TextField::Property::TEXT, "Test1" );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapSet.Clear();
+ strikethroughMapGet.Clear();
+
+ END_TEST;
+ }
+
+ int UtcDaliToolkitTextFieldInputStrikethroughGeneration(void)
+ {
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldInputStrikethroughGeneration");
+
+ TextField textField = TextField::New();
+ textField.SetProperty( TextField::Property::TEXT, "Test" );
+ textField.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 100.f ) );
+ textField.SetProperty( TextField::Property::POINT_SIZE, 10) ;
+ textField.SetProperty( TextField::Property::FONT_FAMILY, "DejaVu Sans");
+
+ application.GetScene().Add( textField );
+ application.SendNotification();
+ application.Render();
+
+ std::string strikethroughSettings1( "{\"enable\":\"true\",\"color\":\"red\",\"height\":\"2\"}" );
+
+ // Check the strikethrough property
+ textField.SetProperty( DevelTextField::Property::INPUT_STRIKETHROUGH, strikethroughSettings1 );
+ textField.SetProperty( TextField::Property::TEXT, "Test1" );
+ DALI_TEST_EQUALS( textField.GetProperty<std::string>( DevelTextField::Property::INPUT_STRIKETHROUGH ), strikethroughSettings1, TEST_LOCATION );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ END_TEST;
+ }
const char* const PROPERTY_NAME_EMBOSS = "emboss";
const char* const PROPERTY_NAME_OUTLINE = "outline";
const char* const PROPERTY_NAME_BACKGROUND = "textBackground";
+ const char* const PROPERTY_NAME_STRIKETHROUGH = "strikethrough";
const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
const char* const PROPERTY_NAME_ELLIPSIS = "ellipsis";
const char* const PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY = "autoScrollLoopDelay";
const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
+const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE = "enableFontSizeScale";
const char* const PROPERTY_NAME_ELLIPSIS_POSITION = "ellipsisPosition";
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextLabel::Property::ELLIPSIS );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY ) == TextLabel::Property::AUTO_SCROLL_LOOP_DELAY );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextLabel::Property::FONT_SIZE_SCALE );
+ DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE ) == DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS_POSITION ) == DevelTextLabel::Property::ELLIPSIS_POSITION );
+ DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_STRIKETHROUGH ) == DevelTextLabel::Property::STRIKETHROUGH );
END_TEST;
}
DALI_TEST_EQUALS( label.GetProperty<float>( DevelTextLabel::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
label.SetProperty( DevelTextLabel::Property::FONT_SIZE_SCALE, 1.0f );
+ label.SetProperty( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE, false );
+ DALI_TEST_EQUALS( label.GetProperty<bool>( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE ), false, TEST_LOCATION );
+ label.SetProperty( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE, true );
+
// Reset font style.
fontStyleMapSet.Clear();
fontStyleMapSet.Insert( "weight", "normal" );
label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ), Color::BLUE, TEST_LOCATION );
+ Property::Map strikethroughMapSet;
+ Property::Map strikethroughMapGet;
+
+ strikethroughMapSet.Insert( "enable", false );
+ strikethroughMapSet.Insert( "color", Color::BLUE );
+ strikethroughMapSet.Insert( "height", 2.0f );
+
+ label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
+
+ strikethroughMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
+
Property::Map underlineMapSet;
Property::Map underlineMapGet;
label.SetProperty( TextLabel::Property::LINE_SPACING, 10.f );
DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ // Check the strikethrough property
+ strikethroughMapSet.Clear();
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::RED );
+ strikethroughMapSet.Insert( "height", 2.0f );
+
+ label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
+
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
+
+ strikethroughMapSet.Clear();
+ strikethroughMapSet.Insert( Toolkit::DevelText::Strikethrough::Property::ENABLE, true );
+ strikethroughMapSet.Insert( Toolkit::DevelText::Strikethrough::Property::COLOR, Color::RED );
+ strikethroughMapSet.Insert( Toolkit::DevelText::Strikethrough::Property::HEIGHT, 2.0f );
+
+ label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
+
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ std::vector<std::string> strikethroughIndicesConversionTable = { "enable", "color","height"};
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet, strikethroughIndicesConversionTable ), true, TEST_LOCATION );
+
+ strikethroughMapSet.Clear();
+
+ Property::Map strikethroughDisabledMapGet;
+ strikethroughDisabledMapGet.Insert( "enable", false );
+ strikethroughDisabledMapGet.Insert( "color", Color::RED );
+ strikethroughDisabledMapGet.Insert( "height", 2.0f );
+
+ label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
+
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughDisabledMapGet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughDisabledMapGet ), true, TEST_LOCATION );
+
// Check the underline property
underlineMapSet.Clear();
underlineMapSet.Insert( "enable", true );
shadowMap.Insert( "offset", Vector2( 1.0f, 1.0f ) );
label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
+ Property::Map strikethroughMap;
+ strikethroughMap.Insert( "enable", true );
+ strikethroughMap.Insert( "color", Color::GREEN );
+ strikethroughMap.Insert( "height", 2.0f );
+ label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMap );
+
try
{
// Render some text with the shared atlas backend
label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
+ Property::Map strikethroughMapSet;
+ strikethroughMapSet.Clear();
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::RED );
+ strikethroughMapSet.Insert( "height", 2.0f );
+ label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
+ label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
+
application.GetScene().Add( label );
application.SendNotification();
END_TEST;
}
+ int UtcDaliToolkitTextlabelStrikethroughExceedsWidthAndHeight(void)
+ {
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelStrikethroughExceedsWidthAndHeight");
+
+ TextLabel label = TextLabel::New();
+ label.SetProperty( TextLabel::Property::TEXT, "Test" );
+ label.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
+
+ //Exeeding BufferWidth
+ label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 400.0f));
+ label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::RIGHT);
+ label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f);
+
+ application.GetScene().Add( label );
+ application.SendNotification();
+ application.Render();
+
+ Property::Map strikethroughMapSet;
+ strikethroughMapSet.Clear();
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::BLUE);
+ strikethroughMapSet.Insert( "height", 2.0f);
+ label.SetProperty( TextLabel::Property::TEXT, "Test1" );
+ label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
+ label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
+ application.GetScene().Add( label );
+ application.SendNotification();
+ application.Render();
+ // Check if the number of renderers is 1.
+ DALI_TEST_EQUALS( 1, label.GetRendererCount(), TEST_LOCATION);
+
+
+ label = TextLabel::New();
+ label.SetProperty( TextLabel::Property::TEXT, "Test" );
+ label.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
+
+ //Exeeding BufferHeight
+ label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 100.0f));
+ label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::RIGHT);
+ label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f);
+
+ application.GetScene().Add( label );
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapSet.Clear();
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::BLUE);
+ strikethroughMapSet.Insert( "height", 2.0f);
+ label.SetProperty( TextLabel::Property::TEXT, "Test2" );
+ label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
+ label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
+ application.GetScene().Add( label );
+ application.SendNotification();
+ application.Render();
+ // Check if the number of renderers is 1.
+ DALI_TEST_EQUALS( 1, label.GetRendererCount(), TEST_LOCATION);
+
+ END_TEST;
+ }
+
int UtcDaliToolkitTextlabelLastCharacterIndex(void)
{
ToolkitTestApplication application;
END_TEST;
}
-
int utcDaliTextLabelGetHeightForWidthChangeLineCountWhenTextChanged(void)
{
ToolkitTestApplication application;
END_TEST;
}
+
+ int UtcDaliToolkitTextLabelStrikethroughGeneration(void)
+ {
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelStrikethroughGeneration");
+
+ TextLabel textLabel = TextLabel::New();
+ textLabel.SetProperty( TextLabel::Property::TEXT, "Test" );
+ textLabel.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 100.f ) );
+ textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 10) ;
+ textLabel.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
+
+ application.GetScene().Add( textLabel );
+ application.SendNotification();
+ application.Render();
+
+ Property::Map strikethroughMapSet;
+ Property::Map strikethroughMapGet;
+
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::RED );
+ strikethroughMapSet.Insert( "height", 2.0f );
+
+ // Check the strikethrough property
+ textLabel.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
+ strikethroughMapGet = textLabel.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
+ textLabel.SetProperty( TextLabel::Property::TEXT, "Test1" );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapSet.Clear();
+ strikethroughMapGet.Clear();
+
+ END_TEST;
+ }
#define DALI_TOOLKIT_TEXT_EDITOR_DEVEL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
FONT_SIZE_SCALE,
/**
+ * @brief True to enable the font size scale or false to disable.
+ * @details Name "enableFontSizeScale", type Property::BOOLEAN.
+ * @note The default value is true.
+ * If false, font size scale is not apppied.
+ */
+ ENABLE_FONT_SIZE_SCALE,
+
+ /**
* @brief The position for primary cursor.
* @details Name "primaryCursorPosition", type Property::INTEGER.
*/
* @note If the font size is larger than the line size, it works with the font size.
*/
MIN_LINE_SIZE,
+
+ /**
+ * @brief A horizontal line through the text center.
+ * @details Name "strikethrough", type Property::MAP.
+ */
+ STRIKETHROUGH,
+
+ /**
+ * @brief The strikethrough parameters of the new input text.
+ * @details Name "inputStrikethrough", type Property::MAP.
+ */
+ INPUT_STRIKETHROUGH,
};
} // namespace Property
#define DALI_TOOLKIT_TEXT_FIELD_DEVEL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
FONT_SIZE_SCALE,
/**
+ * @brief True to enable the font size scale or false to disable.
+ * @details Name "enableFontSizeScale", type Property::BOOLEAN.
+ * @note The default value is true.
+ * If false, font size scale is not apppied.
+ */
+ ENABLE_FONT_SIZE_SCALE,
+
+ /**
* @brief The position for primary cursor.
* @details Name "primaryCursorPosition", type Property::INTEGER.
*/
* @see DevelText::EllipsisPosition
*/
ELLIPSIS_POSITION,
+
+ /**
+ * @brief A horizontal line through the text center.
+ * @details Name "strikethrough", type Property::MAP.
+ */
+ STRIKETHROUGH,
+
+ /**
+ * @brief The strikethrough parameters of the new input text.
+ * @details Name "inputStrikethrough", type Property::MAP.
+ */
+ INPUT_STRIKETHROUGH,
};
} // namespace Property
#define DALI_TOOLKIT_TEXT_LABEL_DEVEL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
FONT_SIZE_SCALE,
/**
+ * @brief True to enable the font size scale or false to disable.
+ * @details Name "enableFontSizeScale", type Property::BOOLEAN.
+ * @note The default value is true.
+ * If false, font size scale is not apppied.
+ */
+ ENABLE_FONT_SIZE_SCALE,
+
+ /**
* @brief The enumerations used to specify whether to position the ellipsis at the END, START or MIDDLE of the text.
* @details Name "EllipsisPosition", type [Type](@ref Dali::Toolkit::DevelText::EllipsisPosition::Type) (Property::INTEGER), or Property::STRING. Read/Write
* @note Default is EllipsisPosition::END.
* @see DevelText::EllipsisPosition
*/
ELLIPSIS_POSITION,
+
+ /**
+ * @brief The default strikethrough parameters.
+ * @details Name "strikethrough", type Property::MAP.
+ *
+ * The strikethrough map contains the following keys:
+ *
+ * | %Property Name | Type | Required | Description |
+ * |----------------------|----------|----------|--------------------------------------------------------------------------------------------------------------------|
+ * | enable | BOOLEAN | No | True to enable the strikethrough or false to disable (the default value is false) |
+ * | color | VECTOR4 | No | The color of the strikethrough (the default value is Color::BLACK) |
+ * | height | FLOAT | No | The height of the strikethrough (the default value is 0) |
+ *
+ */
+ STRIKETHROUGH,
};
} // namespace Property
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "enableEditing", BOOLEAN, ENABLE_EDITING )
DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY(Toolkit, TextEditor, "selectedText", STRING, SELECTED_TEXT )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "fontSizeScale", FLOAT, FONT_SIZE_SCALE )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "enableFontSizeScale", BOOLEAN, ENABLE_FONT_SIZE_SCALE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "primaryCursorPosition", INTEGER, PRIMARY_CURSOR_POSITION )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "grabHandleColor", VECTOR4, GRAB_HANDLE_COLOR )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "enableGrabHandlePopup", BOOLEAN, ENABLE_GRAB_HANDLE_POPUP )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "ellipsis", BOOLEAN, ELLIPSIS )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "ellipsisPosition", INTEGER, ELLIPSIS_POSITION )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "minLineSize", FLOAT, MIN_LINE_SIZE )
+ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "strikethrough", MAP, STRIKETHROUGH )
+ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "inputStrikethrough", MAP, INPUT_STRIKETHROUGH )
DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED )
{
editorInputStyleMask = static_cast<Toolkit::TextEditor::InputStyle::Mask>(editorInputStyleMask | Toolkit::TextEditor::InputStyle::OUTLINE);
}
+ if(InputStyle::NONE != static_cast<InputStyle::Mask>(inputStyleMask & InputStyle::INPUT_STRIKETHROUGH))
+ {
+ editorInputStyleMask = static_cast<Toolkit::TextEditor::InputStyle::Mask>(editorInputStyleMask | Toolkit::TextEditor::InputStyle::STRIKETHROUGH);
+ }
+
return editorInputStyleMask;
}
}
}
-std::string TextEditor::AccessibleImpl::GetName()
+std::string TextEditor::AccessibleImpl::GetName() const
{
auto self = Toolkit::TextEditor::DownCast(Self());
return self.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
}
-std::string TextEditor::AccessibleImpl::GetText(size_t startOffset, size_t endOffset)
+std::string TextEditor::AccessibleImpl::GetText(size_t startOffset, size_t endOffset) const
{
if(endOffset <= startOffset)
{
return text.substr(startOffset, endOffset - startOffset);
}
-size_t TextEditor::AccessibleImpl::GetCharacterCount()
+size_t TextEditor::AccessibleImpl::GetCharacterCount() const
{
auto self = Toolkit::TextEditor::DownCast(Self());
auto text = self.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
return text.size();
}
-size_t TextEditor::AccessibleImpl::GetCursorOffset()
+size_t TextEditor::AccessibleImpl::GetCursorOffset() const
{
auto slf = Toolkit::TextEditor::DownCast(Self());
return Dali::Toolkit::GetImpl(slf).GetTextController()->GetCursorPosition();
return true;
}
-Dali::Accessibility::Range TextEditor::AccessibleImpl::GetTextAtOffset(size_t offset, Dali::Accessibility::TextBoundary boundary)
+Dali::Accessibility::Range TextEditor::AccessibleImpl::GetTextAtOffset(size_t offset, Dali::Accessibility::TextBoundary boundary) const
{
auto self = Toolkit::TextEditor::DownCast(Self());
auto text = self.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
return range;
}
-Dali::Accessibility::Range TextEditor::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex)
+Dali::Accessibility::Range TextEditor::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex) const
{
// Since DALi supports only one selection indexes higher than 0 are ignored
if(selectionIndex > 0)
{
using namespace Dali::Accessibility;
- auto states = DevelControl::AccessibleImpl::CalculateStates();
+ auto states = DevelControl::ControlAccessible::CalculateStates();
states[State::EDITABLE] = true;
states[State::FOCUSABLE] = true;
Toolkit::Control focusControl = Toolkit::KeyInputFocusManager::Get().GetCurrentFocusControl();
- if(mSelf == focusControl)
+ if(Self() == focusControl)
{
states[State::FOCUSED] = true;
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
break;
}
+ case Toolkit::DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ const bool enableFontSizeScale = value.Get<bool>();
+ if(!Equals(impl.mController->IsFontSizeScaleEnabled(), enableFontSizeScale))
+ {
+ impl.mController->SetFontSizeScaleEnabled(enableFontSizeScale);
+ }
+ break;
+ }
case Toolkit::DevelTextEditor::Property::PRIMARY_CURSOR_POSITION:
{
uint32_t position = static_cast<uint32_t>(value.Get<int>());
impl.mRenderer.Reset();
break;
}
+ case Toolkit::DevelTextEditor::Property::STRIKETHROUGH:
+ {
+ const bool update = SetStrikethroughProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
+ if(update)
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::DevelTextEditor::Property::INPUT_STRIKETHROUGH:
+ {
+ const bool update = SetStrikethroughProperties(impl.mController, value, Text::EffectStyle::INPUT);
+ if(update)
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
}
}
value = impl.mController->GetLineWrapMode();
break;
}
+ case Toolkit::DevelTextEditor::Property::STRIKETHROUGH:
+ {
+ GetStrikethroughProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
+ break;
+ }
+ case Toolkit::DevelTextEditor::Property::INPUT_STRIKETHROUGH:
+ {
+ GetStrikethroughProperties(impl.mController, value, Text::EffectStyle::INPUT);
+ break;
+ }
case Toolkit::DevelTextEditor::Property::ENABLE_SHIFT_SELECTION:
{
value = impl.mController->IsShiftSelectionEnabled();
value = impl.mController->GetFontSizeScale();
break;
}
+ case Toolkit::DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ value = impl.mController->IsFontSizeScaleEnabled();
+ break;
+ }
case Toolkit::DevelTextEditor::Property::PRIMARY_CURSOR_POSITION:
{
value = static_cast<int>(impl.mController->GetPrimaryCursorPosition());
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "selectedTextEnd", INTEGER, SELECTED_TEXT_END )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "enableEditing", BOOLEAN, ENABLE_EDITING )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "fontSizeScale", FLOAT, FONT_SIZE_SCALE )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "enableFontSizeScale", BOOLEAN, ENABLE_FONT_SIZE_SCALE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "primaryCursorPosition", INTEGER, PRIMARY_CURSOR_POSITION )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "grabHandleColor", VECTOR4, GRAB_HANDLE_COLOR )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "inputFilter", MAP, INPUT_FILTER )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "ellipsisPosition", INTEGER, ELLIPSIS_POSITION )
+ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "strikethrough", MAP, STRIKETHROUGH )
+ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "inputStrikethrough", MAP, INPUT_STRIKETHROUGH )
DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED )
return mController->GetTextPosition(startIndex, endIndex);
}
-std::string TextField::AccessibleImpl::GetName()
+std::string TextField::AccessibleImpl::GetName() const
{
auto self = Toolkit::TextField::DownCast(Self());
if(IsHiddenInput(self))
return self.GetProperty(Toolkit::TextField::Property::TEXT).Get<std::string>();
}
-std::string TextField::AccessibleImpl::GetText(size_t startOffset, size_t endOffset)
+std::string TextField::AccessibleImpl::GetText(size_t startOffset, size_t endOffset) const
{
if(endOffset <= startOffset)
{
return text.substr(startOffset, endOffset - startOffset);
}
-size_t TextField::AccessibleImpl::GetCharacterCount()
+size_t TextField::AccessibleImpl::GetCharacterCount() const
{
auto self = Toolkit::TextField::DownCast(Self());
auto text = self.GetProperty(Toolkit::TextField::Property::TEXT).Get<std::string>();
return text.size();
}
-size_t TextField::AccessibleImpl::GetCursorOffset()
+size_t TextField::AccessibleImpl::GetCursorOffset() const
{
auto self = Toolkit::TextField::DownCast(Self());
return Dali::Toolkit::GetImpl(self).GetTextController()->GetCursorPosition();
}
Dali::Accessibility::Range TextField::AccessibleImpl::GetTextAtOffset(
- size_t offset, Dali::Accessibility::TextBoundary boundary)
+ size_t offset, Dali::Accessibility::TextBoundary boundary) const
{
auto self = Toolkit::TextField::DownCast(Self());
auto range = Dali::Accessibility::Range{};
return range;
}
-Dali::Accessibility::Range TextField::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex)
+Dali::Accessibility::Range TextField::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex) const
{
// Since DALi supports only one selection indexes higher than 0 are ignored
if(selectionIndex > 0)
{
using namespace Dali::Accessibility;
- auto states = DevelControl::AccessibleImpl::CalculateStates();
+ auto states = DevelControl::ControlAccessible::CalculateStates();
states[State::EDITABLE] = true;
states[State::FOCUSABLE] = true;
Toolkit::Control focusControl = Toolkit::KeyInputFocusManager::Get().GetCurrentFocusControl();
- if(mSelf == focusControl)
+ if(Self() == focusControl)
{
states[State::FOCUSED] = true;
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
break;
}
+ case Toolkit::DevelTextField::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ const bool enableFontSizeScale = value.Get<bool>();
+ if(!Equals(impl.mController->IsFontSizeScaleEnabled(), enableFontSizeScale))
+ {
+ impl.mController->SetFontSizeScaleEnabled(enableFontSizeScale);
+ }
+ break;
+ }
case Toolkit::DevelTextField::Property::PRIMARY_CURSOR_POSITION:
{
uint32_t position = static_cast<uint32_t>(value.Get<int>());
}
break;
}
+ case Toolkit::DevelTextField::Property::STRIKETHROUGH:
+ {
+ const bool update = SetStrikethroughProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
+ if(update)
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::DevelTextField::Property::INPUT_STRIKETHROUGH:
+ {
+ const bool update = SetStrikethroughProperties(impl.mController, value, Text::EffectStyle::INPUT);
+ if(update)
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
}
}
value = impl.mController->GetFontSizeScale();
break;
}
+ case Toolkit::DevelTextField::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ value = impl.mController->IsFontSizeScaleEnabled();
+ break;
+ }
case Toolkit::DevelTextField::Property::PRIMARY_CURSOR_POSITION:
{
value = static_cast<int>(impl.mController->GetPrimaryCursorPosition());
value = impl.mController->GetEllipsisPosition();
break;
}
+ case Toolkit::DevelTextField::Property::STRIKETHROUGH:
+ {
+ GetStrikethroughProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
+ break;
+ }
+ case Toolkit::DevelTextField::Property::INPUT_STRIKETHROUGH:
+ {
+ GetStrikethroughProperties(impl.mController, value, Text::EffectStyle::INPUT);
+ break;
+ }
} //switch
return value;
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "minLineSize", FLOAT, MIN_LINE_SIZE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "renderingBackend", INTEGER, RENDERING_BACKEND )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "fontSizeScale", FLOAT, FONT_SIZE_SCALE )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "enableFontSizeScale", BOOLEAN, ENABLE_FONT_SIZE_SCALE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "ellipsisPosition", INTEGER, ELLIPSIS_POSITION )
+ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "strikethrough", MAP, STRIKETHROUGH )
DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(Toolkit, TextLabel, "textColor", Color::BLACK, TEXT_COLOR )
DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION(Toolkit, TextLabel, "textColorRed", TEXT_COLOR_RED, TEXT_COLOR, 0)
}
break;
}
+ case Toolkit::DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ const bool enableFontSizeScale = value.Get<bool>();
+ if(!Equals(impl.mController->IsFontSizeScaleEnabled(), enableFontSizeScale))
+ {
+ impl.mController->SetFontSizeScaleEnabled(enableFontSizeScale);
+ }
+ break;
+ }
case Toolkit::DevelTextLabel::Property::ELLIPSIS_POSITION:
{
DevelText::EllipsisPosition::Type ellipsisPositionType(static_cast<DevelText::EllipsisPosition::Type>(-1)); // Set to invalid value to ensure a valid mode does get set
}
break;
}
+ case Toolkit::DevelTextLabel::Property::STRIKETHROUGH:
+ {
+ impl.mTextUpdateNeeded = SetStrikethroughProperties(impl.mController, value, Text::EffectStyle::DEFAULT) || impl.mTextUpdateNeeded;
+ break;
+ }
}
// Request relayout when text update is needed. It's necessary to call it
value = impl.mController->GetFontSizeScale();
break;
}
+ case Toolkit::DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ value = impl.mController->IsFontSizeScaleEnabled();
+ break;
+ }
case Toolkit::DevelTextLabel::Property::ELLIPSIS_POSITION:
{
value = impl.mController->GetEllipsisPosition();
break;
}
+ case Toolkit::DevelTextLabel::Property::STRIKETHROUGH:
+ {
+ GetStrikethroughProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
+ break;
+ }
}
}
return mController->GetTextPosition(startIndex, endIndex);
}
-std::string TextLabel::AccessibleImpl::GetNameRaw()
+std::string TextLabel::AccessibleImpl::GetNameRaw() const
{
auto self = Toolkit::TextLabel::DownCast(Self());
return self.GetProperty(Toolkit::TextLabel::Property::TEXT).Get<std::string>();
return Toolkit::TextLabel::Property::TEXT;
}
-std::string TextLabel::AccessibleImpl::GetText(size_t startOffset, size_t endOffset)
+std::string TextLabel::AccessibleImpl::GetText(size_t startOffset, size_t endOffset) const
{
if(endOffset <= startOffset)
{
return text.substr(startOffset, endOffset - startOffset);
}
-size_t TextLabel::AccessibleImpl::GetCharacterCount()
+size_t TextLabel::AccessibleImpl::GetCharacterCount() const
{
auto self = Toolkit::TextLabel::DownCast(Self());
auto text = self.GetProperty(Toolkit::TextLabel::Property::TEXT).Get<std::string>();
return text.size();
}
-size_t TextLabel::AccessibleImpl::GetCursorOffset()
+size_t TextLabel::AccessibleImpl::GetCursorOffset() const
{
return {};
}
return {};
}
-Dali::Accessibility::Range TextLabel::AccessibleImpl::GetTextAtOffset(size_t offset, Dali::Accessibility::TextBoundary boundary)
+Dali::Accessibility::Range TextLabel::AccessibleImpl::GetTextAtOffset(size_t offset, Dali::Accessibility::TextBoundary boundary) const
{
auto self = Toolkit::TextLabel::DownCast(Self());
auto text = self.GetProperty(Toolkit::TextLabel::Property::TEXT).Get<std::string>();
return range;
}
-Dali::Accessibility::Range TextLabel::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex)
+Dali::Accessibility::Range TextLabel::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex) const
{
// Since DALi supports only one selection indexes higher than 0 are ignored
if(selectionIndex > 0)
#define DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
mTextFitMaxSize(DEFAULT_TEXTFIT_MAX),
mTextFitStepSize(DEFAULT_TEXTFIT_STEP),
mFontSizeScale(DEFAULT_FONT_SIZE_SCALE),
+ mFontSizeScaleEnabled(true),
mTextFitEnabled(false),
mTextFitChanged(false),
mIsLayoutDirectionChanged(false)
}
}
+ float GetFontSizeScale()
+ {
+ return mFontSizeScaleEnabled ? mFontSizeScale : 1.0f;
+ }
+
/**
* @brief Helper to notify InputMethodContext with surrounding text & cursor changes.
*/
bool mShadowSetByString : 1; ///< Set when shadow is set by string (legacy) instead of map
bool mOutlineSetByString : 1; ///< Set when outline is set by string (legacy) instead of map
bool mFontStyleSetByString : 1; ///< Set when font style is set by string (legacy) instead of map
+ bool mStrikethroughSetByString : 1; ///< Set when strikethrough is set by string (legacy) instead of map
bool mShouldClearFocusOnEscape : 1; ///< Whether text control should clear key input focus
LayoutDirection::Type mLayoutDirection; ///< Current system language direction
float mTextFitMaxSize; ///< Maximum Font Size for text fit. Default 100
float mTextFitStepSize; ///< Step Size for font intervalse. Default 1
float mFontSizeScale; ///< Scale value for Font Size. Default 1.0
+ bool mFontSizeScaleEnabled : 1; ///< Whether the font size scale is enabled.
bool mTextFitEnabled : 1; ///< Whether the text's fit is enabled.
bool mTextFitChanged : 1; ///< Whether the text fit property has changed.
bool mIsLayoutDirectionChanged : 1; ///< Whether the layout has changed.
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
mImpl->mFontSizeScale = scale;
+ // No relayout is required
+ if(!mImpl->mFontSizeScaleEnabled) return;
+
// Update the cursor position if it's in editing mode
UpdateCursorPosition(mImpl->mEventData);
return mImpl->mFontDefaults ? mImpl->mFontSizeScale : 1.0f;
}
+void Controller::SetFontSizeScaleEnabled(bool enabled)
+{
+ mImpl->mFontSizeScaleEnabled = enabled;
+
+ // Update the cursor position if it's in editing mode
+ UpdateCursorPosition(mImpl->mEventData);
+
+ // Clear the font-specific data
+ mImpl->ClearFontData();
+
+ mImpl->RequestRelayout();
+}
+
+bool Controller::IsFontSizeScaleEnabled() const
+{
+ return mImpl->mFontSizeScaleEnabled;
+}
+
void Controller::SetDefaultFontSize(float fontSize, FontSizeType type)
{
EnsureCreated(mImpl->mFontDefaults);
mImpl->mFontStyleSetByString = setByString;
}
+ void Controller::SetStrikethroughHeight(float height)
+ {
+ mImpl->mModel->mVisualModel->SetStrikethroughHeight(height);
+
+ mImpl->RequestRelayout();
+ }
+
+ float Controller::GetStrikethroughHeight() const
+ {
+ return mImpl->mModel->mVisualModel->GetStrikethroughHeight();
+ }
+
+ void Controller::SetStrikethroughColor(const Vector4& color)
+ {
+ mImpl->mModel->mVisualModel->SetStrikethroughColor(color);
+
+ mImpl->RequestRelayout();
+ }
+
+ const Vector4& Controller::GetStrikethroughColor() const
+ {
+ return mImpl->mModel->mVisualModel->GetStrikethroughColor();
+ }
+
+ void Controller::SetStrikethroughEnabled(bool enabled)
+ {
+ mImpl->mModel->mVisualModel->SetStrikethroughEnabled(enabled);
+
+ mImpl->RequestRelayout();
+ }
+
+ bool Controller::IsStrikethroughEnabled() const
+ {
+ return mImpl->mModel->mVisualModel->IsStrikethroughEnabled();
+ }
+
+ void Controller::SetInputStrikethroughProperties(const std::string& strikethroughProperties)
+ {
+ if(NULL != mImpl->mEventData)
+ {
+ mImpl->mEventData->mInputStyle.strikethroughProperties = strikethroughProperties;
+ }
+ }
+
+ const std::string& Controller::GetInputStrikethroughProperties() const
+ {
+ return (NULL != mImpl->mEventData) ? mImpl->mEventData->mInputStyle.strikethroughProperties : EMPTY_STRING;
+ }
+
+ bool Controller::IsStrikethroughSetByString()
+ {
+ return mImpl->mStrikethroughSetByString;
+ }
+
+ void Controller::StrikethroughSetByString(bool setByString)
+ {
+ mImpl->mStrikethroughSetByString = setByString;
+ }
+
Layout::Engine& Controller::GetLayoutEngine()
{
return mImpl->mLayoutEngine;
#define DALI_TOOLKIT_TEXT_CONTROLLER_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
void FontStyleSetByString(bool setByString);
+ /**
+ * @brief Query if Strikethrough settings were provided by string or map
+ * @return bool true if set by string
+ */
+ bool IsStrikethroughSetByString();
+
+ /**
+ * Set method Strikethrough setting were set by
+ * @param[in] bool, true if set by string
+ */
+ void StrikethroughSetByString(bool setByString);
+
+ /**
+ * @brief Set the override used for strikethrough height, 0 indicates height will be supplied by font metrics
+ *
+ * @param[in] height The height in pixels of the strikethrough
+ */
+ void SetStrikethroughHeight(float height);
+
+ /**
+ * @brief Retrieves the override height of an strikethrough, 0 indicates height is supplied by font metrics
+ *
+ * @return The height of the strikethrough, or 0 if height is not overrided.
+ */
+ float GetStrikethroughHeight() const;
+
+ /**
+ * @brief Set the strikethrough color.
+ *
+ * @param[in] color color of strikethrough.
+ */
+ void SetStrikethroughColor(const Vector4& color);
+
+ /**
+ * @brief Retrieve the strikethrough color.
+ *
+ * @return The strikethrough color.
+ */
+ const Vector4& GetStrikethroughColor() const;
+
+ /**
+ * @brief Set the strikethrough enabled flag.
+ *
+ * @param[in] enabled The strikethrough enabled flag.
+ */
+ void SetStrikethroughEnabled(bool enabled);
+
+ /**
+ * @brief Returns whether the text has a strikethrough or not.
+ *
+ * @return The strikethrough state.
+ */
+ bool IsStrikethroughEnabled() const;
+
public: // Update.
/**
* @brief Replaces any text previously set.
float GetFontSizeScale() const;
/**
+ * @brief Set the font size scale enabled flag.
+ *
+ * @param[in] enabled whether to enable the font size scale.
+ */
+ void SetFontSizeScaleEnabled(bool enabled);
+
+ /**
+ * @brief Returns whether the font size scale is enabled or not.
+ *
+ * @return @e true if the font size scale is enabled, otherwise returns @e false.
+ */
+ bool IsFontSizeScaleEnabled() const;
+
+ /**
* @brief Sets the Placeholder text font size.
* @param[in] fontSize The placeholder text font size
* @param[in] type The font size type is point size or pixel size
const std::string& GetInputOutlineProperties() const;
/**
+ * @brief Sets the input strikethrough's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] strikethroughProperties The strikethrough's properties string.
+ */
+ void SetInputStrikethroughProperties(const std::string& strikethroughProperties);
+
+ /**
+ * @brief Retrieves the input strikethrough's properties string.
+ *
+ * @return The strikethrough's properties string.
+ */
+ const std::string& GetInputStrikethroughProperties() const;
+
+ /**
* @brief Set the control's interface.
*
* @param[in] controlInterface The control's interface.
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
if(lastGlyphIndexOfLine == index)
{
- penY += -line->descender;
+ penY += -line->descender + line->lineSpacing;
// Get the next line.
++lineIndex;
lastGlyphIndexOfLine = (line->isSplitToTwoHalves ? line->glyphRunSecondHalf.glyphIndex + line->glyphRunSecondHalf.numberOfGlyphs : line->glyphRun.glyphIndex + line->glyphRun.numberOfGlyphs) - 1u;
- penY += line->ascender + line->lineSpacing;
+ penY += line->ascender;
}
}
}
return secondMiddleIndexOfElidedGlyphs;
}
+ const Vector4& View::GetStrikethroughColor() const
+ {
+ return (mImpl->mVisualModel) ? mImpl->mVisualModel->GetStrikethroughColor() : Vector4::ZERO;
+ }
+
+ bool View::IsStrikethroughEnabled() const
+ {
+ return (mImpl->mVisualModel) ? mImpl->mVisualModel->IsStrikethroughEnabled() : false;
+ }
+
+ float View::GetStrikethroughHeight() const
+ {
+ return (mImpl->mVisualModel) ? mImpl->mVisualModel->GetStrikethroughHeight() : 0.0f;
+ }
+
} // namespace Text
} // namespace Toolkit