#include <dali-toolkit/devel-api/text/rendering-backend.h>
#include "toolkit-clipboard.h"
#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
+#include "test-text-geometry-utils.h"
using namespace Dali;
using namespace Toolkit;
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";
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( 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();
END_TEST;
}
+int utcDaliTextFieldGeometryEllipsisStart(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldGeometryEllipsisStart");
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK( field );
+
+ application.GetScene().Add( field );
+
+ field.SetProperty( TextField::Property::POINT_SIZE, 7.f );
+ field.SetProperty( Actor::Property::SIZE, Vector2( 250.f, 50.f ) );
+ field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ field.SetProperty( TextField::Property::ENABLE_MARKUP, true );
+ field.SetProperty( DevelTextField::Property::ELLIPSIS, true );
+ field.SetProperty( DevelTextField::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::START );
+ field.SetProperty( TextField::Property::TEXT, "Hello World" );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ unsigned int expectedCount = 1;
+ unsigned int startIndex = 0;
+ unsigned int endIndex = 10;
+
+ Vector<Vector2> positionsList = DevelTextField::GetTextPosition(field, startIndex, endIndex);
+ Vector<Vector2> sizeList = DevelTextField::GetTextSize(field, startIndex, endIndex);
+
+ DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
+ DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
+
+ Vector<Vector2> expectedSizes;
+ Vector<Vector2> expectedPositions;
+
+ expectedPositions.PushBack(Vector2(14, 0));
+ expectedSizes.PushBack(Vector2(106, 25));
+
+ TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
+
+ END_TEST;
+}
+
+int utcDaliTextFieldGeometryEllipsisEnd(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldGeometryEllipsisEnd");
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK( field );
+
+ application.GetScene().Add( field );
+
+ field.SetProperty( TextField::Property::POINT_SIZE, 7.f );
+ field.SetProperty( Actor::Property::SIZE, Vector2( 250.f, 50.f ) );
+ field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ field.SetProperty( TextField::Property::ENABLE_MARKUP, true );
+ field.SetProperty( DevelTextField::Property::ELLIPSIS, true );
+ field.SetProperty( DevelTextField::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::END );
+ field.SetProperty( TextField::Property::TEXT, "Hello World" );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ unsigned int expectedCount = 1;
+ unsigned int startIndex = 0;
+ unsigned int endIndex = 10;
+
+ Vector<Vector2> positionsList = DevelTextField::GetTextPosition(field, startIndex, endIndex);
+ Vector<Vector2> sizeList = DevelTextField::GetTextSize(field, startIndex, endIndex);
+
+ DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
+ DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
+
+ Vector<Vector2> expectedSizes;
+ Vector<Vector2> expectedPositions;
+
+ expectedPositions.PushBack(Vector2(-2, 0));
+ expectedSizes.PushBack(Vector2(122, 25));
+
+ TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
+
+ END_TEST;
+}
+
+int utcDaliTextFieldGeometryRTL(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldGeometryRTL");
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK( field );
+
+ application.GetScene().Add( field );
+
+ field.SetProperty( TextField::Property::POINT_SIZE, 7.f );
+ field.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) );
+ field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ field.SetProperty( TextField::Property::ENABLE_MARKUP, true );
+ field.SetProperty( TextField::Property::TEXT, "السطر الاخير" );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ unsigned int expectedCount = 1;
+ unsigned int startIndex = 1;
+ unsigned int endIndex = 7;
+
+ Vector<Vector2> positionsList = DevelTextField::GetTextPosition(field, startIndex, endIndex);
+ Vector<Vector2> sizeList = DevelTextField::GetTextSize(field, startIndex, endIndex);
+
+ DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
+ DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
+
+ Vector<Vector2> expectedSizes;
+ Vector<Vector2> expectedPositions;
+
+ expectedPositions.PushBack(Vector2(38, 0));
+ expectedSizes.PushBack(Vector2(73, 25));
+
+ TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
+
+ END_TEST;
+}
+
+int utcDaliTextFieldGeometryGlyphMiddle(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldGeometryGlyphMiddle");
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK( field );
+
+ application.GetScene().Add( field );
+
+ field.SetProperty( TextField::Property::POINT_SIZE, 7.f );
+ field.SetProperty( Actor::Property::SIZE, Vector2( 150.f, 200.f ) );
+ field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ field.SetProperty( TextField::Property::ENABLE_MARKUP, true );
+ field.SetProperty( TextField::Property::TEXT, "لا تحتوي على لا" );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ unsigned int expectedCount = 1;
+ unsigned int startIndex = 1;
+ unsigned int endIndex = 13;
+
+ Vector<Vector2> positionsList = DevelTextField::GetTextPosition(field, startIndex, endIndex);
+ Vector<Vector2> sizeList = DevelTextField::GetTextSize(field, startIndex, endIndex);
+
+ DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
+ DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
+
+ Vector<Vector2> expectedSizes;
+ Vector<Vector2> expectedPositions;
+
+ expectedPositions.PushBack(Vector2(6, 0));
+ expectedSizes.PushBack(Vector2(124, 25));
+
+ TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
+
+ END_TEST;
+}
+
int utcDaliTextFieldSelectionClearedSignal(void)
{
ToolkitTestApplication application;
DALI_TEST_EQUALS(oldSelectionEnd, 23, TEST_LOCATION);
END_TEST;
-}
\ No newline at end of file
+}
+
+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;
+}