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;
+}
+
// Negative test for the textChanged signal.
int utcDaliTextFieldTextChangedN(void)
{
ToolkitTestApplication application;
tet_infoline(" utcDaliTextFieldEvent08");
- Dali::Clipboard clipboard = Clipboard::Get();
+ Dali::TextClipboard clipboard = TextClipboard::Get();
clipboard.SetItem("testTextFieldEvent");
// Checks Longpress when only place holder text
application.Render();
field.SetProperty(TextField::Property::TEXT, "Hello");
+ field.SetProperty(TextField::Property::PLACEHOLDER_TEXT, "Placeholder text");
field.SetProperty(TextField::Property::POINT_SIZE, 10.f);
field.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
field.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
application.ProcessEvent(GenerateKey("d", "", "d", 0, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
application.SendNotification();
application.Render();
+ for(unsigned int index = 0u; index < 6u; ++index)
+ {
+ application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
+ application.SendNotification();
+ application.Render();
+ }
map[HiddenInput::Property::MODE] = HiddenInput::Mode::HIDE_ALL;
map[HiddenInput::Property::SUBSTITUTE_CHARACTER] = 0x23;
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;
+}
\ No newline at end of file