/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
#include <unistd.h>
#include <iostream>
-
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-field-devel.h>
const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR = "grabHandleColor";
const char* const PROPERTY_NAME_INPUT_FILTER = "inputFilter";
+const char* const PROPERTY_NAME_REMOVE_FRONT_INSET = "removeFrontInset";
+const char* const PROPERTY_NAME_REMOVE_BACK_INSET = "removeBackInset";
+
const Vector4 PLACEHOLDER_TEXT_COLOR(0.8f, 0.8f, 0.8f, 0.8f);
const Dali::Vector4 LIGHT_BLUE(0.75f, 0.96f, 1.f, 1.f); // The text highlight color.
textField.SetProperty(Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, propertyMap);
textField.SetProperty(Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT, propertyMap);
textField.SetProperty(Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT, propertyMap);
- textField.SetProperty(Toolkit::TextField::Property::GRAB_HANDLE_IMAGE, propertyMap);
- textField.SetProperty(Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE, propertyMap);
+ textField.SetProperty(Toolkit::TextField::Property::GRAB_HANDLE_IMAGE, "image.png");
+ textField.SetProperty(Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE, "image.png");
}
/*
return true;
}
-
// Stores data that is populated in the callback and will be read by the test cases
struct SignalData
{
DALI_TEST_CHECK(field.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextField::Property::STRIKETHROUGH);
DALI_TEST_CHECK(field.GetPropertyIndex(PROPERTY_NAME_INPUT_STRIKETHROUGH) == DevelTextField::Property::INPUT_STRIKETHROUGH);
DALI_TEST_CHECK(field.GetPropertyIndex(PROPERTY_NAME_SELECTION_POPUP_STYLE) == DevelTextField::Property::SELECTION_POPUP_STYLE);
+ DALI_TEST_CHECK(field.GetPropertyIndex(PROPERTY_NAME_REMOVE_FRONT_INSET) == DevelTextField::Property::REMOVE_FRONT_INSET);
+ DALI_TEST_CHECK(field.GetPropertyIndex(PROPERTY_NAME_REMOVE_BACK_INSET) == DevelTextField::Property::REMOVE_BACK_INSET);
END_TEST;
}
outlineMapSet["color"] = Color::RED;
outlineMapSet["width"] = 2.0f;
+ outlineMapSet["offset"] = Vector2(0.0f, 0.0f);
+ outlineMapSet["blurRadius"] = 0.0f;
field.SetProperty(TextField::Property::OUTLINE, outlineMapSet);
application.SendNotification();
application.Render();
+ // Check Remove Front/Back Inset Property
+ DALI_TEST_CHECK(!field.GetProperty<bool>(DevelTextField::Property::REMOVE_FRONT_INSET));
+ field.SetProperty(DevelTextField::Property::REMOVE_FRONT_INSET, true);
+ DALI_TEST_CHECK(field.GetProperty<bool>(DevelTextField::Property::REMOVE_FRONT_INSET));
+
+ DALI_TEST_CHECK(!field.GetProperty<bool>(DevelTextField::Property::REMOVE_BACK_INSET));
+ field.SetProperty(DevelTextField::Property::REMOVE_BACK_INSET, true);
+ DALI_TEST_CHECK(field.GetProperty<bool>(DevelTextField::Property::REMOVE_BACK_INSET));
+
+ application.SendNotification();
+ application.Render();
+
+
END_TEST;
}
END_TEST;
}
+int utcDaliTextFieldInputFilterWithInputMethodContext(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldInputFilterWithInputMethodContext");
+ TextField field = TextField::New();
+ DALI_TEST_CHECK(field);
+
+ Property::Map inputFilter;
+ inputFilter[InputFilter::Property::ACCEPTED] = "[\\d]";
+ inputFilter[InputFilter::Property::REJECTED] = "[5-7]";
+
+ // Set input filter to TextField.
+ field.SetProperty(DevelTextField::Property::INPUT_FILTER, inputFilter);
+
+ application.GetScene().Add(field);
+
+ // connect to the input filtered signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ DevelTextField::InputFilteredSignal(field).Connect(&TestInputFilteredCallback);
+ bool inputFilteredSignal = false;
+ field.ConnectSignal(testTracker, "inputFiltered", CallbackFunctor(&inputFilteredSignal));
+
+ // get InputMethodContext
+ std::string text;
+ InputMethodContext::EventData imfEvent;
+ InputMethodContext inputMethodContext = DevelTextField::GetInputMethodContext(field);
+
+ field.SetKeyInputFocus();
+ field.SetProperty(DevelTextField::Property::ENABLE_EDITING, true);
+
+ // input text
+ gInputFilteredAcceptedCallbackCalled = false;
+ imfEvent = InputMethodContext::EventData(InputMethodContext::COMMIT, "Hello1234", 0, 9);
+ inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK(gInputFilteredAcceptedCallbackCalled);
+ DALI_TEST_EQUALS(field.GetProperty<std::string>(TextField::Property::TEXT), std::string("1234"), TEST_LOCATION);
+
+ inputFilteredSignal = false;
+ gInputFilteredRejectedCallbackCalled = false;
+ imfEvent = InputMethodContext::EventData(InputMethodContext::COMMIT, "1234567", 0, 7);
+ inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK(gInputFilteredRejectedCallbackCalled);
+ DALI_TEST_EQUALS(field.GetProperty<std::string>(TextField::Property::TEXT), std::string("12341234"), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int utcDaliTextFieldFocusWithInputMethodContext(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldFocusWithInputMethodContext");
+ TextField field = TextField::New();
+ DALI_TEST_CHECK(field);
+
+ application.GetScene().Add(field);
+ field.SetProperty(DevelTextField::Property::ENABLE_EDITING, true);
+ application.SendNotification();
+ application.Render();
+
+ // get InputMethodContext
+ InputMethodContext inputMethodContext = DevelTextField::GetInputMethodContext(field);
+ DALI_TEST_CHECK(inputMethodContext);
+
+ // connect StatusChangedSignal
+ field.SetKeyInputFocus();
+
+ // keyboard shown
+ inputMethodContext.StatusChangedSignal().Emit(true);
+ application.SendNotification();
+ application.Render();
+
+ // keyboard hidden
+ inputMethodContext.StatusChangedSignal().Emit(false);
+ application.SendNotification();
+ application.Render();
+
+ // set focus and keyboard shown
+ field.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
+ KeyboardFocusManager::Get().SetCurrentFocusActor(field);
+
+ inputMethodContext.StatusChangedSignal().Emit(true);
+ application.SendNotification();
+ application.Render();
+
+ // keyboard hidden, focus should remain
+ inputMethodContext.StatusChangedSignal().Emit(false);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(field, KeyboardFocusManager::Get().GetCurrentFocusActor(), TEST_LOCATION);
+
+ END_TEST;
+}
+
// Negative test for the textChanged signal.
int utcDaliTextFieldTextChangedN(void)
{
END_TEST;
}
+int utcDaliTextFieldInputStyleChanged03(void)
+{
+ // Test InputStyleCahnged signal emitted even if AddIdle failed.
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldInputStyleChanged03");
+
+ // Load some fonts.
+
+ char* pathNamePtr = get_current_dir_name();
+ const std::string pathName(pathNamePtr);
+ free(pathNamePtr);
+
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.SetDpi(93u, 93u);
+
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE);
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE);
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK(field);
+
+ 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, "<font family='DejaVuSerif' size='18'>He<color value='green'>llo</color> <font weight='bold'>world</font> demo</font>");
+
+ // connect to the text changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ field.InputStyleChangedSignal().Connect(&TestInputStyleChangedCallback);
+ bool inputStyleChangedSignal = false;
+ field.ConnectSignal(testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal));
+
+ application.GetScene().Add(field);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 18.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
+ if(gInputStyleChangedCallbackCalled)
+ {
+ DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextField::InputStyle::FONT_FAMILY | TextField::InputStyle::POINT_SIZE), TEST_LOCATION);
+
+ const std::string fontFamily = field.GetProperty(TextField::Property::INPUT_FONT_FAMILY).Get<std::string>();
+ DALI_TEST_EQUALS(fontFamily, "DejaVuSerif", TEST_LOCATION);
+
+ const float pointSize = field.GetProperty(TextField::Property::INPUT_POINT_SIZE).Get<float>();
+ DALI_TEST_EQUALS(pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+ }
+ DALI_TEST_CHECK(inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 30.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
+ DALI_TEST_CHECK(!inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 43.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
+ if(gInputStyleChangedCallbackCalled)
+ {
+ DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextField::InputStyle::COLOR), TEST_LOCATION);
+
+ const Vector4 color = field.GetProperty(TextField::Property::INPUT_COLOR).Get<Vector4>();
+ DALI_TEST_EQUALS(color, Color::GREEN, TEST_LOCATION);
+ }
+ DALI_TEST_CHECK(inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Make AddIdle return false.
+ ToolkitApplication::ADD_IDLE_SUCCESS = false;
+
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 88.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Execute the idle callbacks.
+ // And check whether we didn't change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
+ DALI_TEST_CHECK(!inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 115.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Execute the idle callbacks.
+ // And check whether we didn't change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
+ DALI_TEST_CHECK(!inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Revert AddIdle return true.
+ ToolkitApplication::ADD_IDLE_SUCCESS = true;
+
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 164.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
+ if(gInputStyleChangedCallbackCalled)
+ {
+ DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextField::InputStyle::FONT_STYLE), TEST_LOCATION);
+
+ const std::string style = field.GetProperty(TextField::Property::INPUT_FONT_STYLE).Get<std::string>();
+ DALI_TEST_CHECK(style.empty());
+ }
+ DALI_TEST_CHECK(inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 191.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
+ DALI_TEST_CHECK(!inputStyleChangedSignal);
+
+ END_TEST;
+}
+
int utcDaliTextFieldEvent01(void)
{
ToolkitTestApplication application;
// Tap grab handle
TestGenerateTap(application, 0.0f, 40.0f);
+
+ field.SetProperty(TextField::Property::POINT_SIZE, 12.f);
+ DALI_TEST_EQUALS(field.GetProperty<float>(TextField::Property::INPUT_POINT_SIZE), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+
END_TEST;
}
ToolkitTestApplication application;
tet_infoline(" utcDaliTextFieldEvent08");
- Dali::Clipboard clipboard = Clipboard::Get();
- clipboard.SetItem("testTextFieldEvent");
+ Dali::Clipboard clipboard = Clipboard::Get();
+ Dali::Clipboard::ClipData data("text/plain;charset=utf-8", "testTextFieldEvent");
+ clipboard.SetData(data);
// Checks Longpress when only place holder text
event.AddPoint(GetPointUpInside(position));
application.ProcessEvent(event);
}
- DALI_TEST_EQUALS(field.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("testTextFieldEvent"), TEST_LOCATION);
+ DALI_TEST_EQUALS(field.GetProperty<std::string>(TextField::Property::TEXT), std::string("testTextFieldEvent"), TEST_LOCATION);
+
+ Dali::Clipboard::ClipData htmlData("application/xhtml+xml", "testTextFieldEventHtml");
+ clipboard.SetData(htmlData);
+
+ field.SetProperty(TextField::Property::TEXT, "");
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Long Press
+ TestGenerateLongPress(application, 1.0f, 25.0f, 20);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ Wait(application, 500);
+
+ TestEndLongPress(application, 1.0f, 25.0f, 520);
+
+ // Long Press
+ TestGenerateLongPress(application, 1.0f, 25.0f, 600);
+
+ // Render and notify
+ application.Render();
+
+ Wait(application, 500);
+
+ stage = application.GetScene();
+ layer = stage.GetRootLayer();
+ actor = layer.FindChildByName("optionPaste");
+
+ if(actor)
+ {
+ Vector3 worldPosition = actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION);
+ Vector2 halfStageSize = stage.GetSize() / 2.0f;
+ Vector2 position(worldPosition.x + halfStageSize.width, worldPosition.y + halfStageSize.height);
+
+ Dali::Integration::TouchEvent event;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint(GetPointDownInside(position));
+ application.ProcessEvent(event);
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint(GetPointUpInside(position));
+ application.ProcessEvent(event);
+ }
+ DALI_TEST_EQUALS(field.GetProperty<std::string>(TextField::Property::TEXT), std::string("testTextFieldEventHtml"), TEST_LOCATION);
END_TEST;
}
field.SetProperty(TextField::Property::ENABLE_MARKUP, true);
field.SetProperty(DevelTextField::Property::ELLIPSIS, true);
field.SetProperty(DevelTextField::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::START);
+ field.SetProperty(DevelTextField::Property::REMOVE_FRONT_INSET, true);
+ field.SetProperty(DevelTextField::Property::REMOVE_BACK_INSET, true);
field.SetProperty(TextField::Property::TEXT, "Hello World");
// Avoid a crash when core load gl resources.
Vector<Vector2> expectedPositions;
expectedPositions.PushBack(Vector2(14, 0));
- expectedSizes.PushBack(Vector2(106, 25));
+ expectedSizes.PushBack(Vector2(107, 25));
TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
field.SetProperty(TextField::Property::ENABLE_MARKUP, true);
field.SetProperty(DevelTextField::Property::ELLIPSIS, true);
field.SetProperty(DevelTextField::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::END);
+ field.SetProperty(DevelTextField::Property::REMOVE_FRONT_INSET, true);
+ field.SetProperty(DevelTextField::Property::REMOVE_BACK_INSET, true);
field.SetProperty(TextField::Property::TEXT, "Hello World");
// Avoid a crash when core load gl resources.
Vector<Vector2> expectedPositions;
expectedPositions.PushBack(Vector2(-2, 0));
- expectedSizes.PushBack(Vector2(122, 25));
+ expectedSizes.PushBack(Vector2(123, 25));
TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
Vector<Vector2> expectedPositions;
expectedPositions.PushBack(Vector2(38, 0));
- expectedSizes.PushBack(Vector2(73, 25));
+ expectedSizes.PushBack(Vector2(75, 25));
TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
Vector<Vector2> expectedPositions;
expectedPositions.PushBack(Vector2(6, 0));
- expectedSizes.PushBack(Vector2(124, 25));
+ expectedSizes.PushBack(Vector2(125, 25));
TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
END_TEST;
}
-
int utcDaliTextFieldGeometryNullPtr(void)
{
ToolkitTestApplication application;
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
+ END_TEST;
+}
+
+int utcDaliTextFieldGetTextBoundingRectangle(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldGeometryEllipsisMiddle");
+
+ 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(100.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::TEXT, "Hello this is the Text Bounding Rectangle TC");
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ unsigned int startIndex = 0;
+ unsigned int endIndex = 15;
+
+ Rect<> textBoundingRectangle = DevelTextField::GetTextBoundingRectangle(field, startIndex, endIndex);
+ Rect<> expectedTextBoundingRectangle = {0, 0, 100, 25};
+
+ TestTextGeometryUtils::CheckRectGeometryResult(textBoundingRectangle, expectedTextBoundingRectangle);
+
+ END_TEST;
+}
+
+int utcDaliTextFieldDecoratorColor(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldDecoratorColor");
+ TextField textField = TextField::New();
+ DALI_TEST_CHECK(textField);
+ LoadMarkerImages(application, textField);
+ application.GetScene().Add(textField);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ textField.SetProperty(TextField::Property::TEXT, "العالم Hello");
+ textField.SetProperty(TextField::Property::POINT_SIZE, 10.f);
+ textField.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
+ textField.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ textField.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
+
+ application.SendNotification();
+ application.Render();
+
+ textField.SetKeyInputFocus();
+
+ application.SendNotification();
+ application.Render();
+
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 1.0f, 25.0f, 100);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Double tap to select a word.
+ TestGenerateTap(application, 1.0f, 25.0f, 200);
+
+ application.SendNotification();
+ application.Render();
+
+ // At this point, the text decorator's primary/secondary cursor, grab/left/right handle and highlight actor were all created.
+ // Check some properties for coverage.
+ textField.SetProperty(TextField::Property::PRIMARY_CURSOR_COLOR, Color::RED);
+ DALI_TEST_EQUALS(textField.GetProperty<Vector4>(TextField::Property::PRIMARY_CURSOR_COLOR), Color::RED, TEST_LOCATION);
+
+ textField.SetProperty(TextField::Property::SECONDARY_CURSOR_COLOR, Color::BLUE);
+ DALI_TEST_EQUALS(textField.GetProperty<Vector4>(TextField::Property::SECONDARY_CURSOR_COLOR), Color::BLUE, TEST_LOCATION);
+
+ textField.SetProperty(DevelTextField::Property::GRAB_HANDLE_COLOR, Color::GREEN);
+ DALI_TEST_EQUALS(textField.GetProperty<Vector4>(DevelTextField::Property::GRAB_HANDLE_COLOR), Color::GREEN, TEST_LOCATION);
+
+ textField.SetProperty(TextField::Property::SELECTION_HIGHLIGHT_COLOR, Color::GREEN);
+ DALI_TEST_EQUALS(textField.GetProperty<Vector4>(TextField::Property::SELECTION_HIGHLIGHT_COLOR), Color::GREEN, TEST_LOCATION);
+
+ textField.SetProperty(TextField::Property::CURSOR_WIDTH, 3);
+ DALI_TEST_EQUALS(textField.GetProperty<int>(TextField::Property::CURSOR_WIDTH), 3, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ END_TEST;
+}
+
+int utcDaliTextFieldRemoveFrontInset(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldRemoveFrontInset");
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK(field);
+
+ application.GetScene().Add(field);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(!DevelTextField::IsRemoveFrontInset(field)); // default value is false.
+ DevelTextField::SetRemoveFrontInset(field, true);
+ DALI_TEST_CHECK(DevelTextField::IsRemoveFrontInset(field));
+
+ END_TEST;
+}
+
+int utcDaliTextFieldRemoveBackInset(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldRemoveBackInset");
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK(field);
+
+ application.GetScene().Add(field);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(!DevelTextField::IsRemoveBackInset(field)); // default value is false.
+ DevelTextField::SetRemoveBackInset(field, true);
+ DALI_TEST_CHECK(DevelTextField::IsRemoveBackInset(field));
END_TEST;
}