2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali-toolkit-test-suite-utils.h>
19 #include <dali-toolkit/dali-toolkit.h>
20 #include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
21 #include <dali-toolkit/devel-api/text/rendering-backend.h>
22 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
23 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
25 #include <dali/devel-api/actors/actor-devel.h>
26 #include <dali/devel-api/adaptor-framework/clipboard.h>
27 #include <dali/devel-api/adaptor-framework/key-devel.h>
28 #include <dali/devel-api/text-abstraction/font-client.h>
29 #include <dali/integration-api/events/key-event-integ.h>
30 #include <dali/integration-api/events/touch-event-integ.h>
31 #include <dali/public-api/rendering/renderer.h>
35 #include "test-text-geometry-utils.h"
38 using namespace Toolkit;
40 void dali_texteditor_startup(void)
42 test_return_value = TET_UNDEF;
45 void dali_texteditor_cleanup(void)
47 test_return_value = TET_PASS;
52 const char* const PROPERTY_NAME_RENDERING_BACKEND = "renderingBackend";
53 const char* const PROPERTY_NAME_TEXT = "text";
54 const char* const PROPERTY_NAME_TEXT_COLOR = "textColor";
55 const char* const PROPERTY_NAME_FONT_FAMILY = "fontFamily";
56 const char* const PROPERTY_NAME_FONT_STYLE = "fontStyle";
57 const char* const PROPERTY_NAME_POINT_SIZE = "pointSize";
58 const char* const PROPERTY_NAME_HORIZONTAL_ALIGNMENT = "horizontalAlignment";
59 const char* const PROPERTY_NAME_SCROLL_THRESHOLD = "scrollThreshold";
60 const char* const PROPERTY_NAME_SCROLL_SPEED = "scrollSpeed";
61 const char* const PROPERTY_NAME_PRIMARY_CURSOR_COLOR = "primaryCursorColor";
62 const char* const PROPERTY_NAME_SECONDARY_CURSOR_COLOR = "secondaryCursorColor";
63 const char* const PROPERTY_NAME_ENABLE_CURSOR_BLINK = "enableCursorBlink";
64 const char* const PROPERTY_NAME_CURSOR_BLINK_INTERVAL = "cursorBlinkInterval";
65 const char* const PROPERTY_NAME_CURSOR_BLINK_DURATION = "cursorBlinkDuration";
66 const char* const PROPERTY_NAME_CURSOR_WIDTH = "cursorWidth";
67 const char* const PROPERTY_NAME_GRAB_HANDLE_IMAGE = "grabHandleImage";
68 const char* const PROPERTY_NAME_GRAB_HANDLE_PRESSED_IMAGE = "grabHandlePressedImage";
69 const char* const PROPERTY_NAME_SELECTION_POPUP_STYLE = "selectionPopupStyle";
70 const char* const PROPERTY_NAME_SELECTION_HANDLE_IMAGE_LEFT = "selectionHandleImageLeft";
71 const char* const PROPERTY_NAME_SELECTION_HANDLE_IMAGE_RIGHT = "selectionHandleImageRight";
72 const char* const PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_LEFT = "selectionHandlePressedImageLeft";
73 const char* const PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = "selectionHandlePressedImageRight";
74 const char* const PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_LEFT = "selectionHandleMarkerImageLeft";
75 const char* const PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_RIGHT = "selectionHandleMarkerImageRight";
76 const char* const PROPERTY_NAME_SELECTION_HIGHLIGHT_COLOR = "selectionHighlightColor";
77 const char* const PROPERTY_NAME_DECORATION_BOUNDING_BOX = "decorationBoundingBox";
78 const char* const PROPERTY_NAME_ENABLE_MARKUP = "enableMarkup";
79 const char* const PROPERTY_NAME_INPUT_COLOR = "inputColor";
80 const char* const PROPERTY_NAME_INPUT_FONT_FAMILY = "inputFontFamily";
81 const char* const PROPERTY_NAME_INPUT_FONT_STYLE = "inputFontStyle";
82 const char* const PROPERTY_NAME_INPUT_POINT_SIZE = "inputPointSize";
84 const char* const PROPERTY_NAME_LINE_SPACING = "lineSpacing";
85 const char* const PROPERTY_NAME_INPUT_LINE_SPACING = "inputLineSpacing";
86 const char* const PROPERTY_NAME_UNDERLINE = "underline";
87 const char* const PROPERTY_NAME_INPUT_UNDERLINE = "inputUnderline";
88 const char* const PROPERTY_NAME_SHADOW = "shadow";
89 const char* const PROPERTY_NAME_INPUT_SHADOW = "inputShadow";
90 const char* const PROPERTY_NAME_EMBOSS = "emboss";
91 const char* const PROPERTY_NAME_INPUT_EMBOSS = "inputEmboss";
92 const char* const PROPERTY_NAME_OUTLINE = "outline";
93 const char* const PROPERTY_NAME_INPUT_OUTLINE = "inputOutline";
94 const char* const PROPERTY_NAME_STRIKETHROUGH = "strikethrough";
95 const char* const PROPERTY_NAME_INPUT_STRIKETHROUGH = "inputStrikethrough";
97 const char* const PROPERTY_NAME_SMOOTH_SCROLL = "smoothScroll";
98 const char* const PROPERTY_NAME_SMOOTH_SCROLL_DURATION = "smoothScrollDuration";
99 const char* const PROPERTY_NAME_ENABLE_SCROLL_BAR = "enableScrollBar";
100 const char* const PROPERTY_NAME_SCROLL_BAR_SHOW_DURATION = "scrollBarShowDuration";
101 const char* const PROPERTY_NAME_SCROLL_BAR_FADE_DURATION = "scrollBarFadeDuration";
102 const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
103 const char* const PROPERTY_NAME_LINE_COUNT = "lineCount";
104 const char* const PROPERTY_NAME_PLACEHOLDER_TEXT = "placeholderText";
105 const char* const PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR = "placeholderTextColor";
106 const char* const PROPERTY_NAME_ENABLE_SELECTION = "enableSelection";
107 const char* const PROPERTY_NAME_PLACEHOLDER = "placeholder";
108 const char* const PROPERTY_NAME_ENABLE_SHIFT_SELECTION = "enableShiftSelection";
109 const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE = "enableGrabHandle";
110 const char* const PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION = "matchSystemLanguageDirection";
111 const char* const PROPERTY_NAME_MAX_LENGTH = "maxLength";
112 const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
113 const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE = "enableFontSizeScale";
114 const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR = "grabHandleColor";
115 const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP = "enableGrabHandlePopup";
116 const char* const PROPERTY_NAME_INPUT_METHOD_SETTINGS = "inputMethodSettings";
117 const char* const PROPERTY_NAME_INPUT_FILTER = "inputFilter";
119 const Vector4 PLACEHOLDER_TEXT_COLOR(0.8f, 0.8f, 0.8f, 0.8f);
120 const Dali::Vector4 LIGHT_BLUE(0.75f, 0.96f, 1.f, 1.f); // The text highlight color.
122 const float RENDER_FRAME_INTERVAL = 16.66f;
124 const unsigned int DEFAULT_FONT_SIZE = 1152u;
125 const std::string DEFAULT_FONT_DIR("/resources/fonts");
127 const int KEY_A_CODE = 38;
128 const int KEY_D_CODE = 40;
129 const int KEY_C_CODE = 54;
130 const int KEY_V_CODE = 55;
131 const int KEY_X_CODE = 53;
132 const int KEY_WHITE_SPACE_CODE = 65;
134 const int KEY_SHIFT_MODIFIER = 257;
135 const int KEY_CONTROL_MODIFIER = 258;
137 const char* HANDLE_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/insertpoint-icon.png";
138 const char* HANDLE_LEFT_SELECTION_FILE_NAME = TEST_RESOURCE_DIR "/selection_handle_drop_left.png";
139 const char* HANDLE_RIGHT_SELECTION_FILE_NAME = TEST_RESOURCE_DIR "/selection_handle_drop_right.png";
141 const std::string DEFAULT_DEVICE_NAME("hwKeyboard");
143 static bool gSelectionChangedCallbackCalled;
144 static uint32_t oldSelectionStart;
145 static uint32_t oldSelectionEnd;
146 static bool gSelectionClearedCallbackCalled;
147 static bool gSelectionStartedCallbackCalled;
148 static bool gAnchorClickedCallBackCalled;
149 static bool gAnchorClickedCallBackNotCalled;
150 static bool gTextChangedCallBackCalled;
151 static bool gInputFilteredAcceptedCallbackCalled;
152 static bool gInputFilteredRejectedCallbackCalled;
153 static bool gInputStyleChangedCallbackCalled;
154 static bool gMaxCharactersCallBackCalled;
155 static bool gCursorPositionChangedCallbackCalled;
156 static uint32_t oldCursorPos;
157 static Dali::Toolkit::TextEditor::InputStyle::Mask gInputStyleMask;
159 struct CallbackFunctor
161 CallbackFunctor(bool* callbackFlag)
162 : mCallbackFlag(callbackFlag)
168 *mCallbackFlag = true;
173 static void TestSelectionStartedCallback(TextEditor control)
175 tet_infoline(" TestSelectionStartedCallback");
177 gSelectionStartedCallbackCalled = true;
180 static void TestSelectionClearedCallback(TextEditor control)
182 tet_infoline(" TestSelectionClearedCallback");
184 gSelectionClearedCallbackCalled = true;
187 static void TestSelectionChangedCallback(TextEditor control, uint32_t oldStart, uint32_t oldEnd)
189 tet_infoline(" TestSelectionChangedCallback");
191 gSelectionChangedCallbackCalled = true;
192 oldSelectionStart = oldStart;
193 oldSelectionEnd = oldEnd;
196 static void TestAnchorClickedCallback(TextEditor control, const char* href, unsigned int hrefLength)
198 tet_infoline(" TestAnchorClickedCallback");
200 gAnchorClickedCallBackNotCalled = false;
202 if(!strcmp(href, "https://www.tizen.org") && hrefLength == strlen(href))
204 gAnchorClickedCallBackCalled = true;
208 static void TestCursorPositionChangedCallback(TextEditor control, unsigned int oldPos)
210 tet_infoline(" TestCursorPositionChangedCallback");
212 gCursorPositionChangedCallbackCalled = true;
213 oldCursorPos = oldPos;
216 static void TestTextChangedCallback(TextEditor control)
218 tet_infoline(" TestTextChangedCallback");
220 gTextChangedCallBackCalled = true;
223 static void TestInputStyleChangedCallback(TextEditor control, TextEditor::InputStyle::Mask mask)
225 tet_infoline(" TestInputStyleChangedCallback");
227 gInputStyleChangedCallbackCalled = true;
228 gInputStyleMask = mask;
231 static void TestMaxLengthReachedCallback(TextEditor control)
233 tet_infoline(" TestMaxLengthReachedCallback");
235 gMaxCharactersCallBackCalled = true;
238 static void TestInputFilteredCallback(TextEditor control, Toolkit::InputFilter::Property::Type type)
240 tet_infoline(" TestInputFilteredCallback");
242 if(type == Toolkit::InputFilter::Property::ACCEPTED)
244 gInputFilteredAcceptedCallbackCalled = true;
246 else if(type == Toolkit::InputFilter::Property::REJECTED)
248 gInputFilteredRejectedCallbackCalled = true;
252 // Generate a KeyEvent to send to Core.
253 Integration::KeyEvent GenerateKey(const std::string& keyName,
254 const std::string& logicalKey,
255 const std::string& keyString,
258 unsigned long timeStamp,
259 const Integration::KeyEvent::State& keyState,
260 const std::string& compose = "",
261 const std::string& deviceName = DEFAULT_DEVICE_NAME,
262 const Device::Class::Type& deviceClass = Device::Class::NONE,
263 const Device::Subclass::Type& deviceSubclass = Device::Subclass::NONE)
265 return Integration::KeyEvent(keyName,
278 Dali::Integration::Point GetPointDownInside(Vector2& pos)
280 Dali::Integration::Point point;
281 point.SetState(PointState::DOWN);
282 point.SetScreenPosition(pos);
286 Dali::Integration::Point GetPointUpInside(Vector2& pos)
288 Dali::Integration::Point point;
289 point.SetState(PointState::UP);
290 point.SetScreenPosition(pos);
294 bool DaliTestCheckMaps(const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet)
296 if(fontStyleMapGet.Count() == fontStyleMapSet.Count())
298 for(unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index)
300 const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue(index);
302 Property::Value* valueSet = NULL;
303 if(valueGet.first.type == Property::Key::INDEX)
305 valueSet = fontStyleMapSet.Find(valueGet.first.indexKey);
309 // Get Key is a string so searching Set Map for a string key
310 valueSet = fontStyleMapSet.Find(valueGet.first.stringKey);
315 if(valueSet->GetType() == Dali::Property::STRING && (valueGet.second.Get<std::string>() != valueSet->Get<std::string>()))
317 tet_printf("Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str());
320 else if(valueSet->GetType() == Dali::Property::BOOLEAN && (valueGet.second.Get<bool>() != valueSet->Get<bool>()))
322 tet_printf("Value got : [%d], expected : [%d]", valueGet.second.Get<bool>(), valueSet->Get<bool>());
325 else if(valueSet->GetType() == Dali::Property::INTEGER && (valueGet.second.Get<int>() != valueSet->Get<int>()))
327 tet_printf("Value got : [%d], expected : [%d]", valueGet.second.Get<int>(), valueSet->Get<int>());
330 else if(valueSet->GetType() == Dali::Property::FLOAT && (valueGet.second.Get<float>() != valueSet->Get<float>()))
332 tet_printf("Value got : [%f], expected : [%f]", valueGet.second.Get<float>(), valueSet->Get<float>());
335 else if(valueSet->GetType() == Dali::Property::VECTOR2 && (valueGet.second.Get<Vector2>() != valueSet->Get<Vector2>()))
337 Vector2 vector2Get = valueGet.second.Get<Vector2>();
338 Vector2 vector2Set = valueSet->Get<Vector2>();
339 tet_printf("Value got : [%f, %f], expected : [%f, %f]", vector2Get.x, vector2Get.y, vector2Set.x, vector2Set.y);
342 else if(valueSet->GetType() == Dali::Property::VECTOR4 && (valueGet.second.Get<Vector4>() != valueSet->Get<Vector4>()))
344 Vector4 vector4Get = valueGet.second.Get<Vector4>();
345 Vector4 vector4Set = valueSet->Get<Vector4>();
346 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);
352 if(valueGet.first.type == Property::Key::INDEX)
354 tet_printf(" The key %d doesn't exist.", valueGet.first.indexKey);
358 tet_printf(" The key %s doesn't exist.", valueGet.first.stringKey.c_str());
368 class ScrollStateChangeCallback : public Dali::ConnectionTracker
371 ScrollStateChangeCallback(bool& startedCalled, bool& finishedCalled)
372 : mStartedCalled(startedCalled),
373 mFinishedCalled(finishedCalled)
377 void Callback(TextEditor editor, TextEditor::Scroll::Type type)
379 if(type == TextEditor::Scroll::STARTED)
381 mStartedCalled = true;
383 else if(type == TextEditor::Scroll::FINISHED)
385 mFinishedCalled = true;
389 bool& mStartedCalled;
390 bool& mFinishedCalled;
395 int UtcDaliToolkitTextEditorConstructorP(void)
397 ToolkitTestApplication application;
398 tet_infoline(" UtcDaliToolkitTextEditorConstructorP");
399 TextEditor textEditor;
400 DALI_TEST_CHECK(!textEditor);
404 int UtcDaliToolkitTextEditorNewP(void)
406 ToolkitTestApplication application;
407 tet_infoline(" UtcDaliToolkitTextEditorNewP");
408 TextEditor textEditor = TextEditor::New();
409 DALI_TEST_CHECK(textEditor);
413 int UtcDaliToolkitTextEditorDownCastP(void)
415 ToolkitTestApplication application;
416 tet_infoline(" UtcDaliToolkitTextEditorDownCastP");
417 TextEditor textEditor1 = TextEditor::New();
418 BaseHandle object(textEditor1);
420 TextEditor textEditor2 = TextEditor::DownCast(object);
421 DALI_TEST_CHECK(textEditor2);
423 TextEditor textEditor3 = DownCast<TextEditor>(object);
424 DALI_TEST_CHECK(textEditor3);
428 int UtcDaliToolkitTextEditorDownCastN(void)
430 ToolkitTestApplication application;
431 tet_infoline(" UtcDaliToolkitTextEditorDownCastN");
432 BaseHandle uninitializedObject;
433 TextEditor textEditor1 = TextEditor::DownCast(uninitializedObject);
434 DALI_TEST_CHECK(!textEditor1);
436 TextEditor textEditor2 = DownCast<TextEditor>(uninitializedObject);
437 DALI_TEST_CHECK(!textEditor2);
441 int UtcDaliToolkitTextEditorCopyConstructorP(void)
443 ToolkitTestApplication application;
444 tet_infoline(" UtcDaliToolkitTextEditorCopyConstructorP");
445 TextEditor textEditor = TextEditor::New();
446 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
448 TextEditor copy(textEditor);
449 DALI_TEST_CHECK(copy);
450 DALI_TEST_CHECK(copy.GetProperty<std::string>(TextEditor::Property::TEXT) == textEditor.GetProperty<std::string>(TextEditor::Property::TEXT));
454 int UtcDaliTextEditorMoveConstructor(void)
456 ToolkitTestApplication application;
458 TextEditor textEditor = TextEditor::New();
459 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
460 DALI_TEST_CHECK(textEditor.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
462 TextEditor moved = std::move(textEditor);
463 DALI_TEST_CHECK(moved);
464 DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
465 DALI_TEST_CHECK(moved.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
466 DALI_TEST_CHECK(!textEditor);
471 int UtcDaliToolkitTextEditorAssignmentOperatorP(void)
473 ToolkitTestApplication application;
474 tet_infoline(" UtcDaliToolkitTextEditorAssignmentOperatorP");
475 TextEditor textEditor = TextEditor::New();
476 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
478 TextEditor copy = textEditor;
479 DALI_TEST_CHECK(copy);
480 DALI_TEST_CHECK(copy.GetProperty<std::string>(TextEditor::Property::TEXT) == textEditor.GetProperty<std::string>(TextEditor::Property::TEXT));
484 int UtcDaliTextEditorMoveAssignment(void)
486 ToolkitTestApplication application;
488 TextEditor textEditor = TextEditor::New();
489 textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
490 DALI_TEST_CHECK(textEditor.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
493 moved = std::move(textEditor);
494 DALI_TEST_CHECK(moved);
495 DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
496 DALI_TEST_CHECK(moved.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
497 DALI_TEST_CHECK(!textEditor);
502 int UtcDaliTextEditorNewP(void)
504 ToolkitTestApplication application;
505 tet_infoline(" UtcDaliToolkitTextEditorNewP");
506 TextEditor textEditor = TextEditor::New();
507 DALI_TEST_CHECK(textEditor);
511 // Positive test case for a method
512 int UtcDaliTextEditorGetPropertyP(void)
514 ToolkitTestApplication application;
515 tet_infoline(" UtcDaliToolkitTextEditorGetPropertyP");
516 TextEditor editor = TextEditor::New();
517 DALI_TEST_CHECK(editor);
519 // Check Property Indices are correct
520 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_RENDERING_BACKEND) == DevelTextEditor::Property::RENDERING_BACKEND);
521 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_TEXT) == TextEditor::Property::TEXT);
522 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_TEXT_COLOR) == TextEditor::Property::TEXT_COLOR);
523 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_FONT_FAMILY) == TextEditor::Property::FONT_FAMILY);
524 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_FONT_STYLE) == TextEditor::Property::FONT_STYLE);
525 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_POINT_SIZE) == TextEditor::Property::POINT_SIZE);
526 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_HORIZONTAL_ALIGNMENT) == TextEditor::Property::HORIZONTAL_ALIGNMENT);
527 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_THRESHOLD) == TextEditor::Property::SCROLL_THRESHOLD);
528 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_SPEED) == TextEditor::Property::SCROLL_SPEED);
529 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PRIMARY_CURSOR_COLOR) == TextEditor::Property::PRIMARY_CURSOR_COLOR);
530 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SECONDARY_CURSOR_COLOR) == TextEditor::Property::SECONDARY_CURSOR_COLOR);
531 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_CURSOR_BLINK) == TextEditor::Property::ENABLE_CURSOR_BLINK);
532 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_CURSOR_BLINK_INTERVAL) == TextEditor::Property::CURSOR_BLINK_INTERVAL);
533 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_CURSOR_BLINK_DURATION) == TextEditor::Property::CURSOR_BLINK_DURATION);
534 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_CURSOR_WIDTH) == TextEditor::Property::CURSOR_WIDTH);
535 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_GRAB_HANDLE_IMAGE) == TextEditor::Property::GRAB_HANDLE_IMAGE);
536 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_GRAB_HANDLE_PRESSED_IMAGE) == TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE);
537 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_IMAGE_LEFT) == TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT);
538 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_IMAGE_RIGHT) == TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT);
539 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_LEFT) == TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT);
540 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT) == TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT);
541 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_LEFT) == TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT);
542 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_RIGHT) == TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT);
543 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HIGHLIGHT_COLOR) == TextEditor::Property::SELECTION_HIGHLIGHT_COLOR);
544 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_DECORATION_BOUNDING_BOX) == TextEditor::Property::DECORATION_BOUNDING_BOX);
545 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_MARKUP) == TextEditor::Property::ENABLE_MARKUP);
546 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_COLOR) == TextEditor::Property::INPUT_COLOR);
547 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_FONT_FAMILY) == TextEditor::Property::INPUT_FONT_FAMILY);
548 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_FONT_STYLE) == TextEditor::Property::INPUT_FONT_STYLE);
549 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_POINT_SIZE) == TextEditor::Property::INPUT_POINT_SIZE);
551 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_LINE_SPACING) == TextEditor::Property::LINE_SPACING);
552 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_LINE_SPACING) == TextEditor::Property::INPUT_LINE_SPACING);
553 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_UNDERLINE) == TextEditor::Property::UNDERLINE);
554 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_UNDERLINE) == TextEditor::Property::INPUT_UNDERLINE);
555 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SHADOW) == TextEditor::Property::SHADOW);
556 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_SHADOW) == TextEditor::Property::INPUT_SHADOW);
557 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_EMBOSS) == TextEditor::Property::EMBOSS);
558 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_EMBOSS) == TextEditor::Property::INPUT_EMBOSS);
559 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_OUTLINE) == TextEditor::Property::OUTLINE);
560 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_OUTLINE) == TextEditor::Property::INPUT_OUTLINE);
561 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextEditor::Property::STRIKETHROUGH);
562 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_STRIKETHROUGH) == DevelTextEditor::Property::INPUT_STRIKETHROUGH);
563 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SMOOTH_SCROLL) == TextEditor::Property::SMOOTH_SCROLL);
564 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SMOOTH_SCROLL_DURATION) == TextEditor::Property::SMOOTH_SCROLL_DURATION);
565 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_SCROLL_BAR) == TextEditor::Property::ENABLE_SCROLL_BAR);
566 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_BAR_SHOW_DURATION) == TextEditor::Property::SCROLL_BAR_SHOW_DURATION);
567 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_BAR_FADE_DURATION) == TextEditor::Property::SCROLL_BAR_FADE_DURATION);
568 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PIXEL_SIZE) == TextEditor::Property::PIXEL_SIZE);
569 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_LINE_COUNT) == TextEditor::Property::LINE_COUNT);
570 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_SELECTION) == TextEditor::Property::ENABLE_SELECTION);
571 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PLACEHOLDER) == TextEditor::Property::PLACEHOLDER);
572 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_FONT_SIZE_SCALE) == DevelTextEditor::Property::FONT_SIZE_SCALE);
573 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE) == DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE);
574 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PLACEHOLDER_TEXT) == DevelTextEditor::Property::PLACEHOLDER_TEXT);
575 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR) == DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR);
576 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_SHIFT_SELECTION) == DevelTextEditor::Property::ENABLE_SHIFT_SELECTION);
577 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_GRAB_HANDLE) == DevelTextEditor::Property::ENABLE_GRAB_HANDLE);
578 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION) == DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION);
579 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_MAX_LENGTH) == DevelTextEditor::Property::MAX_LENGTH);
580 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_GRAB_HANDLE_COLOR) == DevelTextEditor::Property::GRAB_HANDLE_COLOR);
581 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP) == DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP);
582 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_METHOD_SETTINGS) == DevelTextEditor::Property::INPUT_METHOD_SETTINGS);
583 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_FILTER) == DevelTextEditor::Property::INPUT_FILTER);
584 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextEditor::Property::STRIKETHROUGH);
585 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_STRIKETHROUGH) == DevelTextEditor::Property::INPUT_STRIKETHROUGH);
586 DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_POPUP_STYLE) == DevelTextEditor::Property::SELECTION_POPUP_STYLE);
591 bool SetPropertyMapRetrieved(TextEditor& editor, const Property::Index property, const std::string mapKey, const std::string mapValue)
594 Property::Map imageMap;
595 imageMap[mapKey] = mapValue;
597 editor.SetProperty(property, imageMap);
598 Property::Value propValue = editor.GetProperty(property);
599 Property::Map* resultMap = propValue.GetMap();
601 if(resultMap->Find(mapKey)->Get<std::string>() == mapValue)
609 // Positive test case for a method
610 int UtcDaliTextEditorSetPropertyP(void)
612 ToolkitTestApplication application;
613 tet_infoline(" UtcDaliToolkitTextEditorSetPropertyP");
614 TextEditor editor = TextEditor::New();
615 DALI_TEST_CHECK(editor);
616 application.GetScene().Add(editor);
618 // Note - we can't check the defaults since the stylesheets are platform-specific
620 // Check the render backend property.
621 editor.SetProperty(DevelTextEditor::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS);
622 DALI_TEST_EQUALS((DevelText::RenderingType)editor.GetProperty<int>(DevelTextEditor::Property::RENDERING_BACKEND), DevelText::RENDERING_SHARED_ATLAS, TEST_LOCATION);
624 // Check text property.
625 editor.SetProperty(TextEditor::Property::TEXT, "Setting Text");
626 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("Setting Text"), TEST_LOCATION);
628 // Check text's color property
629 editor.SetProperty(TextEditor::Property::TEXT_COLOR, Color::WHITE);
630 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::TEXT_COLOR), Color::WHITE, TEST_LOCATION);
632 // Check font properties.
633 editor.SetProperty(TextEditor::Property::FONT_FAMILY, "Setting font family");
634 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::FONT_FAMILY), std::string("Setting font family"), TEST_LOCATION);
636 Property::Map fontStyleMapSet;
637 Property::Map fontStyleMapGet;
638 Property::Value* slantValue = NULL;
640 fontStyleMapSet.Insert("weight", "bold");
641 fontStyleMapSet.Insert("width", "condensed");
642 fontStyleMapSet.Insert("slant", "italic");
644 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
645 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
646 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
647 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
649 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
650 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::POINT_SIZE), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
652 editor.SetProperty(DevelTextEditor::Property::FONT_SIZE_SCALE, 2.5f);
653 DALI_TEST_EQUALS(editor.GetProperty<float>(DevelTextEditor::Property::FONT_SIZE_SCALE), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
654 editor.SetProperty(DevelTextEditor::Property::FONT_SIZE_SCALE, 1.0f);
656 editor.SetProperty(DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, false);
657 DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE), false, TEST_LOCATION);
658 editor.SetProperty(DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, true);
661 fontStyleMapSet.Clear();
662 fontStyleMapSet.Insert("weight", "normal");
663 fontStyleMapSet.Insert("slant", "oblique");
664 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
665 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
666 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
667 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
669 fontStyleMapSet.Clear();
670 fontStyleMapSet.Insert("slant", "roman");
671 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
672 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
674 // Replace 'roman' for 'normal'.
675 slantValue = fontStyleMapGet.Find("slant");
676 if(NULL != slantValue)
678 if("normal" == slantValue->Get<std::string>())
680 fontStyleMapGet["slant"] = "roman";
683 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
684 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
686 fontStyleMapSet.Clear();
688 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
689 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
690 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
691 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
693 // Check that the Alignment properties can be correctly set
694 editor.SetProperty(TextEditor::Property::HORIZONTAL_ALIGNMENT, "END");
695 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::HORIZONTAL_ALIGNMENT), "END", TEST_LOCATION);
697 // Check that the Alignment properties can be correctly set
698 editor.SetProperty(DevelTextEditor::Property::VERTICAL_ALIGNMENT, "BOTTOM");
699 DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::VERTICAL_ALIGNMENT), "BOTTOM", TEST_LOCATION);
700 editor.SetProperty(DevelTextEditor::Property::VERTICAL_ALIGNMENT, "CENTER");
701 DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::VERTICAL_ALIGNMENT), "CENTER", TEST_LOCATION);
702 editor.SetProperty(DevelTextEditor::Property::VERTICAL_ALIGNMENT, "TOP");
703 DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::VERTICAL_ALIGNMENT), "TOP", TEST_LOCATION);
705 // Check scroll properties.
706 editor.SetProperty(TextEditor::Property::SCROLL_THRESHOLD, 1.f);
707 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_THRESHOLD), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
708 editor.SetProperty(TextEditor::Property::SCROLL_SPEED, 100.f);
709 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_SPEED), 100.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
711 // Check cursor properties
712 editor.SetProperty(TextEditor::Property::PRIMARY_CURSOR_COLOR, Color::RED);
713 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::PRIMARY_CURSOR_COLOR), Color::RED, TEST_LOCATION);
714 editor.SetProperty(TextEditor::Property::SECONDARY_CURSOR_COLOR, Color::BLUE);
715 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::SECONDARY_CURSOR_COLOR), Color::BLUE, TEST_LOCATION);
717 editor.SetProperty(TextEditor::Property::ENABLE_CURSOR_BLINK, false);
718 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_CURSOR_BLINK), false, TEST_LOCATION);
719 editor.SetProperty(TextEditor::Property::CURSOR_BLINK_INTERVAL, 1.f);
720 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::CURSOR_BLINK_INTERVAL), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
721 editor.SetProperty(TextEditor::Property::CURSOR_BLINK_DURATION, 10.f);
722 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::CURSOR_BLINK_DURATION), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
723 editor.SetProperty(TextEditor::Property::CURSOR_WIDTH, 1);
724 DALI_TEST_EQUALS(editor.GetProperty<int>(TextEditor::Property::CURSOR_WIDTH), 1, TEST_LOCATION);
726 // Check handle images
727 editor.SetProperty(TextEditor::Property::GRAB_HANDLE_IMAGE, "image1");
728 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::GRAB_HANDLE_IMAGE), "image1", TEST_LOCATION);
729 editor.SetProperty(TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE, "image2");
730 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE), "image2", TEST_LOCATION);
731 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, "image3");
733 // Check handle images
734 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, "filename", "leftHandleImage"));
735 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT, "filename", "rightHandleImage"));
736 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT, "filename", "leftHandleImagePressed"));
737 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, "filename", "rightHandleImagePressed"));
738 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT, "filename", "leftHandleMarkerImage"));
739 DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT, "filename", "rightHandleMarkerImage"));
741 // Check the selection popup style
742 const Vector2 popupMaxSize(200.0f, 300.0f);
743 const Vector2 optionDividerSize(30.0f, 5.0f);
744 const Vector4 optionDividerPadding(20.0f, 20.0f, 10.0f, 10.0f);
745 const Vector4 labelPadding(5.0f, 5.0f, 50.0f, 25.0f);
747 Property::Map selectionPopupStyle;
748 selectionPopupStyle.Insert(TextSelectionPopup::Property::POPUP_MAX_SIZE, popupMaxSize);
749 selectionPopupStyle.Insert(TextSelectionPopup::Property::OPTION_DIVIDER_SIZE, optionDividerSize);
750 selectionPopupStyle.Insert(TextSelectionPopup::Property::OPTION_DIVIDER_PADDING, optionDividerPadding);
751 selectionPopupStyle.Insert(TextSelectionPopup::Property::LABEL_PADDING, labelPadding);
753 editor.SetProperty(DevelTextEditor::Property::SELECTION_POPUP_STYLE, selectionPopupStyle);
755 Property::Map selectionPopupStyleGet;
756 selectionPopupStyleGet = editor.GetProperty<Property::Map>(DevelTextEditor::Property::SELECTION_POPUP_STYLE);
758 Property::Value* popupValue;
759 popupValue = selectionPopupStyleGet.Find(TextSelectionPopup::Property::POPUP_MAX_SIZE);
760 DALI_TEST_CHECK(NULL != popupValue);
763 Vector2 popupMaxSizeGet;
764 popupValue->Get(popupMaxSizeGet);
765 DALI_TEST_EQUALS(popupMaxSizeGet, popupMaxSize, TEST_LOCATION);
768 popupValue = selectionPopupStyleGet.Find(TextSelectionPopup::Property::OPTION_DIVIDER_SIZE);
769 DALI_TEST_CHECK(NULL != popupValue);
772 Vector2 optionDividerSizeGet;
773 popupValue->Get(optionDividerSizeGet);
774 DALI_TEST_EQUALS(optionDividerSizeGet, optionDividerSize, TEST_LOCATION);
777 popupValue = selectionPopupStyleGet.Find(TextSelectionPopup::Property::OPTION_DIVIDER_PADDING);
778 DALI_TEST_CHECK(NULL != popupValue);
781 Vector4 optionDividerPaddingGet;
782 popupValue->Get(optionDividerPaddingGet);
783 DALI_TEST_EQUALS(optionDividerPaddingGet, optionDividerPadding, TEST_LOCATION);
786 popupValue = selectionPopupStyleGet.Find(TextSelectionPopup::Property::LABEL_PADDING);
787 DALI_TEST_CHECK(NULL != popupValue);
790 Vector4 labelPaddingGet;
791 popupValue->Get(labelPaddingGet);
792 DALI_TEST_EQUALS(labelPaddingGet, labelPadding, TEST_LOCATION);
795 // Reset selection popup style
796 selectionPopupStyle.Clear();
797 editor.SetProperty(DevelTextEditor::Property::SELECTION_POPUP_STYLE, selectionPopupStyle);
799 // Check the highlight color
800 editor.SetProperty(TextEditor::Property::SELECTION_HIGHLIGHT_COLOR, Color::GREEN);
801 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::SELECTION_HIGHLIGHT_COLOR), Color::GREEN, TEST_LOCATION);
803 // Decoration bounding box
804 editor.SetProperty(TextEditor::Property::DECORATION_BOUNDING_BOX, Rect<int>(0, 0, 1, 1));
805 DALI_TEST_EQUALS(editor.GetProperty<Rect<int> >(TextEditor::Property::DECORATION_BOUNDING_BOX), Rect<int>(0, 0, 1, 1), TEST_LOCATION);
807 // Check the enable markup property.
808 DALI_TEST_CHECK(!editor.GetProperty<bool>(TextEditor::Property::ENABLE_MARKUP));
809 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
810 DALI_TEST_CHECK(editor.GetProperty<bool>(TextEditor::Property::ENABLE_MARKUP));
812 // Check input color property.
813 editor.SetProperty(TextEditor::Property::INPUT_COLOR, Color::YELLOW);
814 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::INPUT_COLOR), Color::YELLOW, TEST_LOCATION);
816 // Check input font properties.
817 editor.SetProperty(TextEditor::Property::INPUT_FONT_FAMILY, "Setting input font family");
818 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_FONT_FAMILY), "Setting input font family", TEST_LOCATION);
820 fontStyleMapSet.Clear();
821 fontStyleMapSet.Insert("weight", "bold");
822 fontStyleMapSet.Insert("width", "condensed");
823 fontStyleMapSet.Insert("slant", "italic");
825 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
826 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
827 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
828 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
830 editor.SetProperty(TextEditor::Property::INPUT_POINT_SIZE, 12.f);
831 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::INPUT_POINT_SIZE), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
833 // Reset input font style.
834 fontStyleMapSet.Clear();
835 fontStyleMapSet.Insert("weight", "normal");
836 fontStyleMapSet.Insert("slant", "oblique");
838 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
839 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
840 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
841 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
843 fontStyleMapSet.Clear();
844 fontStyleMapSet.Insert("slant", "roman");
846 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
847 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
849 // Replace 'roman' for 'normal'.
850 slantValue = fontStyleMapGet.Find("slant");
851 if(NULL != slantValue)
853 if("normal" == slantValue->Get<std::string>())
855 fontStyleMapGet["slant"] = "roman";
858 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
859 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
861 fontStyleMapSet.Clear();
863 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
864 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
865 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
866 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
868 // Check the line spacing property
869 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::LINE_SPACING), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
870 editor.SetProperty(TextEditor::Property::LINE_SPACING, 10.f);
871 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::LINE_SPACING), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
873 // Check the input line spacing property
874 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::INPUT_LINE_SPACING), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
875 editor.SetProperty(TextEditor::Property::INPUT_LINE_SPACING, 20.f);
876 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::INPUT_LINE_SPACING), 20.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
878 // Check the underline property
880 Property::Map underlineMapSet;
881 Property::Map underlineMapGet;
883 underlineMapSet.Insert("enable", true);
884 underlineMapSet.Insert("color", Color::RED);
885 underlineMapSet.Insert("height", 1);
886 underlineMapSet.Insert("type", Text::Underline::SOLID);
887 underlineMapSet.Insert("dashWidth", 5);
888 underlineMapSet.Insert("dashGap", 3);
890 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
892 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
893 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
894 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
896 application.SendNotification();
897 application.Render();
899 // Check the dashed underline property
901 underlineMapSet.Clear();
902 underlineMapGet.Clear();
904 underlineMapSet.Insert("enable", true);
905 underlineMapSet.Insert("color", Color::RED);
906 underlineMapSet.Insert("height", 1);
907 underlineMapSet.Insert("type", Text::Underline::DASHED);
908 underlineMapSet.Insert("dashWidth", 5);
909 underlineMapSet.Insert("dashGap", 3);
911 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
913 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
914 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
915 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
917 application.SendNotification();
918 application.Render();
920 underlineMapSet.Clear();
921 underlineMapGet.Clear();
923 // Check the double underline property
925 underlineMapSet.Clear();
926 underlineMapGet.Clear();
928 underlineMapSet.Insert("enable", true);
929 underlineMapSet.Insert("color", Color::RED);
930 underlineMapSet.Insert("height", 1);
931 underlineMapSet.Insert("type", Text::Underline::DOUBLE);
932 underlineMapSet.Insert("dashWidth", 5);
933 underlineMapSet.Insert("dashGap", 3);
935 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
937 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
938 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
939 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
941 application.SendNotification();
942 application.Render();
944 underlineMapSet.Clear();
945 underlineMapGet.Clear();
947 // Check the input underline property
948 editor.SetProperty(TextEditor::Property::INPUT_UNDERLINE, "Underline input properties");
949 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_UNDERLINE), std::string("Underline input properties"), TEST_LOCATION);
951 // Check the shadow property
952 Property::Map shadowMapSet;
953 Property::Map shadowMapGet;
955 shadowMapSet.Insert("color", Color::GREEN);
956 shadowMapSet.Insert("offset", Vector2(2.0f, 2.0f));
957 shadowMapSet.Insert("blurRadius", 3.0f);
959 editor.SetProperty(TextEditor::Property::SHADOW, shadowMapSet);
961 shadowMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::SHADOW);
962 DALI_TEST_EQUALS(shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION);
963 DALI_TEST_EQUALS(DaliTestCheckMaps(shadowMapGet, shadowMapSet), true, TEST_LOCATION);
965 // Check the input shadow property
966 editor.SetProperty(TextEditor::Property::INPUT_SHADOW, "Shadow input properties");
967 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_SHADOW), std::string("Shadow input properties"), TEST_LOCATION);
969 // Check the emboss property
970 editor.SetProperty(TextEditor::Property::EMBOSS, "Emboss properties");
971 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::EMBOSS), std::string("Emboss properties"), TEST_LOCATION);
973 // Check the input emboss property
974 editor.SetProperty(TextEditor::Property::INPUT_EMBOSS, "Emboss input properties");
975 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_EMBOSS), std::string("Emboss input properties"), TEST_LOCATION);
977 // Check the outline property
979 // Test string type first
980 // This is purely to maintain backward compatibility, but we don't support string as the outline property type.
981 editor.SetProperty(TextEditor::Property::OUTLINE, "Outline properties");
982 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::OUTLINE), std::string("Outline properties"), TEST_LOCATION);
984 // Then test the property map type
985 Property::Map outlineMapSet;
986 Property::Map outlineMapGet;
988 outlineMapSet["color"] = Color::RED;
989 outlineMapSet["width"] = 2.0f;
991 editor.SetProperty(TextEditor::Property::OUTLINE, outlineMapSet);
993 outlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::OUTLINE);
994 DALI_TEST_EQUALS(outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION);
995 DALI_TEST_EQUALS(DaliTestCheckMaps(outlineMapGet, outlineMapSet), true, TEST_LOCATION);
997 // Check the input outline property
998 editor.SetProperty(TextEditor::Property::INPUT_OUTLINE, "Outline input properties");
999 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_OUTLINE), std::string("Outline input properties"), TEST_LOCATION);
1001 // Check the smooth scroll property
1002 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::SMOOTH_SCROLL), false, TEST_LOCATION);
1003 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL, true);
1004 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::SMOOTH_SCROLL), true, TEST_LOCATION);
1006 // Check the smooth scroll duration property
1007 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.2f);
1008 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SMOOTH_SCROLL_DURATION), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1010 // Check the scroll bar property
1011 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SCROLL_BAR), false, TEST_LOCATION);
1012 editor.SetProperty(TextEditor::Property::ENABLE_SCROLL_BAR, true);
1013 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SCROLL_BAR), true, TEST_LOCATION);
1015 editor.SetProperty(TextEditor::Property::SCROLL_BAR_SHOW_DURATION, 0.3f);
1016 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_SHOW_DURATION), 0.3f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1017 editor.SetProperty(TextEditor::Property::SCROLL_BAR_FADE_DURATION, 0.2f);
1018 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_FADE_DURATION), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1020 // Check the pixel size of font
1021 editor.SetProperty(TextEditor::Property::PIXEL_SIZE, 20.f);
1022 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::PIXEL_SIZE), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1024 // Check placeholder text properties.
1025 editor.SetProperty(DevelTextEditor::Property::PLACEHOLDER_TEXT, "Setting Placeholder Text");
1026 DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::PLACEHOLDER_TEXT), std::string("Setting Placeholder Text"), TEST_LOCATION);
1028 // Check placeholder text's color property.
1029 editor.SetProperty(DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR, Color::RED);
1030 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR), Color::RED, TEST_LOCATION);
1032 // Check the enable selection property
1033 editor.SetProperty(TextEditor::Property::ENABLE_SELECTION, false);
1034 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SELECTION), false, TEST_LOCATION);
1036 // Check the placeholder property with pixel size
1037 Property::Map placeholderPixelSizeMapSet;
1038 Property::Map placeholderPixelSizeMapGet;
1039 Property::Map placeholderFontstyleMap;
1040 placeholderPixelSizeMapSet["text"] = "Setting Placeholder Text";
1041 placeholderPixelSizeMapSet["textFocused"] = "Setting Placeholder Text Focused";
1042 placeholderPixelSizeMapSet["color"] = Color::BLUE;
1043 placeholderPixelSizeMapSet["fontFamily"] = "Arial";
1044 placeholderPixelSizeMapSet["pixelSize"] = 15.0f;
1046 placeholderFontstyleMap.Insert("weight", "bold");
1047 placeholderPixelSizeMapSet["fontStyle"] = placeholderFontstyleMap;
1048 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderPixelSizeMapSet);
1050 placeholderPixelSizeMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1051 DALI_TEST_EQUALS(placeholderPixelSizeMapGet.Count(), placeholderPixelSizeMapSet.Count(), TEST_LOCATION);
1053 tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value");
1054 Property::Map placeholderConversionMap;
1055 placeholderConversionMap[Text::PlaceHolder::Property::TEXT] = placeholderPixelSizeMapSet["text"];
1056 placeholderConversionMap[Text::PlaceHolder::Property::TEXT_FOCUSED] = placeholderPixelSizeMapSet["textFocused"];
1057 placeholderConversionMap[Text::PlaceHolder::Property::COLOR] = placeholderPixelSizeMapSet["color"];
1058 placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderPixelSizeMapSet["fontStyle"];
1059 placeholderConversionMap[Text::PlaceHolder::Property::FONT_FAMILY] = placeholderPixelSizeMapSet["fontFamily"];
1060 placeholderConversionMap[Text::PlaceHolder::Property::PIXEL_SIZE] = placeholderPixelSizeMapSet["pixelSize"];
1062 DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderPixelSizeMapGet, placeholderConversionMap), true, TEST_LOCATION);
1064 // Check the placeholder property with point size
1065 Property::Map placeholderMapSet;
1066 Property::Map placeholderMapGet;
1067 placeholderMapSet["text"] = "Setting Placeholder Text";
1068 placeholderMapSet["textFocused"] = "Setting Placeholder Text Focused";
1069 placeholderMapSet["color"] = Color::RED;
1070 placeholderMapSet["fontFamily"] = "Arial";
1071 placeholderMapSet["pointSize"] = 12.0f;
1072 // Check the placeholder font style property
1073 placeholderFontstyleMap.Clear();
1075 placeholderFontstyleMap.Insert("weight", "bold");
1076 placeholderFontstyleMap.Insert("width", "condensed");
1077 placeholderFontstyleMap.Insert("slant", "italic");
1078 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1079 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1081 placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1082 DALI_TEST_EQUALS(placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION);
1084 tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value");
1085 placeholderConversionMap.Clear();
1086 placeholderConversionMap[Text::PlaceHolder::Property::TEXT] = placeholderMapSet["text"];
1087 placeholderConversionMap[Text::PlaceHolder::Property::TEXT_FOCUSED] = placeholderMapSet["textFocused"];
1088 placeholderConversionMap[Text::PlaceHolder::Property::COLOR] = placeholderMapSet["color"];
1089 placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderPixelSizeMapSet["fontStyle"];
1090 placeholderConversionMap[Text::PlaceHolder::Property::FONT_FAMILY] = placeholderMapSet["fontFamily"];
1091 placeholderConversionMap[Text::PlaceHolder::Property::POINT_SIZE] = placeholderMapSet["pointSize"];
1092 DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderMapGet, placeholderConversionMap), true, TEST_LOCATION);
1094 // Reset font style.
1095 placeholderFontstyleMap.Clear();
1096 placeholderFontstyleMap.Insert("weight", "normal");
1097 placeholderFontstyleMap.Insert("slant", "oblique");
1098 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1099 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1101 placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1102 DALI_TEST_EQUALS(placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION);
1103 placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderMapSet["fontStyle"];
1104 DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderMapGet, placeholderConversionMap), true, TEST_LOCATION);
1106 placeholderFontstyleMap.Clear();
1107 placeholderFontstyleMap.Insert("slant", "roman");
1108 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1109 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1111 placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1113 placeholderFontstyleMap.Clear();
1114 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1116 editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1117 placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1118 DALI_TEST_EQUALS(placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION);
1119 placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderMapSet["fontStyle"];
1120 DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderMapGet, placeholderConversionMap), true, TEST_LOCATION);
1122 editor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
1123 DALI_TEST_EQUALS(editor.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
1125 // Check handle color
1126 editor.SetProperty(DevelTextEditor::Property::GRAB_HANDLE_COLOR, Color::GREEN);
1127 DALI_TEST_EQUALS(editor.GetProperty<Vector4>(DevelTextEditor::Property::GRAB_HANDLE_COLOR), Color::GREEN, TEST_LOCATION);
1129 // Test the ENABLE_GRAB_HANDLE_POPUP property
1130 editor.SetProperty(DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP, false);
1131 DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP), false, TEST_LOCATION);
1133 // Check the input method setting
1134 Property::Map propertyMap;
1135 InputMethod::PanelLayout::Type panelLayout = InputMethod::PanelLayout::NUMBER;
1136 InputMethod::AutoCapital::Type autoCapital = InputMethod::AutoCapital::WORD;
1137 InputMethod::ButtonAction::Type buttonAction = InputMethod::ButtonAction::GO;
1138 int inputVariation = 1;
1139 propertyMap["PANEL_LAYOUT"] = panelLayout;
1140 propertyMap["AUTO_CAPITALIZE"] = autoCapital;
1141 propertyMap["BUTTON_ACTION"] = buttonAction;
1142 propertyMap["VARIATION"] = inputVariation;
1143 editor.SetProperty(DevelTextEditor::Property::INPUT_METHOD_SETTINGS, propertyMap);
1145 Property::Value value = editor.GetProperty(DevelTextEditor::Property::INPUT_METHOD_SETTINGS);
1147 DALI_TEST_CHECK(value.Get(map));
1150 DALI_TEST_CHECK(map["PANEL_LAYOUT"].Get(layout));
1151 DALI_TEST_EQUALS(static_cast<int>(panelLayout), layout, TEST_LOCATION);
1154 DALI_TEST_CHECK(map["AUTO_CAPITALIZE"].Get(capital));
1155 DALI_TEST_EQUALS(static_cast<int>(autoCapital), capital, TEST_LOCATION);
1158 DALI_TEST_CHECK(map["BUTTON_ACTION"].Get(action));
1159 DALI_TEST_EQUALS(static_cast<int>(buttonAction), action, TEST_LOCATION);
1162 DALI_TEST_CHECK(map["VARIATION"].Get(variation));
1163 DALI_TEST_EQUALS(inputVariation, variation, TEST_LOCATION);
1165 // Check the input filter property
1166 Property::Map inputFilterMapSet;
1167 Property::Map inputFilterMapGet;
1168 inputFilterMapSet[InputFilter::Property::ACCEPTED] = "[\\w]";
1169 inputFilterMapSet[InputFilter::Property::REJECTED] = "[\\d]";
1171 editor.SetProperty(DevelTextEditor::Property::INPUT_FILTER, inputFilterMapSet);
1173 inputFilterMapGet = editor.GetProperty<Property::Map>(DevelTextEditor::Property::INPUT_FILTER);
1174 DALI_TEST_EQUALS(inputFilterMapGet.Count(), inputFilterMapSet.Count(), TEST_LOCATION);
1177 inputFilterMapSet.Clear();
1178 editor.SetProperty(DevelTextEditor::Property::INPUT_FILTER, inputFilterMapSet);
1180 // Check the strikethrough property
1182 Property::Map strikethroughMapSet;
1183 Property::Map strikethroughMapGet;
1185 application.SendNotification();
1186 application.Render();
1188 // Check the input strikethrough property
1190 strikethroughMapSet.Clear();
1191 strikethroughMapGet.Clear();
1192 strikethroughMapSet.Insert("enable", true);
1193 strikethroughMapSet.Insert("color", Color::BLUE);
1194 strikethroughMapSet.Insert("height", 2.0f);
1196 editor.SetProperty(DevelTextEditor::Property::STRIKETHROUGH, strikethroughMapSet);
1198 application.SendNotification();
1199 application.Render();
1201 strikethroughMapGet = editor.GetProperty<Property::Map>(DevelTextEditor::Property::STRIKETHROUGH);
1203 DALI_TEST_EQUALS(strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION);
1204 DALI_TEST_EQUALS(DaliTestCheckMaps(strikethroughMapSet, strikethroughMapGet), true, TEST_LOCATION);
1206 // Check the input strikethrough property
1207 editor.SetProperty(DevelTextEditor::Property::INPUT_STRIKETHROUGH, "Strikethrough input properties");
1208 DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::INPUT_STRIKETHROUGH), std::string("Strikethrough input properties"), TEST_LOCATION);
1210 application.SendNotification();
1211 application.Render();
1213 // Check the line size property
1214 DALI_TEST_EQUALS(editor.GetProperty<float>(DevelTextEditor::Property::MIN_LINE_SIZE), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1215 editor.SetProperty(DevelTextEditor::Property::MIN_LINE_SIZE, 50.f);
1216 DALI_TEST_EQUALS(editor.GetProperty<float>(DevelTextEditor::Property::MIN_LINE_SIZE), 50.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1221 // Positive Atlas Text Renderer test
1222 int utcDaliTextEditorAtlasRenderP(void)
1224 ToolkitTestApplication application;
1225 tet_infoline(" UtcDaliToolkitTextEditorAtlasRenderP");
1226 StyleManager styleManager = StyleManager::Get();
1227 styleManager.ApplyDefaultTheme();
1228 TextEditor editor = TextEditor::New();
1229 DALI_TEST_CHECK(editor);
1231 editor.SetProperty(TextEditor::Property::HORIZONTAL_ALIGNMENT, "CENTER");
1233 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1235 application.GetScene().Add(editor);
1239 // Render some text with the shared atlas backend
1240 editor.SetProperty(DevelTextEditor::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS);
1241 application.SendNotification();
1242 application.Render();
1246 tet_result(TET_FAIL);
1251 // Positive test for the anchorClicked signal.
1252 int utcDaliTextEditorAnchorClickedP(void)
1254 ToolkitTestApplication application;
1255 tet_infoline(" utcDaliTextEditorAnchorClickedP");
1256 TextEditor editor = TextEditor::New();
1257 DALI_TEST_CHECK(editor);
1259 application.GetScene().Add(editor);
1261 // connect to the anchor clicked signal.
1262 ConnectionTracker* testTracker = new ConnectionTracker();
1263 DevelTextEditor::AnchorClickedSignal(editor).Connect(&TestAnchorClickedCallback);
1264 bool anchorClickedSignal = false;
1265 editor.ConnectSignal(testTracker, "anchorClicked", CallbackFunctor(&anchorClickedSignal));
1267 gAnchorClickedCallBackCalled = false;
1268 editor.SetProperty(TextEditor::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
1269 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
1270 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
1271 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1272 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1274 application.SendNotification();
1275 application.Render();
1276 editor.SetKeyInputFocus();
1278 // Create a tap event to touch the text editor.
1279 TestGenerateTap(application, 5.0f, 5.0f);
1280 application.SendNotification();
1281 application.Render();
1283 DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
1284 DALI_TEST_CHECK(anchorClickedSignal);
1286 gAnchorClickedCallBackNotCalled = true;
1287 // Tap the outside of anchor, callback should not be called.
1288 TestGenerateTap(application, 150.f, 100.f);
1289 application.SendNotification();
1290 application.Render();
1292 DALI_TEST_CHECK(gAnchorClickedCallBackNotCalled);
1297 // Positive test for the textChanged signal.
1298 int utcDaliTextEditorTextChangedP(void)
1300 ToolkitTestApplication application;
1301 tet_infoline(" utcDaliTextEditorTextChangedP");
1302 TextEditor editor = TextEditor::New();
1303 DALI_TEST_CHECK(editor);
1305 application.GetScene().Add(editor);
1307 // connect to the text changed signal.
1308 ConnectionTracker* testTracker = new ConnectionTracker();
1309 editor.TextChangedSignal().Connect(&TestTextChangedCallback);
1310 bool textChangedSignal = false;
1311 editor.ConnectSignal(testTracker, "textChanged", CallbackFunctor(&textChangedSignal));
1313 gTextChangedCallBackCalled = false;
1314 editor.SetProperty(TextEditor::Property::TEXT, "ABC");
1315 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1316 DALI_TEST_CHECK(textChangedSignal);
1318 application.SendNotification();
1319 editor.SetKeyInputFocus();
1321 gTextChangedCallBackCalled = false;
1322 application.ProcessEvent(GenerateKey("D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1323 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1326 editor.SetProperty(TextField::Property::TEXT, "");
1328 // Pressing backspace key: TextChangedCallback should not be called when there is no text in texteditor.
1329 gTextChangedCallBackCalled = false;
1330 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1331 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1333 // Pressing delete key: TextChangedCallback should not be called when there is no text in texteditor.
1334 gTextChangedCallBackCalled = false;
1335 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "Delete", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1336 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1341 int utcDaliTextEditorTextChangedWithInputMethodContext(void)
1343 ToolkitTestApplication application;
1344 tet_infoline(" utcDaliTextEditorTextChangedWithInputMethodContext");
1345 TextEditor editor = TextEditor::New();
1346 DALI_TEST_CHECK(editor);
1348 application.GetScene().Add(editor);
1350 // connect to the text changed signal.
1351 ConnectionTracker* testTracker = new ConnectionTracker();
1352 editor.TextChangedSignal().Connect(&TestTextChangedCallback);
1353 bool textChangedSignal = false;
1354 editor.ConnectSignal(testTracker, "textChanged", CallbackFunctor(&textChangedSignal));
1356 // get InputMethodContext
1358 InputMethodContext::EventData imfEvent;
1359 InputMethodContext inputMethodContext = DevelTextEditor::GetInputMethodContext(editor);
1361 editor.SetKeyInputFocus();
1362 editor.SetProperty(DevelTextEditor::Property::ENABLE_EDITING, true);
1365 gTextChangedCallBackCalled = false;
1366 imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "ㅎ", 0, 1);
1367 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1368 application.SendNotification();
1369 application.Render();
1370 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1371 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("ㅎ"), TEST_LOCATION);
1373 gTextChangedCallBackCalled = false;
1374 imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "호", 0, 1);
1375 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1376 application.SendNotification();
1377 application.Render();
1378 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1379 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("호"), TEST_LOCATION);
1381 gTextChangedCallBackCalled = false;
1382 imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "혿", 0, 1);
1383 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1384 application.SendNotification();
1385 application.Render();
1386 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1387 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("혿"), TEST_LOCATION);
1389 gTextChangedCallBackCalled = false;
1390 imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "", 0, 1);
1391 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1392 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1394 imfEvent = InputMethodContext::EventData(InputMethodContext::COMMIT, "호", 0, 1);
1395 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1396 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1398 imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "두", 1, 2);
1399 inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1400 DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1402 application.SendNotification();
1403 application.Render();
1404 DALI_TEST_CHECK(gTextChangedCallBackCalled);
1405 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("호두"), TEST_LOCATION);
1410 int utcDaliTextEditorInputStyleChanged01(void)
1412 // The text-editor emits signals when the input style changes. These changes of style are
1413 // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
1414 // can't be emitted during the size negotiation as the callbacks may update the UI.
1415 // The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
1416 // The ToolkitTestApplication creates an implementation of the adaptor stub and a queue of idle callbacks.
1417 ToolkitTestApplication application;
1418 tet_infoline(" utcDaliTextEditorInputStyleChanged01");
1422 char* pathNamePtr = get_current_dir_name();
1423 const std::string pathName(pathNamePtr);
1426 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1427 fontClient.SetDpi(93u, 93u);
1429 fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE);
1430 fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE);
1432 TextEditor editor = TextEditor::New();
1433 DALI_TEST_CHECK(editor);
1435 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1436 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1437 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1439 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
1440 editor.SetProperty(TextEditor::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='green'>llo</color> <font weight='bold'>world</font> demo</font>");
1442 // connect to the text changed signal.
1443 ConnectionTracker* testTracker = new ConnectionTracker();
1444 editor.InputStyleChangedSignal().Connect(&TestInputStyleChangedCallback);
1445 bool inputStyleChangedSignal = false;
1446 editor.ConnectSignal(testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal));
1448 application.GetScene().Add(editor);
1450 // Render and notify
1451 application.SendNotification();
1452 application.Render();
1454 // Executes the idle callbacks added by the text control on the change of input style.
1455 application.RunIdles();
1457 gInputStyleChangedCallbackCalled = false;
1458 gInputStyleMask = TextEditor::InputStyle::NONE;
1459 inputStyleChangedSignal = false;
1461 // Create a tap event to touch the text editor.
1462 TestGenerateTap(application, 18.0f, 25.0f);
1464 // Render and notify
1465 application.SendNotification();
1466 application.Render();
1468 // Executes the idle callbacks added by the text control on the change of input style.
1469 application.RunIdles();
1471 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1472 if(gInputStyleChangedCallbackCalled)
1474 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::FONT_FAMILY | TextEditor::InputStyle::POINT_SIZE), TEST_LOCATION);
1476 const std::string fontFamily = editor.GetProperty(TextEditor::Property::INPUT_FONT_FAMILY).Get<std::string>();
1477 DALI_TEST_EQUALS(fontFamily, "DejaVuSerif", TEST_LOCATION);
1479 const float pointSize = editor.GetProperty(TextEditor::Property::INPUT_POINT_SIZE).Get<float>();
1480 DALI_TEST_EQUALS(pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1482 DALI_TEST_CHECK(inputStyleChangedSignal);
1484 gInputStyleChangedCallbackCalled = false;
1485 gInputStyleMask = TextEditor::InputStyle::NONE;
1486 inputStyleChangedSignal = false;
1488 // Create a tap event to touch the text editor.
1489 TestGenerateTap(application, 30.0f, 25.0f);
1491 // Render and notify
1492 application.SendNotification();
1493 application.Render();
1495 // Executes the idle callbacks added by the text control on the change of input style.
1496 application.RunIdles();
1498 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1499 DALI_TEST_CHECK(!inputStyleChangedSignal);
1501 gInputStyleChangedCallbackCalled = false;
1502 gInputStyleMask = TextEditor::InputStyle::NONE;
1503 inputStyleChangedSignal = false;
1505 // Create a tap event to touch the text editor.
1506 TestGenerateTap(application, 43.0f, 25.0f);
1508 // Render and notify
1509 application.SendNotification();
1510 application.Render();
1512 // Executes the idle callbacks added by the text control on the change of input style.
1513 application.RunIdles();
1515 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1516 if(gInputStyleChangedCallbackCalled)
1518 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::COLOR), TEST_LOCATION);
1520 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1521 DALI_TEST_EQUALS(color, Color::GREEN, TEST_LOCATION);
1523 DALI_TEST_CHECK(inputStyleChangedSignal);
1525 gInputStyleChangedCallbackCalled = false;
1526 gInputStyleMask = TextEditor::InputStyle::NONE;
1527 inputStyleChangedSignal = false;
1529 // Create a tap event to touch the text editor.
1530 TestGenerateTap(application, 88.0f, 25.0f);
1532 // Render and notify
1533 application.SendNotification();
1534 application.Render();
1536 // Executes the idle callbacks added by the text control on the change of input style.
1537 application.RunIdles();
1539 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1540 if(gInputStyleChangedCallbackCalled)
1542 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::COLOR | TextEditor::InputStyle::FONT_STYLE), TEST_LOCATION);
1544 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1545 DALI_TEST_EQUALS(color, Color::BLACK, TEST_LOCATION);
1547 Property::Map fontStyleMapSet;
1548 Property::Map fontStyleMapGet;
1550 fontStyleMapSet.Insert("weight", "bold");
1552 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
1553 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
1554 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
1556 DALI_TEST_CHECK(inputStyleChangedSignal);
1558 gInputStyleChangedCallbackCalled = false;
1559 gInputStyleMask = TextEditor::InputStyle::NONE;
1560 inputStyleChangedSignal = false;
1562 // Create a tap event to touch the text editor.
1563 TestGenerateTap(application, 115.0f, 25.0f);
1565 // Render and notify
1566 application.SendNotification();
1567 application.Render();
1569 // Executes the idle callbacks added by the text control on the change of input style.
1570 application.RunIdles();
1572 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1573 DALI_TEST_CHECK(!inputStyleChangedSignal);
1575 gInputStyleChangedCallbackCalled = false;
1576 gInputStyleMask = TextEditor::InputStyle::NONE;
1577 inputStyleChangedSignal = false;
1579 // Create a tap event to touch the text editor.
1580 TestGenerateTap(application, 164.0f, 25.0f);
1582 // Render and notify
1583 application.SendNotification();
1584 application.Render();
1586 // Executes the idle callbacks added by the text control on the change of input style.
1587 application.RunIdles();
1589 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1590 if(gInputStyleChangedCallbackCalled)
1592 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::FONT_STYLE), TEST_LOCATION);
1594 Property::Map fontStyleMapSet;
1595 Property::Map fontStyleMapGet;
1597 fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
1598 DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
1599 DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
1601 DALI_TEST_CHECK(inputStyleChangedSignal);
1603 gInputStyleChangedCallbackCalled = false;
1604 gInputStyleMask = TextEditor::InputStyle::NONE;
1605 inputStyleChangedSignal = false;
1607 // Create a tap event to touch the text editor.
1608 TestGenerateTap(application, 191.0f, 25.0f);
1610 // Render and notify
1611 application.SendNotification();
1612 application.Render();
1614 // Executes the idle callbacks added by the text control on the change of input style.
1615 application.RunIdles();
1617 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1618 DALI_TEST_CHECK(!inputStyleChangedSignal);
1623 int utcDaliTextEditorInputStyleChanged02(void)
1625 // The text-editor emits signals when the input style changes. These changes of style are
1626 // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
1627 // can't be emitted during the size negotiation as the callbacks may update the UI.
1628 // The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
1629 // The ToolkitTestApplication creates an implementation of the adaptor stub and a queue of idle callbacks.
1630 ToolkitTestApplication application;
1631 tet_infoline(" utcDaliTextEditorInputStyleChanged02");
1635 char* pathNamePtr = get_current_dir_name();
1636 const std::string pathName(pathNamePtr);
1639 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1640 fontClient.SetDpi(93u, 93u);
1642 fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE);
1643 fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE);
1645 TextEditor editor = TextEditor::New();
1646 DALI_TEST_CHECK(editor);
1648 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1649 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1650 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1652 editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
1653 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>");
1655 // connect to the text changed signal.
1656 ConnectionTracker* testTracker = new ConnectionTracker();
1657 editor.InputStyleChangedSignal().Connect(&TestInputStyleChangedCallback);
1658 bool inputStyleChangedSignal = false;
1659 editor.ConnectSignal(testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal));
1661 application.GetScene().Add(editor);
1663 // Render and notify
1664 application.SendNotification();
1665 application.Render();
1667 // Executes the idle callbacks added by the text control on the change of input style.
1668 application.RunIdles();
1670 gInputStyleChangedCallbackCalled = false;
1671 gInputStyleMask = TextEditor::InputStyle::NONE;
1672 inputStyleChangedSignal = false;
1674 // Create a tap event to touch the text editor.
1675 TestGenerateTap(application, 53.0f, 25.0f, 100);
1676 TestGenerateTap(application, 53.0f, 25.0f, 200);
1678 // Render and notify
1679 application.SendNotification();
1680 application.Render();
1682 // Executes the idle callbacks added by the text control on the change of input style.
1683 application.RunIdles();
1685 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1686 if(gInputStyleChangedCallbackCalled)
1688 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1689 static_cast<unsigned int>(TextEditor::InputStyle::FONT_FAMILY |
1690 TextEditor::InputStyle::POINT_SIZE |
1691 TextEditor::InputStyle::COLOR),
1694 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1695 DALI_TEST_EQUALS(color, Color::GREEN, TEST_LOCATION);
1697 const std::string fontFamily = editor.GetProperty(TextEditor::Property::INPUT_FONT_FAMILY).Get<std::string>();
1698 DALI_TEST_EQUALS(fontFamily, "DejaVuSerif", TEST_LOCATION);
1700 const float pointSize = editor.GetProperty(TextEditor::Property::INPUT_POINT_SIZE).Get<float>();
1701 DALI_TEST_EQUALS(pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1703 DALI_TEST_CHECK(inputStyleChangedSignal);
1705 gInputStyleChangedCallbackCalled = false;
1706 gInputStyleMask = TextEditor::InputStyle::NONE;
1707 inputStyleChangedSignal = false;
1709 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1711 // Render and notify
1712 application.SendNotification();
1713 application.Render();
1715 // Executes the idle callbacks added by the text control on the change of input style.
1716 application.RunIdles();
1718 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1719 if(gInputStyleChangedCallbackCalled)
1721 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1722 static_cast<unsigned int>(TextEditor::InputStyle::COLOR),
1725 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1726 DALI_TEST_EQUALS(color, Color::BLUE, TEST_LOCATION);
1728 DALI_TEST_CHECK(inputStyleChangedSignal);
1730 gInputStyleChangedCallbackCalled = false;
1731 gInputStyleMask = TextEditor::InputStyle::NONE;
1732 inputStyleChangedSignal = false;
1734 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1736 // Render and notify
1737 application.SendNotification();
1738 application.Render();
1740 // Executes the idle callbacks added by the text control on the change of input style.
1741 application.RunIdles();
1743 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1744 DALI_TEST_CHECK(!inputStyleChangedSignal);
1746 gInputStyleChangedCallbackCalled = false;
1747 gInputStyleMask = TextEditor::InputStyle::NONE;
1748 inputStyleChangedSignal = false;
1750 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1752 // Render and notify
1753 application.SendNotification();
1754 application.Render();
1756 // Executes the idle callbacks added by the text control on the change of input style.
1757 application.RunIdles();
1759 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1760 if(gInputStyleChangedCallbackCalled)
1762 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1763 static_cast<unsigned int>(TextEditor::InputStyle::COLOR),
1766 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1767 DALI_TEST_EQUALS(color, Color::BLACK, TEST_LOCATION);
1769 DALI_TEST_CHECK(inputStyleChangedSignal);
1771 gInputStyleChangedCallbackCalled = false;
1772 gInputStyleMask = TextEditor::InputStyle::NONE;
1773 inputStyleChangedSignal = false;
1775 editor.SetProperty(TextEditor::Property::INPUT_COLOR, Color::YELLOW);
1777 Property::Map fontStyleMapSet;
1778 fontStyleMapSet.Insert("weight", "thin");
1779 fontStyleMapSet.Insert("width", "condensed");
1780 fontStyleMapSet.Insert("slant", "italic");
1782 editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
1783 editor.SetProperty(TextEditor::Property::INPUT_POINT_SIZE, 20.f);
1784 editor.SetProperty(TextEditor::Property::INPUT_LINE_SPACING, 5.f);
1786 editor.SetProperty(TextEditor::Property::INPUT_UNDERLINE, "underline");
1787 editor.SetProperty(TextEditor::Property::INPUT_SHADOW, "shadow");
1788 editor.SetProperty(TextEditor::Property::INPUT_EMBOSS, "emboss");
1789 editor.SetProperty(TextEditor::Property::INPUT_OUTLINE, "outline");
1790 editor.SetProperty(DevelTextEditor::Property::INPUT_STRIKETHROUGH, "strikethrough");
1792 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1794 // Render and notify
1795 application.SendNotification();
1796 application.Render();
1798 // Executes the idle callbacks added by the text control on the change of input style.
1799 application.RunIdles();
1801 DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1802 DALI_TEST_CHECK(!inputStyleChangedSignal);
1804 // Create a tap event to touch the text editor.
1805 TestGenerateTap(application, 63.0f, 25.0f, 900);
1807 // Render and notify
1808 application.SendNotification();
1809 application.Render();
1811 // Executes the idle callbacks added by the text control on the change of input style.
1812 application.RunIdles();
1814 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1815 if(gInputStyleChangedCallbackCalled)
1817 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1818 static_cast<unsigned int>(TextEditor::InputStyle::COLOR |
1819 TextEditor::InputStyle::POINT_SIZE |
1820 TextEditor::InputStyle::FONT_STYLE |
1821 TextEditor::InputStyle::LINE_SPACING |
1822 TextEditor::InputStyle::UNDERLINE |
1823 TextEditor::InputStyle::SHADOW |
1824 TextEditor::InputStyle::EMBOSS |
1825 TextEditor::InputStyle::OUTLINE),
1828 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1829 DALI_TEST_EQUALS(color, Color::BLACK, TEST_LOCATION);
1831 DALI_TEST_CHECK(inputStyleChangedSignal);
1833 gInputStyleChangedCallbackCalled = false;
1834 gInputStyleMask = TextEditor::InputStyle::NONE;
1835 inputStyleChangedSignal = false;
1837 editor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVuSerif");
1839 fontStyleMapSet.Clear();
1840 fontStyleMapSet.Insert("weight", "black");
1841 fontStyleMapSet.Insert("width", "expanded");
1842 fontStyleMapSet.Insert("slant", "oblique");
1844 editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
1846 // Create a tap event to touch the text editor.
1847 TestGenerateTap(application, 30.0f, 25.0f, 1500);
1849 // Render and notify
1850 application.SendNotification();
1851 application.Render();
1853 // Executes the idle callbacks added by the text control on the change of input style.
1854 application.RunIdles();
1856 DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1857 if(gInputStyleChangedCallbackCalled)
1859 DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1860 static_cast<unsigned int>(TextEditor::InputStyle::COLOR |
1861 TextEditor::InputStyle::POINT_SIZE |
1862 TextEditor::InputStyle::FONT_STYLE),
1865 const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1866 DALI_TEST_EQUALS(color, Color::YELLOW, TEST_LOCATION);
1868 DALI_TEST_CHECK(inputStyleChangedSignal);
1873 int utcDaliTextEditorEvent01(void)
1875 ToolkitTestApplication application;
1876 tet_infoline(" utcDaliTextEditorEvent01");
1878 // Creates a tap event. After creating a tap event the text editor should
1879 // have the focus and add text with key events should be possible.
1881 TextEditor editor = TextEditor::New();
1882 DALI_TEST_CHECK(editor);
1884 application.GetScene().Add(editor);
1886 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1887 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1888 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1890 // Avoid a crash when core load gl resources.
1891 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1893 // Render and notify
1894 application.SendNotification();
1895 application.Render();
1897 // Add a key event but as the text editor has not the focus it should do nothing.
1898 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1900 // Render and notify
1901 application.SendNotification();
1902 application.Render();
1904 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string(""), TEST_LOCATION);
1906 // Create a tap event to touch the text editor.
1907 TestGenerateTap(application, 150.0f, 25.0f);
1909 // Render and notify
1910 application.SendNotification();
1911 application.Render();
1913 // Now the text editor has the focus, so it can handle the key events.
1914 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1915 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1917 // Render and notify
1918 application.SendNotification();
1919 application.Render();
1921 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("aa"), TEST_LOCATION);
1923 // Create a second text editor and send key events to it.
1924 TextEditor editor2 = TextEditor::New();
1926 editor2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1927 editor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1928 editor2.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
1929 editor2.SetProperty(Actor::Property::POSITION, Vector2(100.f, 100.f));
1931 application.GetScene().Add(editor2);
1933 // Render and notify
1934 application.SendNotification();
1935 application.Render();
1937 // Create a tap event on the second text editor.
1938 TestGenerateTap(application, 150.0f, 125.0f);
1940 // Render and notify
1941 application.SendNotification();
1942 application.Render();
1944 // The second text editor has the focus. It should handle the key events.
1945 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1946 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1948 // Render and notify
1949 application.SendNotification();
1950 application.Render();
1952 // Check the text has been added to the second text editor.
1953 DALI_TEST_EQUALS(editor2.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("aa"), TEST_LOCATION);
1958 int utcDaliTextEditorEvent02(void)
1960 ToolkitTestApplication application;
1961 tet_infoline(" utcDaliTextEditorEvent02");
1963 // Checks if the right number of actors are created.
1965 TextEditor editor = TextEditor::New();
1966 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
1967 DALI_TEST_CHECK(editor);
1969 application.GetScene().Add(editor);
1971 editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1972 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1973 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1975 // Avoid a crash when core load gl resources.
1976 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1978 // Render and notify
1979 application.SendNotification();
1980 application.Render();
1982 // Check there are the expected number of children (the stencil).
1983 DALI_TEST_EQUALS(editor.GetChildCount(), 1u, TEST_LOCATION);
1985 Actor stencil = editor.GetChildAt(0u);
1987 // Create a tap event to touch the text editor.
1988 TestGenerateTap(application, 150.0f, 25.0f, 100);
1990 // Render and notify
1991 application.SendNotification();
1992 application.Render();
1994 Actor layer = editor.GetChildAt(2u);
1995 DALI_TEST_EQUALS(layer.GetChildCount(), 1u, TEST_LOCATION); // The cursor.
1996 DALI_TEST_EQUALS(stencil.GetChildCount(), 0u, TEST_LOCATION);
1998 // Now the text editor has the focus, so it can handle the key events.
1999 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2000 application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2002 // Render and notify
2003 application.SendNotification();
2004 application.Render();
2006 // Checks the cursor and the renderer have been created.
2007 DALI_TEST_EQUALS(layer.GetChildCount(), 1u, TEST_LOCATION); // The cursor.
2008 DALI_TEST_EQUALS(stencil.GetChildCount(), 2u, TEST_LOCATION); // The renderer, clipped cursor
2010 Control cursor = Control::DownCast(layer.GetChildAt(0u));
2011 DALI_TEST_CHECK(cursor);
2013 // The stencil actor has a container with all the actors which contain the text renderers.
2014 Actor container = stencil.GetChildAt(0u);
2015 for(unsigned int index = 0; index < container.GetChildCount(); ++index)
2017 Renderer renderer = container.GetChildAt(index).GetRendererAt(0u);
2018 DALI_TEST_CHECK(renderer);
2021 // Move the cursor and check the position changes.
2022 Vector3 position1 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
2024 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2025 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2027 // Render and notify
2028 application.SendNotification();
2029 application.Render();
2031 Vector3 position2 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
2033 DALI_TEST_CHECK(position2.x < position1.x);
2035 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2036 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2038 // Render and notify
2039 application.SendNotification();
2040 application.Render();
2042 Vector3 position3 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
2044 DALI_TEST_EQUALS(position1, position3, TEST_LOCATION); // Should be in the same position1.
2046 // Send some taps and check the cursor positions.
2048 // Try to tap at the beginning.
2049 TestGenerateTap(application, 1.0f, 25.0f, 700);
2051 // Render and notify
2052 application.SendNotification();
2053 application.Render();
2055 // Cursor position should be the same than position1.
2056 Vector3 position4 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
2058 DALI_TEST_EQUALS(position2, position4, TEST_LOCATION); // Should be in the same position2.
2060 // Tap away from the start position.
2061 TestGenerateTap(application, 16.0f, 25.0f, 1400);
2063 // Render and notify
2064 application.SendNotification();
2065 application.Render();
2067 Vector3 position5 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
2069 DALI_TEST_CHECK(position5.x > position4.x);
2071 // Remove all the text.
2072 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2073 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2074 editor.SetProperty(TextEditor::Property::TEXT, "");
2076 // Render and notify
2077 application.SendNotification();
2078 application.Render();
2080 // Cursor position should be the same than position2.
2081 Vector3 position6 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
2083 DALI_TEST_EQUALS(position2, position6, TEST_LOCATION); // Should be in the same position2.
2085 // Should not be a renderer, there is only a clipped cursor.
2086 DALI_TEST_EQUALS(stencil.GetChildCount(), 1u, TEST_LOCATION);
2091 int utcDaliTextEditorEvent03(void)
2093 ToolkitTestApplication application;
2094 tet_infoline(" utcDaliTextEditorEvent03");
2096 // Checks if the highlight actor is created.
2098 TextEditor editor = TextEditor::New();
2099 DALI_TEST_CHECK(editor);
2101 application.GetScene().Add(editor);
2103 editor.SetProperty(TextEditor::Property::TEXT, "This is a long text for the size of the text-editor.");
2104 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2105 editor.SetProperty(Actor::Property::SIZE, Vector2(30.f, 50.f));
2106 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2107 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2109 // Avoid a crash when core load gl resources.
2110 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2112 // Render and notify
2113 application.SendNotification();
2114 application.Render();
2116 // Send some taps and check text controller with clipboard window
2117 Dali::Clipboard clipboard = Clipboard::Get();
2118 clipboard.ShowClipboard();
2119 TestGenerateTap(application, 3.0f, 25.0f, 100);
2120 clipboard.HideClipboard();
2122 // Render and notify
2123 application.SendNotification();
2124 application.Render();
2126 // Tap first to get the focus.
2127 TestGenerateTap(application, 3.0f, 25.0f, 1000);
2129 // Render and notify
2130 application.SendNotification();
2131 application.Render();
2133 // Double tap to select a word.
2134 TestGenerateTap(application, 3.0f, 25.0f, 1100);
2136 // Render and notify
2137 application.SendNotification();
2138 application.Render();
2140 // The stencil actor should have two actors: the renderer and the highlight actor.
2141 Actor stencil = editor.GetChildAt(0u);
2143 // Highlight needs to be drawn before text, so should come first in child order
2144 Renderer highlight = stencil.GetChildAt(0u).GetRendererAt(0u);
2145 DALI_TEST_CHECK(highlight);
2147 // The stencil actor has a container with all the actors which contain the text renderers.
2148 Actor container = stencil.GetChildAt(1u);
2149 for(unsigned int index = 0; index < container.GetChildCount(); ++index)
2151 Renderer renderer = container.GetChildAt(index).GetRendererAt(0u);
2152 DALI_TEST_CHECK(renderer);
2155 // Double tap out of bounds
2156 TestGenerateTap(application, 29.0f, 25.0f, 1700);
2157 TestGenerateTap(application, 29.0f, 25.0f, 1800);
2159 // Render and notify
2160 application.SendNotification();
2161 application.Render();
2163 // The stencil actor should have one actors: the renderer actor.
2164 stencil = editor.GetChildAt(0u);
2166 // The stencil actor has a container with all the actors which contain the text renderers.
2167 container = stencil.GetChildAt(0u);
2168 for(unsigned int index = 0; index < container.GetChildCount(); ++index)
2170 Renderer renderer = container.GetChildAt(index).GetRendererAt(0u);
2171 DALI_TEST_CHECK(renderer);
2175 TestGenerateLongPress(application, 1.0f, 25.0f);
2177 // Render and notify
2178 application.SendNotification();
2179 application.Render();
2182 TestGenerateMiniPan(application);
2184 // Render and notify
2185 application.SendNotification();
2186 application.Render();
2191 int utcDaliTextEditorEvent04(void)
2193 ToolkitTestApplication application;
2194 tet_infoline(" utcDaliTextEditorEvent04");
2196 // Checks if the highlight actor is created.
2198 TextEditor editor = TextEditor::New();
2199 DALI_TEST_CHECK(editor);
2201 application.GetScene().Add(editor);
2203 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworl");
2204 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2205 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2206 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2207 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2209 // Avoid a crash when core load gl resources.
2210 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2212 // Render and notify
2213 application.SendNotification();
2214 application.Render();
2216 // Tap on the text editor
2217 TestGenerateTap(application, 3.0f, 25.0f);
2219 // Render and notify
2220 application.SendNotification();
2221 application.Render();
2223 // Move at the end of the text.
2224 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2225 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2227 // Render and notify
2228 application.SendNotification();
2229 application.Render();
2231 for(unsigned int index = 0u; index < 10u; ++index)
2233 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2234 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2236 // Render and notify
2237 application.SendNotification();
2238 application.Render();
2242 application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2244 // Render and notify
2245 application.SendNotification();
2246 application.Render();
2248 DALI_TEST_EQUALS("Hello\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2250 // Add some key events
2251 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2252 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2254 // Render and notify
2255 application.SendNotification();
2256 application.Render();
2258 for(unsigned int index = 0u; index < 10u; ++index)
2260 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2261 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2263 // Render and notify
2264 application.SendNotification();
2265 application.Render();
2269 application.ProcessEvent(GenerateKey(" ", "", " ", KEY_WHITE_SPACE_CODE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2271 // Render and notify
2272 application.SendNotification();
2273 application.Render();
2275 DALI_TEST_EQUALS(" Hello\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2280 int utcDaliTextEditorEvent05(void)
2282 ToolkitTestApplication application;
2283 tet_infoline(" utcDaliTextEditorEvent05");
2285 // Checks if the highlight actor is created.
2287 TextEditor editor = TextEditor::New();
2288 DALI_TEST_CHECK(editor);
2290 application.GetScene().Add(editor);
2292 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworl");
2293 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2294 editor.SetProperty(Actor::Property::SIZE, Vector2(50.f, 50.f));
2295 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2296 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2297 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL, true);
2298 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.2f);
2299 editor.SetProperty(TextEditor::Property::ENABLE_SCROLL_BAR, true);
2300 editor.SetProperty(TextEditor::Property::SCROLL_BAR_SHOW_DURATION, 0.3f);
2301 editor.SetProperty(TextEditor::Property::SCROLL_BAR_FADE_DURATION, 0.2f);
2303 // Avoid a crash when core load gl resources.
2304 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2306 // Render and notify
2307 application.SendNotification();
2308 application.Render();
2310 // Tap on the text editor
2311 TestGenerateTap(application, 3.0f, 25.0f);
2313 // Render and notify
2314 application.SendNotification();
2315 application.Render();
2317 // Move at the end of the text.
2318 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2319 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2321 // Render and notify
2322 application.SendNotification();
2323 application.Render();
2325 for(unsigned int index = 0u; index < 10u; ++index)
2328 application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2330 // Render and notify
2331 application.SendNotification();
2332 application.Render();
2334 // Modify duration after scroll is enabled
2335 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.1f);
2337 // Continuous scroll left to increase coverage
2338 for(unsigned int index = 0u; index < 10u; ++index)
2340 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2342 // Render and notify
2343 application.SendNotification();
2344 application.Render();
2346 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SMOOTH_SCROLL_DURATION), 0.1f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
2347 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::SMOOTH_SCROLL), true, TEST_LOCATION);
2348 DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SCROLL_BAR), true, TEST_LOCATION);
2349 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_SHOW_DURATION), 0.3f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
2350 DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_FADE_DURATION), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
2352 // Press Escape to increase coverage
2353 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::UP, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2354 application.SendNotification();
2355 application.Render();
2357 DALI_TEST_CHECK(!editor.HasKeyInputFocus());
2362 int utcDaliTextEditorEvent06(void)
2364 ToolkitTestApplication application;
2365 tet_infoline(" utcDaliTextEditorEvent06");
2367 // Checks if the highlight actor is created.
2369 TextEditor editor = TextEditor::New();
2370 DALI_TEST_CHECK(editor);
2372 application.GetScene().Add(editor);
2374 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
2375 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2376 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2377 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2378 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2380 // Avoid a crash when core load gl resources.
2381 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2383 // Render and notify
2384 application.SendNotification();
2385 application.Render();
2387 // Tap on the text editor
2388 TestGenerateTap(application, 3.0f, 25.0f);
2390 // Render and notify
2391 application.SendNotification();
2392 application.Render();
2394 // Move to seconds line of the text.
2395 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2397 // Render and notify
2398 application.SendNotification();
2399 application.Render();
2401 float layoutHeight = editor.GetHeightForWidth(100.f);
2403 // Add another script characters ( glyph height is defferent )
2404 application.ProcessEvent(GenerateKey("d", "", "ㅁ", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "ㅁ", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2405 application.ProcessEvent(GenerateKey("d", "", "ኢ", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "ኢ", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2407 // Delete characters
2408 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2409 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2411 DALI_TEST_EQUALS(layoutHeight, editor.GetHeightForWidth(100.f), TEST_LOCATION);
2413 // Render and notify
2414 application.SendNotification();
2415 application.Render();
2417 DALI_TEST_EQUALS("Hello\nworld\nHello world", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2420 application.ProcessEvent(GenerateKey("", "", "", 0, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2421 application.SendNotification();
2422 application.Render();
2424 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2425 application.SendNotification();
2426 application.Render();
2428 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_VOLUME_UP, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2429 application.SendNotification();
2430 application.Render();
2432 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_VOLUME_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2433 application.SendNotification();
2434 application.Render();
2436 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2437 application.SendNotification();
2438 application.Render();
2440 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2441 application.SendNotification();
2442 application.Render();
2444 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2445 application.SendNotification();
2446 application.Render();
2451 int utcDaliTextEditorEvent07(void)
2453 ToolkitTestApplication application;
2454 tet_infoline(" utcDaliTextEditorEvent07");
2456 // Checks if the highlight actor is created.
2458 TextEditor editor = TextEditor::New();
2459 DALI_TEST_CHECK(editor);
2461 application.GetScene().Add(editor);
2463 editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
2464 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2465 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2466 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2467 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2469 // Avoid a crash when core load gl resources.
2470 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2472 // Render and notify
2473 application.SendNotification();
2474 application.Render();
2476 // Tap on the text editor
2477 TestGenerateTap(application, 3.0f, 25.0f);
2479 // Render and notify
2480 application.SendNotification();
2481 application.Render();
2483 // Move to second line of the text.
2484 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2486 // Render and notify
2487 application.SendNotification();
2488 application.Render();
2490 // Select some text in the right of the current cursor position
2491 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2492 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2493 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2494 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2496 // Render and notify
2497 application.SendNotification();
2498 application.Render();
2500 // Cut the selected text
2501 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2502 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));
2504 // Render and notify
2505 application.SendNotification();
2506 application.Render();
2508 DALI_TEST_EQUALS("Hello\nld\nHello world", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2510 // Select some text in the left of the current cursor position
2511 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2512 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2513 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2514 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2516 // Render and notify
2517 application.SendNotification();
2518 application.Render();
2520 // Copy the selected text
2521 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2522 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));
2524 // Render and notify
2525 application.SendNotification();
2526 application.Render();
2528 // Move the cursor to the third line
2529 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2530 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2532 // Render and notify
2533 application.SendNotification();
2534 application.Render();
2536 // Paste the selected text at the current cursor position
2537 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2538 application.ProcessEvent(GenerateKey("v", "", "v", KEY_V_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "v", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2540 // Render and notify
2541 application.SendNotification();
2542 application.Render();
2544 DALI_TEST_EQUALS("Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2546 // Disable Shift Selection
2547 editor.SetProperty(DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false);
2549 // Test to select some text in the right of the current cursor position
2550 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2551 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2552 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2553 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2555 // Render and notify
2556 application.SendNotification();
2557 application.Render();
2559 // Cut the selected text
2560 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2561 application.ProcessEvent(GenerateKey("x", "", "x", KEY_X_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "x", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2563 // Render and notify
2564 application.SendNotification();
2565 application.Render();
2567 // The text isn't selected and not changed because of 'SetProperty( DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false )'
2568 DALI_TEST_EQUALS("Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2570 // Test to select some text in the left of the current cursor position
2571 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2572 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2573 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2574 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2576 // Render and notify
2577 application.SendNotification();
2578 application.Render();
2580 // Copy the selected text
2581 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2582 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));
2584 // Render and notify
2585 application.SendNotification();
2586 application.Render();
2588 // The text is not selected and not changed because of 'SetProperty( DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false )'
2589 DALI_TEST_EQUALS("Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2592 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));
2594 // Render and notify
2595 application.SendNotification();
2596 application.Render();
2598 // replace text with "c"
2599 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2601 // Render and notify
2602 application.SendNotification();
2603 application.Render();
2606 DALI_TEST_EQUALS("c", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2609 DevelTextEditor::SelectWholeText(editor);
2611 // Render and notify
2612 application.SendNotification();
2613 application.Render();
2615 // Copy the selected text using logical keys
2616 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2617 application.ProcessEvent(GenerateKey("ؤ", "c", "ؤ", KEY_C_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2619 // Render and notify
2620 application.SendNotification();
2621 application.Render();
2624 DevelTextEditor::SelectNone(editor);
2626 // Render and notify
2627 application.SendNotification();
2628 application.Render();
2630 // Paste the selected using logical keys
2631 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2632 application.ProcessEvent(GenerateKey("ر", "v", "ر", KEY_V_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "v", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2635 DALI_TEST_EQUALS("cc", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2637 // select all using logical keys
2638 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2639 application.ProcessEvent(GenerateKey("ش", "a", "ش", KEY_A_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2641 // Render and notify
2642 application.SendNotification();
2643 application.Render();
2645 // cut text using logical keys
2646 application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2647 application.ProcessEvent(GenerateKey("ء", "x", "ء", KEY_X_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "x", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2649 // Render and notify
2650 application.SendNotification();
2651 application.Render();
2654 DALI_TEST_EQUALS("", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2659 int utcDaliTextEditorEvent08(void)
2661 ToolkitTestApplication application;
2662 tet_infoline(" utcDaliTextEditorEvent08");
2664 // Checks if the highlight actor is released correctly.
2666 TextEditor editor = TextEditor::New();
2667 DALI_TEST_CHECK(editor);
2669 application.GetScene().Add(editor);
2671 editor.SetProperty(TextEditor::Property::TEXT, "DALi");
2672 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2673 editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2674 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2675 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2677 // Avoid a crash when core load gl resources.
2678 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2680 // Render and notify
2681 application.SendNotification();
2682 application.Render();
2684 // Tap on the text editor
2685 TestGenerateTap(application, 3.0f, 25.0f);
2687 // Render and notify
2688 application.SendNotification();
2689 application.Render();
2691 // When the left selection handle and the right selection handle are at the same position, the highlight box should be deactivated.
2692 // Test to select some text in the left of the current cursor position
2693 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2694 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2695 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2696 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2698 // Render and notify
2699 application.SendNotification();
2700 application.Render();
2702 // Test to the left selection handle position and the right selection handle position
2703 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2704 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2705 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2706 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2708 // Render and notify
2709 application.SendNotification();
2710 application.Render();
2712 // Test to select full text in the left of the current cursor position
2713 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2714 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2715 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2716 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2717 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2718 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2720 // Render and notify
2721 application.SendNotification();
2722 application.Render();
2724 // Test to release the current full text selection
2725 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2726 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2728 // Render and notify
2729 application.SendNotification();
2730 application.Render();
2732 // Test to move the current cursor position correctly
2733 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2735 // Render and notify
2736 application.SendNotification();
2737 application.Render();
2740 application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2742 // Render and notify
2743 application.SendNotification();
2744 application.Render();
2746 DALI_TEST_EQUALS("DdALi", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2748 // Test to select some text in the right of the current cursor position
2749 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2750 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2751 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2753 // Render and notify
2754 application.SendNotification();
2755 application.Render();
2757 // Test the cursor position with right arrow key
2758 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2760 // Render and notify
2761 application.SendNotification();
2762 application.Render();
2765 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2767 // Render and notify
2768 application.SendNotification();
2769 application.Render();
2771 DALI_TEST_EQUALS("DdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2773 // Test to select some text in the left of the current cursor position
2774 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2775 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2776 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2777 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2778 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2780 // Render and notify
2781 application.SendNotification();
2782 application.Render();
2784 // Test the cursor position with left arrow key
2785 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2787 // Render and notify
2788 application.SendNotification();
2789 application.Render();
2792 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2794 // Render and notify
2795 application.SendNotification();
2796 application.Render();
2798 DALI_TEST_EQUALS("DcdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2800 // Test to select some text in the right of the current cursor position
2801 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2802 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2803 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2804 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2806 // Render and notify
2807 application.SendNotification();
2808 application.Render();
2810 // Test the cursor position with left arrow key
2811 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2813 // Render and notify
2814 application.SendNotification();
2815 application.Render();
2818 application.ProcessEvent(GenerateKey("x", "", "x", KEY_X_CODE, 0, 0, Integration::KeyEvent::DOWN, "x", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2820 // Render and notify
2821 application.SendNotification();
2822 application.Render();
2824 DALI_TEST_EQUALS("DcxdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2826 // Test to select some text in the left of the current cursor position
2827 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2828 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2829 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2830 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2832 // Render and notify
2833 application.SendNotification();
2834 application.Render();
2836 // Test the cursor position with right arrow key
2837 application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2839 // Render and notify
2840 application.SendNotification();
2841 application.Render();
2844 application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2846 // Render and notify
2847 application.SendNotification();
2848 application.Render();
2850 DALI_TEST_EQUALS("DcxcdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2855 int utcDaliTextEditorHandles(void)
2857 ToolkitTestApplication application;
2858 tet_infoline(" utcDaliTextEditorHandles");
2860 TextEditor editor = TextEditor::New();
2861 DALI_TEST_CHECK(editor);
2863 application.GetScene().Add(editor);
2865 editor.SetProperty(TextEditor::Property::TEXT, "This is a long text for the size of the text-editor.");
2866 editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2867 editor.SetProperty(TextEditor::Property::GRAB_HANDLE_IMAGE, HANDLE_IMAGE_FILE_NAME);
2868 editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL, true);
2870 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, Property::Map{{"filename", HANDLE_LEFT_SELECTION_FILE_NAME}});
2871 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT, Property::Map{{"filename", HANDLE_LEFT_SELECTION_FILE_NAME}});
2872 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT, Property::Map{{"filename", HANDLE_RIGHT_SELECTION_FILE_NAME}});
2873 editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, Property::Map{{"filename", HANDLE_RIGHT_SELECTION_FILE_NAME}});
2875 editor.SetProperty(Actor::Property::SIZE, Vector2(30.f, 500.f));
2876 editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2877 editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2879 // Avoid a crash when core load gl resources.
2880 application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2882 // Render and notify
2883 application.SendNotification();
2884 application.Render();
2886 // Tap first to get the focus.
2887 TestGenerateTap(application, 3.0f, 25.0f, 100);
2889 // Render and notify
2890 application.SendNotification();
2891 application.Render();
2893 // Tap to create the grab handle.
2894 TestGenerateTap(application, 3.0f, 25.0f, 700);
2896 // Render and notify
2897 application.SendNotification();
2898 application.Render();
2900 // Get the active layer where the text's decoration is added.
2901 Actor activeLayer = editor.GetChildAt(1u);
2903 // Get the handle's actor.
2904 Actor handle = activeLayer.GetChildAt(0u);
2905 handle.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
2907 // Render and notify
2908 application.SendNotification();
2909 application.Render();
2911 // Touch the grab handle to set it as pressed.
2912 Vector2 touchPos(10.0f, 50.0f);
2913 Dali::Integration::TouchEvent event;
2914 event = Dali::Integration::TouchEvent();
2915 event.AddPoint(GetPointDownInside(touchPos));
2916 application.ProcessEvent(event);
2918 // Render and notify
2919 application.SendNotification();
2920 application.Render();
2922 // Pan the grab handle
2923 uint32_t time = 100;
2924 TestStartPan(application, Vector2(10.0f, 50.0f), Vector2(10.0f, 50.0f), time);
2925 TestMovePan(application, Vector2(10.0f, 30.0f), time);
2926 TestEndPan(application, Vector2(10.0f, 50.0f), time);
2927 application.SendNotification();
2928 application.Render();
2930 // Release the grab handle.
2931 event = Dali::Integration::TouchEvent();
2932 event.AddPoint(GetPointUpInside(touchPos));
2933 application.ProcessEvent(event);
2935 // Render and notify
2936 application.SendNotification();
2937 application.Render();
2939 // Tap first to get the focus.
2940 TestGenerateTap(application, 3.0f, 25.0f, 1400);
2942 // Render and notify
2943 application.SendNotification();
2944 application.Render();
2946 // Double tap to select a word and create the selection handles.
2947 TestGenerateTap(application, 3.0f, 25.0f, 1500);
2949 // Render and notify
2950 application.SendNotification();
2951 application.Render();
2953 touchPos = Vector2(10.0f, 50.0f);
2955 // Touch the left selection handle to set it as pressed.
2956 event = Dali::Integration::TouchEvent();
2957 event.AddPoint(GetPointDownInside(touchPos));
2958 application.ProcessEvent(event);
2960 // Render and notify
2961 application.SendNotification();
2962 application.Render();
2964 // Release the left selection handle.
2965 event = Dali::Integration::TouchEvent();
2966 event.AddPoint(GetPointUpInside(touchPos));
2967 application.ProcessEvent(event);
2969 // Render and notify
2970 application.SendNotification();
2971 application.Render();
2976 int utcDaliTextEditorUnderPropertyStringP(void)
2978 ToolkitTestApplication application;
2979 tet_infoline(" utcDaliTextEditorUnderPropertyStringP");
2980 TextEditor editor = TextEditor::New();
2981 DALI_TEST_CHECK(editor);
2983 std::string underlineSettings1("{\"enable\":\"true\",\"color\":\"red\",\"height\":\"1\",\"type\":\"SOLID\",\"dashWidth\":\"2\",\"dashGap\":\"1\"}");
2985 application.GetScene().Add(editor);
2987 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineSettings1);
2988 DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::UNDERLINE), underlineSettings1, TEST_LOCATION);
2990 tet_infoline("Set underline settings with a map");
2991 // Check the input underline property
2992 Property::Map underlineMapSet;
2993 Property::Map underlineMapGet;
2994 underlineMapSet.Insert("enable", true);
2995 underlineMapSet.Insert("color", Color::BLUE);
2996 underlineMapSet.Insert("height", 1);
2997 underlineMapSet.Insert("type", Text::Underline::SOLID);
2998 underlineMapSet.Insert("dashWidth", 2);
2999 underlineMapSet.Insert("dashGap", 1);
3001 editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
3002 editor.SetProperty(TextEditor::Property::TEXT, "text");
3003 underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
3004 DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
3005 DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapSet, underlineMapGet), true, TEST_LOCATION);
3007 application.SendNotification();
3008 application.Render();
3010 underlineMapSet.Clear();
3011 underlineMapGet.Clear();
3013 tet_infoline("Set dashed underline settings with a map");
3014 // Check the input underline property
3015 underlineMapSet.Clear();
3016 underlineMapGet.Clear();
3017 underlineMapSet.Insert("enable", true);
3018 underlineMapSet.Insert("color", Color::BLUE);
3019 underlineMapSet.Insert("height", 1);