2 * Copyright (c) 2021 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 gAnchorClickedCallBackCalled;
144 static bool gAnchorClickedCallBackNotCalled;
145 static bool gTextChangedCallBackCalled;
146 static bool gInputFilteredAcceptedCallbackCalled;
147 static bool gInputFilteredRejectedCallbackCalled;
148 static bool gInputStyleChangedCallbackCalled;
149 static bool gMaxCharactersCallBackCalled;
150 static bool gCursorPositionChangedCallbackCalled;
151 static uint32_t oldCursorPos;
152 static Dali::Toolkit::TextEditor::InputStyle::Mask gInputStyleMask;
154 struct CallbackFunctor
156 CallbackFunctor(bool* callbackFlag)
157 : mCallbackFlag(callbackFlag)
163 *mCallbackFlag = true;
168 static void TestSelectionClearedCallback(TextEditor control)
170 tet_infoline(" TestSelectionClearedCallback");
172 gSelectionClearedCallbackCalled = true;
175 static void TestSelectionChangedCallback(TextEditor control, uint32_t oldStart, uint32_t oldEnd)
177 tet_infoline(" TestSelectionChangedCallback");
179 gSelectionChangedCallbackCalled = true;
180 oldSelectionStart = oldStart;
181 oldSelectionEnd = oldEnd;
184 static void TestAnchorClickedCallback(TextEditor control, const char* href, unsigned int hrefLength)
186 tet_infoline(" TestAnchorClickedCallback");
188 gAnchorClickedCallBackNotCalled = false;
190 if(!strcmp(href, "https://www.tizen.org") && hrefLength == strlen(href))
192 gAnchorClickedCallBackCalled = true;
196 static void TestCursorPositionChangedCallback(TextEditor control, unsigned int oldPos)
198 tet_infoline(" TestCursorPositionChangedCallback");
200 gCursorPositionChangedCallbackCalled = true;
201 oldCursorPos = oldPos;
204 static void TestTextChangedCallback(TextEditor control)
206 tet_infoline(" TestTextChangedCallback");
208 gTextChangedCallBackCalled = true;
211 static void TestInputStyleChangedCallback(TextEditor control, TextEditor::InputStyle::Mask mask)
213 tet_infoline(" TestInputStyleChangedCallback");
215 gInputStyleChangedCallbackCalled = true;
216 gInputStyleMask = mask;
219 static void TestMaxLengthReachedCallback(TextEditor control)
221 tet_infoline(" TestMaxLengthReachedCallback");
223 gMaxCharactersCallBackCalled = true;
226 static void TestInputFilteredCallback(TextEditor control, Toolkit::InputFilter::Property::Type type)
228 tet_infoline(" TestInputFilteredCallback");
230 if(type == Toolkit::InputFilter::Property::ACCEPTED)
232 gInputFilteredAcceptedCallbackCalled = true;
234 else if(type == Toolkit::InputFilter::Property::REJECTED)
236 gInputFilteredRejectedCallbackCalled = true;
240 // Generate a KeyEvent to send to Core.
241 Integration::KeyEvent GenerateKey(const std::string& keyName,
242 const std::string& logicalKey,
243 const std::string& keyString,
246 unsigned long timeStamp,
247 const Integration::KeyEvent::State& keyState,
248 const std::string& compose = "",
249 const std::string& deviceName = DEFAULT_DEVICE_NAME,
250 const Device::Class::Type& deviceClass = Device::Class::NONE,
251 const Device::Subclass::Type& deviceSubclass = Device::Subclass::NONE)
253 return Integration::KeyEvent(keyName,
266 Dali::Integration::Point GetPointDownInside(Vector2& pos)
268 Dali::Integration::Point point;
269 point.SetState(PointState::DOWN);
270 point.SetScreenPosition(pos);
274 Dali::Integration::Point GetPointUpInside(Vector2& pos)
276 Dali::Integration::Point point;
277 point.SetState(PointState::UP);
278 point.SetScreenPosition(pos);
282 bool DaliTestCheckMaps(const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet)
284 if(fontStyleMapGet.Count() == fontStyleMapSet.Count())
286 for(unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index)
288 const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue(index);
290 Property::Value* valueSet = NULL;
291 if(valueGet.first.type == Property::Key::INDEX)
293 valueSet = fontStyleMapSet.Find(valueGet.first.indexKey);
297 // Get Key is a string so searching Set Map for a string key
298 valueSet = fontStyleMapSet.Find(valueGet.first.stringKey);
303 if(valueSet->GetType() == Dali::Property::STRING && (valueGet.second.Get<std::string>() != valueSet->Get<std::string>()))
305 tet_printf("Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str());
308 else if(valueSet->GetType() == Dali::Property::BOOLEAN && (valueGet.second.Get<bool>() != valueSet->Get<bool>()))
310 tet_printf("Value got : [%d], expected : [%d]", valueGet.second.Get<bool>(), valueSet->Get<bool>());
313 else if(valueSet->GetType() == Dali::Property::INTEGER && (valueGet.second.Get<int>() != valueSet->Get<int>()))
315 tet_printf("Value got : [%d], expected : [%d]", valueGet.second.Get<int>(), valueSet->Get<int>());
318 else if(valueSet->GetType() == Dali::Property::FLOAT && (valueGet.second.Get<float>() != valueSet->Get<float>()))
320 tet_printf("Value got : [%f], expected : [%f]", valueGet.second.Get<float>(), valueSet->Get<float>());
323 else if(valueSet->GetType() == Dali::Property::VECTOR2 && (valueGet.second.Get<Vector2>() != valueSet->Get<Vector2>()))
325 Vector2 vector2Get = valueGet.second.Get<Vector2>();
326 Vector2 vector2Set = valueSet->Get<Vector2>();
327 tet_printf("Value got : [%f, %f], expected : [%f, %f]", vector2Get.x, vector2Get.y, vector2Set.x, vector2Set.y);
330 else if(valueSet->GetType() == Dali::Property::VECTOR4 && (valueGet.second.Get<Vector4>() != valueSet->Get<Vector4>()))
332 Vector4 vector4Get = valueGet.second.Get<Vector4>();
333 Vector4 vector4Set = valueSet->Get<Vector4>();
334 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);
340 if(valueGet.first.type == Property::Key::INDEX)
342 tet_printf(" The key %d doesn't exist.", valueGet.first.indexKey);
346 tet_printf(" The key %s doesn't exist.", valueGet.first.stringKey.c_str());
356 class ScrollStateChangeCallback : public Dali::ConnectionTracker
359 ScrollStateChangeCallback(bool& startedCalled, bool& finishedCalled)
360 : mStartedCalled(startedCalled),
361 mFinishedCalled(finishedCalled)
365 void Callback(TextEditor editor, TextEditor::Scroll::Type type)
367 if(type == TextEditor::Scroll::STARTED)
369 mStartedCalled = true;
371 else if(type == TextEditor::Scroll::FINISHED)
373 mFinishedCalled = true;
377 bool& mStartedCalled;
378 bool& mFinishedCalled;
383 int UtcDaliToolkitTextEditorConstructorP(void)
385 ToolkitTestApplication application;
386 tet_infoline(" UtcDaliToolkitTextEditorConstructorP");
387 TextEditor textEditor;
388 DALI_TEST_CHECK(!textEditor);
392 int UtcDaliToolkitTextEditorNewP(void)
394 ToolkitTestApplication application;
395 tet_infoline(" UtcDaliToolkitTextEditorNewP");
396 TextEditor textEditor = TextEditor::New();
397 DALI_TEST_CHECK(textEditor);
401 int UtcDaliToolkitTextEditorDownCastP(void)
403 ToolkitTestApplication application;
404 tet_infoline(" UtcDaliToolkitTextEditorDownCastP");
405 TextEditor textEditor1 = TextEditor::New();
406 BaseHandle object(textEditor1);
408 TextEditor textEditor2 = TextEditor::DownCast(object);
409 DALI_TEST_CHECK(textEditor2);
411 TextEditor textEditor3 = DownCast<TextEditor>(object);
412 DALI_TEST_CHECK(textEditor3);
416 int UtcDaliToolkitTextEditorDownCastN(void)
418 ToolkitTestApplication application;
419 tet_infoline(" UtcDaliToolkitTextEditorDownCastN");
420 BaseHandle uninitializedObject;
421 TextEditor textEditor1 = TextEditor::DownCast(uninitializedObject);
422 DALI_TEST_CHECK(!textEditor1);
424 TextEditor textEditor2 = DownCast<TextEditor>(uninitializedObject);
425 DALI_TEST_CHECK(!textEditor2);
429 int UtcDaliToolkitTextEditorCopyConstructorP(void)
431 ToolkitTestApplication application;
432 tet_infoline(" UtcDaliToolkitTextEditorCopyConstructorP");
433 TextEditor textEditor = TextEditor::New();
434 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
436 TextEditor copy(textEditor);
437 DALI_TEST_CHECK(copy);
438 DALI_TEST_CHECK(copy.GetProperty<std::string>(TextEditor::Property::TEXT) == textEditor.GetProperty<std::string>(TextEditor::Property::TEXT));
442 int UtcDaliTextEditorMoveConstructor(void)
444 ToolkitTestApplication application;
446 TextEditor textEditor = TextEditor::New();
447 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
448 DALI_TEST_CHECK(textEditor.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
450 TextEditor moved = std::move(textEditor);
451 DALI_TEST_CHECK(moved);
452 DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
453 DALI_TEST_CHECK(moved.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
454 DALI_TEST_CHECK(!textEditor);
459 int UtcDaliToolkitTextEditorAssignmentOperatorP(void)
461 ToolkitTestApplication application;
462 tet_infoline(" UtcDaliToolkitTextEditorAssignmentOperatorP");
463 TextEditor textEditor = TextEditor::New();
464 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
466 TextEditor copy = textEditor;
467 DALI_TEST_CHECK(copy);
468 DALI_TEST_CHECK(copy.GetProperty<std::string>(TextEditor::Property::TEXT) == textEditor.GetProperty<std::string>(TextEditor::Property::TEXT));
472 int UtcDaliTextEditorMoveAssignment(void)
474 ToolkitTestApplication application;
476 TextEditor textEditor = TextEditor::New();
477 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
478 DALI_TEST_CHECK(textEditor.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
481 moved = std::move(textEditor);
482 DALI_TEST_CHECK(moved);
483 DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
484 DALI_TEST_CHECK(moved.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
485 DALI_TEST_CHECK(!textEditor);
490 int UtcDaliTextEditorNewP(void)
492 ToolkitTestApplication application;
493 tet_infoline(" UtcDaliToolkitTextEditorNewP");
494 TextEditor textEditor = TextEditor::New();
495 DALI_TEST_CHECK(textEditor);
499 // Positive test case for a method
500 int UtcDaliTextEditorGetPropertyP(void)
502 ToolkitTestApplication application;
503 tet_infoline(" UtcDaliToolkitTextEditorGetPropertyP");
504 TextEditor editor = TextEditor::New();
505 DALI_TEST_CHECK(editor);
507 // Check Property Indices are correct
508 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_RENDERING_BACKEND) == DevelTextEditor::Property::RENDERING_BACKEND);
509 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_TEXT) == TextEditor::Property::TEXT);
510 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_TEXT_COLOR) == TextEditor::Property::TEXT_COLOR);
511 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_FONT_FAMILY) == TextEditor::Property::FONT_FAMILY);
512 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_FONT_STYLE) == TextEditor::Property::FONT_STYLE);
513 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_POINT_SIZE) == TextEditor::Property::POINT_SIZE);
514 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_HORIZONTAL_ALIGNMENT) == TextEditor::Property::HORIZONTAL_ALIGNMENT);
515 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_THRESHOLD) == TextEditor::Property::SCROLL_THRESHOLD);
516 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_SPEED) == TextEditor::Property::SCROLL_SPEED);
517 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PRIMARY_CURSOR_COLOR) == TextEditor::Property::PRIMARY_CURSOR_COLOR);
518 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SECONDARY_CURSOR_COLOR) == TextEditor::Property::SECONDARY_CURSOR_COLOR);
519 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_CURSOR_BLINK) == TextEditor::Property::ENABLE_CURSOR_BLINK);
520 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_CURSOR_BLINK_INTERVAL) == TextEditor::Property::CURSOR_BLINK_INTERVAL);
521 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_CURSOR_BLINK_DURATION) == TextEditor::Property::CURSOR_BLINK_DURATION);
522 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_CURSOR_WIDTH) == TextEditor::Property::CURSOR_WIDTH);
523 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_GRAB_HANDLE_IMAGE) == TextEditor::Property::GRAB_HANDLE_IMAGE);
524 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_GRAB_HANDLE_PRESSED_IMAGE) == TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE);
525 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_IMAGE_LEFT) == TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT);
526 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_IMAGE_RIGHT) == TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT);
527 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_LEFT) == TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT);
528 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT) == TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT);
529 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_LEFT) == TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT);
530 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_RIGHT) == TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT);
531 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HIGHLIGHT_COLOR) == TextEditor::Property::SELECTION_HIGHLIGHT_COLOR);
532 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_DECORATION_BOUNDING_BOX) == TextEditor::Property::DECORATION_BOUNDING_BOX);
533 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_MARKUP) == TextEditor::Property::ENABLE_MARKUP);
534 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_COLOR) == TextEditor::Property::INPUT_COLOR);
535 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_FONT_FAMILY) == TextEditor::Property::INPUT_FONT_FAMILY);
536 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_FONT_STYLE) == TextEditor::Property::INPUT_FONT_STYLE);
537 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_POINT_SIZE) == TextEditor::Property::INPUT_POINT_SIZE);
539 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_LINE_SPACING) == TextEditor::Property::LINE_SPACING);
540 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_LINE_SPACING) == TextEditor::Property::INPUT_LINE_SPACING);
541 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_UNDERLINE) == TextEditor::Property::UNDERLINE);
542 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_UNDERLINE) == TextEditor::Property::INPUT_UNDERLINE);
543 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SHADOW) == TextEditor::Property::SHADOW);
544 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_SHADOW) == TextEditor::Property::INPUT_SHADOW);
545 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_EMBOSS) == TextEditor::Property::EMBOSS);
546 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_EMBOSS) == TextEditor::Property::INPUT_EMBOSS);
547 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_OUTLINE) == TextEditor::Property::OUTLINE);
548 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_OUTLINE) == TextEditor::Property::INPUT_OUTLINE);
549 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextEditor::Property::STRIKETHROUGH);
550 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_STRIKETHROUGH) == DevelTextEditor::Property::INPUT_STRIKETHROUGH);
551 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SMOOTH_SCROLL) == TextEditor::Property::SMOOTH_SCROLL);
552 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SMOOTH_SCROLL_DURATION) == TextEditor::Property::SMOOTH_SCROLL_DURATION);
553 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_SCROLL_BAR) == TextEditor::Property::ENABLE_SCROLL_BAR);
554 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_BAR_SHOW_DURATION) == TextEditor::Property::SCROLL_BAR_SHOW_DURATION);
555 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_BAR_FADE_DURATION) == TextEditor::Property::SCROLL_BAR_FADE_DURATION);
556 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PIXEL_SIZE) == TextEditor::Property::PIXEL_SIZE);
557 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_LINE_COUNT) == TextEditor::Property::LINE_COUNT);
558 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_SELECTION) == TextEditor::Property::ENABLE_SELECTION);
559 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PLACEHOLDER) == TextEditor::Property::PLACEHOLDER);
560 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_FONT_SIZE_SCALE) == DevelTextEditor::Property::FONT_SIZE_SCALE);
561 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE) == DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE);
562 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PLACEHOLDER_TEXT) == DevelTextEditor::Property::PLACEHOLDER_TEXT);
563 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR) == DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR);
564 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_SHIFT_SELECTION) == DevelTextEditor::Property::ENABLE_SHIFT_SELECTION);
565 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_GRAB_HANDLE) == DevelTextEditor::Property::ENABLE_GRAB_HANDLE);
566 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION) == DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION);
567 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_MAX_LENGTH) == DevelTextEditor::Property::MAX_LENGTH);
568 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_GRAB_HANDLE_COLOR) == DevelTextEditor::Property::GRAB_HANDLE_COLOR);
569 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP) == DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP);
570 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_METHOD_SETTINGS) == DevelTextEditor::Property::INPUT_METHOD_SETTINGS);
571 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_FILTER) == DevelTextEditor::Property::INPUT_FILTER);
572 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextEditor::Property::STRIKETHROUGH);
573 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_STRIKETHROUGH) == DevelTextEditor::Property::INPUT_STRIKETHROUGH);
578 bool SetPropertyMapRetrieved(TextEditor& editor, const Property::Index property, const std::string mapKey, const std::string mapValue)
581 Property::Map imageMap;
582 imageMap[mapKey] = mapValue;
584 editor.SetProperty(property, imageMap);
585 Property::Value propValue = editor.GetProperty(property);
586 Property::Map* resultMap = propValue.GetMap();
588 if(resultMap->Find(mapKey)->Get<std::string>() == mapValue)
596 // Positive test case for a method
597 int UtcDaliTextEditorSetPropertyP(void)
599 ToolkitTestApplication application;
600 tet_infoline(" UtcDaliToolkitTextEditorSetPropertyP");
601 TextEditor editor = TextEditor::New();
602 DALI_TEST_CHECK(editor);
603 application.GetScene().Add(editor);
605 // Note - we can't check the defaults since the stylesheets are platform-specific
607 // Check the render backend property.
608 editor.SetProperty(DevelTextEditor::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS);
609 DALI_TEST_EQUALS((DevelText::RenderingType)editor.GetProperty<int>(DevelTextEditor::Property::RENDERING_BACKEND), DevelText::RENDERING_SHARED_ATLAS, TEST_LOCATION);
611 // Check text property.
612 editor.SetProperty(TextEditor::Property::TEXT, "Setting Text");
613 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("Setting Text"), TEST_LOCATION);
615 // Check text's color property
616 editor.SetProperty(TextEditor::Property::TEXT_COLOR, Color::WHITE);
617 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::TEXT_COLOR), Color::WHITE, TEST_LOCATION);
619 // Check font properties.
620 editor.SetProperty(TextEditor::Property::FONT_FAMILY, "Setting font family");
621 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::FONT_FAMILY), std::string("Setting font family"), TEST_LOCATION);
623 Property::Map fontStyleMapSet;
624 Property::Map fontStyleMapGet;
625 Property::Value* slantValue = NULL;
627 fontStyleMapSet.Insert("weight", "bold");
628 fontStyleMapSet.Insert("width", "condensed");
629 fontStyleMapSet.Insert("slant", "italic");
631 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
632 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
633 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
634 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
636 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
637 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::POINT_SIZE), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
639 editor.SetProperty(DevelTextEditor::Property::FONT_SIZE_SCALE, 2.5f);
640 DALI_TEST_EQUALS(editor.GetProperty<float>(DevelTextEditor::Property::FONT_SIZE_SCALE), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
641 editor.SetProperty(DevelTextEditor::Property::FONT_SIZE_SCALE, 1.0f);
643 editor.SetProperty(DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, false);
644 DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE), false, TEST_LOCATION);
645 editor.SetProperty(DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, true);
648 fontStyleMapSet.Clear();
649 fontStyleMapSet.Insert("weight", "normal");
650 fontStyleMapSet.Insert("slant", "oblique");
651 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
652 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
653 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
654 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
656 fontStyleMapSet.Clear();
657 fontStyleMapSet.Insert("slant", "roman");
658 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
659 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
661 // Replace 'roman' for 'normal'.
662 slantValue = fontStyleMapGet.Find("slant");
663 if(NULL != slantValue)
665 if("normal" == slantValue->Get<std::string>())
667 fontStyleMapGet["slant"] = "roman";
670 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
671 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
673 fontStyleMapSet.Clear();
675 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
676 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
677 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
678 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
680 // Check that the Alignment properties can be correctly set
681 editor.SetProperty(TextEditor::Property::HORIZONTAL_ALIGNMENT, "END");
682 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::HORIZONTAL_ALIGNMENT), "END", TEST_LOCATION);
684 // Check scroll properties.
685 editor.SetProperty(TextEditor::Property::SCROLL_THRESHOLD, 1.f);
686 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_THRESHOLD), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
687 editor.SetProperty(TextEditor::Property::SCROLL_SPEED, 100.f);
688 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_SPEED), 100.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
690 // Check cursor properties
691 editor.SetProperty(TextEditor::Property::PRIMARY_CURSOR_COLOR, Color::RED);
692 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::PRIMARY_CURSOR_COLOR), Color::RED, TEST_LOCATION);
693 editor.SetProperty(TextEditor::Property::SECONDARY_CURSOR_COLOR, Color::BLUE);
694 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::SECONDARY_CURSOR_COLOR), Color::BLUE, TEST_LOCATION);
696 editor.SetProperty(TextEditor::Property::ENABLE_CURSOR_BLINK, false);
697 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_CURSOR_BLINK), false, TEST_LOCATION);
698 editor.SetProperty(TextEditor::Property::CURSOR_BLINK_INTERVAL, 1.f);
699 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::CURSOR_BLINK_INTERVAL), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
700 editor.SetProperty(TextEditor::Property::CURSOR_BLINK_DURATION, 10.f);
701 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::CURSOR_BLINK_DURATION), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
702 editor.SetProperty(TextEditor::Property::CURSOR_WIDTH, 1);
703 DALI_TEST_EQUALS(editor.GetProperty<int>(TextEditor::Property::CURSOR_WIDTH), 1, TEST_LOCATION);
705 // Check handle images
706 editor.SetProperty(TextEditor::Property::GRAB_HANDLE_IMAGE, "image1");
707 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::GRAB_HANDLE_IMAGE), "image1", TEST_LOCATION);
708 editor.SetProperty(TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE, "image2");
709 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE), "image2", TEST_LOCATION);
710 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, "image3");
712 // Check handle images
713 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, "filename", "leftHandleImage"));
714 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT, "filename", "rightHandleImage"));
715 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT, "filename", "leftHandleImagePressed"));
716 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, "filename", "rightHandleImagePressed"));
717 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT, "filename", "leftHandleMarkerImage"));
718 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT, "filename", "rightHandleMarkerImage"));
720 // Check the highlight color
721 editor.SetProperty(TextEditor::Property::SELECTION_HIGHLIGHT_COLOR, Color::GREEN);
722 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::SELECTION_HIGHLIGHT_COLOR), Color::GREEN, TEST_LOCATION);
724 // Decoration bounding box
725 editor.SetProperty(TextEditor::Property::DECORATION_BOUNDING_BOX, Rect<int>(0, 0, 1, 1));
726 DALI_TEST_EQUALS(editor.GetProperty<Rect<int> >(TextEditor::Property::DECORATION_BOUNDING_BOX), Rect<int>(0, 0, 1, 1), TEST_LOCATION);
728 // Check the enable markup property.
729 DALI_TEST_CHECK(!editor.GetProperty<bool>(TextEditor::Property::ENABLE_MARKUP));
730 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
731 DALI_TEST_CHECK(editor.GetProperty<bool>(TextEditor::Property::ENABLE_MARKUP));
733 // Check input color property.
734 editor.SetProperty(TextEditor::Property::INPUT_COLOR, Color::YELLOW);
735 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::INPUT_COLOR), Color::YELLOW, TEST_LOCATION);
737 // Check input font properties.
738 editor.SetProperty(TextEditor::Property::INPUT_FONT_FAMILY, "Setting input font family");
739 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_FONT_FAMILY), "Setting input font family", TEST_LOCATION);
741 fontStyleMapSet.Clear();
742 fontStyleMapSet.Insert("weight", "bold");
743 fontStyleMapSet.Insert("width", "condensed");
744 fontStyleMapSet.Insert("slant", "italic");
746 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
747 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
748 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
749 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
751 editor.SetProperty(TextEditor::Property::INPUT_POINT_SIZE, 12.f);
752 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::INPUT_POINT_SIZE), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
754 // Reset input font style.
755 fontStyleMapSet.Clear();
756 fontStyleMapSet.Insert("weight", "normal");
757 fontStyleMapSet.Insert("slant", "oblique");
759 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
760 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
761 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
762 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
764 fontStyleMapSet.Clear();
765 fontStyleMapSet.Insert("slant", "roman");
767 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
768 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
770 // Replace 'roman' for 'normal'.
771 slantValue = fontStyleMapGet.Find("slant");
772 if(NULL != slantValue)
774 if("normal" == slantValue->Get<std::string>())
776 fontStyleMapGet["slant"] = "roman";
779 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
780 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
782 fontStyleMapSet.Clear();
784 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
785 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
786 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
787 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
789 // Check the line spacing property
790 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::LINE_SPACING), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
791 editor.SetProperty(TextEditor::Property::LINE_SPACING, 10.f);
792 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::LINE_SPACING), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
794 // Check the input line spacing property
795 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::INPUT_LINE_SPACING), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
796 editor.SetProperty(TextEditor::Property::INPUT_LINE_SPACING, 20.f);
797 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::INPUT_LINE_SPACING), 20.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
799 // Check the underline property
801 Property::Map underlineMapSet;
802 Property::Map underlineMapGet;
804 underlineMapSet.Insert("enable", true);
805 underlineMapSet.Insert("color", Color::RED);
806 underlineMapSet.Insert("height", 1);
807 underlineMapSet.Insert("type", Text::Underline::SOLID);
808 underlineMapSet.Insert("dashWidth", 5);
809 underlineMapSet.Insert("dashGap", 3);
811 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
813 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
814 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
815 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
817 application.SendNotification();
818 application.Render();
820 // Check the dashed underline property
822 underlineMapSet.Clear();
823 underlineMapGet.Clear();
825 underlineMapSet.Insert("enable", true);
826 underlineMapSet.Insert("color", Color::RED);
827 underlineMapSet.Insert("height", 1);
828 underlineMapSet.Insert("type", Text::Underline::DASHED);
829 underlineMapSet.Insert("dashWidth", 5);
830 underlineMapSet.Insert("dashGap", 3);
832 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
834 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
835 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
836 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
838 application.SendNotification();
839 application.Render();
841 underlineMapSet.Clear();
842 underlineMapGet.Clear();
844 // Check the double underline property
846 underlineMapSet.Clear();
847 underlineMapGet.Clear();
849 underlineMapSet.Insert("enable", true);
850 underlineMapSet.Insert("color", Color::RED);
851 underlineMapSet.Insert("height", 1);
852 underlineMapSet.Insert("type", Text::Underline::DOUBLE);
853 underlineMapSet.Insert("dashWidth", 5);
854 underlineMapSet.Insert("dashGap", 3);
856 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
858 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
859 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
860 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
862 application.SendNotification();
863 application.Render();
865 underlineMapSet.Clear();
866 underlineMapGet.Clear();
868 // Check the input underline property
869 editor.SetProperty(TextEditor::Property::INPUT_UNDERLINE, "Underline input properties");
870 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_UNDERLINE), std::string("Underline input properties"), TEST_LOCATION);
872 // Check the shadow property
873 Property::Map shadowMapSet;
874 Property::Map shadowMapGet;
876 shadowMapSet.Insert("color", Color::GREEN);
877 shadowMapSet.Insert("offset", Vector2(2.0f, 2.0f));
878 shadowMapSet.Insert("blurRadius", 3.0f);
880 editor.SetProperty(TextEditor::Property::SHADOW, shadowMapSet);
882 shadowMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::SHADOW);
883 DALI_TEST_EQUALS(shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION);
884 DALI_TEST_EQUALS(DaliTestCheckMaps(shadowMapGet, shadowMapSet), true, TEST_LOCATION);
886 // Check the input shadow property
887 editor.SetProperty(TextEditor::Property::INPUT_SHADOW, "Shadow input properties");
888 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_SHADOW), std::string("Shadow input properties"), TEST_LOCATION);
890 // Check the emboss property
891 editor.SetProperty(TextEditor::Property::EMBOSS, "Emboss properties");
892 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::EMBOSS), std::string("Emboss properties"), TEST_LOCATION);
894 // Check the input emboss property
895 editor.SetProperty(TextEditor::Property::INPUT_EMBOSS, "Emboss input properties");
896 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_EMBOSS), std::string("Emboss input properties"), TEST_LOCATION);
898 // Check the outline property
900 // Test string type first
901 // This is purely to maintain backward compatibility, but we don't support string as the outline property type.
902 editor.SetProperty(TextEditor::Property::OUTLINE, "Outline properties");
903 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::OUTLINE), std::string("Outline properties"), TEST_LOCATION);
905 // Then test the property map type
906 Property::Map outlineMapSet;
907 Property::Map outlineMapGet;
909 outlineMapSet["color"] = Color::RED;
910 outlineMapSet["width"] = 2.0f;
912 editor.SetProperty(TextEditor::Property::OUTLINE, outlineMapSet);
914 outlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::OUTLINE);
915 DALI_TEST_EQUALS(outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION);
916 DALI_TEST_EQUALS(DaliTestCheckMaps(outlineMapGet, outlineMapSet), true, TEST_LOCATION);
918 // Check the input outline property
919 editor.SetProperty(TextEditor::Property::INPUT_OUTLINE, "Outline input properties");
920 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_OUTLINE), std::string("Outline input properties"), TEST_LOCATION);
922 // Check the smooth scroll property
923 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::SMOOTH_SCROLL), false, TEST_LOCATION);
924 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL, true);
925 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::SMOOTH_SCROLL), true, TEST_LOCATION);
927 // Check the smooth scroll duration property
928 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.2f);
929 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SMOOTH_SCROLL_DURATION), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
931 // Check the scroll bar property
932 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SCROLL_BAR), false, TEST_LOCATION);
933 editor.SetProperty(TextEditor::Property::ENABLE_SCROLL_BAR, true);
934 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SCROLL_BAR), true, TEST_LOCATION);
936 editor.SetProperty(TextEditor::Property::SCROLL_BAR_SHOW_DURATION, 0.3f);
937 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_SHOW_DURATION), 0.3f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
938 editor.SetProperty(TextEditor::Property::SCROLL_BAR_FADE_DURATION, 0.2f);
939 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_FADE_DURATION), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
941 // Check the pixel size of font
942 editor.SetProperty(TextEditor::Property::PIXEL_SIZE, 20.f);
943 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::PIXEL_SIZE), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
945 // Check placeholder text properties.
946 editor.SetProperty(DevelTextEditor::Property::PLACEHOLDER_TEXT, "Setting Placeholder Text");
947 DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::PLACEHOLDER_TEXT), std::string("Setting Placeholder Text"), TEST_LOCATION);
949 // Check placeholder text's color property.
950 editor.SetProperty(DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR, Color::RED);
951 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR), Color::RED, TEST_LOCATION);
953 // Check the enable selection property
954 editor.SetProperty(TextEditor::Property::ENABLE_SELECTION, false);
955 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SELECTION), false, TEST_LOCATION);
957 // Check the placeholder property with pixel size
958 Property::Map placeholderPixelSizeMapSet;
959 Property::Map placeholderPixelSizeMapGet;
960 Property::Map placeholderFontstyleMap;
961 placeholderPixelSizeMapSet["text"] = "Setting Placeholder Text";
962 placeholderPixelSizeMapSet["textFocused"] = "Setting Placeholder Text Focused";
963 placeholderPixelSizeMapSet["color"] = Color::BLUE;
964 placeholderPixelSizeMapSet["fontFamily"] = "Arial";
965 placeholderPixelSizeMapSet["pixelSize"] = 15.0f;
967 placeholderFontstyleMap.Insert("weight", "bold");
968 placeholderPixelSizeMapSet["fontStyle"] = placeholderFontstyleMap;
969 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderPixelSizeMapSet);
971 placeholderPixelSizeMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
972 DALI_TEST_EQUALS(placeholderPixelSizeMapGet.Count(), placeholderPixelSizeMapSet.Count(), TEST_LOCATION);
974 tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value");
975 Property::Map placeholderConversionMap;
976 placeholderConversionMap[Text::PlaceHolder::Property::TEXT] = placeholderPixelSizeMapSet["text"];
977 placeholderConversionMap[Text::PlaceHolder::Property::TEXT_FOCUSED] = placeholderPixelSizeMapSet["textFocused"];
978 placeholderConversionMap[Text::PlaceHolder::Property::COLOR] = placeholderPixelSizeMapSet["color"];
979 placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderPixelSizeMapSet["fontStyle"];
980 placeholderConversionMap[Text::PlaceHolder::Property::FONT_FAMILY] = placeholderPixelSizeMapSet["fontFamily"];
981 placeholderConversionMap[Text::PlaceHolder::Property::PIXEL_SIZE] = placeholderPixelSizeMapSet["pixelSize"];
983 DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderPixelSizeMapGet, placeholderConversionMap), true, TEST_LOCATION);
985 // Check the placeholder property with point size
986 Property::Map placeholderMapSet;
987 Property::Map placeholderMapGet;
988 placeholderMapSet["text"] = "Setting Placeholder Text";
989 placeholderMapSet["textFocused"] = "Setting Placeholder Text Focused";
990 placeholderMapSet["color"] = Color::RED;
991 placeholderMapSet["fontFamily"] = "Arial";
992 placeholderMapSet["pointSize"] = 12.0f;
993 // Check the placeholder font style property
994 placeholderFontstyleMap.Clear();
996 placeholderFontstyleMap.Insert("weight", "bold");
997 placeholderFontstyleMap.Insert("width", "condensed");
998 placeholderFontstyleMap.Insert("slant", "italic");
999 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1000 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1002 placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1003 DALI_TEST_EQUALS(placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION);
1005 tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value");
1006 placeholderConversionMap.Clear();
1007 placeholderConversionMap[Text::PlaceHolder::Property::TEXT] = placeholderMapSet["text"];
1008 placeholderConversionMap[Text::PlaceHolder::Property::TEXT_FOCUSED] = placeholderMapSet["textFocused"];
1009 placeholderConversionMap[Text::PlaceHolder::Property::COLOR] = placeholderMapSet["color"];
1010 placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderPixelSizeMapSet["fontStyle"];
1011 placeholderConversionMap[Text::PlaceHolder::Property::FONT_FAMILY] = placeholderMapSet["fontFamily"];
1012 placeholderConversionMap[Text::PlaceHolder::Property::POINT_SIZE] = placeholderMapSet["pointSize"];
1013 DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderMapGet, placeholderConversionMap), true, TEST_LOCATION);
1015 // Reset font style.
1016 placeholderFontstyleMap.Clear();
1017 placeholderFontstyleMap.Insert("weight", "normal");
1018 placeholderFontstyleMap.Insert("slant", "oblique");
1019 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1020 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1022 placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1023 DALI_TEST_EQUALS(placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION);
1024 placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderMapSet["fontStyle"];
1025 DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderMapGet, placeholderConversionMap), true, TEST_LOCATION);
1027 placeholderFontstyleMap.Clear();
1028 placeholderFontstyleMap.Insert("slant", "roman");
1029 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1030 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1032 placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1034 placeholderFontstyleMap.Clear();
1035 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1037 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1038 placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1039 DALI_TEST_EQUALS(placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION);
1040 placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderMapSet["fontStyle"];
1041 DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderMapGet, placeholderConversionMap), true, TEST_LOCATION);
1043 editor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
1044 DALI_TEST_EQUALS(editor.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
1046 // Check handle color
1047 editor.SetProperty(DevelTextEditor::Property::GRAB_HANDLE_COLOR, Color::GREEN);
1048 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(DevelTextEditor::Property::GRAB_HANDLE_COLOR), Color::GREEN, TEST_LOCATION);
1050 // Test the ENABLE_GRAB_HANDLE_POPUP property
1051 editor.SetProperty(DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP, false);
1052 DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP), false, TEST_LOCATION);
1054 // Check the input method setting
1055 Property::Map propertyMap;
1056 InputMethod::PanelLayout::Type panelLayout = InputMethod::PanelLayout::NUMBER;
1057 InputMethod::AutoCapital::Type autoCapital = InputMethod::AutoCapital::WORD;
1058 InputMethod::ButtonAction::Type buttonAction = InputMethod::ButtonAction::GO;
1059 int inputVariation = 1;
1060 propertyMap["PANEL_LAYOUT"] = panelLayout;
1061 propertyMap["AUTO_CAPITALIZE"] = autoCapital;
1062 propertyMap["BUTTON_ACTION"] = buttonAction;
1063 propertyMap["VARIATION"] = inputVariation;
1064 editor.SetProperty(DevelTextEditor::Property::INPUT_METHOD_SETTINGS, propertyMap);
1066 Property::Value value = editor.GetProperty(DevelTextEditor::Property::INPUT_METHOD_SETTINGS);
1068 DALI_TEST_CHECK(value.Get(map));
1071 DALI_TEST_CHECK(map["PANEL_LAYOUT"].Get(layout));
1072 DALI_TEST_EQUALS(static_cast<int>(panelLayout), layout, TEST_LOCATION);
1075 DALI_TEST_CHECK(map["AUTO_CAPITALIZE"].Get(capital));
1076 DALI_TEST_EQUALS(static_cast<int>(autoCapital), capital, TEST_LOCATION);
1079 DALI_TEST_CHECK(map["BUTTON_ACTION"].Get(action));
1080 DALI_TEST_EQUALS(static_cast<int>(buttonAction), action, TEST_LOCATION);
1083 DALI_TEST_CHECK(map["VARIATION"].Get(variation));
1084 DALI_TEST_EQUALS(inputVariation, variation, TEST_LOCATION);
1086 // Check the input filter property
1087 Property::Map inputFilterMapSet;
1088 Property::Map inputFilterMapGet;
1089 inputFilterMapSet[InputFilter::Property::ACCEPTED] = "[\\w]";
1090 inputFilterMapSet[InputFilter::Property::REJECTED] = "[\\d]";
1092 editor.SetProperty(DevelTextEditor::Property::INPUT_FILTER, inputFilterMapSet);
1094 inputFilterMapGet = editor.GetProperty<Property::Map>(DevelTextEditor::Property::INPUT_FILTER);
1095 DALI_TEST_EQUALS(inputFilterMapGet.Count(), inputFilterMapSet.Count(), TEST_LOCATION);
1098 inputFilterMapSet.Clear();
1099 editor.SetProperty(DevelTextEditor::Property::INPUT_FILTER, inputFilterMapSet);
1101 // Check the strikethrough property
1103 Property::Map strikethroughMapSet;
1104 Property::Map strikethroughMapGet;
1106 application.SendNotification();
1107 application.Render();
1109 // Check the input strikethrough property
1111 strikethroughMapSet.Clear();
1112 strikethroughMapGet.Clear();
1113 strikethroughMapSet.Insert("enable", true);
1114 strikethroughMapSet.Insert("color", Color::BLUE);
1115 strikethroughMapSet.Insert("height", 2.0f);
1117 editor.SetProperty(DevelTextEditor::Property::STRIKETHROUGH, strikethroughMapSet);
1119 application.SendNotification();
1120 application.Render();
1122 strikethroughMapGet = editor.GetProperty<Property::Map>(DevelTextEditor::Property::STRIKETHROUGH);
1124 DALI_TEST_EQUALS(strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION);
1125 DALI_TEST_EQUALS(DaliTestCheckMaps(strikethroughMapSet, strikethroughMapGet), true, TEST_LOCATION);
1127 // Check the input strikethrough property
1128 editor.SetProperty(DevelTextEditor::Property::INPUT_STRIKETHROUGH, "Strikethrough input properties");
1129 DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::INPUT_STRIKETHROUGH), std::string("Strikethrough input properties"), TEST_LOCATION);
1131 application.SendNotification();
1132 application.Render();
1134 // Check the line size property
1135 DALI_TEST_EQUALS(editor.GetProperty<float>(DevelTextEditor::Property::MIN_LINE_SIZE), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1136 editor.SetProperty(DevelTextEditor::Property::MIN_LINE_SIZE, 50.f);
1137 DALI_TEST_EQUALS(editor.GetProperty<float>(DevelTextEditor::Property::MIN_LINE_SIZE), 50.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1142 // Positive Atlas Text Renderer test
1143 int utcDaliTextEditorAtlasRenderP(void)
1145 ToolkitTestApplication application;
1146 tet_infoline(" UtcDaliToolkitTextEditorAtlasRenderP");
1147 StyleManager styleManager = StyleManager::Get();
1148 styleManager.ApplyDefaultTheme();
1149 TextEditor editor = TextEditor::New();
1150 DALI_TEST_CHECK(editor);
1152 editor.SetProperty(TextEditor::Property::HORIZONTAL_ALIGNMENT, "CENTER");
1154 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1156 application.GetScene().Add(editor);
1160 // Render some text with the shared atlas backend
1161 editor.SetProperty(DevelTextEditor::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS);
1162 application.SendNotification();
1163 application.Render();
1167 tet_result(TET_FAIL);
1172 // Positive test for the anchorClicked signal.
1173 int utcDaliTextEditorAnchorClickedP(void)
1175 ToolkitTestApplication application;
1176 tet_infoline(" utcDaliTextEditorAnchorClickedP");
1177 TextEditor editor = TextEditor::New();
1178 DALI_TEST_CHECK(editor);
1180 application.GetScene().Add(editor);
1182 // connect to the anchor clicked signal.
1183 ConnectionTracker* testTracker = new ConnectionTracker();
1184 DevelTextEditor::AnchorClickedSignal(editor).Connect(&TestAnchorClickedCallback);
1185 bool anchorClickedSignal = false;
1186 editor.ConnectSignal(testTracker, "anchorClicked", CallbackFunctor(&anchorClickedSignal));
1188 gAnchorClickedCallBackCalled = false;
1189 editor.SetProperty(TextEditor::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
1190 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
1191 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
1192 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1193 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1195 application.SendNotification();
1196 application.Render();
1197 editor.SetKeyInputFocus();
1199 // Create a tap event to touch the text editor.
1200 TestGenerateTap(application, 5.0f, 5.0f);
1201 application.SendNotification();
1202 application.Render();
1204 DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
1205 DALI_TEST_CHECK(anchorClickedSignal);
1207 gAnchorClickedCallBackNotCalled = true;
1208 // Tap the outside of anchor, callback should not be called.
1209 TestGenerateTap(application, 150.f, 100.f);
1210 application.SendNotification();
1211 application.Render();
1213 DALI_TEST_CHECK(gAnchorClickedCallBackNotCalled);
1218 // Positive test for the textChanged signal.
1219 int utcDaliTextEditorTextChangedP(void)
1221 ToolkitTestApplication application;
1222 tet_infoline(" utcDaliTextEditorTextChangedP");
1223 TextEditor editor = TextEditor::New();
1224 DALI_TEST_CHECK(editor);
1226 application.GetScene().Add(editor);
1228 // connect to the text changed signal.
1229 ConnectionTracker* testTracker = new ConnectionTracker();
1230 editor.TextChangedSignal().Connect(&TestTextChangedCallback);
1231 bool textChangedSignal = false;
1232 editor.ConnectSignal(testTracker, "textChanged", CallbackFunctor(&textChangedSignal));
1234 gTextChangedCallBackCalled = false;
1235 editor.SetProperty(TextEditor::Property::TEXT, "ABC");
1236 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1237 DALI_TEST_CHECK(textChangedSignal);
1239 application.SendNotification();
1240 editor.SetKeyInputFocus();
1242 gTextChangedCallBackCalled = false;
1243 application.ProcessEvent(GenerateKey("D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1244 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1247 editor.SetProperty(TextField::Property::TEXT, "");
1249 // Pressing backspace key: TextChangedCallback should not be called when there is no text in texteditor.
1250 gTextChangedCallBackCalled = false;
1251 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1252 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1254 // Pressing delete key: TextChangedCallback should not be called when there is no text in texteditor.
1255 gTextChangedCallBackCalled = false;
1256 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "Delete", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1257 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1262 int utcDaliTextEditorTextChangedWithInputMethodContext(void)
1264 ToolkitTestApplication application;
1265 tet_infoline(" utcDaliTextEditorTextChangedWithInputMethodContext");
1266 TextEditor editor = TextEditor::New();
1267 DALI_TEST_CHECK(editor);
1269 application.GetScene().Add(editor);
1271 // connect to the text changed signal.
1272 ConnectionTracker* testTracker = new ConnectionTracker();
1273 editor.TextChangedSignal().Connect(&TestTextChangedCallback);
1274 bool textChangedSignal = false;
1275 editor.ConnectSignal(testTracker, "textChanged", CallbackFunctor(&textChangedSignal));
1277 // get InputMethodContext
1279 InputMethodContext::EventData imfEvent;
1280 InputMethodContext inputMethodContext = DevelTextEditor::GetInputMethodContext(editor);
1282 editor.SetKeyInputFocus();
1283 editor.SetProperty(DevelTextEditor::Property::ENABLE_EDITING, true);
1286 gTextChangedCallBackCalled = false;
1287 imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "ㅎ", 0, 1);
1288 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1289 application.SendNotification();
1290 application.Render();
1291 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1292 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("ㅎ"), TEST_LOCATION);
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 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1315 imfEvent = InputMethodContext::EventData(InputMethodContext::COMMIT, "호", 0, 1);
1316 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1317 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1319 imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "두", 1, 2);
1320 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1321 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1323 application.SendNotification();
1324 application.Render();
1325 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1326 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("호두"), TEST_LOCATION);
1331 int utcDaliTextEditorInputStyleChanged01(void)
1333 // The text-editor emits signals when the input style changes. These changes of style are
1334 // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
1335 // can't be emitted during the size negotiation as the callbacks may update the UI.
1336 // The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
1337 // The ToolkitTestApplication creates an implementation of the adaptor stub and a queue of idle callbacks.
1338 ToolkitTestApplication application;
1339 tet_infoline(" utcDaliTextEditorInputStyleChanged01");
1343 char* pathNamePtr = get_current_dir_name();
1344 const std::string pathName(pathNamePtr);
1347 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1348 fontClient.SetDpi(93u, 93u);
1350 fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE);
1351 fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE);
1353 TextEditor editor = TextEditor::New();
1354 DALI_TEST_CHECK(editor);
1356 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1357 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1358 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1360 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
1361 editor.SetProperty(TextEditor::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='green'>llo</color> <font weight='bold'>world</font> demo</font>");
1363 // connect to the text changed signal.
1364 ConnectionTracker* testTracker = new ConnectionTracker();
1365 editor.InputStyleChangedSignal().Connect(&TestInputStyleChangedCallback);
1366 bool inputStyleChangedSignal = false;
1367 editor.ConnectSignal(testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal));
1369 application.GetScene().Add(editor);
1371 // Render and notify
1372 application.SendNotification();
1373 application.Render();
1375 // Executes the idle callbacks added by the text control on the change of input style.
1376 application.RunIdles();
1378 gInputStyleChangedCallbackCalled = false;
1379 gInputStyleMask = TextEditor::InputStyle::NONE;
1380 inputStyleChangedSignal = false;
1382 // Create a tap event to touch the text editor.
1383 TestGenerateTap(application, 18.0f, 25.0f);
1385 // Render and notify
1386 application.SendNotification();
1387 application.Render();
1389 // Executes the idle callbacks added by the text control on the change of input style.
1390 application.RunIdles();
1392 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1393 if(gInputStyleChangedCallbackCalled)
1395 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::FONT_FAMILY | TextEditor::InputStyle::POINT_SIZE), TEST_LOCATION);
1397 const std::string fontFamily = editor.GetProperty(TextEditor::Property::INPUT_FONT_FAMILY).Get<std::string>();
1398 DALI_TEST_EQUALS(fontFamily, "DejaVuSerif", TEST_LOCATION);
1400 const float pointSize = editor.GetProperty(TextEditor::Property::INPUT_POINT_SIZE).Get<float>();
1401 DALI_TEST_EQUALS(pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1403 DALI_TEST_CHECK(inputStyleChangedSignal);
1405 gInputStyleChangedCallbackCalled = false;
1406 gInputStyleMask = TextEditor::InputStyle::NONE;
1407 inputStyleChangedSignal = false;
1409 // Create a tap event to touch the text editor.
1410 TestGenerateTap(application, 30.0f, 25.0f);
1412 // Render and notify
1413 application.SendNotification();
1414 application.Render();
1416 // Executes the idle callbacks added by the text control on the change of input style.
1417 application.RunIdles();
1419 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1420 DALI_TEST_CHECK(!inputStyleChangedSignal);
1422 gInputStyleChangedCallbackCalled = false;
1423 gInputStyleMask = TextEditor::InputStyle::NONE;
1424 inputStyleChangedSignal = false;
1426 // Create a tap event to touch the text editor.
1427 TestGenerateTap(application, 43.0f, 25.0f);
1429 // Render and notify
1430 application.SendNotification();
1431 application.Render();
1433 // Executes the idle callbacks added by the text control on the change of input style.
1434 application.RunIdles();
1436 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1437 if(gInputStyleChangedCallbackCalled)
1439 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::COLOR), TEST_LOCATION);
1441 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1442 DALI_TEST_EQUALS(color, Color::GREEN, TEST_LOCATION);
1444 DALI_TEST_CHECK(inputStyleChangedSignal);
1446 gInputStyleChangedCallbackCalled = false;
1447 gInputStyleMask = TextEditor::InputStyle::NONE;
1448 inputStyleChangedSignal = false;
1450 // Create a tap event to touch the text editor.
1451 TestGenerateTap(application, 88.0f, 25.0f);
1453 // Render and notify
1454 application.SendNotification();
1455 application.Render();
1457 // Executes the idle callbacks added by the text control on the change of input style.
1458 application.RunIdles();
1460 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1461 if(gInputStyleChangedCallbackCalled)
1463 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::COLOR | TextEditor::InputStyle::FONT_STYLE), TEST_LOCATION);
1465 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1466 DALI_TEST_EQUALS(color, Color::BLACK, TEST_LOCATION);
1468 Property::Map fontStyleMapSet;
1469 Property::Map fontStyleMapGet;
1471 fontStyleMapSet.Insert("weight", "bold");
1473 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
1474 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
1475 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
1477 DALI_TEST_CHECK(inputStyleChangedSignal);
1479 gInputStyleChangedCallbackCalled = false;
1480 gInputStyleMask = TextEditor::InputStyle::NONE;
1481 inputStyleChangedSignal = false;
1483 // Create a tap event to touch the text editor.
1484 TestGenerateTap(application, 115.0f, 25.0f);
1486 // Render and notify
1487 application.SendNotification();
1488 application.Render();
1490 // Executes the idle callbacks added by the text control on the change of input style.
1491 application.RunIdles();
1493 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1494 DALI_TEST_CHECK(!inputStyleChangedSignal);
1496 gInputStyleChangedCallbackCalled = false;
1497 gInputStyleMask = TextEditor::InputStyle::NONE;
1498 inputStyleChangedSignal = false;
1500 // Create a tap event to touch the text editor.
1501 TestGenerateTap(application, 164.0f, 25.0f);
1503 // Render and notify
1504 application.SendNotification();
1505 application.Render();
1507 // Executes the idle callbacks added by the text control on the change of input style.
1508 application.RunIdles();
1510 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1511 if(gInputStyleChangedCallbackCalled)
1513 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::FONT_STYLE), TEST_LOCATION);
1515 Property::Map fontStyleMapSet;
1516 Property::Map fontStyleMapGet;
1518 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
1519 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
1520 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
1522 DALI_TEST_CHECK(inputStyleChangedSignal);
1524 gInputStyleChangedCallbackCalled = false;
1525 gInputStyleMask = TextEditor::InputStyle::NONE;
1526 inputStyleChangedSignal = false;
1528 // Create a tap event to touch the text editor.
1529 TestGenerateTap(application, 191.0f, 25.0f);
1531 // Render and notify
1532 application.SendNotification();
1533 application.Render();
1535 // Executes the idle callbacks added by the text control on the change of input style.
1536 application.RunIdles();
1538 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1539 DALI_TEST_CHECK(!inputStyleChangedSignal);
1544 int utcDaliTextEditorInputStyleChanged02(void)
1546 // The text-editor emits signals when the input style changes. These changes of style are
1547 // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
1548 // can't be emitted during the size negotiation as the callbacks may update the UI.
1549 // The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
1550 // The ToolkitTestApplication creates an implementation of the adaptor stub and a queue of idle callbacks.
1551 ToolkitTestApplication application;
1552 tet_infoline(" utcDaliTextEditorInputStyleChanged02");
1556 char* pathNamePtr = get_current_dir_name();
1557 const std::string pathName(pathNamePtr);
1560 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1561 fontClient.SetDpi(93u, 93u);
1563 fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE);
1564 fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE);
1566 TextEditor editor = TextEditor::New();
1567 DALI_TEST_CHECK(editor);
1569 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1570 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1571 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1573 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
1574 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>");
1576 // connect to the text changed signal.
1577 ConnectionTracker* testTracker = new ConnectionTracker();
1578 editor.InputStyleChangedSignal().Connect(&TestInputStyleChangedCallback);
1579 bool inputStyleChangedSignal = false;
1580 editor.ConnectSignal(testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal));
1582 application.GetScene().Add(editor);
1584 // Render and notify
1585 application.SendNotification();
1586 application.Render();
1588 // Executes the idle callbacks added by the text control on the change of input style.
1589 application.RunIdles();
1591 gInputStyleChangedCallbackCalled = false;
1592 gInputStyleMask = TextEditor::InputStyle::NONE;
1593 inputStyleChangedSignal = false;
1595 // Create a tap event to touch the text editor.
1596 TestGenerateTap(application, 53.0f, 25.0f, 100);
1597 TestGenerateTap(application, 53.0f, 25.0f, 200);
1599 // Render and notify
1600 application.SendNotification();
1601 application.Render();
1603 // Executes the idle callbacks added by the text control on the change of input style.
1604 application.RunIdles();
1606 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1607 if(gInputStyleChangedCallbackCalled)
1609 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1610 static_cast<unsigned int>(TextEditor::InputStyle::FONT_FAMILY |
1611 TextEditor::InputStyle::POINT_SIZE |
1612 TextEditor::InputStyle::COLOR),
1615 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1616 DALI_TEST_EQUALS(color, Color::GREEN, TEST_LOCATION);
1618 const std::string fontFamily = editor.GetProperty(TextEditor::Property::INPUT_FONT_FAMILY).Get<std::string>();
1619 DALI_TEST_EQUALS(fontFamily, "DejaVuSerif", TEST_LOCATION);
1621 const float pointSize = editor.GetProperty(TextEditor::Property::INPUT_POINT_SIZE).Get<float>();
1622 DALI_TEST_EQUALS(pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1624 DALI_TEST_CHECK(inputStyleChangedSignal);
1626 gInputStyleChangedCallbackCalled = false;
1627 gInputStyleMask = TextEditor::InputStyle::NONE;
1628 inputStyleChangedSignal = false;
1630 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1632 // Render and notify
1633 application.SendNotification();
1634 application.Render();
1636 // Executes the idle callbacks added by the text control on the change of input style.
1637 application.RunIdles();
1639 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1640 if(gInputStyleChangedCallbackCalled)
1642 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1643 static_cast<unsigned int>(TextEditor::InputStyle::COLOR),
1646 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1647 DALI_TEST_EQUALS(color, Color::BLUE, TEST_LOCATION);
1649 DALI_TEST_CHECK(inputStyleChangedSignal);
1651 gInputStyleChangedCallbackCalled = false;
1652 gInputStyleMask = TextEditor::InputStyle::NONE;
1653 inputStyleChangedSignal = false;
1655 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1657 // Render and notify
1658 application.SendNotification();
1659 application.Render();
1661 // Executes the idle callbacks added by the text control on the change of input style.
1662 application.RunIdles();
1664 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1665 DALI_TEST_CHECK(!inputStyleChangedSignal);
1667 gInputStyleChangedCallbackCalled = false;
1668 gInputStyleMask = TextEditor::InputStyle::NONE;
1669 inputStyleChangedSignal = false;
1671 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1673 // Render and notify
1674 application.SendNotification();
1675 application.Render();
1677 // Executes the idle callbacks added by the text control on the change of input style.
1678 application.RunIdles();
1680 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1681 if(gInputStyleChangedCallbackCalled)
1683 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1684 static_cast<unsigned int>(TextEditor::InputStyle::COLOR),
1687 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1688 DALI_TEST_EQUALS(color, Color::BLACK, TEST_LOCATION);
1690 DALI_TEST_CHECK(inputStyleChangedSignal);
1692 gInputStyleChangedCallbackCalled = false;
1693 gInputStyleMask = TextEditor::InputStyle::NONE;
1694 inputStyleChangedSignal = false;
1696 editor.SetProperty(TextEditor::Property::INPUT_COLOR, Color::YELLOW);
1698 Property::Map fontStyleMapSet;
1699 fontStyleMapSet.Insert("weight", "thin");
1700 fontStyleMapSet.Insert("width", "condensed");
1701 fontStyleMapSet.Insert("slant", "italic");
1703 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
1704 editor.SetProperty(TextEditor::Property::INPUT_POINT_SIZE, 20.f);
1705 editor.SetProperty(TextEditor::Property::INPUT_LINE_SPACING, 5.f);
1707 editor.SetProperty(TextEditor::Property::INPUT_UNDERLINE, "underline");
1708 editor.SetProperty(TextEditor::Property::INPUT_SHADOW, "shadow");
1709 editor.SetProperty(TextEditor::Property::INPUT_EMBOSS, "emboss");
1710 editor.SetProperty(TextEditor::Property::INPUT_OUTLINE, "outline");
1711 editor.SetProperty(DevelTextEditor::Property::INPUT_STRIKETHROUGH, "strikethrough");
1713 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1715 // Render and notify
1716 application.SendNotification();
1717 application.Render();
1719 // Executes the idle callbacks added by the text control on the change of input style.
1720 application.RunIdles();
1722 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1723 DALI_TEST_CHECK(!inputStyleChangedSignal);
1725 // Create a tap event to touch the text editor.
1726 TestGenerateTap(application, 63.0f, 25.0f, 900);
1728 // Render and notify
1729 application.SendNotification();
1730 application.Render();
1732 // Executes the idle callbacks added by the text control on the change of input style.
1733 application.RunIdles();
1735 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1736 if(gInputStyleChangedCallbackCalled)
1738 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1739 static_cast<unsigned int>(TextEditor::InputStyle::COLOR |
1740 TextEditor::InputStyle::POINT_SIZE |
1741 TextEditor::InputStyle::FONT_STYLE |
1742 TextEditor::InputStyle::LINE_SPACING |
1743 TextEditor::InputStyle::UNDERLINE |
1744 TextEditor::InputStyle::SHADOW |
1745 TextEditor::InputStyle::EMBOSS |
1746 TextEditor::InputStyle::OUTLINE),
1749 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1750 DALI_TEST_EQUALS(color, Color::BLACK, TEST_LOCATION);
1752 DALI_TEST_CHECK(inputStyleChangedSignal);
1754 gInputStyleChangedCallbackCalled = false;
1755 gInputStyleMask = TextEditor::InputStyle::NONE;
1756 inputStyleChangedSignal = false;
1758 editor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVuSerif");
1760 fontStyleMapSet.Clear();
1761 fontStyleMapSet.Insert("weight", "black");
1762 fontStyleMapSet.Insert("width", "expanded");
1763 fontStyleMapSet.Insert("slant", "oblique");
1765 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
1767 // Create a tap event to touch the text editor.
1768 TestGenerateTap(application, 30.0f, 25.0f, 1500);
1770 // Render and notify
1771 application.SendNotification();
1772 application.Render();
1774 // Executes the idle callbacks added by the text control on the change of input style.
1775 application.RunIdles();
1777 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1778 if(gInputStyleChangedCallbackCalled)
1780 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1781 static_cast<unsigned int>(TextEditor::InputStyle::COLOR |
1782 TextEditor::InputStyle::POINT_SIZE |
1783 TextEditor::InputStyle::FONT_STYLE),
1786 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1787 DALI_TEST_EQUALS(color, Color::YELLOW, TEST_LOCATION);
1789 DALI_TEST_CHECK(inputStyleChangedSignal);
1794 int utcDaliTextEditorEvent01(void)
1796 ToolkitTestApplication application;
1797 tet_infoline(" utcDaliTextEditorEvent01");
1799 // Creates a tap event. After creating a tap event the text editor should
1800 // have the focus and add text with key events should be possible.
1802 TextEditor editor = TextEditor::New();
1803 DALI_TEST_CHECK(editor);
1805 application.GetScene().Add(editor);
1807 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1808 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1809 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1811 // Avoid a crash when core load gl resources.
1812 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1814 // Render and notify
1815 application.SendNotification();
1816 application.Render();
1818 // Add a key event but as the text editor has not the focus it should do nothing.
1819 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1821 // Render and notify
1822 application.SendNotification();
1823 application.Render();
1825 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string(""), TEST_LOCATION);
1827 // Create a tap event to touch the text editor.
1828 TestGenerateTap(application, 150.0f, 25.0f);
1830 // Render and notify
1831 application.SendNotification();
1832 application.Render();
1834 // Now the text editor has the focus, so it can handle the key events.
1835 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1836 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1838 // Render and notify
1839 application.SendNotification();
1840 application.Render();
1842 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("aa"), TEST_LOCATION);
1844 // Create a second text editor and send key events to it.
1845 TextEditor editor2 = TextEditor::New();
1847 editor2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1848 editor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1849 editor2.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
1850 editor2.SetProperty(Actor::Property::POSITION, Vector2(100.f, 100.f));
1852 application.GetScene().Add(editor2);
1854 // Render and notify
1855 application.SendNotification();
1856 application.Render();
1858 // Create a tap event on the second text editor.
1859 TestGenerateTap(application, 150.0f, 125.0f);
1861 // Render and notify
1862 application.SendNotification();
1863 application.Render();
1865 // The second text editor has the focus. It should handle the key events.
1866 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1867 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1869 // Render and notify
1870 application.SendNotification();
1871 application.Render();
1873 // Check the text has been added to the second text editor.
1874 DALI_TEST_EQUALS(editor2.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("aa"), TEST_LOCATION);
1879 int utcDaliTextEditorEvent02(void)
1881 ToolkitTestApplication application;
1882 tet_infoline(" utcDaliTextEditorEvent02");
1884 // Checks if the right number of actors are created.
1886 TextEditor editor = TextEditor::New();
1887 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
1888 DALI_TEST_CHECK(editor);
1890 application.GetScene().Add(editor);
1892 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1893 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1894 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1896 // Avoid a crash when core load gl resources.
1897 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1899 // Render and notify
1900 application.SendNotification();
1901 application.Render();
1903 // Check there are the expected number of children (the stencil).
1904 DALI_TEST_EQUALS(editor.GetChildCount(), 1u, TEST_LOCATION);
1906 Actor stencil = editor.GetChildAt(0u);
1908 // Create a tap event to touch the text editor.
1909 TestGenerateTap(application, 150.0f, 25.0f, 100);
1911 // Render and notify
1912 application.SendNotification();
1913 application.Render();
1915 Actor layer = editor.GetChildAt(1u);
1916 DALI_TEST_EQUALS(layer.GetChildCount(), 1u, TEST_LOCATION); // The cursor.
1917 DALI_TEST_EQUALS(stencil.GetChildCount(), 0u, TEST_LOCATION);
1919 // Now the text editor has the focus, so it can handle the key events.
1920 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1921 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1923 // Render and notify
1924 application.SendNotification();
1925 application.Render();
1927 // Checks the cursor and the renderer have been created.
1928 DALI_TEST_EQUALS(layer.GetChildCount(), 1u, TEST_LOCATION); // The cursor.
1929 DALI_TEST_EQUALS(stencil.GetChildCount(), 1u, TEST_LOCATION); // The renderer
1931 Control cursor = Control::DownCast(layer.GetChildAt(0u));
1932 DALI_TEST_CHECK(cursor);
1934 // The stencil actor has a container with all the actors which contain the text renderers.
1935 Actor container = stencil.GetChildAt(0u);
1936 for(unsigned int index = 0; index < container.GetChildCount(); ++index)
1938 Renderer renderer = container.GetChildAt(index).GetRendererAt(0u);
1939 DALI_TEST_CHECK(renderer);
1942 // Move the cursor and check the position changes.
1943 Vector3 position1 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1945 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1946 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1948 // Render and notify
1949 application.SendNotification();
1950 application.Render();
1952 Vector3 position2 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1954 DALI_TEST_CHECK(position2.x < position1.x);
1956 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1957 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1959 // Render and notify
1960 application.SendNotification();
1961 application.Render();
1963 Vector3 position3 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1965 DALI_TEST_EQUALS(position1, position3, TEST_LOCATION); // Should be in the same position1.
1967 // Send some taps and check the cursor positions.
1969 // Try to tap at the beginning.
1970 TestGenerateTap(application, 1.0f, 25.0f, 700);
1972 // Render and notify
1973 application.SendNotification();
1974 application.Render();
1976 // Cursor position should be the same than position1.
1977 Vector3 position4 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1979 DALI_TEST_EQUALS(position2, position4, TEST_LOCATION); // Should be in the same position2.
1981 // Tap away from the start position.
1982 TestGenerateTap(application, 16.0f, 25.0f, 1400);
1984 // Render and notify
1985 application.SendNotification();
1986 application.Render();
1988 Vector3 position5 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1990 DALI_TEST_CHECK(position5.x > position4.x);
1992 // Remove all the text.
1993 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1994 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1995 editor.SetProperty(TextEditor::Property::TEXT, "");
1997 // Render and notify
1998 application.SendNotification();
1999 application.Render();
2001 // Cursor position should be the same than position2.
2002 Vector3 position6 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
2004 DALI_TEST_EQUALS(position2, position6, TEST_LOCATION); // Should be in the same position2.
2006 // Should not be a renderer.
2007 DALI_TEST_EQUALS(stencil.GetChildCount(), 0u, TEST_LOCATION);
2012 int utcDaliTextEditorEvent03(void)
2014 ToolkitTestApplication application;
2015 tet_infoline(" utcDaliTextEditorEvent03");
2017 // Checks if the highlight actor is created.
2019 TextEditor editor = TextEditor::New();
2020 DALI_TEST_CHECK(editor);
2022 application.GetScene().Add(editor);
2024 editor.SetProperty(TextEditor::Property::TEXT, "This is a long text for the size of the text-editor.");
2025 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2026 editor.SetProperty(Actor::Property::SIZE, Vector2(30.f, 50.f));
2027 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2028 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2030 // Avoid a crash when core load gl resources.
2031 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2033 // Render and notify
2034 application.SendNotification();
2035 application.Render();
2037 // Send some taps and check text controller with clipboard window
2038 Dali::Clipboard clipboard = Clipboard::Get();
2039 clipboard.ShowClipboard();
2040 TestGenerateTap(application, 3.0f, 25.0f, 100);
2041 clipboard.HideClipboard();
2043 // Render and notify
2044 application.SendNotification();
2045 application.Render();
2047 // Tap first to get the focus.
2048 TestGenerateTap(application, 3.0f, 25.0f, 1000);
2050 // Render and notify
2051 application.SendNotification();
2052 application.Render();
2054 // Double tap to select a word.
2055 TestGenerateTap(application, 3.0f, 25.0f, 1100);
2057 // Render and notify
2058 application.SendNotification();
2059 application.Render();
2061 // The stencil actor should have two actors: the renderer and the highlight actor.
2062 Actor stencil = editor.GetChildAt(0u);
2064 // Highlight needs to be drawn before text, so should come first in child order
2065 Renderer highlight = stencil.GetChildAt(0u).GetRendererAt(0u);
2066 DALI_TEST_CHECK(highlight);
2068 // The stencil actor has a container with all the actors which contain the text renderers.
2069 Actor container = stencil.GetChildAt(1u);
2070 for(unsigned int index = 0; index < container.GetChildCount(); ++index)
2072 Renderer renderer = container.GetChildAt(index).GetRendererAt(0u);
2073 DALI_TEST_CHECK(renderer);
2076 // Double tap out of bounds
2077 TestGenerateTap(application, 29.0f, 25.0f, 1700);
2078 TestGenerateTap(application, 29.0f, 25.0f, 1800);
2080 // Render and notify
2081 application.SendNotification();
2082 application.Render();
2084 // The stencil actor should have one actors: the renderer actor.
2085 stencil = editor.GetChildAt(0u);
2087 // The stencil actor has a container with all the actors which contain the text renderers.
2088 container = stencil.GetChildAt(0u);
2089 for(unsigned int index = 0; index < container.GetChildCount(); ++index)
2091 Renderer renderer = container.GetChildAt(index).GetRendererAt(0u);
2092 DALI_TEST_CHECK(renderer);
2096 TestGenerateLongPress(application, 1.0f, 25.0f);
2098 // Render and notify
2099 application.SendNotification();
2100 application.Render();
2103 TestGenerateMiniPan(application);
2105 // Render and notify
2106 application.SendNotification();
2107 application.Render();
2112 int utcDaliTextEditorEvent04(void)
2114 ToolkitTestApplication application;
2115 tet_infoline(" utcDaliTextEditorEvent04");
2117 // Checks if the highlight actor is created.
2119 TextEditor editor = TextEditor::New();
2120 DALI_TEST_CHECK(editor);
2122 application.GetScene().Add(editor);
2124 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworl");
2125 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2126 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2127 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2128 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2130 // Avoid a crash when core load gl resources.
2131 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2133 // Render and notify
2134 application.SendNotification();
2135 application.Render();
2137 // Tap on the text editor
2138 TestGenerateTap(application, 3.0f, 25.0f);
2140 // Render and notify
2141 application.SendNotification();
2142 application.Render();
2144 // Move at the end of the text.
2145 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2146 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2148 // Render and notify
2149 application.SendNotification();
2150 application.Render();
2152 for(unsigned int index = 0u; index < 10u; ++index)
2154 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2155 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2157 // Render and notify
2158 application.SendNotification();
2159 application.Render();
2163 application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2165 // Render and notify
2166 application.SendNotification();
2167 application.Render();
2169 DALI_TEST_EQUALS("Hello\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2171 // Add some key events
2172 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2173 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2175 // Render and notify
2176 application.SendNotification();
2177 application.Render();
2179 for(unsigned int index = 0u; index < 10u; ++index)
2181 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2182 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2184 // Render and notify
2185 application.SendNotification();
2186 application.Render();
2190 application.ProcessEvent(GenerateKey(" ", "", " ", KEY_WHITE_SPACE_CODE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2192 // Render and notify
2193 application.SendNotification();
2194 application.Render();
2196 DALI_TEST_EQUALS(" Hello\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2201 int utcDaliTextEditorEvent05(void)
2203 ToolkitTestApplication application;
2204 tet_infoline(" utcDaliTextEditorEvent05");
2206 // Checks if the highlight actor is created.
2208 TextEditor editor = TextEditor::New();
2209 DALI_TEST_CHECK(editor);
2211 application.GetScene().Add(editor);
2213 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworl");
2214 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2215 editor.SetProperty(Actor::Property::SIZE, Vector2(50.f, 50.f));
2216 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2217 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2218 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL, true);
2219 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.2f);
2220 editor.SetProperty(TextEditor::Property::ENABLE_SCROLL_BAR, true);
2221 editor.SetProperty(TextEditor::Property::SCROLL_BAR_SHOW_DURATION, 0.3f);
2222 editor.SetProperty(TextEditor::Property::SCROLL_BAR_FADE_DURATION, 0.2f);
2224 // Avoid a crash when core load gl resources.
2225 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2227 // Render and notify
2228 application.SendNotification();
2229 application.Render();
2231 // Tap on the text editor
2232 TestGenerateTap(application, 3.0f, 25.0f);
2234 // Render and notify
2235 application.SendNotification();
2236 application.Render();
2238 // Move at the end of the text.
2239 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2240 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2242 // Render and notify
2243 application.SendNotification();
2244 application.Render();
2246 for(unsigned int index = 0u; index < 10u; ++index)
2249 application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2251 // Render and notify
2252 application.SendNotification();
2253 application.Render();
2255 // Modify duration after scroll is enabled
2256 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.1f);
2258 // Continuous scroll left to increase coverage
2259 for(unsigned int index = 0u; index < 10u; ++index)
2261 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2263 // Render and notify
2264 application.SendNotification();
2265 application.Render();
2267 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SMOOTH_SCROLL_DURATION), 0.1f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
2268 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::SMOOTH_SCROLL), true, TEST_LOCATION);
2269 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SCROLL_BAR), true, TEST_LOCATION);
2270 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_SHOW_DURATION), 0.3f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
2271 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_FADE_DURATION), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
2273 // Press Escape to increase coverage
2274 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::UP, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2275 application.SendNotification();
2276 application.Render();
2278 DALI_TEST_CHECK(!editor.HasKeyInputFocus());
2283 int utcDaliTextEditorEvent06(void)
2285 ToolkitTestApplication application;
2286 tet_infoline(" utcDaliTextEditorEvent06");
2288 // Checks if the highlight actor is created.
2290 TextEditor editor = TextEditor::New();
2291 DALI_TEST_CHECK(editor);
2293 application.GetScene().Add(editor);
2295 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
2296 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2297 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2298 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2299 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2301 // Avoid a crash when core load gl resources.
2302 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2304 // Render and notify
2305 application.SendNotification();
2306 application.Render();
2308 // Tap on the text editor
2309 TestGenerateTap(application, 3.0f, 25.0f);
2311 // Render and notify
2312 application.SendNotification();
2313 application.Render();
2315 // Move to seconds line of the text.
2316 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2318 // Render and notify
2319 application.SendNotification();
2320 application.Render();
2322 float layoutHeight = editor.GetHeightForWidth(100.f);
2324 // Add another script characters ( glyph height is defferent )
2325 application.ProcessEvent(GenerateKey("d", "", "ㅁ", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "ㅁ", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2326 application.ProcessEvent(GenerateKey("d", "", "ኢ", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "ኢ", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2328 // Delete characters
2329 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2330 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2332 DALI_TEST_EQUALS(layoutHeight, editor.GetHeightForWidth(100.f), TEST_LOCATION);
2334 // Render and notify
2335 application.SendNotification();
2336 application.Render();
2338 DALI_TEST_EQUALS("Hello\nworld\nHello world", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2341 application.ProcessEvent(GenerateKey("", "", "", 0, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2342 application.SendNotification();
2343 application.Render();
2345 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2346 application.SendNotification();
2347 application.Render();
2349 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_VOLUME_UP, 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_VOLUME_DOWN, 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::DevelKey::DALI_KEY_DELETE, 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::DevelKey::DALI_KEY_CONTROL_LEFT, 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_CONTROL_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2366 application.SendNotification();
2367 application.Render();
2372 int utcDaliTextEditorEvent07(void)
2374 ToolkitTestApplication application;
2375 tet_infoline(" utcDaliTextEditorEvent07");
2377 // Checks if the highlight actor is created.
2379 TextEditor editor = TextEditor::New();
2380 DALI_TEST_CHECK(editor);
2382 application.GetScene().Add(editor);
2384 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
2385 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2386 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2387 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2388 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2390 // Avoid a crash when core load gl resources.
2391 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2393 // Render and notify
2394 application.SendNotification();
2395 application.Render();
2397 // Tap on the text editor
2398 TestGenerateTap(application, 3.0f, 25.0f);
2400 // Render and notify
2401 application.SendNotification();
2402 application.Render();
2404 // Move to second line of the text.
2405 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2407 // Render and notify
2408 application.SendNotification();
2409 application.Render();
2411 // Select some text in the right of the current cursor position
2412 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2413 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2414 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2415 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2417 // Render and notify
2418 application.SendNotification();
2419 application.Render();
2421 // Cut the selected text
2422 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2423 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));
2425 // Render and notify
2426 application.SendNotification();
2427 application.Render();
2429 DALI_TEST_EQUALS("Hello\nld\nHello world", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2431 // Select some text in the left of the current cursor position
2432 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2433 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2434 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2435 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2437 // Render and notify
2438 application.SendNotification();
2439 application.Render();
2441 // Copy the selected text
2442 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2443 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));
2445 // Render and notify
2446 application.SendNotification();
2447 application.Render();
2449 // Move the cursor to the third line
2450 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2451 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2453 // Render and notify
2454 application.SendNotification();
2455 application.Render();
2457 // Paste the selected text at the current cursor position
2458 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2459 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));
2461 // Render and notify
2462 application.SendNotification();
2463 application.Render();
2465 DALI_TEST_EQUALS("Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2467 // Disable Shift Selection
2468 editor.SetProperty(DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false);
2470 // Test to select some text in the right of the current cursor position
2471 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2472 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2473 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2474 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2476 // Render and notify
2477 application.SendNotification();
2478 application.Render();
2480 // Cut the selected text
2481 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2482 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));
2484 // Render and notify
2485 application.SendNotification();
2486 application.Render();
2488 // The text isn't selected and not changed because of 'SetProperty( DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false )'
2489 DALI_TEST_EQUALS("Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2491 // Test to select some text in the left of the current cursor position
2492 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2493 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2494 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2495 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2497 // Render and notify
2498 application.SendNotification();
2499 application.Render();
2501 // Copy the selected text
2502 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2503 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));
2505 // Render and notify
2506 application.SendNotification();
2507 application.Render();
2509 // The text is not selected and not changed because of 'SetProperty( DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false )'
2510 DALI_TEST_EQUALS("Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2513 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));
2515 // Render and notify
2516 application.SendNotification();
2517 application.Render();
2519 // replace text with "c"
2520 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2522 // Render and notify
2523 application.SendNotification();
2524 application.Render();
2527 DALI_TEST_EQUALS("c", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2530 DevelTextEditor::SelectWholeText(editor);
2532 // Render and notify
2533 application.SendNotification();
2534 application.Render();
2536 // Copy the selected text using logical keys
2537 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2538 application.ProcessEvent(GenerateKey("ؤ", "c", "ؤ", KEY_C_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2540 // Render and notify
2541 application.SendNotification();
2542 application.Render();
2545 DevelTextEditor::SelectNone(editor);
2547 // Render and notify
2548 application.SendNotification();
2549 application.Render();
2551 // Paste the selected using logical keys
2552 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2553 application.ProcessEvent(GenerateKey("ر", "v", "ر", KEY_V_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "v", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2556 DALI_TEST_EQUALS("cc", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2558 // select all using logical keys
2559 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2560 application.ProcessEvent(GenerateKey("ش", "a", "ش", KEY_A_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2562 // Render and notify
2563 application.SendNotification();
2564 application.Render();
2566 // cut text 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("ء", "x", "ء", KEY_X_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "x", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2570 // Render and notify
2571 application.SendNotification();
2572 application.Render();
2575 DALI_TEST_EQUALS("", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2580 int utcDaliTextEditorEvent08(void)
2582 ToolkitTestApplication application;
2583 tet_infoline(" utcDaliTextEditorEvent08");
2585 // Checks if the highlight actor is released correctly.
2587 TextEditor editor = TextEditor::New();
2588 DALI_TEST_CHECK(editor);
2590 application.GetScene().Add(editor);
2592 editor.SetProperty(TextEditor::Property::TEXT, "DALi");
2593 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2594 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2595 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2596 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2598 // Avoid a crash when core load gl resources.
2599 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2601 // Render and notify
2602 application.SendNotification();
2603 application.Render();
2605 // Tap on the text editor
2606 TestGenerateTap(application, 3.0f, 25.0f);
2608 // Render and notify
2609 application.SendNotification();
2610 application.Render();
2612 // When the left selection handle and the right selection handle are at the same position, the highlight box should be deactivated.
2613 // Test to select some text in the left of the current cursor position
2614 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2615 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2616 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2617 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2619 // Render and notify
2620 application.SendNotification();
2621 application.Render();
2623 // Test to the left selection handle position and the right selection handle position
2624 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2625 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2626 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2627 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2629 // Render and notify
2630 application.SendNotification();
2631 application.Render();
2633 // Test to select full text in the left of the current cursor position
2634 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2635 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2636 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2637 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2638 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2639 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2641 // Render and notify
2642 application.SendNotification();
2643 application.Render();
2645 // Test to release the current full text selection
2646 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2647 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 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 move the current cursor position correctly
2654 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2656 // Render and notify
2657 application.SendNotification();
2658 application.Render();
2661 application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2663 // Render and notify
2664 application.SendNotification();
2665 application.Render();
2667 DALI_TEST_EQUALS("DdALi", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2669 // Test to select some text in the right of the current cursor position
2670 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2671 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2672 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2674 // Render and notify
2675 application.SendNotification();
2676 application.Render();
2678 // Test the cursor position with right arrow key
2679 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2681 // Render and notify
2682 application.SendNotification();
2683 application.Render();
2686 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2688 // Render and notify
2689 application.SendNotification();
2690 application.Render();
2692 DALI_TEST_EQUALS("DdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2694 // Test to select some text in the left of the current cursor position
2695 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2696 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2697 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2698 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2699 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2701 // Render and notify
2702 application.SendNotification();
2703 application.Render();
2705 // Test the cursor position with left arrow key
2706 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2708 // Render and notify
2709 application.SendNotification();
2710 application.Render();
2713 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2715 // Render and notify
2716 application.SendNotification();
2717 application.Render();
2719 DALI_TEST_EQUALS("DcdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2721 // Test to select some text in the right of the current cursor position
2722 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2723 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2724 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2725 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2727 // Render and notify
2728 application.SendNotification();
2729 application.Render();
2731 // Test the cursor position with left arrow key
2732 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2734 // Render and notify
2735 application.SendNotification();
2736 application.Render();
2739 application.ProcessEvent(GenerateKey("x", "", "x", KEY_X_CODE, 0, 0, Integration::KeyEvent::DOWN, "x", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2741 // Render and notify
2742 application.SendNotification();
2743 application.Render();
2745 DALI_TEST_EQUALS("DcxdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2747 // Test to select some text in the left of the current cursor position
2748 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2749 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2750 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2751 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2753 // Render and notify
2754 application.SendNotification();
2755 application.Render();
2757 // Test the cursor position with right arrow key
2758 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2760 // Render and notify
2761 application.SendNotification();
2762 application.Render();
2765 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2767 // Render and notify
2768 application.SendNotification();
2769 application.Render();
2771 DALI_TEST_EQUALS("DcxcdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2776 int utcDaliTextEditorHandles(void)
2778 ToolkitTestApplication application;
2779 tet_infoline(" utcDaliTextEditorHandles");
2781 TextEditor editor = TextEditor::New();
2782 DALI_TEST_CHECK(editor);
2784 application.GetScene().Add(editor);
2786 editor.SetProperty(TextEditor::Property::TEXT, "This is a long text for the size of the text-editor.");
2787 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2788 editor.SetProperty(TextEditor::Property::GRAB_HANDLE_IMAGE, HANDLE_IMAGE_FILE_NAME);
2789 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL, true);
2791 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, Property::Map{{"filename", HANDLE_LEFT_SELECTION_FILE_NAME}});
2792 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT, Property::Map{{"filename", HANDLE_LEFT_SELECTION_FILE_NAME}});
2793 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT, Property::Map{{"filename", HANDLE_RIGHT_SELECTION_FILE_NAME}});
2794 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, Property::Map{{"filename", HANDLE_RIGHT_SELECTION_FILE_NAME}});
2796 editor.SetProperty(Actor::Property::SIZE, Vector2(30.f, 500.f));
2797 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2798 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2800 // Avoid a crash when core load gl resources.
2801 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2803 // Render and notify
2804 application.SendNotification();
2805 application.Render();
2807 // Tap first to get the focus.
2808 TestGenerateTap(application, 3.0f, 25.0f, 100);
2810 // Render and notify
2811 application.SendNotification();
2812 application.Render();
2814 // Tap to create the grab handle.
2815 TestGenerateTap(application, 3.0f, 25.0f, 700);
2817 // Render and notify
2818 application.SendNotification();
2819 application.Render();
2821 // Get the active layer where the text's decoration is added.
2822 Actor activeLayer = editor.GetChildAt(1u);
2824 // Get the handle's actor.
2825 Actor handle = activeLayer.GetChildAt(1u);
2826 handle.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
2828 // Render and notify
2829 application.SendNotification();
2830 application.Render();
2832 // Touch the grab handle to set it as pressed.
2833 Vector2 touchPos(10.0f, 50.0f);
2834 Dali::Integration::TouchEvent event;
2835 event = Dali::Integration::TouchEvent();
2836 event.AddPoint(GetPointDownInside(touchPos));
2837 application.ProcessEvent(event);
2839 // Render and notify
2840 application.SendNotification();
2841 application.Render();
2843 // Pan the grab handle
2844 uint32_t time = 100;
2845 TestStartPan(application, Vector2(10.0f, 50.0f), Vector2(10.0f, 50.0f), time);
2846 TestMovePan(application, Vector2(10.0f, 30.0f), time);
2847 TestEndPan(application, Vector2(10.0f, 50.0f), time);
2848 application.SendNotification();
2849 application.Render();
2851 // Release the grab handle.
2852 event = Dali::Integration::TouchEvent();
2853 event.AddPoint(GetPointUpInside(touchPos));
2854 application.ProcessEvent(event);
2856 // Render and notify
2857 application.SendNotification();
2858 application.Render();
2860 // Tap first to get the focus.
2861 TestGenerateTap(application, 3.0f, 25.0f, 1400);
2863 // Render and notify
2864 application.SendNotification();
2865 application.Render();
2867 // Double tap to select a word and create the selection handles.
2868 TestGenerateTap(application, 3.0f, 25.0f, 1500);
2870 // Render and notify
2871 application.SendNotification();
2872 application.Render();
2874 touchPos = Vector2(10.0f, 50.0f);
2876 // Touch the left selection handle to set it as pressed.
2877 event = Dali::Integration::TouchEvent();
2878 event.AddPoint(GetPointDownInside(touchPos));
2879 application.ProcessEvent(event);
2881 // Render and notify
2882 application.SendNotification();
2883 application.Render();
2885 // Release the left selection handle.
2886 event = Dali::Integration::TouchEvent();
2887 event.AddPoint(GetPointUpInside(touchPos));
2888 application.ProcessEvent(event);
2890 // Render and notify
2891 application.SendNotification();
2892 application.Render();
2897 int utcDaliTextEditorUnderPropertyStringP(void)
2899 ToolkitTestApplication application;
2900 tet_infoline(" utcDaliTextEditorUnderPropertyStringP");
2901 TextEditor editor = TextEditor::New();
2902 DALI_TEST_CHECK(editor);
2904 std::string underlineSettings1("{\"enable\":\"true\",\"color\":\"red\",\"height\":\"1\",\"type\":\"SOLID\",\"dashWidth\":\"2\",\"dashGap\":\"1\"}");
2906 application.GetScene().Add(editor);
2908 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineSettings1);
2909 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::UNDERLINE), underlineSettings1, TEST_LOCATION);
2911 tet_infoline("Set underline settings with a map");
2912 // Check the input underline property
2913 Property::Map underlineMapSet;
2914 Property::Map underlineMapGet;
2915 underlineMapSet.Insert("enable", true);
2916 underlineMapSet.Insert("color", Color::BLUE);
2917 underlineMapSet.Insert("height", 1);
2918 underlineMapSet.Insert("type", Text::Underline::SOLID);
2919 underlineMapSet.Insert("dashWidth", 2);
2920 underlineMapSet.Insert("dashGap", 1);
2922 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
2923 editor.SetProperty(TextEditor::Property::TEXT, "text");
2924 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
2925 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
2926 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapSet, underlineMapGet), true, TEST_LOCATION);
2928 application.SendNotification();
2929 application.Render();
2931 underlineMapSet.Clear();
2932 underlineMapGet.Clear();
2934 tet_infoline("Set dashed underline settings with a map");
2935 // Check the input underline property
2936 underlineMapSet.Clear();
2937 underlineMapGet.Clear();
2938 underlineMapSet.Insert("enable", true);
2939 underlineMapSet.Insert("color", Color::BLUE);
2940 underlineMapSet.Insert("height", 1);
2941 underlineMapSet.Insert("type", Text::Underline::DASHED);
2942 underlineMapSet.Insert("dashWidth", 5);
2943 underlineMapSet.Insert("dashGap", 3);
2945 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
2946 editor.SetProperty(TextEditor::Property::TEXT, "text");
2947 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
2948 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
2949 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapSet, underlineMapGet), true, TEST_LOCATION);
2951 // Check the input underline property
2952 underlineMapSet.Clear();
2953 underlineMapGet.Clear();
2954 underlineMapSet.Insert("enable", true);
2955 underlineMapSet.Insert("color", Color::BLUE);
2956 underlineMapSet.Insert("height", 1);
2957 underlineMapSet.Insert("type", Text::Underline::DOUBLE);
2958 underlineMapSet.Insert("dashWidth", 5);
2959 underlineMapSet.Insert("dashGap", 3);
2961 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
2962 editor.SetProperty(TextEditor::Property::TEXT, "text");
2963 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
2964 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
2965 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapSet, underlineMapGet), true, TEST_LOCATION);
2967 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
2968 editor.SetProperty(TextEditor::Property::TEXT, "text");
2969 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
2970 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
2971 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapSet, underlineMapGet), true, TEST_LOCATION);
2973 application.SendNotification();
2974 application.Render();
2976 underlineMapSet.Clear();
2977 underlineMapGet.Clear();
2979 tet_infoline("Set underline settings with a string");
2980 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineSettings1);
2981 Property::Value value = editor.GetProperty(TextEditor::Property::UNDERLINE);
2984 DALI_TEST_EQUALS(result, underlineSettings1, TEST_LOCATION);
2986 tet_infoline("Trying to set invalid underline settings, should not update and stay at previous settings");
2987 std::string underlineSettingsVoid("{\"enable\":\"true\",\"coooolor\":\"blue\",\"heeeight\":\"4\"}");
2988 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineSettingsVoid);
2989 value = editor.GetProperty(TextEditor::Property::UNDERLINE);
2991 DALI_TEST_EQUALS(result, underlineSettings1, TEST_LOCATION);
2996 int utcDaliTextEditorStrikethroughPropertyStringP(void)
2998 ToolkitTestApplication application;
2999 tet_infoline(" utcDaliTextEditorStrikethroughPropertyStringP");
3000 TextEditor editor = TextEditor::New();
3001 DALI_TEST_CHECK(editor);
3003 std::string strikethroughSettings1("{\"enable\":\"true\",\"color\":\"red\",\"height\":\"2\"}");
3005 application.GetScene().Add(editor);
3007 editor.SetProperty(DevelTextEditor::Property::STRIKETHROUGH, strikethroughSettings1);
3008 DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::STRIKETHROUGH), strikethroughSettings1, TEST_LOCATION);
3010 tet_infoline("Set strikethrough settings with a map");
3011 // Check the input strikethrough property
3012 Property::Map strikethroughMapSet;
3013 Property::Map strikethroughMapGet;
3014 strikethroughMapSet.Insert("enable", true);
3015 strikethroughMapSet.Insert("color", Color::BLUE);
3016 strikethroughMapSet.Insert("height", 2.0f);
3018 editor.SetProperty(DevelTextEditor::Property::STRIKETHROUGH, strikethroughMapSet);
3019 strikethroughMapGet = editor.GetProperty<Property::Map>(DevelTextEditor::Property::STRIKETHROUGH);
3020 DALI_TEST_EQUALS(strikethroughMapGet.Count(), striketh