Supports USER_INTERACTION_ENABLED for text components
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TextEditor.cpp
1 /*
2  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
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
24 #include <dali/devel-api/actors/actor-devel.h>
25 #include <dali/devel-api/adaptor-framework/clipboard.h>
26 #include <dali/devel-api/adaptor-framework/key-devel.h>
27 #include <dali/devel-api/text-abstraction/font-client.h>
28 #include <dali/integration-api/events/key-event-integ.h>
29 #include <dali/integration-api/events/touch-event-integ.h>
30 #include <dali/public-api/rendering/renderer.h>
31 #include <stdlib.h>
32 #include <unistd.h>
33 #include <iostream>
34 #include "test-text-geometry-utils.h"
35
36 using namespace Dali;
37 using namespace Toolkit;
38
39 void dali_texteditor_startup(void)
40 {
41   test_return_value = TET_UNDEF;
42 }
43
44 void dali_texteditor_cleanup(void)
45 {
46   test_return_value = TET_PASS;
47 }
48
49 namespace
50 {
51 const char* const PROPERTY_NAME_RENDERING_BACKEND                    = "renderingBackend";
52 const char* const PROPERTY_NAME_TEXT                                 = "text";
53 const char* const PROPERTY_NAME_TEXT_COLOR                           = "textColor";
54 const char* const PROPERTY_NAME_FONT_FAMILY                          = "fontFamily";
55 const char* const PROPERTY_NAME_FONT_STYLE                           = "fontStyle";
56 const char* const PROPERTY_NAME_POINT_SIZE                           = "pointSize";
57 const char* const PROPERTY_NAME_HORIZONTAL_ALIGNMENT                 = "horizontalAlignment";
58 const char* const PROPERTY_NAME_SCROLL_THRESHOLD                     = "scrollThreshold";
59 const char* const PROPERTY_NAME_SCROLL_SPEED                         = "scrollSpeed";
60 const char* const PROPERTY_NAME_PRIMARY_CURSOR_COLOR                 = "primaryCursorColor";
61 const char* const PROPERTY_NAME_SECONDARY_CURSOR_COLOR               = "secondaryCursorColor";
62 const char* const PROPERTY_NAME_ENABLE_CURSOR_BLINK                  = "enableCursorBlink";
63 const char* const PROPERTY_NAME_CURSOR_BLINK_INTERVAL                = "cursorBlinkInterval";
64 const char* const PROPERTY_NAME_CURSOR_BLINK_DURATION                = "cursorBlinkDuration";
65 const char* const PROPERTY_NAME_CURSOR_WIDTH                         = "cursorWidth";
66 const char* const PROPERTY_NAME_GRAB_HANDLE_IMAGE                    = "grabHandleImage";
67 const char* const PROPERTY_NAME_GRAB_HANDLE_PRESSED_IMAGE            = "grabHandlePressedImage";
68 const char* const PROPERTY_NAME_SELECTION_HANDLE_IMAGE_LEFT          = "selectionHandleImageLeft";
69 const char* const PROPERTY_NAME_SELECTION_HANDLE_IMAGE_RIGHT         = "selectionHandleImageRight";
70 const char* const PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_LEFT  = "selectionHandlePressedImageLeft";
71 const char* const PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = "selectionHandlePressedImageRight";
72 const char* const PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_LEFT   = "selectionHandleMarkerImageLeft";
73 const char* const PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_RIGHT  = "selectionHandleMarkerImageRight";
74 const char* const PROPERTY_NAME_SELECTION_HIGHLIGHT_COLOR            = "selectionHighlightColor";
75 const char* const PROPERTY_NAME_DECORATION_BOUNDING_BOX              = "decorationBoundingBox";
76 const char* const PROPERTY_NAME_ENABLE_MARKUP                        = "enableMarkup";
77 const char* const PROPERTY_NAME_INPUT_COLOR                          = "inputColor";
78 const char* const PROPERTY_NAME_INPUT_FONT_FAMILY                    = "inputFontFamily";
79 const char* const PROPERTY_NAME_INPUT_FONT_STYLE                     = "inputFontStyle";
80 const char* const PROPERTY_NAME_INPUT_POINT_SIZE                     = "inputPointSize";
81
82 const char* const PROPERTY_NAME_LINE_SPACING        = "lineSpacing";
83 const char* const PROPERTY_NAME_INPUT_LINE_SPACING  = "inputLineSpacing";
84 const char* const PROPERTY_NAME_UNDERLINE           = "underline";
85 const char* const PROPERTY_NAME_INPUT_UNDERLINE     = "inputUnderline";
86 const char* const PROPERTY_NAME_SHADOW              = "shadow";
87 const char* const PROPERTY_NAME_INPUT_SHADOW        = "inputShadow";
88 const char* const PROPERTY_NAME_EMBOSS              = "emboss";
89 const char* const PROPERTY_NAME_INPUT_EMBOSS        = "inputEmboss";
90 const char* const PROPERTY_NAME_OUTLINE             = "outline";
91 const char* const PROPERTY_NAME_INPUT_OUTLINE       = "inputOutline";
92 const char* const PROPERTY_NAME_STRIKETHROUGH       = "strikethrough";
93 const char* const PROPERTY_NAME_INPUT_STRIKETHROUGH = "inputStrikethrough";
94
95 const char* const PROPERTY_NAME_SMOOTH_SCROLL                   = "smoothScroll";
96 const char* const PROPERTY_NAME_SMOOTH_SCROLL_DURATION          = "smoothScrollDuration";
97 const char* const PROPERTY_NAME_ENABLE_SCROLL_BAR               = "enableScrollBar";
98 const char* const PROPERTY_NAME_SCROLL_BAR_SHOW_DURATION        = "scrollBarShowDuration";
99 const char* const PROPERTY_NAME_SCROLL_BAR_FADE_DURATION        = "scrollBarFadeDuration";
100 const char* const PROPERTY_NAME_PIXEL_SIZE                      = "pixelSize";
101 const char* const PROPERTY_NAME_LINE_COUNT                      = "lineCount";
102 const char* const PROPERTY_NAME_PLACEHOLDER_TEXT                = "placeholderText";
103 const char* const PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR          = "placeholderTextColor";
104 const char* const PROPERTY_NAME_ENABLE_SELECTION                = "enableSelection";
105 const char* const PROPERTY_NAME_PLACEHOLDER                     = "placeholder";
106 const char* const PROPERTY_NAME_ENABLE_SHIFT_SELECTION          = "enableShiftSelection";
107 const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE              = "enableGrabHandle";
108 const char* const PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION = "matchSystemLanguageDirection";
109 const char* const PROPERTY_NAME_MAX_LENGTH                      = "maxLength";
110 const char* const PROPERTY_NAME_FONT_SIZE_SCALE                 = "fontSizeScale";
111 const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE          = "enableFontSizeScale";
112 const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR               = "grabHandleColor";
113 const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP        = "enableGrabHandlePopup";
114 const char* const PROPERTY_NAME_INPUT_METHOD_SETTINGS           = "inputMethodSettings";
115 const char* const PROPERTY_NAME_INPUT_FILTER                    = "inputFilter";
116
117 const Vector4       PLACEHOLDER_TEXT_COLOR(0.8f, 0.8f, 0.8f, 0.8f);
118 const Dali::Vector4 LIGHT_BLUE(0.75f, 0.96f, 1.f, 1.f); // The text highlight color.
119
120 const float RENDER_FRAME_INTERVAL = 16.66f;
121
122 const unsigned int DEFAULT_FONT_SIZE = 1152u;
123 const std::string  DEFAULT_FONT_DIR("/resources/fonts");
124
125 const int KEY_A_CODE           = 38;
126 const int KEY_D_CODE           = 40;
127 const int KEY_C_CODE           = 54;
128 const int KEY_V_CODE           = 55;
129 const int KEY_X_CODE           = 53;
130 const int KEY_WHITE_SPACE_CODE = 65;
131
132 const int KEY_SHIFT_MODIFIER   = 257;
133 const int KEY_CONTROL_MODIFIER = 258;
134
135 const char* HANDLE_IMAGE_FILE_NAME           = TEST_RESOURCE_DIR "/insertpoint-icon.png";
136 const char* HANDLE_LEFT_SELECTION_FILE_NAME  = TEST_RESOURCE_DIR "/selection_handle_drop_left.png";
137 const char* HANDLE_RIGHT_SELECTION_FILE_NAME = TEST_RESOURCE_DIR "/selection_handle_drop_right.png";
138
139 const std::string DEFAULT_DEVICE_NAME("hwKeyboard");
140
141 static bool                                        gSelectionChangedCallbackCalled;
142 static uint32_t                                    oldSelectionStart;
143 static uint32_t                                    oldSelectionEnd;
144 static bool                                        gSelectionClearedCallbackCalled;
145 static bool                                        gSelectionStartedCallbackCalled;
146 static bool                                        gAnchorClickedCallBackCalled;
147 static bool                                        gAnchorClickedCallBackNotCalled;
148 static bool                                        gTextChangedCallBackCalled;
149 static bool                                        gInputFilteredAcceptedCallbackCalled;
150 static bool                                        gInputFilteredRejectedCallbackCalled;
151 static bool                                        gInputStyleChangedCallbackCalled;
152 static bool                                        gMaxCharactersCallBackCalled;
153 static bool                                        gCursorPositionChangedCallbackCalled;
154 static uint32_t                                    oldCursorPos;
155 static Dali::Toolkit::TextEditor::InputStyle::Mask gInputStyleMask;
156
157 struct CallbackFunctor
158 {
159   CallbackFunctor(bool* callbackFlag)
160   : mCallbackFlag(callbackFlag)
161   {
162   }
163
164   void operator()()
165   {
166     *mCallbackFlag = true;
167   }
168   bool* mCallbackFlag;
169 };
170
171 static void TestSelectionStartedCallback(TextEditor control)
172 {
173   tet_infoline(" TestSelectionStartedCallback");
174
175   gSelectionStartedCallbackCalled = true;
176 }
177
178 static void TestSelectionClearedCallback(TextEditor control)
179 {
180   tet_infoline(" TestSelectionClearedCallback");
181
182   gSelectionClearedCallbackCalled = true;
183 }
184
185 static void TestSelectionChangedCallback(TextEditor control, uint32_t oldStart, uint32_t oldEnd)
186 {
187   tet_infoline(" TestSelectionChangedCallback");
188
189   gSelectionChangedCallbackCalled = true;
190   oldSelectionStart               = oldStart;
191   oldSelectionEnd                 = oldEnd;
192 }
193
194 static void TestAnchorClickedCallback(TextEditor control, const char* href, unsigned int hrefLength)
195 {
196   tet_infoline(" TestAnchorClickedCallback");
197
198   gAnchorClickedCallBackNotCalled = false;
199
200   if(!strcmp(href, "https://www.tizen.org") && hrefLength == strlen(href))
201   {
202     gAnchorClickedCallBackCalled = true;
203   }
204 }
205
206 static void TestCursorPositionChangedCallback(TextEditor control, unsigned int oldPos)
207 {
208   tet_infoline(" TestCursorPositionChangedCallback");
209
210   gCursorPositionChangedCallbackCalled = true;
211   oldCursorPos                         = oldPos;
212 }
213
214 static void TestTextChangedCallback(TextEditor control)
215 {
216   tet_infoline(" TestTextChangedCallback");
217
218   gTextChangedCallBackCalled = true;
219 }
220
221 static void TestInputStyleChangedCallback(TextEditor control, TextEditor::InputStyle::Mask mask)
222 {
223   tet_infoline(" TestInputStyleChangedCallback");
224
225   gInputStyleChangedCallbackCalled = true;
226   gInputStyleMask                  = mask;
227 }
228
229 static void TestMaxLengthReachedCallback(TextEditor control)
230 {
231   tet_infoline(" TestMaxLengthReachedCallback");
232
233   gMaxCharactersCallBackCalled = true;
234 }
235
236 static void TestInputFilteredCallback(TextEditor control, Toolkit::InputFilter::Property::Type type)
237 {
238   tet_infoline(" TestInputFilteredCallback");
239
240   if(type == Toolkit::InputFilter::Property::ACCEPTED)
241   {
242     gInputFilteredAcceptedCallbackCalled = true;
243   }
244   else if(type == Toolkit::InputFilter::Property::REJECTED)
245   {
246     gInputFilteredRejectedCallbackCalled = true;
247   }
248 }
249
250 // Generate a KeyEvent to send to Core.
251 Integration::KeyEvent GenerateKey(const std::string&                  keyName,
252                                   const std::string&                  logicalKey,
253                                   const std::string&                  keyString,
254                                   int                                 keyCode,
255                                   int                                 keyModifier,
256                                   unsigned long                       timeStamp,
257                                   const Integration::KeyEvent::State& keyState,
258                                   const std::string&                  compose        = "",
259                                   const std::string&                  deviceName     = DEFAULT_DEVICE_NAME,
260                                   const Device::Class::Type&          deviceClass    = Device::Class::NONE,
261                                   const Device::Subclass::Type&       deviceSubclass = Device::Subclass::NONE)
262 {
263   return Integration::KeyEvent(keyName,
264                                logicalKey,
265                                keyString,
266                                keyCode,
267                                keyModifier,
268                                timeStamp,
269                                keyState,
270                                compose,
271                                deviceName,
272                                deviceClass,
273                                deviceSubclass);
274 }
275
276 Dali::Integration::Point GetPointDownInside(Vector2& pos)
277 {
278   Dali::Integration::Point point;
279   point.SetState(PointState::DOWN);
280   point.SetScreenPosition(pos);
281   return point;
282 }
283
284 Dali::Integration::Point GetPointUpInside(Vector2& pos)
285 {
286   Dali::Integration::Point point;
287   point.SetState(PointState::UP);
288   point.SetScreenPosition(pos);
289   return point;
290 }
291
292 bool DaliTestCheckMaps(const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet)
293 {
294   if(fontStyleMapGet.Count() == fontStyleMapSet.Count())
295   {
296     for(unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index)
297     {
298       const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue(index);
299
300       Property::Value* valueSet = NULL;
301       if(valueGet.first.type == Property::Key::INDEX)
302       {
303         valueSet = fontStyleMapSet.Find(valueGet.first.indexKey);
304       }
305       else
306       {
307         // Get Key is a string so searching Set Map for a string key
308         valueSet = fontStyleMapSet.Find(valueGet.first.stringKey);
309       }
310
311       if(NULL != valueSet)
312       {
313         if(valueSet->GetType() == Dali::Property::STRING && (valueGet.second.Get<std::string>() != valueSet->Get<std::string>()))
314         {
315           tet_printf("Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str());
316           return false;
317         }
318         else if(valueSet->GetType() == Dali::Property::BOOLEAN && (valueGet.second.Get<bool>() != valueSet->Get<bool>()))
319         {
320           tet_printf("Value got : [%d], expected : [%d]", valueGet.second.Get<bool>(), valueSet->Get<bool>());
321           return false;
322         }
323         else if(valueSet->GetType() == Dali::Property::INTEGER && (valueGet.second.Get<int>() != valueSet->Get<int>()))
324         {
325           tet_printf("Value got : [%d], expected : [%d]", valueGet.second.Get<int>(), valueSet->Get<int>());
326           return false;
327         }
328         else if(valueSet->GetType() == Dali::Property::FLOAT && (valueGet.second.Get<float>() != valueSet->Get<float>()))
329         {
330           tet_printf("Value got : [%f], expected : [%f]", valueGet.second.Get<float>(), valueSet->Get<float>());
331           return false;
332         }
333         else if(valueSet->GetType() == Dali::Property::VECTOR2 && (valueGet.second.Get<Vector2>() != valueSet->Get<Vector2>()))
334         {
335           Vector2 vector2Get = valueGet.second.Get<Vector2>();
336           Vector2 vector2Set = valueSet->Get<Vector2>();
337           tet_printf("Value got : [%f, %f], expected : [%f, %f]", vector2Get.x, vector2Get.y, vector2Set.x, vector2Set.y);
338           return false;
339         }
340         else if(valueSet->GetType() == Dali::Property::VECTOR4 && (valueGet.second.Get<Vector4>() != valueSet->Get<Vector4>()))
341         {
342           Vector4 vector4Get = valueGet.second.Get<Vector4>();
343           Vector4 vector4Set = valueSet->Get<Vector4>();
344           tet_printf("Value got : [%f, %f, %f, %f], expected : [%f, %f, %f, %f]", vector4Get.r, vector4Get.g, vector4Get.b, vector4Get.a, vector4Set.r, vector4Set.g, vector4Set.b, vector4Set.a);
345           return false;
346         }
347       }
348       else
349       {
350         if(valueGet.first.type == Property::Key::INDEX)
351         {
352           tet_printf("  The key %d doesn't exist.", valueGet.first.indexKey);
353         }
354         else
355         {
356           tet_printf("  The key %s doesn't exist.", valueGet.first.stringKey.c_str());
357         }
358         return false;
359       }
360     }
361   }
362
363   return true;
364 }
365
366 class ScrollStateChangeCallback : public Dali::ConnectionTracker
367 {
368 public:
369   ScrollStateChangeCallback(bool& startedCalled, bool& finishedCalled)
370   : mStartedCalled(startedCalled),
371     mFinishedCalled(finishedCalled)
372   {
373   }
374
375   void Callback(TextEditor editor, TextEditor::Scroll::Type type)
376   {
377     if(type == TextEditor::Scroll::STARTED)
378     {
379       mStartedCalled = true;
380     }
381     else if(type == TextEditor::Scroll::FINISHED)
382     {
383       mFinishedCalled = true;
384     }
385   }
386
387   bool& mStartedCalled;
388   bool& mFinishedCalled;
389 };
390
391 } // namespace
392
393 int UtcDaliToolkitTextEditorConstructorP(void)
394 {
395   ToolkitTestApplication application;
396   tet_infoline(" UtcDaliToolkitTextEditorConstructorP");
397   TextEditor textEditor;
398   DALI_TEST_CHECK(!textEditor);
399   END_TEST;
400 }
401
402 int UtcDaliToolkitTextEditorNewP(void)
403 {
404   ToolkitTestApplication application;
405   tet_infoline(" UtcDaliToolkitTextEditorNewP");
406   TextEditor textEditor = TextEditor::New();
407   DALI_TEST_CHECK(textEditor);
408   END_TEST;
409 }
410
411 int UtcDaliToolkitTextEditorDownCastP(void)
412 {
413   ToolkitTestApplication application;
414   tet_infoline(" UtcDaliToolkitTextEditorDownCastP");
415   TextEditor textEditor1 = TextEditor::New();
416   BaseHandle object(textEditor1);
417
418   TextEditor textEditor2 = TextEditor::DownCast(object);
419   DALI_TEST_CHECK(textEditor2);
420
421   TextEditor textEditor3 = DownCast<TextEditor>(object);
422   DALI_TEST_CHECK(textEditor3);
423   END_TEST;
424 }
425
426 int UtcDaliToolkitTextEditorDownCastN(void)
427 {
428   ToolkitTestApplication application;
429   tet_infoline(" UtcDaliToolkitTextEditorDownCastN");
430   BaseHandle uninitializedObject;
431   TextEditor textEditor1 = TextEditor::DownCast(uninitializedObject);
432   DALI_TEST_CHECK(!textEditor1);
433
434   TextEditor textEditor2 = DownCast<TextEditor>(uninitializedObject);
435   DALI_TEST_CHECK(!textEditor2);
436   END_TEST;
437 }
438
439 int UtcDaliToolkitTextEditorCopyConstructorP(void)
440 {
441   ToolkitTestApplication application;
442   tet_infoline(" UtcDaliToolkitTextEditorCopyConstructorP");
443   TextEditor textEditor = TextEditor::New();
444   textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
445
446   TextEditor copy(textEditor);
447   DALI_TEST_CHECK(copy);
448   DALI_TEST_CHECK(copy.GetProperty<std::string>(TextEditor::Property::TEXT) == textEditor.GetProperty<std::string>(TextEditor::Property::TEXT));
449   END_TEST;
450 }
451
452 int UtcDaliTextEditorMoveConstructor(void)
453 {
454   ToolkitTestApplication application;
455
456   TextEditor textEditor = TextEditor::New();
457   textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
458   DALI_TEST_CHECK(textEditor.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
459
460   TextEditor moved = std::move(textEditor);
461   DALI_TEST_CHECK(moved);
462   DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
463   DALI_TEST_CHECK(moved.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
464   DALI_TEST_CHECK(!textEditor);
465
466   END_TEST;
467 }
468
469 int UtcDaliToolkitTextEditorAssignmentOperatorP(void)
470 {
471   ToolkitTestApplication application;
472   tet_infoline(" UtcDaliToolkitTextEditorAssignmentOperatorP");
473   TextEditor textEditor = TextEditor::New();
474   textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
475
476   TextEditor copy = textEditor;
477   DALI_TEST_CHECK(copy);
478   DALI_TEST_CHECK(copy.GetProperty<std::string>(TextEditor::Property::TEXT) == textEditor.GetProperty<std::string>(TextEditor::Property::TEXT));
479   END_TEST;
480 }
481
482 int UtcDaliTextEditorMoveAssignment(void)
483 {
484   ToolkitTestApplication application;
485
486   TextEditor textEditor = TextEditor::New();
487   textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
488   DALI_TEST_CHECK(textEditor.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
489
490   TextEditor moved;
491   moved = std::move(textEditor);
492   DALI_TEST_CHECK(moved);
493   DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
494   DALI_TEST_CHECK(moved.GetProperty<std::string>(TextEditor::Property::TEXT) == "Test");
495   DALI_TEST_CHECK(!textEditor);
496
497   END_TEST;
498 }
499
500 int UtcDaliTextEditorNewP(void)
501 {
502   ToolkitTestApplication application;
503   tet_infoline(" UtcDaliToolkitTextEditorNewP");
504   TextEditor textEditor = TextEditor::New();
505   DALI_TEST_CHECK(textEditor);
506   END_TEST;
507 }
508
509 // Positive test case for a method
510 int UtcDaliTextEditorGetPropertyP(void)
511 {
512   ToolkitTestApplication application;
513   tet_infoline(" UtcDaliToolkitTextEditorGetPropertyP");
514   TextEditor editor = TextEditor::New();
515   DALI_TEST_CHECK(editor);
516
517   // Check Property Indices are correct
518   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_RENDERING_BACKEND) == DevelTextEditor::Property::RENDERING_BACKEND);
519   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_TEXT) == TextEditor::Property::TEXT);
520   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_TEXT_COLOR) == TextEditor::Property::TEXT_COLOR);
521   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_FONT_FAMILY) == TextEditor::Property::FONT_FAMILY);
522   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_FONT_STYLE) == TextEditor::Property::FONT_STYLE);
523   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_POINT_SIZE) == TextEditor::Property::POINT_SIZE);
524   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_HORIZONTAL_ALIGNMENT) == TextEditor::Property::HORIZONTAL_ALIGNMENT);
525   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_THRESHOLD) == TextEditor::Property::SCROLL_THRESHOLD);
526   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_SPEED) == TextEditor::Property::SCROLL_SPEED);
527   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PRIMARY_CURSOR_COLOR) == TextEditor::Property::PRIMARY_CURSOR_COLOR);
528   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SECONDARY_CURSOR_COLOR) == TextEditor::Property::SECONDARY_CURSOR_COLOR);
529   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_CURSOR_BLINK) == TextEditor::Property::ENABLE_CURSOR_BLINK);
530   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_CURSOR_BLINK_INTERVAL) == TextEditor::Property::CURSOR_BLINK_INTERVAL);
531   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_CURSOR_BLINK_DURATION) == TextEditor::Property::CURSOR_BLINK_DURATION);
532   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_CURSOR_WIDTH) == TextEditor::Property::CURSOR_WIDTH);
533   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_GRAB_HANDLE_IMAGE) == TextEditor::Property::GRAB_HANDLE_IMAGE);
534   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_GRAB_HANDLE_PRESSED_IMAGE) == TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE);
535   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_IMAGE_LEFT) == TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT);
536   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_IMAGE_RIGHT) == TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT);
537   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_LEFT) == TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT);
538   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT) == TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT);
539   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_LEFT) == TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT);
540   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_RIGHT) == TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT);
541   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_HIGHLIGHT_COLOR) == TextEditor::Property::SELECTION_HIGHLIGHT_COLOR);
542   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_DECORATION_BOUNDING_BOX) == TextEditor::Property::DECORATION_BOUNDING_BOX);
543   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_MARKUP) == TextEditor::Property::ENABLE_MARKUP);
544   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_COLOR) == TextEditor::Property::INPUT_COLOR);
545   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_FONT_FAMILY) == TextEditor::Property::INPUT_FONT_FAMILY);
546   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_FONT_STYLE) == TextEditor::Property::INPUT_FONT_STYLE);
547   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_POINT_SIZE) == TextEditor::Property::INPUT_POINT_SIZE);
548
549   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_LINE_SPACING) == TextEditor::Property::LINE_SPACING);
550   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_LINE_SPACING) == TextEditor::Property::INPUT_LINE_SPACING);
551   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_UNDERLINE) == TextEditor::Property::UNDERLINE);
552   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_UNDERLINE) == TextEditor::Property::INPUT_UNDERLINE);
553   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SHADOW) == TextEditor::Property::SHADOW);
554   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_SHADOW) == TextEditor::Property::INPUT_SHADOW);
555   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_EMBOSS) == TextEditor::Property::EMBOSS);
556   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_EMBOSS) == TextEditor::Property::INPUT_EMBOSS);
557   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_OUTLINE) == TextEditor::Property::OUTLINE);
558   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_OUTLINE) == TextEditor::Property::INPUT_OUTLINE);
559   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextEditor::Property::STRIKETHROUGH);
560   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_STRIKETHROUGH) == DevelTextEditor::Property::INPUT_STRIKETHROUGH);
561   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SMOOTH_SCROLL) == TextEditor::Property::SMOOTH_SCROLL);
562   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SMOOTH_SCROLL_DURATION) == TextEditor::Property::SMOOTH_SCROLL_DURATION);
563   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_SCROLL_BAR) == TextEditor::Property::ENABLE_SCROLL_BAR);
564   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_BAR_SHOW_DURATION) == TextEditor::Property::SCROLL_BAR_SHOW_DURATION);
565   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SCROLL_BAR_FADE_DURATION) == TextEditor::Property::SCROLL_BAR_FADE_DURATION);
566   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PIXEL_SIZE) == TextEditor::Property::PIXEL_SIZE);
567   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_LINE_COUNT) == TextEditor::Property::LINE_COUNT);
568   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_SELECTION) == TextEditor::Property::ENABLE_SELECTION);
569   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PLACEHOLDER) == TextEditor::Property::PLACEHOLDER);
570   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_FONT_SIZE_SCALE) == DevelTextEditor::Property::FONT_SIZE_SCALE);
571   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE) == DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE);
572   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PLACEHOLDER_TEXT) == DevelTextEditor::Property::PLACEHOLDER_TEXT);
573   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR) == DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR);
574   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_SHIFT_SELECTION) == DevelTextEditor::Property::ENABLE_SHIFT_SELECTION);
575   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_GRAB_HANDLE) == DevelTextEditor::Property::ENABLE_GRAB_HANDLE);
576   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION) == DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION);
577   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_MAX_LENGTH) == DevelTextEditor::Property::MAX_LENGTH);
578   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_GRAB_HANDLE_COLOR) == DevelTextEditor::Property::GRAB_HANDLE_COLOR);
579   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP) == DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP);
580   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_METHOD_SETTINGS) == DevelTextEditor::Property::INPUT_METHOD_SETTINGS);
581   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_FILTER) == DevelTextEditor::Property::INPUT_FILTER);
582   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextEditor::Property::STRIKETHROUGH);
583   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_STRIKETHROUGH) == DevelTextEditor::Property::INPUT_STRIKETHROUGH);
584
585   END_TEST;
586 }
587
588 bool SetPropertyMapRetrieved(TextEditor& editor, const Property::Index property, const std::string mapKey, const std::string mapValue)
589 {
590   bool          result = false;
591   Property::Map imageMap;
592   imageMap[mapKey] = mapValue;
593
594   editor.SetProperty(property, imageMap);
595   Property::Value propValue = editor.GetProperty(property);
596   Property::Map*  resultMap = propValue.GetMap();
597
598   if(resultMap->Find(mapKey)->Get<std::string>() == mapValue)
599   {
600     result = true;
601   }
602
603   return result;
604 }
605
606 // Positive test case for a method
607 int UtcDaliTextEditorSetPropertyP(void)
608 {
609   ToolkitTestApplication application;
610   tet_infoline(" UtcDaliToolkitTextEditorSetPropertyP");
611   TextEditor editor = TextEditor::New();
612   DALI_TEST_CHECK(editor);
613   application.GetScene().Add(editor);
614
615   // Note - we can't check the defaults since the stylesheets are platform-specific
616
617   // Check the render backend property.
618   editor.SetProperty(DevelTextEditor::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS);
619   DALI_TEST_EQUALS((DevelText::RenderingType)editor.GetProperty<int>(DevelTextEditor::Property::RENDERING_BACKEND), DevelText::RENDERING_SHARED_ATLAS, TEST_LOCATION);
620
621   // Check text property.
622   editor.SetProperty(TextEditor::Property::TEXT, "Setting Text");
623   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("Setting Text"), TEST_LOCATION);
624
625   // Check text's color property
626   editor.SetProperty(TextEditor::Property::TEXT_COLOR, Color::WHITE);
627   DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::TEXT_COLOR), Color::WHITE, TEST_LOCATION);
628
629   // Check font properties.
630   editor.SetProperty(TextEditor::Property::FONT_FAMILY, "Setting font family");
631   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::FONT_FAMILY), std::string("Setting font family"), TEST_LOCATION);
632
633   Property::Map    fontStyleMapSet;
634   Property::Map    fontStyleMapGet;
635   Property::Value* slantValue = NULL;
636
637   fontStyleMapSet.Insert("weight", "bold");
638   fontStyleMapSet.Insert("width", "condensed");
639   fontStyleMapSet.Insert("slant", "italic");
640
641   editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
642   fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
643   DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
644   DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
645
646   editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
647   DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::POINT_SIZE), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
648
649   editor.SetProperty(DevelTextEditor::Property::FONT_SIZE_SCALE, 2.5f);
650   DALI_TEST_EQUALS(editor.GetProperty<float>(DevelTextEditor::Property::FONT_SIZE_SCALE), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
651   editor.SetProperty(DevelTextEditor::Property::FONT_SIZE_SCALE, 1.0f);
652
653   editor.SetProperty(DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, false);
654   DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE), false, TEST_LOCATION);
655   editor.SetProperty(DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, true);
656
657   // Reset font style.
658   fontStyleMapSet.Clear();
659   fontStyleMapSet.Insert("weight", "normal");
660   fontStyleMapSet.Insert("slant", "oblique");
661   editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
662   fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
663   DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
664   DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
665
666   fontStyleMapSet.Clear();
667   fontStyleMapSet.Insert("slant", "roman");
668   editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
669   fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
670
671   // Replace 'roman' for 'normal'.
672   slantValue = fontStyleMapGet.Find("slant");
673   if(NULL != slantValue)
674   {
675     if("normal" == slantValue->Get<std::string>())
676     {
677       fontStyleMapGet["slant"] = "roman";
678     }
679   }
680   DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
681   DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
682
683   fontStyleMapSet.Clear();
684
685   editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
686   fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::FONT_STYLE);
687   DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
688   DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
689
690   // Check that the Alignment properties can be correctly set
691   editor.SetProperty(TextEditor::Property::HORIZONTAL_ALIGNMENT, "END");
692   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::HORIZONTAL_ALIGNMENT), "END", TEST_LOCATION);
693
694   // Check scroll properties.
695   editor.SetProperty(TextEditor::Property::SCROLL_THRESHOLD, 1.f);
696   DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_THRESHOLD), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
697   editor.SetProperty(TextEditor::Property::SCROLL_SPEED, 100.f);
698   DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_SPEED), 100.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
699
700   // Check cursor properties
701   editor.SetProperty(TextEditor::Property::PRIMARY_CURSOR_COLOR, Color::RED);
702   DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::PRIMARY_CURSOR_COLOR), Color::RED, TEST_LOCATION);
703   editor.SetProperty(TextEditor::Property::SECONDARY_CURSOR_COLOR, Color::BLUE);
704   DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::SECONDARY_CURSOR_COLOR), Color::BLUE, TEST_LOCATION);
705
706   editor.SetProperty(TextEditor::Property::ENABLE_CURSOR_BLINK, false);
707   DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_CURSOR_BLINK), false, TEST_LOCATION);
708   editor.SetProperty(TextEditor::Property::CURSOR_BLINK_INTERVAL, 1.f);
709   DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::CURSOR_BLINK_INTERVAL), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
710   editor.SetProperty(TextEditor::Property::CURSOR_BLINK_DURATION, 10.f);
711   DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::CURSOR_BLINK_DURATION), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
712   editor.SetProperty(TextEditor::Property::CURSOR_WIDTH, 1);
713   DALI_TEST_EQUALS(editor.GetProperty<int>(TextEditor::Property::CURSOR_WIDTH), 1, TEST_LOCATION);
714
715   // Check handle images
716   editor.SetProperty(TextEditor::Property::GRAB_HANDLE_IMAGE, "image1");
717   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::GRAB_HANDLE_IMAGE), "image1", TEST_LOCATION);
718   editor.SetProperty(TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE, "image2");
719   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE), "image2", TEST_LOCATION);
720   editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, "image3");
721
722   // Check handle images
723   DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, "filename", "leftHandleImage"));
724   DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT, "filename", "rightHandleImage"));
725   DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT, "filename", "leftHandleImagePressed"));
726   DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, "filename", "rightHandleImagePressed"));
727   DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT, "filename", "leftHandleMarkerImage"));
728   DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT, "filename", "rightHandleMarkerImage"));
729
730   // Check the highlight color
731   editor.SetProperty(TextEditor::Property::SELECTION_HIGHLIGHT_COLOR, Color::GREEN);
732   DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::SELECTION_HIGHLIGHT_COLOR), Color::GREEN, TEST_LOCATION);
733
734   // Decoration bounding box
735   editor.SetProperty(TextEditor::Property::DECORATION_BOUNDING_BOX, Rect<int>(0, 0, 1, 1));
736   DALI_TEST_EQUALS(editor.GetProperty<Rect<int> >(TextEditor::Property::DECORATION_BOUNDING_BOX), Rect<int>(0, 0, 1, 1), TEST_LOCATION);
737
738   // Check the enable markup property.
739   DALI_TEST_CHECK(!editor.GetProperty<bool>(TextEditor::Property::ENABLE_MARKUP));
740   editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
741   DALI_TEST_CHECK(editor.GetProperty<bool>(TextEditor::Property::ENABLE_MARKUP));
742
743   // Check input color property.
744   editor.SetProperty(TextEditor::Property::INPUT_COLOR, Color::YELLOW);
745   DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::INPUT_COLOR), Color::YELLOW, TEST_LOCATION);
746
747   // Check input font properties.
748   editor.SetProperty(TextEditor::Property::INPUT_FONT_FAMILY, "Setting input font family");
749   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_FONT_FAMILY), "Setting input font family", TEST_LOCATION);
750
751   fontStyleMapSet.Clear();
752   fontStyleMapSet.Insert("weight", "bold");
753   fontStyleMapSet.Insert("width", "condensed");
754   fontStyleMapSet.Insert("slant", "italic");
755
756   editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
757   fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
758   DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
759   DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
760
761   editor.SetProperty(TextEditor::Property::INPUT_POINT_SIZE, 12.f);
762   DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::INPUT_POINT_SIZE), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
763
764   // Reset input font style.
765   fontStyleMapSet.Clear();
766   fontStyleMapSet.Insert("weight", "normal");
767   fontStyleMapSet.Insert("slant", "oblique");
768
769   editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
770   fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
771   DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
772   DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
773
774   fontStyleMapSet.Clear();
775   fontStyleMapSet.Insert("slant", "roman");
776
777   editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
778   fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
779
780   // Replace 'roman' for 'normal'.
781   slantValue = fontStyleMapGet.Find("slant");
782   if(NULL != slantValue)
783   {
784     if("normal" == slantValue->Get<std::string>())
785     {
786       fontStyleMapGet["slant"] = "roman";
787     }
788   }
789   DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
790   DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
791
792   fontStyleMapSet.Clear();
793
794   editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
795   fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
796   DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
797   DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
798
799   // Check the line spacing property
800   DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::LINE_SPACING), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
801   editor.SetProperty(TextEditor::Property::LINE_SPACING, 10.f);
802   DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::LINE_SPACING), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
803
804   // Check the input line spacing property
805   DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::INPUT_LINE_SPACING), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
806   editor.SetProperty(TextEditor::Property::INPUT_LINE_SPACING, 20.f);
807   DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::INPUT_LINE_SPACING), 20.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
808
809   // Check the underline property
810
811   Property::Map underlineMapSet;
812   Property::Map underlineMapGet;
813
814   underlineMapSet.Insert("enable", true);
815   underlineMapSet.Insert("color", Color::RED);
816   underlineMapSet.Insert("height", 1);
817   underlineMapSet.Insert("type", Text::Underline::SOLID);
818   underlineMapSet.Insert("dashWidth", 5);
819   underlineMapSet.Insert("dashGap", 3);
820
821   editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
822
823   underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
824   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
825   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
826
827   application.SendNotification();
828   application.Render();
829
830   // Check the dashed underline property
831
832   underlineMapSet.Clear();
833   underlineMapGet.Clear();
834
835   underlineMapSet.Insert("enable", true);
836   underlineMapSet.Insert("color", Color::RED);
837   underlineMapSet.Insert("height", 1);
838   underlineMapSet.Insert("type", Text::Underline::DASHED);
839   underlineMapSet.Insert("dashWidth", 5);
840   underlineMapSet.Insert("dashGap", 3);
841
842   editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
843
844   underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
845   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
846   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
847
848   application.SendNotification();
849   application.Render();
850
851   underlineMapSet.Clear();
852   underlineMapGet.Clear();
853
854   // Check the double underline property
855
856   underlineMapSet.Clear();
857   underlineMapGet.Clear();
858
859   underlineMapSet.Insert("enable", true);
860   underlineMapSet.Insert("color", Color::RED);
861   underlineMapSet.Insert("height", 1);
862   underlineMapSet.Insert("type", Text::Underline::DOUBLE);
863   underlineMapSet.Insert("dashWidth", 5);
864   underlineMapSet.Insert("dashGap", 3);
865
866   editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
867
868   underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
869   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
870   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
871
872   application.SendNotification();
873   application.Render();
874
875   underlineMapSet.Clear();
876   underlineMapGet.Clear();
877
878   // Check the input underline property
879   editor.SetProperty(TextEditor::Property::INPUT_UNDERLINE, "Underline input properties");
880   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_UNDERLINE), std::string("Underline input properties"), TEST_LOCATION);
881
882   // Check the shadow property
883   Property::Map shadowMapSet;
884   Property::Map shadowMapGet;
885
886   shadowMapSet.Insert("color", Color::GREEN);
887   shadowMapSet.Insert("offset", Vector2(2.0f, 2.0f));
888   shadowMapSet.Insert("blurRadius", 3.0f);
889
890   editor.SetProperty(TextEditor::Property::SHADOW, shadowMapSet);
891
892   shadowMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::SHADOW);
893   DALI_TEST_EQUALS(shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION);
894   DALI_TEST_EQUALS(DaliTestCheckMaps(shadowMapGet, shadowMapSet), true, TEST_LOCATION);
895
896   // Check the input shadow property
897   editor.SetProperty(TextEditor::Property::INPUT_SHADOW, "Shadow input properties");
898   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_SHADOW), std::string("Shadow input properties"), TEST_LOCATION);
899
900   // Check the emboss property
901   editor.SetProperty(TextEditor::Property::EMBOSS, "Emboss properties");
902   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::EMBOSS), std::string("Emboss properties"), TEST_LOCATION);
903
904   // Check the input emboss property
905   editor.SetProperty(TextEditor::Property::INPUT_EMBOSS, "Emboss input properties");
906   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_EMBOSS), std::string("Emboss input properties"), TEST_LOCATION);
907
908   // Check the outline property
909
910   // Test string type first
911   // This is purely to maintain backward compatibility, but we don't support string as the outline property type.
912   editor.SetProperty(TextEditor::Property::OUTLINE, "Outline properties");
913   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::OUTLINE), std::string("Outline properties"), TEST_LOCATION);
914
915   // Then test the property map type
916   Property::Map outlineMapSet;
917   Property::Map outlineMapGet;
918
919   outlineMapSet["color"] = Color::RED;
920   outlineMapSet["width"] = 2.0f;
921
922   editor.SetProperty(TextEditor::Property::OUTLINE, outlineMapSet);
923
924   outlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::OUTLINE);
925   DALI_TEST_EQUALS(outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION);
926   DALI_TEST_EQUALS(DaliTestCheckMaps(outlineMapGet, outlineMapSet), true, TEST_LOCATION);
927
928   // Check the input outline property
929   editor.SetProperty(TextEditor::Property::INPUT_OUTLINE, "Outline input properties");
930   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::INPUT_OUTLINE), std::string("Outline input properties"), TEST_LOCATION);
931
932   // Check the smooth scroll property
933   DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::SMOOTH_SCROLL), false, TEST_LOCATION);
934   editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL, true);
935   DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::SMOOTH_SCROLL), true, TEST_LOCATION);
936
937   // Check the smooth scroll duration property
938   editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.2f);
939   DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SMOOTH_SCROLL_DURATION), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
940
941   // Check the scroll bar property
942   DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SCROLL_BAR), false, TEST_LOCATION);
943   editor.SetProperty(TextEditor::Property::ENABLE_SCROLL_BAR, true);
944   DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SCROLL_BAR), true, TEST_LOCATION);
945
946   editor.SetProperty(TextEditor::Property::SCROLL_BAR_SHOW_DURATION, 0.3f);
947   DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_SHOW_DURATION), 0.3f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
948   editor.SetProperty(TextEditor::Property::SCROLL_BAR_FADE_DURATION, 0.2f);
949   DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_FADE_DURATION), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
950
951   // Check the pixel size of font
952   editor.SetProperty(TextEditor::Property::PIXEL_SIZE, 20.f);
953   DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::PIXEL_SIZE), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
954
955   // Check placeholder text properties.
956   editor.SetProperty(DevelTextEditor::Property::PLACEHOLDER_TEXT, "Setting Placeholder Text");
957   DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::PLACEHOLDER_TEXT), std::string("Setting Placeholder Text"), TEST_LOCATION);
958
959   // Check placeholder text's color property.
960   editor.SetProperty(DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR, Color::RED);
961   DALI_TEST_EQUALS(editor.GetProperty<Vector4>(DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR), Color::RED, TEST_LOCATION);
962
963   // Check the enable selection property
964   editor.SetProperty(TextEditor::Property::ENABLE_SELECTION, false);
965   DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SELECTION), false, TEST_LOCATION);
966
967   // Check the placeholder property with pixel size
968   Property::Map placeholderPixelSizeMapSet;
969   Property::Map placeholderPixelSizeMapGet;
970   Property::Map placeholderFontstyleMap;
971   placeholderPixelSizeMapSet["text"]        = "Setting Placeholder Text";
972   placeholderPixelSizeMapSet["textFocused"] = "Setting Placeholder Text Focused";
973   placeholderPixelSizeMapSet["color"]       = Color::BLUE;
974   placeholderPixelSizeMapSet["fontFamily"]  = "Arial";
975   placeholderPixelSizeMapSet["pixelSize"]   = 15.0f;
976
977   placeholderFontstyleMap.Insert("weight", "bold");
978   placeholderPixelSizeMapSet["fontStyle"] = placeholderFontstyleMap;
979   editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderPixelSizeMapSet);
980
981   placeholderPixelSizeMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
982   DALI_TEST_EQUALS(placeholderPixelSizeMapGet.Count(), placeholderPixelSizeMapSet.Count(), TEST_LOCATION);
983
984   tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value");
985   Property::Map placeholderConversionMap;
986   placeholderConversionMap[Text::PlaceHolder::Property::TEXT]         = placeholderPixelSizeMapSet["text"];
987   placeholderConversionMap[Text::PlaceHolder::Property::TEXT_FOCUSED] = placeholderPixelSizeMapSet["textFocused"];
988   placeholderConversionMap[Text::PlaceHolder::Property::COLOR]        = placeholderPixelSizeMapSet["color"];
989   placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE]   = placeholderPixelSizeMapSet["fontStyle"];
990   placeholderConversionMap[Text::PlaceHolder::Property::FONT_FAMILY]  = placeholderPixelSizeMapSet["fontFamily"];
991   placeholderConversionMap[Text::PlaceHolder::Property::PIXEL_SIZE]   = placeholderPixelSizeMapSet["pixelSize"];
992
993   DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderPixelSizeMapGet, placeholderConversionMap), true, TEST_LOCATION);
994
995   // Check the placeholder property with point size
996   Property::Map placeholderMapSet;
997   Property::Map placeholderMapGet;
998   placeholderMapSet["text"]        = "Setting Placeholder Text";
999   placeholderMapSet["textFocused"] = "Setting Placeholder Text Focused";
1000   placeholderMapSet["color"]       = Color::RED;
1001   placeholderMapSet["fontFamily"]  = "Arial";
1002   placeholderMapSet["pointSize"]   = 12.0f;
1003   // Check the placeholder font style property
1004   placeholderFontstyleMap.Clear();
1005
1006   placeholderFontstyleMap.Insert("weight", "bold");
1007   placeholderFontstyleMap.Insert("width", "condensed");
1008   placeholderFontstyleMap.Insert("slant", "italic");
1009   placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1010   editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1011
1012   placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1013   DALI_TEST_EQUALS(placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION);
1014
1015   tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value");
1016   placeholderConversionMap.Clear();
1017   placeholderConversionMap[Text::PlaceHolder::Property::TEXT]         = placeholderMapSet["text"];
1018   placeholderConversionMap[Text::PlaceHolder::Property::TEXT_FOCUSED] = placeholderMapSet["textFocused"];
1019   placeholderConversionMap[Text::PlaceHolder::Property::COLOR]        = placeholderMapSet["color"];
1020   placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE]   = placeholderPixelSizeMapSet["fontStyle"];
1021   placeholderConversionMap[Text::PlaceHolder::Property::FONT_FAMILY]  = placeholderMapSet["fontFamily"];
1022   placeholderConversionMap[Text::PlaceHolder::Property::POINT_SIZE]   = placeholderMapSet["pointSize"];
1023   DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderMapGet, placeholderConversionMap), true, TEST_LOCATION);
1024
1025   // Reset font style.
1026   placeholderFontstyleMap.Clear();
1027   placeholderFontstyleMap.Insert("weight", "normal");
1028   placeholderFontstyleMap.Insert("slant", "oblique");
1029   placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1030   editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1031
1032   placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1033   DALI_TEST_EQUALS(placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION);
1034   placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderMapSet["fontStyle"];
1035   DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderMapGet, placeholderConversionMap), true, TEST_LOCATION);
1036
1037   placeholderFontstyleMap.Clear();
1038   placeholderFontstyleMap.Insert("slant", "roman");
1039   placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1040   editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1041
1042   placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1043
1044   placeholderFontstyleMap.Clear();
1045   placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
1046
1047   editor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
1048   placeholderMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::PLACEHOLDER);
1049   DALI_TEST_EQUALS(placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION);
1050   placeholderConversionMap[Text::PlaceHolder::Property::FONT_STYLE] = placeholderMapSet["fontStyle"];
1051   DALI_TEST_EQUALS(DaliTestCheckMaps(placeholderMapGet, placeholderConversionMap), true, TEST_LOCATION);
1052
1053   editor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
1054   DALI_TEST_EQUALS(editor.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
1055
1056   // Check handle color
1057   editor.SetProperty(DevelTextEditor::Property::GRAB_HANDLE_COLOR, Color::GREEN);
1058   DALI_TEST_EQUALS(editor.GetProperty<Vector4>(DevelTextEditor::Property::GRAB_HANDLE_COLOR), Color::GREEN, TEST_LOCATION);
1059
1060   // Test the ENABLE_GRAB_HANDLE_POPUP property
1061   editor.SetProperty(DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP, false);
1062   DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP), false, TEST_LOCATION);
1063
1064   // Check the input method setting
1065   Property::Map                   propertyMap;
1066   InputMethod::PanelLayout::Type  panelLayout    = InputMethod::PanelLayout::NUMBER;
1067   InputMethod::AutoCapital::Type  autoCapital    = InputMethod::AutoCapital::WORD;
1068   InputMethod::ButtonAction::Type buttonAction   = InputMethod::ButtonAction::GO;
1069   int                             inputVariation = 1;
1070   propertyMap["PANEL_LAYOUT"]                    = panelLayout;
1071   propertyMap["AUTO_CAPITALIZE"]                 = autoCapital;
1072   propertyMap["BUTTON_ACTION"]                   = buttonAction;
1073   propertyMap["VARIATION"]                       = inputVariation;
1074   editor.SetProperty(DevelTextEditor::Property::INPUT_METHOD_SETTINGS, propertyMap);
1075
1076   Property::Value value = editor.GetProperty(DevelTextEditor::Property::INPUT_METHOD_SETTINGS);
1077   Property::Map   map;
1078   DALI_TEST_CHECK(value.Get(map));
1079
1080   int layout = 0;
1081   DALI_TEST_CHECK(map["PANEL_LAYOUT"].Get(layout));
1082   DALI_TEST_EQUALS(static_cast<int>(panelLayout), layout, TEST_LOCATION);
1083
1084   int capital = 0;
1085   DALI_TEST_CHECK(map["AUTO_CAPITALIZE"].Get(capital));
1086   DALI_TEST_EQUALS(static_cast<int>(autoCapital), capital, TEST_LOCATION);
1087
1088   int action = 0;
1089   DALI_TEST_CHECK(map["BUTTON_ACTION"].Get(action));
1090   DALI_TEST_EQUALS(static_cast<int>(buttonAction), action, TEST_LOCATION);
1091
1092   int variation = 0;
1093   DALI_TEST_CHECK(map["VARIATION"].Get(variation));
1094   DALI_TEST_EQUALS(inputVariation, variation, TEST_LOCATION);
1095
1096   // Check the input filter property
1097   Property::Map inputFilterMapSet;
1098   Property::Map inputFilterMapGet;
1099   inputFilterMapSet[InputFilter::Property::ACCEPTED] = "[\\w]";
1100   inputFilterMapSet[InputFilter::Property::REJECTED] = "[\\d]";
1101
1102   editor.SetProperty(DevelTextEditor::Property::INPUT_FILTER, inputFilterMapSet);
1103
1104   inputFilterMapGet = editor.GetProperty<Property::Map>(DevelTextEditor::Property::INPUT_FILTER);
1105   DALI_TEST_EQUALS(inputFilterMapGet.Count(), inputFilterMapSet.Count(), TEST_LOCATION);
1106
1107   // Clear
1108   inputFilterMapSet.Clear();
1109   editor.SetProperty(DevelTextEditor::Property::INPUT_FILTER, inputFilterMapSet);
1110
1111   // Check the strikethrough property
1112
1113   Property::Map strikethroughMapSet;
1114   Property::Map strikethroughMapGet;
1115
1116   application.SendNotification();
1117   application.Render();
1118
1119   // Check the input strikethrough property
1120
1121   strikethroughMapSet.Clear();
1122   strikethroughMapGet.Clear();
1123   strikethroughMapSet.Insert("enable", true);
1124   strikethroughMapSet.Insert("color", Color::BLUE);
1125   strikethroughMapSet.Insert("height", 2.0f);
1126
1127   editor.SetProperty(DevelTextEditor::Property::STRIKETHROUGH, strikethroughMapSet);
1128
1129   application.SendNotification();
1130   application.Render();
1131
1132   strikethroughMapGet = editor.GetProperty<Property::Map>(DevelTextEditor::Property::STRIKETHROUGH);
1133
1134   DALI_TEST_EQUALS(strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION);
1135   DALI_TEST_EQUALS(DaliTestCheckMaps(strikethroughMapSet, strikethroughMapGet), true, TEST_LOCATION);
1136
1137   // Check the input strikethrough property
1138   editor.SetProperty(DevelTextEditor::Property::INPUT_STRIKETHROUGH, "Strikethrough input properties");
1139   DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::INPUT_STRIKETHROUGH), std::string("Strikethrough input properties"), TEST_LOCATION);
1140
1141   application.SendNotification();
1142   application.Render();
1143
1144   // Check the line size property
1145   DALI_TEST_EQUALS(editor.GetProperty<float>(DevelTextEditor::Property::MIN_LINE_SIZE), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1146   editor.SetProperty(DevelTextEditor::Property::MIN_LINE_SIZE, 50.f);
1147   DALI_TEST_EQUALS(editor.GetProperty<float>(DevelTextEditor::Property::MIN_LINE_SIZE), 50.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1148
1149   END_TEST;
1150 }
1151
1152 // Positive Atlas Text Renderer test
1153 int utcDaliTextEditorAtlasRenderP(void)
1154 {
1155   ToolkitTestApplication application;
1156   tet_infoline(" UtcDaliToolkitTextEditorAtlasRenderP");
1157   StyleManager styleManager = StyleManager::Get();
1158   styleManager.ApplyDefaultTheme();
1159   TextEditor editor = TextEditor::New();
1160   DALI_TEST_CHECK(editor);
1161
1162   editor.SetProperty(TextEditor::Property::HORIZONTAL_ALIGNMENT, "CENTER");
1163
1164   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1165
1166   application.GetScene().Add(editor);
1167
1168   try
1169   {
1170     // Render some text with the shared atlas backend
1171     editor.SetProperty(DevelTextEditor::Property::RENDERING_BACKEND, DevelText::RENDERING_SHARED_ATLAS);
1172     application.SendNotification();
1173     application.Render();
1174   }
1175   catch(...)
1176   {
1177     tet_result(TET_FAIL);
1178   }
1179   END_TEST;
1180 }
1181
1182 // Positive test for the anchorClicked signal.
1183 int utcDaliTextEditorAnchorClickedP(void)
1184 {
1185   ToolkitTestApplication application;
1186   tet_infoline(" utcDaliTextEditorAnchorClickedP");
1187   TextEditor editor = TextEditor::New();
1188   DALI_TEST_CHECK(editor);
1189
1190   application.GetScene().Add(editor);
1191
1192   // connect to the anchor clicked signal.
1193   ConnectionTracker* testTracker = new ConnectionTracker();
1194   DevelTextEditor::AnchorClickedSignal(editor).Connect(&TestAnchorClickedCallback);
1195   bool anchorClickedSignal = false;
1196   editor.ConnectSignal(testTracker, "anchorClicked", CallbackFunctor(&anchorClickedSignal));
1197
1198   gAnchorClickedCallBackCalled = false;
1199   editor.SetProperty(TextEditor::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
1200   editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
1201   editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
1202   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1203   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1204
1205   application.SendNotification();
1206   application.Render();
1207   editor.SetKeyInputFocus();
1208
1209   // Create a tap event to touch the text editor.
1210   TestGenerateTap(application, 5.0f, 5.0f);
1211   application.SendNotification();
1212   application.Render();
1213
1214   DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
1215   DALI_TEST_CHECK(anchorClickedSignal);
1216
1217   gAnchorClickedCallBackNotCalled = true;
1218   // Tap the outside of anchor, callback should not be called.
1219   TestGenerateTap(application, 150.f, 100.f);
1220   application.SendNotification();
1221   application.Render();
1222
1223   DALI_TEST_CHECK(gAnchorClickedCallBackNotCalled);
1224
1225   END_TEST;
1226 }
1227
1228 // Positive test for the textChanged signal.
1229 int utcDaliTextEditorTextChangedP(void)
1230 {
1231   ToolkitTestApplication application;
1232   tet_infoline(" utcDaliTextEditorTextChangedP");
1233   TextEditor editor = TextEditor::New();
1234   DALI_TEST_CHECK(editor);
1235
1236   application.GetScene().Add(editor);
1237
1238   // connect to the text changed signal.
1239   ConnectionTracker* testTracker = new ConnectionTracker();
1240   editor.TextChangedSignal().Connect(&TestTextChangedCallback);
1241   bool textChangedSignal = false;
1242   editor.ConnectSignal(testTracker, "textChanged", CallbackFunctor(&textChangedSignal));
1243
1244   gTextChangedCallBackCalled = false;
1245   editor.SetProperty(TextEditor::Property::TEXT, "ABC");
1246   DALI_TEST_CHECK(gTextChangedCallBackCalled);
1247   DALI_TEST_CHECK(textChangedSignal);
1248
1249   application.SendNotification();
1250   editor.SetKeyInputFocus();
1251
1252   gTextChangedCallBackCalled = false;
1253   application.ProcessEvent(GenerateKey("D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1254   DALI_TEST_CHECK(gTextChangedCallBackCalled);
1255
1256   // Remove all text
1257   editor.SetProperty(TextField::Property::TEXT, "");
1258
1259   // Pressing backspace key: TextChangedCallback should not be called when there is no text in texteditor.
1260   gTextChangedCallBackCalled = false;
1261   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1262   DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1263
1264   // Pressing delete key: TextChangedCallback should not be called when there is no text in texteditor.
1265   gTextChangedCallBackCalled = false;
1266   application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "Delete", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1267   DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1268
1269   END_TEST;
1270 }
1271
1272 int utcDaliTextEditorTextChangedWithInputMethodContext(void)
1273 {
1274   ToolkitTestApplication application;
1275   tet_infoline(" utcDaliTextEditorTextChangedWithInputMethodContext");
1276   TextEditor editor = TextEditor::New();
1277   DALI_TEST_CHECK(editor);
1278
1279   application.GetScene().Add(editor);
1280
1281   // connect to the text changed signal.
1282   ConnectionTracker* testTracker = new ConnectionTracker();
1283   editor.TextChangedSignal().Connect(&TestTextChangedCallback);
1284   bool textChangedSignal = false;
1285   editor.ConnectSignal(testTracker, "textChanged", CallbackFunctor(&textChangedSignal));
1286
1287   // get InputMethodContext
1288   std::string                   text;
1289   InputMethodContext::EventData imfEvent;
1290   InputMethodContext            inputMethodContext = DevelTextEditor::GetInputMethodContext(editor);
1291
1292   editor.SetKeyInputFocus();
1293   editor.SetProperty(DevelTextEditor::Property::ENABLE_EDITING, true);
1294
1295   // input text
1296   gTextChangedCallBackCalled = false;
1297   imfEvent                   = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "ㅎ", 0, 1);
1298   inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1299   application.SendNotification();
1300   application.Render();
1301   DALI_TEST_CHECK(gTextChangedCallBackCalled);
1302   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("ㅎ"), TEST_LOCATION);
1303
1304   gTextChangedCallBackCalled = false;
1305   imfEvent                   = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "호", 0, 1);
1306   inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1307   application.SendNotification();
1308   application.Render();
1309   DALI_TEST_CHECK(gTextChangedCallBackCalled);
1310   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("호"), TEST_LOCATION);
1311
1312   gTextChangedCallBackCalled = false;
1313   imfEvent                   = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "혿", 0, 1);
1314   inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1315   application.SendNotification();
1316   application.Render();
1317   DALI_TEST_CHECK(gTextChangedCallBackCalled);
1318   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("혿"), TEST_LOCATION);
1319
1320   gTextChangedCallBackCalled = false;
1321   imfEvent                   = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "", 0, 1);
1322   inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1323   DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1324
1325   imfEvent = InputMethodContext::EventData(InputMethodContext::COMMIT, "호", 0, 1);
1326   inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1327   DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1328
1329   imfEvent = InputMethodContext::EventData(InputMethodContext::PRE_EDIT, "두", 1, 2);
1330   inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
1331   DALI_TEST_CHECK(!gTextChangedCallBackCalled);
1332
1333   application.SendNotification();
1334   application.Render();
1335   DALI_TEST_CHECK(gTextChangedCallBackCalled);
1336   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("호두"), TEST_LOCATION);
1337
1338   END_TEST;
1339 }
1340
1341 int utcDaliTextEditorInputStyleChanged01(void)
1342 {
1343   // The text-editor emits signals when the input style changes. These changes of style are
1344   // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
1345   // can't be emitted during the size negotiation as the callbacks may update the UI.
1346   // The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
1347   // The ToolkitTestApplication creates an implementation of the adaptor stub and a queue of idle callbacks.
1348   ToolkitTestApplication application;
1349   tet_infoline(" utcDaliTextEditorInputStyleChanged01");
1350
1351   // Load some fonts.
1352
1353   char*             pathNamePtr = get_current_dir_name();
1354   const std::string pathName(pathNamePtr);
1355   free(pathNamePtr);
1356
1357   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1358   fontClient.SetDpi(93u, 93u);
1359
1360   fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE);
1361   fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE);
1362
1363   TextEditor editor = TextEditor::New();
1364   DALI_TEST_CHECK(editor);
1365
1366   editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1367   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1368   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1369
1370   editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
1371   editor.SetProperty(TextEditor::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='green'>llo</color> <font weight='bold'>world</font> demo</font>");
1372
1373   // connect to the text changed signal.
1374   ConnectionTracker* testTracker = new ConnectionTracker();
1375   editor.InputStyleChangedSignal().Connect(&TestInputStyleChangedCallback);
1376   bool inputStyleChangedSignal = false;
1377   editor.ConnectSignal(testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal));
1378
1379   application.GetScene().Add(editor);
1380
1381   // Render and notify
1382   application.SendNotification();
1383   application.Render();
1384
1385   // Executes the idle callbacks added by the text control on the change of input style.
1386   application.RunIdles();
1387
1388   gInputStyleChangedCallbackCalled = false;
1389   gInputStyleMask                  = TextEditor::InputStyle::NONE;
1390   inputStyleChangedSignal          = false;
1391
1392   // Create a tap event to touch the text editor.
1393   TestGenerateTap(application, 18.0f, 25.0f);
1394
1395   // Render and notify
1396   application.SendNotification();
1397   application.Render();
1398
1399   // Executes the idle callbacks added by the text control on the change of input style.
1400   application.RunIdles();
1401
1402   DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1403   if(gInputStyleChangedCallbackCalled)
1404   {
1405     DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::FONT_FAMILY | TextEditor::InputStyle::POINT_SIZE), TEST_LOCATION);
1406
1407     const std::string fontFamily = editor.GetProperty(TextEditor::Property::INPUT_FONT_FAMILY).Get<std::string>();
1408     DALI_TEST_EQUALS(fontFamily, "DejaVuSerif", TEST_LOCATION);
1409
1410     const float pointSize = editor.GetProperty(TextEditor::Property::INPUT_POINT_SIZE).Get<float>();
1411     DALI_TEST_EQUALS(pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1412   }
1413   DALI_TEST_CHECK(inputStyleChangedSignal);
1414
1415   gInputStyleChangedCallbackCalled = false;
1416   gInputStyleMask                  = TextEditor::InputStyle::NONE;
1417   inputStyleChangedSignal          = false;
1418
1419   // Create a tap event to touch the text editor.
1420   TestGenerateTap(application, 30.0f, 25.0f);
1421
1422   // Render and notify
1423   application.SendNotification();
1424   application.Render();
1425
1426   // Executes the idle callbacks added by the text control on the change of input style.
1427   application.RunIdles();
1428
1429   DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1430   DALI_TEST_CHECK(!inputStyleChangedSignal);
1431
1432   gInputStyleChangedCallbackCalled = false;
1433   gInputStyleMask                  = TextEditor::InputStyle::NONE;
1434   inputStyleChangedSignal          = false;
1435
1436   // Create a tap event to touch the text editor.
1437   TestGenerateTap(application, 43.0f, 25.0f);
1438
1439   // Render and notify
1440   application.SendNotification();
1441   application.Render();
1442
1443   // Executes the idle callbacks added by the text control on the change of input style.
1444   application.RunIdles();
1445
1446   DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1447   if(gInputStyleChangedCallbackCalled)
1448   {
1449     DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::COLOR), TEST_LOCATION);
1450
1451     const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1452     DALI_TEST_EQUALS(color, Color::GREEN, TEST_LOCATION);
1453   }
1454   DALI_TEST_CHECK(inputStyleChangedSignal);
1455
1456   gInputStyleChangedCallbackCalled = false;
1457   gInputStyleMask                  = TextEditor::InputStyle::NONE;
1458   inputStyleChangedSignal          = false;
1459
1460   // Create a tap event to touch the text editor.
1461   TestGenerateTap(application, 88.0f, 25.0f);
1462
1463   // Render and notify
1464   application.SendNotification();
1465   application.Render();
1466
1467   // Executes the idle callbacks added by the text control on the change of input style.
1468   application.RunIdles();
1469
1470   DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1471   if(gInputStyleChangedCallbackCalled)
1472   {
1473     DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::COLOR | TextEditor::InputStyle::FONT_STYLE), TEST_LOCATION);
1474
1475     const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1476     DALI_TEST_EQUALS(color, Color::BLACK, TEST_LOCATION);
1477
1478     Property::Map fontStyleMapSet;
1479     Property::Map fontStyleMapGet;
1480
1481     fontStyleMapSet.Insert("weight", "bold");
1482
1483     fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
1484     DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
1485     DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
1486   }
1487   DALI_TEST_CHECK(inputStyleChangedSignal);
1488
1489   gInputStyleChangedCallbackCalled = false;
1490   gInputStyleMask                  = TextEditor::InputStyle::NONE;
1491   inputStyleChangedSignal          = false;
1492
1493   // Create a tap event to touch the text editor.
1494   TestGenerateTap(application, 115.0f, 25.0f);
1495
1496   // Render and notify
1497   application.SendNotification();
1498   application.Render();
1499
1500   // Executes the idle callbacks added by the text control on the change of input style.
1501   application.RunIdles();
1502
1503   DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1504   DALI_TEST_CHECK(!inputStyleChangedSignal);
1505
1506   gInputStyleChangedCallbackCalled = false;
1507   gInputStyleMask                  = TextEditor::InputStyle::NONE;
1508   inputStyleChangedSignal          = false;
1509
1510   // Create a tap event to touch the text editor.
1511   TestGenerateTap(application, 164.0f, 25.0f);
1512
1513   // Render and notify
1514   application.SendNotification();
1515   application.Render();
1516
1517   // Executes the idle callbacks added by the text control on the change of input style.
1518   application.RunIdles();
1519
1520   DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1521   if(gInputStyleChangedCallbackCalled)
1522   {
1523     DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::FONT_STYLE), TEST_LOCATION);
1524
1525     Property::Map fontStyleMapSet;
1526     Property::Map fontStyleMapGet;
1527
1528     fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
1529     DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
1530     DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
1531   }
1532   DALI_TEST_CHECK(inputStyleChangedSignal);
1533
1534   gInputStyleChangedCallbackCalled = false;
1535   gInputStyleMask                  = TextEditor::InputStyle::NONE;
1536   inputStyleChangedSignal          = false;
1537
1538   // Create a tap event to touch the text editor.
1539   TestGenerateTap(application, 191.0f, 25.0f);
1540
1541   // Render and notify
1542   application.SendNotification();
1543   application.Render();
1544
1545   // Executes the idle callbacks added by the text control on the change of input style.
1546   application.RunIdles();
1547
1548   DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1549   DALI_TEST_CHECK(!inputStyleChangedSignal);
1550
1551   END_TEST;
1552 }
1553
1554 int utcDaliTextEditorInputStyleChanged02(void)
1555 {
1556   // The text-editor emits signals when the input style changes. These changes of style are
1557   // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
1558   // can't be emitted during the size negotiation as the callbacks may update the UI.
1559   // The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
1560   // The ToolkitTestApplication creates an implementation of the adaptor stub and a queue of idle callbacks.
1561   ToolkitTestApplication application;
1562   tet_infoline(" utcDaliTextEditorInputStyleChanged02");
1563
1564   // Load some fonts.
1565
1566   char*             pathNamePtr = get_current_dir_name();
1567   const std::string pathName(pathNamePtr);
1568   free(pathNamePtr);
1569
1570   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1571   fontClient.SetDpi(93u, 93u);
1572
1573   fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE);
1574   fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE);
1575
1576   TextEditor editor = TextEditor::New();
1577   DALI_TEST_CHECK(editor);
1578
1579   editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1580   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1581   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1582
1583   editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
1584   editor.SetProperty(TextEditor::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='blue'> l</color><color value='green'>lo</color> <font weight='bold'>world</font> demo</font>");
1585
1586   // connect to the text changed signal.
1587   ConnectionTracker* testTracker = new ConnectionTracker();
1588   editor.InputStyleChangedSignal().Connect(&TestInputStyleChangedCallback);
1589   bool inputStyleChangedSignal = false;
1590   editor.ConnectSignal(testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal));
1591
1592   application.GetScene().Add(editor);
1593
1594   // Render and notify
1595   application.SendNotification();
1596   application.Render();
1597
1598   // Executes the idle callbacks added by the text control on the change of input style.
1599   application.RunIdles();
1600
1601   gInputStyleChangedCallbackCalled = false;
1602   gInputStyleMask                  = TextEditor::InputStyle::NONE;
1603   inputStyleChangedSignal          = false;
1604
1605   // Create a tap event to touch the text editor.
1606   TestGenerateTap(application, 53.0f, 25.0f, 100);
1607   TestGenerateTap(application, 53.0f, 25.0f, 200);
1608
1609   // Render and notify
1610   application.SendNotification();
1611   application.Render();
1612
1613   // Executes the idle callbacks added by the text control on the change of input style.
1614   application.RunIdles();
1615
1616   DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1617   if(gInputStyleChangedCallbackCalled)
1618   {
1619     DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1620                      static_cast<unsigned int>(TextEditor::InputStyle::FONT_FAMILY |
1621                                                TextEditor::InputStyle::POINT_SIZE |
1622                                                TextEditor::InputStyle::COLOR),
1623                      TEST_LOCATION);
1624
1625     const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1626     DALI_TEST_EQUALS(color, Color::GREEN, TEST_LOCATION);
1627
1628     const std::string fontFamily = editor.GetProperty(TextEditor::Property::INPUT_FONT_FAMILY).Get<std::string>();
1629     DALI_TEST_EQUALS(fontFamily, "DejaVuSerif", TEST_LOCATION);
1630
1631     const float pointSize = editor.GetProperty(TextEditor::Property::INPUT_POINT_SIZE).Get<float>();
1632     DALI_TEST_EQUALS(pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
1633   }
1634   DALI_TEST_CHECK(inputStyleChangedSignal);
1635
1636   gInputStyleChangedCallbackCalled = false;
1637   gInputStyleMask                  = TextEditor::InputStyle::NONE;
1638   inputStyleChangedSignal          = false;
1639
1640   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1641
1642   // Render and notify
1643   application.SendNotification();
1644   application.Render();
1645
1646   // Executes the idle callbacks added by the text control on the change of input style.
1647   application.RunIdles();
1648
1649   DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1650   if(gInputStyleChangedCallbackCalled)
1651   {
1652     DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1653                      static_cast<unsigned int>(TextEditor::InputStyle::COLOR),
1654                      TEST_LOCATION);
1655
1656     const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1657     DALI_TEST_EQUALS(color, Color::BLUE, TEST_LOCATION);
1658   }
1659   DALI_TEST_CHECK(inputStyleChangedSignal);
1660
1661   gInputStyleChangedCallbackCalled = false;
1662   gInputStyleMask                  = TextEditor::InputStyle::NONE;
1663   inputStyleChangedSignal          = false;
1664
1665   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1666
1667   // Render and notify
1668   application.SendNotification();
1669   application.Render();
1670
1671   // Executes the idle callbacks added by the text control on the change of input style.
1672   application.RunIdles();
1673
1674   DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1675   DALI_TEST_CHECK(!inputStyleChangedSignal);
1676
1677   gInputStyleChangedCallbackCalled = false;
1678   gInputStyleMask                  = TextEditor::InputStyle::NONE;
1679   inputStyleChangedSignal          = false;
1680
1681   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1682
1683   // Render and notify
1684   application.SendNotification();
1685   application.Render();
1686
1687   // Executes the idle callbacks added by the text control on the change of input style.
1688   application.RunIdles();
1689
1690   DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1691   if(gInputStyleChangedCallbackCalled)
1692   {
1693     DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1694                      static_cast<unsigned int>(TextEditor::InputStyle::COLOR),
1695                      TEST_LOCATION);
1696
1697     const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1698     DALI_TEST_EQUALS(color, Color::BLACK, TEST_LOCATION);
1699   }
1700   DALI_TEST_CHECK(inputStyleChangedSignal);
1701
1702   gInputStyleChangedCallbackCalled = false;
1703   gInputStyleMask                  = TextEditor::InputStyle::NONE;
1704   inputStyleChangedSignal          = false;
1705
1706   editor.SetProperty(TextEditor::Property::INPUT_COLOR, Color::YELLOW);
1707
1708   Property::Map fontStyleMapSet;
1709   fontStyleMapSet.Insert("weight", "thin");
1710   fontStyleMapSet.Insert("width", "condensed");
1711   fontStyleMapSet.Insert("slant", "italic");
1712
1713   editor.SetProperty(TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet);
1714   editor.SetProperty(TextEditor::Property::INPUT_POINT_SIZE, 20.f);
1715   editor.SetProperty(TextEditor::Property::INPUT_LINE_SPACING, 5.f);
1716
1717   editor.SetProperty(TextEditor::Property::INPUT_UNDERLINE, "underline");
1718   editor.SetProperty(TextEditor::Property::INPUT_SHADOW, "shadow");
1719   editor.SetProperty(TextEditor::Property::INPUT_EMBOSS, "emboss");
1720   editor.SetProperty(TextEditor::Property::INPUT_OUTLINE, "outline");
1721   editor.SetProperty(DevelTextEditor::Property::INPUT_STRIKETHROUGH, "strikethrough");
1722
1723   application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1724
1725   // Render and notify
1726   application.SendNotification();
1727   application.Render();
1728
1729   // Executes the idle callbacks added by the text control on the change of input style.
1730   application.RunIdles();
1731
1732   DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
1733   DALI_TEST_CHECK(!inputStyleChangedSignal);
1734
1735   // Create a tap event to touch the text editor.
1736   TestGenerateTap(application, 63.0f, 25.0f, 900);
1737
1738   // Render and notify
1739   application.SendNotification();
1740   application.Render();
1741
1742   // Executes the idle callbacks added by the text control on the change of input style.
1743   application.RunIdles();
1744
1745   DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1746   if(gInputStyleChangedCallbackCalled)
1747   {
1748     DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1749                      static_cast<unsigned int>(TextEditor::InputStyle::COLOR |
1750                                                TextEditor::InputStyle::POINT_SIZE |
1751                                                TextEditor::InputStyle::FONT_STYLE |
1752                                                TextEditor::InputStyle::LINE_SPACING |
1753                                                TextEditor::InputStyle::UNDERLINE |
1754                                                TextEditor::InputStyle::SHADOW |
1755                                                TextEditor::InputStyle::EMBOSS |
1756                                                TextEditor::InputStyle::OUTLINE),
1757                      TEST_LOCATION);
1758
1759     const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1760     DALI_TEST_EQUALS(color, Color::BLACK, TEST_LOCATION);
1761   }
1762   DALI_TEST_CHECK(inputStyleChangedSignal);
1763
1764   gInputStyleChangedCallbackCalled = false;
1765   gInputStyleMask                  = TextEditor::InputStyle::NONE;
1766   inputStyleChangedSignal          = false;
1767
1768   editor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVuSerif");
1769
1770   fontStyleMapSet.Clear();
1771   fontStyleMapSet.Insert("weight", "black");
1772   fontStyleMapSet.Insert("width", "expanded");
1773   fontStyleMapSet.Insert("slant", "oblique");
1774
1775   editor.SetProperty(TextEditor::Property::FONT_STYLE, fontStyleMapSet);
1776
1777   // Create a tap event to touch the text editor.
1778   TestGenerateTap(application, 30.0f, 25.0f, 1500);
1779
1780   // Render and notify
1781   application.SendNotification();
1782   application.Render();
1783
1784   // Executes the idle callbacks added by the text control on the change of input style.
1785   application.RunIdles();
1786
1787   DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
1788   if(gInputStyleChangedCallbackCalled)
1789   {
1790     DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask),
1791                      static_cast<unsigned int>(TextEditor::InputStyle::COLOR |
1792                                                TextEditor::InputStyle::POINT_SIZE |
1793                                                TextEditor::InputStyle::FONT_STYLE),
1794                      TEST_LOCATION);
1795
1796     const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
1797     DALI_TEST_EQUALS(color, Color::YELLOW, TEST_LOCATION);
1798   }
1799   DALI_TEST_CHECK(inputStyleChangedSignal);
1800
1801   END_TEST;
1802 }
1803
1804 int utcDaliTextEditorEvent01(void)
1805 {
1806   ToolkitTestApplication application;
1807   tet_infoline(" utcDaliTextEditorEvent01");
1808
1809   // Creates a tap event. After creating a tap event the text editor should
1810   // have the focus and add text with key events should be possible.
1811
1812   TextEditor editor = TextEditor::New();
1813   DALI_TEST_CHECK(editor);
1814
1815   application.GetScene().Add(editor);
1816
1817   editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1818   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1819   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1820
1821   // Avoid a crash when core load gl resources.
1822   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1823
1824   // Render and notify
1825   application.SendNotification();
1826   application.Render();
1827
1828   // Add a key event but as the text editor has not the focus it should do nothing.
1829   application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1830
1831   // Render and notify
1832   application.SendNotification();
1833   application.Render();
1834
1835   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string(""), TEST_LOCATION);
1836
1837   // Create a tap event to touch the text editor.
1838   TestGenerateTap(application, 150.0f, 25.0f);
1839
1840   // Render and notify
1841   application.SendNotification();
1842   application.Render();
1843
1844   // Now the text editor has the focus, so it can handle the key events.
1845   application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1846   application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1847
1848   // Render and notify
1849   application.SendNotification();
1850   application.Render();
1851
1852   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("aa"), TEST_LOCATION);
1853
1854   // Create a second text editor and send key events to it.
1855   TextEditor editor2 = TextEditor::New();
1856
1857   editor2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1858   editor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1859   editor2.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
1860   editor2.SetProperty(Actor::Property::POSITION, Vector2(100.f, 100.f));
1861
1862   application.GetScene().Add(editor2);
1863
1864   // Render and notify
1865   application.SendNotification();
1866   application.Render();
1867
1868   // Create a tap event on the second text editor.
1869   TestGenerateTap(application, 150.0f, 125.0f);
1870
1871   // Render and notify
1872   application.SendNotification();
1873   application.Render();
1874
1875   // The second text editor has the focus. It should handle the key events.
1876   application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1877   application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1878
1879   // Render and notify
1880   application.SendNotification();
1881   application.Render();
1882
1883   // Check the text has been added to the second text editor.
1884   DALI_TEST_EQUALS(editor2.GetProperty<std::string>(TextEditor::Property::TEXT), std::string("aa"), TEST_LOCATION);
1885
1886   END_TEST;
1887 }
1888
1889 int utcDaliTextEditorEvent02(void)
1890 {
1891   ToolkitTestApplication application;
1892   tet_infoline(" utcDaliTextEditorEvent02");
1893
1894   // Checks if the right number of actors are created.
1895
1896   TextEditor editor = TextEditor::New();
1897   editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
1898   DALI_TEST_CHECK(editor);
1899
1900   application.GetScene().Add(editor);
1901
1902   editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
1903   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1904   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1905
1906   // Avoid a crash when core load gl resources.
1907   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
1908
1909   // Render and notify
1910   application.SendNotification();
1911   application.Render();
1912
1913   // Check there are the expected number of children (the stencil).
1914   DALI_TEST_EQUALS(editor.GetChildCount(), 1u, TEST_LOCATION);
1915
1916   Actor stencil = editor.GetChildAt(0u);
1917
1918   // Create a tap event to touch the text editor.
1919   TestGenerateTap(application, 150.0f, 25.0f, 100);
1920
1921   // Render and notify
1922   application.SendNotification();
1923   application.Render();
1924
1925   Actor layer = editor.GetChildAt(2u);
1926   DALI_TEST_EQUALS(layer.GetChildCount(), 1u, TEST_LOCATION); // The cursor.
1927   DALI_TEST_EQUALS(stencil.GetChildCount(), 0u, TEST_LOCATION);
1928
1929   // Now the text editor has the focus, so it can handle the key events.
1930   application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1931   application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1932
1933   // Render and notify
1934   application.SendNotification();
1935   application.Render();
1936
1937   // Checks the cursor and the renderer have been created.
1938   DALI_TEST_EQUALS(layer.GetChildCount(), 1u, TEST_LOCATION);   // The cursor.
1939   DALI_TEST_EQUALS(stencil.GetChildCount(), 2u, TEST_LOCATION); // The renderer, clipped cursor
1940
1941   Control cursor = Control::DownCast(layer.GetChildAt(0u));
1942   DALI_TEST_CHECK(cursor);
1943
1944   // The stencil actor has a container with all the actors which contain the text renderers.
1945   Actor container = stencil.GetChildAt(0u);
1946   for(unsigned int index = 0; index < container.GetChildCount(); ++index)
1947   {
1948     Renderer renderer = container.GetChildAt(index).GetRendererAt(0u);
1949     DALI_TEST_CHECK(renderer);
1950   }
1951
1952   // Move the cursor and check the position changes.
1953   Vector3 position1 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1954
1955   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1956   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1957
1958   // Render and notify
1959   application.SendNotification();
1960   application.Render();
1961
1962   Vector3 position2 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1963
1964   DALI_TEST_CHECK(position2.x < position1.x);
1965
1966   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1967   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
1968
1969   // Render and notify
1970   application.SendNotification();
1971   application.Render();
1972
1973   Vector3 position3 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1974
1975   DALI_TEST_EQUALS(position1, position3, TEST_LOCATION); // Should be in the same position1.
1976
1977   // Send some taps and check the cursor positions.
1978
1979   // Try to tap at the beginning.
1980   TestGenerateTap(application, 1.0f, 25.0f, 700);
1981
1982   // Render and notify
1983   application.SendNotification();
1984   application.Render();
1985
1986   // Cursor position should be the same than position1.
1987   Vector3 position4 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1988
1989   DALI_TEST_EQUALS(position2, position4, TEST_LOCATION); // Should be in the same position2.
1990
1991   // Tap away from the start position.
1992   TestGenerateTap(application, 16.0f, 25.0f, 1400);
1993
1994   // Render and notify
1995   application.SendNotification();
1996   application.Render();
1997
1998   Vector3 position5 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
1999
2000   DALI_TEST_CHECK(position5.x > position4.x);
2001
2002   // Remove all the text.
2003   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2004   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2005   editor.SetProperty(TextEditor::Property::TEXT, "");
2006
2007   // Render and notify
2008   application.SendNotification();
2009   application.Render();
2010
2011   // Cursor position should be the same than position2.
2012   Vector3 position6 = cursor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
2013
2014   DALI_TEST_EQUALS(position2, position6, TEST_LOCATION); // Should be in the same position2.
2015
2016   // Should not be a renderer, there is only a clipped cursor.
2017   DALI_TEST_EQUALS(stencil.GetChildCount(), 1u, TEST_LOCATION);
2018
2019   END_TEST;
2020 }
2021
2022 int utcDaliTextEditorEvent03(void)
2023 {
2024   ToolkitTestApplication application;
2025   tet_infoline(" utcDaliTextEditorEvent03");
2026
2027   // Checks if the highlight actor is created.
2028
2029   TextEditor editor = TextEditor::New();
2030   DALI_TEST_CHECK(editor);
2031
2032   application.GetScene().Add(editor);
2033
2034   editor.SetProperty(TextEditor::Property::TEXT, "This is a long text for the size of the text-editor.");
2035   editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2036   editor.SetProperty(Actor::Property::SIZE, Vector2(30.f, 50.f));
2037   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2038   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2039
2040   // Avoid a crash when core load gl resources.
2041   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2042
2043   // Render and notify
2044   application.SendNotification();
2045   application.Render();
2046
2047   // Send some taps and check text controller with clipboard window
2048   Dali::Clipboard clipboard = Clipboard::Get();
2049   clipboard.ShowClipboard();
2050   TestGenerateTap(application, 3.0f, 25.0f, 100);
2051   clipboard.HideClipboard();
2052
2053   // Render and notify
2054   application.SendNotification();
2055   application.Render();
2056
2057   // Tap first to get the focus.
2058   TestGenerateTap(application, 3.0f, 25.0f, 1000);
2059
2060   // Render and notify
2061   application.SendNotification();
2062   application.Render();
2063
2064   // Double tap to select a word.
2065   TestGenerateTap(application, 3.0f, 25.0f, 1100);
2066
2067   // Render and notify
2068   application.SendNotification();
2069   application.Render();
2070
2071   // The stencil actor should have two actors: the renderer and the highlight actor.
2072   Actor stencil = editor.GetChildAt(0u);
2073
2074   // Highlight needs to be drawn before text, so should come first in child order
2075   Renderer highlight = stencil.GetChildAt(0u).GetRendererAt(0u);
2076   DALI_TEST_CHECK(highlight);
2077
2078   // The stencil actor has a container with all the actors which contain the text renderers.
2079   Actor container = stencil.GetChildAt(1u);
2080   for(unsigned int index = 0; index < container.GetChildCount(); ++index)
2081   {
2082     Renderer renderer = container.GetChildAt(index).GetRendererAt(0u);
2083     DALI_TEST_CHECK(renderer);
2084   }
2085
2086   // Double tap out of bounds
2087   TestGenerateTap(application, 29.0f, 25.0f, 1700);
2088   TestGenerateTap(application, 29.0f, 25.0f, 1800);
2089
2090   // Render and notify
2091   application.SendNotification();
2092   application.Render();
2093
2094   // The stencil actor should have one actors: the renderer actor.
2095   stencil = editor.GetChildAt(0u);
2096
2097   // The stencil actor has a container with all the actors which contain the text renderers.
2098   container = stencil.GetChildAt(0u);
2099   for(unsigned int index = 0; index < container.GetChildCount(); ++index)
2100   {
2101     Renderer renderer = container.GetChildAt(index).GetRendererAt(0u);
2102     DALI_TEST_CHECK(renderer);
2103   }
2104
2105   // Long Press
2106   TestGenerateLongPress(application, 1.0f, 25.0f);
2107
2108   // Render and notify
2109   application.SendNotification();
2110   application.Render();
2111
2112   // Pan Press
2113   TestGenerateMiniPan(application);
2114
2115   // Render and notify
2116   application.SendNotification();
2117   application.Render();
2118
2119   END_TEST;
2120 }
2121
2122 int utcDaliTextEditorEvent04(void)
2123 {
2124   ToolkitTestApplication application;
2125   tet_infoline(" utcDaliTextEditorEvent04");
2126
2127   // Checks if the highlight actor is created.
2128
2129   TextEditor editor = TextEditor::New();
2130   DALI_TEST_CHECK(editor);
2131
2132   application.GetScene().Add(editor);
2133
2134   editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworl");
2135   editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2136   editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2137   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2138   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2139
2140   // Avoid a crash when core load gl resources.
2141   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2142
2143   // Render and notify
2144   application.SendNotification();
2145   application.Render();
2146
2147   // Tap on the text editor
2148   TestGenerateTap(application, 3.0f, 25.0f);
2149
2150   // Render and notify
2151   application.SendNotification();
2152   application.Render();
2153
2154   // Move at the end of the text.
2155   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2156   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2157
2158   // Render and notify
2159   application.SendNotification();
2160   application.Render();
2161
2162   for(unsigned int index = 0u; index < 10u; ++index)
2163   {
2164     application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2165     application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2166
2167     // Render and notify
2168     application.SendNotification();
2169     application.Render();
2170   }
2171
2172   // Add a character
2173   application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2174
2175   // Render and notify
2176   application.SendNotification();
2177   application.Render();
2178
2179   DALI_TEST_EQUALS("Hello\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2180
2181   // Add some key events
2182   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2183   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2184
2185   // Render and notify
2186   application.SendNotification();
2187   application.Render();
2188
2189   for(unsigned int index = 0u; index < 10u; ++index)
2190   {
2191     application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2192     application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2193
2194     // Render and notify
2195     application.SendNotification();
2196     application.Render();
2197   }
2198
2199   // Add a character
2200   application.ProcessEvent(GenerateKey(" ", "", " ", KEY_WHITE_SPACE_CODE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2201
2202   // Render and notify
2203   application.SendNotification();
2204   application.Render();
2205
2206   DALI_TEST_EQUALS(" Hello\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2207
2208   END_TEST;
2209 }
2210
2211 int utcDaliTextEditorEvent05(void)
2212 {
2213   ToolkitTestApplication application;
2214   tet_infoline(" utcDaliTextEditorEvent05");
2215
2216   // Checks if the highlight actor is created.
2217
2218   TextEditor editor = TextEditor::New();
2219   DALI_TEST_CHECK(editor);
2220
2221   application.GetScene().Add(editor);
2222
2223   editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworl");
2224   editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2225   editor.SetProperty(Actor::Property::SIZE, Vector2(50.f, 50.f));
2226   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2227   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2228   editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL, true);
2229   editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.2f);
2230   editor.SetProperty(TextEditor::Property::ENABLE_SCROLL_BAR, true);
2231   editor.SetProperty(TextEditor::Property::SCROLL_BAR_SHOW_DURATION, 0.3f);
2232   editor.SetProperty(TextEditor::Property::SCROLL_BAR_FADE_DURATION, 0.2f);
2233
2234   // Avoid a crash when core load gl resources.
2235   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2236
2237   // Render and notify
2238   application.SendNotification();
2239   application.Render();
2240
2241   // Tap on the text editor
2242   TestGenerateTap(application, 3.0f, 25.0f);
2243
2244   // Render and notify
2245   application.SendNotification();
2246   application.Render();
2247
2248   // Move at the end of the text.
2249   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2250   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2251
2252   // Render and notify
2253   application.SendNotification();
2254   application.Render();
2255
2256   for(unsigned int index = 0u; index < 10u; ++index)
2257   {
2258     // Add a character
2259     application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2260
2261     // Render and notify
2262     application.SendNotification();
2263     application.Render();
2264   }
2265   // Modify duration after scroll is enabled
2266   editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.1f);
2267
2268   // Continuous scroll left to increase coverage
2269   for(unsigned int index = 0u; index < 10u; ++index)
2270   {
2271     application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2272
2273     // Render and notify
2274     application.SendNotification();
2275     application.Render();
2276   }
2277   DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SMOOTH_SCROLL_DURATION), 0.1f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
2278   DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::SMOOTH_SCROLL), true, TEST_LOCATION);
2279   DALI_TEST_EQUALS(editor.GetProperty<bool>(TextEditor::Property::ENABLE_SCROLL_BAR), true, TEST_LOCATION);
2280   DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_SHOW_DURATION), 0.3f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
2281   DALI_TEST_EQUALS(editor.GetProperty<float>(TextEditor::Property::SCROLL_BAR_FADE_DURATION), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
2282
2283   // Press Escape to increase coverage
2284   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::UP, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2285   application.SendNotification();
2286   application.Render();
2287
2288   DALI_TEST_CHECK(!editor.HasKeyInputFocus());
2289
2290   END_TEST;
2291 }
2292
2293 int utcDaliTextEditorEvent06(void)
2294 {
2295   ToolkitTestApplication application;
2296   tet_infoline(" utcDaliTextEditorEvent06");
2297
2298   // Checks if the highlight actor is created.
2299
2300   TextEditor editor = TextEditor::New();
2301   DALI_TEST_CHECK(editor);
2302
2303   application.GetScene().Add(editor);
2304
2305   editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
2306   editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2307   editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2308   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2309   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2310
2311   // Avoid a crash when core load gl resources.
2312   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2313
2314   // Render and notify
2315   application.SendNotification();
2316   application.Render();
2317
2318   // Tap on the text editor
2319   TestGenerateTap(application, 3.0f, 25.0f);
2320
2321   // Render and notify
2322   application.SendNotification();
2323   application.Render();
2324
2325   // Move to seconds line of the text.
2326   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2327
2328   // Render and notify
2329   application.SendNotification();
2330   application.Render();
2331
2332   float layoutHeight = editor.GetHeightForWidth(100.f);
2333
2334   // Add  another script characters ( glyph height is defferent )
2335   application.ProcessEvent(GenerateKey("d", "", "ㅁ", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "ㅁ", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2336   application.ProcessEvent(GenerateKey("d", "", "ኢ", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "ኢ", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2337
2338   // Delete characters
2339   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2340   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2341
2342   DALI_TEST_EQUALS(layoutHeight, editor.GetHeightForWidth(100.f), TEST_LOCATION);
2343
2344   // Render and notify
2345   application.SendNotification();
2346   application.Render();
2347
2348   DALI_TEST_EQUALS("Hello\nworld\nHello world", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2349
2350   // For coverage
2351   application.ProcessEvent(GenerateKey("", "", "", 0, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2352   application.SendNotification();
2353   application.Render();
2354
2355   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2356   application.SendNotification();
2357   application.Render();
2358
2359   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_VOLUME_UP, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2360   application.SendNotification();
2361   application.Render();
2362
2363   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_VOLUME_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2364   application.SendNotification();
2365   application.Render();
2366
2367   application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2368   application.SendNotification();
2369   application.Render();
2370
2371   application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2372   application.SendNotification();
2373   application.Render();
2374
2375   application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2376   application.SendNotification();
2377   application.Render();
2378
2379   END_TEST;
2380 }
2381
2382 int utcDaliTextEditorEvent07(void)
2383 {
2384   ToolkitTestApplication application;
2385   tet_infoline(" utcDaliTextEditorEvent07");
2386
2387   // Checks if the highlight actor is created.
2388
2389   TextEditor editor = TextEditor::New();
2390   DALI_TEST_CHECK(editor);
2391
2392   application.GetScene().Add(editor);
2393
2394   editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
2395   editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2396   editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2397   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2398   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2399
2400   // Avoid a crash when core load gl resources.
2401   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2402
2403   // Render and notify
2404   application.SendNotification();
2405   application.Render();
2406
2407   // Tap on the text editor
2408   TestGenerateTap(application, 3.0f, 25.0f);
2409
2410   // Render and notify
2411   application.SendNotification();
2412   application.Render();
2413
2414   // Move to second line of the text.
2415   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2416
2417   // Render and notify
2418   application.SendNotification();
2419   application.Render();
2420
2421   // Select some text in the right of the current cursor position
2422   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2423   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2424   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2425   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2426
2427   // Render and notify
2428   application.SendNotification();
2429   application.Render();
2430
2431   // Cut the selected text
2432   application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2433   application.ProcessEvent(GenerateKey("x", "", "x", KEY_X_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "x", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2434
2435   // Render and notify
2436   application.SendNotification();
2437   application.Render();
2438
2439   DALI_TEST_EQUALS("Hello\nld\nHello world", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2440
2441   // Select some text in the left of the current cursor position
2442   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2443   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2444   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2445   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2446
2447   // Render and notify
2448   application.SendNotification();
2449   application.Render();
2450
2451   // Copy the selected text
2452   application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2453   application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2454
2455   // Render and notify
2456   application.SendNotification();
2457   application.Render();
2458
2459   // Move the cursor to the third line
2460   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2461   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2462
2463   // Render and notify
2464   application.SendNotification();
2465   application.Render();
2466
2467   // Paste the selected text at the current cursor position
2468   application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2469   application.ProcessEvent(GenerateKey("v", "", "v", KEY_V_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "v", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2470
2471   // Render and notify
2472   application.SendNotification();
2473   application.Render();
2474
2475   DALI_TEST_EQUALS("Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2476
2477   // Disable Shift Selection
2478   editor.SetProperty(DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false);
2479
2480   // Test to select some text in the right of the current cursor position
2481   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2482   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2483   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2484   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2485
2486   // Render and notify
2487   application.SendNotification();
2488   application.Render();
2489
2490   // Cut the selected text
2491   application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2492   application.ProcessEvent(GenerateKey("x", "", "x", KEY_X_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "x", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2493
2494   // Render and notify
2495   application.SendNotification();
2496   application.Render();
2497
2498   // The text isn't selected and not changed because of 'SetProperty( DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false )'
2499   DALI_TEST_EQUALS("Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2500
2501   // Test to select some text in the left of the current cursor position
2502   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2503   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2504   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2505   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2506
2507   // Render and notify
2508   application.SendNotification();
2509   application.Render();
2510
2511   // Copy the selected text
2512   application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2513   application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2514
2515   // Render and notify
2516   application.SendNotification();
2517   application.Render();
2518
2519   // The text is not selected and not changed because of 'SetProperty( DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false )'
2520   DALI_TEST_EQUALS("Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2521
2522   // Select all Text
2523   application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2524
2525   // Render and notify
2526   application.SendNotification();
2527   application.Render();
2528
2529   // replace text with "c"
2530   application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2531
2532   // Render and notify
2533   application.SendNotification();
2534   application.Render();
2535
2536   //text is "c"
2537   DALI_TEST_EQUALS("c", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2538
2539   // select all text
2540   DevelTextEditor::SelectWholeText(editor);
2541
2542   // Render and notify
2543   application.SendNotification();
2544   application.Render();
2545
2546   // Copy the selected text using logical keys
2547   application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2548   application.ProcessEvent(GenerateKey("ؤ", "c", "ؤ", KEY_C_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2549
2550   // Render and notify
2551   application.SendNotification();
2552   application.Render();
2553
2554   // select none
2555   DevelTextEditor::SelectNone(editor);
2556
2557   // Render and notify
2558   application.SendNotification();
2559   application.Render();
2560
2561   // Paste the selected using logical keys
2562   application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2563   application.ProcessEvent(GenerateKey("ر", "v", "ر", KEY_V_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "v", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2564
2565   //text is "cc"
2566   DALI_TEST_EQUALS("cc", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2567
2568   // select all using logical keys
2569   application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2570   application.ProcessEvent(GenerateKey("ش", "a", "ش", KEY_A_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2571
2572   // Render and notify
2573   application.SendNotification();
2574   application.Render();
2575
2576   // cut text using logical keys
2577   application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2578   application.ProcessEvent(GenerateKey("ء", "x", "ء", KEY_X_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "x", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2579
2580   // Render and notify
2581   application.SendNotification();
2582   application.Render();
2583
2584   //text is ""
2585   DALI_TEST_EQUALS("", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2586
2587   END_TEST;
2588 }
2589
2590 int utcDaliTextEditorEvent08(void)
2591 {
2592   ToolkitTestApplication application;
2593   tet_infoline(" utcDaliTextEditorEvent08");
2594
2595   // Checks if the highlight actor is released correctly.
2596
2597   TextEditor editor = TextEditor::New();
2598   DALI_TEST_CHECK(editor);
2599
2600   application.GetScene().Add(editor);
2601
2602   editor.SetProperty(TextEditor::Property::TEXT, "DALi");
2603   editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2604   editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
2605   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2606   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2607
2608   // Avoid a crash when core load gl resources.
2609   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2610
2611   // Render and notify
2612   application.SendNotification();
2613   application.Render();
2614
2615   // Tap on the text editor
2616   TestGenerateTap(application, 3.0f, 25.0f);
2617
2618   // Render and notify
2619   application.SendNotification();
2620   application.Render();
2621
2622   // When the left selection handle and the right selection handle are at the same position, the highlight box should be deactivated.
2623   // Test to select some text in the left of the current cursor position
2624   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2625   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2626   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2627   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2628
2629   // Render and notify
2630   application.SendNotification();
2631   application.Render();
2632
2633   // Test to the left selection handle position and the right selection handle position
2634   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2635   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2636   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2637   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2638
2639   // Render and notify
2640   application.SendNotification();
2641   application.Render();
2642
2643   // Test to select full text in the left of the current cursor position
2644   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2645   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2646   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2647   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2648   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2649   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2650
2651   // Render and notify
2652   application.SendNotification();
2653   application.Render();
2654
2655   // Test to release the current full text selection
2656   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2657   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2658
2659   // Render and notify
2660   application.SendNotification();
2661   application.Render();
2662
2663   // Test to move the current cursor position correctly
2664   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2665
2666   // Render and notify
2667   application.SendNotification();
2668   application.Render();
2669
2670   // Add a character
2671   application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2672
2673   // Render and notify
2674   application.SendNotification();
2675   application.Render();
2676
2677   DALI_TEST_EQUALS("DdALi", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2678
2679   // Test to select some text in the right of the current cursor position
2680   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2681   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2682   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2683
2684   // Render and notify
2685   application.SendNotification();
2686   application.Render();
2687
2688   // Test the cursor position with right arrow key
2689   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2690
2691   // Render and notify
2692   application.SendNotification();
2693   application.Render();
2694
2695   // Add a character
2696   application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2697
2698   // Render and notify
2699   application.SendNotification();
2700   application.Render();
2701
2702   DALI_TEST_EQUALS("DdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2703
2704   // Test to select some text in the left of the current cursor position
2705   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2706   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2707   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2708   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2709   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2710
2711   // Render and notify
2712   application.SendNotification();
2713   application.Render();
2714
2715   // Test the cursor position with left arrow key
2716   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2717
2718   // Render and notify
2719   application.SendNotification();
2720   application.Render();
2721
2722   // Add a character
2723   application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2724
2725   // Render and notify
2726   application.SendNotification();
2727   application.Render();
2728
2729   DALI_TEST_EQUALS("DcdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2730
2731   // Test to select some text in the right of the current cursor position
2732   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2733   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2734   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2735   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2736
2737   // Render and notify
2738   application.SendNotification();
2739   application.Render();
2740
2741   // Test the cursor position with left arrow key
2742   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2743
2744   // Render and notify
2745   application.SendNotification();
2746   application.Render();
2747
2748   // Add a character
2749   application.ProcessEvent(GenerateKey("x", "", "x", KEY_X_CODE, 0, 0, Integration::KeyEvent::DOWN, "x", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2750
2751   // Render and notify
2752   application.SendNotification();
2753   application.Render();
2754
2755   DALI_TEST_EQUALS("DcxdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2756
2757   // Test to select some text in the left of the current cursor position
2758   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2759   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2760   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2761   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2762
2763   // Render and notify
2764   application.SendNotification();
2765   application.Render();
2766
2767   // Test the cursor position with right arrow key
2768   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2769
2770   // Render and notify
2771   application.SendNotification();
2772   application.Render();
2773
2774   // Add a character
2775   application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
2776
2777   // Render and notify
2778   application.SendNotification();
2779   application.Render();
2780
2781   DALI_TEST_EQUALS("DcxcdALci", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
2782
2783   END_TEST;
2784 }
2785
2786 int utcDaliTextEditorHandles(void)
2787 {
2788   ToolkitTestApplication application;
2789   tet_infoline(" utcDaliTextEditorHandles");
2790
2791   TextEditor editor = TextEditor::New();
2792   DALI_TEST_CHECK(editor);
2793
2794   application.GetScene().Add(editor);
2795
2796   editor.SetProperty(TextEditor::Property::TEXT, "This is a long text for the size of the text-editor.");
2797   editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
2798   editor.SetProperty(TextEditor::Property::GRAB_HANDLE_IMAGE, HANDLE_IMAGE_FILE_NAME);
2799   editor.SetProperty(TextEditor::Property::SMOOTH_SCROLL, true);
2800
2801   editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, Property::Map{{"filename", HANDLE_LEFT_SELECTION_FILE_NAME}});
2802   editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT, Property::Map{{"filename", HANDLE_LEFT_SELECTION_FILE_NAME}});
2803   editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT, Property::Map{{"filename", HANDLE_RIGHT_SELECTION_FILE_NAME}});
2804   editor.SetProperty(TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, Property::Map{{"filename", HANDLE_RIGHT_SELECTION_FILE_NAME}});
2805
2806   editor.SetProperty(Actor::Property::SIZE, Vector2(30.f, 500.f));
2807   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2808   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2809
2810   // Avoid a crash when core load gl resources.
2811   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
2812
2813   // Render and notify
2814   application.SendNotification();
2815   application.Render();
2816
2817   // Tap first to get the focus.
2818   TestGenerateTap(application, 3.0f, 25.0f, 100);
2819
2820   // Render and notify
2821   application.SendNotification();
2822   application.Render();
2823
2824   // Tap to create the grab handle.
2825   TestGenerateTap(application, 3.0f, 25.0f, 700);
2826
2827   // Render and notify
2828   application.SendNotification();
2829   application.Render();
2830
2831   // Get the active layer where the text's decoration is added.
2832   Actor activeLayer = editor.GetChildAt(1u);
2833
2834   // Get the handle's actor.
2835   Actor handle = activeLayer.GetChildAt(0u);
2836   handle.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
2837
2838   // Render and notify
2839   application.SendNotification();
2840   application.Render();
2841
2842   // Touch the grab handle to set it as pressed.
2843   Vector2                       touchPos(10.0f, 50.0f);
2844   Dali::Integration::TouchEvent event;
2845   event = Dali::Integration::TouchEvent();
2846   event.AddPoint(GetPointDownInside(touchPos));
2847   application.ProcessEvent(event);
2848
2849   // Render and notify
2850   application.SendNotification();
2851   application.Render();
2852
2853   // Pan the grab handle
2854   uint32_t time = 100;
2855   TestStartPan(application, Vector2(10.0f, 50.0f), Vector2(10.0f, 50.0f), time);
2856   TestMovePan(application, Vector2(10.0f, 30.0f), time);
2857   TestEndPan(application, Vector2(10.0f, 50.0f), time);
2858   application.SendNotification();
2859   application.Render();
2860
2861   // Release the grab handle.
2862   event = Dali::Integration::TouchEvent();
2863   event.AddPoint(GetPointUpInside(touchPos));
2864   application.ProcessEvent(event);
2865
2866   // Render and notify
2867   application.SendNotification();
2868   application.Render();
2869
2870   // Tap first to get the focus.
2871   TestGenerateTap(application, 3.0f, 25.0f, 1400);
2872
2873   // Render and notify
2874   application.SendNotification();
2875   application.Render();
2876
2877   // Double tap to select a word and create the selection handles.
2878   TestGenerateTap(application, 3.0f, 25.0f, 1500);
2879
2880   // Render and notify
2881   application.SendNotification();
2882   application.Render();
2883
2884   touchPos = Vector2(10.0f, 50.0f);
2885
2886   // Touch the left selection handle to set it as pressed.
2887   event = Dali::Integration::TouchEvent();
2888   event.AddPoint(GetPointDownInside(touchPos));
2889   application.ProcessEvent(event);
2890
2891   // Render and notify
2892   application.SendNotification();
2893   application.Render();
2894
2895   // Release the left selection handle.
2896   event = Dali::Integration::TouchEvent();
2897   event.AddPoint(GetPointUpInside(touchPos));
2898   application.ProcessEvent(event);
2899
2900   // Render and notify
2901   application.SendNotification();
2902   application.Render();
2903
2904   END_TEST;
2905 }
2906
2907 int utcDaliTextEditorUnderPropertyStringP(void)
2908 {
2909   ToolkitTestApplication application;
2910   tet_infoline(" utcDaliTextEditorUnderPropertyStringP");
2911   TextEditor editor = TextEditor::New();
2912   DALI_TEST_CHECK(editor);
2913
2914   std::string underlineSettings1("{\"enable\":\"true\",\"color\":\"red\",\"height\":\"1\",\"type\":\"SOLID\",\"dashWidth\":\"2\",\"dashGap\":\"1\"}");
2915
2916   application.GetScene().Add(editor);
2917
2918   editor.SetProperty(TextEditor::Property::UNDERLINE, underlineSettings1);
2919   DALI_TEST_EQUALS(editor.GetProperty<std::string>(TextEditor::Property::UNDERLINE), underlineSettings1, TEST_LOCATION);
2920
2921   tet_infoline("Set underline settings with a map");
2922   // Check the input underline property
2923   Property::Map underlineMapSet;
2924   Property::Map underlineMapGet;
2925   underlineMapSet.Insert("enable", true);
2926   underlineMapSet.Insert("color", Color::BLUE);
2927   underlineMapSet.Insert("height", 1);
2928   underlineMapSet.Insert("type", Text::Underline::SOLID);
2929   underlineMapSet.Insert("dashWidth", 2);
2930   underlineMapSet.Insert("dashGap", 1);
2931
2932   editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
2933   editor.SetProperty(TextEditor::Property::TEXT, "text");
2934   underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
2935   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
2936   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapSet, underlineMapGet), true, TEST_LOCATION);
2937
2938   application.SendNotification();
2939   application.Render();
2940
2941   underlineMapSet.Clear();
2942   underlineMapGet.Clear();
2943
2944   tet_infoline("Set dashed underline settings with a map");
2945   // Check the input underline property
2946   underlineMapSet.Clear();
2947   underlineMapGet.Clear();
2948   underlineMapSet.Insert("enable", true);
2949   underlineMapSet.Insert("color", Color::BLUE);
2950   underlineMapSet.Insert("height", 1);
2951   underlineMapSet.Insert("type", Text::Underline::DASHED);
2952   underlineMapSet.Insert("dashWidth", 5);
2953   underlineMapSet.Insert("dashGap", 3);
2954
2955   editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
2956   editor.SetProperty(TextEditor::Property::TEXT, "text");
2957   underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
2958   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
2959   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapSet, underlineMapGet), true, TEST_LOCATION);
2960
2961   // Check the input underline property
2962   underlineMapSet.Clear();
2963   underlineMapGet.Clear();
2964   underlineMapSet.Insert("enable", true);
2965   underlineMapSet.Insert("color", Color::BLUE);
2966   underlineMapSet.Insert("height", 1);
2967   underlineMapSet.Insert("type", Text::Underline::DOUBLE);
2968   underlineMapSet.Insert("dashWidth", 5);
2969   underlineMapSet.Insert("dashGap", 3);
2970
2971   editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
2972   editor.SetProperty(TextEditor::Property::TEXT, "text");
2973   underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
2974   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
2975   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapSet, underlineMapGet), true, TEST_LOCATION);
2976
2977   editor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
2978   editor.SetProperty(TextEditor::Property::TEXT, "text");
2979   underlineMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
2980   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
2981   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapSet, underlineMapGet), true, TEST_LOCATION);
2982
2983   application.SendNotification();
2984   application.Render();
2985
2986   underlineMapSet.Clear();
2987   underlineMapGet.Clear();
2988
2989   tet_infoline("Set underline settings with a string");
2990   editor.SetProperty(TextEditor::Property::UNDERLINE, underlineSettings1);
2991   Property::Value value = editor.GetProperty(TextEditor::Property::UNDERLINE);
2992   std::string     result;
2993   value.Get(result);
2994   DALI_TEST_EQUALS(result, underlineSettings1, TEST_LOCATION);
2995
2996   tet_infoline("Trying to set invalid underline settings, should not update and stay at previous settings");
2997   std::string underlineSettingsVoid("{\"enable\":\"true\",\"coooolor\":\"blue\",\"heeeight\":\"4\"}");
2998   editor.SetProperty(TextEditor::Property::UNDERLINE, underlineSettingsVoid);
2999   value = editor.GetProperty(TextEditor::Property::UNDERLINE);
3000   value.Get(result);
3001   DALI_TEST_EQUALS(result, underlineSettings1, TEST_LOCATION);
3002
3003   END_TEST;
3004 }
3005
3006 int utcDaliTextEditorStrikethroughPropertyStringP(void)
3007 {
3008   ToolkitTestApplication application;
3009   tet_infoline(" utcDaliTextEditorStrikethroughPropertyStringP");
3010   TextEditor editor = TextEditor::New();
3011   DALI_TEST_CHECK(editor);
3012
3013   std::string strikethroughSettings1("{\"enable\":\"true\",\"color\":\"red\",\"height\":\"2\"}");
3014
3015   application.GetScene().Add(editor);
3016
3017   editor.SetProperty(DevelTextEditor::Property::STRIKETHROUGH, strikethroughSettings1);
3018   DALI_TEST_EQUALS(editor.GetProperty<std::string>(DevelTextEditor::Property::STRIKETHROUGH), strikethroughSettings1, TEST_LOCATION);
3019
3020   tet_infoline("Set strikethrough settings with a map");