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");