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