2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali-toolkit-test-suite-utils.h>
19 #include <dali-toolkit/dali-toolkit.h>
20 #include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
21 #include <dali-toolkit/devel-api/text/rendering-backend.h>
22 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
23 #include <dali/devel-api/adaptor-framework/clipboard.h>
24 #include <dali/devel-api/adaptor-framework/key-devel.h>
25 #include <dali/devel-api/text-abstraction/font-client.h>
26 #include <dali/integration-api/events/key-event-integ.h>
27 #include <dali/integration-api/events/touch-event-integ.h>
28 #include <dali/public-api/rendering/renderer.h>
32 #include "test-text-geometry-utils.h"
35 using namespace Toolkit;
37 void dali_texteditor_startup(void)
39 test_return_value = TET_UNDEF;
42 void dali_texteditor_cleanup(void)
44 test_return_value = TET_PASS;
49 const char* const PROPERTY_NAME_RENDERING_BACKEND = "renderingBackend";
50 const char* const PROPERTY_NAME_TEXT = "text";
51 const char* const PROPERTY_NAME_TEXT_COLOR = "textColor";
52 const char* const PROPERTY_NAME_FONT_FAMILY = "fontFamily";
53 const char* const PROPERTY_NAME_FONT_STYLE = "fontStyle";
54 const char* const PROPERTY_NAME_POINT_SIZE = "pointSize";
55 const char* const PROPERTY_NAME_HORIZONTAL_ALIGNMENT = "horizontalAlignment";
56 const char* const PROPERTY_NAME_SCROLL_THRESHOLD = "scrollThreshold";
57 const char* const PROPERTY_NAME_SCROLL_SPEED = "scrollSpeed";
58 const char* const PROPERTY_NAME_PRIMARY_CURSOR_COLOR = "primaryCursorColor";
59 const char* const PROPERTY_NAME_SECONDARY_CURSOR_COLOR = "secondaryCursorColor";
60 const char* const PROPERTY_NAME_ENABLE_CURSOR_BLINK = "enableCursorBlink";
61 const char* const PROPERTY_NAME_CURSOR_BLINK_INTERVAL = "cursorBlinkInterval";
62 const char* const PROPERTY_NAME_CURSOR_BLINK_DURATION = "cursorBlinkDuration";
63 const char* const PROPERTY_NAME_CURSOR_WIDTH = "cursorWidth";
64 const char* const PROPERTY_NAME_GRAB_HANDLE_IMAGE = "grabHandleImage";
65 const char* const PROPERTY_NAME_GRAB_HANDLE_PRESSED_IMAGE = "grabHandlePressedImage";
66 const char* const PROPERTY_NAME_SELECTION_HANDLE_IMAGE_LEFT = "selectionHandleImageLeft";
67 const char* const PROPERTY_NAME_SELECTION_HANDLE_IMAGE_RIGHT = "selectionHandleImageRight";
68 const char* const PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_LEFT = "selectionHandlePressedImageLeft";
69 const char* const PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = "selectionHandlePressedImageRight";
70 const char* const PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_LEFT = "selectionHandleMarkerImageLeft";
71 const char* const PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_RIGHT = "selectionHandleMarkerImageRight";
72 const char* const PROPERTY_NAME_SELECTION_HIGHLIGHT_COLOR = "selectionHighlightColor";
73 const char* const PROPERTY_NAME_DECORATION_BOUNDING_BOX = "decorationBoundingBox";
74 const char* const PROPERTY_NAME_ENABLE_MARKUP = "enableMarkup";
75 const char* const PROPERTY_NAME_INPUT_COLOR = "inputColor";
76 const char* const PROPERTY_NAME_INPUT_FONT_FAMILY = "inputFontFamily";
77 const char* const PROPERTY_NAME_INPUT_FONT_STYLE = "inputFontStyle";
78 const char* const PROPERTY_NAME_INPUT_POINT_SIZE = "inputPointSize";
80 const char* const PROPERTY_NAME_LINE_SPACING = "lineSpacing";
81 const char* const PROPERTY_NAME_INPUT_LINE_SPACING = "inputLineSpacing";
82 const char* const PROPERTY_NAME_UNDERLINE = "underline";
83 const char* const PROPERTY_NAME_INPUT_UNDERLINE = "inputUnderline";
84 const char* const PROPERTY_NAME_SHADOW = "shadow";
85 const char* const PROPERTY_NAME_INPUT_SHADOW = "inputShadow";
86 const char* const PROPERTY_NAME_EMBOSS = "emboss";
87 const char* const PROPERTY_NAME_INPUT_EMBOSS = "inputEmboss";
88 const char* const PROPERTY_NAME_OUTLINE = "outline";
89 const char* const PROPERTY_NAME_INPUT_OUTLINE = "inputOutline";
90 const char* const PROPERTY_NAME_STRIKETHROUGH = "strikethrough";
91 const char* const PROPERTY_NAME_INPUT_STRIKETHROUGH = "inputStrikethrough";
93 const char* const PROPERTY_NAME_SMOOTH_SCROLL = "smoothScroll";
94 const char* const PROPERTY_NAME_SMOOTH_SCROLL_DURATION = "smoothScrollDuration";
95 const char* const PROPERTY_NAME_ENABLE_SCROLL_BAR = "enableScrollBar";
96 const char* const PROPERTY_NAME_SCROLL_BAR_SHOW_DURATION = "scrollBarShowDuration";
97 const char* const PROPERTY_NAME_SCROLL_BAR_FADE_DURATION = "scrollBarFadeDuration";
98 const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
99 const char* const PROPERTY_NAME_LINE_COUNT = "lineCount";
100 const char* const PROPERTY_NAME_PLACEHOLDER_TEXT = "placeholderText";
101 const char* const PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR = "placeholderTextColor";
102 const char* const PROPERTY_NAME_ENABLE_SELECTION = "enableSelection";
103 const char* const PROPERTY_NAME_PLACEHOLDER = "placeholder";
104 const char* const PROPERTY_NAME_ENABLE_SHIFT_SELECTION = "enableShiftSelection";
105 const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE = "enableGrabHandle";
106 const char* const PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION = "matchSystemLanguageDirection";
107 const char* const PROPERTY_NAME_MAX_LENGTH = "maxLength";
108 const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
109 const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE = "enableFontSizeScale";
110 const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR = "grabHandleColor";
111 const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP = "enableGrabHandlePopup";
112 const char* const PROPERTY_NAME_INPUT_METHOD_SETTINGS = "inputMethodSettings";
113 const char* const PROPERTY_NAME_INPUT_FILTER = "inputFilter";
115 const Vector4 PLACEHOLDER_TEXT_COLOR(0.8f, 0.8f, 0.8f, 0.8f);
116 const Dali::Vector4 LIGHT_BLUE(0.75f, 0.96f, 1.f, 1.f); // The text highlight color.
118 const float RENDER_FRAME_INTERVAL = 16.66f;
120 const unsigned int DEFAULT_FONT_SIZE = 1152u;
121 const std::string DEFAULT_FONT_DIR("/resources/fonts");
123 const int KEY_A_CODE = 38;
124 const int KEY_D_CODE = 40;
125 const int KEY_C_CODE = 54;
126 const int KEY_V_CODE = 55;
127 const int KEY_X_CODE = 53;
128 const int KEY_WHITE_SPACE_CODE = 65;
130 const int KEY_SHIFT_MODIFIER = 257;
131 const int KEY_CONTROL_MODIFIER = 258;
133 const char* HANDLE_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/insertpoint-icon.png";
134 const char* HANDLE_LEFT_SELECTION_FILE_NAME = TEST_RESOURCE_DIR "/selection_handle_drop_left.png";
135 const char* HANDLE_RIGHT_SELECTION_FILE_NAME = TEST_RESOURCE_DIR "/selection_handle_drop_right.png";
137 const std::string DEFAULT_DEVICE_NAME("hwKeyboard");
139 static bool gSelectionChangedCallbackCalled;
140 static uint32_t oldSelectionStart;
141 static uint32_t oldSelectionEnd;
142 static bool gSelectionClearedCallbackCalled;
143 static bool gSelectionStartedCallbackCalled;
144 static bool gAnchorClickedCallBackCalled;
145 static bool gAnchorClickedCallBackNotCalled;
146 static bool gTextChangedCallBackCalled;
147 static bool gInputFilteredAcceptedCallbackCalled;
148 static bool gInputFilteredRejectedCallbackCalled;
149 static bool gInputStyleChangedCallbackCalled;
150 static bool gMaxCharactersCallBackCalled;
151 static bool gCursorPositionChangedCallbackCalled;
152 static uint32_t oldCursorPos;
153 static Dali::Toolkit::TextEditor::InputStyle::Mask gInputStyleMask;
155 struct CallbackFunctor
157 CallbackFunctor(bool* callbackFlag)
158 : mCallbackFlag(callbackFlag)
164 *mCallbackFlag = true;
169 static void TestSelectionStartedCallback(TextEditor control)
171 tet_infoline(" TestSelectionStartedCallback");
173 gSelectionStartedCallbackCalled = true;
176 static void TestSelectionClearedCallback(TextEditor control)
178 tet_infoline(" TestSelectionClearedCallback");
180 gSelectionClearedCallbackCalled = true;
183 static void TestSelectionChangedCallback(TextEditor control, uint32_t oldStart, uint32_t oldEnd)
185 tet_infoline(" TestSelectionChangedCallback");
187 gSelectionChangedCallbackCalled = true;
188 oldSelectionStart = oldStart;
189 oldSelectionEnd = oldEnd;
192 static void TestAnchorClickedCallback(TextEditor control, const char* href, unsigned int hrefLength)
194 tet_infoline(" TestAnchorClickedCallback");
196 gAnchorClickedCallBackNotCalled = false;
198 if(!strcmp(href, "https://www.tizen.org") && hrefLength == strlen(href))
200 gAnchorClickedCallBackCalled = true;
204 static void TestCursorPositionChangedCallback(TextEditor control, unsigned int oldPos)
206 tet_infoline(" TestCursorPositionChangedCallback");
208 gCursorPositionChangedCallbackCalled = true;
209 oldCursorPos = oldPos;
212 static void TestTextChangedCallback(TextEditor control)
214 tet_infoline(" TestTextChangedCallback");
216 gTextChangedCallBackCalled = true;
219 static void TestInputStyleChangedCallback(TextEditor control, TextEditor::InputStyle::Mask mask)
221 tet_infoline(" TestInputStyleChangedCallback");
223 gInputStyleChangedCallbackCalled = true;
224 gInputStyleMask = mask;
227 static void TestMaxLengthReachedCallback(TextEditor control)
229 tet_infoline(" TestMaxLengthReachedCallback");
231 gMaxCharactersCallBackCalled = true;
234 static void TestInputFilteredCallback(TextEditor control, Toolkit::InputFilter::Property::Type type)
236 tet_infoline(" TestInputFilteredCallback");
238 if(type == Toolkit::InputFilter::Property::ACCEPTED)
240 gInputFilteredAcceptedCallbackCalled = true;
242 else if(type == Toolkit::InputFilter::Property::REJECTED)
244 gInputFilteredRejectedCallbackCalled = true;
248 // Generate a KeyEvent to send to Core.
249 Integration::KeyEvent GenerateKey(const std::string& keyName,
250 const std::string& logicalKey,
251 const std::string& keyString,
254 unsigned long timeStamp,
255 const Integration::KeyEvent::State& keyState,
256 const std::string& compose = "",
257 const std::string& deviceName = DEFAULT_DEVICE_NAME,
258 const Device::Class::Type& deviceClass = Device::Class::NONE,
259 const Device::Subclass::Type& deviceSubclass = Device::Subclass::NONE)
261 return Integration::KeyEvent(keyName,
274 Dali::Integration::Point GetPointDownInside(Vector2& pos)
276 Dali::Integration::Point point;
277 point.SetState(PointState::DOWN);
278 point.SetScreenPosition(pos);
282 Dali::Integration::Point GetPointUpInside(Vector2& pos)
284 Dali::Integration::Point point;
285 point.SetState(PointState::UP);
286 point.SetScreenPosition(pos);
290 bool DaliTestCheckMaps(const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet)
292 if(fontStyleMapGet.Count() == fontStyleMapSet.Count())
294 for(unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index)
296 const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue(index);
298 Property::Value* valueSet = NULL;
299 if(valueGet.first.type == Property::Key::INDEX)
301 valueSet = fontStyleMapSet.Find(valueGet.first.indexKey);
305 // Get Key is a string so searching Set Map for a string key
306 valueSet = fontStyleMapSet.Find(valueGet.first.stringKey);
311 if(valueSet->GetType() == Dali::Property::STRING && (valueGet.second.Get<std::string>() != valueSet->Get<std::string>()))
313 tet_printf("Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str());
316 else if(valueSet->GetType() == Dali::Property::BOOLEAN && (valueGet.second.Get<bool>() != valueSet->Get<bool>()))
318 tet_printf("Value got : [%d], expected : [%d]", valueGet.second.Get<bool>(), valueSet->Get<bool>());
321 else if(valueSet->GetType() == Dali::Property::INTEGER && (valueGet.second.Get<int>() != valueSet->Get<int>()))
323 tet_printf("Value got : [%d], expected : [%d]", valueGet.second.Get<int>(), valueSet->Get<int>());
326 else if(valueSet->GetType() == Dali::Property::FLOAT && (valueGet.second.Get<float>() != valueSet->Get<float>()))
328 tet_printf("Value got : [%f], expected : [%f]", valueGet.second.Get<float>(), valueSet->Get<float>());
331 else if(valueSet->GetType() == Dali::Property::VECTOR2 && (valueGet.second.Get<Vector2>() != valueSet->Get<Vector2>()))
333 Vector2 vector2Get = valueGet.second.Get<Vector2>();
334 Vector2 vector2Set = valueSet->Get<Vector2>();
335 tet_printf("Value got : [%f, %f], expected : [%f, %f]", vector2Get.x, vector2Get.y, vector2Set.x, vector2Set.y);
338 else if(valueSet->GetType() == Dali::Property::VECTOR4 && (valueGet.second.Get<Vector4>() != valueSet->Get<Vector4>()))
340 Vector4 vector4Get = valueGet.second.Get<Vector4>();
341 Vector4 vector4Set = valueSet->Get<Vector4>();
342 tet_printf("Value got : [%f, %f, %f, %f], expected : [%f, %f, %f, %f]", vector4Get.r, vector4Get.g, vector4Get.b, vector4Get.a, vector4Set.r, vector4Set.g, vector4Set.b, vector4Set.a);
348 if(valueGet.first.type == Property::Key::INDEX)
350 tet_printf(" The key %d doesn't exist.", valueGet.first.indexKey);
354 tet_printf(" The key %s doesn't exist.", valueGet.first.stringKey.c_str());
364 class ScrollStateChangeCallback : public Dali::ConnectionTracker
367 ScrollStateChangeCallback(bool& startedCalled, bool& finishedCalled)
368 : mStartedCalled(startedCalled),
369 mFinishedCalled(finishedCalled)
373 void Callback(TextEditor editor, TextEditor::Scroll::Type type)
375 if(type == TextEditor::Scroll::STARTED)
377 mStartedCalled = true;
379 else if(type == TextEditor::Scroll::FINISHED)
381 mFinishedCalled = true;
385 bool& mStartedCalled;
386 bool& mFinishedCalled;
391 int UtcDaliToolkitTextEditorConstructorP(void)
393 ToolkitTestApplication application;
394 tet_infoline(" UtcDaliToolkitTextEditorConstructorP");
395 TextEditor textEditor;
396 DALI_TEST_CHECK(!textEditor);
400 int UtcDaliToolkitTextEditorNewP(void)
402 ToolkitTestApplication application;
403 tet_infoline(" UtcDaliToolkitTextEditorNewP");
404 TextEditor textEditor = TextEditor::New();
405 DALI_TEST_CHECK(textEditor);
409 int UtcDaliToolkitTextEditorDownCastP(void)
411 ToolkitTestApplication application;
412 tet_infoline(" UtcDaliToolkitTextEditorDownCastP");
413 TextEditor textEditor1 = TextEditor::New();
414 BaseHandle object(textEditor1);
416 TextEditor textEditor2 = TextEditor::DownCast(object);
417 DALI_TEST_CHECK(textEditor2);
419 TextEditor textEditor3 = DownCast<TextEditor>(object);
420 DALI_TEST_CHECK(textEditor3);
424 int UtcDaliToolkitTextEditorDownCastN(void)
426 ToolkitTestApplication application;
427 tet_infoline(" UtcDaliToolkitTextEditorDownCastN");
428 BaseHandle uninitializedObject;
429 TextEditor textEditor1 = TextEditor::DownCast(uninitializedObject);
430 DALI_TEST_CHECK(!textEditor1);
432 TextEditor textEditor2 = DownCast<TextEditor>(uninitializedObject);
433 DALI_TEST_CHECK(!textEditor2);
437 int UtcDaliToolkitTextEditorCopyConstructorP(void)
439 ToolkitTestApplication application;
440 tet_infoline(" UtcDaliToolkitTextEditorCopyConstructorP");
441 TextEditor textEditor = TextEditor::New();
442 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
444 TextEditor copy(textEditor);
445 DALI_TEST_CHECK(copy);
446 DALI_TEST_CHECK(copy.GetProperty<std::string>(TextEditor::Property::TEXT) == textEditor.GetProperty<std::string>(TextEditor::Property::TEXT));
450 int UtcDaliTextEditorMoveConstructor(void)
452 ToolkitTestApplication application;
454 TextEditor textEditor = TextEditor::New();
455 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
456 DALI_TEST_CHECK(textEditor.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
458 TextEditor moved = std::move(textEditor);
459 DALI_TEST_CHECK(moved);
460 DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
461 DALI_TEST_CHECK(moved.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
462 DALI_TEST_CHECK(!textEditor);
467 int UtcDaliToolkitTextEditorAssignmentOperatorP(void)
469 ToolkitTestApplication application;
470 tet_infoline(" UtcDaliToolkitTextEditorAssignmentOperatorP");
471 TextEditor textEditor = TextEditor::New();
472 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
474 TextEditor copy = textEditor;
475 DALI_TEST_CHECK(copy);
476 DALI_TEST_CHECK(copy.GetProperty<std::string>(TextEditor::Property::TEXT) == textEditor.GetProperty<std::string>(TextEditor::Property::TEXT));
480 int UtcDaliTextEditorMoveAssignment(void)
482 ToolkitTestApplication application;
484 TextEditor textEditor = TextEditor::New();
485 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
486 DALI_TEST_CHECK(textEditor.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
489 moved = std::move(textEditor);
490 DALI_TEST_CHECK(moved);
491 DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
492 DALI_TEST_CHECK(moved.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
493 DALI_TEST_CHECK(!textEditor);
498 int UtcDaliTextEditorNewP(void)
500 ToolkitTestApplication application;
501 tet_infoline(" UtcDaliToolkitTextEditorNewP");
502 TextEditor textEditor = TextEditor::New();
503 DALI_TEST_CHECK(textEditor);
507 // Positive test case for a method
508 int UtcDaliTextEditorGetPropertyP(void)
510 ToolkitTestApplication application;
511 tet_infoline(" UtcDaliToolkitTextEditorGetPropertyP");
512 TextEditor editor = TextEditor::New();
513 DALI_TEST_CHECK(editor);
515 // Check Property Indices are correct
516 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_RENDERING_BACKEND) == DevelTextEditor::Property::RENDERING_BACKEND);
517 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_TEXT) == TextEditor::Property::TEXT);
518 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_TEXT_COLOR) == TextEditor::Property::TEXT_COLOR);
519 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_FONT_FAMILY) == TextEditor::Property::FONT_FAMILY);
520 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_FONT_STYLE) == TextEditor::Property::FONT_STYLE);
521 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_POINT_SIZE) == TextEditor::Property::POINT_SIZE);
522 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_HORIZONTAL_ALIGNMENT) == TextEditor::Property::HORIZONTAL_ALIGNMENT);
523 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_THRESHOLD) == TextEditor::Property::SCROLL_THRESHOLD);
524 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_SPEED) == TextEditor::Property::SCROLL_SPEED);
525 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PRIMARY_CURSOR_COLOR) == TextEditor::Property::PRIMARY_CURSOR_COLOR);
526 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SECONDARY_CURSOR_COLOR) == TextEditor::Property::SECONDARY_CURSOR_COLOR);
527 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_CURSOR_BLINK) == TextEditor::Property::ENABLE_CURSOR_BLINK);
528 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_CURSOR_BLINK_INTERVAL) == TextEditor::Property::CURSOR_BLINK_INTERVAL);
529 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_CURSOR_BLINK_DURATION) == TextEditor::Property::CURSOR_BLINK_DURATION);
530 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_CURSOR_WIDTH) == TextEditor::Property::CURSOR_WIDTH);
531 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_GRAB_HANDLE_IMAGE) == TextEditor::Property::GRAB_HANDLE_IMAGE);
532 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_GRAB_HANDLE_PRESSED_IMAGE) == TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE);
533 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_IMAGE_LEFT) == TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT);
534 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_IMAGE_RIGHT) == TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT);
535 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_LEFT) == TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT);
536 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT) == TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT);
537 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_LEFT) == TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT);
538 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_RIGHT) == TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT);
539 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HIGHLIGHT_COLOR) == TextEditor::Property::SELECTION_HIGHLIGHT_COLOR);
540 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_DECORATION_BOUNDING_BOX) == TextEditor::Property::DECORATION_BOUNDING_BOX);
541 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_MARKUP) == TextEditor::Property::ENABLE_MARKUP);
542 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_COLOR) == TextEditor::Property::INPUT_COLOR);
543 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_FONT_FAMILY) == TextEditor::Property::INPUT_FONT_FAMILY);
544 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_FONT_STYLE) == TextEditor::Property::INPUT_FONT_STYLE);
545 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_POINT_SIZE) == TextEditor::Property::INPUT_POINT_SIZE);
547 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_LINE_SPACING) == TextEditor::Property::LINE_SPACING);
548 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_LINE_SPACING) == TextEditor::Property::INPUT_LINE_SPACING);
549 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_UNDERLINE) == TextEditor::Property::UNDERLINE);
550 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_UNDERLINE) == TextEditor::Property::INPUT_UNDERLINE);
551 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SHADOW) == TextEditor::Property::SHADOW);
552 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_SHADOW) == TextEditor::Property::INPUT_SHADOW);
553 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_EMBOSS) == TextEditor::Property::EMBOSS);
554 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_EMBOSS) == TextEditor::Property::INPUT_EMBOSS);
555 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_OUTLINE) == TextEditor::Property::OUTLINE);
556 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_OUTLINE) == TextEditor::Property::INPUT_OUTLINE);
557 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextEditor::Property::STRIKETHROUGH);
558 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_STRIKETHROUGH) == DevelTextEditor::Property::INPUT_STRIKETHROUGH);
559 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SMOOTH_SCROLL) == TextEditor::Property::SMOOTH_SCROLL);
560 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SMOOTH_SCROLL_DURATION) == TextEditor::Property::SMOOTH_SCROLL_DURATION);
561 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_SCROLL_BAR) == TextEditor::Property::ENABLE_SCROLL_BAR);
562 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_BAR_SHOW_DURATION) == TextEditor::Property::SCROLL_BAR_SHOW_DURATION);
563 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_BAR_FADE_DURATION) == TextEditor::Property::SCROLL_BAR_FADE_DURATION);
564 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PIXEL_SIZE) == TextEditor::Property::PIXEL_SIZE);
565 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_LINE_COUNT) == TextEditor::Property::LINE_COUNT);
566 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_SELECTION) == TextEditor::Property::ENABLE_SELECTION);
567 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PLACEHOLDER) == TextEditor::Property::PLACEHOLDER);
568 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_FONT_SIZE_SCALE) == DevelTextEditor::Property::FONT_SIZE_SCALE);
569 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE) == DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE);
570 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PLACEHOLDER_TEXT) == DevelTextEditor::Property::PLACEHOLDER_TEXT);
571 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR) == DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR);
572 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_SHIFT_SELECTION) == DevelTextEditor::Property::ENABLE_SHIFT_SELECTION);
573 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_GRAB_HANDLE) == DevelTextEditor::Property::ENABLE_GRAB_HANDLE);
574 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION) == DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION);
575 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_MAX_LENGTH) == DevelTextEditor::Property::MAX_LENGTH);
576 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_GRAB_HANDLE_COLOR) == DevelTextEditor::Property::GRAB_HANDLE_COLOR);
577 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP) == DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP);
578 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_METHOD_SETTINGS) == DevelTextEditor::Property::INPUT_METHOD_SETTINGS);
579 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_FILTER) == DevelTextEditor::Property::INPUT_FILTER);
580 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextEditor::Property::STRIKETHROUGH);
581 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_STRIKETHROUGH) == DevelTextEditor::Property::INPUT_STRIKETHROUGH);
586 bool SetPropertyMapRetrieved(TextEditor& editor, const Property::Index property, const std::string mapKey, const std::string mapValue)
589 Property::Map imageMap;
590 imageMap[mapKey] = mapValue;
592 editor.SetProperty(property, imageMap);
593 Property::Value propValue = editor.GetProperty(property);
594 Property::Map* resultMap = propValue.GetMap();
596 if(resultMap->Find(mapKey)->Get<std::string>() == mapValue)
604 // Positive test case for a method
605 int UtcDaliTextEditorSetPropertyP(void)
607 ToolkitTestApplication application;
608 tet_infoline(" UtcDaliToolkitTextEditorSetPropertyP");
609 TextEditor editor = TextEditor::New();
610 DALI_TEST_CHECK(editor);
611 application.GetScene().Add(editor);
613 // Note - we can't check the defaults since the stylesheets are platform-specific
615 // Check the render backend property.
616 editor.SetProperty(DevelTextEditor::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS);
617 DALI_TEST_EQUALS((DevelText::RenderingType)editor.GetProperty<int>(DevelTextEditor::Property::RENDERING_BACKEND), DevelText::RENDERING_SHARED_ATLAS, TEST_LOCATION);
619 // Check text property.
620 editor.SetProperty(TextEditor::Property::TEXT, "Setting Text");
621 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("Setting Text"), TEST_LOCATION);
623 // Check text's color property
624 editor.SetProperty(TextEditor::Property::TEXT_COLOR, Color::WHITE);
625 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::TEXT_COLOR), Color::WHITE, TEST_LOCATION);
627 // Check font properties.
628 editor.SetProperty(TextEditor::Property::FONT_FAMILY, "Setting font family");
629 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::FONT_FAMILY), std::string("Setting font family"), TEST_LOCATION);
631 Property::Map fontStyleMapSet;
632 Property::Map fontStyleMapGet;
633 Property::Value* slantValue = NULL;
635 fontStyleMapSet.Insert("weight", "bold");
636 fontStyleMapSet.Insert("width", "condensed");
637 fontStyleMapSet.Insert("slant", "italic");
639 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
640 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
641 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
642 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
644 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
645 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::POINT_SIZE), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
647 editor.SetProperty(DevelTextEditor::Property::FONT_SIZE_SCALE, 2.5f);
648 DALI_TEST_EQUALS(editor.GetProperty<float>(DevelTextEditor::Property::FONT_SIZE_SCALE), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
649 editor.SetProperty(DevelTextEditor::Property::FONT_SIZE_SCALE, 1.0f);
651 editor.SetProperty(DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, false);
652 DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE), false, TEST_LOCATION);
653 editor.SetProperty(DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, true);
656 fontStyleMapSet.Clear();
657 fontStyleMapSet.Insert("weight", "normal");
658 fontStyleMapSet.Insert("slant", "oblique");
659 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
660 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
661 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
662 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
664 fontStyleMapSet.Clear();
665 fontStyleMapSet.Insert("slant", "roman");
666 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
667 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
669 // Replace 'roman' for 'normal'.
670 slantValue = fontStyleMapGet.Find("slant");
671 if(NULL != slantValue)
673 if("normal" == slantValue->Get<std::string>())
675 fontStyleMapGet["slant"] = "roman";
678 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
679 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
681 fontStyleMapSet.Clear();
683 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
684 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
685 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
686 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
688 // Check that the Alignment properties can be correctly set
689 editor.SetProperty(TextEditor::Property::HORIZONTAL_ALIGNMENT, "END");
690 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::HORIZONTAL_ALIGNMENT), "END", TEST_LOCATION);
692 // Check scroll properties.
693 editor.SetProperty(TextEditor::Property::SCROLL_THRESHOLD, 1.f);
694 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_THRESHOLD), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
695 editor.SetProperty(TextEditor::Property::SCROLL_SPEED, 100.f);
696 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_SPEED), 100.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
698 // Check cursor properties
699 editor.SetProperty(TextEditor::Property::PRIMARY_CURSOR_COLOR, Color::RED);
700 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::PRIMARY_CURSOR_COLOR), Color::RED, TEST_LOCATION);
701 editor.SetProperty(TextEditor::Property::SECONDARY_CURSOR_COLOR, Color::BLUE);
702 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::SECONDARY_CURSOR_COLOR), Color::BLUE, TEST_LOCATION);
704 editor.SetProperty(TextEditor::Property::ENABLE_CURSOR_BLINK, false);
705 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_CURSOR_BLINK), false, TEST_LOCATION);
706 editor.SetProperty(TextEditor::Property::CURSOR_BLINK_INTERVAL, 1.f);
707 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::CURSOR_BLINK_INTERVAL), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
708 editor.SetProperty(TextEditor::Property::CURSOR_BLINK_DURATION, 10.f);
709 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::CURSOR_BLINK_DURATION), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
710 editor.SetProperty(TextEditor::Property::CURSOR_WIDTH, 1);
711 DALI_TEST_EQUALS(editor.GetProperty<int>(TextEditor::Property::CURSOR_WIDTH), 1, TEST_LOCATION);
713 // Check handle images
714 editor.SetProperty(TextEditor::Property::GRAB_HANDLE_IMAGE, "image1");
715 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::GRAB_HANDLE_IMAGE), "image1", TEST_LOCATION);
716 editor.SetProperty(TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE, "image2");
717 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE), "image2", TEST_LOCATION);
718 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, "image3");
720 // Check handle images
721 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, "filename", "leftHandleImage"));
722 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT, "filename", "rightHandleImage"));
723 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT, "filename", "leftHandleImagePressed"));
724 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, "filename", "rightHandleImagePressed"));
725 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT, "filename", "leftHandleMarkerImage"));
726 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT, "filename", "rightHandleMarkerImage"));
728 // Check the highlight color
729 editor.SetProperty(TextEditor::Property::SELECTION_HIGHLIGHT_COLOR, Color::GREEN);
730 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::SELECTION_HIGHLIGHT_COLOR), Color::GREEN, TEST_LOCATION);
732 // Decoration bounding box
733 editor.SetProperty(TextEditor::Property::DECORATION_BOUNDING_BOX, Rect<int>(0, 0, 1, 1));
734 DALI_TEST_EQUALS(editor.GetProperty<Rect<int> >(TextEditor::Property::DECORATION_BOUNDING_BOX), Rect<int>(0, 0, 1, 1), TEST_LOCATION);
736 // Check the enable markup property.
737 DALI_TEST_CHECK(!editor.GetProperty<bool>(TextEditor::Property::ENABLE_MARKUP));
738 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
739 DALI_TEST_CHECK(editor.GetProperty<bool>(TextEditor::Property::ENABLE_MARKUP));
741 // Check input color property.
742 editor.SetProperty(TextEditor::Property::INPUT_COLOR, Color::YELLOW);
743 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::INPUT_COLOR), Color::YELLOW, TEST_LOCATION);
745 // Check input font properties.
746 editor.SetProperty(TextEditor::Property::INPUT_FONT_FAMILY, "Setting input font family");
747 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_FONT_FAMILY), "Setting input font family", TEST_LOCATION);
749 fontStyleMapSet.Clear();
750 fontStyleMapSet.Insert("weight", "bold");
751 fontStyleMapSet.Insert("width", "condensed");
752 fontStyleMapSet.Insert("slant", "italic");
754 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
755 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
756 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
757 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
759 editor.SetProperty(TextEditor::Property::INPUT_POINT_SIZE, 12.f);
760 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::INPUT_POINT_SIZE), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
762 // Reset input font style.
763 fontStyleMapSet.Clear();
764 fontStyleMapSet.Insert("weight", "normal");
765 fontStyleMapSet.Insert("slant", "oblique");
767 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
768 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
769 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
770 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
772 fontStyleMapSet.Clear();
773 fontStyleMapSet.Insert("slant", "roman");
775 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
776 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
778 // Replace 'roman' for 'normal'.
779 slantValue = fontStyleMapGet.Find("slant");
780 if(NULL != slantValue)
782 if("normal" == slantValue->Get<std::string>())
784 fontStyleMapGet["slant"] = "roman";
787 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
788 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
790 fontStyleMapSet.Clear();
792 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
793 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
794 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
795 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
797 // Check the line spacing property
798 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::LINE_SPACING), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
799 editor.SetProperty(TextEditor::Property::LINE_SPACING, 10.f);
800 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::LINE_SPACING), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
802 // Check the input line spacing property
803 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::INPUT_LINE_SPACING), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
804 editor.SetProperty(TextEditor::Property::INPUT_LINE_SPACING, 20.f);
805 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::INPUT_LINE_SPACING), 20.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
807 // Check the underline property
809 Property::Map underlineMapSet;
810 Property::Map underlineMapGet;
812 underlineMapSet.Insert("enable", true);
813 underlineMapSet.Insert("color", Color::RED);
814 underlineMapSet.Insert("height", 1);
815 underlineMapSet.Insert("type", Text::Underline::SOLID);
816 underlineMapSet.Insert("dashWidth", 5);
817 underlineMapSet.Insert("dashGap", 3);
819 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
821 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
822 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
823 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
825 application.SendNotification();
826 application.Render();
828 // Check the dashed underline property
830 underlineMapSet.Clear();
831 underlineMapGet.Clear();
833 underlineMapSet.Insert("enable", true);
834 underlineMapSet.Insert("color", Color::RED);
835 underlineMapSet.Insert("height", 1);
836 underlineMapSet.Insert("type", Text::Underline::DASHED);
837 underlineMapSet.Insert("dashWidth", 5);
838 underlineMapSet.Insert("dashGap", 3);
840 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
842 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
843 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
844 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
846 application.SendNotification();
847 application.Render();
849 underlineMapSet.Clear();
850 underlineMapGet.Clear();
852 // Check the double underline property
854 underlineMapSet.Clear();
855 underlineMapGet.Clear();
857 underlineMapSet.Insert("enable", true);
858 underlineMapSet.Insert("color", Color::RED);
859 underlineMapSet.Insert("height", 1);
860 underlineMapSet.Insert("type", Text::Underline::DOUBLE);
861 underlineMapSet.Insert("dashWidth", 5);
862 underlineMapSet.Insert("dashGap", 3);
864 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
866 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
867 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
868 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
870 application.SendNotification();
871 application.Render();
873 underlineMapSet.Clear();
874 underlineMapGet.Clear();
876 // Check the input underline property
877 editor.SetProperty(TextEditor::Property::INPUT_UNDERLINE, "Underline input properties");
878 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_UNDERLINE), std::string("Underline input properties"), TEST_LOCATION);
880 // Check the shadow property
881 Property::Map shadowMapSet;
882 Property::Map shadowMapGet;
884 shadowMapSet.Insert("color", Color::GREEN);
885 shadowMapSet.Insert("offset", Vector2(2.0f, 2.0f));
886 shadowMapSet.Insert("blurRadius", 3.0f);
888 editor.SetProperty(TextEditor::Property::SHADOW, shadowMapSet);
890 shadowMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::SHADOW);
891 DALI_TEST_EQUALS(shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION);
892 DALI_TEST_EQUALS(DaliTestCheckMaps(shadowMapGet, shadowMapSet), true, TEST_LOCATION);
894 // Check the input shadow property
895 editor.SetProperty(TextEditor::Property::INPUT_SHADOW, "Shadow input properties");
896 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_SHADOW), std::string("Shadow input properties"), TEST_LOCATION);
898 // Check the emboss property
899 editor.SetProperty(TextEditor::Property::EMBOSS, "Emboss properties");
900 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::EMBOSS), std::string("Emboss properties"), TEST_LOCATION);
902 // Check the input emboss property
903 editor.SetProperty(TextEditor::Property::INPUT_EMBOSS, "Emboss input properties");
904 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_EMBOSS), std::string("Emboss input properties"), TEST_LOCATION);
906 // Check the outline property
908 // Test string type first
909 // This is purely to maintain backward compatibility, but we don't support string as the outline property type.
910 editor.SetProperty(TextEditor::Property::OUTLINE, "Outline properties");
911 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::OUTLINE), std::string("Outline properties"), TEST_LOCATION);
913 // Then test the property map type
914 Property::Map outlineMapSet;
915 Property::Map outlineMapGet;
917 outlineMapSet["color"] = Color::RED;
918 outlineMapSet["width"] = 2.0f;
920 editor.SetProperty(TextEditor::Property::OUTLINE, outlineMapSet);
922 outlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::OUTLINE);
923 DALI_TEST_EQUALS(outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION);
924 DALI_TEST_EQUALS(DaliTestCheckMaps(outlineMapGet, outlineMapSet), true, TEST_LOCATION);
926 // Check the input outline property
927 editor.SetProperty(TextEditor::Property::INPUT_OUTLINE, "Outline input properties");
928 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_OUTLINE), std::string("Outline input properties"), TEST_LOCATION);
930 // Check the smooth scroll property
931 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::SMOOTH_SCROLL), false, TEST_LOCATION);
932 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL, true);
933 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::SMOOTH_SCROLL), true, TEST_LOCATION);
935 // Check the smooth scroll duration property
936 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.2f);
937 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SMOOTH_SCROLL_DURATION), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
939 // Check the scroll bar property
940 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SCROLL_BAR), false, TEST_LOCATION);
941 editor.SetProperty(TextEditor::Property::ENABLE_SCROLL_BAR, true);
942 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SCROLL_BAR), true, TEST_LOCATION);
944 editor.SetProperty(TextEditor::Property::SCROLL_BAR_SHOW_DURATION, 0.3f);
945 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_SHOW_DURATION), 0.3f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
946 editor.SetProperty(TextEditor::Property::SCROLL_BAR_FADE_DURATION, 0.2f);
947 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_FADE_DURATION), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
949 // Check the pixel size of font
950 editor.SetProperty(TextEditor::Property::PIXEL_SIZE, 20.f);
951 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::PIXEL_SIZE), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
953 // Check placeholder text properties.
954 editor.SetProperty(DevelTextEditor::Property::PLACEHOLDER_TEXT, "Setting Placeholder Text");
955 DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::PLACEHOLDER_TEXT), std::string("Setting Placeholder Text"), TEST_LOCATION);
957 // Check placeholder text's color property.
958 editor.SetProperty(DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR, Color::RED);
959 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR), Color::RED, TEST_LOCATION);
961 // Check the enable selection property
962 editor.SetProperty(TextEditor::Property::ENABLE_SELECTION, false);
963 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SELECTION), false, TEST_LOCATION);
965 // Check the placeholder property with pixel size
966 Property::Map placeholderPixelSizeMapSet;
967 Property::Map placeholderPixelSizeMapGet;
968 Property::Map placeholderFontstyleMap;
969 placeholderPixelSizeMapSet["text"] = "Setting Placeholder Text";
970 placeholderPixelSizeMapSet["textFocused"] = "Setting Placeholder Text Focused";
971 placeholderPixelSizeMapSet["color"] = Color::BLUE;
972 placeholderPixelSizeMapSet["fontFamily"] = "Arial";
973 placeholderPixelSizeMapSet["pixelSize"] = 15.0f;
975 placeholderFontstyleMap.Insert("weight", "bold");
976 placeholderPixelSizeMapSet["fontStyle"] = placeholderFontstyleMap;
977 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderPixelSizeMapSet);
979 placeholderPixelSizeMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
980 DALI_TEST_EQUALS(placeholderPixelSizeMapGet.Count(), placeholderPixelSizeMapSet.Count(), TEST_LOCATION);
982 tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value");
983 Property::Map placeholderConversionMap;
984 placeholderConversionMap[Text::PlaceHolder::Property::TEXT] = placeholderPixelSizeMapSet["text"];
985 placeholderConversionMap[Text::PlaceHolder::Property::TEXT_FOCUSED] = placeholderPixelSizeMapSet["textFocused"];
986 placeholderConversionMap[Text::PlaceHolder::Property::COLOR] = placeholderPixelSizeMapSet["color"];
987 placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderPixelSizeMapSet["fontStyle"];
988 placeholderConversionMap[Text::PlaceHolder::Property::FONT_FAMILY] = placeholderPixelSizeMapSet["fontFamily"];
989 placeholderConversionMap[Text::PlaceHolder::Property::PIXEL_SIZE] = placeholderPixelSizeMapSet["pixelSize"];
991 DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderPixelSizeMapGet, placeholderConversionMap), true, TEST_LOCATION);
993 // Check the placeholder property with point size
994 Property::Map placeholderMapSet;
995 Property::Map placeholderMapGet;
996 placeholderMapSet["text"] = "Setting Placeholder Text";
997 placeholderMapSet["textFocused"] = "Setting Placeholder Text Focused";
998 placeholderMapSet["color"] = Color::RED;
999 placeholderMapSet["fontFamily"] = "Arial";
1000 placeholderMapSet["pointSize"] = 12.0f;
1001 // Check the placeholder font style property
1002 placeholderFontstyleMap.Clear();
1004 placeholderFontstyleMap.Insert("weight", "bold");
1005 placeholderFontstyleMap.Insert("width", "condensed");
1006 placeholderFontstyleMap.Insert("slant", "italic");
1007 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1008 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1010 placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1011 DALI_TEST_EQUALS(placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION);
1013 tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value");
1014 placeholderConversionMap.Clear();
1015 placeholderConversionMap[Text::PlaceHolder::Property::TEXT] = placeholderMapSet["text"];
1016 placeholderConversionMap[Text::PlaceHolder::Property::TEXT_FOCUSED] = placeholderMapSet["textFocused"];
1017 placeholderConversionMap[Text::PlaceHolder::Property::COLOR] = placeholderMapSet["color"];
1018 placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderPixelSizeMapSet["fontStyle"];
1019 placeholderConversionMap[Text::PlaceHolder::Property::FONT_FAMILY] = placeholderMapSet["fontFamily"];
1020 placeholderConversionMap[Text::PlaceHolder::Property::POINT_SIZE] = placeholderMapSet["pointSize"];
1021 DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderMapGet, placeholderConversionMap), true, TEST_LOCATION);
1023 // Reset font style.
1024 placeholderFontstyleMap.Clear();
1025 placeholderFontstyleMap.Insert("weight", "normal");
1026 placeholderFontstyleMap.Insert("slant", "oblique");
1027 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1028 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1030 placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1031 DALI_TEST_EQUALS(placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION);
1032 placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderMapSet["fontStyle"];
1033 DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderMapGet, placeholderConversionMap), true, TEST_LOCATION);
1035 placeholderFontstyleMap.Clear();
1036 placeholderFontstyleMap.Insert("slant", "roman");
1037 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1038 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1040 placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1042 placeholderFontstyleMap.Clear();
1043 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1045 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1046 placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1047 DALI_TEST_EQUALS(placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION);
1048 placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderMapSet["fontStyle"];
1049 DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderMapGet, placeholderConversionMap), true, TEST_LOCATION);
1051 editor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
1052 DALI_TEST_EQUALS(editor.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
1054 // Check handle color
1055 editor.SetProperty(DevelTextEditor::Property::GRAB_HANDLE_COLOR, Color::GREEN);
1056 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(DevelTextEditor::Property::GRAB_HANDLE_COLOR), Color::GREEN, TEST_LOCATION);
1058 // Test the ENABLE_GRAB_HANDLE_POPUP property
1059 editor.SetProperty(DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP, false);
1060 DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP), false, TEST_LOCATION);
1062 // Check the input method setting
1063 Property::Map propertyMap;
1064 InputMethod::PanelLayout::Type panelLayout = InputMethod::PanelLayout::NUMBER;
1065 InputMethod::AutoCapital::Type autoCapital = InputMethod::AutoCapital::WORD;
1066 InputMethod::ButtonAction::Type buttonAction = InputMethod::ButtonAction::GO;
1067 int inputVariation = 1;
1068 propertyMap["PANEL_LAYOUT"] = panelLayout;
1069 propertyMap["AUTO_CAPITALIZE"] = autoCapital;
1070 propertyMap["BUTTON_ACTION"] = buttonAction;
1071 propertyMap["VARIATION"] = inputVariation;
1072 editor.SetProperty(DevelTextEditor::Property::INPUT_METHOD_SETTINGS, propertyMap);
1074 Property::Value value = editor.GetProperty(DevelTextEditor::Property::INPUT_METHOD_SETTINGS);
1076 DALI_TEST_CHECK(value.Get(map));
1079 DALI_TEST_CHECK(map["PANEL_LAYOUT"].Get(layout));
1080 DALI_TEST_EQUALS(static_cast<int>(panelLayout), layout, TEST_LOCATION);
1083 DALI_TEST_CHECK(map["AUTO_CAPITALIZE"].Get(capital));
1084 DALI_TEST_EQUALS(static_cast<int>(autoCapital), capital, TEST_LOCATION);
1087 DALI_TEST_CHECK(map["BUTTON_ACTION"].Get(action));
1088 DALI_TEST_EQUALS(static_cast<int>(buttonAction), action, TEST_LOCATION);
1091 DALI_TEST_CHECK(map["VARIATION"].Get(variation));
1092 DALI_TEST_EQUALS(inputVariation, variation, TEST_LOCATION);
1094 // Check the input filter property
1095 Property::Map inputFilterMapSet;
1096 Property::Map inputFilterMapGet;
1097 inputFilterMapSet[InputFilter::Property::ACCEPTED] = "[\\w]";
1098 inputFilterMapSet[InputFilter::Property::REJECTED] = "[\\d]";
1100 editor.SetProperty(DevelTextEditor::Property::INPUT_FILTER, inputFilterMapSet);
1102 inputFilterMapGet = editor.GetProperty<Property::Map>(DevelTextEditor::Property::INPUT_FILTER);
1103 DALI_TEST_EQUALS(inputFilterMapGet.Count(), inputFilterMapSet.Count(), TEST_LOCATION);
1106 inputFilterMapSet.Clear();
1107 editor.SetProperty(DevelTextEditor::Property::INPUT_FILTER, inputFilterMapSet);
1109 // Check the strikethrough property
1111 Property::Map strikethroughMapSet;
1112 Property::Map strikethroughMapGet;
1114 application.SendNotification();
1115 application.Render();
1117 // Check the input strikethrough property
1119 strikethroughMapSet.Clear();
1120 strikethroughMapGet.Clear();
1121 strikethroughMapSet.Insert("enable", true);
1122 strikethroughMapSet.Insert("color", Color::BLUE);
1123 strikethroughMapSet.Insert("height", 2.0f);
1125 editor.SetProperty(DevelTextEditor::Property::STRIKETHROUGH, strikethroughMapSet);
1127 application.SendNotification();
1128 application.Render();
1130 strikethroughMapGet = editor.GetProperty<Property::Map>(DevelTextEditor::Property::STRIKETHROUGH);
1132 DALI_TEST_EQUALS(strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION);
1133 DALI_TEST_EQUALS(DaliTestCheckMaps(strikethroughMapSet, strikethroughMapGet), true, TEST_LOCATION);
1135 // Check the input strikethrough property
1136 editor.SetProperty(DevelTextEditor::Property::INPUT_STRIKETHROUGH, "Strikethrough input properties");
1137 DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::INPUT_STRIKETHROUGH), std::string("Strikethrough input properties"), TEST_LOCATION);
1139 application.SendNotification();
1140 application.Render();
1142 // Check the line size property
1143 DALI_TEST_EQUALS(editor.GetProperty<float>(DevelTextEditor::Property::MIN_LINE_SIZE), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1144 editor.SetProperty(DevelTextEditor::Property::MIN_LINE_SIZE, 50.f);
1145 DALI_TEST_EQUALS(editor.GetProperty<float>(DevelTextEditor::Property::MIN_LINE_SIZE), 50.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1150 // Positive Atlas Text Renderer test
1151 int utcDaliTextEditorAtlasRenderP(void)
1153 ToolkitTestApplication application;
1154 tet_infoline(" UtcDaliToolkitTextEditorAtlasRenderP");
1155 StyleManager styleManager = StyleManager::Get();
1156 styleManager.ApplyDefaultTheme();
1157 TextEditor editor = TextEditor::New();
1158 DALI_TEST_CHECK(editor);
1160 editor.SetProperty(TextEditor::Property::HORIZONTAL_ALIGNMENT, "CENTER");
1162 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1164 application.GetScene().Add(editor);
1168 // Render some text with the shared atlas backend
1169 editor.SetProperty(DevelTextEditor::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS);
1170 application.SendNotification();
1171 application.Render();
1175 tet_result(TET_FAIL);
1180 // Positive test for the anchorClicked signal.
1181 int utcDaliTextEditorAnchorClickedP(void)
1183 ToolkitTestApplication application;
1184 tet_infoline(" utcDaliTextEditorAnchorClickedP");
1185 TextEditor editor = TextEditor::New();
1186 DALI_TEST_CHECK(editor);
1188 application.GetScene().Add(editor);
1190 // connect to the anchor clicked signal.
1191 ConnectionTracker* testTracker = new ConnectionTracker();
1192 DevelTextEditor::AnchorClickedSignal(editor).Connect(&TestAnchorClickedCallback);
1193 bool anchorClickedSignal = false;
1194 editor.ConnectSignal(testTracker, "anchorClicked", CallbackFunctor(&anchorClickedSignal));
1196 gAnchorClickedCallBackCalled = false;
1197 editor.SetProperty(TextEditor::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
1198 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
1199 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
1200 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1201 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1203 application.SendNotification();
1204 application.Render();
1205 editor.SetKeyInputFocus();
1207 // Create a tap event to touch the text editor.
1208 TestGenerateTap(application, 5.0f, 5.0f);
1209 application.SendNotification();
1210 application.Render();
1212 DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
1213 DALI_TEST_CHECK(anchorClickedSignal);
1215 gAnchorClickedCallBackNotCalled = true;
1216 // Tap the outside of anchor, callback should not be called.
1217 TestGenerateTap(application, 150.f, 100.f);
1218 application.SendNotification();
1219 application.Render();
1221 DALI_TEST_CHECK(gAnchorClickedCallBackNotCalled);
1226 // Positive test for the textChanged signal.
1227 int utcDaliTextEditorTextChangedP(void)
1229 ToolkitTestApplication application;
1230 tet_infoline(" utcDaliTextEditorTextChangedP");
1231 TextEditor editor = TextEditor::New();
1232 DALI_TEST_CHECK(editor);
1234 application.GetScene().Add(editor);
1236 // connect to the text changed signal.
1237 ConnectionTracker* testTracker = new ConnectionTracker();
1238 editor.TextChangedSignal().Connect(&TestTextChangedCallback);
1239 bool textChangedSignal = false;
1240 editor.ConnectSignal(testTracker, "textChanged", CallbackFunctor(&textChangedSignal));
1242 gTextChangedCallBackCalled = false;
1243 editor.SetProperty(TextEditor::Property::TEXT, "ABC");
1244 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1245 DALI_TEST_CHECK(textChangedSignal);
1247 application.SendNotification();
1248 editor.SetKeyInputFocus();
1250 gTextChangedCallBackCalled = false;
1251 application.ProcessEvent(GenerateKey("D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1252 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1255 editor.SetProperty(TextField::Property::TEXT, "");
1257 // Pressing backspace key: TextChangedCallback should not be called when there is no text in texteditor.
1258 gTextChangedCallBackCalled = false;
1259 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1260 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1262 // Pressing delete key: TextChangedCallback should not be called when there is no text in texteditor.
1263 gTextChangedCallBackCalled = false;
1264 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "Delete", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1265 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1270 int utcDaliTextEditorTextChangedWithInputMethodContext(void)
1272 ToolkitTestApplication application;
1273 tet_infoline(" utcDaliTextEditorTextChangedWithInputMethodContext");
1274 TextEditor editor = TextEditor::New();
1275 DALI_TEST_CHECK(editor);
1277 application.GetScene().Add(editor);
1279 // connect to the text changed signal.
1280 ConnectionTracker* testTracker = new ConnectionTracker();
1281 editor.TextChangedSignal().Connect(&TestTextChangedCallback);
1282 bool textChangedSignal = false;
1283 editor.ConnectSignal(testTracker, "textChanged", CallbackFunctor(&textChangedSignal));
1285 // get InputMethodContext
1287 InputMethodContext::EventData imfEvent;
1288 InputMethodContext inputMethodContext = DevelTextEditor::GetInputMethodContext(editor);
1290 editor.SetKeyInputFocus();
1291 editor.SetProperty(DevelTextEditor::Property::ENABLE_EDITING, true);
1294 gTextChangedCallBackCalled = false;
1295 imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "ㅎ", 0, 1);
1296 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1297 application.SendNotification();
1298 application.Render();
1299 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1300 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("ㅎ"), TEST_LOCATION);
1302 gTextChangedCallBackCalled = false;
1303 imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "호", 0, 1);
1304 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1305 application.SendNotification();
1306 application.Render();
1307 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1308 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("호"), TEST_LOCATION);
1310 gTextChangedCallBackCalled = false;
1311 imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "혿", 0, 1);
1312 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1313 application.SendNotification();
1314 application.Render();
1315 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1316 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("혿"), TEST_LOCATION);
1318 gTextChangedCallBackCalled = false;
1319 imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "", 0, 1);
1320 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1321 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1323 imfEvent = InputMethodContext::EventData(InputMethodContext::COMMIT, "호", 0, 1);
1324 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1325 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1327 imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "두", 1, 2);
1328 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1329 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1331 application.SendNotification();
1332 application.Render();
1333 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1334 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("호두"), TEST_LOCATION);
1339 int utcDaliTextEditorInputStyleChanged01(void)
1341 // The text-editor emits signals when the input style changes. These changes of style are
1342 // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
1343 // can't be emitted during the size negotiation as the callbacks may update the UI.
1344 // The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
1345 // The ToolkitTestApplication creates an implementation of the adaptor stub and a queue of idle callbacks.
1346 ToolkitTestApplication application;
1347 tet_infoline(" utcDaliTextEditorInputStyleChanged01");
1351 char* pathNamePtr = get_current_dir_name();
1352 const std::string pathName(pathNamePtr);
1355 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1356 fontClient.SetDpi(93u, 93u);
1358 fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE);
1359 fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE);
1361 TextEditor editor = TextEditor::New();
1362 DALI_TEST_CHECK(editor);
1364 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1365 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1366 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1368 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
1369 editor.SetProperty(TextEditor::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='green'>llo</color> <font weight='bold'>world</font> demo</font>");
1371 // connect to the text changed signal.
1372 ConnectionTracker* testTracker = new ConnectionTracker();
1373 editor.InputStyleChangedSignal().Connect(&TestInputStyleChangedCallback);
1374 bool inputStyleChangedSignal = false;
1375 editor.ConnectSignal(testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal));
1377 application.GetScene().Add(editor);
1379 // Render and notify
1380 application.SendNotification();
1381 application.Render();
1383 // Executes the idle callbacks added by the text control on the change of input style.
1384 application.RunIdles();
1386 gInputStyleChangedCallbackCalled = false;
1387 gInputStyleMask = TextEditor::InputStyle::NONE;
1388 inputStyleChangedSignal = false;
1390 // Create a tap event to touch the text editor.
1391 TestGenerateTap(application, 18.0f, 25.0f);
1393 // Render and notify
1394 application.SendNotification();
1395 application.Render();
1397 // Executes the idle callbacks added by the text control on the change of input style.
1398 application.RunIdles();
1400 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1401 if(gInputStyleChangedCallbackCalled)
1403 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::FONT_FAMILY | TextEditor::InputStyle::POINT_SIZE), TEST_LOCATION);
1405 const std::string fontFamily = editor.GetProperty(TextEditor::Property::INPUT_FONT_FAMILY).Get<std::string>();
1406 DALI_TEST_EQUALS(fontFamily, "DejaVuSerif", TEST_LOCATION);
1408 const float pointSize = editor.GetProperty(TextEditor::Property::INPUT_POINT_SIZE).Get<float>();
1409 DALI_TEST_EQUALS(pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1411 DALI_TEST_CHECK(inputStyleChangedSignal);
1413 gInputStyleChangedCallbackCalled = false;
1414 gInputStyleMask = TextEditor::InputStyle::NONE;
1415 inputStyleChangedSignal = false;
1417 // Create a tap event to touch the text editor.
1418 TestGenerateTap(application, 30.0f, 25.0f);
1420 // Render and notify
1421 application.SendNotification();
1422 application.Render();
1424 // Executes the idle callbacks added by the text control on the change of input style.
1425 application.RunIdles();
1427 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1428 DALI_TEST_CHECK(!inputStyleChangedSignal);
1430 gInputStyleChangedCallbackCalled = false;
1431 gInputStyleMask = TextEditor::InputStyle::NONE;
1432 inputStyleChangedSignal = false;
1434 // Create a tap event to touch the text editor.
1435 TestGenerateTap(application, 43.0f, 25.0f);
1437 // Render and notify
1438 application.SendNotification();
1439 application.Render();
1441 // Executes the idle callbacks added by the text control on the change of input style.
1442 application.RunIdles();
1444 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1445 if(gInputStyleChangedCallbackCalled)
1447 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::COLOR), TEST_LOCATION);
1449 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1450 DALI_TEST_EQUALS(color, Color::GREEN, TEST_LOCATION);
1452 DALI_TEST_CHECK(inputStyleChangedSignal);
1454 gInputStyleChangedCallbackCalled = false;
1455 gInputStyleMask = TextEditor::InputStyle::NONE;
1456 inputStyleChangedSignal = false;
1458 // Create a tap event to touch the text editor.
1459 TestGenerateTap(application, 88.0f, 25.0f);
1461 // Render and notify
1462 application.SendNotification();
1463 application.Render();
1465 // Executes the idle callbacks added by the text control on the change of input style.
1466 application.RunIdles();
1468 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1469 if(gInputStyleChangedCallbackCalled)
1471 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::COLOR | TextEditor::InputStyle::FONT_STYLE), TEST_LOCATION);
1473 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1474 DALI_TEST_EQUALS(color, Color::BLACK, TEST_LOCATION);
1476 Property::Map fontStyleMapSet;
1477 Property::Map fontStyleMapGet;
1479 fontStyleMapSet.Insert("weight", "bold");
1481 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
1482 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
1483 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
1485 DALI_TEST_CHECK(inputStyleChangedSignal);
1487 gInputStyleChangedCallbackCalled = false;
1488 gInputStyleMask = TextEditor::InputStyle::NONE;
1489 inputStyleChangedSignal = false;
1491 // Create a tap event to touch the text editor.
1492 TestGenerateTap(application, 115.0f, 25.0f);
1494 // Render and notify
1495 application.SendNotification();
1496 application.Render();
1498 // Executes the idle callbacks added by the text control on the change of input style.
1499 application.RunIdles();
1501 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1502 DALI_TEST_CHECK(!inputStyleChangedSignal);
1504 gInputStyleChangedCallbackCalled = false;
1505 gInputStyleMask = TextEditor::InputStyle::NONE;
1506 inputStyleChangedSignal = false;
1508 // Create a tap event to touch the text editor.
1509 TestGenerateTap(application, 164.0f, 25.0f);
1511 // Render and notify
1512 application.SendNotification();
1513 application.Render();
1515 // Executes the idle callbacks added by the text control on the change of input style.
1516 application.RunIdles();
1518 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1519 if(gInputStyleChangedCallbackCalled)
1521 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::FONT_STYLE), TEST_LOCATION);
1523 Property::Map fontStyleMapSet;
1524 Property::Map fontStyleMapGet;
1526 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
1527 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
1528 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
1530 DALI_TEST_CHECK(inputStyleChangedSignal);
1532 gInputStyleChangedCallbackCalled = false;
1533 gInputStyleMask = TextEditor::InputStyle::NONE;
1534 inputStyleChangedSignal = false;
1536 // Create a tap event to touch the text editor.
1537 TestGenerateTap(application, 191.0f, 25.0f);
1539 // Render and notify
1540 application.SendNotification();
1541 application.Render();
1543 // Executes the idle callbacks added by the text control on the change of input style.
1544 application.RunIdles();
1546 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1547 DALI_TEST_CHECK(!inputStyleChangedSignal);
1552 int utcDaliTextEditorInputStyleChanged02(void)
1554 // The text-editor emits signals when the input style changes. These changes of style are
1555 // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
1556 // can't be emitted during the size negotiation as the callbacks may update the UI.
1557 // The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
1558 // The ToolkitTestApplication creates an implementation of the adaptor stub and a queue of idle callbacks.
1559 ToolkitTestApplication application;
1560 tet_infoline(" utcDaliTextEditorInputStyleChanged02");
1564 char* pathNamePtr = get_current_dir_name();
1565 const std::string pathName(pathNamePtr);
1568 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1569 fontClient.SetDpi(93u, 93u);
1571 fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE);
1572 fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE);
1574 TextEditor editor = TextEditor::New();
1575 DALI_TEST_CHECK(editor);
1577 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1578 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1579 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1581 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
1582 editor.SetProperty(TextEditor::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='blue'> l</color><color value='green'>lo</color> <font weight='bold'>world</font> demo</font>");
1584 // connect to the text changed signal.
1585 ConnectionTracker* testTracker = new ConnectionTracker();
1586 editor.InputStyleChangedSignal().Connect(&TestInputStyleChangedCallback);
1587 bool inputStyleChangedSignal = false;
1588 editor.ConnectSignal(testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal));
1590 application.GetScene().Add(editor);
1592 // Render and notify
1593 application.SendNotification();
1594 application.Render();
1596 // Executes the idle callbacks added by the text control on the change of input style.
1597 application.RunIdles();
1599 gInputStyleChangedCallbackCalled = false;
1600 gInputStyleMask = TextEditor::InputStyle::NONE;
1601 inputStyleChangedSignal = false;
1603 // Create a tap event to touch the text editor.
1604 TestGenerateTap(application, 53.0f, 25.0f, 100);
1605 TestGenerateTap(application, 53.0f, 25.0f, 200);
1607 // Render and notify
1608 application.SendNotification();
1609 application.Render();
1611 // Executes the idle callbacks added by the text control on the change of input style.
1612 application.RunIdles();
1614 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1615 if(gInputStyleChangedCallbackCalled)
1617 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1618 static_cast<unsigned int>(TextEditor::InputStyle::FONT_FAMILY |
1619 TextEditor::InputStyle::POINT_SIZE |
1620 TextEditor::InputStyle::COLOR),
1623 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1624 DALI_TEST_EQUALS(color, Color::GREEN, TEST_LOCATION);
1626 const std::string fontFamily = editor.GetProperty(TextEditor::Property::INPUT_FONT_FAMILY).Get<std::string>();
1627 DALI_TEST_EQUALS(fontFamily, "DejaVuSerif", TEST_LOCATION);
1629 const float pointSize = editor.GetProperty(TextEditor::Property::INPUT_POINT_SIZE).Get<float>();
1630 DALI_TEST_EQUALS(pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1632 DALI_TEST_CHECK(inputStyleChangedSignal);
1634 gInputStyleChangedCallbackCalled = false;
1635 gInputStyleMask = TextEditor::InputStyle::NONE;
1636 inputStyleChangedSignal = false;
1638 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1640 // Render and notify
1641 application.SendNotification();
1642 application.Render();
1644 // Executes the idle callbacks added by the text control on the change of input style.
1645 application.RunIdles();
1647 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1648 if(gInputStyleChangedCallbackCalled)
1650 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1651 static_cast<unsigned int>(TextEditor::InputStyle::COLOR),
1654 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1655 DALI_TEST_EQUALS(color, Color::BLUE, TEST_LOCATION);
1657 DALI_TEST_CHECK(inputStyleChangedSignal);
1659 gInputStyleChangedCallbackCalled = false;
1660 gInputStyleMask = TextEditor::InputStyle::NONE;
1661 inputStyleChangedSignal = false;
1663 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1665 // Render and notify
1666 application.SendNotification();
1667 application.Render();
1669 // Executes the idle callbacks added by the text control on the change of input style.
1670 application.RunIdles();
1672 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1673 DALI_TEST_CHECK(!inputStyleChangedSignal);
1675 gInputStyleChangedCallbackCalled = false;
1676 gInputStyleMask = TextEditor::InputStyle::NONE;
1677 inputStyleChangedSignal = false;
1679 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1681 // Render and notify
1682 application.SendNotification();
1683 application.Render();
1685 // Executes the idle callbacks added by the text control on the change of input style.
1686 application.RunIdles();
1688 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1689 if(gInputStyleChangedCallbackCalled)
1691 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1692 static_cast<unsigned int>(TextEditor::InputStyle::COLOR),
1695 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1696 DALI_TEST_EQUALS(color, Color::BLACK, TEST_LOCATION);
1698 DALI_TEST_CHECK(inputStyleChangedSignal);
1700 gInputStyleChangedCallbackCalled = false;
1701 gInputStyleMask = TextEditor::InputStyle::NONE;
1702 inputStyleChangedSignal = false;
1704 editor.SetProperty(TextEditor::Property::INPUT_COLOR, Color::YELLOW);
1706 Property::Map fontStyleMapSet;
1707 fontStyleMapSet.Insert("weight", "thin");
1708 fontStyleMapSet.Insert("width", "condensed");
1709 fontStyleMapSet.Insert("slant", "italic");
1711 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
1712 editor.SetProperty(TextEditor::Property::INPUT_POINT_SIZE, 20.f);
1713 editor.SetProperty(TextEditor::Property::INPUT_LINE_SPACING, 5.f);
1715 editor.SetProperty(TextEditor::Property::INPUT_UNDERLINE, "underline");
1716 editor.SetProperty(TextEditor::Property::INPUT_SHADOW, "shadow");
1717 editor.SetProperty(TextEditor::Property::INPUT_EMBOSS, "emboss");
1718 editor.SetProperty(TextEditor::Property::INPUT_OUTLINE, "outline");
1719 editor.SetProperty(DevelTextEditor::Property::INPUT_STRIKETHROUGH, "strikethrough");
1721 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1723 // Render and notify
1724 application.SendNotification();
1725 application.Render();
1727 // Executes the idle callbacks added by the text control on the change of input style.
1728 application.RunIdles();
1730 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1731 DALI_TEST_CHECK(!inputStyleChangedSignal);
1733 // Create a tap event to touch the text editor.
1734 TestGenerateTap(application, 63.0f, 25.0f, 900);
1736 // Render and notify
1737 application.SendNotification();
1738 application.Render();
1740 // Executes the idle callbacks added by the text control on the change of input style.
1741 application.RunIdles();
1743 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1744 if(gInputStyleChangedCallbackCalled)
1746 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1747 static_cast<unsigned int>(TextEditor::InputStyle::COLOR |
1748 TextEditor::InputStyle::POINT_SIZE |
1749 TextEditor::InputStyle::FONT_STYLE |
1750 TextEditor::InputStyle::LINE_SPACING |
1751 TextEditor::InputStyle::UNDERLINE |
1752 TextEditor::InputStyle::SHADOW |
1753 TextEditor::InputStyle::EMBOSS |
1754 TextEditor::InputStyle::OUTLINE),
1757 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1758 DALI_TEST_EQUALS(color, Color::BLACK, TEST_LOCATION);
1760 DALI_TEST_CHECK(inputStyleChangedSignal);
1762 gInputStyleChangedCallbackCalled = false;
1763 gInputStyleMask = TextEditor::InputStyle::NONE;
1764 inputStyleChangedSignal = false;
1766 editor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVuSerif");
1768 fontStyleMapSet.Clear();
1769 fontStyleMapSet.Insert("weight", "black");
1770 fontStyleMapSet.Insert("width", "expanded");
1771 fontStyleMapSet.Insert("slant", "oblique");
1773 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
1775 // Create a tap event to touch the text editor.
1776 TestGenerateTap(application, 30.0f, 25.0f, 1500);
1778 // Render and notify
1779 application.SendNotification();
1780 application.Render();
1782 // Executes the idle callbacks added by the text control on the change of input style.
1783 application.RunIdles();
1785 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1786 if(gInputStyleChangedCallbackCalled)
1788 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1789 static_cast<unsigned int>(TextEditor::InputStyle::COLOR |
1790 TextEditor::InputStyle::POINT_SIZE |
1791 TextEditor::InputStyle::FONT_STYLE),
1794 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1795 DALI_TEST_EQUALS(color, Color::YELLOW, TEST_LOCATION);
1797 DALI_TEST_CHECK(inputStyleChangedSignal);
1802 int utcDaliTextEditorEvent01(void)
1804 ToolkitTestApplication application;
1805 tet_infoline(" utcDaliTextEditorEvent01");
1807 // Creates a tap event. After creating a tap event the text editor should
1808 // have the focus and add text with key events should be possible.
1810 TextEditor editor = TextEditor::New();
1811 DALI_TEST_CHECK(editor);
1813 application.GetScene().Add(editor);
1815 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1816 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1817 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1819 // Avoid a crash when core load gl resources.
1820 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1822 // Render and notify
1823 application.SendNotification();
1824 application.Render();
1826 // Add a key event but as the text editor has not the focus it should do nothing.
1827 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1829 // Render and notify
1830 application.SendNotification();
1831 application.Render();
1833 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string(""), TEST_LOCATION);
1835 // Create a tap event to touch the text editor.
1836 TestGenerateTap(application, 150.0f, 25.0f);
1838 // Render and notify
1839 application.SendNotification();
1840 application.Render();
1842 // Now the text editor has the focus, so it can handle the key events.
1843 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1844 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1846 // Render and notify
1847 application.SendNotification();
1848 application.Render();
1850 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("aa"), TEST_LOCATION);
1852 // Create a second text editor and send key events to it.
1853 TextEditor editor2 = TextEditor::New();
1855 editor2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1856 editor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1857 editor2.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
1858 editor2.SetProperty(Actor::Property::POSITION, Vector2(100.f, 100.f));
1860 application.GetScene().Add(editor2);
1862 // Render and notify
1863 application.SendNotification();
1864 application.Render();
1866 // Create a tap event on the second text editor.
1867 TestGenerateTap(application, 150.0f, 125.0f);
1869 // Render and notify
1870 application.SendNotification();
1871 application.Render();
1873 // The second text editor has the focus. It should handle the key events.
1874 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1875 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1877 // Render and notify
1878 application.SendNotification();
1879 application.Render();
1881 // Check the text has been added to the second text editor.
1882 DALI_TEST_EQUALS(editor2.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("aa"), TEST_LOCATION);
1887 int utcDaliTextEditorEvent02(void)
1889 ToolkitTestApplication application;
1890 tet_infoline(" utcDaliTextEditorEvent02");
1892 // Checks if the right number of actors are created.
1894 TextEditor editor = TextEditor::New();
1895 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
1896 DALI_TEST_CHECK(editor);
1898 application.GetScene().Add(editor);
1900 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1901 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1902 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1904 // Avoid a crash when core load gl resources.
1905 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1907 // Render and notify
1908 application.SendNotification();
1909 application.Render();
1911 // Check there are the expected number of children (the stencil).
1912 DALI_TEST_EQUALS(editor.GetChildCount(), 1u, TEST_LOCATION);
1914 Actor stencil = editor.GetChildAt(0u);
1916 // Create a tap event to touch the text editor.
1917 TestGenerateTap(application, 150.0f, 25.0f, 100);
1919 // Render and notify
1920 application.SendNotification();
1921 application.Render();
1923 Actor layer = editor.GetChildAt(2u);
1924 DALI_TEST_EQUALS(layer.GetChildCount(), 1u, TEST_LOCATION); // The cursor.
1925 DALI_TEST_EQUALS(stencil.GetChildCount(), 0u, TEST_LOCATION);
1927 // Now the text editor has the focus, so it can handle the key events.
1928 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1929 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1931 // Render and notify
1932 application.SendNotification();
1933 application.Render();
1935 // Checks the cursor and the renderer have been created.
1936 DALI_TEST_EQUALS(layer.GetChildCount(), 1u, TEST_LOCATION); // The cursor.
1937 DALI_TEST_EQUALS(stencil.GetChildCount(), 2u, TEST_LOCATION); // The renderer, clipped cursor
1939 Control cursor = Control::DownCast(layer.GetChildAt(0u));
1940 DALI_TEST_CHECK(cursor);
1942 // The stencil actor has a container with all the actors which contain the text renderers.
1943 Actor container = stencil.GetChildAt(0u);
1944 for(unsigned int index = 0; index < container.GetChildCount(); ++index)
1946 Renderer renderer = container.GetChildAt(index).GetRendererAt(0u);
1947 DALI_TEST_CHECK(renderer);
1950 // Move the cursor and check the position changes.
1951 Vector3 position1 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1953 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1954 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1956 // Render and notify
1957 application.SendNotification();
1958 application.Render();
1960 Vector3 position2 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1962 DALI_TEST_CHECK(position2.x < position1.x);
1964 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1965 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1967 // Render and notify
1968 application.SendNotification();
1969 application.Render();
1971 Vector3 position3 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1973 DALI_TEST_EQUALS(position1, position3, TEST_LOCATION); // Should be in the same position1.
1975 // Send some taps and check the cursor positions.
1977 // Try to tap at the beginning.
1978 TestGenerateTap(application, 1.0f, 25.0f, 700);
1980 // Render and notify
1981 application.SendNotification();
1982 application.Render();
1984 // Cursor position should be the same than position1.
1985 Vector3 position4 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1987 DALI_TEST_EQUALS(position2, position4, TEST_LOCATION); // Should be in the same position2.
1989 // Tap away from the start position.
1990 TestGenerateTap(application, 16.0f, 25.0f, 1400);
1992 // Render and notify
1993 application.SendNotification();
1994 application.Render();
1996 Vector3 position5 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1998 DALI_TEST_CHECK(position5.x > position4.x);
2000 // Remove all the text.
2001 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2002 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2003 editor.SetProperty(TextEditor::Property::TEXT, "");
2005 // Render and notify
2006 application.SendNotification();
2007 application.Render();
2009 // Cursor position should be the same than position2.
2010 Vector3 position6 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
2012 DALI_TEST_EQUALS(position2, position6, TEST_LOCATION); // Should be in the same position2.
2014 // Should not be a renderer, there is only a clipped cursor.
2015 DALI_TEST_EQUALS(stencil.GetChildCount(), 1u, TEST_LOCATION);
2020 int utcDaliTextEditorEvent03(void)
2022 ToolkitTestApplication application;
2023 tet_infoline(" utcDaliTextEditorEvent03");
2025 // Checks if the highlight actor is created.
2027 TextEditor editor = TextEditor::New();
2028 DALI_TEST_CHECK(editor);
2030 application.GetScene().Add(editor);
2032 editor.SetProperty(TextEditor::Property::TEXT, "This is a long text for the size of the text-editor.");
2033 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2034 editor.SetProperty(Actor::Property::SIZE, Vector2(30.f, 50.f));
2035 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2036 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2038 // Avoid a crash when core load gl resources.
2039 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2041 // Render and notify
2042 application.SendNotification();
2043 application.Render();
2045 // Send some taps and check text controller with clipboard window
2046 Dali::Clipboard clipboard = Clipboard::Get();
2047 clipboard.ShowClipboard();
2048 TestGenerateTap(application, 3.0f, 25.0f, 100);
2049 clipboard.HideClipboard();
2051 // Render and notify
2052 application.SendNotification();
2053 application.Render();
2055 // Tap first to get the focus.
2056 TestGenerateTap(application, 3.0f, 25.0f, 1000);
2058 // Render and notify
2059 application.SendNotification();
2060 application.Render();
2062 // Double tap to select a word.
2063 TestGenerateTap(application, 3.0f, 25.0f, 1100);
2065 // Render and notify
2066 application.SendNotification();
2067 application.Render();
2069 // The stencil actor should have two actors: the renderer and the highlight actor.
2070 Actor stencil = editor.GetChildAt(0u);
2072 // Highlight needs to be drawn before text, so should come first in child order
2073 Renderer highlight = stencil.GetChildAt(0u).GetRendererAt(0u);
2074 DALI_TEST_CHECK(highlight);
2076 // The stencil actor has a container with all the actors which contain the text renderers.
2077 Actor container = stencil.GetChildAt(1u);
2078 for(unsigned int index = 0; index < container.GetChildCount(); ++index)
2080 Renderer renderer = container.GetChildAt(index).GetRendererAt(0u);
2081 DALI_TEST_CHECK(renderer);
2084 // Double tap out of bounds
2085 TestGenerateTap(application, 29.0f, 25.0f, 1700);
2086 TestGenerateTap(application, 29.0f, 25.0f, 1800);
2088 // Render and notify
2089 application.SendNotification();
2090 application.Render();
2092 // The stencil actor should have one actors: the renderer actor.
2093 stencil = editor.GetChildAt(0u);
2095 // The stencil actor has a container with all the actors which contain the text renderers.
2096 container = stencil.GetChildAt(0u);
2097 for(unsigned int index = 0; index < container.GetChildCount(); ++index)
2099 Renderer renderer = container.GetChildAt(index).GetRendererAt(0u);
2100 DALI_TEST_CHECK(renderer);
2104 TestGenerateLongPress(application, 1.0f, 25.0f);
2106 // Render and notify
2107 application.SendNotification();
2108 application.Render();
2111 TestGenerateMiniPan(application);
2113 // Render and notify
2114 application.SendNotification();
2115 application.Render();
2120 int utcDaliTextEditorEvent04(void)
2122 ToolkitTestApplication application;
2123 tet_infoline(" utcDaliTextEditorEvent04");
2125 // Checks if the highlight actor is created.
2127 TextEditor editor = TextEditor::New();
2128 DALI_TEST_CHECK(editor);
2130 application.GetScene().Add(editor);
2132 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworl");
2133 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2134 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2135 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2136 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2138 // Avoid a crash when core load gl resources.
2139 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2141 // Render and notify
2142 application.SendNotification();
2143 application.Render();
2145 // Tap on the text editor
2146 TestGenerateTap(application, 3.0f, 25.0f);
2148 // Render and notify
2149 application.SendNotification();
2150 application.Render();
2152 // Move at the end of the text.
2153 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2154 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2156 // Render and notify
2157 application.SendNotification();
2158 application.Render();
2160 for(unsigned int index = 0u; index < 10u; ++index)
2162 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2163 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2165 // Render and notify
2166 application.SendNotification();
2167 application.Render();
2171 application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2173 // Render and notify
2174 application.SendNotification();
2175 application.Render();
2177 DALI_TEST_EQUALS("Hello\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2179 // Add some key events
2180 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2181 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2183 // Render and notify
2184 application.SendNotification();
2185 application.Render();
2187 for(unsigned int index = 0u; index < 10u; ++index)
2189 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2190 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2192 // Render and notify
2193 application.SendNotification();
2194 application.Render();
2198 application.ProcessEvent(GenerateKey(" ", "", " ", KEY_WHITE_SPACE_CODE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2200 // Render and notify
2201 application.SendNotification();
2202 application.Render();
2204 DALI_TEST_EQUALS(" Hello\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2209 int utcDaliTextEditorEvent05(void)
2211 ToolkitTestApplication application;
2212 tet_infoline(" utcDaliTextEditorEvent05");
2214 // Checks if the highlight actor is created.
2216 TextEditor editor = TextEditor::New();
2217 DALI_TEST_CHECK(editor);
2219 application.GetScene().Add(editor);
2221 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworl");
2222 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2223 editor.SetProperty(Actor::Property::SIZE, Vector2(50.f, 50.f));
2224 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2225 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2226 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL, true);
2227 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.2f);
2228 editor.SetProperty(TextEditor::Property::ENABLE_SCROLL_BAR, true);
2229 editor.SetProperty(TextEditor::Property::SCROLL_BAR_SHOW_DURATION, 0.3f);
2230 editor.SetProperty(TextEditor::Property::SCROLL_BAR_FADE_DURATION, 0.2f);
2232 // Avoid a crash when core load gl resources.
2233 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2235 // Render and notify
2236 application.SendNotification();
2237 application.Render();
2239 // Tap on the text editor
2240 TestGenerateTap(application, 3.0f, 25.0f);
2242 // Render and notify
2243 application.SendNotification();
2244 application.Render();
2246 // Move at the end of the text.
2247 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2248 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2250 // Render and notify
2251 application.SendNotification();
2252 application.Render();
2254 for(unsigned int index = 0u; index < 10u; ++index)
2257 application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2259 // Render and notify
2260 application.SendNotification();
2261 application.Render();
2263 // Modify duration after scroll is enabled
2264 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.1f);
2266 // Continuous scroll left to increase coverage
2267 for(unsigned int index = 0u; index < 10u; ++index)
2269 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2271 // Render and notify
2272 application.SendNotification();
2273 application.Render();
2275 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SMOOTH_SCROLL_DURATION), 0.1f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
2276 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::SMOOTH_SCROLL), true, TEST_LOCATION);
2277 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SCROLL_BAR), true, TEST_LOCATION);
2278 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_SHOW_DURATION), 0.3f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
2279 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_FADE_DURATION), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
2281 // Press Escape to increase coverage
2282 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::UP, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2283 application.SendNotification();
2284 application.Render();
2286 DALI_TEST_CHECK(!editor.HasKeyInputFocus());
2291 int utcDaliTextEditorEvent06(void)
2293 ToolkitTestApplication application;
2294 tet_infoline(" utcDaliTextEditorEvent06");
2296 // Checks if the highlight actor is created.
2298 TextEditor editor = TextEditor::New();
2299 DALI_TEST_CHECK(editor);
2301 application.GetScene().Add(editor);
2303 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
2304 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2305 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2306 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2307 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2309 // Avoid a crash when core load gl resources.
2310 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2312 // Render and notify
2313 application.SendNotification();
2314 application.Render();
2316 // Tap on the text editor
2317 TestGenerateTap(application, 3.0f, 25.0f);
2319 // Render and notify
2320 application.SendNotification();
2321 application.Render();
2323 // Move to seconds line of the text.
2324 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2326 // Render and notify
2327 application.SendNotification();
2328 application.Render();
2330 float layoutHeight = editor.GetHeightForWidth(100.f);
2332 // Add another script characters ( glyph height is defferent )
2333 application.ProcessEvent(GenerateKey("d", "", "ㅁ", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "ㅁ", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2334 application.ProcessEvent(GenerateKey("d", "", "ኢ", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "ኢ", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2336 // Delete characters
2337 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2338 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2340 DALI_TEST_EQUALS(layoutHeight, editor.GetHeightForWidth(100.f), TEST_LOCATION);
2342 // Render and notify
2343 application.SendNotification();
2344 application.Render();
2346 DALI_TEST_EQUALS("Hello\nworld\nHello world", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2349 application.ProcessEvent(GenerateKey("", "", "", 0, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2350 application.SendNotification();
2351 application.Render();
2353 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2354 application.SendNotification();
2355 application.Render();
2357 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_VOLUME_UP, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2358 application.SendNotification();
2359 application.Render();
2361 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_VOLUME_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2362 application.SendNotification();
2363 application.Render();
2365 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2366 application.SendNotification();
2367 application.Render();
2369 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2370 application.SendNotification();
2371 application.Render();
2373 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2374 application.SendNotification();
2375 application.Render();
2380 int utcDaliTextEditorEvent07(void)
2382 ToolkitTestApplication application;
2383 tet_infoline(" utcDaliTextEditorEvent07");
2385 // Checks if the highlight actor is created.
2387 TextEditor editor = TextEditor::New();
2388 DALI_TEST_CHECK(editor);
2390 application.GetScene().Add(editor);
2392 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
2393 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2394 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2395 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2396 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2398 // Avoid a crash when core load gl resources.
2399 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2401 // Render and notify
2402 application.SendNotification();
2403 application.Render();
2405 // Tap on the text editor
2406 TestGenerateTap(application, 3.0f, 25.0f);
2408 // Render and notify
2409 application.SendNotification();
2410 application.Render();
2412 // Move to second line of the text.
2413 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2415 // Render and notify
2416 application.SendNotification();
2417 application.Render();
2419 // Select some text in the right of the current cursor position
2420 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2421 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2422 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2423 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2425 // Render and notify
2426 application.SendNotification();
2427 application.Render();
2429 // Cut the selected text
2430 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2431 application.ProcessEvent(GenerateKey("x", "", "x", KEY_X_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "x", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2433 // Render and notify
2434 application.SendNotification();
2435 application.Render();
2437 DALI_TEST_EQUALS("Hello\nld\nHello world", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2439 // Select some text in the left of the current cursor position
2440 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2441 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2442 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2443 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2445 // Render and notify
2446 application.SendNotification();
2447 application.Render();
2449 // Copy the selected text
2450 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2451 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2453 // Render and notify
2454 application.SendNotification();
2455 application.Render();
2457 // Move the cursor to the third line
2458 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2459 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2461 // Render and notify
2462 application.SendNotification();
2463 application.Render();
2465 // Paste the selected text at the current cursor position
2466 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2467 application.ProcessEvent(GenerateKey("v", "", "v", KEY_V_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "v", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2469 // Render and notify
2470 application.SendNotification();
2471 application.Render();
2473 DALI_TEST_EQUALS("Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2475 // Disable Shift Selection
2476 editor.SetProperty(DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false);
2478 // Test to select some text in the right of the current cursor position
2479 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2480 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2481 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2482 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2484 // Render and notify
2485 application.SendNotification();
2486 application.Render();
2488 // Cut the selected text
2489 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2490 application.ProcessEvent(GenerateKey("x", "", "x", KEY_X_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "x", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2492 // Render and notify
2493 application.SendNotification();
2494 application.Render();
2496 // The text isn't selected and not changed because of 'SetProperty( DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false )'
2497 DALI_TEST_EQUALS("Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2499 // Test to select some text in the left of the current cursor position
2500 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2501 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2502 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2503 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2505 // Render and notify
2506 application.SendNotification();
2507 application.Render();
2509 // Copy the selected text
2510 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2511 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2513 // Render and notify
2514 application.SendNotification();
2515 application.Render();
2517 // The text is not selected and not changed because of 'SetProperty( DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false )'
2518 DALI_TEST_EQUALS("Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2521 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2523 // Render and notify
2524 application.SendNotification();
2525 application.Render();
2527 // replace text with "c"
2528 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2530 // Render and notify
2531 application.SendNotification();
2532 application.Render();
2535 DALI_TEST_EQUALS("c", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2538 DevelTextEditor::SelectWholeText(editor);
2540 // Render and notify
2541 application.SendNotification();
2542 application.Render();
2544 // Copy the selected text using logical keys
2545 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2546 application.ProcessEvent(GenerateKey("ؤ", "c", "ؤ", KEY_C_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2548 // Render and notify
2549 application.SendNotification();
2550 application.Render();
2553 DevelTextEditor::SelectNone(editor);
2555 // Render and notify
2556 application.SendNotification();
2557 application.Render();
2559 // Paste the selected using logical keys
2560 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2561 application.ProcessEvent(GenerateKey("ر", "v", "ر", KEY_V_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "v", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2564 DALI_TEST_EQUALS("cc", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2566 // select all using logical keys
2567 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2568 application.ProcessEvent(GenerateKey("ش", "a", "ش", KEY_A_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2570 // Render and notify
2571 application.SendNotification();
2572 application.Render();
2574 // cut text using logical keys
2575 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2576 application.ProcessEvent(GenerateKey("ء", "x", "ء", KEY_X_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "x", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2578 // Render and notify
2579 application.SendNotification();
2580 application.Render();
2583 DALI_TEST_EQUALS("", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2588 int utcDaliTextEditorEvent08(void)
2590 ToolkitTestApplication application;
2591 tet_infoline(" utcDaliTextEditorEvent08");
2593 // Checks if the highlight actor is released correctly.
2595 TextEditor editor = TextEditor::New();
2596 DALI_TEST_CHECK(editor);
2598 application.GetScene().Add(editor);
2600 editor.SetProperty(TextEditor::Property::TEXT, "DALi");
2601 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2602 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2603 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2604 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2606 // Avoid a crash when core load gl resources.
2607 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2609 // Render and notify
2610 application.SendNotification();
2611 application.Render();
2613 // Tap on the text editor
2614 TestGenerateTap(application, 3.0f, 25.0f);
2616 // Render and notify
2617 application.SendNotification();
2618 application.Render();
2620 // When the left selection handle and the right selection handle are at the same position, the highlight box should be deactivated.
2621 // Test to select some text in the left of the current cursor position
2622 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2623 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2624 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2625 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2627 // Render and notify
2628 application.SendNotification();
2629 application.Render();
2631 // Test to the left selection handle position and the right selection handle position
2632 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2633 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2634 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2635 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2637 // Render and notify
2638 application.SendNotification();
2639 application.Render();
2641 // Test to select full text in the left of the current cursor position
2642 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2643 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2644 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2645 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2646 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2647 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2649 // Render and notify
2650 application.SendNotification();
2651 application.Render();
2653 // Test to release the current full text selection
2654 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2655 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2657 // Render and notify
2658 application.SendNotification();
2659 application.Render();
2661 // Test to move the current cursor position correctly
2662 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2664 // Render and notify
2665 application.SendNotification();
2666 application.Render();
2669 application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2671 // Render and notify
2672 application.SendNotification();
2673 application.Render();
2675 DALI_TEST_EQUALS("DdALi", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2677 // Test to select some text in the right of the current cursor position
2678 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2679 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2680 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2682 // Render and notify
2683 application.SendNotification();
2684 application.Render();
2686 // Test the cursor position with right arrow key
2687 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2689 // Render and notify
2690 application.SendNotification();
2691 application.Render();
2694 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2696 // Render and notify
2697 application.SendNotification();
2698 application.Render();
2700 DALI_TEST_EQUALS("DdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2702 // Test to select some text in the left of the current cursor position
2703 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2704 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2705 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2706 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2707 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2709 // Render and notify
2710 application.SendNotification();
2711 application.Render();
2713 // Test the cursor position with left arrow key
2714 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2716 // Render and notify
2717 application.SendNotification();
2718 application.Render();
2721 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2723 // Render and notify
2724 application.SendNotification();
2725 application.Render();
2727 DALI_TEST_EQUALS("DcdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2729 // Test to select some text in the right of the current cursor position
2730 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2731 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2732 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2733 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2735 // Render and notify
2736 application.SendNotification();
2737 application.Render();
2739 // Test the cursor position with left arrow key
2740 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2742 // Render and notify
2743 application.SendNotification();
2744 application.Render();
2747 application.ProcessEvent(GenerateKey("x", "", "x", KEY_X_CODE, 0, 0, Integration::KeyEvent::DOWN, "x", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2749 // Render and notify
2750 application.SendNotification();
2751 application.Render();
2753 DALI_TEST_EQUALS("DcxdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2755 // Test to select some text in the left of the current cursor position
2756 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2757 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2758 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2759 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2761 // Render and notify
2762 application.SendNotification();
2763 application.Render();
2765 // Test the cursor position with right arrow key
2766 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2768 // Render and notify
2769 application.SendNotification();
2770 application.Render();
2773 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2775 // Render and notify
2776 application.SendNotification();
2777 application.Render();
2779 DALI_TEST_EQUALS("DcxcdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2784 int utcDaliTextEditorHandles(void)
2786 ToolkitTestApplication application;
2787 tet_infoline(" utcDaliTextEditorHandles");
2789 TextEditor editor = TextEditor::New();
2790 DALI_TEST_CHECK(editor);
2792 application.GetScene().Add(editor);
2794 editor.SetProperty(TextEditor::Property::TEXT, "This is a long text for the size of the text-editor.");
2795 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2796 editor.SetProperty(TextEditor::Property::GRAB_HANDLE_IMAGE, HANDLE_IMAGE_FILE_NAME);
2797 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL, true);
2799 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, Property::Map{{"filename", HANDLE_LEFT_SELECTION_FILE_NAME}});
2800 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT, Property::Map{{"filename", HANDLE_LEFT_SELECTION_FILE_NAME}});
2801 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT, Property::Map{{"filename", HANDLE_RIGHT_SELECTION_FILE_NAME}});
2802 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, Property::Map{{"filename", HANDLE_RIGHT_SELECTION_FILE_NAME}});
2804 editor.SetProperty(Actor::Property::SIZE, Vector2(30.f, 500.f));
2805 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2806 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2808 // Avoid a crash when core load gl resources.
2809 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2811 // Render and notify
2812 application.SendNotification();
2813 application.Render();
2815 // Tap first to get the focus.
2816 TestGenerateTap(application, 3.0f, 25.0f, 100);
2818 // Render and notify
2819 application.SendNotification();
2820 application.Render();
2822 // Tap to create the grab handle.
2823 TestGenerateTap(application, 3.0f, 25.0f, 700);
2825 // Render and notify
2826 application.SendNotification();
2827 application.Render();
2829 // Get the active layer where the text's decoration is added.
2830 Actor activeLayer = editor.GetChildAt(1u);
2832 // Get the handle's actor.
2833 Actor handle = activeLayer.GetChildAt(0u);
2834 handle.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
2836 // Render and notify
2837 application.SendNotification();
2838 application.Render();
2840 // Touch the grab handle to set it as pressed.
2841 Vector2 touchPos(10.0f, 50.0f);
2842 Dali::Integration::TouchEvent event;
2843 event = Dali::Integration::TouchEvent();
2844 event.AddPoint(GetPointDownInside(touchPos));
2845 application.ProcessEvent(event);
2847 // Render and notify
2848 application.SendNotification();
2849 application.Render();
2851 // Pan the grab handle
2852 uint32_t time = 100;
2853 TestStartPan(application, Vector2(10.0f, 50.0f), Vector2(10.0f, 50.0f), time);
2854 TestMovePan(application, Vector2(10.0f, 30.0f), time);
2855 TestEndPan(application, Vector2(10.0f, 50.0f), time);
2856 application.SendNotification();
2857 application.Render();
2859 // Release the grab handle.
2860 event = Dali::Integration::TouchEvent();
2861 event.AddPoint(GetPointUpInside(touchPos));
2862 application.ProcessEvent(event);
2864 // Render and notify
2865 application.SendNotification();
2866 application.Render();
2868 // Tap first to get the focus.
2869 TestGenerateTap(application, 3.0f, 25.0f, 1400);
2871 // Render and notify
2872 application.SendNotification();
2873 application.Render();
2875 // Double tap to select a word and create the selection handles.
2876 TestGenerateTap(application, 3.0f, 25.0f, 1500);
2878 // Render and notify
2879 application.SendNotification();
2880 application.Render();
2882 touchPos = Vector2(10.0f, 50.0f);
2884 // Touch the left selection handle to set it as pressed.
2885 event = Dali::Integration::TouchEvent();
2886 event.AddPoint(GetPointDownInside(touchPos));
2887 application.ProcessEvent(event);
2889 // Render and notify
2890 application.SendNotification();
2891 application.Render();
2893 // Release the left selection handle.
2894 event = Dali::Integration::TouchEvent();
2895 event.AddPoint(GetPointUpInside(touchPos));
2896 application.ProcessEvent(event);
2898 // Render and notify
2899 application.SendNotification();
2900 application.Render();
2905 int utcDaliTextEditorUnderPropertyStringP(void)
2907 ToolkitTestApplication application;
2908 tet_infoline(" utcDaliTextEditorUnderPropertyStringP");
2909 TextEditor editor = TextEditor::New();
2910 DALI_TEST_CHECK(editor);
2912 std::string underlineSettings1("{\"enable\":\"true\",\"color\":\"red\",\"height\":\"1\",\"type\":\"SOLID\",\"dashWidth\":\"2\",\"dashGap\":\"1\"}");
2914 application.GetScene().Add(editor);
2916 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineSettings1);
2917 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::UNDERLINE), underlineSettings1, TEST_LOCATION);
2919 tet_infoline("Set underline settings with a map");
2920 // Check the input underline property
2921 Property::Map underlineMapSet;
2922 Property::Map underlineMapGet;
2923 underlineMapSet.Insert("enable", true);
2924 underlineMapSet.Insert("color", Color::BLUE);
2925 underlineMapSet.Insert("height", 1);
2926 underlineMapSet.Insert("type", Text::Underline::SOLID);
2927 underlineMapSet.Insert("dashWidth", 2);
2928 underlineMapSet.Insert("dashGap", 1);
2930 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
2931 editor.SetProperty(TextEditor::Property::TEXT, "text");
2932 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
2933 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
2934 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapSet, underlineMapGet), true, TEST_LOCATION);
2936 application.SendNotification();
2937 application.Render();
2939 underlineMapSet.Clear();
2940 underlineMapGet.Clear();
2942 tet_infoline("Set dashed underline settings with a map");
2943 // Check the input underline property
2944 underlineMapSet.Clear();
2945 underlineMapGet.Clear();
2946 underlineMapSet.Insert("enable", true);
2947 underlineMapSet.Insert("color", Color::BLUE);
2948 underlineMapSet.Insert("height", 1);
2949 underlineMapSet.Insert("type", Text::Underline::DASHED);
2950 underlineMapSet.Insert("dashWidth", 5);
2951 underlineMapSet.Insert("dashGap", 3);
2953 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
2954 editor.SetProperty(TextEditor::Property::TEXT, "text");
2955 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
2956 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
2957 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapSet, underlineMapGet), true, TEST_LOCATION);
2959 // Check the input underline property
2960 underlineMapSet.Clear();
2961 underlineMapGet.Clear();
2962 underlineMapSet.Insert("enable", true);
2963 underlineMapSet.Insert("color", Color::BLUE);
2964 underlineMapSet.Insert("height", 1);
2965 underlineMapSet.Insert("type", Text::Underline::DOUBLE);
2966 underlineMapSet.Insert("dashWidth", 5);
2967 underlineMapSet.Insert("dashGap", 3);
2969 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
2970 editor.SetProperty(TextEditor::Property::TEXT, "text");
2971 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
2972 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
2973 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapSet, underlineMapGet), true, TEST_LOCATION);
2975 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
2976 editor.SetProperty(TextEditor::Property::TEXT, "text");
2977 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
2978 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
2979 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapSet, underlineMapGet), true, TEST_LOCATION);
2981 application.SendNotification();
2982 application.Render();
2984 underlineMapSet.Clear();
2985 underlineMapGet.Clear();
2987 tet_infoline("Set underline settings with a string");
2988 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineSettings1);
2989 Property::Value value = editor.GetProperty(TextEditor::Property::UNDERLINE);
2992 DALI_TEST_EQUALS(result, underlineSettings1, TEST_LOCATION);
2994 tet_infoline("Trying to set invalid underline settings, should not update and stay at previous settings");
2995 std::string underlineSettingsVoid("{\"enable\":\"true\",\"coooolor\":\"blue\",\"heeeight\":\"4\"}");
2996 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineSettingsVoid);
2997 value = editor.GetProperty(TextEditor::Property::UNDERLINE);
2999 DALI_TEST_EQUALS(result, underlineSettings1, TEST_LOCATION);
3004 int utcDaliTextEditorStrikethroughPropertyStringP(void)
3006 ToolkitTestApplication application;
3007 tet_infoline(" utcDaliTextEditorStrikethroughPropertyStringP");
3008 TextEditor editor = TextEditor::New();
3009 DALI_TEST_CHECK(editor);
3011 std::string strikethroughSettings1("{\"enable\":\"true\",\"color\":\"red\",\"height\":\"2\"}");
3013 application.GetScene().Add(editor);
3015 editor.SetProperty(DevelTextEditor::Property::STRIKETHROUGH, strikethroughSettings1);
3016 DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::STRIKETHROUGH), strikethroughSettings1, TEST_LOCATION);
3018 tet_infoline("Set strikethrough settings with a map");
3019 // Check the input strikethrough property
3020 Property::Map strikethroughMapSet;
3021 Property::Map strikethroughMapGet;
3022 strikethroughMapSet.Insert("enable", true);
3023 strikethroughMapSet.Insert("color", Color::BLUE);
3024 strikethroughMapSet.Insert("height", 2.0f);
3026 editor.SetProperty(DevelTextEditor::Property::STRIKETHROUGH, strikethroughMapSet);
3027 strikethroughMapGet = editor.GetProperty<Property::Map>(DevelTextEditor::Property::STRIKETHROUGH);
3028 DALI_TEST_EQUALS(strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION);
3029 DALI_TEST_EQUALS(DaliTestCheckMaps(strikethroughMapSet, strikethroughMapGet), true, TEST_LOCATION);
3031 tet_infoline("Set strikethrough settings with a string");
3032 editor.SetProperty(DevelTextEditor::Property::STRIKETHROUGH, strikethroughSettings1);
3033 Property::Value value = editor.GetProperty(DevelTextEditor::Property::STRIKETHROUGH);
3036 DALI_TEST_EQUALS(result, strikethroughSettings1, TEST_LOCATION);
3038 tet_infoline("Trying to set invalid strikethrough settings, should not update and stay at previous settings");
3039 std::string strikethroughSettingsVoid("{\"enable\":\"true\",\"coooolor\":\"blue\",\"height\":\"2\"}");
3040 editor.SetProperty(DevelTextEditor::Property::STRIKETHROUGH, strikethroughSettingsVoid);
3041 value = editor.GetProperty(TextEditor::Property::UNDERLINE);
3043 DALI_TEST_EQUALS(result, strikethroughSettings1, TEST_LOCATION);
3048 int utcDaliTextEditorShadowPropertyStringP(void)
3050 ToolkitTestApplication application;
3051 tet_infoline(" utcDaliTextEditorShadowPropertyStringP Setting Shadow propeties by string");
3053 TextEditor editor = TextEditor::New();
3055 std::string shadowSettings("{\"color\":\"green\",\"offset\":\"2 2\",\"blurRadius\":\"0\"}");
3057 application.GetScene().Add(editor);
3059 editor.SetProperty(TextEditor::Property::SHADOW, "{\"color\":\"green\",\"offset\":\"2 2\",\"blurRadius\":\"0\"}");
3061 Property::Value value = editor.GetProperty<std::string>(TextEditor::Property::SHADOW);
3065 DALI_TEST_EQUALS(result, shadowSettings, TEST_LOCATION);
3070 int utcDaliTextEditorFontStylePropertyStringP(void)
3072 ToolkitTestApplication application;
3073 tet_infoline(" utcDaliTextEditorFontStylePropertyStringP Setting FontStyle propeties by string");
3075 TextEditor editor = TextEditor::New();
3077 std::string fontStyleSettings("{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}");
3079 application.GetScene().Add(editor);
3081 editor.SetProperty(TextEditor::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}");
3083 Property::Value value = editor.GetProperty<std::string>(TextEditor::Property::FONT_STYLE);
3087 DALI_TEST_EQUALS(result, fontStyleSettings, TEST_LOCATION);
3092 int utcDaliTextEditorGetPropertyLinecountP(void)
3094 ToolkitTestApplication application;
3096 tet_infoline(" utcDaliTextEditorGetPropertyLinecount getting line count property");
3100 TextEditor editor = TextEditor::New();
3101 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10);
3102 editor.SetProperty(TextEditor::Property::TEXT,
3103 "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST ");
3105 application.GetScene().Add(editor);
3107 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
3108 lineCount = editor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3109 DALI_TEST_EQUALS(lineCount, 14, TEST_LOCATION);
3111 editor.SetProperty(Actor::Property::SIZE, Vector2(50.f, 100.f));
3112 lineCount = editor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3113 DALI_TEST_EQUALS(lineCount, 28, TEST_LOCATION);
3118 int utcDaliTextEditorScrollStateChangedSignalTest(void)
3120 ToolkitTestApplication application;
3121 tet_infoline(" UtcDaliTextEditorScrollStateChangedSignalTest");
3123 TextEditor editor = TextEditor::New();
3124 DALI_TEST_CHECK(editor);
3126 application.GetScene().Add(editor);
3128 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
3129 editor.SetProperty(Actor::Property::SIZE, Vector2(50.f, 50.f));
3130 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3131 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3132 editor.SetProperty(TextEditor::Property::ENABLE_SCROLL_BAR, true);
3133 editor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
3135 bool startedCalled = false;
3136 bool finishedCalled = false;
3138 ScrollStateChangeCallback callback(startedCalled, finishedCalled);
3139 editor.ScrollStateChangedSignal().Connect(&callback, &ScrollStateChangeCallback::Callback);
3141 KeyboardFocusManager::Get().SetCurrentFocusActor(editor);
3143 // Render and notify
3144 application.SendNotification();
3145 application.Render();
3147 editor.SetProperty(TextEditor::Property::TEXT, "Long enough message for TextEditor!");
3148 application.SendNotification();
3149 application.Render(6000);
3151 application.SendNotification();
3152 DALI_TEST_EQUALS(startedCalled, true, TEST_LOCATION);
3153 DALI_TEST_EQUALS(finishedCalled, true, TEST_LOCATION);
3158 int UtcDaliToolkitTextEditorTextWrapMode(void)
3160 ToolkitTestApplication application;
3161 tet_infoline(" UtcDaliToolkitTextEditorTextWarpMode");
3165 TextEditor editor = TextEditor::New();
3166 editor.SetProperty(Actor::Property::SIZE, Vector2(150.0f, 300.f));
3167 editor.SetProperty(TextEditor::Property::TEXT, "Hello world Hello world");
3169 application.GetScene().Add(editor);
3171 editor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, "WORD");
3172 DALI_TEST_EQUALS(editor.GetProperty<int>(TextEditor::Property::LINE_WRAP_MODE), static_cast<int>(Text::LineWrap::WORD), TEST_LOCATION);
3174 application.SendNotification();
3175 application.Render();
3177 lineCount = editor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3178 DALI_TEST_EQUALS(lineCount, 4, TEST_LOCATION);
3180 editor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, "CHARACTER");
3181 DALI_TEST_EQUALS(editor.GetProperty<int>(TextEditor::Property::LINE_WRAP_MODE), static_cast<int>(Text::LineWrap::CHARACTER), TEST_LOCATION);
3183 application.SendNotification();
3184 application.Render();
3186 lineCount = editor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3187 DALI_TEST_EQUALS(lineCount, 3, TEST_LOCATION);
3189 editor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, Text::LineWrap::WORD);
3190 DALI_TEST_EQUALS(editor.GetProperty<int>(TextEditor::Property::LINE_WRAP_MODE), static_cast<int>(Text::LineWrap::WORD), TEST_LOCATION);
3192 application.SendNotification();
3193 application.Render();
3195 lineCount = editor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3196 DALI_TEST_EQUALS(lineCount, 4, TEST_LOCATION);
3198 editor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, Text::LineWrap::CHARACTER);
3199 DALI_TEST_EQUALS(editor.GetProperty<int>(TextEditor::Property::LINE_WRAP_MODE), static_cast<int>(Text::LineWrap::CHARACTER), TEST_LOCATION);
3201 application.SendNotification();
3202 application.Render();
3204 lineCount = editor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3205 DALI_TEST_EQUALS(lineCount, 3, TEST_LOCATION);
3210 int UtcDaliTextEditorSetPaddingProperty(void)
3212 ToolkitTestApplication application;
3213 tet_infoline("UtcDaliTextEditorSetPaddingProperty\n");
3215 TextEditor editor = TextEditor::New();
3216 DALI_TEST_CHECK(editor);
3217 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3218 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3219 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3220 application.GetScene().Add(editor);
3222 application.SendNotification();
3223 application.Render();
3225 Vector3 originalSize = editor.GetNaturalSize();
3227 editor.SetProperty(Toolkit::Control::Property::PADDING, Extents(10, 10, 10, 10));
3229 application.SendNotification();
3230 application.Render();
3232 DALI_TEST_EQUALS(editor.GetProperty<Extents>(Toolkit::Control::Property::PADDING), Extents(10, 10, 10, 10), TEST_LOCATION);
3234 Vector3 paddingAddedSize = editor.GetNaturalSize();
3236 DALI_TEST_EQUALS(originalSize.width + 10 + 10, paddingAddedSize.width, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
3238 DALI_TEST_EQUALS(originalSize.height + 10 + 10, paddingAddedSize.height, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
3243 int UtcDaliTextEditorEnableShiftSelectionProperty(void)
3245 ToolkitTestApplication application;
3246 tet_infoline("UtcDaliTextEditorEnableShiftSelectionProperty");
3248 TextEditor editor = TextEditor::New();
3249 DALI_TEST_CHECK(editor);
3250 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3251 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3252 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3253 application.GetScene().Add(editor);
3255 application.SendNotification();
3256 application.Render();
3258 // The default value of ENABLE_SHIFT_SELECTION is 'true'.
3259 DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_SHIFT_SELECTION), true, TEST_LOCATION);
3261 // Check the enable shift selection property
3262 editor.SetProperty(DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false);
3263 DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_SHIFT_SELECTION), false, TEST_LOCATION);
3265 application.SendNotification();
3266 application.Render();
3271 int UtcDaliTextEditorEnableGrabHandleProperty(void)
3273 ToolkitTestApplication application;
3274 tet_infoline("UtcDaliTextEditorEnableGrabHandleProperty");
3276 TextEditor editor = TextEditor::New();
3277 DALI_TEST_CHECK(editor);
3278 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3279 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3280 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3281 application.GetScene().Add(editor);
3283 application.SendNotification();
3284 application.Render();
3286 // The default value of ENABLE_GRAB_HANDLE is 'true'.
3287 DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_GRAB_HANDLE), true, TEST_LOCATION);
3289 // Check the enable grab handle property
3290 editor.SetProperty(DevelTextEditor::Property::ENABLE_GRAB_HANDLE, false);
3291 DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_GRAB_HANDLE), false, TEST_LOCATION);
3293 application.SendNotification();
3294 application.Render();
3299 int UtcDaliTextEditorMatchSystemLanguageDirectionProperty(void)
3301 ToolkitTestApplication application;
3302 tet_infoline("UtcDaliTextEditorMatchSystemLanguageDirectionProperty");
3304 TextEditor editor = TextEditor::New();
3305 DALI_TEST_CHECK(editor);
3306 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3307 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3308 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3309 application.GetScene().Add(editor);
3311 application.SendNotification();
3312 application.Render();
3314 // The default value of MATCH_SYSTEM_LANGUAGE_DIRECTION is 'true'.
3315 DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION), true, TEST_LOCATION);
3317 // Check the disable match system language direction property
3318 editor.SetProperty(DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, false);
3319 DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION), false, TEST_LOCATION);
3321 application.SendNotification();
3322 application.Render();
3327 int UtcDaliTextEditorGetInputMethodContext(void)
3329 ToolkitTestApplication application;
3330 tet_infoline("UtcDaliTextEditorGetInputMethodContext");
3332 TextEditor editor = TextEditor::New();
3333 DALI_TEST_CHECK(DevelTextEditor::GetInputMethodContext(editor));
3338 int utcDaliTextEditorMaxCharactersReached(void)
3340 ToolkitTestApplication application;
3341 tet_infoline("utcDaliTextEditorMaxCharactersReached");
3343 TextEditor editor = TextEditor::New();
3344 DALI_TEST_CHECK(editor);
3346 application.GetScene().Add(editor);
3348 const int maxNumberOfCharacters = 1;
3349 editor.SetProperty(DevelTextEditor::Property::MAX_LENGTH, maxNumberOfCharacters);
3350 DALI_TEST_EQUALS(editor.GetProperty<int>(DevelTextEditor::Property::MAX_LENGTH), maxNumberOfCharacters, TEST_LOCATION);
3352 editor.SetKeyInputFocus();
3354 // connect to the text changed signal.
3355 ConnectionTracker* testTracker = new ConnectionTracker();
3356 DevelTextEditor::MaxLengthReachedSignal(editor).Connect(&TestMaxLengthReachedCallback);
3357 bool maxLengthReachedSignal = false;
3358 editor.ConnectSignal(testTracker, "maxLengthReached", CallbackFunctor(&maxLengthReachedSignal));
3360 gMaxCharactersCallBackCalled = false;
3362 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
3363 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
3365 DALI_TEST_CHECK(gMaxCharactersCallBackCalled);
3366 DALI_TEST_CHECK(maxLengthReachedSignal);
3371 int utcDaliTextEditorInputFiltered(void)
3373 ToolkitTestApplication application;
3374 tet_infoline(" utcDaliTextEditorInputFiltered");
3375 TextEditor editor = TextEditor::New();
3376 DALI_TEST_CHECK(editor);
3378 application.GetScene().Add(editor);
3380 Property::Map inputFilter;
3382 // Only digit is accepted.
3383 inputFilter[InputFilter::Property::ACCEPTED] = "[\\d]";
3385 // Set input filter to TextEditor.
3386 editor.SetProperty(DevelTextEditor::Property::INPUT_FILTER, inputFilter);
3388 editor.SetKeyInputFocus();
3390 // connect to the input filtered signal.
3391 ConnectionTracker* testTracker = new ConnectionTracker();
3392 DevelTextEditor::InputFilteredSignal(editor).Connect(&TestInputFilteredCallback);
3393 bool inputFilteredSignal = false;
3394 editor.ConnectSignal(testTracker, "inputFiltered", CallbackFunctor(&inputFilteredSignal));
3396 gInputFilteredAcceptedCallbackCalled = false;
3398 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
3400 DALI_TEST_CHECK(gInputFilteredAcceptedCallbackCalled);
3401 DALI_TEST_CHECK(inputFilteredSignal);
3403 // Word is rejected.
3404 inputFilter[InputFilter::Property::ACCEPTED] = "";
3405 inputFilter[InputFilter::Property::REJECTED] = "[\\w]";
3407 // Set input filter to TextEditor.
3408 editor.SetProperty(DevelTextEditor::Property::INPUT_FILTER, inputFilter);
3410 editor.SetKeyInputFocus();
3412 inputFilteredSignal = false;
3413 gInputFilteredRejectedCallbackCalled = false;
3415 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
3417 DALI_TEST_CHECK(gInputFilteredAcceptedCallbackCalled);
3418 DALI_TEST_CHECK(inputFilteredSignal);
3423 int UtcDaliTextEditorSelectWholeText(void)
3425 ToolkitTestApplication application;
3426 tet_infoline(" UtcDaliTextEditorSelectWholeText ");
3428 TextEditor textEditor = TextEditor::New();
3430 application.GetScene().Add(textEditor);
3432 textEditor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3433 textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3434 textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3436 // Avoid a crash when core load gl resources.
3437 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
3439 application.SendNotification();
3440 application.Render();
3442 DALI_TEST_EQUALS(1u, textEditor.GetChildCount(), TEST_LOCATION);
3444 DevelTextEditor::SelectWholeText(textEditor);
3446 application.SendNotification();
3447 application.Render();
3449 // Nothing should have been selected. The number of children is still 1
3450 DALI_TEST_EQUALS(1u, textEditor.GetChildCount(), TEST_LOCATION);
3452 textEditor.SetProperty(TextEditor::Property::TEXT, "Hello world");
3454 application.SendNotification();
3455 application.Render();
3457 DevelTextEditor::SelectWholeText(textEditor);
3459 application.SendNotification();
3460 application.Render();
3462 // Should be 2 children, the stencil and the layer
3463 DALI_TEST_EQUALS(2u, textEditor.GetChildCount(), TEST_LOCATION);
3465 // The offscreen root actor should have two actors: the renderer and the highlight actor.
3466 Actor stencil = textEditor.GetChildAt(0u);
3468 // The highlight actor is drawn first, so is the first actor in the list
3469 Renderer highlight = stencil.GetChildAt(0u).GetRendererAt(0u);
3470 DALI_TEST_CHECK(highlight);
3475 int UtcDaliTextEditorSelectText(void)
3477 ToolkitTestApplication application;
3478 tet_infoline(" UtcDaliTextEditorSelectText ");
3480 TextEditor textEditor = TextEditor::New();
3482 application.GetScene().Add(textEditor);
3484 textEditor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3485 textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3486 textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3488 // Avoid a crash when core load gl resources.
3489 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
3491 application.SendNotification();
3492 application.Render();
3494 DevelTextEditor::SelectText(textEditor, 0, 5);
3496 application.SendNotification();
3497 application.Render();
3499 // Nothing is selected
3500 std::string selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
3501 DALI_TEST_EQUALS("", selectedText, TEST_LOCATION);
3503 textEditor.SetProperty(TextEditor::Property::TEXT, "Hello world");
3505 application.SendNotification();
3506 application.Render();
3508 DevelTextEditor::SelectText(textEditor, 0, 5);
3510 application.SendNotification();
3511 application.Render();
3513 selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
3514 DALI_TEST_EQUALS("Hello", selectedText, TEST_LOCATION);
3516 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 0, TEST_LOCATION);
3517 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 5, TEST_LOCATION);
3519 // world is selected
3520 DevelTextEditor::SelectText(textEditor, 6, 11);
3522 application.SendNotification();
3523 application.Render();
3525 selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
3526 DALI_TEST_EQUALS("world", selectedText, TEST_LOCATION);
3528 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 6, TEST_LOCATION);
3529 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 11, TEST_LOCATION);
3534 int UtcDaliTextEditorSelectNone(void)
3536 ToolkitTestApplication application;
3537 tet_infoline(" UtcDaliTextEditorSelectWholeText ");
3539 TextEditor textEditor = TextEditor::New();
3541 application.GetScene().Add(textEditor);
3543 textEditor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3544 textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3545 textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3547 // Avoid a crash when core load gl resources.
3548 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
3550 application.SendNotification();
3551 application.Render();
3553 textEditor.SetProperty(TextEditor::Property::TEXT, "Hello world");
3555 application.SendNotification();
3556 application.Render();
3558 // Nothing is selected
3559 std::string selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
3560 DALI_TEST_EQUALS("", selectedText, TEST_LOCATION);
3562 DevelTextEditor::SelectWholeText(textEditor);
3564 application.SendNotification();
3565 application.Render();
3567 // whole text is selected
3568 selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
3569 DALI_TEST_EQUALS("Hello world", selectedText, TEST_LOCATION);
3571 DevelTextEditor::SelectNone(textEditor);
3573 application.SendNotification();
3574 application.Render();
3576 // Nothing is selected
3577 selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
3578 DALI_TEST_EQUALS("", selectedText, TEST_LOCATION);
3583 int UtcDaliTextEditorSelectRange(void)
3585 ToolkitTestApplication application;
3586 tet_infoline("utcDaliTextEditorSelectRange");
3588 TextEditor textEditor = TextEditor::New();
3589 DALI_TEST_CHECK(textEditor);
3591 application.GetScene().Add(textEditor);
3593 // Avoid a crash when core load gl resources.
3594 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
3596 application.SendNotification();
3597 application.Render();
3599 textEditor.SetProperty(TextEditor::Property::TEXT, "Hello world");
3601 textEditor.SetProperty(DevelTextEditor::Property::SELECTED_TEXT_START, 0);
3602 textEditor.SetProperty(DevelTextEditor::Property::SELECTED_TEXT_END, 5);
3604 // Hello is selected
3605 std::string selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
3606 DALI_TEST_EQUALS("Hello", selectedText, TEST_LOCATION);
3608 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 0, TEST_LOCATION);
3609 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 5, TEST_LOCATION);
3614 int UtcDaliTextEditorEnableEditing(void)
3616 ToolkitTestApplication application;
3617 tet_infoline(" UtcDaliTextEditorEnableEditing ");
3619 TextEditor textEditor = TextEditor::New();
3621 application.GetScene().Add(textEditor);
3623 textEditor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3624 textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3625 textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3627 // Avoid a crash when core load gl resources.
3628 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
3630 application.SendNotification();
3631 application.Render();
3633 textEditor.SetKeyInputFocus();
3634 textEditor.SetProperty(DevelTextEditor::Property::ENABLE_EDITING, false);
3635 application.ProcessEvent(GenerateKey("D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
3637 // Render and notify
3638 application.SendNotification();
3639 application.Render();
3641 DALI_TEST_EQUALS(textEditor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "", TEST_LOCATION);
3642 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::ENABLE_EDITING).Get<bool>(), false, TEST_LOCATION);
3644 textEditor.SetKeyInputFocus();
3645 textEditor.SetProperty(DevelTextEditor::Property::ENABLE_EDITING, true);
3646 application.ProcessEvent(GenerateKey("D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
3648 // Render and notify
3649 application.SendNotification();
3650 application.Render();
3652 DALI_TEST_EQUALS(textEditor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "D", TEST_LOCATION);
3653 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::ENABLE_EDITING).Get<bool>(), true, TEST_LOCATION);
3658 int UtcDaliTextEditorScrolling(void)
3660 ToolkitTestApplication application;
3661 tet_infoline(" UtcDaliTextEditorScrolling ");
3663 TextEditor textEditor = TextEditor::New();
3664 DALI_TEST_CHECK(textEditor);
3666 application.GetScene().Add(textEditor);
3668 // Avoid a crash when core load gl resources.
3669 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
3671 application.SendNotification();
3672 application.Render();
3674 textEditor.SetProperty(TextEditor::Property::TEXT, "Tex1\nTex2\nTex3\nTex4\nTex5\nTex6\nTex7\nTex8");
3675 textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER);
3676 textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER);
3677 textEditor.SetProperty(Actor::Property::SIZE, Vector2(60.0f, 160.0f));
3679 application.SendNotification();
3680 application.Render();
3682 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::VERTICAL_SCROLL_POSITION).Get<float>(), 0.0f, TEST_LOCATION);
3683 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::HORIZONTAL_SCROLL_POSITION).Get<float>(), 0.0f, TEST_LOCATION);
3685 DevelTextEditor::ScrollBy(textEditor, Vector2(1.0f, 1.0f));
3687 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::VERTICAL_SCROLL_POSITION).Get<float>(), 1.0f, TEST_LOCATION);
3688 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::HORIZONTAL_SCROLL_POSITION).Get<float>(), 0.0f, TEST_LOCATION);
3690 DevelTextEditor::ScrollBy(textEditor, Vector2(0.0f, 1000.0f));
3692 DALI_TEST_NOT_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::VERTICAL_SCROLL_POSITION).Get<float>(), 1.0f, 0.1f, TEST_LOCATION);
3693 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::HORIZONTAL_SCROLL_POSITION).Get<float>(), 0.0f, TEST_LOCATION);
3695 textEditor.SetProperty(DevelTextEditor::Property::VERTICAL_SCROLL_POSITION, 0.0f);
3696 textEditor.SetProperty(DevelTextEditor::Property::HORIZONTAL_SCROLL_POSITION, 0.0f);
3698 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::VERTICAL_SCROLL_POSITION).Get<float>(), 0.0f, TEST_LOCATION);
3699 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::HORIZONTAL_SCROLL_POSITION).Get<float>(), 0.0f, TEST_LOCATION);
3704 int UtcDaliToolkitTextEditorFontSizeScale(void)
3706 ToolkitTestApplication application;
3707 tet_infoline(" UtcDaliToolkitTextEditorFontSizeScale");
3709 TextEditor textEditor = TextEditor::New();
3710 textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 30.f);
3711 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
3712 Vector3 nonScaledSize = textEditor.GetNaturalSize();
3714 TextEditor textEditorScaled = TextEditor::New();
3715 textEditorScaled.SetProperty(TextEditor::Property::POINT_SIZE, 15.f);
3716 textEditorScaled.SetProperty(Toolkit::DevelTextEditor::Property::FONT_SIZE_SCALE, 2.f);
3717 textEditorScaled.SetProperty(TextEditor::Property::TEXT, "Test");
3718 Vector3 scaledSize = textEditorScaled.GetNaturalSize();
3720 DALI_TEST_EQUALS(nonScaledSize, scaledSize, TEST_LOCATION);
3722 textEditor.SetProperty(TextEditor::Property::PIXEL_SIZE, 30.f);
3723 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
3724 nonScaledSize = textEditor.GetNaturalSize();
3726 textEditorScaled.SetProperty(TextEditor::Property::PIXEL_SIZE, 15.f);
3727 textEditorScaled.SetProperty(Toolkit::DevelTextEditor::Property::FONT_SIZE_SCALE, 2.f);
3728 textEditorScaled.SetProperty(TextEditor::Property::TEXT, "Test");
3729 scaledSize = textEditorScaled.GetNaturalSize();
3731 DALI_TEST_EQUALS(nonScaledSize, scaledSize, TEST_LOCATION);
3736 int UtcDaliTextEditorPrimaryCursorPosition(void)
3738 ToolkitTestApplication application;
3739 tet_infoline(" UtcDaliTextPrimaryCursorPosition ");
3741 TextEditor textEditor = TextEditor::New();
3743 application.GetScene().Add(textEditor);
3745 textEditor.SetProperty(TextEditor::Property::TEXT, "ABCEF");
3746 textEditor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3747 textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3748 textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3750 // Avoid a crash when core load gl resources.
3751 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
3753 textEditor.SetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 3);
3754 application.SendNotification();
3755 application.Render();
3756 textEditor.SetKeyInputFocus();
3758 application.ProcessEvent(GenerateKey("D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
3760 // Render and notify
3761 application.SendNotification();
3762 application.Render();
3764 DALI_TEST_EQUALS(textEditor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "ABCDEF", TEST_LOCATION);
3765 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION).Get<int>(), 4, TEST_LOCATION);
3770 int UtcDaliTextEditorLineCountAfterGetNaturalSize(void)
3772 ToolkitTestApplication application;
3773 tet_infoline(" UtcDaliTextEditorLineCountAfterGetNaturalSize ");
3775 TextEditor textEditor = TextEditor::New();
3776 textEditor.SetProperty(TextEditor::Property::TEXT, "A\nB\nC\nD\nE\nF\n");
3777 textEditor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3778 textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3779 textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3780 application.GetScene().Add(textEditor);
3782 application.SendNotification();
3783 application.Render();
3786 lineCount = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3787 DALI_TEST_EQUALS(lineCount, 7, TEST_LOCATION);
3789 textEditor.GetNaturalSize();
3791 // Create a tap event to touch the text editor.
3792 TestGenerateTap(application, 18.0f, 25.0f);
3794 application.SendNotification();
3795 application.Render();
3797 lineCount = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3798 DALI_TEST_EQUALS(lineCount, 7, TEST_LOCATION);
3803 int utcDaliTextEditorGetHeightForWidthDoesNotChangeLineCountScrollingCase(void)
3805 ToolkitTestApplication application;
3807 tet_infoline(" utcDaliTextEditorGetHeightForWidthDoesNotChangeLineCountScrollingCase ");
3809 int lineCountBefore = 0;
3810 int lineCountAfter = 0;
3812 // Create a text editor
3813 TextEditor textEditor = TextEditor::New();
3814 //Set very large font-size using point-size
3815 textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 10);
3816 //Specify font-family
3817 textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
3819 textEditor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
3820 //Set text longer than width of textEditor
3821 textEditor.SetProperty(TextEditor::Property::TEXT, "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST ");
3823 application.GetScene().Add(textEditor);
3825 application.SendNotification();
3826 application.Render();
3828 //Failed case is the GetHeightForWidth change LineCount then the scrollor will not arrive to latest line
3829 //GetHeightForWidth is a retrieval method which should not modify object
3830 lineCountBefore = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3831 textEditor.GetHeightForWidth(200.f);
3833 //This is to simulate focus into text editor after calling GetHeightForWidth
3834 //Create a tap event to touch the text editor.
3835 TestGenerateTap(application, 18.0f, 25.0f);
3837 application.SendNotification();
3838 application.Render();
3840 lineCountAfter = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3842 //The LineCount must not be changed when calling GetHeightForWidth.
3843 DALI_TEST_EQUALS(lineCountAfter, lineCountBefore, TEST_LOCATION);
3848 int utcDaliTextEditorGetHeightForWidthDoesNotChangeLineCountLineWrapCharCase(void)
3850 ToolkitTestApplication application;
3852 tet_infoline(" utcDaliTextEditorGetHeightForWidthDoesNotChangeLineCountLineWrapCharCase ");
3854 int lineCountBefore = 0;
3855 int lineCountAfter = 0;
3857 // Create a text editor
3858 TextEditor textEditor = TextEditor::New();
3859 //Set very large font-size using point-size
3860 textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 10);
3861 //Specify font-family
3862 textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
3864 textEditor.SetProperty(Actor::Property::SIZE, Vector2(50.f, 100.f));
3865 //Set text longer than width of textEditor
3866 textEditor.SetProperty(TextEditor::Property::TEXT, "qwertyuiopasdfghjklzxcvbnm\n");
3867 //Set line wrap mode Character
3868 textEditor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, "CHARACTER");
3870 application.GetScene().Add(textEditor);
3872 application.SendNotification();
3873 application.Render();
3875 //Failed case is the GetHeightForWidth change LineCount which make position of cursor invalid in TextEditor
3876 //GetHeightForWidth is a retrieval method which should not modify object
3877 lineCountBefore = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3878 textEditor.GetHeightForWidth(200.f);
3880 //This is to simulate focus into text editor after calling GetHeightForWidth
3881 //Create a tap event to touch the text editor.
3882 TestGenerateTap(application, 18.0f, 25.0f);
3884 application.SendNotification();
3885 application.Render();
3887 lineCountAfter = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3889 //The LineCount must not be changed when calling GetHeightForWidth.
3890 DALI_TEST_EQUALS(lineCountAfter, lineCountBefore, TEST_LOCATION);
3895 int utcDaliTextEditorGetHeightForWidthChangeLineCountWhenTextChanged(void)
3897 ToolkitTestApplication application;
3899 tet_infoline(" utcDaliTextEditorGetHeightForWidthChangeLineCountWhenTextChanged ");
3901 int lineCountBefore = 0;
3902 int lineCountAfter = 0;
3904 // Create a text editor
3905 TextEditor textEditor = TextEditor::New();
3906 //Set very large font-size using point-size
3907 textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 10);
3908 //Specify font-family
3909 textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
3911 textEditor.SetProperty(Actor::Property::SIZE, Vector2(200.f, 100.f));
3912 //Set text longer than width of textEditor
3913 textEditor.SetProperty(TextEditor::Property::TEXT, "Short text");
3914 //Set line wrap mode Character
3915 textEditor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, "CHARACTER");
3917 application.GetScene().Add(textEditor);
3919 application.SendNotification();
3920 application.Render();
3922 lineCountBefore = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3924 textEditor.SetProperty(TextEditor::Property::TEXT, "This is very loooooooooooooooooooooooooooooooooooong text for test");
3925 lineCountAfter = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3927 // When the text changed, the Line-count should be updated according to new text.
3928 // Because the GetHeightForWidth is called in Controller::GetLineCount(float width)
3929 DALI_TEST_EQUALS(lineCountBefore, 1, TEST_LOCATION);
3930 DALI_TEST_GREATER(lineCountAfter, 1, TEST_LOCATION);
3935 int utcDaliTextEditorGetNaturalSizeDoesNotChangeLineCountScrollingCase(void)
3937 ToolkitTestApplication application;
3939 tet_infoline(" utcDaliTextEditorGetNaturalSizeDoesNotChangeLineCountScrollingCase ");
3941 int lineCountBefore = 0;
3942 int lineCountAfter = 0;
3944 // Create a text editor
3945 TextEditor textEditor = TextEditor::New();
3946 //Set very large font-size using point-size
3947 textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 10);
3948 //Specify font-family
3949 textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
3951 textEditor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
3952 //Set text longer than width of textEditor
3953 textEditor.SetProperty(TextEditor::Property::TEXT, "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST ");
3955 application.GetScene().Add(textEditor);
3957 application.SendNotification();
3958 application.Render();
3960 //Failed case is the GetNaturalSize change LineCount then the scrollor will not arrive to latest line
3961 //GetNaturalSize is a retrieval method which should not modify object
3962 lineCountBefore = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3963 textEditor.GetNaturalSize();
3965 //This is to simulate focus into text editor after calling GetNaturalSize
3966 //Create a tap event to touch the text editor.
3967 TestGenerateTap(application, 18.0f, 25.0f);
3969 application.SendNotification();
3970 application.Render();
3972 lineCountAfter = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3974 //The LineCount must not be changed when calling GetNaturalSize.
3975 DALI_TEST_EQUALS(lineCountAfter, lineCountBefore, TEST_LOCATION);
3980 int utcDaliTextEditorGetNaturalSizeDoesNotChangeLineCountLineWrapCharCase(void)
3982 ToolkitTestApplication application;
3984 tet_infoline(" utcDaliTextEditorGetNaturalSizeDoesNotChangeLineCountLineWrapCharCase ");
3986 int lineCountBefore = 0;
3987 int lineCountAfter = 0;
3989 // Create a text editor
3990 TextEditor textEditor = TextEditor::New();
3991 //Set very large font-size using point-size
3992 textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 10);
3993 //Specify font-family
3994 textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
3996 textEditor.SetProperty(Actor::Property::SIZE, Vector2(50.f, 100.f));
3997 //Set text longer than width of textEditor
3998 textEditor.SetProperty(TextEditor::Property::TEXT, "qwertyuiopasdfghjklzxcvbnm\n");
3999 //Set line wrap mode Character
4000 textEditor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, "CHARACTER");
4002 application.GetScene().Add(textEditor);
4004 application.SendNotification();
4005 application.Render();
4007 //Failed case is the GetNaturalSize change LineCount which make position of cursor invalid in TextEditor
4008 //GetNaturalSize is a retrieval method which should not modify object
4009 lineCountBefore = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
4010 textEditor.GetNaturalSize();
4012 //This is to simulate focus into text editor after calling GetNaturalSize
4013 //Create a tap event to touch the text editor.
4014 TestGenerateTap(application, 18.0f, 25.0f);
4016 application.SendNotification();
4017 application.Render();
4019 lineCountAfter = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
4021 //The LineCount must not be changed when calling GetNaturalSize.
4022 DALI_TEST_EQUALS(lineCountAfter, lineCountBefore, TEST_LOCATION);
4027 int UtcDaliTextEditorAtlasLimitationIsEnabledForLargeFontPointSize(void)
4029 ToolkitTestApplication application;
4030 tet_infoline(" UtcDaliTextEditorAtlasLimitationIsEnabledForLargeFontPointSize ");
4032 // +2: First one to handle the equal case. Second one to handle odd to even case of GetNaturalSize
4033 const uint32_t lessThanWidth = TextAbstraction::FontClient::MAX_TEXT_ATLAS_WIDTH - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
4034 const uint32_t lessThanHeight = TextAbstraction::FontClient::MAX_TEXT_ATLAS_HEIGHT - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
4036 // Create a text editor
4037 TextEditor textEditor = TextEditor::New();
4039 //Set size to avoid automatic eliding
4040 textEditor.SetProperty(Actor::Property::SIZE, Vector2(1025, 1025));
4041 //Set very large font-size using point-size
4042 textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 1000);
4043 //Specify font-family
4044 textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
4045 //Set text to check if appear or not
4046 textEditor.SetProperty(TextEditor::Property::TEXT, "A");
4048 application.GetScene().Add(textEditor);
4050 application.SendNotification();
4051 application.Render();
4052 //Use GetNaturalSize to verify that size of block does not exceed Atlas size
4053 Vector3 naturalSize = textEditor.GetNaturalSize();
4055 DALI_TEST_GREATER(lessThanWidth, static_cast<uint32_t>(naturalSize.width), TEST_LOCATION);
4056 DALI_TEST_GREATER(lessThanHeight, static_cast<uint32_t>(naturalSize.height), TEST_LOCATION);
4061 int UtcDaliTextEditorAtlasLimitationIsEnabledPerformanceCases(void)
4063 ToolkitTestApplication application;
4064 tet_infoline(" UtcDaliTextEditorAtlasLimitationIsEnabledPerformanceCases ");
4066 // +2: First one to handle the equal case. Second one to handle odd to even case of GetNaturalSize
4067 const uint32_t lessThanWidth = TextAbstraction::FontClient::MAX_TEXT_ATLAS_WIDTH - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
4068 const uint32_t lessThanHeight = TextAbstraction::FontClient::MAX_TEXT_ATLAS_HEIGHT - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
4070 Vector3 naturalSize; //Use GetNaturalSize to verify that size of block does not exceed Atlas size
4071 // Create a text editor
4072 TextEditor textEditor = TextEditor::New();
4073 //Set size to avoid automatic eliding
4074 textEditor.SetProperty(Actor::Property::SIZE, Vector2(1025, 1025));
4075 textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
4076 textEditor.SetProperty(TextEditor::Property::TEXT, "A");
4078 const int numberOfCases = 6;
4079 int arrayCases[numberOfCases] = {323, 326, 330, 600, 1630, 2500};
4081 for(int index = 0; index < numberOfCases; index++)
4083 tet_printf(" UtcDaliTextEditorAtlasLimitationIsEnabledPerformanceCases point-size= %d \n", arrayCases[index]);
4084 textEditor.SetProperty(TextEditor::Property::POINT_SIZE, arrayCases[index]);
4085 application.GetScene().Add(textEditor);
4086 application.SendNotification();
4087 application.Render();
4088 naturalSize = textEditor.GetNaturalSize();
4089 DALI_TEST_GREATER(lessThanWidth, static_cast<uint32_t>(naturalSize.width), TEST_LOCATION);
4090 DALI_TEST_GREATER(lessThanHeight, static_cast<uint32_t>(naturalSize.height), TEST_LOCATION);
4096 int UtcDaliTextEditorHyphenWrapMode(void)
4098 ToolkitTestApplication application;
4099 tet_infoline(" UtcDaliTextEditorHyphenWrapMode ");
4102 TextEditor textEditor = TextEditor::New();
4104 textEditor.SetProperty(Actor::Property::SIZE, Vector2(150.0f, 300.f));
4106 application.GetScene().Add(textEditor);
4107 application.SendNotification();
4108 application.Render();
4110 textEditor.SetProperty(TextEditor::Property::TEXT, "Hi Experimen");
4111 textEditor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, DevelText::LineWrap::HYPHENATION);
4112 DALI_TEST_EQUALS(textEditor.GetProperty<int>(TextEditor::Property::LINE_WRAP_MODE), static_cast<int>(DevelText::LineWrap::HYPHENATION), TEST_LOCATION);
4114 application.SendNotification();
4115 application.Render();
4117 lineCount = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
4123 DALI_TEST_EQUALS(lineCount, 2, TEST_LOCATION);
4125 textEditor.SetProperty(TextEditor::Property::TEXT, "Hi Experimen");
4126 textEditor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, DevelText::LineWrap::MIXED);
4127 DALI_TEST_EQUALS(textEditor.GetProperty<int>(TextEditor::Property::LINE_WRAP_MODE), static_cast<int>(DevelText::LineWrap::MIXED), TEST_LOCATION);
4129 application.SendNotification();
4130 application.Render();
4132 lineCount = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
4139 DALI_TEST_EQUALS(lineCount, 3, TEST_LOCATION);
4144 int UtcDaliToolkitTextEditorEllipsisPositionProperty(void)
4146 ToolkitTestApplication application;
4147 tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty ");
4148 TextEditor textEditor = TextEditor::New();
4150 tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Default is END");
4151 DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
4153 tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to START");
4154 textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::START);
4155 DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::START), TEST_LOCATION);
4157 tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to MIDDLE");
4158 textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::MIDDLE);
4159 DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::MIDDLE), TEST_LOCATION);
4161 tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to END");
4162 textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::END);
4163 DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
4165 tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to START using integer");
4166 textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, 1);
4167 DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::START), TEST_LOCATION);
4169 tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to MIDDLE using integer");
4170 textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, 2);
4171 DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::MIDDLE), TEST_LOCATION);
4173 tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to END using integer");
4174 textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, 0);
4175 DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
4177 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - uppercase");
4178 textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "START");
4179 DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::START), TEST_LOCATION);
4181 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - uppercase");
4182 textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "MIDDLE");
4183 DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::MIDDLE), TEST_LOCATION);
4185 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - uppercase");
4186 textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "END");
4187 DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
4189 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - lowercase");
4190 textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "start");
4191 DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::START), TEST_LOCATION);
4193 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - lowercase");
4194 textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "middle");
4195 DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::MIDDLE), TEST_LOCATION);
4197 tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - lowercase");
4198 textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "end");
4199 DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
4204 int UtcDaliTextEditorCopyText(void)
4206 ToolkitTestApplication application;
4207 tet_infoline(" UtcDaliTextEditorCopyText ");
4209 TextEditor textEditor = TextEditor::New();
4211 std::string selectedText = "";
4212 std::string copiedText = "";
4214 application.GetScene().Add(textEditor);
4216 textEditor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
4217 textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4218 textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4220 // Avoid a crash when core load gl resources.
4221 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4223 application.SendNotification();
4224 application.Render();
4226 textEditor.SetProperty(TextEditor::Property::TEXT, "Hello world");
4228 application.SendNotification();
4229 application.Render();
4231 // Hello is selected
4232 DevelTextEditor::SelectText(textEditor, 0, 5);
4234 application.SendNotification();
4235 application.Render();
4237 selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
4238 DALI_TEST_EQUALS("Hello", selectedText, TEST_LOCATION);
4240 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 0, TEST_LOCATION);
4241 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 5, TEST_LOCATION);
4244 copiedText = DevelTextEditor::CopyText(textEditor);
4245 DALI_TEST_EQUALS("Hello", copiedText, TEST_LOCATION);
4247 // world is selected
4248 DevelTextEditor::SelectText(textEditor, 6, 11);
4250 application.SendNotification();
4251 application.Render();
4253 selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
4254 DALI_TEST_EQUALS("world", selectedText, TEST_LOCATION);
4256 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 6, TEST_LOCATION);
4257 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 11, TEST_LOCATION);
4260 copiedText = DevelTextEditor::CopyText(textEditor);
4261 DALI_TEST_EQUALS("world", copiedText, TEST_LOCATION);
4263 // "lo wo" is selected
4264 DevelTextEditor::SelectText(textEditor, 3, 8);
4266 application.SendNotification();
4267 application.Render();
4269 selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
4270 DALI_TEST_EQUALS("lo wo", selectedText, TEST_LOCATION);
4272 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 3, TEST_LOCATION);
4273 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 8, TEST_LOCATION);
4275 // "lo wo" is copied
4276 copiedText = DevelTextEditor::CopyText(textEditor);
4277 DALI_TEST_EQUALS("lo wo", copiedText, TEST_LOCATION);
4282 int UtcDaliTextEditorCutText(void)
4284 ToolkitTestApplication application;
4285 tet_infoline(" UtcDaliTextEditorCutText ");
4287 TextEditor textEditor = TextEditor::New();
4289 std::string selectedText = "";
4291 application.GetScene().Add(textEditor);
4293 textEditor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
4294 textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4295 textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4297 // Avoid a crash when core load gl resources.
4298 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4300 application.SendNotification();
4301 application.Render();
4303 textEditor.SetProperty(TextEditor::Property::TEXT, "Hello world");
4305 application.SendNotification();
4306 application.Render();
4308 // Hello is selected
4309 DevelTextEditor::SelectText(textEditor, 0, 5);
4311 application.SendNotification();
4312 application.Render();
4314 selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
4315 DALI_TEST_EQUALS("Hello", selectedText, TEST_LOCATION);
4317 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 0, TEST_LOCATION);
4318 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 5, TEST_LOCATION);
4321 DALI_TEST_EQUALS("Hello", DevelTextEditor::CutText(textEditor), TEST_LOCATION);
4323 application.SendNotification();
4324 application.Render();
4326 DALI_TEST_EQUALS(textEditor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), " world", TEST_LOCATION);
4329 DevelTextEditor::SelectText(textEditor, 0, 2);
4331 application.SendNotification();
4332 application.Render();
4334 selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
4335 DALI_TEST_EQUALS(" w", selectedText, TEST_LOCATION);
4337 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 0, TEST_LOCATION);
4338 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 2, TEST_LOCATION);
4341 DALI_TEST_EQUALS(" w", DevelTextEditor::CutText(textEditor), TEST_LOCATION);
4343 application.SendNotification();
4344 application.Render();
4346 DALI_TEST_EQUALS(textEditor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "orld", TEST_LOCATION);
4348 // Test Cut from the middle
4351 DevelTextEditor::SelectText(textEditor, 1, 3);
4353 application.SendNotification();
4354 application.Render();
4356 selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
4357 DALI_TEST_EQUALS("rl", selectedText, TEST_LOCATION);
4359 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 1, TEST_LOCATION);
4360 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 3, TEST_LOCATION);
4363 DALI_TEST_EQUALS("rl", DevelTextEditor::CutText(textEditor), TEST_LOCATION);
4365 application.SendNotification();
4366 application.Render();
4368 DALI_TEST_EQUALS(textEditor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "od", TEST_LOCATION);
4370 // Test Cut from the end
4373 DevelTextEditor::SelectText(textEditor, 1, 2);
4375 application.SendNotification();
4376 application.Render();
4378 selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
4379 DALI_TEST_EQUALS("d", selectedText, TEST_LOCATION);
4381 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 1, TEST_LOCATION);
4382 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 2, TEST_LOCATION);
4385 DALI_TEST_EQUALS("d", DevelTextEditor::CutText(textEditor), TEST_LOCATION);
4387 application.SendNotification();
4388 application.Render();
4390 DALI_TEST_EQUALS(textEditor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "o", TEST_LOCATION);
4395 int UtcDaliTextEditorPasteText(void)
4397 ToolkitTestApplication application;
4398 tet_infoline(" UtcDaliTextEditorPasteText ");
4400 TextEditor editor = TextEditor::New();
4401 DALI_TEST_CHECK(editor);
4403 application.GetScene().Add(editor);
4405 std::string cutText = "";
4406 std::string copiedText = "";
4408 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
4409 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
4410 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
4411 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4412 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4414 // Avoid a crash when core load gl resources.
4415 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4417 // Render and notify
4418 application.SendNotification();
4419 application.Render();
4421 // Tap on the text editor
4422 TestGenerateTap(application, 3.0f, 25.0f);
4424 // Render and notify
4425 application.SendNotification();
4426 application.Render();
4428 // Move to second line of the text.
4429 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4431 // Render and notify
4432 application.SendNotification();
4433 application.Render();
4435 // Select some text in the right of the current cursor position
4436 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4437 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4438 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4439 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4441 // Render and notify
4442 application.SendNotification();
4443 application.Render();
4445 // Cut the selected text
4446 cutText = DevelTextEditor::CutText(editor);
4448 // Render and notify
4449 application.SendNotification();
4450 application.Render();
4452 DALI_TEST_EQUALS("wor", cutText, TEST_LOCATION);
4453 DALI_TEST_EQUALS("Hello\nld\nHello world", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
4455 // Select some text in the left of the current cursor position
4456 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4457 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4458 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4459 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4461 // Render and notify
4462 application.SendNotification();
4463 application.Render();
4465 // Copy the selected text
4466 copiedText = DevelTextEditor::CopyText(editor);
4468 // Render and notify
4469 application.SendNotification();
4470 application.Render();
4472 DALI_TEST_EQUALS("lo\n", copiedText, TEST_LOCATION);
4473 DALI_TEST_EQUALS("Hello\nld\nHello world", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
4475 // Move the cursor to the third line
4476 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4477 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4479 // Render and notify
4480 application.SendNotification();
4481 application.Render();
4483 // Paste the selected text at the current cursor position
4484 DevelTextEditor::PasteText(editor);
4486 // Render and notify
4487 application.SendNotification();
4488 application.Render();
4490 DALI_TEST_EQUALS("Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
4495 int UtcDaliTextEditorLineSpacing(void)
4497 ToolkitTestApplication application;
4498 tet_infoline(" UtcDaliTextEditorLineSpacing ");
4500 TextEditor textEditor = TextEditor::New();
4501 textEditor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.f));
4502 application.GetScene().Add(textEditor);
4503 application.SendNotification();
4504 application.Render();
4506 textEditor.SetProperty(TextEditor::Property::TEXT, "Line #1\nLine #2\nLine #3");
4507 textEditor.SetProperty(DevelTextEditor::Property::LINE_SPACING, 0);
4509 Vector3 sizeBefore = textEditor.GetNaturalSize();
4511 textEditor.SetProperty(DevelTextEditor::Property::LINE_SPACING, 20);
4513 //add 20 for each line 20 * 3
4514 DALI_TEST_EQUALS(sizeBefore.height + 60.0f, textEditor.GetNaturalSize().height, TEST_LOCATION);
4519 int UtcDaliTextEditorSelectionWithLineSpacing(void)
4521 //Only for test coverage
4522 ToolkitTestApplication application;
4523 tet_infoline(" UtcDaliTextEditorSelectionWithLineSpacing ");
4525 TextEditor textEditor = TextEditor::New();
4526 textEditor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.f));
4527 application.GetScene().Add(textEditor);
4528 application.SendNotification();
4529 application.Render();
4531 textEditor.SetProperty(TextEditor::Property::TEXT, "Line #1\nLine #2\nLine #3");
4532 textEditor.SetProperty(DevelTextEditor::Property::LINE_SPACING, -20);
4534 application.SendNotification();
4535 application.Render();
4537 DevelTextEditor::SelectWholeText(textEditor);
4539 application.SendNotification();
4540 application.Render();
4542 DevelTextEditor::SelectNone(textEditor);
4543 textEditor.SetProperty(DevelTextEditor::Property::LINE_SPACING, 20);
4545 application.SendNotification();
4546 application.Render();
4548 DevelTextEditor::SelectWholeText(textEditor);
4550 application.SendNotification();
4551 application.Render();
4553 DALI_TEST_EQUALS(textEditor.GetProperty<float>(DevelTextEditor::Property::LINE_SPACING), 20.0f, TEST_LOCATION);
4558 int UtcDaliTextEditorMinLineSize(void)
4560 ToolkitTestApplication application;
4561 tet_infoline(" UtcDaliTextEditorMinLineSize ");
4563 TextEditor textEditor = TextEditor::New();
4564 textEditor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.f));
4565 application.GetScene().Add(textEditor);
4566 application.SendNotification();
4567 application.Render();
4569 textEditor.SetProperty(TextEditor::Property::TEXT, "Line #1\nLine #2\nLine #3");
4570 textEditor.SetProperty(DevelTextEditor::Property::MIN_LINE_SIZE, 0);
4572 Vector3 sizeBefore = textEditor.GetNaturalSize();
4574 textEditor.SetProperty(DevelTextEditor::Property::MIN_LINE_SIZE, 60);
4576 DALI_TEST_NOT_EQUALS(sizeBefore, textEditor.GetNaturalSize(), 0.0f, TEST_LOCATION);
4579 DALI_TEST_EQUALS(180.0f, textEditor.GetNaturalSize().height, TEST_LOCATION);
4584 int utcDaliTextEditorCursorPositionChangedSignal(void)
4586 ToolkitTestApplication application;
4587 tet_infoline(" utcDaliTextEditorCursorPositionChangedSignal");
4589 TextEditor editor = TextEditor::New();
4590 DALI_TEST_CHECK(editor);
4592 application.GetScene().Add(editor);
4594 // connect to the selection changed signal.
4595 ConnectionTracker* testTracker = new ConnectionTracker();
4596 DevelTextEditor::CursorPositionChangedSignal(editor).Connect(&TestCursorPositionChangedCallback);
4597 bool cursorPositionChangedSignal = false;
4598 editor.ConnectSignal(testTracker, "cursorPositionChanged", CallbackFunctor(&cursorPositionChangedSignal));
4600 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
4601 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
4602 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
4603 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4604 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4606 // Avoid a crash when core load gl resources.
4607 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4609 // Render and notify
4610 application.SendNotification();
4611 application.Render();
4613 editor.SetKeyInputFocus();
4615 // Tap on the text editor
4616 TestGenerateTap(application, 3.0f, 25.0f);
4618 // Render and notify
4619 application.SendNotification();
4620 application.Render();
4622 DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
4623 DALI_TEST_EQUALS(oldCursorPos, 23, TEST_LOCATION);
4625 gCursorPositionChangedCallbackCalled = false;
4628 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4630 // Render and notify
4631 application.SendNotification();
4632 application.Render();
4634 DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
4635 DALI_TEST_EQUALS(oldCursorPos, 18, TEST_LOCATION);
4637 gCursorPositionChangedCallbackCalled = false;
4640 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4642 // Render and notify
4643 application.SendNotification();
4644 application.Render();
4646 DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
4647 DALI_TEST_EQUALS(oldCursorPos, 17, TEST_LOCATION);
4649 gCursorPositionChangedCallbackCalled = false;
4651 //delete one character
4652 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4654 // Render and notify
4655 application.SendNotification();
4656 application.Render();
4658 DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
4659 DALI_TEST_EQUALS(oldCursorPos, 18, TEST_LOCATION);
4661 gCursorPositionChangedCallbackCalled = false;
4663 editor.SetProperty(TextEditor::Property::TEXT, "Hello");
4665 // Render and notify
4666 application.SendNotification();
4667 application.Render();
4669 DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
4670 DALI_TEST_EQUALS(oldCursorPos, 17, TEST_LOCATION);
4672 gCursorPositionChangedCallbackCalled = false;
4674 editor.SetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 3);
4676 // Render and notify
4677 application.SendNotification();
4678 application.Render();
4680 DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
4681 DALI_TEST_EQUALS(oldCursorPos, 5, TEST_LOCATION);
4686 int utcDaliTextEditorGeometryEllipsisStart(void)
4688 ToolkitTestApplication application;
4689 tet_infoline(" utcDaliTextEditorGeometryEllipsisStart");
4691 TextEditor editor = TextEditor::New();
4692 DALI_TEST_CHECK(editor);
4694 application.GetScene().Add(editor);
4696 editor.SetProperty(TextEditor::Property::POINT_SIZE, 7.f);
4697 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
4698 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4699 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4700 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
4701 editor.SetProperty(DevelTextEditor::Property::ENABLE_SCROLL_BAR, false);
4702 editor.SetProperty(DevelTextEditor::Property::ELLIPSIS, true);
4703 editor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::START);
4704 editor.SetProperty(TextEditor::Property::TEXT, "line1 \nline2\nline 3\nline4");
4706 // Avoid a crash when core load gl resources.
4707 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4709 // Render and notify
4710 application.SendNotification();
4711 application.Render();
4713 unsigned int expectedCount = 2;
4714 unsigned int startIndex = 0;
4715 unsigned int endIndex = 24;
4717 Vector<Vector2> positionsList = DevelTextEditor::GetTextPosition(editor, startIndex, endIndex);
4718 Vector<Vector2> sizeList = DevelTextEditor::GetTextSize(editor, startIndex, endIndex);
4720 DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
4721 DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
4723 Vector<Vector2> expectedSizes;
4724 Vector<Vector2> expectedPositions;
4726 expectedPositions.PushBack(Vector2(37, 0));
4727 expectedSizes.PushBack(Vector2(20, 25));
4729 expectedPositions.PushBack(Vector2(-1, 25));
4730 expectedSizes.PushBack(Vector2(52, 25));
4732 TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
4737 int utcDaliTextEditorGeometryEllipsisMiddle(void)
4739 ToolkitTestApplication application;
4740 tet_infoline(" utcDaliTextEditorGeometryEllipsisMiddle");
4742 TextEditor editor = TextEditor::New();
4743 DALI_TEST_CHECK(editor);
4745 application.GetScene().Add(editor);
4747 editor.SetProperty(TextEditor::Property::POINT_SIZE, 7.f);
4748 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
4749 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4750 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4751 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
4752 editor.SetProperty(DevelTextEditor::Property::ENABLE_SCROLL_BAR, false);
4753 editor.SetProperty(DevelTextEditor::Property::ELLIPSIS, true);
4754 editor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::MIDDLE);
4755 editor.SetProperty(TextEditor::Property::TEXT, "line1 \nline2\nline 3\nline4");
4757 // Avoid a crash when core load gl resources.
4758 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4760 // Render and notify
4761 application.SendNotification();
4762 application.Render();
4764 unsigned int expectedCount = 2;
4765 unsigned int startIndex = 0;
4766 unsigned int endIndex = 24;
4768 Vector<Vector2> positionsList = DevelTextEditor::GetTextPosition(editor, startIndex, endIndex);
4769 Vector<Vector2> sizeList = DevelTextEditor::GetTextSize(editor, startIndex, endIndex);
4771 DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
4772 DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
4774 Vector<Vector2> expectedSizes;
4775 Vector<Vector2> expectedPositions;
4777 expectedPositions.PushBack(Vector2(-1, 0));
4778 expectedSizes.PushBack(Vector2(25, 25));
4780 expectedPositions.PushBack(Vector2(-1, 25));
4781 expectedSizes.PushBack(Vector2(52, 25));
4783 TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
4788 int utcDaliTextEditorGeometryEllipsisEnd(void)
4790 ToolkitTestApplication application;
4791 tet_infoline(" utcDaliTextEditorGeometryEllipsisEnd");
4793 TextEditor editor = TextEditor::New();
4794 DALI_TEST_CHECK(editor);
4796 application.GetScene().Add(editor);
4798 editor.SetProperty(TextEditor::Property::POINT_SIZE, 7.f);
4799 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
4800 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4801 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4802 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
4803 editor.SetProperty(DevelTextEditor::Property::ENABLE_SCROLL_BAR, false);
4804 editor.SetProperty(DevelTextEditor::Property::ELLIPSIS, true);
4805 editor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::END);
4806 editor.SetProperty(TextEditor::Property::TEXT, "line1 \nline2\nline 3\nline4");
4808 // Avoid a crash when core load gl resources.
4809 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4811 // Render and notify
4812 application.SendNotification();
4813 application.Render();
4815 unsigned int expectedCount = 2;
4816 unsigned int startIndex = 0;
4817 unsigned int endIndex = 24;
4819 Vector<Vector2> positionsList = DevelTextEditor::GetTextPosition(editor, startIndex, endIndex);
4820 Vector<Vector2> sizeList = DevelTextEditor::GetTextSize(editor, startIndex, endIndex);
4822 DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
4823 DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
4825 Vector<Vector2> expectedSizes;
4826 Vector<Vector2> expectedPositions;
4828 expectedPositions.PushBack(Vector2(-1, 0));
4829 expectedSizes.PushBack(Vector2(59, 25));
4831 expectedPositions.PushBack(Vector2(-1, 25));
4832 expectedSizes.PushBack(Vector2(25, 25));
4834 TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
4839 int utcDaliTextEditorGeometryRTL(void)
4841 ToolkitTestApplication application;
4842 tet_infoline(" utcDaliTextEditorGeometryRTL");
4844 TextEditor editor = TextEditor::New();
4845 DALI_TEST_CHECK(editor);
4847 application.GetScene().Add(editor);
4849 editor.SetProperty(TextEditor::Property::POINT_SIZE, 7.f);
4850 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
4851 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4852 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4853 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
4854 editor.SetProperty(TextEditor::Property::TEXT, "line1 \nline2\nline 3\nالاخيرالسطر");
4856 // Avoid a crash when core load gl resources.
4857 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4859 // Render and notify
4860 application.SendNotification();
4861 application.Render();
4863 unsigned int expectedCount = 4;
4864 unsigned int startIndex = 3;
4865 unsigned int endIndex = 24;
4867 Vector<Vector2> positionsList = DevelTextEditor::GetTextPosition(editor, startIndex, endIndex);
4868 Vector<Vector2> sizeList = DevelTextEditor::GetTextSize(editor, startIndex, endIndex);
4870 DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
4871 DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
4873 Vector<Vector2> expectedSizes;
4874 Vector<Vector2> expectedPositions;
4876 expectedPositions.PushBack(Vector2(24, 0));
4877 expectedSizes.PushBack(Vector2(33, 25));
4879 expectedPositions.PushBack(Vector2(-1, 25));
4880 expectedSizes.PushBack(Vector2(52, 25));
4882 expectedPositions.PushBack(Vector2(-1, 50));
4883 expectedSizes.PushBack(Vector2(59, 25));
4885 expectedPositions.PushBack(Vector2(61, 75));
4886 expectedSizes.PushBack(Vector2(37, 25));
4888 TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
4893 int utcDaliTextEditorGeometryGlyphMiddle(void)
4895 ToolkitTestApplication application;
4896 tet_infoline(" utcDaliTextEditorGeometryGlyphMiddle");
4898 TextEditor editor = TextEditor::New();
4899 DALI_TEST_CHECK(editor);
4901 application.GetScene().Add(editor);
4903 editor.SetProperty(TextEditor::Property::POINT_SIZE, 7.f);
4904 editor.SetProperty(Actor::Property::SIZE, Vector2(150.f, 200.f));
4905 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4906 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4907 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
4908 editor.SetProperty(TextEditor::Property::TEXT, "لا تحتوي على لا");
4910 // Avoid a crash when core load gl resources.
4911 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4913 // Render and notify
4914 application.SendNotification();
4915 application.Render();
4917 unsigned int expectedCount = 1;
4918 unsigned int startIndex = 1;
4919 unsigned int endIndex = 13;
4921 Vector<Vector2> positionsList = DevelTextEditor::GetTextPosition(editor, startIndex, endIndex);
4922 Vector<Vector2> sizeList = DevelTextEditor::GetTextSize(editor, startIndex, endIndex);
4924 DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
4925 DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
4927 Vector<Vector2> expectedSizes;
4928 Vector<Vector2> expectedPositions;
4930 expectedPositions.PushBack(Vector2(6, 0));
4931 expectedSizes.PushBack(Vector2(124, 25));
4933 TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
4938 int utcDaliTextEditorSelectionClearedSignal(void)
4940 ToolkitTestApplication application;
4941 tet_infoline(" utcDaliTextEditorSelectionClearedSignal");
4943 TextEditor editor = TextEditor::New();
4944 DALI_TEST_CHECK(editor);
4946 application.GetScene().Add(editor);
4948 // connect to the selection changed signal.
4949 ConnectionTracker* testTracker = new ConnectionTracker();
4950 DevelTextEditor::SelectionClearedSignal(editor).Connect(&TestSelectionClearedCallback);
4951 bool selectionClearedSignal = false;
4952 editor.ConnectSignal(testTracker, "selectionCleared", CallbackFunctor(&selectionClearedSignal));
4954 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
4955 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
4956 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
4957 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4958 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4960 // Avoid a crash when core load gl resources.
4961 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4963 // Render and notify
4964 application.SendNotification();
4965 application.Render();
4967 // Tap on the text editor
4968 TestGenerateTap(application, 3.0f, 25.0f);
4970 // Render and notify
4971 application.SendNotification();
4972 application.Render();
4974 // Move to second line of the text & Select some text in the right of the current cursor position
4975 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4976 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4979 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::UP, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4981 // Render and notify
4982 application.SendNotification();
4983 application.Render();
4985 DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
4987 // Render and notify
4988 application.SendNotification();
4989 application.Render();
4991 // Tap on the text editor
4992 TestGenerateTap(application, 3.0f, 25.0f);
4994 // Render and notify
4995 application.SendNotification();
4996 application.Render();
4998 gSelectionClearedCallbackCalled = false;
5000 // Move to second line of the text & select.
5001 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5002 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5005 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5007 // Render and notify
5008 application.SendNotification();
5009 application.Render();
5011 DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
5013 gSelectionClearedCallbackCalled = false;
5015 // Render and notify
5016 application.SendNotification();
5017 application.Render();
5019 // Move to second line of the text & select.
5020 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5021 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5023 // replace C with selected text
5024 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5026 // Render and notify
5027 application.SendNotification();
5028 application.Render();
5030 DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
5032 gSelectionClearedCallbackCalled = false;
5034 // Render and notify
5035 application.SendNotification();
5036 application.Render();
5038 DevelTextEditor::SelectText(editor, 1, 3);
5040 // Render and notify
5041 application.SendNotification();
5042 application.Render();
5044 editor.SetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 3);
5046 // Render and notify
5047 application.SendNotification();
5048 application.Render();
5050 DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
5052 gSelectionClearedCallbackCalled = false;
5054 DevelTextEditor::SelectText(editor, 1, 3);
5056 // Render and notify
5057 application.SendNotification();
5058 application.Render();
5061 DevelTextEditor::SelectNone(editor);
5063 // Render and notify
5064 application.SendNotification();
5065 application.Render();
5067 DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
5072 int utcDaliTextEditorSelectionStartedSignal(void)
5074 ToolkitTestApplication application;
5075 tet_infoline(" utcDaliTextEditorSelectionStartedSignal");
5077 TextEditor editor = TextEditor::New();
5078 DALI_TEST_CHECK(editor);
5080 application.GetScene().Add(editor);
5082 // connect to the selection changed signal.
5083 ConnectionTracker* testTracker = new ConnectionTracker();
5084 DevelTextEditor::SelectionStartedSignal(editor).Connect(&TestSelectionStartedCallback);
5085 bool selectionStartedSignal = false;
5086 editor.ConnectSignal(testTracker, "selectionStarted", CallbackFunctor(&selectionStartedSignal));
5088 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
5089 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
5090 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
5091 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
5092 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
5094 // Avoid a crash when core load gl resources.
5095 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
5097 // Render and notify
5098 application.SendNotification();
5099 application.Render();
5101 // Tap on the text editor
5102 TestGenerateTap(application, 3.0f, 25.0f);
5104 // Render and notify
5105 application.SendNotification();
5106 application.Render();
5108 // Move to second line of the text & Select some text in the right of the current cursor position
5109 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5110 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5112 // Render and notify
5113 application.SendNotification();
5114 application.Render();
5116 DALI_TEST_CHECK(gSelectionStartedCallbackCalled);
5119 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::UP, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5121 // Render and notify
5122 application.SendNotification();
5123 application.Render();
5125 gSelectionStartedCallbackCalled = false;
5127 DevelTextEditor::SelectText(editor, 1, 3);
5129 // Render and notify
5130 application.SendNotification();
5131 application.Render();
5133 DALI_TEST_CHECK(gSelectionStartedCallbackCalled);
5138 int utcDaliTextEditorSelectionWithSecondaryCursor(void)
5140 ToolkitTestApplication application;
5141 tet_infoline(" utcDaliTextEditorSelectionWithSecondaryCursor");
5143 // Checks if the actor is created.
5145 TextEditor editor = TextEditor::New();
5146 DALI_TEST_CHECK(editor);
5148 application.GetScene().Add(editor);
5150 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
5151 editor.SetProperty(TextEditor::Property::TEXT, "اللغة العربية\nمرحبا بالجميع\nالسلام عليكم <span font-size='12' font-family='DejaVu Sans' >Hello world</span>");
5152 editor.SetProperty(TextEditor::Property::POINT_SIZE, 12.f);
5153 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
5154 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
5155 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
5156 editor.SetProperty(DevelTextEditor::Property::MIN_LINE_SIZE, 50.f);
5157 editor.SetProperty(DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, false);
5159 // Avoid a crash when core load gl resources.
5160 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
5162 // Render and notify
5163 application.SendNotification();
5164 application.Render();
5166 // Tap on the text editor
5167 TestGenerateTap(application, 3.0f, 25.0f);
5169 // Render and notify
5170 application.SendNotification();
5171 application.Render();
5173 //Select the last Arabic word (RTL) & some the space before the English (LTR) letters.
5174 DevelTextEditor::SelectText(editor, 35, 41); // This will activate the alternative cursor position and thus 'cursorInfo.isSecondaryCursor' will be true.
5176 application.SendNotification();
5177 application.Render();
5179 std::string selectedText = editor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
5180 DALI_TEST_EQUALS("عليكم ", selectedText, TEST_LOCATION);
5185 int utcDaliTextEditorSelectionChangedSignal(void)
5187 ToolkitTestApplication application;
5188 tet_infoline(" utcDaliTextEditorSelectionChangedSignal");
5190 TextEditor editor = TextEditor::New();
5191 DALI_TEST_CHECK(editor);
5193 application.GetScene().Add(editor);
5195 // connect to the selection changed signal.
5196 ConnectionTracker* testTracker = new ConnectionTracker();
5197 DevelTextEditor::SelectionChangedSignal(editor).Connect(&TestSelectionChangedCallback);
5198 bool selectionChangedSignal = false;
5199 editor.ConnectSignal(testTracker, "selectionChanged", CallbackFunctor(&selectionChangedSignal));
5201 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
5202 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
5203 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
5204 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
5205 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
5207 // Avoid a crash when core load gl resources.
5208 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
5210 // Render and notify
5211 application.SendNotification();
5212 application.Render();
5214 // Tap on the text editor
5215 TestGenerateTap(application, 3.0f, 25.0f);
5217 // Render and notify
5218 application.SendNotification();
5219 application.Render();
5221 // Move to second line of the text.
5222 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5224 // Render and notify
5225 application.SendNotification();
5226 application.Render();
5228 // Select some text in the right of the current cursor position
5229 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5230 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5232 // Render and notify
5233 application.SendNotification();
5234 application.Render();
5236 DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
5237 DALI_TEST_EQUALS(oldSelectionStart, oldSelectionEnd, TEST_LOCATION);
5239 gSelectionChangedCallbackCalled = false;
5241 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5243 // Render and notify
5244 application.SendNotification();
5245 application.Render();
5247 DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
5248 DALI_TEST_EQUALS(oldSelectionStart, 6, TEST_LOCATION);
5249 DALI_TEST_EQUALS(oldSelectionEnd, 7, TEST_LOCATION);
5251 gSelectionChangedCallbackCalled = false;
5253 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::UP, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5255 // Render and notify
5256 application.SendNotification();
5257 application.Render();
5259 DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
5260 DALI_TEST_EQUALS(oldSelectionStart, 6, TEST_LOCATION);
5261 DALI_TEST_EQUALS(oldSelectionEnd, 8, TEST_LOCATION);
5263 gSelectionChangedCallbackCalled = false;
5264 editor.SetKeyInputFocus();
5266 // Render and notify
5267 application.SendNotification();
5268 application.Render();
5270 DevelTextEditor::SelectText(editor, 0, 5);
5272 application.SendNotification();
5273 application.Render();
5275 DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
5276 DALI_TEST_EQUALS(oldSelectionStart, oldSelectionEnd, TEST_LOCATION);
5278 gSelectionChangedCallbackCalled = false;
5280 editor.SetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 3);
5282 // Render and notify
5283 application.SendNotification();
5284 application.Render();
5286 DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
5287 DALI_TEST_EQUALS(oldSelectionStart, 0, TEST_LOCATION);
5288 DALI_TEST_EQUALS(oldSelectionEnd, 5, TEST_LOCATION);
5290 gSelectionChangedCallbackCalled = false;
5293 DevelTextEditor::SelectWholeText(editor);
5295 // Render and notify
5296 application.SendNotification();
5297 application.Render();
5299 DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
5300 DALI_TEST_EQUALS(oldSelectionStart, oldSelectionEnd, TEST_LOCATION);
5302 gSelectionChangedCallbackCalled = false;
5305 DevelTextEditor::SelectNone(editor);
5307 // Render and notify
5308 application.SendNotification();
5309 application.Render();
5311 DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
5312 DALI_TEST_EQUALS(oldSelectionStart, 0, TEST_LOCATION);
5313 DALI_TEST_EQUALS(oldSelectionEnd, 23, TEST_LOCATION);
5318 int UtcDaliToolkitTextEditorStrikethroughGeneration(void)
5320 ToolkitTestApplication application;
5321 tet_infoline(" UtcDaliToolkitTextEditorStrikethroughGeneration");
5323 TextEditor textEditor = TextEditor::New();
5324 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
5325 textEditor.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 100.f));
5326 textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 10);
5327 textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
5329 application.GetScene().Add(textEditor);
5330 application.SendNotification();
5331 application.Render();
5333 Property::Map strikethroughMapSet;
5334 Property::Map strikethroughMapGet;
5336 strikethroughMapSet.Insert("enable", true);
5337 strikethroughMapSet.Insert("color", Color::RED);
5338 strikethroughMapSet.Insert("height", 2.0f);
5340 // Check the strikethrough property
5341 textEditor.SetProperty(DevelTextEditor::Property::STRIKETHROUGH, strikethroughMapSet);
5342 strikethroughMapGet = textEditor.GetProperty<Property::Map>(DevelTextEditor::Property::STRIKETHROUGH);
5343 textEditor.SetProperty(TextEditor::Property::TEXT, "Test1");
5344 DALI_TEST_EQUALS(strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION);
5345 DALI_TEST_EQUALS(DaliTestCheckMaps(strikethroughMapGet, strikethroughMapSet), true, TEST_LOCATION);
5347 // Render and notify
5348 application.SendNotification();
5349 application.Render();
5351 strikethroughMapSet.Clear();
5352 strikethroughMapGet.Clear();
5357 int utcDaliTextEditorInsertCharacterAfterInitWithResizePolicyNaturalSize(void)
5359 //This is to test a crash when used Resize Policy equals USE_NATURAL_SIZE
5360 //DaliException on vector: "Iterator not inside vector"
5362 ToolkitTestApplication application;
5363 tet_infoline(" utcDaliTextEditorInsertCharacterAfterInitWithResizePolicyNaturalSize");
5365 TextEditor editor = TextEditor::New();
5366 DALI_TEST_CHECK(editor);
5368 application.GetScene().Add(editor);
5370 // Avoid a crash when core load gl resources.
5371 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
5373 //Set multilines text
5374 editor.SetProperty(Dali::Toolkit::TextEditor::Property::TEXT, "Hello \n World");
5375 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
5376 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
5378 //Set ResizePolicy to NaturalSize
5379 editor.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::USE_NATURAL_SIZE);
5381 // Render and notify
5382 application.SendNotification();
5383 application.Render();
5385 // Create a tap event to touch the text editor.
5386 TestGenerateTap(application, 5.0f, 5.0f);
5388 // Render and notify
5389 application.SendNotification();
5390 application.Render();
5392 // Set currsor and add character (in first line)
5393 editor.SetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 5);
5394 application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5395 application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::UP, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5397 // Render and notify
5398 application.SendNotification();
5399 application.Render();
5401 //Check the changed text and cursor position
5402 DALI_TEST_EQUALS(editor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "Hellod \n World", TEST_LOCATION);
5403 DALI_TEST_EQUALS(editor.GetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION).Get<int>(), 6, TEST_LOCATION);
5405 // Render and notify
5406 application.SendNotification();
5407 application.Render();
5412 int utcDaliTextEditorRemoveCharacterAfterInitWithResizePolicyNaturalSize(void)
5414 //This is to test a crash when used Resize Policy equals USE_NATURAL_SIZE
5415 //DaliException on vector: "Iterator not inside vector"
5417 ToolkitTestApplication application;
5418 tet_infoline(" utcDaliTextEditorRemoveCharacterAfterInitWithResizePolicyNaturalSize");
5420 TextEditor editor = TextEditor::New();
5421 DALI_TEST_CHECK(editor);
5423 application.GetScene().Add(editor);
5425 // Avoid a crash when core load gl resources.
5426 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
5428 //Set multilines text
5429 editor.SetProperty(Dali::Toolkit::TextEditor::Property::TEXT, "Hello \n World");
5430 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
5431 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
5433 //Set ResizePolicy to NaturalSize
5434 editor.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::USE_NATURAL_SIZE);
5437 editor.SetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 5);
5438 application.SendNotification();
5439 application.Render();
5441 // Set focus and remove character
5442 editor.SetKeyInputFocus();
5443 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5445 // Render and notify
5446 application.SendNotification();
5447 application.Render();
5449 //Check the changed text and cursor position
5450 DALI_TEST_EQUALS(editor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "Hell \n World", TEST_LOCATION);
5451 DALI_TEST_EQUALS(editor.GetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION).Get<int>(), 4, TEST_LOCATION);
5453 // Render and notify
5454 application.SendNotification();
5455 application.Render();
5460 int utcDaliTextEditorCutSelectedTextAfterInitWithResizePolicyNaturalSize(void)
5462 //This is to test a crash when used Resize Policy equals USE_NATURAL_SIZE
5463 //DaliException on vector: "Iterator not inside vector"
5465 ToolkitTestApplication application;
5466 tet_infoline(" utcDaliTextEditorCutSelectedTextAfterInitWithResizePolicyNaturalSize");
5468 TextEditor editor = TextEditor::New();
5469 DALI_TEST_CHECK(editor);
5471 application.GetScene().Add(editor);
5473 // Avoid a crash when core load gl resources.
5474 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
5476 //Set multilines text
5477 editor.SetProperty(Dali::Toolkit::TextEditor::Property::TEXT, "Hello \n World");
5478 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
5479 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
5481 //Set ResizePolicy to NaturalSize
5482 editor.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::USE_NATURAL_SIZE);
5484 //Select text at initialization (before the first render)
5485 DevelTextEditor::SelectText(editor, 3, 5);
5487 // Render and notify
5488 application.SendNotification();
5489 application.Render();
5492 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5493 application.ProcessEvent(GenerateKey("x", "x", "x", KEY_X_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "x", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5495 // Render and notify
5496 application.SendNotification();
5497 application.Render();
5499 //Check the changed text and cursor position
5500 DALI_TEST_EQUALS(editor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "Hel \n World", TEST_LOCATION);
5501 DALI_TEST_EQUALS(editor.GetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION).Get<int>(), 3, TEST_LOCATION);
5503 // Render and notify
5504 application.SendNotification();
5505 application.Render();
5510 int utcDaliTextEditorDoubleEnterAfterInitWithResizePolicyNaturalSize(void)
5512 //This is to test a crash when used Resize Policy equals USE_NATURAL_SIZE
5513 //DaliException on vector: "Iterator not inside vector"
5515 ToolkitTestApplication application;
5516 tet_infoline(" utcDaliTextEditorDoubleEnterAfterInitWithResizePolicyNaturalSize");
5518 TextEditor editor = TextEditor::New();
5519 DALI_TEST_CHECK(editor);
5521 application.GetScene().Add(editor);
5523 // Avoid a crash when core load gl resources.
5524 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
5526 //Set multilines text
5527 editor.SetProperty(Dali::Toolkit::TextEditor::Property::TEXT, "Hello \n World");
5528 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
5529 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
5531 //Set ResizePolicy to NaturalSize
5532 editor.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::USE_NATURAL_SIZE);
5535 editor.SetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 5);
5536 application.SendNotification();
5537 application.Render();
5539 // Set focus and double enter (new line)
5540 editor.SetKeyInputFocus();
5541 application.ProcessEvent(GenerateKey("Enter", "", "\n", 13, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5542 application.ProcessEvent(GenerateKey("Enter", "", "\n", 13, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5544 // Render and notify
5545 application.SendNotification();
5546 application.Render();
5548 //Check the changed text and cursor position
5549 DALI_TEST_EQUALS(editor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "Hello\n\n \n World", TEST_LOCATION);
5550 DALI_TEST_EQUALS(editor.GetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION).Get<int>(), 7, TEST_LOCATION);
5552 // Render and notify
5553 application.SendNotification();
5554 application.Render();
5559 int UtcDaliToolkitTextEditorUnderlineTypesGeneration1(void)
5561 ToolkitTestApplication application;
5562 tet_infoline(" UtcDaliToolkitTextEditorUnderlineTypesGeneration1");
5563 TextEditor textEditor = TextEditor::New();
5564 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
5565 textEditor.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 100.f));
5566 textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 10);
5567 textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
5569 application.GetScene().Add(textEditor);
5570 application.SendNotification();
5571 application.Render();
5573 Property::Map underlineMapSet;
5574 Property::Map underlineMapGet;
5576 underlineMapSet.Insert("enable", true);
5577 underlineMapSet.Insert("color", Color::RED);
5578 underlineMapSet.Insert("height", 1);
5579 underlineMapSet.Insert("type", Text::Underline::SOLID);
5580 underlineMapSet.Insert("dashWidth", 2);
5581 underlineMapSet.Insert("dashGap", 1);
5583 // Check the underline property
5584 textEditor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
5586 underlineMapGet = textEditor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
5587 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
5588 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
5590 // Render and notify
5591 application.SendNotification();
5592 application.Render();
5594 underlineMapSet.Clear();
5595 underlineMapGet.Clear();
5597 underlineMapSet.Insert("enable", true);
5598 underlineMapSet.Insert("color", Color::BLUE);
5599 underlineMapSet.Insert("height", 1);
5600 underlineMapSet.Insert("type", Text::Underline::DASHED);
5601 underlineMapSet.Insert("dashWidth", 4);
5602 underlineMapSet.Insert("dashGap", 2);
5604 // Check the dashed underline property
5605 textEditor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
5607 underlineMapGet = textEditor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
5608 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
5609 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
5611 // Render and notify
5612 application.SendNotification();
5613 application.Render();
5615 underlineMapSet.Clear();
5616 underlineMapGet.Clear();
5618 underlineMapSet.Insert("enable", true);
5619 underlineMapSet.Insert("color", Color::BLUE);
5620 underlineMapSet.Insert("height", 1);
5621 underlineMapSet.Insert("type", Text::Underline::DOUBLE);
5622 underlineMapSet.Insert("dashWidth", 4);
5623 underlineMapSet.Insert("dashGap", 2);
5625 // Check the dashed underline property
5626 textEditor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
5628 underlineMapGet = textEditor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
5629 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
5630 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
5632 // Render and notify
5633 application.SendNotification();
5634 application.Render();
5636 underlineMapSet.Clear();
5637 underlineMapGet.Clear();
5642 int UtcDaliToolkitTextEditorUnderlineTypesGeneration2(void)
5644 ToolkitTestApplication application;
5645 tet_infoline(" UtcDaliToolkitTextEditorUnderlineTypesGeneration2");
5647 TextEditor textEditor1 = TextEditor::New();
5648 textEditor1.SetProperty(TextEditor::Property::TEXT, "Test");
5649 textEditor1.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 100.f));
5650 textEditor1.SetProperty(TextEditor::Property::POINT_SIZE, 10);
5651 textEditor1.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
5653 Property::Map underlineMapSet1;
5654 Property::Map underlineMapGet1;
5656 underlineMapSet1.Insert("enable", true);
5657 underlineMapSet1.Insert("color", Color::RED);
5658 underlineMapSet1.Insert("height", 1);
5659 underlineMapSet1.Insert("type", Text::Underline::SOLID);
5660 underlineMapSet1.Insert("dashWidth", 2);
5661 underlineMapSet1.Insert("dashGap", 1);
5663 // Check the underline property
5664 textEditor1.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet1);
5666 underlineMapGet1 = textEditor1.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
5667 DALI_TEST_EQUALS(underlineMapGet1.Count(), underlineMapSet1.Count(), TEST_LOCATION);
5668 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet1, underlineMapSet1), true, TEST_LOCATION);
5670 application.GetScene().Add(textEditor1);
5671 application.SendNotification();
5672 application.Render();
5674 TextEditor textEditor2 = TextEditor::New();
5675 textEditor2.SetProperty(TextEditor::Property::TEXT, "Test");
5676 textEditor2.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 100.f));
5677 textEditor2.SetProperty(TextEditor::Property::POINT_SIZE, 10);
5678 textEditor2.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
5680 Property::Map underlineMapSet2;
5681 Property::Map underlineMapGet2;
5683 underlineMapSet2.Insert("enable", true);
5684 underlineMapSet2.Insert("color", Color::BLUE);
5685 underlineMapSet2.Insert("height", 1);
5686 underlineMapSet2.Insert("type", Text::Underline::DASHED);
5687 underlineMapSet2.Insert("dashWidth", 4);
5688 underlineMapSet2.Insert("dashGap", 2);
5690 // Check the dashed underline property
5691 textEditor2.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet2);
5693 underlineMapGet2 = textEditor2.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
5694 DALI_TEST_EQUALS(underlineMapGet2.Count(), underlineMapSet2.Count(), TEST_LOCATION);
5695 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet2, underlineMapSet2), true, TEST_LOCATION);
5697 application.GetScene().Add(textEditor2);
5698 application.SendNotification();
5699 application.Render();
5701 TextEditor textEditor3 = TextEditor::New();
5702 textEditor3.SetProperty(TextEditor::Property::TEXT, "Test");
5703 textEditor3.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 100.f));
5704 textEditor3.SetProperty(TextEditor::Property::POINT_SIZE, 10);
5705 textEditor3.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
5707 Property::Map underlineMapSet3;
5708 Property::Map underlineMapGet3;
5710 underlineMapSet3.Insert("enable", true);
5711 underlineMapSet3.Insert("color", Color::BLUE);
5712 underlineMapSet3.Insert("height", 1);
5713 underlineMapSet3.Insert("type", Text::Underline::DOUBLE);
5714 underlineMapSet3.Insert("dashWidth", 4);
5715 underlineMapSet3.Insert("dashGap", 2);
5717 // Check the dashed underline property
5718 textEditor3.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet3);
5720 underlineMapGet3 = textEditor3.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
5721 DALI_TEST_EQUALS(underlineMapGet3.Count(), underlineMapSet3.Count(), TEST_LOCATION);
5722 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet3, underlineMapSet3), true, TEST_LOCATION);
5724 application.GetScene().Add(textEditor3);
5725 application.SendNotification();
5726 application.Render();
5731 int UtcDaliToolkitTextEditorUnderlineTypesGeneration3(void)
5733 ToolkitTestApplication application;
5734 tet_infoline(" UtcDaliToolkitTextEditorUnderlineTypesGeneration3");
5736 TextEditor textEditor1 = TextEditor::New();
5737 textEditor1.SetProperty(TextEditor::Property::TEXT, "Test1");
5738 textEditor1.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 100.f));
5739 textEditor1.SetProperty(TextEditor::Property::POINT_SIZE, 10);
5740 textEditor1.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
5742 Property::Map underlineMapSet1;
5743 Property::Map underlineMapGet1;
5745 underlineMapSet1.Insert("enable", true);
5746 underlineMapSet1.Insert("color", Color::RED);
5747 underlineMapSet1.Insert("height", 1);
5748 underlineMapSet1.Insert("type", Text::Underline::SOLID);
5749 underlineMapSet1.Insert("dashWidth", 2);
5750 underlineMapSet1.Insert("dashGap", 1);
5752 // Check the underline property
5753 textEditor1.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet1);
5754 //textEditor1.SetProperty( TextEditor::Property::TEXT, "Test2" );
5756 underlineMapGet1 = textEditor1.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
5757 DALI_TEST_EQUALS(underlineMapGet1.Count(), underlineMapSet1.Count(), TEST_LOCATION);
5758 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet1, underlineMapSet1), true, TEST_LOCATION);
5760 application.GetScene().Add(textEditor1);
5762 application.SendNotification();
5763 application.Render();
5768 int UtcDaliToolkitTextEditorRelativeLineHeight(void)
5770 ToolkitTestApplication application;
5771 tet_infoline(" UtcDaliToolkitTextEditorRelativeLineHeight");
5773 TextEditor editor = TextEditor::New();
5774 editor.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 300.f));
5775 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10);
5776 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nWorld");
5778 application.GetScene().Add(editor);
5779 application.SendNotification();
5780 application.Render();
5782 Vector3 naturalSize = editor.GetNaturalSize();
5784 editor.SetProperty(DevelTextEditor::Property::RELATIVE_LINE_SIZE, 0.5f);
5786 application.SendNotification();
5787 application.Render();
5789 Vector3 relativeNaturalSize = editor.GetNaturalSize();
5791 DALI_TEST_EQUALS(naturalSize.y, relativeNaturalSize.y, TEST_LOCATION);
5793 editor.SetProperty(DevelTextEditor::Property::RELATIVE_LINE_SIZE, 2.0f);
5795 application.SendNotification();
5796 application.Render();
5798 relativeNaturalSize = editor.GetNaturalSize();
5800 DALI_TEST_EQUALS(naturalSize.y * 2, relativeNaturalSize.y, TEST_LOCATION);
5804 int UtcDaliTextEditorCharacterSpacing(void)
5806 ToolkitTestApplication application;
5807 tet_infoline(" UtcDaliTextEditorCharacterSpacing ");
5809 TextEditor textEditor = TextEditor::New();
5811 textEditor.SetProperty(Actor::Property::SIZE, Vector2(150.0f, 300.f));
5813 application.GetScene().Add(textEditor);
5814 application.SendNotification();
5815 application.Render();
5817 textEditor.SetProperty(TextEditor::Property::TEXT, "Hi Experiment");
5818 textEditor.SetProperty(DevelTextEditor::Property::CHARACTER_SPACING, 10.f);
5819 DALI_TEST_EQUALS(textEditor.GetProperty<float>(DevelTextEditor::Property::CHARACTER_SPACING), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
5821 application.SendNotification();
5822 application.Render();
5827 int UtcDaliTextEditorTextSizeNegativeLineSpacing(void)
5829 ToolkitTestApplication application;
5830 tet_infoline("UtcDaliTextEditorTextSizeNegativeLineSpacing");
5832 TextEditor editor = TextEditor::New();
5834 float lineSpacing = -20.f;
5836 editor.SetProperty(Actor::Property::SIZE, Vector2(450.0f, 300.f));
5837 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
5838 editor.SetProperty(DevelTextEditor::Property::LINE_SPACING, lineSpacing);
5839 editor.SetProperty(TextEditor::Property::TEXT, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
5841 application.GetScene().Add(editor);
5842 application.SendNotification();
5843 application.Render();
5845 Vector<Vector2> positionsList = DevelTextEditor::GetTextPosition(editor, 0, 123);
5846 Vector<Vector2> sizeList = DevelTextEditor::GetTextSize(editor, 0, 123);
5848 Vector2 lastLinePos = positionsList[positionsList.Size() - 1];
5849 Vector2 lastLineSize = sizeList[sizeList.Size() - 1];
5851 DALI_TEST_EQUALS(sizeList[0].y * (sizeList.Size() - 1), lastLinePos.y, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
5852 DALI_TEST_EQUALS(sizeList[0].y - lineSpacing, lastLineSize.y, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
5854 application.SendNotification();
5855 application.Render();
5860 int UtcDaliTextEditorNegativeLineSpacingWithEllipsis(void)
5862 ToolkitTestApplication application;
5863 tet_infoline("UtcDaliTextEditorNegativeLineSpacingWithEllipsis");
5865 TextEditor editor = TextEditor::New();
5867 float lineSpacing = -20.f;
5869 editor.SetProperty(Actor::Property::SIZE, Vector2(480.0f, 100.f));
5870 editor.SetProperty(TextEditor::Property::POINT_SIZE, 11.0f);
5871 editor.SetProperty(DevelTextEditor::Property::LINE_SPACING, lineSpacing);
5872 editor.SetProperty(TextEditor::Property::TEXT, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
5873 editor.SetProperty(DevelTextEditor::Property::ELLIPSIS, true);
5875 application.GetScene().Add(editor);
5876 application.SendNotification();
5877 application.Render();
5879 Vector<Vector2> sizeList = DevelTextEditor::GetTextSize(editor, 0, 123);
5881 int lineCount = sizeList.Size();
5882 DALI_TEST_EQUALS(4, lineCount, TEST_LOCATION);
5884 application.SendNotification();
5885 application.Render();
5890 int UtcDaliToolkitTexteditorParagraphTag(void)
5892 ToolkitTestApplication application;
5893 tet_infoline(" UtcDaliToolkitTexteditorParagraphTag");
5894 TextEditor editorNewlineSeparator = TextEditor::New();
5895 TextEditor editorParagraphTag = TextEditor::New();
5896 DALI_TEST_CHECK(editorNewlineSeparator);
5897 DALI_TEST_CHECK(editorParagraphTag);
5899 application.GetScene().Add(editorNewlineSeparator);
5900 application.GetScene().Add(editorParagraphTag);
5902 //Same utterance uses new-line to split paragraphs should give similar results for paragraph tag.
5903 editorNewlineSeparator.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
5904 editorNewlineSeparator.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
5905 editorNewlineSeparator.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
5906 editorNewlineSeparator.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
5907 editorNewlineSeparator.SetProperty(TextEditor::Property::TEXT, "test paragraph tag \ntest paragraph tag \ntest paragraph tag ");
5909 editorParagraphTag.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
5910 editorParagraphTag.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
5911 editorParagraphTag.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
5912 editorParagraphTag.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
5913 editorParagraphTag.SetProperty(TextEditor::Property::TEXT, "test paragraph tag <p>test paragraph tag </p>test paragraph tag ");
5915 application.SendNotification();
5916 application.Render();
5918 Vector3 textNaturalSizeNewlineSeparator = editorNewlineSeparator.GetNaturalSize();
5919 Vector3 textNaturalSizeParagraphTag = editorParagraphTag.GetNaturalSize();
5921 DALI_TEST_EQUALS(textNaturalSizeNewlineSeparator, textNaturalSizeParagraphTag, TEST_LOCATION);
5923 application.SendNotification();
5924 application.Render();
5929 //Handle Emoji clustering for cursor handling
5930 int utcDaliTextEditorClusteredEmojiDeletionBackSpaceKey(void)
5932 ToolkitTestApplication application;
5933 tet_infoline(" utcDaliTextEditorClusteredEmojiDeletionBackSpaceKey ");
5934 TextEditor textEditor = TextEditor::New();
5935 DALI_TEST_CHECK(textEditor);
5937 application.GetScene().Add(textEditor);
5939 // Avoid a crash when core load gl resources.
5940 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
5942 textEditor.SetProperty(TextEditor::Property::TEXT, "ABC👨‍👩‍👧‍👦XY");
5943 textEditor.SetProperty(Dali::Toolkit::TextEditor::Property::ENABLE_MARKUP, true);
5945 // Render and notify
5946 application.SendNotification();
5947 application.Render();
5950 textEditor.SetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 10);
5951 application.SendNotification();
5952 application.Render();
5954 // Set focus and remove Emoji
5955 textEditor.SetKeyInputFocus();
5956 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5958 //Check the changed text and cursor position
5959 DALI_TEST_EQUALS(textEditor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "ABCXY", TEST_LOCATION);
5960 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION).Get<int>(), 3, TEST_LOCATION);
5962 // Render and notify
5963 application.SendNotification();
5964 application.Render();
5969 int utcDaliTextEditorClusteredEmojiDeletionDeleteKey(void)
5971 ToolkitTestApplication application;
5972 tet_infoline(" utcDaliTextEditorClusteredEmojiDeletionDeleteKey ");
5973 TextEditor textEditor = TextEditor::New();
5974 DALI_TEST_CHECK(textEditor);
5976 application.GetScene().Add(textEditor);
5978 // Avoid a crash when core load gl resources.
5979 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
5981 textEditor.SetProperty(TextEditor::Property::TEXT, "ABC👨‍👩‍👧‍👦XY");
5982 textEditor.SetProperty(Dali::Toolkit::TextEditor::Property::ENABLE_MARKUP, true);
5984 // Render and notify
5985 application.SendNotification();
5986 application.Render();
5989 textEditor.SetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 3);
5990 application.SendNotification();
5991 application.Render();
5993 // Set focus and remove Emoji
5994 textEditor.SetKeyInputFocus();
5995 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5997 //Check the changed text and cursor position
5998 DALI_TEST_EQUALS(textEditor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "ABCXY", TEST_LOCATION);
5999 DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION).Get<int>(), 3, TEST_LOCATION);
6001 // Render and notify
6002 application.SendNotification();
6003 application.Render();