Adding Character Spacing
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TextEditor.cpp
1 /*
2  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <dali-toolkit-test-suite-utils.h>
19 #include <dali-toolkit/dali-toolkit.h>
20 #include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
21 #include <dali-toolkit/devel-api/text/rendering-backend.h>
22 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
23 #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(), strikethroughMapSet.Count(), TEST_LOCATION);
3021   DALI_TEST_EQUALS(DaliTestCheckMaps(strikethroughMapSet, strikethroughMapGet), true, TEST_LOCATION);
3022
3023   tet_infoline("Set strikethrough settings with a string");
3024   editor.SetProperty(DevelTextEditor::Property::STRIKETHROUGH, strikethroughSettings1);
3025   Property::Value value = editor.GetProperty(DevelTextEditor::Property::STRIKETHROUGH);
3026   std::string     result;
3027   value.Get(result);
3028   DALI_TEST_EQUALS(result, strikethroughSettings1, TEST_LOCATION);
3029
3030   tet_infoline("Trying to set invalid strikethrough settings, should not update and stay at previous settings");
3031   std::string strikethroughSettingsVoid("{\"enable\":\"true\",\"coooolor\":\"blue\",\"height\":\"2\"}");
3032   editor.SetProperty(DevelTextEditor::Property::STRIKETHROUGH, strikethroughSettingsVoid);
3033   value = editor.GetProperty(TextEditor::Property::UNDERLINE);
3034   value.Get(result);
3035   DALI_TEST_EQUALS(result, strikethroughSettings1, TEST_LOCATION);
3036
3037   END_TEST;
3038 }
3039
3040 int utcDaliTextEditorShadowPropertyStringP(void)
3041 {
3042   ToolkitTestApplication application;
3043   tet_infoline(" utcDaliTextEditorShadowPropertyStringP Setting Shadow propeties by string");
3044
3045   TextEditor editor = TextEditor::New();
3046
3047   std::string shadowSettings("{\"color\":\"green\",\"offset\":\"2 2\",\"blurRadius\":\"0\"}");
3048
3049   application.GetScene().Add(editor);
3050
3051   editor.SetProperty(TextEditor::Property::SHADOW, "{\"color\":\"green\",\"offset\":\"2 2\",\"blurRadius\":\"0\"}");
3052
3053   Property::Value value = editor.GetProperty<std::string>(TextEditor::Property::SHADOW);
3054   std::string     result;
3055   value.Get(result);
3056
3057   DALI_TEST_EQUALS(result, shadowSettings, TEST_LOCATION);
3058
3059   END_TEST;
3060 }
3061
3062 int utcDaliTextEditorFontStylePropertyStringP(void)
3063 {
3064   ToolkitTestApplication application;
3065   tet_infoline(" utcDaliTextEditorFontStylePropertyStringP Setting FontStyle propeties by string");
3066
3067   TextEditor editor = TextEditor::New();
3068
3069   std::string fontStyleSettings("{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}");
3070
3071   application.GetScene().Add(editor);
3072
3073   editor.SetProperty(TextEditor::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}");
3074
3075   Property::Value value = editor.GetProperty<std::string>(TextEditor::Property::FONT_STYLE);
3076   std::string     result;
3077   value.Get(result);
3078
3079   DALI_TEST_EQUALS(result, fontStyleSettings, TEST_LOCATION);
3080
3081   END_TEST;
3082 }
3083
3084 int utcDaliTextEditorGetPropertyLinecountP(void)
3085 {
3086   ToolkitTestApplication application;
3087
3088   tet_infoline(" utcDaliTextEditorGetPropertyLinecount getting line count property");
3089
3090   int lineCount = 0;
3091
3092   TextEditor editor = TextEditor::New();
3093   editor.SetProperty(TextEditor::Property::POINT_SIZE, 10);
3094   editor.SetProperty(TextEditor::Property::TEXT,
3095                      "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST ");
3096
3097   application.GetScene().Add(editor);
3098
3099   editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
3100   lineCount = editor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3101   DALI_TEST_EQUALS(lineCount, 14, TEST_LOCATION);
3102
3103   editor.SetProperty(Actor::Property::SIZE, Vector2(50.f, 100.f));
3104   lineCount = editor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3105   DALI_TEST_EQUALS(lineCount, 28, TEST_LOCATION);
3106
3107   END_TEST;
3108 }
3109
3110 int utcDaliTextEditorScrollStateChangedSignalTest(void)
3111 {
3112   ToolkitTestApplication application;
3113   tet_infoline(" UtcDaliTextEditorScrollStateChangedSignalTest");
3114
3115   TextEditor editor = TextEditor::New();
3116   DALI_TEST_CHECK(editor);
3117
3118   application.GetScene().Add(editor);
3119
3120   editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
3121   editor.SetProperty(Actor::Property::SIZE, Vector2(50.f, 50.f));
3122   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3123   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3124   editor.SetProperty(TextEditor::Property::ENABLE_SCROLL_BAR, true);
3125   editor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
3126
3127   bool startedCalled  = false;
3128   bool finishedCalled = false;
3129
3130   ScrollStateChangeCallback callback(startedCalled, finishedCalled);
3131   editor.ScrollStateChangedSignal().Connect(&callback, &ScrollStateChangeCallback::Callback);
3132
3133   KeyboardFocusManager::Get().SetCurrentFocusActor(editor);
3134
3135   // Render and notify
3136   application.SendNotification();
3137   application.Render();
3138
3139   editor.SetProperty(TextEditor::Property::TEXT, "Long enough message for TextEditor!");
3140   application.SendNotification();
3141   application.Render(6000);
3142
3143   application.SendNotification();
3144   DALI_TEST_EQUALS(startedCalled, true, TEST_LOCATION);
3145   DALI_TEST_EQUALS(finishedCalled, true, TEST_LOCATION);
3146
3147   END_TEST;
3148 }
3149
3150 int UtcDaliToolkitTextEditorTextWrapMode(void)
3151 {
3152   ToolkitTestApplication application;
3153   tet_infoline(" UtcDaliToolkitTextEditorTextWarpMode");
3154
3155   int lineCount = 0;
3156
3157   TextEditor editor = TextEditor::New();
3158   editor.SetProperty(Actor::Property::SIZE, Vector2(150.0f, 300.f));
3159   editor.SetProperty(TextEditor::Property::TEXT, "Hello world Hello world");
3160
3161   application.GetScene().Add(editor);
3162
3163   editor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, "WORD");
3164   DALI_TEST_EQUALS(editor.GetProperty<int>(TextEditor::Property::LINE_WRAP_MODE), static_cast<int>(Text::LineWrap::WORD), TEST_LOCATION);
3165
3166   application.SendNotification();
3167   application.Render();
3168
3169   lineCount = editor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3170   DALI_TEST_EQUALS(lineCount, 4, TEST_LOCATION);
3171
3172   editor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, "CHARACTER");
3173   DALI_TEST_EQUALS(editor.GetProperty<int>(TextEditor::Property::LINE_WRAP_MODE), static_cast<int>(Text::LineWrap::CHARACTER), TEST_LOCATION);
3174
3175   application.SendNotification();
3176   application.Render();
3177
3178   lineCount = editor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3179   DALI_TEST_EQUALS(lineCount, 3, TEST_LOCATION);
3180
3181   editor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, Text::LineWrap::WORD);
3182   DALI_TEST_EQUALS(editor.GetProperty<int>(TextEditor::Property::LINE_WRAP_MODE), static_cast<int>(Text::LineWrap::WORD), TEST_LOCATION);
3183
3184   application.SendNotification();
3185   application.Render();
3186
3187   lineCount = editor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3188   DALI_TEST_EQUALS(lineCount, 4, TEST_LOCATION);
3189
3190   editor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, Text::LineWrap::CHARACTER);
3191   DALI_TEST_EQUALS(editor.GetProperty<int>(TextEditor::Property::LINE_WRAP_MODE), static_cast<int>(Text::LineWrap::CHARACTER), TEST_LOCATION);
3192
3193   application.SendNotification();
3194   application.Render();
3195
3196   lineCount = editor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3197   DALI_TEST_EQUALS(lineCount, 3, TEST_LOCATION);
3198
3199   END_TEST;
3200 }
3201
3202 int UtcDaliTextEditorSetPaddingProperty(void)
3203 {
3204   ToolkitTestApplication application;
3205   tet_infoline("UtcDaliTextEditorSetPaddingProperty\n");
3206
3207   TextEditor editor = TextEditor::New();
3208   DALI_TEST_CHECK(editor);
3209   editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3210   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3211   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3212   application.GetScene().Add(editor);
3213
3214   application.SendNotification();
3215   application.Render();
3216
3217   Vector3 originalSize = editor.GetNaturalSize();
3218
3219   editor.SetProperty(Toolkit::Control::Property::PADDING, Extents(10, 10, 10, 10));
3220
3221   application.SendNotification();
3222   application.Render();
3223
3224   DALI_TEST_EQUALS(editor.GetProperty<Extents>(Toolkit::Control::Property::PADDING), Extents(10, 10, 10, 10), TEST_LOCATION);
3225
3226   Vector3 paddingAddedSize = editor.GetNaturalSize();
3227
3228   DALI_TEST_EQUALS(originalSize.width + 10 + 10, paddingAddedSize.width, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
3229
3230   DALI_TEST_EQUALS(originalSize.height + 10 + 10, paddingAddedSize.height, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
3231
3232   END_TEST;
3233 }
3234
3235 int UtcDaliTextEditorEnableShiftSelectionProperty(void)
3236 {
3237   ToolkitTestApplication application;
3238   tet_infoline("UtcDaliTextEditorEnableShiftSelectionProperty");
3239
3240   TextEditor editor = TextEditor::New();
3241   DALI_TEST_CHECK(editor);
3242   editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3243   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3244   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3245   application.GetScene().Add(editor);
3246
3247   application.SendNotification();
3248   application.Render();
3249
3250   // The default value of ENABLE_SHIFT_SELECTION is 'true'.
3251   DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_SHIFT_SELECTION), true, TEST_LOCATION);
3252
3253   // Check the enable shift selection property
3254   editor.SetProperty(DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false);
3255   DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_SHIFT_SELECTION), false, TEST_LOCATION);
3256
3257   application.SendNotification();
3258   application.Render();
3259
3260   END_TEST;
3261 }
3262
3263 int UtcDaliTextEditorEnableGrabHandleProperty(void)
3264 {
3265   ToolkitTestApplication application;
3266   tet_infoline("UtcDaliTextEditorEnableGrabHandleProperty");
3267
3268   TextEditor editor = TextEditor::New();
3269   DALI_TEST_CHECK(editor);
3270   editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3271   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3272   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3273   application.GetScene().Add(editor);
3274
3275   application.SendNotification();
3276   application.Render();
3277
3278   // The default value of ENABLE_GRAB_HANDLE is 'true'.
3279   DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_GRAB_HANDLE), true, TEST_LOCATION);
3280
3281   // Check the enable grab handle property
3282   editor.SetProperty(DevelTextEditor::Property::ENABLE_GRAB_HANDLE, false);
3283   DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::ENABLE_GRAB_HANDLE), false, TEST_LOCATION);
3284
3285   application.SendNotification();
3286   application.Render();
3287
3288   END_TEST;
3289 }
3290
3291 int UtcDaliTextEditorMatchSystemLanguageDirectionProperty(void)
3292 {
3293   ToolkitTestApplication application;
3294   tet_infoline("UtcDaliTextEditorMatchSystemLanguageDirectionProperty");
3295
3296   TextEditor editor = TextEditor::New();
3297   DALI_TEST_CHECK(editor);
3298   editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3299   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3300   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3301   application.GetScene().Add(editor);
3302
3303   application.SendNotification();
3304   application.Render();
3305
3306   // The default value of MATCH_SYSTEM_LANGUAGE_DIRECTION is 'true'.
3307   DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION), true, TEST_LOCATION);
3308
3309   // Check the disable match system language direction property
3310   editor.SetProperty(DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, false);
3311   DALI_TEST_EQUALS(editor.GetProperty<bool>(DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION), false, TEST_LOCATION);
3312
3313   application.SendNotification();
3314   application.Render();
3315
3316   END_TEST;
3317 }
3318
3319 int UtcDaliTextEditorGetInputMethodContext(void)
3320 {
3321   ToolkitTestApplication application;
3322   tet_infoline("UtcDaliTextEditorGetInputMethodContext");
3323
3324   TextEditor editor = TextEditor::New();
3325   DALI_TEST_CHECK(DevelTextEditor::GetInputMethodContext(editor));
3326
3327   END_TEST;
3328 }
3329
3330 int utcDaliTextEditorMaxCharactersReached(void)
3331 {
3332   ToolkitTestApplication application;
3333   tet_infoline("utcDaliTextEditorMaxCharactersReached");
3334
3335   TextEditor editor = TextEditor::New();
3336   DALI_TEST_CHECK(editor);
3337
3338   application.GetScene().Add(editor);
3339
3340   const int maxNumberOfCharacters = 1;
3341   editor.SetProperty(DevelTextEditor::Property::MAX_LENGTH, maxNumberOfCharacters);
3342   DALI_TEST_EQUALS(editor.GetProperty<int>(DevelTextEditor::Property::MAX_LENGTH), maxNumberOfCharacters, TEST_LOCATION);
3343
3344   editor.SetKeyInputFocus();
3345
3346   // connect to the text changed signal.
3347   ConnectionTracker* testTracker = new ConnectionTracker();
3348   DevelTextEditor::MaxLengthReachedSignal(editor).Connect(&TestMaxLengthReachedCallback);
3349   bool maxLengthReachedSignal = false;
3350   editor.ConnectSignal(testTracker, "maxLengthReached", CallbackFunctor(&maxLengthReachedSignal));
3351
3352   gMaxCharactersCallBackCalled = false;
3353
3354   application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
3355   application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
3356
3357   DALI_TEST_CHECK(gMaxCharactersCallBackCalled);
3358   DALI_TEST_CHECK(maxLengthReachedSignal);
3359
3360   END_TEST;
3361 }
3362
3363 int utcDaliTextEditorInputFiltered(void)
3364 {
3365   ToolkitTestApplication application;
3366   tet_infoline(" utcDaliTextEditorInputFiltered");
3367   TextEditor editor = TextEditor::New();
3368   DALI_TEST_CHECK(editor);
3369
3370   application.GetScene().Add(editor);
3371
3372   Property::Map inputFilter;
3373
3374   // Only digit is accepted.
3375   inputFilter[InputFilter::Property::ACCEPTED] = "[\\d]";
3376
3377   // Set input filter to TextEditor.
3378   editor.SetProperty(DevelTextEditor::Property::INPUT_FILTER, inputFilter);
3379
3380   editor.SetKeyInputFocus();
3381
3382   // connect to the input filtered signal.
3383   ConnectionTracker* testTracker = new ConnectionTracker();
3384   DevelTextEditor::InputFilteredSignal(editor).Connect(&TestInputFilteredCallback);
3385   bool inputFilteredSignal = false;
3386   editor.ConnectSignal(testTracker, "inputFiltered", CallbackFunctor(&inputFilteredSignal));
3387
3388   gInputFilteredAcceptedCallbackCalled = false;
3389
3390   application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
3391
3392   DALI_TEST_CHECK(gInputFilteredAcceptedCallbackCalled);
3393   DALI_TEST_CHECK(inputFilteredSignal);
3394
3395   // Word is rejected.
3396   inputFilter[InputFilter::Property::ACCEPTED] = "";
3397   inputFilter[InputFilter::Property::REJECTED] = "[\\w]";
3398
3399   // Set input filter to TextEditor.
3400   editor.SetProperty(DevelTextEditor::Property::INPUT_FILTER, inputFilter);
3401
3402   editor.SetKeyInputFocus();
3403
3404   inputFilteredSignal                  = false;
3405   gInputFilteredRejectedCallbackCalled = false;
3406
3407   application.ProcessEvent(GenerateKey("a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
3408
3409   DALI_TEST_CHECK(gInputFilteredAcceptedCallbackCalled);
3410   DALI_TEST_CHECK(inputFilteredSignal);
3411
3412   END_TEST;
3413 }
3414
3415 int UtcDaliTextEditorSelectWholeText(void)
3416 {
3417   ToolkitTestApplication application;
3418   tet_infoline(" UtcDaliTextEditorSelectWholeText ");
3419
3420   TextEditor textEditor = TextEditor::New();
3421
3422   application.GetScene().Add(textEditor);
3423
3424   textEditor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3425   textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3426   textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3427
3428   // Avoid a crash when core load gl resources.
3429   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
3430
3431   application.SendNotification();
3432   application.Render();
3433
3434   DALI_TEST_EQUALS(1u, textEditor.GetChildCount(), TEST_LOCATION);
3435
3436   DevelTextEditor::SelectWholeText(textEditor);
3437
3438   application.SendNotification();
3439   application.Render();
3440
3441   // Nothing should have been selected. The number of children is still 1
3442   DALI_TEST_EQUALS(1u, textEditor.GetChildCount(), TEST_LOCATION);
3443
3444   textEditor.SetProperty(TextEditor::Property::TEXT, "Hello world");
3445
3446   application.SendNotification();
3447   application.Render();
3448
3449   DevelTextEditor::SelectWholeText(textEditor);
3450
3451   application.SendNotification();
3452   application.Render();
3453
3454   // Should be 2 children, the stencil and the layer
3455   DALI_TEST_EQUALS(2u, textEditor.GetChildCount(), TEST_LOCATION);
3456
3457   // The offscreen root actor should have two actors: the renderer and the highlight actor.
3458   Actor stencil = textEditor.GetChildAt(0u);
3459
3460   // The highlight actor is drawn first, so is the first actor in the list
3461   Renderer highlight = stencil.GetChildAt(0u).GetRendererAt(0u);
3462   DALI_TEST_CHECK(highlight);
3463
3464   END_TEST;
3465 }
3466
3467 int UtcDaliTextEditorSelectText(void)
3468 {
3469   ToolkitTestApplication application;
3470   tet_infoline(" UtcDaliTextEditorSelectText ");
3471
3472   TextEditor textEditor = TextEditor::New();
3473
3474   application.GetScene().Add(textEditor);
3475
3476   textEditor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3477   textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3478   textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3479
3480   // Avoid a crash when core load gl resources.
3481   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
3482
3483   application.SendNotification();
3484   application.Render();
3485
3486   DevelTextEditor::SelectText(textEditor, 0, 5);
3487
3488   application.SendNotification();
3489   application.Render();
3490
3491   // Nothing is selected
3492   std::string selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
3493   DALI_TEST_EQUALS("", selectedText, TEST_LOCATION);
3494
3495   textEditor.SetProperty(TextEditor::Property::TEXT, "Hello world");
3496
3497   application.SendNotification();
3498   application.Render();
3499
3500   DevelTextEditor::SelectText(textEditor, 0, 5);
3501
3502   application.SendNotification();
3503   application.Render();
3504
3505   selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
3506   DALI_TEST_EQUALS("Hello", selectedText, TEST_LOCATION);
3507
3508   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 0, TEST_LOCATION);
3509   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 5, TEST_LOCATION);
3510
3511   // world is selected
3512   DevelTextEditor::SelectText(textEditor, 6, 11);
3513
3514   application.SendNotification();
3515   application.Render();
3516
3517   selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
3518   DALI_TEST_EQUALS("world", selectedText, TEST_LOCATION);
3519
3520   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 6, TEST_LOCATION);
3521   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 11, TEST_LOCATION);
3522
3523   END_TEST;
3524 }
3525
3526 int UtcDaliTextEditorSelectNone(void)
3527 {
3528   ToolkitTestApplication application;
3529   tet_infoline(" UtcDaliTextEditorSelectWholeText ");
3530
3531   TextEditor textEditor = TextEditor::New();
3532
3533   application.GetScene().Add(textEditor);
3534
3535   textEditor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3536   textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3537   textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3538
3539   // Avoid a crash when core load gl resources.
3540   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
3541
3542   application.SendNotification();
3543   application.Render();
3544
3545   textEditor.SetProperty(TextEditor::Property::TEXT, "Hello world");
3546
3547   application.SendNotification();
3548   application.Render();
3549
3550   // Nothing is selected
3551   std::string selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
3552   DALI_TEST_EQUALS("", selectedText, TEST_LOCATION);
3553
3554   DevelTextEditor::SelectWholeText(textEditor);
3555
3556   application.SendNotification();
3557   application.Render();
3558
3559   // whole text is selected
3560   selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
3561   DALI_TEST_EQUALS("Hello world", selectedText, TEST_LOCATION);
3562
3563   DevelTextEditor::SelectNone(textEditor);
3564
3565   application.SendNotification();
3566   application.Render();
3567
3568   // Nothing is selected
3569   selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
3570   DALI_TEST_EQUALS("", selectedText, TEST_LOCATION);
3571
3572   END_TEST;
3573 }
3574
3575 int UtcDaliTextEditorSelectRange(void)
3576 {
3577   ToolkitTestApplication application;
3578   tet_infoline("utcDaliTextEditorSelectRange");
3579
3580   TextEditor textEditor = TextEditor::New();
3581   DALI_TEST_CHECK(textEditor);
3582
3583   application.GetScene().Add(textEditor);
3584
3585   // Avoid a crash when core load gl resources.
3586   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
3587
3588   application.SendNotification();
3589   application.Render();
3590
3591   textEditor.SetProperty(TextEditor::Property::TEXT, "Hello world");
3592
3593   textEditor.SetProperty(DevelTextEditor::Property::SELECTED_TEXT_START, 0);
3594   textEditor.SetProperty(DevelTextEditor::Property::SELECTED_TEXT_END, 5);
3595
3596   // Hello is selected
3597   std::string selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
3598   DALI_TEST_EQUALS("Hello", selectedText, TEST_LOCATION);
3599
3600   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 0, TEST_LOCATION);
3601   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 5, TEST_LOCATION);
3602
3603   END_TEST;
3604 }
3605
3606 int UtcDaliTextEditorEnableEditing(void)
3607 {
3608   ToolkitTestApplication application;
3609   tet_infoline(" UtcDaliTextEditorEnableEditing ");
3610
3611   TextEditor textEditor = TextEditor::New();
3612
3613   application.GetScene().Add(textEditor);
3614
3615   textEditor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3616   textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3617   textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3618
3619   // Avoid a crash when core load gl resources.
3620   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
3621
3622   application.SendNotification();
3623   application.Render();
3624
3625   textEditor.SetKeyInputFocus();
3626   textEditor.SetProperty(DevelTextEditor::Property::ENABLE_EDITING, false);
3627   application.ProcessEvent(GenerateKey("D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
3628
3629   // Render and notify
3630   application.SendNotification();
3631   application.Render();
3632
3633   DALI_TEST_EQUALS(textEditor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "", TEST_LOCATION);
3634   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::ENABLE_EDITING).Get<bool>(), false, TEST_LOCATION);
3635
3636   textEditor.SetKeyInputFocus();
3637   textEditor.SetProperty(DevelTextEditor::Property::ENABLE_EDITING, true);
3638   application.ProcessEvent(GenerateKey("D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
3639
3640   // Render and notify
3641   application.SendNotification();
3642   application.Render();
3643
3644   DALI_TEST_EQUALS(textEditor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "D", TEST_LOCATION);
3645   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::ENABLE_EDITING).Get<bool>(), true, TEST_LOCATION);
3646
3647   END_TEST;
3648 }
3649
3650 int UtcDaliTextEditorScrolling(void)
3651 {
3652   ToolkitTestApplication application;
3653   tet_infoline(" UtcDaliTextEditorScrolling ");
3654
3655   TextEditor textEditor = TextEditor::New();
3656   DALI_TEST_CHECK(textEditor);
3657
3658   application.GetScene().Add(textEditor);
3659
3660   // Avoid a crash when core load gl resources.
3661   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
3662
3663   application.SendNotification();
3664   application.Render();
3665
3666   textEditor.SetProperty(TextEditor::Property::TEXT, "Tex1\nTex2\nTex3\nTex4\nTex5\nTex6\nTex7\nTex8");
3667   textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER);
3668   textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER);
3669   textEditor.SetProperty(Actor::Property::SIZE, Vector2(60.0f, 160.0f));
3670
3671   application.SendNotification();
3672   application.Render();
3673
3674   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::VERTICAL_SCROLL_POSITION).Get<float>(), 0.0f, TEST_LOCATION);
3675   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::HORIZONTAL_SCROLL_POSITION).Get<float>(), 0.0f, TEST_LOCATION);
3676
3677   DevelTextEditor::ScrollBy(textEditor, Vector2(1.0f, 1.0f));
3678
3679   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::VERTICAL_SCROLL_POSITION).Get<float>(), 1.0f, TEST_LOCATION);
3680   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::HORIZONTAL_SCROLL_POSITION).Get<float>(), 0.0f, TEST_LOCATION);
3681
3682   DevelTextEditor::ScrollBy(textEditor, Vector2(0.0f, 1000.0f));
3683
3684   DALI_TEST_NOT_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::VERTICAL_SCROLL_POSITION).Get<float>(), 1.0f, 0.1f, TEST_LOCATION);
3685   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::HORIZONTAL_SCROLL_POSITION).Get<float>(), 0.0f, TEST_LOCATION);
3686
3687   textEditor.SetProperty(DevelTextEditor::Property::VERTICAL_SCROLL_POSITION, 0.0f);
3688   textEditor.SetProperty(DevelTextEditor::Property::HORIZONTAL_SCROLL_POSITION, 0.0f);
3689
3690   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::VERTICAL_SCROLL_POSITION).Get<float>(), 0.0f, TEST_LOCATION);
3691   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::HORIZONTAL_SCROLL_POSITION).Get<float>(), 0.0f, TEST_LOCATION);
3692
3693   END_TEST;
3694 }
3695
3696 int UtcDaliToolkitTextEditorFontSizeScale(void)
3697 {
3698   ToolkitTestApplication application;
3699   tet_infoline(" UtcDaliToolkitTextEditorFontSizeScale");
3700
3701   TextEditor textEditor = TextEditor::New();
3702   textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 30.f);
3703   textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
3704   Vector3 nonScaledSize = textEditor.GetNaturalSize();
3705
3706   TextEditor textEditorScaled = TextEditor::New();
3707   textEditorScaled.SetProperty(TextEditor::Property::POINT_SIZE, 15.f);
3708   textEditorScaled.SetProperty(Toolkit::DevelTextEditor::Property::FONT_SIZE_SCALE, 2.f);
3709   textEditorScaled.SetProperty(TextEditor::Property::TEXT, "Test");
3710   Vector3 scaledSize = textEditorScaled.GetNaturalSize();
3711
3712   DALI_TEST_EQUALS(nonScaledSize, scaledSize, TEST_LOCATION);
3713
3714   textEditor.SetProperty(TextEditor::Property::PIXEL_SIZE, 30.f);
3715   textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
3716   nonScaledSize = textEditor.GetNaturalSize();
3717
3718   textEditorScaled.SetProperty(TextEditor::Property::PIXEL_SIZE, 15.f);
3719   textEditorScaled.SetProperty(Toolkit::DevelTextEditor::Property::FONT_SIZE_SCALE, 2.f);
3720   textEditorScaled.SetProperty(TextEditor::Property::TEXT, "Test");
3721   scaledSize = textEditorScaled.GetNaturalSize();
3722
3723   DALI_TEST_EQUALS(nonScaledSize, scaledSize, TEST_LOCATION);
3724
3725   END_TEST;
3726 }
3727
3728 int UtcDaliTextEditorPrimaryCursorPosition(void)
3729 {
3730   ToolkitTestApplication application;
3731   tet_infoline(" UtcDaliTextPrimaryCursorPosition ");
3732
3733   TextEditor textEditor = TextEditor::New();
3734
3735   application.GetScene().Add(textEditor);
3736
3737   textEditor.SetProperty(TextEditor::Property::TEXT, "ABCEF");
3738   textEditor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3739   textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3740   textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3741
3742   // Avoid a crash when core load gl resources.
3743   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
3744
3745   textEditor.SetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 3);
3746   application.SendNotification();
3747   application.Render();
3748   textEditor.SetKeyInputFocus();
3749
3750   application.ProcessEvent(GenerateKey("D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
3751
3752   // Render and notify
3753   application.SendNotification();
3754   application.Render();
3755
3756   DALI_TEST_EQUALS(textEditor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "ABCDEF", TEST_LOCATION);
3757   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION).Get<int>(), 4, TEST_LOCATION);
3758
3759   END_TEST;
3760 }
3761
3762 int UtcDaliTextEditorLineCountAfterGetNaturalSize(void)
3763 {
3764   ToolkitTestApplication application;
3765   tet_infoline(" UtcDaliTextEditorLineCountAfterGetNaturalSize ");
3766
3767   TextEditor textEditor = TextEditor::New();
3768   textEditor.SetProperty(TextEditor::Property::TEXT, "A\nB\nC\nD\nE\nF\n");
3769   textEditor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
3770   textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
3771   textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
3772   application.GetScene().Add(textEditor);
3773
3774   application.SendNotification();
3775   application.Render();
3776
3777   int lineCount = 0;
3778   lineCount     = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3779   DALI_TEST_EQUALS(lineCount, 7, TEST_LOCATION);
3780
3781   textEditor.GetNaturalSize();
3782
3783   // Create a tap event to touch the text editor.
3784   TestGenerateTap(application, 18.0f, 25.0f);
3785
3786   application.SendNotification();
3787   application.Render();
3788
3789   lineCount = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3790   DALI_TEST_EQUALS(lineCount, 7, TEST_LOCATION);
3791
3792   END_TEST;
3793 }
3794
3795 int utcDaliTextEditorGetHeightForWidthDoesNotChangeLineCountScrollingCase(void)
3796 {
3797   ToolkitTestApplication application;
3798
3799   tet_infoline(" utcDaliTextEditorGetHeightForWidthDoesNotChangeLineCountScrollingCase ");
3800
3801   int lineCountBefore = 0;
3802   int lineCountAfter  = 0;
3803
3804   // Create a text editor
3805   TextEditor textEditor = TextEditor::New();
3806   //Set very large font-size using point-size
3807   textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 10);
3808   //Specify font-family
3809   textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
3810   //Specify size
3811   textEditor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
3812   //Set text longer than width of textEditor
3813   textEditor.SetProperty(TextEditor::Property::TEXT, "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST ");
3814
3815   application.GetScene().Add(textEditor);
3816
3817   application.SendNotification();
3818   application.Render();
3819
3820   //Failed case is the GetHeightForWidth change LineCount then the scrollor will not arrive to latest line
3821   //GetHeightForWidth is a retrieval method which should not modify object
3822   lineCountBefore = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3823   textEditor.GetHeightForWidth(200.f);
3824
3825   //This is to simulate focus into text editor after calling GetHeightForWidth
3826   //Create a tap event to touch the text editor.
3827   TestGenerateTap(application, 18.0f, 25.0f);
3828
3829   application.SendNotification();
3830   application.Render();
3831
3832   lineCountAfter = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3833
3834   //The LineCount must not be changed when calling GetHeightForWidth.
3835   DALI_TEST_EQUALS(lineCountAfter, lineCountBefore, TEST_LOCATION);
3836
3837   END_TEST;
3838 }
3839
3840 int utcDaliTextEditorGetHeightForWidthDoesNotChangeLineCountLineWrapCharCase(void)
3841 {
3842   ToolkitTestApplication application;
3843
3844   tet_infoline(" utcDaliTextEditorGetHeightForWidthDoesNotChangeLineCountLineWrapCharCase ");
3845
3846   int lineCountBefore = 0;
3847   int lineCountAfter  = 0;
3848
3849   // Create a text editor
3850   TextEditor textEditor = TextEditor::New();
3851   //Set very large font-size using point-size
3852   textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 10);
3853   //Specify font-family
3854   textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
3855   //Specify size
3856   textEditor.SetProperty(Actor::Property::SIZE, Vector2(50.f, 100.f));
3857   //Set text longer than width of textEditor
3858   textEditor.SetProperty(TextEditor::Property::TEXT, "qwertyuiopasdfghjklzxcvbnm\n");
3859   //Set line wrap mode Character
3860   textEditor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, "CHARACTER");
3861
3862   application.GetScene().Add(textEditor);
3863
3864   application.SendNotification();
3865   application.Render();
3866
3867   //Failed case is the GetHeightForWidth change LineCount which make position of cursor invalid in TextEditor
3868   //GetHeightForWidth is a retrieval method which should not modify object
3869   lineCountBefore = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3870   textEditor.GetHeightForWidth(200.f);
3871
3872   //This is to simulate focus into text editor after calling GetHeightForWidth
3873   //Create a tap event to touch the text editor.
3874   TestGenerateTap(application, 18.0f, 25.0f);
3875
3876   application.SendNotification();
3877   application.Render();
3878
3879   lineCountAfter = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3880
3881   //The LineCount must not be changed when calling GetHeightForWidth.
3882   DALI_TEST_EQUALS(lineCountAfter, lineCountBefore, TEST_LOCATION);
3883
3884   END_TEST;
3885 }
3886
3887 int utcDaliTextEditorGetHeightForWidthChangeLineCountWhenTextChanged(void)
3888 {
3889   ToolkitTestApplication application;
3890
3891   tet_infoline(" utcDaliTextEditorGetHeightForWidthChangeLineCountWhenTextChanged ");
3892
3893   int lineCountBefore = 0;
3894   int lineCountAfter  = 0;
3895
3896   // Create a text editor
3897   TextEditor textEditor = TextEditor::New();
3898   //Set very large font-size using point-size
3899   textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 10);
3900   //Specify font-family
3901   textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
3902   //Specify size
3903   textEditor.SetProperty(Actor::Property::SIZE, Vector2(200.f, 100.f));
3904   //Set text longer than width of textEditor
3905   textEditor.SetProperty(TextEditor::Property::TEXT, "Short text");
3906   //Set line wrap mode Character
3907   textEditor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, "CHARACTER");
3908
3909   application.GetScene().Add(textEditor);
3910
3911   application.SendNotification();
3912   application.Render();
3913
3914   lineCountBefore = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3915
3916   textEditor.SetProperty(TextEditor::Property::TEXT, "This is very loooooooooooooooooooooooooooooooooooong text for test");
3917   lineCountAfter = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3918
3919   // When the text changed, the Line-count should be updated according to new text.
3920   // Because the GetHeightForWidth is called in Controller::GetLineCount(float width)
3921   DALI_TEST_EQUALS(lineCountBefore, 1, TEST_LOCATION);
3922   DALI_TEST_GREATER(lineCountAfter, 1, TEST_LOCATION);
3923
3924   END_TEST;
3925 }
3926
3927 int utcDaliTextEditorGetNaturalSizeDoesNotChangeLineCountScrollingCase(void)
3928 {
3929   ToolkitTestApplication application;
3930
3931   tet_infoline(" utcDaliTextEditorGetNaturalSizeDoesNotChangeLineCountScrollingCase ");
3932
3933   int lineCountBefore = 0;
3934   int lineCountAfter  = 0;
3935
3936   // Create a text editor
3937   TextEditor textEditor = TextEditor::New();
3938   //Set very large font-size using point-size
3939   textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 10);
3940   //Specify font-family
3941   textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
3942   //Specify size
3943   textEditor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
3944   //Set text longer than width of textEditor
3945   textEditor.SetProperty(TextEditor::Property::TEXT, "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST ");
3946
3947   application.GetScene().Add(textEditor);
3948
3949   application.SendNotification();
3950   application.Render();
3951
3952   //Failed case is the GetNaturalSize change LineCount then the scrollor will not arrive to latest line
3953   //GetNaturalSize is a retrieval method which should not modify object
3954   lineCountBefore = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3955   textEditor.GetNaturalSize();
3956
3957   //This is to simulate focus into text editor after calling GetNaturalSize
3958   //Create a tap event to touch the text editor.
3959   TestGenerateTap(application, 18.0f, 25.0f);
3960
3961   application.SendNotification();
3962   application.Render();
3963
3964   lineCountAfter = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
3965
3966   //The LineCount must not be changed when calling GetNaturalSize.
3967   DALI_TEST_EQUALS(lineCountAfter, lineCountBefore, TEST_LOCATION);
3968
3969   END_TEST;
3970 }
3971
3972 int utcDaliTextEditorGetNaturalSizeDoesNotChangeLineCountLineWrapCharCase(void)
3973 {
3974   ToolkitTestApplication application;
3975
3976   tet_infoline(" utcDaliTextEditorGetNaturalSizeDoesNotChangeLineCountLineWrapCharCase ");
3977
3978   int lineCountBefore = 0;
3979   int lineCountAfter  = 0;
3980
3981   // Create a text editor
3982   TextEditor textEditor = TextEditor::New();
3983   //Set very large font-size using point-size
3984   textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 10);
3985   //Specify font-family
3986   textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
3987   //Specify size
3988   textEditor.SetProperty(Actor::Property::SIZE, Vector2(50.f, 100.f));
3989   //Set text longer than width of textEditor
3990   textEditor.SetProperty(TextEditor::Property::TEXT, "qwertyuiopasdfghjklzxcvbnm\n");
3991   //Set line wrap mode Character
3992   textEditor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, "CHARACTER");
3993
3994   application.GetScene().Add(textEditor);
3995
3996   application.SendNotification();
3997   application.Render();
3998
3999   //Failed case is the GetNaturalSize change LineCount which make position of cursor invalid in TextEditor
4000   //GetNaturalSize is a retrieval method which should not modify object
4001   lineCountBefore = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
4002   textEditor.GetNaturalSize();
4003
4004   //This is to simulate focus into text editor after calling GetNaturalSize
4005   //Create a tap event to touch the text editor.
4006   TestGenerateTap(application, 18.0f, 25.0f);
4007
4008   application.SendNotification();
4009   application.Render();
4010
4011   lineCountAfter = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
4012
4013   //The LineCount must not be changed when calling GetNaturalSize.
4014   DALI_TEST_EQUALS(lineCountAfter, lineCountBefore, TEST_LOCATION);
4015
4016   END_TEST;
4017 }
4018
4019 int UtcDaliTextEditorAtlasLimitationIsEnabledForLargeFontPointSize(void)
4020 {
4021   ToolkitTestApplication application;
4022   tet_infoline(" UtcDaliTextEditorAtlasLimitationIsEnabledForLargeFontPointSize ");
4023
4024   // +2: First one to handle the equal case. Second one to handle odd to even case of GetNaturalSize
4025   const uint32_t lessThanWidth  = TextAbstraction::FontClient::MAX_TEXT_ATLAS_WIDTH - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
4026   const uint32_t lessThanHeight = TextAbstraction::FontClient::MAX_TEXT_ATLAS_HEIGHT - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
4027
4028   // Create a text editor
4029   TextEditor textEditor = TextEditor::New();
4030
4031   //Set size to avoid automatic eliding
4032   textEditor.SetProperty(Actor::Property::SIZE, Vector2(1025, 1025));
4033   //Set very large font-size using point-size
4034   textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 1000);
4035   //Specify font-family
4036   textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
4037   //Set text to check if appear or not
4038   textEditor.SetProperty(TextEditor::Property::TEXT, "A");
4039
4040   application.GetScene().Add(textEditor);
4041
4042   application.SendNotification();
4043   application.Render();
4044   //Use GetNaturalSize to verify that size of block does not exceed Atlas size
4045   Vector3 naturalSize = textEditor.GetNaturalSize();
4046
4047   DALI_TEST_GREATER(lessThanWidth, static_cast<uint32_t>(naturalSize.width), TEST_LOCATION);
4048   DALI_TEST_GREATER(lessThanHeight, static_cast<uint32_t>(naturalSize.height), TEST_LOCATION);
4049
4050   END_TEST;
4051 }
4052
4053 int UtcDaliTextEditorAtlasLimitationIsEnabledPerformanceCases(void)
4054 {
4055   ToolkitTestApplication application;
4056   tet_infoline(" UtcDaliTextEditorAtlasLimitationIsEnabledPerformanceCases ");
4057
4058   // +2: First one to handle the equal case. Second one to handle odd to even case of GetNaturalSize
4059   const uint32_t lessThanWidth  = TextAbstraction::FontClient::MAX_TEXT_ATLAS_WIDTH - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
4060   const uint32_t lessThanHeight = TextAbstraction::FontClient::MAX_TEXT_ATLAS_HEIGHT - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
4061
4062   Vector3 naturalSize; //Use GetNaturalSize to verify that size of block does not exceed Atlas size
4063   // Create a text editor
4064   TextEditor textEditor = TextEditor::New();
4065   //Set size to avoid automatic eliding
4066   textEditor.SetProperty(Actor::Property::SIZE, Vector2(1025, 1025));
4067   textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
4068   textEditor.SetProperty(TextEditor::Property::TEXT, "A");
4069
4070   const int numberOfCases             = 6;
4071   int       arrayCases[numberOfCases] = {323, 326, 330, 600, 1630, 2500};
4072
4073   for(int index = 0; index < numberOfCases; index++)
4074   {
4075     tet_printf(" UtcDaliTextEditorAtlasLimitationIsEnabledPerformanceCases point-size= %d \n", arrayCases[index]);
4076     textEditor.SetProperty(TextEditor::Property::POINT_SIZE, arrayCases[index]);
4077     application.GetScene().Add(textEditor);
4078     application.SendNotification();
4079     application.Render();
4080     naturalSize = textEditor.GetNaturalSize();
4081     DALI_TEST_GREATER(lessThanWidth, static_cast<uint32_t>(naturalSize.width), TEST_LOCATION);
4082     DALI_TEST_GREATER(lessThanHeight, static_cast<uint32_t>(naturalSize.height), TEST_LOCATION);
4083   }
4084
4085   END_TEST;
4086 }
4087
4088 int UtcDaliTextEditorHyphenWrapMode(void)
4089 {
4090   ToolkitTestApplication application;
4091   tet_infoline(" UtcDaliTextEditorHyphenWrapMode ");
4092
4093   int        lineCount  = 0;
4094   TextEditor textEditor = TextEditor::New();
4095
4096   textEditor.SetProperty(Actor::Property::SIZE, Vector2(150.0f, 300.f));
4097
4098   application.GetScene().Add(textEditor);
4099   application.SendNotification();
4100   application.Render();
4101
4102   textEditor.SetProperty(TextEditor::Property::TEXT, "Hi Experimen");
4103   textEditor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, DevelText::LineWrap::HYPHENATION);
4104   DALI_TEST_EQUALS(textEditor.GetProperty<int>(TextEditor::Property::LINE_WRAP_MODE), static_cast<int>(DevelText::LineWrap::HYPHENATION), TEST_LOCATION);
4105
4106   application.SendNotification();
4107   application.Render();
4108
4109   lineCount = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
4110   /*
4111     text will be :
4112     Hi Exp-
4113     erimen
4114   */
4115   DALI_TEST_EQUALS(lineCount, 2, TEST_LOCATION);
4116
4117   textEditor.SetProperty(TextEditor::Property::TEXT, "Hi Experimen");
4118   textEditor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, DevelText::LineWrap::MIXED);
4119   DALI_TEST_EQUALS(textEditor.GetProperty<int>(TextEditor::Property::LINE_WRAP_MODE), static_cast<int>(DevelText::LineWrap::MIXED), TEST_LOCATION);
4120
4121   application.SendNotification();
4122   application.Render();
4123
4124   lineCount = textEditor.GetProperty<int>(TextEditor::Property::LINE_COUNT);
4125   /*
4126     text will be :
4127     Hi
4128     Experi-
4129     men
4130   */
4131   DALI_TEST_EQUALS(lineCount, 3, TEST_LOCATION);
4132
4133   END_TEST;
4134 }
4135
4136 int UtcDaliToolkitTextEditorEllipsisPositionProperty(void)
4137 {
4138   ToolkitTestApplication application;
4139   tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty ");
4140   TextEditor textEditor = TextEditor::New();
4141
4142   tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Default is END");
4143   DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
4144
4145   tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to START");
4146   textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::START);
4147   DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::START), TEST_LOCATION);
4148
4149   tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to MIDDLE");
4150   textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::MIDDLE);
4151   DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::MIDDLE), TEST_LOCATION);
4152
4153   tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to END");
4154   textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::END);
4155   DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
4156
4157   tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to START using integer");
4158   textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, 1);
4159   DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::START), TEST_LOCATION);
4160
4161   tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to MIDDLE using integer");
4162   textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, 2);
4163   DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::MIDDLE), TEST_LOCATION);
4164
4165   tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to END using integer");
4166   textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, 0);
4167   DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
4168
4169   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - uppercase");
4170   textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "START");
4171   DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::START), TEST_LOCATION);
4172
4173   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - uppercase");
4174   textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "MIDDLE");
4175   DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::MIDDLE), TEST_LOCATION);
4176
4177   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - uppercase");
4178   textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "END");
4179   DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
4180
4181   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - lowercase");
4182   textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "start");
4183   DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::START), TEST_LOCATION);
4184
4185   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - lowercase");
4186   textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "middle");
4187   DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::MIDDLE), TEST_LOCATION);
4188
4189   tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - lowercase");
4190   textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "end");
4191   DALI_TEST_EQUALS(textEditor.GetProperty<int>(DevelTextEditor::Property::ELLIPSIS_POSITION), static_cast<int>(Toolkit::DevelText::EllipsisPosition::END), TEST_LOCATION);
4192
4193   END_TEST;
4194 }
4195
4196 int UtcDaliTextEditorCopyText(void)
4197 {
4198   ToolkitTestApplication application;
4199   tet_infoline(" UtcDaliTextEditorCopyText ");
4200
4201   TextEditor textEditor = TextEditor::New();
4202
4203   std::string selectedText = "";
4204   std::string copiedText   = "";
4205
4206   application.GetScene().Add(textEditor);
4207
4208   textEditor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
4209   textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4210   textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4211
4212   // Avoid a crash when core load gl resources.
4213   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4214
4215   application.SendNotification();
4216   application.Render();
4217
4218   textEditor.SetProperty(TextEditor::Property::TEXT, "Hello world");
4219
4220   application.SendNotification();
4221   application.Render();
4222
4223   // Hello is selected
4224   DevelTextEditor::SelectText(textEditor, 0, 5);
4225
4226   application.SendNotification();
4227   application.Render();
4228
4229   selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
4230   DALI_TEST_EQUALS("Hello", selectedText, TEST_LOCATION);
4231
4232   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 0, TEST_LOCATION);
4233   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 5, TEST_LOCATION);
4234
4235   // Hello is copied
4236   copiedText = DevelTextEditor::CopyText(textEditor);
4237   DALI_TEST_EQUALS("Hello", copiedText, TEST_LOCATION);
4238
4239   // world is selected
4240   DevelTextEditor::SelectText(textEditor, 6, 11);
4241
4242   application.SendNotification();
4243   application.Render();
4244
4245   selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
4246   DALI_TEST_EQUALS("world", selectedText, TEST_LOCATION);
4247
4248   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 6, TEST_LOCATION);
4249   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 11, TEST_LOCATION);
4250
4251   // world is copied
4252   copiedText = DevelTextEditor::CopyText(textEditor);
4253   DALI_TEST_EQUALS("world", copiedText, TEST_LOCATION);
4254
4255   // "lo wo" is selected
4256   DevelTextEditor::SelectText(textEditor, 3, 8);
4257
4258   application.SendNotification();
4259   application.Render();
4260
4261   selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
4262   DALI_TEST_EQUALS("lo wo", selectedText, TEST_LOCATION);
4263
4264   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 3, TEST_LOCATION);
4265   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 8, TEST_LOCATION);
4266
4267   // "lo wo" is copied
4268   copiedText = DevelTextEditor::CopyText(textEditor);
4269   DALI_TEST_EQUALS("lo wo", copiedText, TEST_LOCATION);
4270
4271   END_TEST;
4272 }
4273
4274 int UtcDaliTextEditorCutText(void)
4275 {
4276   ToolkitTestApplication application;
4277   tet_infoline(" UtcDaliTextEditorCutText ");
4278
4279   TextEditor textEditor = TextEditor::New();
4280
4281   std::string selectedText = "";
4282
4283   application.GetScene().Add(textEditor);
4284
4285   textEditor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
4286   textEditor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4287   textEditor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4288
4289   // Avoid a crash when core load gl resources.
4290   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4291
4292   application.SendNotification();
4293   application.Render();
4294
4295   textEditor.SetProperty(TextEditor::Property::TEXT, "Hello world");
4296
4297   application.SendNotification();
4298   application.Render();
4299
4300   // Hello is selected
4301   DevelTextEditor::SelectText(textEditor, 0, 5);
4302
4303   application.SendNotification();
4304   application.Render();
4305
4306   selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
4307   DALI_TEST_EQUALS("Hello", selectedText, TEST_LOCATION);
4308
4309   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 0, TEST_LOCATION);
4310   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 5, TEST_LOCATION);
4311
4312   // Hello is cut
4313   DALI_TEST_EQUALS("Hello", DevelTextEditor::CutText(textEditor), TEST_LOCATION);
4314
4315   application.SendNotification();
4316   application.Render();
4317
4318   DALI_TEST_EQUALS(textEditor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), " world", TEST_LOCATION);
4319
4320   // " w" is selected
4321   DevelTextEditor::SelectText(textEditor, 0, 2);
4322
4323   application.SendNotification();
4324   application.Render();
4325
4326   selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
4327   DALI_TEST_EQUALS(" w", selectedText, TEST_LOCATION);
4328
4329   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 0, TEST_LOCATION);
4330   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 2, TEST_LOCATION);
4331
4332   // " w" is cut
4333   DALI_TEST_EQUALS(" w", DevelTextEditor::CutText(textEditor), TEST_LOCATION);
4334
4335   application.SendNotification();
4336   application.Render();
4337
4338   DALI_TEST_EQUALS(textEditor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "orld", TEST_LOCATION);
4339
4340   // Test Cut from the middle
4341
4342   // "rl" is selected
4343   DevelTextEditor::SelectText(textEditor, 1, 3);
4344
4345   application.SendNotification();
4346   application.Render();
4347
4348   selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
4349   DALI_TEST_EQUALS("rl", selectedText, TEST_LOCATION);
4350
4351   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 1, TEST_LOCATION);
4352   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 3, TEST_LOCATION);
4353
4354   // "rl" is cut
4355   DALI_TEST_EQUALS("rl", DevelTextEditor::CutText(textEditor), TEST_LOCATION);
4356
4357   application.SendNotification();
4358   application.Render();
4359
4360   DALI_TEST_EQUALS(textEditor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "od", TEST_LOCATION);
4361
4362   // Test Cut from the end
4363
4364   // "d" is selected
4365   DevelTextEditor::SelectText(textEditor, 1, 2);
4366
4367   application.SendNotification();
4368   application.Render();
4369
4370   selectedText = textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
4371   DALI_TEST_EQUALS("d", selectedText, TEST_LOCATION);
4372
4373   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_START).Get<int>(), 1, TEST_LOCATION);
4374   DALI_TEST_EQUALS(textEditor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT_END).Get<int>(), 2, TEST_LOCATION);
4375
4376   // "d" is cut
4377   DALI_TEST_EQUALS("d", DevelTextEditor::CutText(textEditor), TEST_LOCATION);
4378
4379   application.SendNotification();
4380   application.Render();
4381
4382   DALI_TEST_EQUALS(textEditor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "o", TEST_LOCATION);
4383
4384   END_TEST;
4385 }
4386
4387 int UtcDaliTextEditorPasteText(void)
4388 {
4389   ToolkitTestApplication application;
4390   tet_infoline(" UtcDaliTextEditorPasteText ");
4391
4392   TextEditor editor = TextEditor::New();
4393   DALI_TEST_CHECK(editor);
4394
4395   application.GetScene().Add(editor);
4396
4397   std::string cutText    = "";
4398   std::string copiedText = "";
4399
4400   editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
4401   editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
4402   editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
4403   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4404   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4405
4406   // Avoid a crash when core load gl resources.
4407   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4408
4409   // Render and notify
4410   application.SendNotification();
4411   application.Render();
4412
4413   // Tap on the text editor
4414   TestGenerateTap(application, 3.0f, 25.0f);
4415
4416   // Render and notify
4417   application.SendNotification();
4418   application.Render();
4419
4420   // Move to second line of the text.
4421   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4422
4423   // Render and notify
4424   application.SendNotification();
4425   application.Render();
4426
4427   // Select some text in the right of the current cursor position
4428   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4429   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4430   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4431   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4432
4433   // Render and notify
4434   application.SendNotification();
4435   application.Render();
4436
4437   // Cut the selected text
4438   cutText = DevelTextEditor::CutText(editor);
4439
4440   // Render and notify
4441   application.SendNotification();
4442   application.Render();
4443
4444   DALI_TEST_EQUALS("wor", cutText, TEST_LOCATION);
4445   DALI_TEST_EQUALS("Hello\nld\nHello world", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
4446
4447   // Select some text in the left of the current cursor position
4448   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4449   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4450   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4451   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4452
4453   // Render and notify
4454   application.SendNotification();
4455   application.Render();
4456
4457   // Copy the selected text
4458   copiedText = DevelTextEditor::CopyText(editor);
4459
4460   // Render and notify
4461   application.SendNotification();
4462   application.Render();
4463
4464   DALI_TEST_EQUALS("lo\n", copiedText, TEST_LOCATION);
4465   DALI_TEST_EQUALS("Hello\nld\nHello world", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
4466
4467   // Move the cursor to the third line
4468   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4469   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4470
4471   // Render and notify
4472   application.SendNotification();
4473   application.Render();
4474
4475   // Paste the selected text at the current cursor position
4476   DevelTextEditor::PasteText(editor);
4477
4478   // Render and notify
4479   application.SendNotification();
4480   application.Render();
4481
4482   DALI_TEST_EQUALS("Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>(TextEditor::Property::TEXT), TEST_LOCATION);
4483
4484   END_TEST;
4485 }
4486
4487 int UtcDaliTextEditorLineSpacing(void)
4488 {
4489   ToolkitTestApplication application;
4490   tet_infoline(" UtcDaliTextEditorLineSpacing ");
4491
4492   TextEditor textEditor = TextEditor::New();
4493   textEditor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.f));
4494   application.GetScene().Add(textEditor);
4495   application.SendNotification();
4496   application.Render();
4497
4498   textEditor.SetProperty(TextEditor::Property::TEXT, "Line #1\nLine #2\nLine #3");
4499   textEditor.SetProperty(DevelTextEditor::Property::LINE_SPACING, 0);
4500
4501   Vector3 sizeBefore = textEditor.GetNaturalSize();
4502
4503   textEditor.SetProperty(DevelTextEditor::Property::LINE_SPACING, 20);
4504
4505   //add 20 for each line  20 * 3
4506   DALI_TEST_EQUALS(sizeBefore.height + 60.0f, textEditor.GetNaturalSize().height, TEST_LOCATION);
4507
4508   END_TEST;
4509 }
4510
4511 int UtcDaliTextEditorMinLineSize(void)
4512 {
4513   ToolkitTestApplication application;
4514   tet_infoline(" UtcDaliTextEditorMinLineSize ");
4515
4516   TextEditor textEditor = TextEditor::New();
4517   textEditor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.f));
4518   application.GetScene().Add(textEditor);
4519   application.SendNotification();
4520   application.Render();
4521
4522   textEditor.SetProperty(TextEditor::Property::TEXT, "Line #1\nLine #2\nLine #3");
4523   textEditor.SetProperty(DevelTextEditor::Property::MIN_LINE_SIZE, 0);
4524
4525   Vector3 sizeBefore = textEditor.GetNaturalSize();
4526
4527   textEditor.SetProperty(DevelTextEditor::Property::MIN_LINE_SIZE, 60);
4528
4529   DALI_TEST_NOT_EQUALS(sizeBefore, textEditor.GetNaturalSize(), 0.0f, TEST_LOCATION);
4530
4531   //60 * 3 lines
4532   DALI_TEST_EQUALS(180.0f, textEditor.GetNaturalSize().height, TEST_LOCATION);
4533
4534   END_TEST;
4535 }
4536
4537 int utcDaliTextEditorCursorPositionChangedSignal(void)
4538 {
4539   ToolkitTestApplication application;
4540   tet_infoline(" utcDaliTextEditorCursorPositionChangedSignal");
4541
4542   TextEditor editor = TextEditor::New();
4543   DALI_TEST_CHECK(editor);
4544
4545   application.GetScene().Add(editor);
4546
4547   // connect to the selection changed signal.
4548   ConnectionTracker* testTracker = new ConnectionTracker();
4549   DevelTextEditor::CursorPositionChangedSignal(editor).Connect(&TestCursorPositionChangedCallback);
4550   bool cursorPositionChangedSignal = false;
4551   editor.ConnectSignal(testTracker, "cursorPositionChanged", CallbackFunctor(&cursorPositionChangedSignal));
4552
4553   editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
4554   editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
4555   editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
4556   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4557   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4558
4559   // Avoid a crash when core load gl resources.
4560   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4561
4562   // Render and notify
4563   application.SendNotification();
4564   application.Render();
4565
4566   editor.SetKeyInputFocus();
4567
4568   // Tap on the text editor
4569   TestGenerateTap(application, 3.0f, 25.0f);
4570
4571   // Render and notify
4572   application.SendNotification();
4573   application.Render();
4574
4575   DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
4576   DALI_TEST_EQUALS(oldCursorPos, 23, TEST_LOCATION);
4577
4578   gCursorPositionChangedCallbackCalled = false;
4579
4580   // Move to left.
4581   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4582
4583   // Render and notify
4584   application.SendNotification();
4585   application.Render();
4586
4587   DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
4588   DALI_TEST_EQUALS(oldCursorPos, 18, TEST_LOCATION);
4589
4590   gCursorPositionChangedCallbackCalled = false;
4591
4592   // Insert C
4593   application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4594
4595   // Render and notify
4596   application.SendNotification();
4597   application.Render();
4598
4599   DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
4600   DALI_TEST_EQUALS(oldCursorPos, 17, TEST_LOCATION);
4601
4602   gCursorPositionChangedCallbackCalled = false;
4603
4604   //delete one character
4605   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4606
4607   // Render and notify
4608   application.SendNotification();
4609   application.Render();
4610
4611   DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
4612   DALI_TEST_EQUALS(oldCursorPos, 18, TEST_LOCATION);
4613
4614   gCursorPositionChangedCallbackCalled = false;
4615
4616   editor.SetProperty(TextEditor::Property::TEXT, "Hello");
4617
4618   // Render and notify
4619   application.SendNotification();
4620   application.Render();
4621
4622   DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
4623   DALI_TEST_EQUALS(oldCursorPos, 17, TEST_LOCATION);
4624
4625   gCursorPositionChangedCallbackCalled = false;
4626
4627   editor.SetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 3);
4628
4629   // Render and notify
4630   application.SendNotification();
4631   application.Render();
4632
4633   DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
4634   DALI_TEST_EQUALS(oldCursorPos, 5, TEST_LOCATION);
4635
4636   END_TEST;
4637 }
4638
4639 int utcDaliTextEditorGeometryEllipsisStart(void)
4640 {
4641   ToolkitTestApplication application;
4642   tet_infoline(" utcDaliTextEditorGeometryEllipsisStart");
4643
4644   TextEditor editor = TextEditor::New();
4645   DALI_TEST_CHECK(editor);
4646
4647   application.GetScene().Add(editor);
4648
4649   editor.SetProperty(TextEditor::Property::POINT_SIZE, 7.f);
4650   editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
4651   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4652   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4653   editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
4654   editor.SetProperty(DevelTextEditor::Property::ENABLE_SCROLL_BAR, false);
4655   editor.SetProperty(DevelTextEditor::Property::ELLIPSIS, true);
4656   editor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::START);
4657   editor.SetProperty(TextEditor::Property::TEXT, "line1 \nline2\nline 3\nline4");
4658
4659   // Avoid a crash when core load gl resources.
4660   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4661
4662   // Render and notify
4663   application.SendNotification();
4664   application.Render();
4665
4666   unsigned int expectedCount = 2;
4667   unsigned int startIndex    = 0;
4668   unsigned int endIndex      = 24;
4669
4670   Vector<Vector2> positionsList = DevelTextEditor::GetTextPosition(editor, startIndex, endIndex);
4671   Vector<Vector2> sizeList      = DevelTextEditor::GetTextSize(editor, startIndex, endIndex);
4672
4673   DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
4674   DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
4675
4676   Vector<Vector2> expectedSizes;
4677   Vector<Vector2> expectedPositions;
4678
4679   expectedPositions.PushBack(Vector2(37, 0));
4680   expectedSizes.PushBack(Vector2(20, 25));
4681
4682   expectedPositions.PushBack(Vector2(-1, 25));
4683   expectedSizes.PushBack(Vector2(52, 25));
4684
4685   TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
4686
4687   END_TEST;
4688 }
4689
4690 int utcDaliTextEditorGeometryEllipsisMiddle(void)
4691 {
4692   ToolkitTestApplication application;
4693   tet_infoline(" utcDaliTextEditorGeometryEllipsisMiddle");
4694
4695   TextEditor editor = TextEditor::New();
4696   DALI_TEST_CHECK(editor);
4697
4698   application.GetScene().Add(editor);
4699
4700   editor.SetProperty(TextEditor::Property::POINT_SIZE, 7.f);
4701   editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
4702   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4703   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4704   editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
4705   editor.SetProperty(DevelTextEditor::Property::ENABLE_SCROLL_BAR, false);
4706   editor.SetProperty(DevelTextEditor::Property::ELLIPSIS, true);
4707   editor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::MIDDLE);
4708   editor.SetProperty(TextEditor::Property::TEXT, "line1 \nline2\nline 3\nline4");
4709
4710   // Avoid a crash when core load gl resources.
4711   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4712
4713   // Render and notify
4714   application.SendNotification();
4715   application.Render();
4716
4717   unsigned int expectedCount = 2;
4718   unsigned int startIndex    = 0;
4719   unsigned int endIndex      = 24;
4720
4721   Vector<Vector2> positionsList = DevelTextEditor::GetTextPosition(editor, startIndex, endIndex);
4722   Vector<Vector2> sizeList      = DevelTextEditor::GetTextSize(editor, startIndex, endIndex);
4723
4724   DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
4725   DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
4726
4727   Vector<Vector2> expectedSizes;
4728   Vector<Vector2> expectedPositions;
4729
4730   expectedPositions.PushBack(Vector2(-1, 0));
4731   expectedSizes.PushBack(Vector2(25, 25));
4732
4733   expectedPositions.PushBack(Vector2(-1, 25));
4734   expectedSizes.PushBack(Vector2(52, 25));
4735
4736   TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
4737
4738   END_TEST;
4739 }
4740
4741 int utcDaliTextEditorGeometryEllipsisEnd(void)
4742 {
4743   ToolkitTestApplication application;
4744   tet_infoline(" utcDaliTextEditorGeometryEllipsisEnd");
4745
4746   TextEditor editor = TextEditor::New();
4747   DALI_TEST_CHECK(editor);
4748
4749   application.GetScene().Add(editor);
4750
4751   editor.SetProperty(TextEditor::Property::POINT_SIZE, 7.f);
4752   editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
4753   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4754   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4755   editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
4756   editor.SetProperty(DevelTextEditor::Property::ENABLE_SCROLL_BAR, false);
4757   editor.SetProperty(DevelTextEditor::Property::ELLIPSIS, true);
4758   editor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::END);
4759   editor.SetProperty(TextEditor::Property::TEXT, "line1 \nline2\nline 3\nline4");
4760
4761   // Avoid a crash when core load gl resources.
4762   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4763
4764   // Render and notify
4765   application.SendNotification();
4766   application.Render();
4767
4768   unsigned int expectedCount = 2;
4769   unsigned int startIndex    = 0;
4770   unsigned int endIndex      = 24;
4771
4772   Vector<Vector2> positionsList = DevelTextEditor::GetTextPosition(editor, startIndex, endIndex);
4773   Vector<Vector2> sizeList      = DevelTextEditor::GetTextSize(editor, startIndex, endIndex);
4774
4775   DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
4776   DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
4777
4778   Vector<Vector2> expectedSizes;
4779   Vector<Vector2> expectedPositions;
4780
4781   expectedPositions.PushBack(Vector2(-1, 0));
4782   expectedSizes.PushBack(Vector2(59, 25));
4783
4784   expectedPositions.PushBack(Vector2(-1, 25));
4785   expectedSizes.PushBack(Vector2(25, 25));
4786
4787   TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
4788
4789   END_TEST;
4790 }
4791
4792 int utcDaliTextEditorGeometryRTL(void)
4793 {
4794   ToolkitTestApplication application;
4795   tet_infoline(" utcDaliTextEditorGeometryRTL");
4796
4797   TextEditor editor = TextEditor::New();
4798   DALI_TEST_CHECK(editor);
4799
4800   application.GetScene().Add(editor);
4801
4802   editor.SetProperty(TextEditor::Property::POINT_SIZE, 7.f);
4803   editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
4804   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4805   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4806   editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
4807   editor.SetProperty(TextEditor::Property::TEXT, "line1 \nline2\nline 3\nالاخيرالسطر");
4808
4809   // Avoid a crash when core load gl resources.
4810   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4811
4812   // Render and notify
4813   application.SendNotification();
4814   application.Render();
4815
4816   unsigned int expectedCount = 4;
4817   unsigned int startIndex    = 3;
4818   unsigned int endIndex      = 24;
4819
4820   Vector<Vector2> positionsList = DevelTextEditor::GetTextPosition(editor, startIndex, endIndex);
4821   Vector<Vector2> sizeList      = DevelTextEditor::GetTextSize(editor, startIndex, endIndex);
4822
4823   DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
4824   DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
4825
4826   Vector<Vector2> expectedSizes;
4827   Vector<Vector2> expectedPositions;
4828
4829   expectedPositions.PushBack(Vector2(24, 0));
4830   expectedSizes.PushBack(Vector2(33, 25));
4831
4832   expectedPositions.PushBack(Vector2(-1, 25));
4833   expectedSizes.PushBack(Vector2(52, 25));
4834
4835   expectedPositions.PushBack(Vector2(-1, 50));
4836   expectedSizes.PushBack(Vector2(59, 25));
4837
4838   expectedPositions.PushBack(Vector2(61, 75));
4839   expectedSizes.PushBack(Vector2(37, 25));
4840
4841   TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
4842
4843   END_TEST;
4844 }
4845
4846 int utcDaliTextEditorGeometryGlyphMiddle(void)
4847 {
4848   ToolkitTestApplication application;
4849   tet_infoline(" utcDaliTextEditorGeometryGlyphMiddle");
4850
4851   TextEditor editor = TextEditor::New();
4852   DALI_TEST_CHECK(editor);
4853
4854   application.GetScene().Add(editor);
4855
4856   editor.SetProperty(TextEditor::Property::POINT_SIZE, 7.f);
4857   editor.SetProperty(Actor::Property::SIZE, Vector2(150.f, 200.f));
4858   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4859   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4860   editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
4861   editor.SetProperty(TextEditor::Property::TEXT, "لا تحتوي على لا");
4862
4863   // Avoid a crash when core load gl resources.
4864   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4865
4866   // Render and notify
4867   application.SendNotification();
4868   application.Render();
4869
4870   unsigned int expectedCount = 1;
4871   unsigned int startIndex    = 1;
4872   unsigned int endIndex      = 13;
4873
4874   Vector<Vector2> positionsList = DevelTextEditor::GetTextPosition(editor, startIndex, endIndex);
4875   Vector<Vector2> sizeList      = DevelTextEditor::GetTextSize(editor, startIndex, endIndex);
4876
4877   DALI_TEST_EQUALS(positionsList.Size(), expectedCount, TEST_LOCATION);
4878   DALI_TEST_EQUALS(sizeList.Size(), expectedCount, TEST_LOCATION);
4879
4880   Vector<Vector2> expectedSizes;
4881   Vector<Vector2> expectedPositions;
4882
4883   expectedPositions.PushBack(Vector2(6, 0));
4884   expectedSizes.PushBack(Vector2(124, 25));
4885
4886   TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
4887
4888   END_TEST;
4889 }
4890
4891 int utcDaliTextEditorSelectionClearedSignal(void)
4892 {
4893   ToolkitTestApplication application;
4894   tet_infoline(" utcDaliTextEditorSelectionClearedSignal");
4895
4896   TextEditor editor = TextEditor::New();
4897   DALI_TEST_CHECK(editor);
4898
4899   application.GetScene().Add(editor);
4900
4901   // connect to the selection changed signal.
4902   ConnectionTracker* testTracker = new ConnectionTracker();
4903   DevelTextEditor::SelectionClearedSignal(editor).Connect(&TestSelectionClearedCallback);
4904   bool selectionClearedSignal = false;
4905   editor.ConnectSignal(testTracker, "selectionCleared", CallbackFunctor(&selectionClearedSignal));
4906
4907   editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
4908   editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
4909   editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
4910   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
4911   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
4912
4913   // Avoid a crash when core load gl resources.
4914   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
4915
4916   // Render and notify
4917   application.SendNotification();
4918   application.Render();
4919
4920   // Tap on the text editor
4921   TestGenerateTap(application, 3.0f, 25.0f);
4922
4923   // Render and notify
4924   application.SendNotification();
4925   application.Render();
4926
4927   // Move to second line of the text & Select some text in the right of the current cursor position
4928   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4929   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4930
4931   // remove selection
4932   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::UP, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4933
4934   // Render and notify
4935   application.SendNotification();
4936   application.Render();
4937
4938   DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
4939
4940   // Render and notify
4941   application.SendNotification();
4942   application.Render();
4943
4944   // Tap on the text editor
4945   TestGenerateTap(application, 3.0f, 25.0f);
4946
4947   // Render and notify
4948   application.SendNotification();
4949   application.Render();
4950
4951   gSelectionClearedCallbackCalled = false;
4952
4953   // Move to second line of the text & select.
4954   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4955   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4956
4957   //remove selection
4958   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4959
4960   // Render and notify
4961   application.SendNotification();
4962   application.Render();
4963
4964   DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
4965
4966   gSelectionClearedCallbackCalled = false;
4967
4968   // Render and notify
4969   application.SendNotification();
4970   application.Render();
4971
4972   // Move to second line of the text & select.
4973   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4974   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4975
4976   // replace C with selected text
4977   application.ProcessEvent(GenerateKey("c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
4978
4979   // Render and notify
4980   application.SendNotification();
4981   application.Render();
4982
4983   DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
4984
4985   gSelectionClearedCallbackCalled = false;
4986
4987   // Render and notify
4988   application.SendNotification();
4989   application.Render();
4990
4991   DevelTextEditor::SelectText(editor, 1, 3);
4992
4993   // Render and notify
4994   application.SendNotification();
4995   application.Render();
4996
4997   editor.SetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 3);
4998
4999   // Render and notify
5000   application.SendNotification();
5001   application.Render();
5002
5003   DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
5004
5005   gSelectionClearedCallbackCalled = false;
5006
5007   DevelTextEditor::SelectText(editor, 1, 3);
5008
5009   // Render and notify
5010   application.SendNotification();
5011   application.Render();
5012
5013   // select none
5014   DevelTextEditor::SelectNone(editor);
5015
5016   // Render and notify
5017   application.SendNotification();
5018   application.Render();
5019
5020   DALI_TEST_CHECK(gSelectionClearedCallbackCalled);
5021
5022   END_TEST;
5023 }
5024
5025 int utcDaliTextEditorSelectionWithSecondaryCursor(void)
5026 {
5027   ToolkitTestApplication application;
5028   tet_infoline(" utcDaliTextEditorSelectionWithSecondaryCursor");
5029
5030   // Checks if the actor is created.
5031
5032   TextEditor editor = TextEditor::New();
5033   DALI_TEST_CHECK(editor);
5034
5035   application.GetScene().Add(editor);
5036
5037   editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
5038   editor.SetProperty(TextEditor::Property::TEXT, "اللغة العربية\nمرحبا بالجميع\nالسلام عليكم <span font-size='12' font-family='DejaVu Sans' >Hello world</span>");
5039   editor.SetProperty(TextEditor::Property::POINT_SIZE, 12.f);
5040   editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
5041   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
5042   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
5043   editor.SetProperty(DevelTextEditor::Property::MIN_LINE_SIZE, 50.f);
5044   editor.SetProperty(DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, false);
5045
5046   // Avoid a crash when core load gl resources.
5047   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
5048
5049   // Render and notify
5050   application.SendNotification();
5051   application.Render();
5052
5053   // Tap on the text editor
5054   TestGenerateTap(application, 3.0f, 25.0f);
5055
5056   // Render and notify
5057   application.SendNotification();
5058   application.Render();
5059
5060   //Select the last Arabic word (RTL) & some the space before the English (LTR) letters.
5061   DevelTextEditor::SelectText(editor, 35, 41); // This will activate the alternative cursor position and thus 'cursorInfo.isSecondaryCursor' will be true.
5062
5063   application.SendNotification();
5064   application.Render();
5065
5066   std::string selectedText = editor.GetProperty(DevelTextEditor::Property::SELECTED_TEXT).Get<std::string>();
5067   DALI_TEST_EQUALS("عليكم ", selectedText, TEST_LOCATION);
5068
5069   END_TEST;
5070 }
5071
5072 int utcDaliTextEditorSelectionChangedSignal(void)
5073 {
5074   ToolkitTestApplication application;
5075   tet_infoline(" utcDaliTextEditorSelectionChangedSignal");
5076
5077   TextEditor editor = TextEditor::New();
5078   DALI_TEST_CHECK(editor);
5079
5080   application.GetScene().Add(editor);
5081
5082   // connect to the selection changed signal.
5083   ConnectionTracker* testTracker = new ConnectionTracker();
5084   DevelTextEditor::SelectionChangedSignal(editor).Connect(&TestSelectionChangedCallback);
5085   bool selectionChangedSignal = false;
5086   editor.ConnectSignal(testTracker, "selectionChanged", CallbackFunctor(&selectionChangedSignal));
5087
5088   editor.SetProperty(TextEditor::Property::TEXT, "Hello\nworld\nHello world");
5089   editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.f);
5090   editor.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
5091   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
5092   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
5093
5094   // Avoid a crash when core load gl resources.
5095   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
5096
5097   // Render and notify
5098   application.SendNotification();
5099   application.Render();
5100
5101   // Tap on the text editor
5102   TestGenerateTap(application, 3.0f, 25.0f);
5103
5104   // Render and notify
5105   application.SendNotification();
5106   application.Render();
5107
5108   // Move to second line of the text.
5109   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5110
5111   // Render and notify
5112   application.SendNotification();
5113   application.Render();
5114
5115   // Select some text in the right of the current cursor position
5116   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5117   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5118
5119   // Render and notify
5120   application.SendNotification();
5121   application.Render();
5122
5123   DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
5124   DALI_TEST_EQUALS(oldSelectionStart, oldSelectionEnd, TEST_LOCATION);
5125
5126   gSelectionChangedCallbackCalled = false;
5127
5128   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5129
5130   // Render and notify
5131   application.SendNotification();
5132   application.Render();
5133
5134   DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
5135   DALI_TEST_EQUALS(oldSelectionStart, 6, TEST_LOCATION);
5136   DALI_TEST_EQUALS(oldSelectionEnd, 7, TEST_LOCATION);
5137
5138   gSelectionChangedCallbackCalled = false;
5139
5140   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::UP, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5141
5142   // Render and notify
5143   application.SendNotification();
5144   application.Render();
5145
5146   DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
5147   DALI_TEST_EQUALS(oldSelectionStart, 6, TEST_LOCATION);
5148   DALI_TEST_EQUALS(oldSelectionEnd, 8, TEST_LOCATION);
5149
5150   gSelectionChangedCallbackCalled = false;
5151   editor.SetKeyInputFocus();
5152
5153   // Render and notify
5154   application.SendNotification();
5155   application.Render();
5156
5157   DevelTextEditor::SelectText(editor, 0, 5);
5158
5159   application.SendNotification();
5160   application.Render();
5161
5162   DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
5163   DALI_TEST_EQUALS(oldSelectionStart, oldSelectionEnd, TEST_LOCATION);
5164
5165   gSelectionChangedCallbackCalled = false;
5166
5167   editor.SetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 3);
5168
5169   // Render and notify
5170   application.SendNotification();
5171   application.Render();
5172
5173   DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
5174   DALI_TEST_EQUALS(oldSelectionStart, 0, TEST_LOCATION);
5175   DALI_TEST_EQUALS(oldSelectionEnd, 5, TEST_LOCATION);
5176
5177   gSelectionChangedCallbackCalled = false;
5178
5179   // select all text
5180   DevelTextEditor::SelectWholeText(editor);
5181
5182   // Render and notify
5183   application.SendNotification();
5184   application.Render();
5185
5186   DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
5187   DALI_TEST_EQUALS(oldSelectionStart, oldSelectionEnd, TEST_LOCATION);
5188
5189   gSelectionChangedCallbackCalled = false;
5190
5191   // select none
5192   DevelTextEditor::SelectNone(editor);
5193
5194   // Render and notify
5195   application.SendNotification();
5196   application.Render();
5197
5198   DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
5199   DALI_TEST_EQUALS(oldSelectionStart, 0, TEST_LOCATION);
5200   DALI_TEST_EQUALS(oldSelectionEnd, 23, TEST_LOCATION);
5201
5202   END_TEST;
5203 }
5204
5205 int UtcDaliToolkitTextEditorStrikethroughGeneration(void)
5206 {
5207   ToolkitTestApplication application;
5208   tet_infoline(" UtcDaliToolkitTextEditorStrikethroughGeneration");
5209
5210   TextEditor textEditor = TextEditor::New();
5211   textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
5212   textEditor.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 100.f));
5213   textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 10);
5214   textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
5215
5216   application.GetScene().Add(textEditor);
5217   application.SendNotification();
5218   application.Render();
5219
5220   Property::Map strikethroughMapSet;
5221   Property::Map strikethroughMapGet;
5222
5223   strikethroughMapSet.Insert("enable", true);
5224   strikethroughMapSet.Insert("color", Color::RED);
5225   strikethroughMapSet.Insert("height", 2.0f);
5226
5227   // Check the strikethrough property
5228   textEditor.SetProperty(DevelTextEditor::Property::STRIKETHROUGH, strikethroughMapSet);
5229   strikethroughMapGet = textEditor.GetProperty<Property::Map>(DevelTextEditor::Property::STRIKETHROUGH);
5230   textEditor.SetProperty(TextEditor::Property::TEXT, "Test1");
5231   DALI_TEST_EQUALS(strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION);
5232   DALI_TEST_EQUALS(DaliTestCheckMaps(strikethroughMapGet, strikethroughMapSet), true, TEST_LOCATION);
5233
5234   // Render and notify
5235   application.SendNotification();
5236   application.Render();
5237
5238   strikethroughMapSet.Clear();
5239   strikethroughMapGet.Clear();
5240
5241   END_TEST;
5242 }
5243
5244 int utcDaliTextEditorInsertCharacterAfterInitWithResizePolicyNaturalSize(void)
5245 {
5246   //This is to test a crash when used Resize Policy equals USE_NATURAL_SIZE
5247   //DaliException on vector: "Iterator not inside vector"
5248
5249   ToolkitTestApplication application;
5250   tet_infoline(" utcDaliTextEditorInsertCharacterAfterInitWithResizePolicyNaturalSize");
5251
5252   TextEditor editor = TextEditor::New();
5253   DALI_TEST_CHECK(editor);
5254
5255   application.GetScene().Add(editor);
5256
5257   // Avoid a crash when core load gl resources.
5258   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
5259
5260   //Set multilines text
5261   editor.SetProperty(Dali::Toolkit::TextEditor::Property::TEXT, "Hello \n World");
5262   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
5263   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
5264
5265   //Set ResizePolicy to NaturalSize
5266   editor.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::USE_NATURAL_SIZE);
5267
5268   // Render and notify
5269   application.SendNotification();
5270   application.Render();
5271
5272   // Create a tap event to touch the text editor.
5273   TestGenerateTap(application, 5.0f, 5.0f);
5274
5275   // Render and notify
5276   application.SendNotification();
5277   application.Render();
5278
5279   // Set currsor and add character (in first line)
5280   editor.SetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 5);
5281   application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5282   application.ProcessEvent(GenerateKey("d", "", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::UP, "d", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5283
5284   // Render and notify
5285   application.SendNotification();
5286   application.Render();
5287
5288   //Check the changed text and cursor position
5289   DALI_TEST_EQUALS(editor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "Hellod \n World", TEST_LOCATION);
5290   DALI_TEST_EQUALS(editor.GetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION).Get<int>(), 6, TEST_LOCATION);
5291
5292   // Render and notify
5293   application.SendNotification();
5294   application.Render();
5295
5296   END_TEST;
5297 }
5298
5299 int utcDaliTextEditorRemoveCharacterAfterInitWithResizePolicyNaturalSize(void)
5300 {
5301   //This is to test a crash when used Resize Policy equals USE_NATURAL_SIZE
5302   //DaliException on vector: "Iterator not inside vector"
5303
5304   ToolkitTestApplication application;
5305   tet_infoline(" utcDaliTextEditorRemoveCharacterAfterInitWithResizePolicyNaturalSize");
5306
5307   TextEditor editor = TextEditor::New();
5308   DALI_TEST_CHECK(editor);
5309
5310   application.GetScene().Add(editor);
5311
5312   // Avoid a crash when core load gl resources.
5313   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
5314
5315   //Set multilines text
5316   editor.SetProperty(Dali::Toolkit::TextEditor::Property::TEXT, "Hello \n World");
5317   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
5318   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
5319
5320   //Set ResizePolicy to NaturalSize
5321   editor.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::USE_NATURAL_SIZE);
5322
5323   // Set currsor
5324   editor.SetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 5);
5325   application.SendNotification();
5326   application.Render();
5327
5328   // Set focus and remove character
5329   editor.SetKeyInputFocus();
5330   application.ProcessEvent(GenerateKey("", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5331
5332   // Render and notify
5333   application.SendNotification();
5334   application.Render();
5335
5336   //Check the changed text and cursor position
5337   DALI_TEST_EQUALS(editor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "Hell \n World", TEST_LOCATION);
5338   DALI_TEST_EQUALS(editor.GetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION).Get<int>(), 4, TEST_LOCATION);
5339
5340   // Render and notify
5341   application.SendNotification();
5342   application.Render();
5343
5344   END_TEST;
5345 }
5346
5347 int utcDaliTextEditorCutSelectedTextAfterInitWithResizePolicyNaturalSize(void)
5348 {
5349   //This is to test a crash when used Resize Policy equals USE_NATURAL_SIZE
5350   //DaliException on vector: "Iterator not inside vector"
5351
5352   ToolkitTestApplication application;
5353   tet_infoline(" utcDaliTextEditorCutSelectedTextAfterInitWithResizePolicyNaturalSize");
5354
5355   TextEditor editor = TextEditor::New();
5356   DALI_TEST_CHECK(editor);
5357
5358   application.GetScene().Add(editor);
5359
5360   // Avoid a crash when core load gl resources.
5361   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
5362
5363   //Set multilines text
5364   editor.SetProperty(Dali::Toolkit::TextEditor::Property::TEXT, "Hello \n World");
5365   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
5366   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
5367
5368   //Set ResizePolicy to NaturalSize
5369   editor.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::USE_NATURAL_SIZE);
5370
5371   //Select text at initialization (before the first render)
5372   DevelTextEditor::SelectText(editor, 3, 5);
5373
5374   // Render and notify
5375   application.SendNotification();
5376   application.Render();
5377
5378   //Cut text
5379   application.ProcessEvent(GenerateKey("", "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5380   application.ProcessEvent(GenerateKey("x", "x", "x", KEY_X_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "x", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5381
5382   // Render and notify
5383   application.SendNotification();
5384   application.Render();
5385
5386   //Check the changed text and cursor position
5387   DALI_TEST_EQUALS(editor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "Hel \n World", TEST_LOCATION);
5388   DALI_TEST_EQUALS(editor.GetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION).Get<int>(), 3, TEST_LOCATION);
5389
5390   // Render and notify
5391   application.SendNotification();
5392   application.Render();
5393
5394   END_TEST;
5395 }
5396
5397 int utcDaliTextEditorDoubleEnterAfterInitWithResizePolicyNaturalSize(void)
5398 {
5399   //This is to test a crash when used Resize Policy equals USE_NATURAL_SIZE
5400   //DaliException on vector: "Iterator not inside vector"
5401
5402   ToolkitTestApplication application;
5403   tet_infoline(" utcDaliTextEditorDoubleEnterAfterInitWithResizePolicyNaturalSize");
5404
5405   TextEditor editor = TextEditor::New();
5406   DALI_TEST_CHECK(editor);
5407
5408   application.GetScene().Add(editor);
5409
5410   // Avoid a crash when core load gl resources.
5411   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
5412
5413   //Set multilines text
5414   editor.SetProperty(Dali::Toolkit::TextEditor::Property::TEXT, "Hello \n World");
5415   editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
5416   editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
5417
5418   //Set ResizePolicy to NaturalSize
5419   editor.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::USE_NATURAL_SIZE);
5420
5421   // Set currsor
5422   editor.SetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 5);
5423   application.SendNotification();
5424   application.Render();
5425
5426   // Set focus and double enter (new line)
5427   editor.SetKeyInputFocus();
5428   application.ProcessEvent(GenerateKey("Enter", "", "\n", 13, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5429   application.ProcessEvent(GenerateKey("Enter", "", "\n", 13, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE));
5430
5431   // Render and notify
5432   application.SendNotification();
5433   application.Render();
5434
5435   //Check the changed text and cursor position
5436   DALI_TEST_EQUALS(editor.GetProperty(TextEditor::Property::TEXT).Get<std::string>(), "Hello\n\n \n World", TEST_LOCATION);
5437   DALI_TEST_EQUALS(editor.GetProperty(DevelTextEditor::Property::PRIMARY_CURSOR_POSITION).Get<int>(), 7, TEST_LOCATION);
5438
5439   // Render and notify
5440   application.SendNotification();
5441   application.Render();
5442
5443   END_TEST;
5444 }
5445
5446 int UtcDaliToolkitTextEditorUnderlineTypesGeneration1(void)
5447 {
5448   ToolkitTestApplication application;
5449   tet_infoline(" UtcDaliToolkitTextEditorUnderlineTypesGeneration1");
5450   TextEditor textEditor = TextEditor::New();
5451   textEditor.SetProperty(TextEditor::Property::TEXT, "Test");
5452   textEditor.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 100.f));
5453   textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 10);
5454   textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
5455
5456   application.GetScene().Add(textEditor);
5457   application.SendNotification();
5458   application.Render();
5459
5460   Property::Map underlineMapSet;
5461   Property::Map underlineMapGet;
5462
5463   underlineMapSet.Insert("enable", true);
5464   underlineMapSet.Insert("color", Color::RED);
5465   underlineMapSet.Insert("height", 1);
5466   underlineMapSet.Insert("type", Text::Underline::SOLID);
5467   underlineMapSet.Insert("dashWidth", 2);
5468   underlineMapSet.Insert("dashGap", 1);
5469
5470   // Check the underline property
5471   textEditor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
5472
5473   underlineMapGet = textEditor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
5474   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
5475   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
5476
5477   // Render and notify
5478   application.SendNotification();
5479   application.Render();
5480
5481   underlineMapSet.Clear();
5482   underlineMapGet.Clear();
5483
5484   underlineMapSet.Insert("enable", true);
5485   underlineMapSet.Insert("color", Color::BLUE);
5486   underlineMapSet.Insert("height", 1);
5487   underlineMapSet.Insert("type", Text::Underline::DASHED);
5488   underlineMapSet.Insert("dashWidth", 4);
5489   underlineMapSet.Insert("dashGap", 2);
5490
5491   // Check the dashed underline property
5492   textEditor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
5493
5494   underlineMapGet = textEditor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
5495   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
5496   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
5497
5498   // Render and notify
5499   application.SendNotification();
5500   application.Render();
5501
5502   underlineMapSet.Clear();
5503   underlineMapGet.Clear();
5504
5505   underlineMapSet.Insert("enable", true);
5506   underlineMapSet.Insert("color", Color::BLUE);
5507   underlineMapSet.Insert("height", 1);
5508   underlineMapSet.Insert("type", Text::Underline::DOUBLE);
5509   underlineMapSet.Insert("dashWidth", 4);
5510   underlineMapSet.Insert("dashGap", 2);
5511
5512   // Check the dashed underline property
5513   textEditor.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet);
5514
5515   underlineMapGet = textEditor.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
5516   DALI_TEST_EQUALS(underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION);
5517   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet, underlineMapSet), true, TEST_LOCATION);
5518
5519   // Render and notify
5520   application.SendNotification();
5521   application.Render();
5522
5523   underlineMapSet.Clear();
5524   underlineMapGet.Clear();
5525
5526   END_TEST;
5527 }
5528
5529 int UtcDaliToolkitTextEditorUnderlineTypesGeneration2(void)
5530 {
5531   ToolkitTestApplication application;
5532   tet_infoline(" UtcDaliToolkitTextEditorUnderlineTypesGeneration2");
5533
5534   TextEditor textEditor1 = TextEditor::New();
5535   textEditor1.SetProperty(TextEditor::Property::TEXT, "Test");
5536   textEditor1.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 100.f));
5537   textEditor1.SetProperty(TextEditor::Property::POINT_SIZE, 10);
5538   textEditor1.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
5539
5540   Property::Map underlineMapSet1;
5541   Property::Map underlineMapGet1;
5542
5543   underlineMapSet1.Insert("enable", true);
5544   underlineMapSet1.Insert("color", Color::RED);
5545   underlineMapSet1.Insert("height", 1);
5546   underlineMapSet1.Insert("type", Text::Underline::SOLID);
5547   underlineMapSet1.Insert("dashWidth", 2);
5548   underlineMapSet1.Insert("dashGap", 1);
5549
5550   // Check the underline property
5551   textEditor1.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet1);
5552
5553   underlineMapGet1 = textEditor1.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
5554   DALI_TEST_EQUALS(underlineMapGet1.Count(), underlineMapSet1.Count(), TEST_LOCATION);
5555   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet1, underlineMapSet1), true, TEST_LOCATION);
5556
5557   application.GetScene().Add(textEditor1);
5558   application.SendNotification();
5559   application.Render();
5560
5561   TextEditor textEditor2 = TextEditor::New();
5562   textEditor2.SetProperty(TextEditor::Property::TEXT, "Test");
5563   textEditor2.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 100.f));
5564   textEditor2.SetProperty(TextEditor::Property::POINT_SIZE, 10);
5565   textEditor2.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
5566
5567   Property::Map underlineMapSet2;
5568   Property::Map underlineMapGet2;
5569
5570   underlineMapSet2.Insert("enable", true);
5571   underlineMapSet2.Insert("color", Color::BLUE);
5572   underlineMapSet2.Insert("height", 1);
5573   underlineMapSet2.Insert("type", Text::Underline::DASHED);
5574   underlineMapSet2.Insert("dashWidth", 4);
5575   underlineMapSet2.Insert("dashGap", 2);
5576
5577   // Check the dashed underline property
5578   textEditor2.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet2);
5579
5580   underlineMapGet2 = textEditor2.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
5581   DALI_TEST_EQUALS(underlineMapGet2.Count(), underlineMapSet2.Count(), TEST_LOCATION);
5582   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet2, underlineMapSet2), true, TEST_LOCATION);
5583
5584   application.GetScene().Add(textEditor2);
5585   application.SendNotification();
5586   application.Render();
5587
5588   TextEditor textEditor3 = TextEditor::New();
5589   textEditor3.SetProperty(TextEditor::Property::TEXT, "Test");
5590   textEditor3.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 100.f));
5591   textEditor3.SetProperty(TextEditor::Property::POINT_SIZE, 10);
5592   textEditor3.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
5593
5594   Property::Map underlineMapSet3;
5595   Property::Map underlineMapGet3;
5596
5597   underlineMapSet3.Insert("enable", true);
5598   underlineMapSet3.Insert("color", Color::BLUE);
5599   underlineMapSet3.Insert("height", 1);
5600   underlineMapSet3.Insert("type", Text::Underline::DOUBLE);
5601   underlineMapSet3.Insert("dashWidth", 4);
5602   underlineMapSet3.Insert("dashGap", 2);
5603
5604   // Check the dashed underline property
5605   textEditor3.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet3);
5606
5607   underlineMapGet3 = textEditor3.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
5608   DALI_TEST_EQUALS(underlineMapGet3.Count(), underlineMapSet3.Count(), TEST_LOCATION);
5609   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet3, underlineMapSet3), true, TEST_LOCATION);
5610
5611   application.GetScene().Add(textEditor3);
5612   application.SendNotification();
5613   application.Render();
5614
5615   END_TEST;
5616 }
5617
5618 int UtcDaliToolkitTextEditorUnderlineTypesGeneration3(void)
5619 {
5620   ToolkitTestApplication application;
5621   tet_infoline(" UtcDaliToolkitTextEditorUnderlineTypesGeneration3");
5622
5623   TextEditor textEditor1 = TextEditor::New();
5624   textEditor1.SetProperty(TextEditor::Property::TEXT, "Test1");
5625   textEditor1.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 100.f));
5626   textEditor1.SetProperty(TextEditor::Property::POINT_SIZE, 10);
5627   textEditor1.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
5628
5629   Property::Map underlineMapSet1;
5630   Property::Map underlineMapGet1;
5631
5632   underlineMapSet1.Insert("enable", true);
5633   underlineMapSet1.Insert("color", Color::RED);
5634   underlineMapSet1.Insert("height", 1);
5635   underlineMapSet1.Insert("type", Text::Underline::SOLID);
5636   underlineMapSet1.Insert("dashWidth", 2);
5637   underlineMapSet1.Insert("dashGap", 1);
5638
5639   // Check the underline property
5640   textEditor1.SetProperty(TextEditor::Property::UNDERLINE, underlineMapSet1);
5641   //textEditor1.SetProperty( TextEditor::Property::TEXT, "Test2" );
5642
5643   underlineMapGet1 = textEditor1.GetProperty<Property::Map>(TextEditor::Property::UNDERLINE);
5644   DALI_TEST_EQUALS(underlineMapGet1.Count(), underlineMapSet1.Count(), TEST_LOCATION);
5645   DALI_TEST_EQUALS(DaliTestCheckMaps(underlineMapGet1, underlineMapSet1), true, TEST_LOCATION);
5646
5647   application.GetScene().Add(textEditor1);
5648
5649   application.SendNotification();
5650   application.Render();
5651
5652   END_TEST;
5653 }
5654
5655 int UtcDaliTextEditorCharacterSpacing(void)
5656 {
5657   ToolkitTestApplication application;
5658   tet_infoline(" UtcDaliTextEditorCharacterSpacing ");
5659
5660   TextEditor textEditor = TextEditor::New();
5661
5662   textEditor.SetProperty(Actor::Property::SIZE, Vector2(150.0f, 300.f));
5663
5664   application.GetScene().Add(textEditor);
5665   application.SendNotification();
5666   application.Render();
5667
5668   textEditor.SetProperty(TextEditor::Property::TEXT, "Hi Experiment");
5669   textEditor.SetProperty(DevelTextEditor::Property::CHARACTER_SPACING, 10.f);
5670   DALI_TEST_EQUALS(textEditor.GetProperty<float>(DevelTextEditor::Property::CHARACTER_SPACING), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
5671
5672   application.SendNotification();
5673   application.Render();
5674
5675   END_TEST;
5676 }