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