2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali-toolkit-test-suite-utils.h>
19 #include <dali-toolkit/dali-toolkit.h>
20 #include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
21 #include <dali-toolkit/devel-api/text/rendering-backend.h>
22 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
24 #include <dali/devel-api/actors/actor-devel.h>
25 #include <dali/devel-api/adaptor-framework/clipboard.h>
26 #include <dali/devel-api/adaptor-framework/key-devel.h>
27 #include <dali/devel-api/text-abstraction/font-client.h>
28 #include <dali/integration-api/events/key-event-integ.h>
29 #include <dali/integration-api/events/touch-event-integ.h>
30 #include <dali/public-api/rendering/renderer.h>
34 #include "test-text-geometry-utils.h"
37 using namespace Toolkit;
39 void dali_texteditor_startup(void)
41 test_return_value = TET_UNDEF;
44 void dali_texteditor_cleanup(void)
46 test_return_value = TET_PASS;
51 const char* const PROPERTY_NAME_RENDERING_BACKEND = "renderingBackend";
52 const char* const PROPERTY_NAME_TEXT = "text";
53 const char* const PROPERTY_NAME_TEXT_COLOR = "textColor";
54 const char* const PROPERTY_NAME_FONT_FAMILY = "fontFamily";
55 const char* const PROPERTY_NAME_FONT_STYLE = "fontStyle";
56 const char* const PROPERTY_NAME_POINT_SIZE = "pointSize";
57 const char* const PROPERTY_NAME_HORIZONTAL_ALIGNMENT = "horizontalAlignment";
58 const char* const PROPERTY_NAME_SCROLL_THRESHOLD = "scrollThreshold";
59 const char* const PROPERTY_NAME_SCROLL_SPEED = "scrollSpeed";
60 const char* const PROPERTY_NAME_PRIMARY_CURSOR_COLOR = "primaryCursorColor";
61 const char* const PROPERTY_NAME_SECONDARY_CURSOR_COLOR = "secondaryCursorColor";
62 const char* const PROPERTY_NAME_ENABLE_CURSOR_BLINK = "enableCursorBlink";
63 const char* const PROPERTY_NAME_CURSOR_BLINK_INTERVAL = "cursorBlinkInterval";
64 const char* const PROPERTY_NAME_CURSOR_BLINK_DURATION = "cursorBlinkDuration";
65 const char* const PROPERTY_NAME_CURSOR_WIDTH = "cursorWidth";
66 const char* const PROPERTY_NAME_GRAB_HANDLE_IMAGE = "grabHandleImage";
67 const char* const PROPERTY_NAME_GRAB_HANDLE_PRESSED_IMAGE = "grabHandlePressedImage";
68 const char* const PROPERTY_NAME_SELECTION_HANDLE_IMAGE_LEFT = "selectionHandleImageLeft";
69 const char* const PROPERTY_NAME_SELECTION_HANDLE_IMAGE_RIGHT = "selectionHandleImageRight";
70 const char* const PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_LEFT = "selectionHandlePressedImageLeft";
71 const char* const PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = "selectionHandlePressedImageRight";
72 const char* const PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_LEFT = "selectionHandleMarkerImageLeft";
73 const char* const PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_RIGHT = "selectionHandleMarkerImageRight";
74 const char* const PROPERTY_NAME_SELECTION_HIGHLIGHT_COLOR = "selectionHighlightColor";
75 const char* const PROPERTY_NAME_DECORATION_BOUNDING_BOX = "decorationBoundingBox";
76 const char* const PROPERTY_NAME_ENABLE_MARKUP = "enableMarkup";
77 const char* const PROPERTY_NAME_INPUT_COLOR = "inputColor";
78 const char* const PROPERTY_NAME_INPUT_FONT_FAMILY = "inputFontFamily";
79 const char* const PROPERTY_NAME_INPUT_FONT_STYLE = "inputFontStyle";
80 const char* const PROPERTY_NAME_INPUT_POINT_SIZE = "inputPointSize";
82 const char* const PROPERTY_NAME_LINE_SPACING = "lineSpacing";
83 const char* const PROPERTY_NAME_INPUT_LINE_SPACING = "inputLineSpacing";
84 const char* const PROPERTY_NAME_UNDERLINE = "underline";
85 const char* const PROPERTY_NAME_INPUT_UNDERLINE = "inputUnderline";
86 const char* const PROPERTY_NAME_SHADOW = "shadow";
87 const char* const PROPERTY_NAME_INPUT_SHADOW = "inputShadow";
88 const char* const PROPERTY_NAME_EMBOSS = "emboss";
89 const char* const PROPERTY_NAME_INPUT_EMBOSS = "inputEmboss";
90 const char* const PROPERTY_NAME_OUTLINE = "outline";
91 const char* const PROPERTY_NAME_INPUT_OUTLINE = "inputOutline";
92 const char* const PROPERTY_NAME_STRIKETHROUGH = "strikethrough";
93 const char* const PROPERTY_NAME_INPUT_STRIKETHROUGH = "inputStrikethrough";
95 const char* const PROPERTY_NAME_SMOOTH_SCROLL = "smoothScroll";
96 const char* const PROPERTY_NAME_SMOOTH_SCROLL_DURATION = "smoothScrollDuration";
97 const char* const PROPERTY_NAME_ENABLE_SCROLL_BAR = "enableScrollBar";
98 const char* const PROPERTY_NAME_SCROLL_BAR_SHOW_DURATION = "scrollBarShowDuration";
99 const char* const PROPERTY_NAME_SCROLL_BAR_FADE_DURATION = "scrollBarFadeDuration";
100 const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
101 const char* const PROPERTY_NAME_LINE_COUNT = "lineCount";
102 const char* const PROPERTY_NAME_PLACEHOLDER_TEXT = "placeholderText";
103 const char* const PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR = "placeholderTextColor";
104 const char* const PROPERTY_NAME_ENABLE_SELECTION = "enableSelection";
105 const char* const PROPERTY_NAME_PLACEHOLDER = "placeholder";
106 const char* const PROPERTY_NAME_ENABLE_SHIFT_SELECTION = "enableShiftSelection";
107 const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE = "enableGrabHandle";
108 const char* const PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION = "matchSystemLanguageDirection";
109 const char* const PROPERTY_NAME_MAX_LENGTH = "maxLength";
110 const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
111 const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE = "enableFontSizeScale";
112 const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR = "grabHandleColor";
113 const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP = "enableGrabHandlePopup";
114 const char* const PROPERTY_NAME_INPUT_METHOD_SETTINGS = "inputMethodSettings";
115 const char* const PROPERTY_NAME_INPUT_FILTER = "inputFilter";
117 const Vector4 PLACEHOLDER_TEXT_COLOR(0.8f, 0.8f, 0.8f, 0.8f);
118 const Dali::Vector4 LIGHT_BLUE(0.75f, 0.96f, 1.f, 1.f); // The text highlight color.
120 const float RENDER_FRAME_INTERVAL = 16.66f;
122 const unsigned int DEFAULT_FONT_SIZE = 1152u;
123 const std::string DEFAULT_FONT_DIR("/resources/fonts");
125 const int KEY_A_CODE = 38;
126 const int KEY_D_CODE = 40;
127 const int KEY_C_CODE = 54;
128 const int KEY_V_CODE = 55;
129 const int KEY_X_CODE = 53;
130 const int KEY_WHITE_SPACE_CODE = 65;
132 const int KEY_SHIFT_MODIFIER = 257;
133 const int KEY_CONTROL_MODIFIER = 258;
135 const char* HANDLE_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/insertpoint-icon.png";
136 const char* HANDLE_LEFT_SELECTION_FILE_NAME = TEST_RESOURCE_DIR "/selection_handle_drop_left.png";
137 const char* HANDLE_RIGHT_SELECTION_FILE_NAME = TEST_RESOURCE_DIR "/selection_handle_drop_right.png";
139 const std::string DEFAULT_DEVICE_NAME("hwKeyboard");
141 static bool gSelectionChangedCallbackCalled;
142 static uint32_t oldSelectionStart;
143 static uint32_t oldSelectionEnd;
144 static bool gSelectionClearedCallbackCalled;
145 static bool gSelectionStartedCallbackCalled;
146 static bool gAnchorClickedCallBackCalled;
147 static bool gAnchorClickedCallBackNotCalled;
148 static bool gTextChangedCallBackCalled;
149 static bool gInputFilteredAcceptedCallbackCalled;
150 static bool gInputFilteredRejectedCallbackCalled;
151 static bool gInputStyleChangedCallbackCalled;
152 static bool gMaxCharactersCallBackCalled;
153 static bool gCursorPositionChangedCallbackCalled;
154 static uint32_t oldCursorPos;
155 static Dali::Toolkit::TextEditor::InputStyle::Mask gInputStyleMask;
157 struct CallbackFunctor
159 CallbackFunctor(bool* callbackFlag)
160 : mCallbackFlag(callbackFlag)
166 *mCallbackFlag = true;
171 static void TestSelectionStartedCallback(TextEditor control)
173 tet_infoline(" TestSelectionStartedCallback");
175 gSelectionStartedCallbackCalled = true;
178 static void TestSelectionClearedCallback(TextEditor control)
180 tet_infoline(" TestSelectionClearedCallback");
182 gSelectionClearedCallbackCalled = true;
185 static void TestSelectionChangedCallback(TextEditor control, uint32_t oldStart, uint32_t oldEnd)
187 tet_infoline(" TestSelectionChangedCallback");
189 gSelectionChangedCallbackCalled = true;
190 oldSelectionStart = oldStart;
191 oldSelectionEnd = oldEnd;
194 static void TestAnchorClickedCallback(TextEditor control, const char* href, unsigned int hrefLength)
196 tet_infoline(" TestAnchorClickedCallback");
198 gAnchorClickedCallBackNotCalled = false;
200 if(!strcmp(href, "https://www.tizen.org") && hrefLength == strlen(href))
202 gAnchorClickedCallBackCalled = true;
206 static void TestCursorPositionChangedCallback(TextEditor control, unsigned int oldPos)
208 tet_infoline(" TestCursorPositionChangedCallback");
210 gCursorPositionChangedCallbackCalled = true;
211 oldCursorPos = oldPos;
214 static void TestTextChangedCallback(TextEditor control)
216 tet_infoline(" TestTextChangedCallback");
218 gTextChangedCallBackCalled = true;
221 static void TestInputStyleChangedCallback(TextEditor control, TextEditor::InputStyle::Mask mask)
223 tet_infoline(" TestInputStyleChangedCallback");
225 gInputStyleChangedCallbackCalled = true;
226 gInputStyleMask = mask;
229 static void TestMaxLengthReachedCallback(TextEditor control)
231 tet_infoline(" TestMaxLengthReachedCallback");
233 gMaxCharactersCallBackCalled = true;
236 static void TestInputFilteredCallback(TextEditor control, Toolkit::InputFilter::Property::Type type)
238 tet_infoline(" TestInputFilteredCallback");
240 if(type == Toolkit::InputFilter::Property::ACCEPTED)
242 gInputFilteredAcceptedCallbackCalled = true;
244 else if(type == Toolkit::InputFilter::Property::REJECTED)
246 gInputFilteredRejectedCallbackCalled = true;
250 // Generate a KeyEvent to send to Core.
251 Integration::KeyEvent GenerateKey(const std::string& keyName,
252 const std::string& logicalKey,
253 const std::string& keyString,
256 unsigned long timeStamp,
257 const Integration::KeyEvent::State& keyState,
258 const std::string& compose = "",
259 const std::string& deviceName = DEFAULT_DEVICE_NAME,
260 const Device::Class::Type& deviceClass = Device::Class::NONE,
261 const Device::Subclass::Type& deviceSubclass = Device::Subclass::NONE)
263 return Integration::KeyEvent(keyName,
276 Dali::Integration::Point GetPointDownInside(Vector2& pos)
278 Dali::Integration::Point point;
279 point.SetState(PointState::DOWN);
280 point.SetScreenPosition(pos);
284 Dali::Integration::Point GetPointUpInside(Vector2& pos)
286 Dali::Integration::Point point;
287 point.SetState(PointState::UP);
288 point.SetScreenPosition(pos);
292 bool DaliTestCheckMaps(const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet)
294 if(fontStyleMapGet.Count() == fontStyleMapSet.Count())
296 for(unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index)
298 const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue(index);
300 Property::Value* valueSet = NULL;
301 if(valueGet.first.type == Property::Key::INDEX)
303 valueSet = fontStyleMapSet.Find(valueGet.first.indexKey);
307 // Get Key is a string so searching Set Map for a string key
308 valueSet = fontStyleMapSet.Find(valueGet.first.stringKey);
313 if(valueSet->GetType() == Dali::Property::STRING && (valueGet.second.Get<std::string>() != valueSet->Get<std::string>()))
315 tet_printf("Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str());
318 else if(valueSet->GetType() == Dali::Property::BOOLEAN && (valueGet.second.Get<bool>() != valueSet->Get<bool>()))
320 tet_printf("Value got : [%d], expected : [%d]", valueGet.second.Get<bool>(), valueSet->Get<bool>());
323 else if(valueSet->GetType() == Dali::Property::INTEGER && (valueGet.second.Get<int>() != valueSet->Get<int>()))
325 tet_printf("Value got : [%d], expected : [%d]", valueGet.second.Get<int>(), valueSet->Get<int>());
328 else if(valueSet->GetType() == Dali::Property::FLOAT && (valueGet.second.Get<float>() != valueSet->Get<float>()))
330 tet_printf("Value got : [%f], expected : [%f]", valueGet.second.Get<float>(), valueSet->Get<float>());
333 else if(valueSet->GetType() == Dali::Property::VECTOR2 && (valueGet.second.Get<Vector2>() != valueSet->Get<Vector2>()))
335 Vector2 vector2Get = valueGet.second.Get<Vector2>();
336 Vector2 vector2Set = valueSet->Get<Vector2>();
337 tet_printf("Value got : [%f, %f], expected : [%f, %f]", vector2Get.x, vector2Get.y, vector2Set.x, vector2Set.y);
340 else if(valueSet->GetType() == Dali::Property::VECTOR4 && (valueGet.second.Get<Vector4>() != valueSet->Get<Vector4>()))
342 Vector4 vector4Get = valueGet.second.Get<Vector4>();
343 Vector4 vector4Set = valueSet->Get<Vector4>();
344 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);
350 if(valueGet.first.type == Property::Key::INDEX)
352 tet_printf(" The key %d doesn't exist.", valueGet.first.indexKey);
356 tet_printf(" The key %s doesn't exist.", valueGet.first.stringKey.c_str());
366 class ScrollStateChangeCallback : public Dali::ConnectionTracker
369 ScrollStateChangeCallback(bool& startedCalled, bool& finishedCalled)
370 : mStartedCalled(startedCalled),
371 mFinishedCalled(finishedCalled)
375 void Callback(TextEditor editor, TextEditor::Scroll::Type type)
377 if(type == TextEditor::Scroll::STARTED)
379 mStartedCalled = true;
381 else if(type == TextEditor::Scroll::FINISHED)
383 mFinishedCalled = true;
387 bool& mStartedCalled;
388 bool& mFinishedCalled;
393 int UtcDaliToolkitTextEditorConstructorP(void)
395 ToolkitTestApplication application;
396 tet_infoline(" UtcDaliToolkitTextEditorConstructorP");
397 TextEditor textEditor;
398 DALI_TEST_CHECK(!textEditor);
402 int UtcDaliToolkitTextEditorNewP(void)
404 ToolkitTestApplication application;
405 tet_infoline(" UtcDaliToolkitTextEditorNewP");
406 TextEditor textEditor = TextEditor::New();
407 DALI_TEST_CHECK(textEditor);
411 int UtcDaliToolkitTextEditorDownCastP(void)
413 ToolkitTestApplication application;
414 tet_infoline(" UtcDaliToolkitTextEditorDownCastP");
415 TextEditor textEditor1 = TextEditor::New();
416 BaseHandle object(textEditor1);
418 TextEditor textEditor2 = TextEditor::DownCast(object);
419 DALI_TEST_CHECK(textEditor2);
421 TextEditor textEditor3 = DownCast<TextEditor>(object);
422 DALI_TEST_CHECK(textEditor3);
426 int UtcDaliToolkitTextEditorDownCastN(void)
428 ToolkitTestApplication application;
429 tet_infoline(" UtcDaliToolkitTextEditorDownCastN");
430 BaseHandle uninitializedObject;
431 TextEditor textEditor1 = TextEditor::DownCast(uninitializedObject);
432 DALI_TEST_CHECK(!textEditor1);
434 TextEditor textEditor2 = DownCast<TextEditor>(uninitializedObject);
435 DALI_TEST_CHECK(!textEditor2);
439 int UtcDaliToolkitTextEditorCopyConstructorP(void)
441 ToolkitTestApplication application;
442 tet_infoline(" UtcDaliToolkitTextEditorCopyConstructorP");
443 TextEditor textEditor = TextEditor::New();
444 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
446 TextEditor copy(textEditor);
447 DALI_TEST_CHECK(copy);
448 DALI_TEST_CHECK(copy.GetProperty<std::string>(TextEditor::Property::TEXT) == textEditor.GetProperty<std::string>(TextEditor::Property::TEXT));
452 int UtcDaliTextEditorMoveConstructor(void)
454 ToolkitTestApplication application;
456 TextEditor textEditor = TextEditor::New();
457 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
458 DALI_TEST_CHECK(textEditor.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
460 TextEditor moved = std::move(textEditor);
461 DALI_TEST_CHECK(moved);
462 DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
463 DALI_TEST_CHECK(moved.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
464 DALI_TEST_CHECK(!textEditor);
469 int UtcDaliToolkitTextEditorAssignmentOperatorP(void)
471 ToolkitTestApplication application;
472 tet_infoline(" UtcDaliToolkitTextEditorAssignmentOperatorP");
473 TextEditor textEditor = TextEditor::New();
474 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
476 TextEditor copy = textEditor;
477 DALI_TEST_CHECK(copy);
478 DALI_TEST_CHECK(copy.GetProperty<std::string>(TextEditor::Property::TEXT) == textEditor.GetProperty<std::string>(TextEditor::Property::TEXT));
482 int UtcDaliTextEditorMoveAssignment(void)
484 ToolkitTestApplication application;
486 TextEditor textEditor = TextEditor::New();
487 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
488 DALI_TEST_CHECK(textEditor.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
491 moved = std::move(textEditor);
492 DALI_TEST_CHECK(moved);
493 DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
494 DALI_TEST_CHECK(moved.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
495 DALI_TEST_CHECK(!textEditor);
500 int UtcDaliTextEditorNewP(void)
502 ToolkitTestApplication application;
503 tet_infoline(" UtcDaliToolkitTextEditorNewP");
504 TextEditor textEditor = TextEditor::New();
505 DALI_TEST_CHECK(textEditor);
509 // Positive test case for a method
510 int UtcDaliTextEditorGetPropertyP(void)
512 ToolkitTestApplication application;
513 tet_infoline(" UtcDaliToolkitTextEditorGetPropertyP");
514 TextEditor editor = TextEditor::New();
515 DALI_TEST_CHECK(editor);
517 // Check Property Indices are correct
518 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_RENDERING_BACKEND) == DevelTextEditor::Property::RENDERING_BACKEND);
519 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_TEXT) == TextEditor::Property::TEXT);
520 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_TEXT_COLOR) == TextEditor::Property::TEXT_COLOR);
521 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_FONT_FAMILY) == TextEditor::Property::FONT_FAMILY);
522 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_FONT_STYLE) == TextEditor::Property::FONT_STYLE);
523 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_POINT_SIZE) == TextEditor::Property::POINT_SIZE);
524 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_HORIZONTAL_ALIGNMENT) == TextEditor::Property::HORIZONTAL_ALIGNMENT);
525 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_THRESHOLD) == TextEditor::Property::SCROLL_THRESHOLD);
526 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_SPEED) == TextEditor::Property::SCROLL_SPEED);
527 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PRIMARY_CURSOR_COLOR) == TextEditor::Property::PRIMARY_CURSOR_COLOR);
528 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SECONDARY_CURSOR_COLOR) == TextEditor::Property::SECONDARY_CURSOR_COLOR);
529 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_CURSOR_BLINK) == TextEditor::Property::ENABLE_CURSOR_BLINK);
530 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_CURSOR_BLINK_INTERVAL) == TextEditor::Property::CURSOR_BLINK_INTERVAL);
531 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_CURSOR_BLINK_DURATION) == TextEditor::Property::CURSOR_BLINK_DURATION);
532 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_CURSOR_WIDTH) == TextEditor::Property::CURSOR_WIDTH);
533 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_GRAB_HANDLE_IMAGE) == TextEditor::Property::GRAB_HANDLE_IMAGE);
534 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_GRAB_HANDLE_PRESSED_IMAGE) == TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE);
535 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_IMAGE_LEFT) == TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT);
536 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_IMAGE_RIGHT) == TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT);
537 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_LEFT) == TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT);
538 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT) == TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT);
539 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_LEFT) == TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT);
540 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_RIGHT) == TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT);
541 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HIGHLIGHT_COLOR) == TextEditor::Property::SELECTION_HIGHLIGHT_COLOR);
542 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_DECORATION_BOUNDING_BOX) == TextEditor::Property::DECORATION_BOUNDING_BOX);
543 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_MARKUP) == TextEditor::Property::ENABLE_MARKUP);
544 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_COLOR) == TextEditor::Property::INPUT_COLOR);
545 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_FONT_FAMILY) == TextEditor::Property::INPUT_FONT_FAMILY);
546 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_FONT_STYLE) == TextEditor::Property::INPUT_FONT_STYLE);
547 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_POINT_SIZE) == TextEditor::Property::INPUT_POINT_SIZE);
549 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_LINE_SPACING) == TextEditor::Property::LINE_SPACING);
550 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_LINE_SPACING) == TextEditor::Property::INPUT_LINE_SPACING);
551 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_UNDERLINE) == TextEditor::Property::UNDERLINE);
552 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_UNDERLINE) == TextEditor::Property::INPUT_UNDERLINE);
553 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SHADOW) == TextEditor::Property::SHADOW);
554 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_SHADOW) == TextEditor::Property::INPUT_SHADOW);
555 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_EMBOSS) == TextEditor::Property::EMBOSS);
556 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_EMBOSS) == TextEditor::Property::INPUT_EMBOSS);
557 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_OUTLINE) == TextEditor::Property::OUTLINE);
558 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_OUTLINE) == TextEditor::Property::INPUT_OUTLINE);
559 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextEditor::Property::STRIKETHROUGH);
560 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_STRIKETHROUGH) == DevelTextEditor::Property::INPUT_STRIKETHROUGH);
561 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SMOOTH_SCROLL) == TextEditor::Property::SMOOTH_SCROLL);
562 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SMOOTH_SCROLL_DURATION) == TextEditor::Property::SMOOTH_SCROLL_DURATION);
563 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_SCROLL_BAR) == TextEditor::Property::ENABLE_SCROLL_BAR);
564 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_BAR_SHOW_DURATION) == TextEditor::Property::SCROLL_BAR_SHOW_DURATION);
565 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_BAR_FADE_DURATION) == TextEditor::Property::SCROLL_BAR_FADE_DURATION);
566 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PIXEL_SIZE) == TextEditor::Property::PIXEL_SIZE);
567 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_LINE_COUNT) == TextEditor::Property::LINE_COUNT);
568 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_SELECTION) == TextEditor::Property::ENABLE_SELECTION);
569 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PLACEHOLDER) == TextEditor::Property::PLACEHOLDER);
570 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_FONT_SIZE_SCALE) == DevelTextEditor::Property::FONT_SIZE_SCALE);
571 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE) == DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE);
572 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PLACEHOLDER_TEXT) == DevelTextEditor::Property::PLACEHOLDER_TEXT);
573 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR) == DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR);
574 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_SHIFT_SELECTION) == DevelTextEditor::Property::ENABLE_SHIFT_SELECTION);
575 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_GRAB_HANDLE) == DevelTextEditor::Property::ENABLE_GRAB_HANDLE);
576 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION) == DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION);
577 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_MAX_LENGTH) == DevelTextEditor::Property::MAX_LENGTH);
578 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_GRAB_HANDLE_COLOR) == DevelTextEditor::Property::GRAB_HANDLE_COLOR);
579 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP) == DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP);
580 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_METHOD_SETTINGS) == DevelTextEditor::Property::INPUT_METHOD_SETTINGS);
581 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_FILTER) == DevelTextEditor::Property::INPUT_FILTER);
582 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextEditor::Property::STRIKETHROUGH);
583 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_STRIKETHROUGH) == DevelTextEditor::Property::INPUT_STRIKETHROUGH);
588 bool SetPropertyMapRetrieved(TextEditor& editor, const Property::Index property, const std::string mapKey, const std::string mapValue)
591 Property::Map imageMap;
592 imageMap[mapKey] = mapValue;
594 editor.SetProperty(property, imageMap);
595 Property::Value propValue = editor.GetProperty(property);
596 Property::Map* resultMap = propValue.GetMap();
598 if(resultMap->Find(mapKey)->Get<std::string>() == mapValue)
606 // Positive test case for a method
607 int UtcDaliTextEditorSetPropertyP(void)
609 ToolkitTestApplication application;
610 tet_infoline(" UtcDaliToolkitTextEditorSetPropertyP");
611 TextEditor editor = TextEditor::New();
612 DALI_TEST_CHECK(editor);
613 application.GetScene().Add(editor);
615 // Note - we can't check the defaults since the stylesheets are platform-specific
617 // Check the render backend property.
618 editor.SetProperty(DevelTextEditor::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS);
619 DALI_TEST_EQUALS((DevelText::RenderingType)editor.GetProperty<int>(DevelTextEditor::Property::RENDERING_BACKEND), DevelText::RENDERING_SHARED_ATLAS, TEST_LOCATION);
621 // Check text property.
622 editor.SetProperty(TextEditor::Property::TEXT, "Setting Text");
623 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("Setting Text"), TEST_LOCATION);
625 // Check text's color property
626 editor.SetProperty(TextEditor::Property::TEXT_COLOR, Color::WHITE);
627 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::TEXT_COLOR), Color::WHITE, TEST_LOCATION);
629 // Check font properties.
630 editor.SetProperty(TextEditor::Property::FONT_FAMILY, "Setting font family");
631 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::FONT_FAMILY), std::string("Setting font family"), TEST_LOCATION);
633 Property::Map fontStyleMapSet;
634 Property::Map fontStyleMapGet;
635 Property::Value* slantValue = NULL;
637 fontStyleMapSet.Insert("weight", "bold");
638 fontStyleMapSet.Insert("width", "condensed");
639 fontStyleMapSet.Insert("slant", "italic");
641 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
642 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
643 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
644 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
646 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
647 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::POINT_SIZE), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
649 editor.SetProperty(DevelTextEditor::Property::FONT_SIZE_SCALE, 2.5f);
650 DALI_TEST_EQUALS(editor.GetProperty<float>(DevelTextEditor::Property::FONT_SIZE_SCALE), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
651 editor.SetProperty(DevelTextEditor::Property::FONT_SIZE_SCALE, 1.0f);
653 editor.SetProperty(DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, false);
654 DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE), false, TEST_LOCATION);
655 editor.SetProperty(DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, true);
658 fontStyleMapSet.Clear();
659 fontStyleMapSet.Insert("weight", "normal");
660 fontStyleMapSet.Insert("slant", "oblique");
661 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
662 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
663 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
664 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
666 fontStyleMapSet.Clear();
667 fontStyleMapSet.Insert("slant", "roman");
668 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
669 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
671 // Replace 'roman' for 'normal'.
672 slantValue = fontStyleMapGet.Find("slant");
673 if(NULL != slantValue)
675 if("normal" == slantValue->Get<std::string>())
677 fontStyleMapGet["slant"] = "roman";
680 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
681 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
683 fontStyleMapSet.Clear();
685 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
686 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
687 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
688 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
690 // Check that the Alignment properties can be correctly set
691 editor.SetProperty(TextEditor::Property::HORIZONTAL_ALIGNMENT, "END");
692 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::HORIZONTAL_ALIGNMENT), "END", TEST_LOCATION);
694 // Check scroll properties.
695 editor.SetProperty(TextEditor::Property::SCROLL_THRESHOLD, 1.f);
696 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_THRESHOLD), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
697 editor.SetProperty(TextEditor::Property::SCROLL_SPEED, 100.f);
698 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_SPEED), 100.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
700 // Check cursor properties
701 editor.SetProperty(TextEditor::Property::PRIMARY_CURSOR_COLOR, Color::RED);
702 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::PRIMARY_CURSOR_COLOR), Color::RED, TEST_LOCATION);
703 editor.SetProperty(TextEditor::Property::SECONDARY_CURSOR_COLOR, Color::BLUE);
704 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::SECONDARY_CURSOR_COLOR), Color::BLUE, TEST_LOCATION);
706 editor.SetProperty(TextEditor::Property::ENABLE_CURSOR_BLINK, false);
707 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_CURSOR_BLINK), false, TEST_LOCATION);
708 editor.SetProperty(TextEditor::Property::CURSOR_BLINK_INTERVAL, 1.f);
709 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::CURSOR_BLINK_INTERVAL), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
710 editor.SetProperty(TextEditor::Property::CURSOR_BLINK_DURATION, 10.f);
711 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::CURSOR_BLINK_DURATION), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
712 editor.SetProperty(TextEditor::Property::CURSOR_WIDTH, 1);
713 DALI_TEST_EQUALS(editor.GetProperty<int>(TextEditor::Property::CURSOR_WIDTH), 1, TEST_LOCATION);
715 // Check handle images
716 editor.SetProperty(TextEditor::Property::GRAB_HANDLE_IMAGE, "image1");
717 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::GRAB_HANDLE_IMAGE), "image1", TEST_LOCATION);
718 editor.SetProperty(TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE, "image2");
719 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE), "image2", TEST_LOCATION);
720 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, "image3");
722 // Check handle images
723 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, "filename", "leftHandleImage"));
724 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT, "filename", "rightHandleImage"));
725 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT, "filename", "leftHandleImagePressed"));
726 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, "filename", "rightHandleImagePressed"));
727 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT, "filename", "leftHandleMarkerImage"));
728 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT, "filename", "rightHandleMarkerImage"));
730 // Check the highlight color
731 editor.SetProperty(TextEditor::Property::SELECTION_HIGHLIGHT_COLOR, Color::GREEN);
732 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::SELECTION_HIGHLIGHT_COLOR), Color::GREEN, TEST_LOCATION);
734 // Decoration bounding box
735 editor.SetProperty(TextEditor::Property::DECORATION_BOUNDING_BOX, Rect<int>(0, 0, 1, 1));
736 DALI_TEST_EQUALS(editor.GetProperty<Rect<int> >(TextEditor::Property::DECORATION_BOUNDING_BOX), Rect<int>(0, 0, 1, 1), TEST_LOCATION);
738 // Check the enable markup property.
739 DALI_TEST_CHECK(!editor.GetProperty<bool>(TextEditor::Property::ENABLE_MARKUP));
740 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
741 DALI_TEST_CHECK(editor.GetProperty<bool>(TextEditor::Property::ENABLE_MARKUP));
743 // Check input color property.
744 editor.SetProperty(TextEditor::Property::INPUT_COLOR, Color::YELLOW);
745 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::INPUT_COLOR), Color::YELLOW, TEST_LOCATION);
747 // Check input font properties.
748 editor.SetProperty(TextEditor::Property::INPUT_FONT_FAMILY, "Setting input font family");
749 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_FONT_FAMILY), "Setting input font family", TEST_LOCATION);
751 fontStyleMapSet.Clear();
752 fontStyleMapSet.Insert("weight", "bold");
753 fontStyleMapSet.Insert("width", "condensed");
754 fontStyleMapSet.Insert("slant", "italic");
756 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
757 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
758 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
759 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
761 editor.SetProperty(TextEditor::Property::INPUT_POINT_SIZE, 12.f);
762 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::INPUT_POINT_SIZE), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
764 // Reset input font style.
765 fontStyleMapSet.Clear();
766 fontStyleMapSet.Insert("weight", "normal");
767 fontStyleMapSet.Insert("slant", "oblique");
769 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
770 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
771 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
772 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
774 fontStyleMapSet.Clear();
775 fontStyleMapSet.Insert("slant", "roman");
777 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
778 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
780 // Replace 'roman' for 'normal'.
781 slantValue = fontStyleMapGet.Find("slant");
782 if(NULL != slantValue)
784 if("normal" == slantValue->Get<std::string>())
786 fontStyleMapGet["slant"] = "roman";
789 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
790 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
792 fontStyleMapSet.Clear();
794 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
795 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
796 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
797 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
799 // Check the line spacing property
800 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::LINE_SPACING), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
801 editor.SetProperty(TextEditor::Property::LINE_SPACING, 10.f);
802 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::LINE_SPACING), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
804 // Check the input line spacing property
805 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::INPUT_LINE_SPACING), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
806 editor.SetProperty(TextEditor::Property::INPUT_LINE_SPACING, 20.f);
807 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::INPUT_LINE_SPACING), 20.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
809 // Check the underline property
811 Property::Map underlineMapSet;
812 Property::Map underlineMapGet;
814 underlineMapSet.Insert("enable", true);
815 underlineMapSet.Insert("color", Color::RED);
816 underlineMapSet.Insert("height", 1);
817 underlineMapSet.Insert("type", Text::Underline::SOLID);
818 underlineMapSet.Insert("dashWidth", 5);
819 underlineMapSet.Insert("dashGap", 3);
821 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
823 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
824 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
825 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
827 application.SendNotification();
828 application.Render();
830 // Check the dashed underline property
832 underlineMapSet.Clear();
833 underlineMapGet.Clear();
835 underlineMapSet.Insert("enable", true);
836 underlineMapSet.Insert("color", Color::RED);
837 underlineMapSet.Insert("height", 1);
838 underlineMapSet.Insert("type", Text::Underline::DASHED);
839 underlineMapSet.Insert("dashWidth", 5);
840 underlineMapSet.Insert("dashGap", 3);
842 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
844 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
845 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
846 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
848 application.SendNotification();
849 application.Render();
851 underlineMapSet.Clear();
852 underlineMapGet.Clear();
854 // Check the double underline property
856 underlineMapSet.Clear();
857 underlineMapGet.Clear();
859 underlineMapSet.Insert("enable", true);
860 underlineMapSet.Insert("color", Color::RED);
861 underlineMapSet.Insert("height", 1);
862 underlineMapSet.Insert("type", Text::Underline::DOUBLE);
863 underlineMapSet.Insert("dashWidth", 5);
864 underlineMapSet.Insert("dashGap", 3);
866 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
868 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
869 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
870 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
872 application.SendNotification();
873 application.Render();
875 underlineMapSet.Clear();
876 underlineMapGet.Clear();
878 // Check the input underline property
879 editor.SetProperty(TextEditor::Property::INPUT_UNDERLINE, "Underline input properties");
880 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_UNDERLINE), std::string("Underline input properties"), TEST_LOCATION);
882 // Check the shadow property
883 Property::Map shadowMapSet;
884 Property::Map shadowMapGet;
886 shadowMapSet.Insert("color", Color::GREEN);
887 shadowMapSet.Insert("offset", Vector2(2.0f, 2.0f));
888 shadowMapSet.Insert("blurRadius", 3.0f);
890 editor.SetProperty(TextEditor::Property::SHADOW, shadowMapSet);
892 shadowMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::SHADOW);
893 DALI_TEST_EQUALS(shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION);
894 DALI_TEST_EQUALS(DaliTestCheckMaps(shadowMapGet, shadowMapSet), true, TEST_LOCATION);
896 // Check the input shadow property
897 editor.SetProperty(TextEditor::Property::INPUT_SHADOW, "Shadow input properties");
898 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_SHADOW), std::string("Shadow input properties"), TEST_LOCATION);
900 // Check the emboss property
901 editor.SetProperty(TextEditor::Property::EMBOSS, "Emboss properties");
902 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::EMBOSS), std::string("Emboss properties"), TEST_LOCATION);
904 // Check the input emboss property
905 editor.SetProperty(TextEditor::Property::INPUT_EMBOSS, "Emboss input properties");
906 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_EMBOSS), std::string("Emboss input properties"), TEST_LOCATION);
908 // Check the outline property
910 // Test string type first
911 // This is purely to maintain backward compatibility, but we don't support string as the outline property type.
912 editor.SetProperty(TextEditor::Property::OUTLINE, "Outline properties");
913 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::OUTLINE), std::string("Outline properties"), TEST_LOCATION);
915 // Then test the property map type
916 Property::Map outlineMapSet;
917 Property::Map outlineMapGet;
919 outlineMapSet["color"] = Color::RED;
920 outlineMapSet["width"] = 2.0f;
922 editor.SetProperty(TextEditor::Property::OUTLINE, outlineMapSet);
924 outlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::OUTLINE);
925 DALI_TEST_EQUALS(outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION);
926 DALI_TEST_EQUALS(DaliTestCheckMaps(outlineMapGet, outlineMapSet), true, TEST_LOCATION);
928 // Check the input outline property
929 editor.SetProperty(TextEditor::Property::INPUT_OUTLINE, "Outline input properties");
930 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_OUTLINE), std::string("Outline input properties"), TEST_LOCATION);
932 // Check the smooth scroll property
933 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::SMOOTH_SCROLL), false, TEST_LOCATION);
934 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL, true);
935 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::SMOOTH_SCROLL), true, TEST_LOCATION);
937 // Check the smooth scroll duration property
938 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.2f);
939 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SMOOTH_SCROLL_DURATION), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
941 // Check the scroll bar property
942 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SCROLL_BAR), false, TEST_LOCATION);
943 editor.SetProperty(TextEditor::Property::ENABLE_SCROLL_BAR, true);
944 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SCROLL_BAR), true, TEST_LOCATION);
946 editor.SetProperty(TextEditor::Property::SCROLL_BAR_SHOW_DURATION, 0.3f);
947 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_SHOW_DURATION), 0.3f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
948 editor.SetProperty(TextEditor::Property::SCROLL_BAR_FADE_DURATION, 0.2f);
949 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_FADE_DURATION), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
951 // Check the pixel size of font
952 editor.SetProperty(TextEditor::Property::PIXEL_SIZE, 20.f);
953 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::PIXEL_SIZE), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
955 // Check placeholder text properties.
956 editor.SetProperty(DevelTextEditor::Property::PLACEHOLDER_TEXT, "Setting Placeholder Text");
957 DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::PLACEHOLDER_TEXT), std::string("Setting Placeholder Text"), TEST_LOCATION);
959 // Check placeholder text's color property.
960 editor.SetProperty(DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR, Color::RED);
961 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR), Color::RED, TEST_LOCATION);
963 // Check the enable selection property
964 editor.SetProperty(TextEditor::Property::ENABLE_SELECTION, false);
965 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SELECTION), false, TEST_LOCATION);
967 // Check the placeholder property with pixel size
968 Property::Map placeholderPixelSizeMapSet;
969 Property::Map placeholderPixelSizeMapGet;
970 Property::Map placeholderFontstyleMap;
971 placeholderPixelSizeMapSet["text"] = "Setting Placeholder Text";
972 placeholderPixelSizeMapSet["textFocused"] = "Setting Placeholder Text Focused";
973 placeholderPixelSizeMapSet["color"] = Color::BLUE;
974 placeholderPixelSizeMapSet["fontFamily"] = "Arial";
975 placeholderPixelSizeMapSet["pixelSize"] = 15.0f;
977 placeholderFontstyleMap.Insert("weight", "bold");
978 placeholderPixelSizeMapSet["fontStyle"] = placeholderFontstyleMap;
979 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderPixelSizeMapSet);
981 placeholderPixelSizeMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
982 DALI_TEST_EQUALS(placeholderPixelSizeMapGet.Count(), placeholderPixelSizeMapSet.Count(), TEST_LOCATION);
984 tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value");
985 Property::Map placeholderConversionMap;
986 placeholderConversionMap[Text::PlaceHolder::Property::TEXT] = placeholderPixelSizeMapSet["text"];
987 placeholderConversionMap[Text::PlaceHolder::Property::TEXT_FOCUSED] = placeholderPixelSizeMapSet["textFocused"];
988 placeholderConversionMap[Text::PlaceHolder::Property::COLOR] = placeholderPixelSizeMapSet["color"];
989 placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderPixelSizeMapSet["fontStyle"];
990 placeholderConversionMap[Text::PlaceHolder::Property::FONT_FAMILY] = placeholderPixelSizeMapSet["fontFamily"];
991 placeholderConversionMap[Text::PlaceHolder::Property::PIXEL_SIZE] = placeholderPixelSizeMapSet["pixelSize"];
993 DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderPixelSizeMapGet, placeholderConversionMap), true, TEST_LOCATION);
995 // Check the placeholder property with point size
996 Property::Map placeholderMapSet;
997 Property::Map placeholderMapGet;
998 placeholderMapSet["text"] = "Setting Placeholder Text";
999 placeholderMapSet["textFocused"] = "Setting Placeholder Text Focused";
1000 placeholderMapSet["color"] = Color::RED;
1001 placeholderMapSet["fontFamily"] = "Arial";
1002 placeholderMapSet["pointSize"] = 12.0f;
1003 // Check the placeholder font style property
1004 placeholderFontstyleMap.Clear();
1006 placeholderFontstyleMap.Insert("weight", "bold");
1007 placeholderFontstyleMap.Insert("width", "condensed");
1008 placeholderFontstyleMap.Insert("slant", "italic");
1009 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1010 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1012 placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1013 DALI_TEST_EQUALS(placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION);
1015 tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value");
1016 placeholderConversionMap.Clear();
1017 placeholderConversionMap[Text::PlaceHolder::Property::TEXT] = placeholderMapSet["text"];
1018 placeholderConversionMap[Text::PlaceHolder::Property::TEXT_FOCUSED] = placeholderMapSet["textFocused"];
1019 placeholderConversionMap[Text::PlaceHolder::Property::COLOR] = placeholderMapSet["color"];
1020 placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderPixelSizeMapSet["fontStyle"];
1021 placeholderConversionMap[Text::PlaceHolder::Property::FONT_FAMILY] = placeholderMapSet["fontFamily"];
1022 placeholderConversionMap[Text::PlaceHolder::Property::POINT_SIZE] = placeholderMapSet["pointSize"];
1023 DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderMapGet, placeholderConversionMap), true, TEST_LOCATION);
1025 // Reset font style.
1026 placeholderFontstyleMap.Clear();
1027 placeholderFontstyleMap.Insert("weight", "normal");
1028 placeholderFontstyleMap.Insert("slant", "oblique");
1029 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1030 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1032 placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1033 DALI_TEST_EQUALS(placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION);
1034 placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderMapSet["fontStyle"];
1035 DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderMapGet, placeholderConversionMap), true, TEST_LOCATION);
1037 placeholderFontstyleMap.Clear();
1038 placeholderFontstyleMap.Insert("slant", "roman");
1039 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1040 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1042 placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1044 placeholderFontstyleMap.Clear();
1045 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1047 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1048 placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1049 DALI_TEST_EQUALS(placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION);
1050 placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderMapSet["fontStyle"];
1051 DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderMapGet, placeholderConversionMap), true, TEST_LOCATION);
1053 editor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
1054 DALI_TEST_EQUALS(editor.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
1056 // Check handle color
1057 editor.SetProperty(DevelTextEditor::Property::GRAB_HANDLE_COLOR, Color::GREEN);
1058 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(DevelTextEditor::Property::GRAB_HANDLE_COLOR), Color::GREEN, TEST_LOCATION);
1060 // Test the ENABLE_GRAB_HANDLE_POPUP property
1061 editor.SetProperty(DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP, false);
1062 DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP), false, TEST_LOCATION);
1064 // Check the input method setting
1065 Property::Map propertyMap;
1066 InputMethod::PanelLayout::Type panelLayout = InputMethod::PanelLayout::NUMBER;
1067 InputMethod::AutoCapital::Type autoCapital = InputMethod::AutoCapital::WORD;
1068 InputMethod::ButtonAction::Type buttonAction = InputMethod::ButtonAction::GO;
1069 int inputVariation = 1;
1070 propertyMap["PANEL_LAYOUT"] = panelLayout;
1071 propertyMap["AUTO_CAPITALIZE"] = autoCapital;
1072 propertyMap["BUTTON_ACTION"] = buttonAction;
1073 propertyMap["VARIATION"] = inputVariation;
1074 editor.SetProperty(DevelTextEditor::Property::INPUT_METHOD_SETTINGS, propertyMap);
1076 Property::Value value = editor.GetProperty(DevelTextEditor::Property::INPUT_METHOD_SETTINGS);
1078 DALI_TEST_CHECK(value.Get(map));
1081 DALI_TEST_CHECK(map["PANEL_LAYOUT"].Get(layout));
1082 DALI_TEST_EQUALS(static_cast<int>(panelLayout), layout, TEST_LOCATION);
1085 DALI_TEST_CHECK(map["AUTO_CAPITALIZE"].Get(capital));
1086 DALI_TEST_EQUALS(static_cast<int>(autoCapital), capital, TEST_LOCATION);
1089 DALI_TEST_CHECK(map["BUTTON_ACTION"].Get(action));
1090 DALI_TEST_EQUALS(static_cast<int>(buttonAction), action, TEST_LOCATION);
1093 DALI_TEST_CHECK(map["VARIATION"].Get(variation));
1094 DALI_TEST_EQUALS(inputVariation, variation, TEST_LOCATION);
1096 // Check the input filter property
1097 Property::Map inputFilterMapSet;
1098 Property::Map inputFilterMapGet;
1099 inputFilterMapSet[InputFilter::Property::ACCEPTED] = "[\\w]";
1100 inputFilterMapSet[InputFilter::Property::REJECTED] = "[\\d]";
1102 editor.SetProperty(DevelTextEditor::Property::INPUT_FILTER, inputFilterMapSet);
1104 inputFilterMapGet = editor.GetProperty<Property::Map>(DevelTextEditor::Property::INPUT_FILTER);
1105 DALI_TEST_EQUALS(inputFilterMapGet.Count(), inputFilterMapSet.Count(), TEST_LOCATION);
1108 inputFilterMapSet.Clear();
1109 editor.SetProperty(DevelTextEditor::Property::INPUT_FILTER, inputFilterMapSet);
1111 // Check the strikethrough property
1113 Property::Map strikethroughMapSet;
1114 Property::Map strikethroughMapGet;
1116 application.SendNotification();
1117 application.Render();
1119 // Check the input strikethrough property
1121 strikethroughMapSet.Clear();
1122 strikethroughMapGet.Clear();
1123 strikethroughMapSet.Insert("enable", true);
1124 strikethroughMapSet.Insert("color", Color::BLUE);
1125 strikethroughMapSet.Insert("height", 2.0f);
1127 editor.SetProperty(DevelTextEditor::Property::STRIKETHROUGH, strikethroughMapSet);
1129 application.SendNotification();
1130 application.Render();
1132 strikethroughMapGet = editor.GetProperty<Property::Map>(DevelTextEditor::Property::STRIKETHROUGH);
1134 DALI_TEST_EQUALS(strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION);
1135 DALI_TEST_EQUALS(DaliTestCheckMaps(strikethroughMapSet, strikethroughMapGet), true, TEST_LOCATION);
1137 // Check the input strikethrough property
1138 editor.SetProperty(DevelTextEditor::Property::INPUT_STRIKETHROUGH, "Strikethrough input properties");
1139 DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::INPUT_STRIKETHROUGH), std::string("Strikethrough input properties"), TEST_LOCATION);
1141 application.SendNotification();
1142 application.Render();
1144 // Check the line size property
1145 DALI_TEST_EQUALS(editor.GetProperty<float>(DevelTextEditor::Property::MIN_LINE_SIZE), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1146 editor.SetProperty(DevelTextEditor::Property::MIN_LINE_SIZE, 50.f);
1147 DALI_TEST_EQUALS(editor.GetProperty<float>(DevelTextEditor::Property::MIN_LINE_SIZE), 50.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1152 // Positive Atlas Text Renderer test
1153 int utcDaliTextEditorAtlasRenderP(void)
1155 ToolkitTestApplication application;
1156 tet_infoline(" UtcDaliToolkitTextEditorAtlasRenderP");
1157 StyleManager styleManager = StyleManager::Get();
1158 styleManager.ApplyDefaultTheme();
1159 TextEditor editor = TextEditor::New();
1160 DALI_TEST_CHECK(editor);
1162 editor.SetProperty(TextEditor::Property::HORIZONTAL_ALIGNMENT, "CENTER");
1164 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1166 application.GetScene().Add(editor);
1170 // Render some text with the shared atlas backend
1171 editor.SetProperty(DevelTextEditor::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS);
1172 application.SendNotification();
1173 application.Render();
1177 tet_result(TET_FAIL);
1182 // Positive test for the anchorClicked signal.
1183 int utcDaliTextEditorAnchorClickedP(void)
1185 ToolkitTestApplication application;
1186 tet_infoline(" utcDaliTextEditorAnchorClickedP");
1187 TextEditor editor = TextEditor::New();
1188 DALI_TEST_CHECK(editor);
1190 application.GetScene().Add(editor);
1192 // connect to the anchor clicked signal.
1193 ConnectionTracker* testTracker = new ConnectionTracker();
1194 DevelTextEditor::AnchorClickedSignal(editor).Connect(&TestAnchorClickedCallback);
1195 bool anchorClickedSignal = false;
1196 editor.ConnectSignal(testTracker, "anchorClicked", CallbackFunctor(&anchorClickedSignal));
1198 gAnchorClickedCallBackCalled = false;
1199 editor.SetProperty(TextEditor::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
1200 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
1201 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
1202 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1203 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1205 application.SendNotification();
1206 application.Render();
1207 editor.SetKeyInputFocus();
1209 // Create a tap event to touch the text editor.
1210 TestGenerateTap(application, 5.0f, 5.0f);
1211 application.SendNotification();
1212 application.Render();
1214 DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
1215 DALI_TEST_CHECK(anchorClickedSignal);
1217 gAnchorClickedCallBackNotCalled = true;
1218 // Tap the outside of anchor, callback should not be called.
1219 TestGenerateTap(application, 150.f, 100.f);
1220 application.SendNotification();
1221 application.Render();
1223 DALI_TEST_CHECK(gAnchorClickedCallBackNotCalled);
1228 // Positive test for the textChanged signal.
1229 int utcDaliTextEditorTextChangedP(void)
1231 ToolkitTestApplication application;
1232 tet_infoline(" utcDaliTextEditorTextChangedP");
1233 TextEditor editor = TextEditor::New();
1234 DALI_TEST_CHECK(editor);
1236 application.GetScene().Add(editor);
1238 // connect to the text changed signal.
1239 ConnectionTracker* testTracker = new ConnectionTracker();
1240 editor.TextChangedSignal().Connect(&TestTextChangedCallback);
1241 bool textChangedSignal = false;
1242 editor.ConnectSignal(testTracker, "textChanged", CallbackFunctor(&textChangedSignal));
1244 gTextChangedCallBackCalled = false;
1245 editor.SetProperty(TextEditor::Property::TEXT, "ABC");
1246 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1247 DALI_TEST_CHECK(textChangedSignal);
1249 application.SendNotification();
1250 editor.SetKeyInputFocus();
1252 gTextChangedCallBackCalled = false;
1253 application.ProcessEvent(GenerateKey("D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1254 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1257 editor.SetProperty(TextField::Property::TEXT, "");
1259 // Pressing backspace key: TextChangedCallback should not be called when there is no text in texteditor.
1260 gTextChangedCallBackCalled = false;
1261 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1262 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1264 // Pressing delete key: TextChangedCallback should not be called when there is no text in texteditor.
1265 gTextChangedCallBackCalled = false;
1266 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "Delete", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1267 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1272 int utcDaliTextEditorTextChangedWithInputMethodContext(void)
1274 ToolkitTestApplication application;
1275 tet_infoline(" utcDaliTextEditorTextChangedWithInputMethodContext");
1276 TextEditor editor = TextEditor::New();
1277 DALI_TEST_CHECK(editor);
1279 application.GetScene().Add(editor);
1281 // connect to the text changed signal.
1282 ConnectionTracker* testTracker = new ConnectionTracker();
1283 editor.TextChangedSignal().Connect(&TestTextChangedCallback);
1284 bool textChangedSignal = false;
1285 editor.ConnectSignal(testTracker, "textChanged", CallbackFunctor(&textChangedSignal));
1287 // get InputMethodContext
1289 InputMethodContext::EventData imfEvent;
1290 InputMethodContext inputMethodContext = DevelTextEditor::GetInputMethodContext(editor);
1292 editor.SetKeyInputFocus();
1293 editor.SetProperty(DevelTextEditor::Property::ENABLE_EDITING, true);
1296 gTextChangedCallBackCalled = false;
1297 imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "ㅎ", 0, 1);
1298 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1299 application.SendNotification();
1300 application.Render();
1301 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1302 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("ㅎ"), TEST_LOCATION);
1304 gTextChangedCallBackCalled = false;
1305 imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "호", 0, 1);
1306 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1307 application.SendNotification();
1308 application.Render();
1309 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1310 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("호"), TEST_LOCATION);
1312 gTextChangedCallBackCalled = false;
1313 imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "혿", 0, 1);
1314 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1315 application.SendNotification();
1316 application.Render();
1317 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1318 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("혿"), TEST_LOCATION);
1320 gTextChangedCallBackCalled = false;
1321 imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "", 0, 1);
1322 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1323 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1325 imfEvent = InputMethodContext::EventData(InputMethodContext::COMMIT, "호", 0, 1);
1326 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1327 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1329 imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "두", 1, 2);
1330 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1331 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1333 application.SendNotification();
1334 application.Render();
1335 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1336 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("호두"), TEST_LOCATION);
1341 int utcDaliTextEditorInputStyleChanged01(void)
1343 // The text-editor emits signals when the input style changes. These changes of style are
1344 // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
1345 // can't be emitted during the size negotiation as the callbacks may update the UI.
1346 // The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
1347 // The ToolkitTestApplication creates an implementation of the adaptor stub and a queue of idle callbacks.
1348 ToolkitTestApplication application;
1349 tet_infoline(" utcDaliTextEditorInputStyleChanged01");
1353 char* pathNamePtr = get_current_dir_name();
1354 const std::string pathName(pathNamePtr);
1357 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1358 fontClient.SetDpi(93u, 93u);
1360 fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE);
1361 fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE);
1363 TextEditor editor = TextEditor::New();
1364 DALI_TEST_CHECK(editor);
1366 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1367 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1368 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1370 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
1371 editor.SetProperty(TextEditor::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='green'>llo</color> <font weight='bold'>world</font> demo</font>");
1373 // connect to the text changed signal.
1374 ConnectionTracker* testTracker = new ConnectionTracker();
1375 editor.InputStyleChangedSignal().Connect(&TestInputStyleChangedCallback);
1376 bool inputStyleChangedSignal = false;
1377 editor.ConnectSignal(testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal));
1379 application.GetScene().Add(editor);
1381 // Render and notify
1382 application.SendNotification();
1383 application.Render();
1385 // Executes the idle callbacks added by the text control on the change of input style.
1386 application.RunIdles();
1388 gInputStyleChangedCallbackCalled = false;
1389 gInputStyleMask = TextEditor::InputStyle::NONE;
1390 inputStyleChangedSignal = false;
1392 // Create a tap event to touch the text editor.
1393 TestGenerateTap(application, 18.0f, 25.0f);
1395 // Render and notify
1396 application.SendNotification();
1397 application.Render();
1399 // Executes the idle callbacks added by the text control on the change of input style.
1400 application.RunIdles();
1402 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1403 if(gInputStyleChangedCallbackCalled)
1405 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::FONT_FAMILY | TextEditor::InputStyle::POINT_SIZE), TEST_LOCATION);
1407 const std::string fontFamily = editor.GetProperty(TextEditor::Property::INPUT_FONT_FAMILY).Get<std::string>();
1408 DALI_TEST_EQUALS(fontFamily, "DejaVuSerif", TEST_LOCATION);
1410 const float pointSize = editor.GetProperty(TextEditor::Property::INPUT_POINT_SIZE).Get<float>();
1411 DALI_TEST_EQUALS(pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1413 DALI_TEST_CHECK(inputStyleChangedSignal);
1415 gInputStyleChangedCallbackCalled = false;
1416 gInputStyleMask = TextEditor::InputStyle::NONE;
1417 inputStyleChangedSignal = false;
1419 // Create a tap event to touch the text editor.
1420 TestGenerateTap(application, 30.0f, 25.0f);
1422 // Render and notify
1423 application.SendNotification();
1424 application.Render();
1426 // Executes the idle callbacks added by the text control on the change of input style.
1427 application.RunIdles();
1429 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1430 DALI_TEST_CHECK(!inputStyleChangedSignal);
1432 gInputStyleChangedCallbackCalled = false;
1433 gInputStyleMask = TextEditor::InputStyle::NONE;
1434 inputStyleChangedSignal = false;
1436 // Create a tap event to touch the text editor.
1437 TestGenerateTap(application, 43.0f, 25.0f);
1439 // Render and notify
1440 application.SendNotification();
1441 application.Render();
1443 // Executes the idle callbacks added by the text control on the change of input style.
1444 application.RunIdles();
1446 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1447 if(gInputStyleChangedCallbackCalled)
1449 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::COLOR), TEST_LOCATION);
1451 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1452 DALI_TEST_EQUALS(color, Color::GREEN, TEST_LOCATION);
1454 DALI_TEST_CHECK(inputStyleChangedSignal);
1456 gInputStyleChangedCallbackCalled = false;
1457 gInputStyleMask = TextEditor::InputStyle::NONE;
1458 inputStyleChangedSignal = false;
1460 // Create a tap event to touch the text editor.
1461 TestGenerateTap(application, 88.0f, 25.0f);
1463 // Render and notify
1464 application.SendNotification();
1465 application.Render();
1467 // Executes the idle callbacks added by the text control on the change of input style.
1468 application.RunIdles();
1470 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1471 if(gInputStyleChangedCallbackCalled)
1473 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::COLOR | TextEditor::InputStyle::FONT_STYLE), TEST_LOCATION);
1475 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1476 DALI_TEST_EQUALS(color, Color::BLACK, TEST_LOCATION);
1478 Property::Map fontStyleMapSet;
1479 Property::Map fontStyleMapGet;
1481 fontStyleMapSet.Insert("weight", "bold");
1483 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
1484 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
1485 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
1487 DALI_TEST_CHECK(inputStyleChangedSignal);
1489 gInputStyleChangedCallbackCalled = false;
1490 gInputStyleMask = TextEditor::InputStyle::NONE;
1491 inputStyleChangedSignal = false;
1493 // Create a tap event to touch the text editor.
1494 TestGenerateTap(application, 115.0f, 25.0f);
1496 // Render and notify
1497 application.SendNotification();
1498 application.Render();
1500 // Executes the idle callbacks added by the text control on the change of input style.
1501 application.RunIdles();
1503 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1504 DALI_TEST_CHECK(!inputStyleChangedSignal);
1506 gInputStyleChangedCallbackCalled = false;
1507 gInputStyleMask = TextEditor::InputStyle::NONE;
1508 inputStyleChangedSignal = false;
1510 // Create a tap event to touch the text editor.
1511 TestGenerateTap(application, 164.0f, 25.0f);
1513 // Render and notify
1514 application.SendNotification();
1515 application.Render();
1517 // Executes the idle callbacks added by the text control on the change of input style.
1518 application.RunIdles();
1520 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1521 if(gInputStyleChangedCallbackCalled)
1523 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::FONT_STYLE), TEST_LOCATION);
1525 Property::Map fontStyleMapSet;
1526 Property::Map fontStyleMapGet;
1528 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
1529 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
1530 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
1532 DALI_TEST_CHECK(inputStyleChangedSignal);
1534 gInputStyleChangedCallbackCalled = false;
1535 gInputStyleMask = TextEditor::InputStyle::NONE;
1536 inputStyleChangedSignal = false;
1538 // Create a tap event to touch the text editor.
1539 TestGenerateTap(application, 191.0f, 25.0f);
1541 // Render and notify
1542 application.SendNotification();
1543 application.Render();
1545 // Executes the idle callbacks added by the text control on the change of input style.
1546 application.RunIdles();
1548 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1549 DALI_TEST_CHECK(!inputStyleChangedSignal);
1554 int utcDaliTextEditorInputStyleChanged02(void)
1556 // The text-editor emits signals when the input style changes. These changes of style are
1557 // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
1558 // can't be emitted during the size negotiation as the callbacks may update the UI.
1559 // The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
1560 // The ToolkitTestApplication creates an implementation of the adaptor stub and a queue of idle callbacks.
1561 ToolkitTestApplication application;
1562 tet_infoline(" utcDaliTextEditorInputStyleChanged02");
1566 char* pathNamePtr = get_current_dir_name();
1567 const std::string pathName(pathNamePtr);
1570 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1571 fontClient.SetDpi(93u, 93u);
1573 fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE);
1574 fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE);
1576 TextEditor editor = TextEditor::New();
1577 DALI_TEST_CHECK(editor);
1579 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1580 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1581 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1583 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
1584 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>");
1586 // connect to the text changed signal.
1587 ConnectionTracker* testTracker = new ConnectionTracker();
1588 editor.InputStyleChangedSignal().Connect(&TestInputStyleChangedCallback);
1589 bool inputStyleChangedSignal = false;
1590 editor.ConnectSignal(testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal));
1592 application.GetScene().Add(editor);
1594 // Render and notify
1595 application.SendNotification();
1596 application.Render();
1598 // Executes the idle callbacks added by the text control on the change of input style.
1599 application.RunIdles();
1601 gInputStyleChangedCallbackCalled = false;
1602 gInputStyleMask = TextEditor::InputStyle::NONE;
1603 inputStyleChangedSignal = false;
1605 // Create a tap event to touch the text editor.
1606 TestGenerateTap(application, 53.0f, 25.0f, 100);
1607 TestGenerateTap(application, 53.0f, 25.0f, 200);
1609 // Render and notify
1610 application.SendNotification();
1611 application.Render();
1613 // Executes the idle callbacks added by the text control on the change of input style.
1614 application.RunIdles();
1616 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1617 if(gInputStyleChangedCallbackCalled)
1619 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1620 static_cast<unsigned int>(TextEditor::InputStyle::FONT_FAMILY |
1621 TextEditor::InputStyle::POINT_SIZE |
1622 TextEditor::InputStyle::COLOR),
1625 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1626 DALI_TEST_EQUALS(color, Color::GREEN, TEST_LOCATION);
1628 const std::string fontFamily = editor.GetProperty(TextEditor::Property::INPUT_FONT_FAMILY).Get<std::string>();
1629 DALI_TEST_EQUALS(fontFamily, "DejaVuSerif", TEST_LOCATION);
1631 const float pointSize = editor.GetProperty(TextEditor::Property::INPUT_POINT_SIZE).Get<float>();
1632 DALI_TEST_EQUALS(pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1634 DALI_TEST_CHECK(inputStyleChangedSignal);
1636 gInputStyleChangedCallbackCalled = false;
1637 gInputStyleMask = TextEditor::InputStyle::NONE;
1638 inputStyleChangedSignal = false;
1640 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1642 // Render and notify
1643 application.SendNotification();
1644 application.Render();
1646 // Executes the idle callbacks added by the text control on the change of input style.
1647 application.RunIdles();
1649 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1650 if(gInputStyleChangedCallbackCalled)
1652 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1653 static_cast<unsigned int>(TextEditor::InputStyle::COLOR),
1656 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1657 DALI_TEST_EQUALS(color, Color::BLUE, TEST_LOCATION);
1659 DALI_TEST_CHECK(inputStyleChangedSignal);
1661 gInputStyleChangedCallbackCalled = false;
1662 gInputStyleMask = TextEditor::InputStyle::NONE;
1663 inputStyleChangedSignal = false;
1665 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1667 // Render and notify
1668 application.SendNotification();
1669 application.Render();
1671 // Executes the idle callbacks added by the text control on the change of input style.
1672 application.RunIdles();
1674 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1675 DALI_TEST_CHECK(!inputStyleChangedSignal);
1677 gInputStyleChangedCallbackCalled = false;
1678 gInputStyleMask = TextEditor::InputStyle::NONE;
1679 inputStyleChangedSignal = false;
1681 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1683 // Render and notify
1684 application.SendNotification();
1685 application.Render();
1687 // Executes the idle callbacks added by the text control on the change of input style.
1688 application.RunIdles();
1690 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1691 if(gInputStyleChangedCallbackCalled)
1693 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1694 static_cast<unsigned int>(TextEditor::InputStyle::COLOR),
1697 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1698 DALI_TEST_EQUALS(color, Color::BLACK, TEST_LOCATION);
1700 DALI_TEST_CHECK(inputStyleChangedSignal);
1702 gInputStyleChangedCallbackCalled = false;
1703 gInputStyleMask = TextEditor::InputStyle::NONE;
1704 inputStyleChangedSignal = false;
1706 editor.SetProperty(TextEditor::Property::INPUT_COLOR, Color::YELLOW);
1708 Property::Map fontStyleMapSet;
1709 fontStyleMapSet.Insert("weight", "thin");
1710 fontStyleMapSet.Insert("width", "condensed");
1711 fontStyleMapSet.Insert("slant", "italic");
1713 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
1714 editor.SetProperty(TextEditor::Property::INPUT_POINT_SIZE, 20.f);
1715 editor.SetProperty(TextEditor::Property::INPUT_LINE_SPACING, 5.f);
1717 editor.SetProperty(TextEditor::Property::INPUT_UNDERLINE, "underline");
1718 editor.SetProperty(TextEditor::Property::INPUT_SHADOW, "shadow");
1719 editor.SetProperty(TextEditor::Property::INPUT_EMBOSS, "emboss");
1720 editor.SetProperty(TextEditor::Property::INPUT_OUTLINE, "outline");
1721 editor.SetProperty(DevelTextEditor::Property::INPUT_STRIKETHROUGH, "strikethrough");
1723 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1725 // Render and notify
1726 application.SendNotification();
1727 application.Render();
1729 // Executes the idle callbacks added by the text control on the change of input style.
1730 application.RunIdles();
1732 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1733 DALI_TEST_CHECK(!inputStyleChangedSignal);
1735 // Create a tap event to touch the text editor.
1736 TestGenerateTap(application, 63.0f, 25.0f, 900);
1738 // Render and notify
1739 application.SendNotification();
1740 application.Render();
1742 // Executes the idle callbacks added by the text control on the change of input style.
1743 application.RunIdles();
1745 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1746 if(gInputStyleChangedCallbackCalled)
1748 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1749 static_cast<unsigned int>(TextEditor::InputStyle::COLOR |
1750 TextEditor::InputStyle::POINT_SIZE |
1751 TextEditor::InputStyle::FONT_STYLE |
1752 TextEditor::InputStyle::LINE_SPACING |
1753 TextEditor::InputStyle::UNDERLINE |
1754 TextEditor::InputStyle::SHADOW |
1755 TextEditor::InputStyle::EMBOSS |
1756 TextEditor::InputStyle::OUTLINE),
1759 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1760 DALI_TEST_EQUALS(color, Color::BLACK, TEST_LOCATION);
1762 DALI_TEST_CHECK(inputStyleChangedSignal);
1764 gInputStyleChangedCallbackCalled = false;
1765 gInputStyleMask = TextEditor::InputStyle::NONE;
1766 inputStyleChangedSignal = false;
1768 editor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVuSerif");
1770 fontStyleMapSet.Clear();
1771 fontStyleMapSet.Insert("weight", "black");
1772 fontStyleMapSet.Insert("width", "expanded");
1773 fontStyleMapSet.Insert("slant", "oblique");
1775 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
1777 // Create a tap event to touch the text editor.
1778 TestGenerateTap(application, 30.0f, 25.0f, 1500);
1780 // Render and notify
1781 application.SendNotification();
1782 application.Render();
1784 // Executes the idle callbacks added by the text control on the change of input style.
1785 application.RunIdles();
1787 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1788 if(gInputStyleChangedCallbackCalled)
1790 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1791 static_cast<unsigned int>(TextEditor::InputStyle::COLOR |
1792 TextEditor::InputStyle::POINT_SIZE |
1793 TextEditor::InputStyle::FONT_STYLE),
1796 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1797 DALI_TEST_EQUALS(color, Color::YELLOW, TEST_LOCATION);
1799 DALI_TEST_CHECK(inputStyleChangedSignal);
1804 int utcDaliTextEditorEvent01(void)
1806 ToolkitTestApplication application;
1807 tet_infoline(" utcDaliTextEditorEvent01");
1809 // Creates a tap event. After creating a tap event the text editor should
1810 // have the focus and add text with key events should be possible.
1812 TextEditor editor = TextEditor::New();
1813 DALI_TEST_CHECK(editor);
1815 application.GetScene().Add(editor);
1817 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1818 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1819 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1821 // Avoid a crash when core load gl resources.
1822 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1824 // Render and notify
1825 application.SendNotification();
1826 application.Render();
1828 // Add a key event but as the text editor has not the focus it should do nothing.
1829 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1831 // Render and notify
1832 application.SendNotification();
1833 application.Render();
1835 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string(""), TEST_LOCATION);
1837 // Create a tap event to touch the text editor.
1838 TestGenerateTap(application, 150.0f, 25.0f);
1840 // Render and notify
1841 application.SendNotification();
1842 application.Render();
1844 // Now the text editor has the focus, so it can handle the key events.
1845 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1846 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1848 // Render and notify
1849 application.SendNotification();
1850 application.Render();
1852 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("aa"), TEST_LOCATION);
1854 // Create a second text editor and send key events to it.
1855 TextEditor editor2 = TextEditor::New();
1857 editor2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1858 editor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1859 editor2.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
1860 editor2.SetProperty(Actor::Property::POSITION, Vector2(100.f, 100.f));
1862 application.GetScene().Add(editor2);
1864 // Render and notify
1865 application.SendNotification();
1866 application.Render();
1868 // Create a tap event on the second text editor.
1869 TestGenerateTap(application, 150.0f, 125.0f);
1871 // Render and notify
1872 application.SendNotification();
1873 application.Render();
1875 // The second text editor has the focus. It should handle the key events.
1876 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1877 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1879 // Render and notify
1880 application.SendNotification();
1881 application.Render();
1883 // Check the text has been added to the second text editor.
1884 DALI_TEST_EQUALS(editor2.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("aa"), TEST_LOCATION);
1889 int utcDaliTextEditorEvent02(void)
1891 ToolkitTestApplication application;
1892 tet_infoline(" utcDaliTextEditorEvent02");
1894 // Checks if the right number of actors are created.
1896 TextEditor editor = TextEditor::New();
1897 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
1898 DALI_TEST_CHECK(editor);
1900 application.GetScene().Add(editor);
1902 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1903 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1904 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1906 // Avoid a crash when core load gl resources.
1907 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1909 // Render and notify
1910 application.SendNotification();
1911 application.Render();
1913 // Check there are the expected number of children (the stencil).
1914 DALI_TEST_EQUALS(editor.GetChildCount(), 1u, TEST_LOCATION);
1916 Actor stencil = editor.GetChildAt(0u);
1918 // Create a tap event to touch the text editor.
1919 TestGenerateTap(application, 150.0f, 25.0f, 100);
1921 // Render and notify
1922 application.SendNotification();
1923 application.Render();
1925 Actor layer = editor.GetChildAt(2u);
1926 DALI_TEST_EQUALS(layer.GetChildCount(), 1u, TEST_LOCATION); // The cursor.
1927 DALI_TEST_EQUALS(stencil.GetChildCount(), 0u, TEST_LOCATION);
1929 // Now the text editor has the focus, so it can handle the key events.
1930 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1931 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1933 // Render and notify
1934 application.SendNotification();
1935 application.Render();
1937 // Checks the cursor and the renderer have been created.
1938 DALI_TEST_EQUALS(layer.GetChildCount(), 1u, TEST_LOCATION); // The cursor.
1939 DALI_TEST_EQUALS(stencil.GetChildCount(), 2u, TEST_LOCATION); // The renderer, clipped cursor
1941 Control cursor = Control::DownCast(layer.GetChildAt(0u));
1942 DALI_TEST_CHECK(cursor);
1944 // The stencil actor has a container with all the actors which contain the text renderers.
1945 Actor container = stencil.GetChildAt(0u);
1946 for(unsigned int index = 0; index < container.GetChildCount(); ++index)
1948 Renderer renderer = container.GetChildAt(index).GetRendererAt(0u);
1949 DALI_TEST_CHECK(renderer);
1952 // Move the cursor and check the position changes.
1953 Vector3 position1 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1955 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1956 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1958 // Render and notify
1959 application.SendNotification();
1960 application.Render();
1962 Vector3 position2 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1964 DALI_TEST_CHECK(position2.x < position1.x);
1966 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1967 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1969 // Render and notify
1970 application.SendNotification();
1971 application.Render();
1973 Vector3 position3 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1975 DALI_TEST_EQUALS(position1, position3, TEST_LOCATION); // Should be in the same position1.
1977 // Send some taps and check the cursor positions.
1979 // Try to tap at the beginning.
1980 TestGenerateTap(application, 1.0f, 25.0f, 700);
1982 // Render and notify
1983 application.SendNotification();
1984 application.Render();
1986 // Cursor position should be the same than position1.
1987 Vector3 position4 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1989 DALI_TEST_EQUALS(position2, position4, TEST_LOCATION); // Should be in the same position2.
1991 // Tap away from the start position.
1992 TestGenerateTap(application, 16.0f, 25.0f, 1400);
1994 // Render and notify
1995 application.SendNotification();
1996 application.Render();
1998 Vector3 position5 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
2000 DALI_TEST_CHECK(position5.x > position4.x);
2002 // Remove all the text.
2003 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2004 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2005 editor.SetProperty(TextEditor::Property::TEXT, "");
2007 // Render and notify
2008 application.SendNotification();
2009 application.Render();
2011 // Cursor position should be the same than position2.
2012 Vector3 position6 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
2014 DALI_TEST_EQUALS(position2, position6, TEST_LOCATION); // Should be in the same position2.
2016 // Should not be a renderer, there is only a clipped cursor.
2017 DALI_TEST_EQUALS(stencil.GetChildCount(), 1u, TEST_LOCATION);
2022 int utcDaliTextEditorEvent03(void)
2024 ToolkitTestApplication application;
2025 tet_infoline(" utcDaliTextEditorEvent03");
2027 // Checks if the highlight actor is created.
2029 TextEditor editor = TextEditor::New();
2030 DALI_TEST_CHECK(editor);
2032 application.GetScene().Add(editor);
2034 editor.SetProperty(TextEditor::Property::TEXT, "This is a long text for the size of the text-editor.");
2035 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2036 editor.SetProperty(Actor::Property::SIZE, Vector2(30.f, 50.f));
2037 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2038 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2040 // Avoid a crash when core load gl resources.
2041 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2043 // Render and notify
2044 application.SendNotification();
2045 application.Render();
2047 // Send some taps and check text controller with clipboard window
2048 Dali::Clipboard clipboard = Clipboard::Get();
2049 clipboard.ShowClipboard();
2050 TestGenerateTap(application, 3.0f, 25.0f, 100);
2051 clipboard.HideClipboard();
2053 // Render and notify
2054 application.SendNotification();
2055 application.Render();
2057 // Tap first to get the focus.
2058 TestGenerateTap(application, 3.0f, 25.0f, 1000);
2060 // Render and notify
2061 application.SendNotification();
2062 application.Render();
2064 // Double tap to select a word.
2065 TestGenerateTap(application, 3.0f, 25.0f, 1100);
2067 // Render and notify
2068 application.SendNotification();
2069 application.Render();
2071 // The stencil actor should have two actors: the renderer and the highlight actor.
2072 Actor stencil = editor.GetChildAt(0u);
2074 // Highlight needs to be drawn before text, so should come first in child order
2075 Renderer highlight = stencil.GetChildAt(0u).GetRendererAt(0u);
2076 DALI_TEST_CHECK(highlight);
2078 // The stencil actor has a container with all the actors which contain the text renderers.
2079 Actor container = stencil.GetChildAt(1u);
2080 for(unsigned int index = 0; index < container.GetChildCount(); ++index)
2082 Renderer renderer = container.GetChildAt(index).GetRendererAt(0u);
2083 DALI_TEST_CHECK(renderer);
2086 // Double tap out of bounds
2087 TestGenerateTap(application, 29.0f, 25.0f, 1700);
2088 TestGenerateTap(application, 29.0f, 25.0f, 1800);
2090 // Render and notify
2091 application.SendNotification();
2092 application.Render();
2094 // The stencil actor should have one actors: the renderer actor.
2095 stencil = editor.GetChildAt(0u);
2097 // The stencil actor has a container with all the actors which contain the text renderers.
2098 container = stencil.GetChildAt(0u);
2099 for(unsigned int index = 0; index < container.GetChildCount(); ++index)
2101 Renderer renderer = container.GetChildAt(index).GetRendererAt(0u);
2102 DALI_TEST_CHECK(renderer);
2106 TestGenerateLongPress(application, 1.0f, 25.0f);
2108 // Render and notify
2109 application.SendNotification();
2110 application.Render();
2113 TestGenerateMiniPan(application);
2115 // Render and notify
2116 application.SendNotification();
2117 application.Render();
2122 int utcDaliTextEditorEvent04(void)
2124 ToolkitTestApplication application;
2125 tet_infoline(" utcDaliTextEditorEvent04");
2127 // Checks if the highlight actor is created.
2129 TextEditor editor = TextEditor::New();
2130 DALI_TEST_CHECK(editor);
2132 application.GetScene().Add(editor);
2134 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworl");
2135 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2136 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2137 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2138 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2140 // Avoid a crash when core load gl resources.
2141 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2143 // Render and notify
2144 application.SendNotification();
2145 application.Render();
2147 // Tap on the text editor
2148 TestGenerateTap(application, 3.0f, 25.0f);
2150 // Render and notify
2151 application.SendNotification();
2152 application.Render();
2154 // Move at the end of the text.
2155 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2156 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2158 // Render and notify
2159 application.SendNotification();
2160 application.Render();
2162 for(unsigned int index = 0u; index < 10u; ++index)
2164 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2165 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2167 // Render and notify
2168 application.SendNotification();
2169 application.Render();
2173 application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2175 // Render and notify
2176 application.SendNotification();
2177 application.Render();
2179 DALI_TEST_EQUALS("Hello\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2181 // Add some key events
2182 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2183 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2185 // Render and notify
2186 application.SendNotification();
2187 application.Render();
2189 for(unsigned int index = 0u; index < 10u; ++index)
2191 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2192 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2194 // Render and notify
2195 application.SendNotification();
2196 application.Render();
2200 application.ProcessEvent(GenerateKey(" ", "", " ", KEY_WHITE_SPACE_CODE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2202 // Render and notify
2203 application.SendNotification();
2204 application.Render();
2206 DALI_TEST_EQUALS(" Hello\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2211 int utcDaliTextEditorEvent05(void)
2213 ToolkitTestApplication application;
2214 tet_infoline(" utcDaliTextEditorEvent05");
2216 // Checks if the highlight actor is created.
2218 TextEditor editor = TextEditor::New();
2219 DALI_TEST_CHECK(editor);
2221 application.GetScene().Add(editor);
2223 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworl");
2224 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2225 editor.SetProperty(Actor::Property::SIZE, Vector2(50.f, 50.f));
2226 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2227 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2228 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL, true);
2229 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.2f);
2230 editor.SetProperty(TextEditor::Property::ENABLE_SCROLL_BAR, true);
2231 editor.SetProperty(TextEditor::Property::SCROLL_BAR_SHOW_DURATION, 0.3f);
2232 editor.SetProperty(TextEditor::Property::SCROLL_BAR_FADE_DURATION, 0.2f);
2234 // Avoid a crash when core load gl resources.
2235 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2237 // Render and notify
2238 application.SendNotification();
2239 application.Render();
2241 // Tap on the text editor
2242 TestGenerateTap(application, 3.0f, 25.0f);
2244 // Render and notify
2245 application.SendNotification();
2246 application.Render();
2248 // Move at the end of the text.
2249 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2250 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2252 // Render and notify
2253 application.SendNotification();
2254 application.Render();
2256 for(unsigned int index = 0u; index < 10u; ++index)
2259 application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2261 // Render and notify
2262 application.SendNotification();
2263 application.Render();
2265 // Modify duration after scroll is enabled
2266 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.1f);
2268 // Continuous scroll left to increase coverage
2269 for(unsigned int index = 0u; index < 10u; ++index)
2271 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2273 // Render and notify
2274 application.SendNotification();
2275 application.Render();
2277 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SMOOTH_SCROLL_DURATION), 0.1f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
2278 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::SMOOTH_SCROLL), true, TEST_LOCATION);
2279 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SCROLL_BAR), true, TEST_LOCATION);
2280 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_SHOW_DURATION), 0.3f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
2281 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_FADE_DURATION), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
2283 // Press Escape to increase coverage
2284 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::UP, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2285 application.SendNotification();
2286 application.Render();
2288 DALI_TEST_CHECK(!editor.HasKeyInputFocus());
2293 int utcDaliTextEditorEvent06(void)
2295 ToolkitTestApplication application;
2296 tet_infoline(" utcDaliTextEditorEvent06");
2298 // Checks if the highlight actor is created.
2300 TextEditor editor = TextEditor::New();
2301 DALI_TEST_CHECK(editor);
2303 application.GetScene().Add(editor);
2305 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
2306 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2307 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2308 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2309 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2311 // Avoid a crash when core load gl resources.
2312 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2314 // Render and notify
2315 application.SendNotification();
2316 application.Render();
2318 // Tap on the text editor
2319 TestGenerateTap(application, 3.0f, 25.0f);
2321 // Render and notify
2322 application.SendNotification();
2323 application.Render();
2325 // Move to seconds line of the text.
2326 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2328 // Render and notify
2329 application.SendNotification();
2330 application.Render();
2332 float layoutHeight = editor.GetHeightForWidth(100.f);
2334 // Add another script characters ( glyph height is defferent )
2335 application.ProcessEvent(GenerateKey("d", "", "ㅁ", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "ㅁ", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2336 application.ProcessEvent(GenerateKey("d", "", "ኢ", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "ኢ", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2338 // Delete characters
2339 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2340 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2342 DALI_TEST_EQUALS(layoutHeight, editor.GetHeightForWidth(100.f), TEST_LOCATION);
2344 // Render and notify
2345 application.SendNotification();
2346 application.Render();
2348 DALI_TEST_EQUALS("Hello\nworld\nHello world", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2351 application.ProcessEvent(GenerateKey("", "", "", 0, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2352 application.SendNotification();
2353 application.Render();
2355 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2356 application.SendNotification();
2357 application.Render();
2359 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_VOLUME_UP, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2360 application.SendNotification();
2361 application.Render();
2363 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_VOLUME_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2364 application.SendNotification();
2365 application.Render();
2367 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2368 application.SendNotification();
2369 application.Render();
2371 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2372 application.SendNotification();
2373 application.Render();
2375 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2376 application.SendNotification();
2377 application.Render();
2382 int utcDaliTextEditorEvent07(void)
2384 ToolkitTestApplication application;
2385 tet_infoline(" utcDaliTextEditorEvent07");
2387 // Checks if the highlight actor is created.
2389 TextEditor editor = TextEditor::New();
2390 DALI_TEST_CHECK(editor);
2392 application.GetScene().Add(editor);
2394 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
2395 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2396 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2397 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2398 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2400 // Avoid a crash when core load gl resources.
2401 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2403 // Render and notify
2404 application.SendNotification();
2405 application.Render();
2407 // Tap on the text editor
2408 TestGenerateTap(application, 3.0f, 25.0f);
2410 // Render and notify
2411 application.SendNotification();
2412 application.Render();
2414 // Move to second line of the text.
2415 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2417 // Render and notify
2418 application.SendNotification();
2419 application.Render();
2421 // Select some text in the right of the current cursor position
2422 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2423 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2424 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2425 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2427 // Render and notify
2428 application.SendNotification();
2429 application.Render();
2431 // Cut the selected text
2432 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2433 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));
2435 // Render and notify
2436 application.SendNotification();
2437 application.Render();
2439 DALI_TEST_EQUALS("Hello\nld\nHello world", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2441 // Select some text in the left of the current cursor position
2442 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2443 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2444 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2445 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2447 // Render and notify
2448 application.SendNotification();
2449 application.Render();
2451 // Copy the selected text
2452 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2453 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));
2455 // Render and notify
2456 application.SendNotification();
2457 application.Render();
2459 // Move the cursor to the third line
2460 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2461 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2463 // Render and notify
2464 application.SendNotification();
2465 application.Render();
2467 // Paste the selected text at the current cursor position
2468 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2469 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));
2471 // Render and notify
2472 application.SendNotification();
2473 application.Render();
2475 DALI_TEST_EQUALS("Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2477 // Disable Shift Selection
2478 editor.SetProperty(DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false);
2480 // Test to select some text in the right of the current cursor position
2481 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2482 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2483 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2484 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2486 // Render and notify
2487 application.SendNotification();
2488 application.Render();
2490 // Cut the selected text
2491 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2492 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));
2494 // Render and notify
2495 application.SendNotification();
2496 application.Render();
2498 // The text isn't selected and not changed because of 'SetProperty( DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false )'
2499 DALI_TEST_EQUALS("Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2501 // Test to select some text in the left of the current cursor position
2502 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2503 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2504 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2505 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2507 // Render and notify
2508 application.SendNotification();
2509 application.Render();
2511 // Copy the selected text
2512 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2513 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));
2515 // Render and notify
2516 application.SendNotification();
2517 application.Render();
2519 // The text is not selected and not changed because of 'SetProperty( DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false )'
2520 DALI_TEST_EQUALS("Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2523 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));
2525 // Render and notify
2526 application.SendNotification();
2527 application.Render();
2529 // replace text with "c"
2530 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2532 // Render and notify
2533 application.SendNotification();
2534 application.Render();
2537 DALI_TEST_EQUALS("c", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2540 DevelTextEditor::SelectWholeText(editor);
2542 // Render and notify
2543 application.SendNotification();
2544 application.Render();
2546 // Copy the selected text using logical keys
2547 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2548 application.ProcessEvent(GenerateKey("ؤ", "c", "ؤ", KEY_C_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2550 // Render and notify
2551 application.SendNotification();
2552 application.Render();
2555 DevelTextEditor::SelectNone(editor);
2557 // Render and notify
2558 application.SendNotification();
2559 application.Render();
2561 // Paste the selected using logical keys
2562 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2563 application.ProcessEvent(GenerateKey("ر", "v", "ر", KEY_V_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "v", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2566 DALI_TEST_EQUALS("cc", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2568 // select all using logical keys
2569 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2570 application.ProcessEvent(GenerateKey("ش", "a", "ش", KEY_A_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2572 // Render and notify
2573 application.SendNotification();
2574 application.Render();
2576 // cut text using logical keys
2577 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2578 application.ProcessEvent(GenerateKey("ء", "x", "ء", KEY_X_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "x", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2580 // Render and notify
2581 application.SendNotification();
2582 application.Render();
2585 DALI_TEST_EQUALS("", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2590 int utcDaliTextEditorEvent08(void)
2592 ToolkitTestApplication application;
2593 tet_infoline(" utcDaliTextEditorEvent08");
2595 // Checks if the highlight actor is released correctly.
2597 TextEditor editor = TextEditor::New();
2598 DALI_TEST_CHECK(editor);
2600 application.GetScene().Add(editor);
2602 editor.SetProperty(TextEditor::Property::TEXT, "DALi");
2603 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2604 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2605 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2606 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2608 // Avoid a crash when core load gl resources.
2609 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2611 // Render and notify
2612 application.SendNotification();
2613 application.Render();
2615 // Tap on the text editor
2616 TestGenerateTap(application, 3.0f, 25.0f);
2618 // Render and notify
2619 application.SendNotification();
2620 application.Render();
2622 // When the left selection handle and the right selection handle are at the same position, the highlight box should be deactivated.
2623 // Test to select some text in the left of the current cursor 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_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2626 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2627 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 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 the left selection handle position and the right selection handle 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_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2636 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2637 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2639 // Render and notify
2640 application.SendNotification();
2641 application.Render();
2643 // Test to select full text in the left of the current cursor position
2644 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2645 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2646 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2647 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2648 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2649 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2651 // Render and notify
2652 application.SendNotification();
2653 application.Render();
2655 // Test to release the current full text selection
2656 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2657 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2659 // Render and notify
2660 application.SendNotification();
2661 application.Render();
2663 // Test to move the current cursor position correctly
2664 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2666 // Render and notify
2667 application.SendNotification();
2668 application.Render();
2671 application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2673 // Render and notify
2674 application.SendNotification();
2675 application.Render();
2677 DALI_TEST_EQUALS("DdALi", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2679 // Test to select some text in the right of the current cursor position
2680 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2681 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2682 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2684 // Render and notify
2685 application.SendNotification();
2686 application.Render();
2688 // Test the cursor position with right arrow key
2689 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2691 // Render and notify
2692 application.SendNotification();
2693 application.Render();
2696 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2698 // Render and notify
2699 application.SendNotification();
2700 application.Render();
2702 DALI_TEST_EQUALS("DdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2704 // Test to select some text in the left of the current cursor position
2705 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2706 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2707 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2708 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2709 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2711 // Render and notify
2712 application.SendNotification();
2713 application.Render();
2715 // Test the cursor position with left arrow key
2716 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2718 // Render and notify
2719 application.SendNotification();
2720 application.Render();
2723 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2725 // Render and notify
2726 application.SendNotification();
2727 application.Render();
2729 DALI_TEST_EQUALS("DcdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2731 // Test to select some text in the right of the current cursor position
2732 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2733 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2734 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2735 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2737 // Render and notify
2738 application.SendNotification();
2739 application.Render();
2741 // Test the cursor position with left arrow key
2742 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2744 // Render and notify
2745 application.SendNotification();
2746 application.Render();
2749 application.ProcessEvent(GenerateKey("x", "", "x", KEY_X_CODE, 0, 0, Integration::KeyEvent::DOWN, "x", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2751 // Render and notify
2752 application.SendNotification();
2753 application.Render();
2755 DALI_TEST_EQUALS("DcxdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2757 // Test to select some text in the left of the current cursor position
2758 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2759 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2760 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2761 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2763 // Render and notify
2764 application.SendNotification();
2765 application.Render();
2767 // Test the cursor position with right arrow key
2768 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2770 // Render and notify
2771 application.SendNotification();
2772 application.Render();
2775 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2777 // Render and notify
2778 application.SendNotification();
2779 application.Render();
2781 DALI_TEST_EQUALS("DcxcdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2786 int utcDaliTextEditorHandles(void)
2788 ToolkitTestApplication application;
2789 tet_infoline(" utcDaliTextEditorHandles");
2791 TextEditor editor = TextEditor::New();
2792 DALI_TEST_CHECK(editor);
2794 application.GetScene().Add(editor);
2796 editor.SetProperty(TextEditor::Property::TEXT, "This is a long text for the size of the text-editor.");
2797 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2798 editor.SetProperty(TextEditor::Property::GRAB_HANDLE_IMAGE, HANDLE_IMAGE_FILE_NAME);
2799 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL, true);
2801 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, Property::Map{{"filename", HANDLE_LEFT_SELECTION_FILE_NAME}});
2802 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT, Property::Map{{"filename", HANDLE_LEFT_SELECTION_FILE_NAME}});
2803 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT, Property::Map{{"filename", HANDLE_RIGHT_SELECTION_FILE_NAME}});
2804 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, Property::Map{{"filename", HANDLE_RIGHT_SELECTION_FILE_NAME}});
2806 editor.SetProperty(Actor::Property::SIZE, Vector2(30.f, 500.f));
2807 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2808 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2810 // Avoid a crash when core load gl resources.
2811 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2813 // Render and notify
2814 application.SendNotification();
2815 application.Render();
2817 // Tap first to get the focus.
2818 TestGenerateTap(application, 3.0f, 25.0f, 100);
2820 // Render and notify
2821 application.SendNotification();
2822 application.Render();
2824 // Tap to create the grab handle.
2825 TestGenerateTap(application, 3.0f, 25.0f, 700);
2827 // Render and notify
2828 application.SendNotification();
2829 application.Render();
2831 // Get the active layer where the text's decoration is added.
2832 Actor activeLayer = editor.GetChildAt(1u);
2834 // Get the handle's actor.
2835 Actor handle = activeLayer.GetChildAt(0u);
2836 handle.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
2838 // Render and notify
2839 application.SendNotification();
2840 application.Render();
2842 // Touch the grab handle to set it as pressed.
2843 Vector2 touchPos(10.0f, 50.0f);
2844 Dali::Integration::TouchEvent event;
2845 event = Dali::Integration::TouchEvent();
2846 event.AddPoint(GetPointDownInside(touchPos));
2847 application.ProcessEvent(event);
2849 // Render and notify
2850 application.SendNotification();
2851 application.Render();
2853 // Pan the grab handle
2854 uint32_t time = 100;
2855 TestStartPan(application, Vector2(10.0f, 50.0f), Vector2(10.0f, 50.0f), time);
2856 TestMovePan(application, Vector2(10.0f, 30.0f), time);
2857 TestEndPan(application, Vector2(10.0f, 50.0f), time);
2858 application.SendNotification();
2859 application.Render();
2861 // Release the grab handle.
2862 event = Dali::Integration::TouchEvent();
2863 event.AddPoint(GetPointUpInside(touchPos));
2864 application.ProcessEvent(event);
2866 // Render and notify
2867 application.SendNotification();
2868 application.Render();
2870 // Tap first to get the focus.
2871 TestGenerateTap(application, 3.0f, 25.0f, 1400);
2873 // Render and notify
2874 application.SendNotification();
2875 application.Render();
2877 // Double tap to select a word and create the selection handles.
2878 TestGenerateTap(application, 3.0f, 25.0f, 1500);
2880 // Render and notify
2881 application.SendNotification();
2882 application.Render();
2884 touchPos = Vector2(10.0f, 50.0f);
2886 // Touch the left selection handle to set it as pressed.
2887 event = Dali::Integration::TouchEvent();
2888 event.AddPoint(GetPointDownInside(touchPos));
2889 application.ProcessEvent(event);
2891 // Render and notify
2892 application.SendNotification();
2893 application.Render();
2895 // Release the left selection handle.
2896 event = Dali::Integration::TouchEvent();
2897 event.AddPoint(GetPointUpInside(touchPos));
2898 application.ProcessEvent(event);
2900 // Render and notify
2901 application.SendNotification();
2902 application.Render();
2907 int utcDaliTextEditorUnderPropertyStringP(void)
2909 ToolkitTestApplication application;
2910 tet_infoline(" utcDaliTextEditorUnderPropertyStringP");
2911 TextEditor editor = TextEditor::New();
2912 DALI_TEST_CHECK(editor);
2914 std::string underlineSettings1("{\"enable\":\"true\",\"color\":\"red\",\"height\":\"1\",\"type\":\"SOLID\",\"dashWidth\":\"2\",\"dashGap\":\"1\"}");
2916 application.GetScene().Add(editor);
2918 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineSettings1);
2919 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::UNDERLINE), underlineSettings1, TEST_LOCATION);
2921 tet_infoline("Set underline settings with a map");
2922 // Check the input underline property
2923 Property::Map underlineMapSet;
2924 Property::Map underlineMapGet;
2925 underlineMapSet.Insert("enable", true);
2926 underlineMapSet.Insert("color", Color::BLUE);
2927 underlineMapSet.Insert("height", 1);
2928 underlineMapSet.Insert("type", Text::Underline::SOLID);
2929 underlineMapSet.Insert("dashWidth", 2);
2930 underlineMapSet.Insert("dashGap", 1);
2932 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
2933 editor.SetProperty(TextEditor::Property::TEXT, "text");
2934 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
2935 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
2936 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapSet, underlineMapGet), true, TEST_LOCATION);
2938 application.SendNotification();
2939 application.Render();
2941 underlineMapSet.Clear();
2942 underlineMapGet.Clear();
2944 tet_infoline("Set dashed underline settings with a map");
2945 // Check the input underline property
2946 underlineMapSet.Clear();
2947 underlineMapGet.Clear();
2948 underlineMapSet.Insert("enable", true);
2949 underlineMapSet.Insert("color", Color::BLUE);
2950 underlineMapSet.Insert("height", 1);
2951 underlineMapSet.Insert("type", Text::Underline::DASHED);
2952 underlineMapSet.Insert("dashWidth", 5);
2953 underlineMapSet.Insert("dashGap", 3);
2955 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
2956 editor.SetProperty(TextEditor::Property::TEXT, "text");
2957 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
2958 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
2959 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapSet, underlineMapGet), true, TEST_LOCATION);
2961 // Check the input underline property
2962 underlineMapSet.Clear();
2963 underlineMapGet.Clear();
2964 underlineMapSet.Insert("enable", true);
2965 underlineMapSet.Insert("color", Color::BLUE);
2966 underlineMapSet.Insert("height", 1);
2967 underlineMapSet.Insert("type", Text::Underline::DOUBLE);
2968 underlineMapSet.Insert("dashWidth", 5);
2969 underlineMapSet.Insert("dashGap", 3);
2971 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
2972 editor.SetProperty(TextEditor::Property::TEXT, "text");
2973 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
2974 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
2975 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapSet, underlineMapGet), true, TEST_LOCATION);
2977 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
2978 editor.SetProperty(TextEditor::Property::TEXT, "text");
2979 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
2980 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
2981 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapSet, underlineMapGet), true, TEST_LOCATION);
2983 application.SendNotification();
2984 application.Render();
2986 underlineMapSet.Clear();
2987 underlineMapGet.Clear();
2989 tet_infoline("Set underline settings with a string");
2990 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineSettings1);
2991 Property::Value value = editor.GetProperty(TextEditor::Property::UNDERLINE);
2994 DALI_TEST_EQUALS(result, underlineSettings1, TEST_LOCATION);
2996 tet_infoline("Trying to set invalid underline settings, should not update and stay at previous settings");
2997 std::string underlineSettingsVoid("{\"enable\":\"true\",\"coooolor\":\"blue\",\"heeeight\":\"4\"}");
2998 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineSettingsVoid);
2999 value = editor.GetProperty(TextEditor::Property::UNDERLINE);
3001 DALI_TEST_EQUALS(result, underlineSettings1, TEST_LOCATION);
3006 int utcDaliTextEditorStrikethroughPropertyStringP(void)
3008 ToolkitTestApplication application;
3009 tet_infoline(" utcDaliTextEditorStrikethroughPropertyStringP");
3010 TextEditor editor = TextEditor::New();
3011 DALI_TEST_CHECK(editor);
3013 std::string strikethroughSettings1("{\"enable\":\"true\",\"color\":\"red\",\"height\":\"2\"}");
3015 application.GetScene().Add(editor);
3017 editor.SetProperty(DevelTextEditor::Property::STRIKETHROUGH, strikethroughSettings1);
3018 DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::STRIKETHROUGH), strikethroughSettings1, TEST_LOCATION);
3020 tet_infoline("Set strikethrough settings with a map");