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