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