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