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