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