2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/rendering/renderer.h>
23 #include <dali/integration-api/events/key-event-integ.h>
24 #include <dali/integration-api/events/tap-gesture-event.h>
25 #include <dali/integration-api/events/touch-event-integ.h>
26 #include <dali/integration-api/events/pan-gesture-event.h>
27 #include <dali/integration-api/events/long-press-gesture-event.h>
28 #include <dali-toolkit-test-suite-utils.h>
29 #include <dali-toolkit/dali-toolkit.h>
30 #include <dali-toolkit/devel-api/controls/text-controls/hidden-input-properties.h>
31 #include <dali-toolkit/devel-api/controls/text-controls/text-field-devel.h>
32 #include "toolkit-clipboard.h"
35 using namespace Toolkit;
37 void dali_textfield_startup(void)
39 test_return_value = TET_UNDEF;
42 void dali_textfield_cleanup(void)
44 test_return_value = TET_PASS;
50 const char* const PROPERTY_NAME_RENDERING_BACKEND = "renderingBackend";
51 const char* const PROPERTY_NAME_TEXT = "text";
52 const char* const PROPERTY_NAME_PLACEHOLDER_TEXT = "placeholderText";
53 const char* const PROPERTY_NAME_PLACEHOLDER_TEXT_FOCUSED = "placeholderTextFocused";
54 const char* const PROPERTY_NAME_FONT_FAMILY = "fontFamily";
55 const char* const PROPERTY_NAME_FONT_STYLE = "fontStyle";
56 const char* const PROPERTY_NAME_POINT_SIZE = "pointSize";
57 const char* const PROPERTY_NAME_MAX_LENGTH = "maxLength";
58 const char* const PROPERTY_NAME_EXCEED_POLICY = "exceedPolicy";
59 const char* const PROPERTY_NAME_HORIZONTAL_ALIGNMENT = "horizontalAlignment";
60 const char* const PROPERTY_NAME_VERTICAL_ALIGNMENT = "verticalAlignment";
61 const char* const PROPERTY_NAME_TEXT_COLOR = "textColor";
62 const char* const PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR = "placeholderTextColor";
63 const char* const PROPERTY_NAME_SHADOW_OFFSET = "shadowOffset";
64 const char* const PROPERTY_NAME_SHADOW_COLOR = "shadowColor";
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";
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";
99 const char* const PROPERTY_NAME_HIDDEN_INPUT_SETTINGS = "hiddenInputSettings";
101 const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
103 const Vector4 PLACEHOLDER_TEXT_COLOR( 0.8f, 0.8f, 0.8f, 0.8f );
104 const Dali::Vector4 LIGHT_BLUE( 0.75f, 0.96f, 1.f, 1.f ); // The text highlight color.
106 const unsigned int CURSOR_BLINK_INTERVAL = 500u; // Cursor blink interval
107 const float RENDER_FRAME_INTERVAL = 16.66f;
109 const float TO_MILLISECONDS = 1000.f;
110 const float TO_SECONDS = 1.f / TO_MILLISECONDS;
112 const float SCROLL_THRESHOLD = 10.f;
113 const float SCROLL_SPEED = 300.f;
115 const unsigned int DEFAULT_FONT_SIZE = 1152u;
116 const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
118 const int KEY_A_CODE = 38;
119 const int KEY_D_CODE = 40;
121 const std::string DEFAULT_DEVICE_NAME("hwKeyboard");
123 static bool gTextChangedCallBackCalled;
124 static bool gMaxCharactersCallBackCalled;
125 static bool gInputStyleChangedCallbackCalled;
126 static Dali::Toolkit::TextField::InputStyle::Mask gInputStyleMask;
128 static void LoadBitmapResource(TestPlatformAbstraction& platform, int width, int height)
130 Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
131 Integration::ResourcePointer resource(bitmap);
132 bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, width, height, width, height);
135 static void LoadMarkerImages(ToolkitTestApplication& app, TextField textField)
139 LoadBitmapResource( app.GetPlatform(), width, height );
141 Property::Map propertyMap;
142 propertyMap["filename"] = "image.png";
143 propertyMap["width"] = width;
144 propertyMap["height"] = height;
145 textField.SetProperty( Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_LEFT, propertyMap );
146 textField.SetProperty( Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_RIGHT, propertyMap );
147 textField.SetProperty( Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT, propertyMap );
148 textField.SetProperty( Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, propertyMap );
149 textField.SetProperty( Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT, propertyMap );
150 textField.SetProperty( Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT, propertyMap );
151 textField.SetProperty( Toolkit::TextField::Property::GRAB_HANDLE_IMAGE, propertyMap );
152 textField.SetProperty( Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE, propertyMap );
155 // Generate a PanGestureEvent to send to Core
156 static Integration::PanGestureEvent GeneratePan(
157 Gesture::State state,
158 const Vector2& previousPosition,
159 const Vector2& currentPosition,
160 unsigned long timeDelta,
161 unsigned int numberOfTouches = 1)
163 Integration::PanGestureEvent pan(state);
165 pan.previousPosition = previousPosition;
166 pan.currentPosition = currentPosition;
167 pan.timeDelta = timeDelta;
168 pan.numberOfTouches = numberOfTouches;
174 * Helper to generate PanGestureEvent
176 * @param[in] application Application instance
177 * @param[in] state The Gesture State
178 * @param[in] pos The current position of touch.
180 static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos)
184 if( (state == Gesture::Started) ||
185 (state == Gesture::Possible) )
191 application.ProcessEvent(GeneratePan(state, last, pos, 16));
198 * Simulate time passed by.
200 * @note this will always process at least 1 frame (1/60 sec)
202 * @param application Test application instance
203 * @param duration Time to pass in milliseconds.
204 * @return The actual time passed in milliseconds
206 static int Wait(ToolkitTestApplication& application, int duration = 0)
210 for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
212 application.SendNotification();
213 application.Render(RENDER_FRAME_INTERVAL);
214 time += RENDER_FRAME_INTERVAL;
220 Dali::Integration::Point GetPointDownInside( Vector2& pos )
222 Dali::Integration::Point point;
223 point.SetState( PointState::DOWN );
224 point.SetScreenPosition( pos );
228 Dali::Integration::Point GetPointUpInside( Vector2& pos )
230 Dali::Integration::Point point;
231 point.SetState( PointState::UP );
232 point.SetScreenPosition( pos );
236 struct CallbackFunctor
238 CallbackFunctor(bool* callbackFlag)
239 : mCallbackFlag( callbackFlag )
245 *mCallbackFlag = true;
250 static void TestTextChangedCallback( TextField control )
252 tet_infoline(" TestTextChangedCallback");
254 gTextChangedCallBackCalled = true;
257 static void TestMaxLengthReachedCallback( TextField control )
259 tet_infoline(" TestMaxLengthReachedCallback");
261 gMaxCharactersCallBackCalled = true;
264 static void TestInputStyleChangedCallback( TextField control, TextField::InputStyle::Mask mask )
266 tet_infoline(" TestInputStyleChangedCallback");
268 gInputStyleChangedCallbackCalled = true;
269 gInputStyleMask = mask;
272 // Generate a TapGestureEvent to send to Core.
273 Integration::TapGestureEvent GenerateTap(
274 Gesture::State state,
275 unsigned int numberOfTaps,
276 unsigned int numberOfTouches,
279 Integration::TapGestureEvent tap( state );
281 tap.numberOfTaps = numberOfTaps;
282 tap.numberOfTouches = numberOfTouches;
288 Integration::LongPressGestureEvent GenerateLongPress(
289 Gesture::State state,
290 unsigned int numberOfTouches,
293 Integration::LongPressGestureEvent longPress( state );
295 longPress.numberOfTouches = numberOfTouches;
296 longPress.point = point;
300 // Generate a KeyEvent to send to Core.
301 Integration::KeyEvent GenerateKey( const std::string& keyName,
302 const std::string& keyString,
305 unsigned long timeStamp,
306 const Integration::KeyEvent::State& keyState,
307 const std::string& deviceName,
308 const DevelKeyEvent::DeviceClass::Type& deviceClass )
310 return Integration::KeyEvent( keyName,
320 bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet )
322 if( fontStyleMapGet.Count() == fontStyleMapSet.Count() )
324 for( unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index )
326 const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue( index );
328 if( valueGet.first.type == Property::Key::STRING )
330 Property::Value* valueSet = fontStyleMapSet.Find( valueGet.first.stringKey );
331 if( NULL != valueSet )
333 if( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() )
335 tet_printf( " Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
341 tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
347 Property::Value* valueSet = fontStyleMapSet.Find( valueGet.first.indexKey );
348 if( NULL != valueSet )
350 if( valueGet.second.Get<int>() != valueSet->Get<int>() )
352 tet_printf( " Integer Value got : [%d], expected : [%d]", valueGet.second.Get<int>(), valueSet->Get<int>() );
358 tet_printf( " The Int key %d doesn't exist.", valueGet.first.indexKey );
370 int UtcDaliToolkitTextFieldConstructorP(void)
372 ToolkitTestApplication application;
373 tet_infoline(" UtcDaliToolkitTextFieldConstructorP");
375 DALI_TEST_CHECK( !textField );
379 int UtcDaliToolkitTextFieldNewP(void)
381 ToolkitTestApplication application;
382 tet_infoline(" UtcDaliToolkitTextFieldNewP");
383 TextField textField = TextField::New();
384 DALI_TEST_CHECK( textField );
388 int UtcDaliToolkitTextFieldDownCastP(void)
390 ToolkitTestApplication application;
391 tet_infoline(" UtcDaliToolkitTextFieldDownCastP");
392 TextField textField1 = TextField::New();
393 BaseHandle object( textField1 );
395 TextField textField2 = TextField::DownCast( object );
396 DALI_TEST_CHECK( textField2 );
398 TextField textField3 = DownCast< TextField >( object );
399 DALI_TEST_CHECK( textField3 );
403 int UtcDaliToolkitTextFieldDownCastN(void)
405 ToolkitTestApplication application;
406 tet_infoline(" UtcDaliToolkitTextFieldDownCastN");
407 BaseHandle uninitializedObject;
408 TextField textField1 = TextField::DownCast( uninitializedObject );
409 DALI_TEST_CHECK( !textField1 );
411 TextField textField2 = DownCast< TextField >( uninitializedObject );
412 DALI_TEST_CHECK( !textField2 );
416 int UtcDaliToolkitTextFieldCopyConstructorP(void)
418 ToolkitTestApplication application;
419 tet_infoline(" UtcDaliToolkitTextFieldCopyConstructorP");
420 TextField textField = TextField::New();
421 textField.SetProperty( TextField::Property::TEXT, "Test" );
423 TextField copy( textField );
424 DALI_TEST_CHECK( copy );
425 DALI_TEST_CHECK( copy.GetProperty<std::string>( TextLabel::Property::TEXT ) == textField.GetProperty<std::string>( TextLabel::Property::TEXT ) );
429 int UtcDaliToolkitTextFieldAssignmentOperatorP(void)
431 ToolkitTestApplication application;
432 tet_infoline(" UtcDaliToolkitTextFieldAssignmentOperatorP");
433 TextField textField = TextField::New();
434 textField.SetProperty( TextField::Property::TEXT, "Test" );
436 TextField copy = textField;
437 DALI_TEST_CHECK( copy );
438 DALI_TEST_CHECK( copy.GetProperty<std::string>( TextField::Property::TEXT ) == textField.GetProperty<std::string>( TextField::Property::TEXT ) );
442 int UtcDaliTextFieldNewP(void)
444 ToolkitTestApplication application;
445 tet_infoline(" UtcDaliToolkitTextFieldNewP");
446 TextField textField = TextField::New();
447 DALI_TEST_CHECK( textField );
451 // Positive test case for a method
452 int UtcDaliTextFieldGetPropertyP(void)
454 ToolkitTestApplication application;
455 tet_infoline(" UtcDaliToolkitTextFieldGetPropertyP");
456 TextField field = TextField::New();
457 DALI_TEST_CHECK( field );
459 // Check Property Indices are correct
460 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_RENDERING_BACKEND ) == TextField::Property::RENDERING_BACKEND );
461 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_TEXT ) == TextField::Property::TEXT );
462 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT ) == TextField::Property::PLACEHOLDER_TEXT );
463 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT_FOCUSED ) == TextField::Property::PLACEHOLDER_TEXT_FOCUSED );
464 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_FONT_FAMILY ) == TextField::Property::FONT_FAMILY );
465 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_FONT_STYLE ) == TextField::Property::FONT_STYLE );
466 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_POINT_SIZE ) == TextField::Property::POINT_SIZE );
467 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_MAX_LENGTH ) == TextField::Property::MAX_LENGTH );
468 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_EXCEED_POLICY ) == TextField::Property::EXCEED_POLICY );
469 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_HORIZONTAL_ALIGNMENT ) == TextField::Property::HORIZONTAL_ALIGNMENT );
470 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_VERTICAL_ALIGNMENT ) == TextField::Property::VERTICAL_ALIGNMENT );
471 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_TEXT_COLOR ) == TextField::Property::TEXT_COLOR );
472 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR ) == TextField::Property::PLACEHOLDER_TEXT_COLOR );
473 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_SHADOW_OFFSET ) == TextField::Property::SHADOW_OFFSET );
474 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_SHADOW_COLOR ) == TextField::Property::SHADOW_COLOR );
475 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PRIMARY_CURSOR_COLOR ) == TextField::Property::PRIMARY_CURSOR_COLOR );
476 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_SECONDARY_CURSOR_COLOR ) == TextField::Property::SECONDARY_CURSOR_COLOR );
477 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_CURSOR_BLINK ) == TextField::Property::ENABLE_CURSOR_BLINK );
478 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_CURSOR_BLINK_INTERVAL ) == TextField::Property::CURSOR_BLINK_INTERVAL );
479 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_CURSOR_BLINK_DURATION ) == TextField::Property::CURSOR_BLINK_DURATION );
480 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_CURSOR_WIDTH ) == TextField::Property::CURSOR_WIDTH );
481 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_GRAB_HANDLE_IMAGE ) == TextField::Property::GRAB_HANDLE_IMAGE );
482 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_GRAB_HANDLE_PRESSED_IMAGE ) == TextField::Property::GRAB_HANDLE_PRESSED_IMAGE );
483 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_SCROLL_THRESHOLD ) == TextField::Property::SCROLL_THRESHOLD );
484 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_SCROLL_SPEED ) == TextField::Property::SCROLL_SPEED );
485 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_IMAGE_LEFT ) == TextField::Property::SELECTION_HANDLE_IMAGE_LEFT );
486 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_IMAGE_RIGHT ) == TextField::Property::SELECTION_HANDLE_IMAGE_RIGHT );
487 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_LEFT ) == TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT );
488 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT ) == TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT );
489 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_LEFT ) == TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT );
490 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_RIGHT ) == TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT );
491 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_SELECTION_HIGHLIGHT_COLOR ) == TextField::Property::SELECTION_HIGHLIGHT_COLOR );
492 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_DECORATION_BOUNDING_BOX ) == TextField::Property::DECORATION_BOUNDING_BOX );
493 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_METHOD_SETTINGS ) == TextField::Property::INPUT_METHOD_SETTINGS );
494 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_COLOR ) == TextField::Property::INPUT_COLOR );
495 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_MARKUP ) == TextField::Property::ENABLE_MARKUP );
496 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_FONT_FAMILY ) == TextField::Property::INPUT_FONT_FAMILY );
497 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_FONT_STYLE ) == TextField::Property::INPUT_FONT_STYLE );
498 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_POINT_SIZE ) == TextField::Property::INPUT_POINT_SIZE );
499 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_UNDERLINE ) == TextField::Property::UNDERLINE );
500 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_UNDERLINE ) == TextField::Property::INPUT_UNDERLINE );
501 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_SHADOW ) == TextField::Property::SHADOW );
502 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_SHADOW ) == TextField::Property::INPUT_SHADOW );
503 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_EMBOSS ) == TextField::Property::EMBOSS );
504 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_EMBOSS ) == TextField::Property::INPUT_EMBOSS );
505 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextField::Property::OUTLINE );
506 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_OUTLINE ) == TextField::Property::INPUT_OUTLINE );
507 DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_HIDDEN_INPUT_SETTINGS ) == DevelTextField::Property::HIDDEN_INPUT_SETTINGS );
512 bool SetPropertyMapRetrieved( TextField& field, const Property::Index property, const std::string mapKey, const std::string mapValue )
515 Property::Map imageMap;
516 imageMap[mapKey] =mapValue;
518 field.SetProperty( property , imageMap );
519 Property::Value propValue = field.GetProperty( property );
520 Property::Map* resultMap = propValue.GetMap();
522 if ( resultMap->Find( mapKey )->Get< std::string>() == mapValue )
530 // Positive test case for a method
531 int UtcDaliTextFieldSetPropertyP(void)
533 ToolkitTestApplication application;
534 tet_infoline(" UtcDaliToolkitTextFieldSetPropertyP");
535 TextField field = TextField::New();
536 DALI_TEST_CHECK( field );
537 Stage::GetCurrent().Add( field );
539 // Note - we can't check the defaults since the stylesheets are platform-specific
541 // Check the render backend property.
542 field.SetProperty( TextField::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
543 DALI_TEST_EQUALS( (Text::RenderingType)field.GetProperty<int>( TextField::Property::RENDERING_BACKEND ), Text::RENDERING_SHARED_ATLAS, TEST_LOCATION );
545 // Check text property.
546 field.SetProperty( TextField::Property::TEXT, "Setting Text" );
547 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::TEXT ), std::string("Setting Text"), TEST_LOCATION );
549 // Check placeholder text properties.
550 field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Setting Placeholder Text" );
551 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::PLACEHOLDER_TEXT ), std::string("Setting Placeholder Text"), TEST_LOCATION );
553 field.SetProperty( TextField::Property::PLACEHOLDER_TEXT_FOCUSED, "Setting Placeholder Text Focused" );
554 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::PLACEHOLDER_TEXT_FOCUSED ), std::string("Setting Placeholder Text Focused"), TEST_LOCATION );
556 // Check font properties.
557 field.SetProperty( TextField::Property::FONT_FAMILY, "Setting font family" );
558 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
560 Property::Map fontStyleMapSet;
561 Property::Map fontStyleMapGet;
562 Property::Value* slantValue = NULL;
564 fontStyleMapSet.Insert( "weight", "bold" );
565 fontStyleMapSet.Insert( "width", "condensed" );
566 fontStyleMapSet.Insert( "slant", "italic" );
567 field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
569 fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
570 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
571 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
573 field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
574 DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
577 fontStyleMapSet.Clear();
578 fontStyleMapSet.Insert( "weight", "normal" );
579 fontStyleMapSet.Insert( "slant", "oblique" );
580 field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
582 fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
583 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
584 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
586 fontStyleMapSet.Clear();
587 fontStyleMapSet.Insert( "slant", "roman" );
588 field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
589 fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
591 // Replace 'roman' for 'normal'.
592 slantValue = fontStyleMapGet.Find( "slant" );
593 if( NULL != slantValue )
595 if( "normal" == slantValue->Get<std::string>() )
597 fontStyleMapGet["slant"] = "roman";
600 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
601 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
603 fontStyleMapSet.Clear();
605 field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
606 fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
607 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
608 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
610 // Check that the MAX_LENGTH property can be correctly set
611 const int maxNumberOfCharacters = 20;
612 field.SetProperty( TextField::Property::MAX_LENGTH, maxNumberOfCharacters );
613 DALI_TEST_EQUALS( field.GetProperty<int>( TextField::Property::MAX_LENGTH ), maxNumberOfCharacters, TEST_LOCATION );
615 // Check exceed policy
616 field.SetProperty( TextField::Property::EXCEED_POLICY, Dali::Toolkit::TextField::EXCEED_POLICY_CLIP );
617 DALI_TEST_EQUALS( field.GetProperty<int>( TextField::Property::EXCEED_POLICY ), static_cast<int>( Dali::Toolkit::TextField::EXCEED_POLICY_CLIP ), TEST_LOCATION );
618 field.SetProperty( TextField::Property::EXCEED_POLICY, Dali::Toolkit::TextField::EXCEED_POLICY_ORIGINAL );
619 DALI_TEST_EQUALS( field.GetProperty<int>( TextField::Property::EXCEED_POLICY ), static_cast<int>( Dali::Toolkit::TextField::EXCEED_POLICY_ORIGINAL ), TEST_LOCATION );
621 // Check that the Alignment properties can be correctly set
622 field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "END" );
623 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::HORIZONTAL_ALIGNMENT ), "END", TEST_LOCATION );
624 field.SetProperty( TextField::Property::VERTICAL_ALIGNMENT, "CENTER" );
625 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::VERTICAL_ALIGNMENT ), "CENTER", TEST_LOCATION );
627 // Check text's color property
628 field.SetProperty( TextField::Property::TEXT_COLOR, Color::WHITE );
629 DALI_TEST_EQUALS( field.GetProperty<Vector4>( TextField::Property::TEXT_COLOR ), Color::WHITE, TEST_LOCATION );
631 // Check placeholder text's color property.
632 field.SetProperty( TextField::Property::PLACEHOLDER_TEXT_COLOR, Color::RED );
633 DALI_TEST_EQUALS( field.GetProperty<Vector4>( TextField::Property::PLACEHOLDER_TEXT_COLOR ), Color::RED, TEST_LOCATION );
635 // Check shadow properties.
636 field.SetProperty( TextField::Property::SHADOW_OFFSET, Vector2( 1.f, 1.f ) );
637 DALI_TEST_EQUALS( field.GetProperty<Vector2>( TextField::Property::SHADOW_OFFSET ), Vector2( 1.f, 1.f ), TEST_LOCATION );
638 field.SetProperty( TextField::Property::SHADOW_COLOR, Color::GREEN );
639 DALI_TEST_EQUALS( field.GetProperty<Vector4>( TextField::Property::SHADOW_COLOR ), Color::GREEN, TEST_LOCATION );
641 // Check cursor properties
642 field.SetProperty( TextField::Property::PRIMARY_CURSOR_COLOR, Color::RED );
643 DALI_TEST_EQUALS( field.GetProperty<Vector4>( TextField::Property::PRIMARY_CURSOR_COLOR ), Color::RED, TEST_LOCATION );
644 field.SetProperty( TextField::Property::SECONDARY_CURSOR_COLOR, Color::BLUE );
645 DALI_TEST_EQUALS( field.GetProperty<Vector4>( TextField::Property::SECONDARY_CURSOR_COLOR ), Color::BLUE, TEST_LOCATION );
647 field.SetProperty( TextField::Property::ENABLE_CURSOR_BLINK, false );
648 DALI_TEST_EQUALS( field.GetProperty<bool>( TextField::Property::ENABLE_CURSOR_BLINK ), false, TEST_LOCATION );
649 field.SetProperty( TextField::Property::CURSOR_BLINK_INTERVAL, 1.f );
650 DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::CURSOR_BLINK_INTERVAL ), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
651 field.SetProperty( TextField::Property::CURSOR_BLINK_DURATION, 10.f );
652 DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::CURSOR_BLINK_DURATION ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
653 field.SetProperty( TextField::Property::CURSOR_WIDTH, 1 );
654 DALI_TEST_EQUALS( field.GetProperty<int>( TextField::Property::CURSOR_WIDTH ), 1, TEST_LOCATION );
656 // Check scroll properties.
657 field.SetProperty( TextField::Property::SCROLL_THRESHOLD, 1.f );
658 DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::SCROLL_THRESHOLD ), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
659 field.SetProperty( TextField::Property::SCROLL_SPEED, 100.f );
660 DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::SCROLL_SPEED ), 100.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
662 // Check handle images
663 field.SetProperty( TextField::Property::GRAB_HANDLE_IMAGE, "image1" );
664 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::GRAB_HANDLE_IMAGE ), "image1", TEST_LOCATION );
665 field.SetProperty( TextField::Property::GRAB_HANDLE_PRESSED_IMAGE, "image2" );
666 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::GRAB_HANDLE_PRESSED_IMAGE ), "image2", TEST_LOCATION );
667 field.SetProperty( TextField::Property::SELECTION_HANDLE_IMAGE_LEFT, "image3" );
669 // Check handle images
670 DALI_TEST_CHECK( SetPropertyMapRetrieved( field, TextField::Property::SELECTION_HANDLE_IMAGE_LEFT, "filename", "leftHandleImage" ) );
671 DALI_TEST_CHECK( SetPropertyMapRetrieved( field, TextField::Property::SELECTION_HANDLE_IMAGE_RIGHT, "filename", "rightHandleImage" ) );
672 DALI_TEST_CHECK( SetPropertyMapRetrieved( field, TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT, "filename", "leftHandleImagePressed" ) );
673 DALI_TEST_CHECK( SetPropertyMapRetrieved( field, TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, "filename", "rightHandleImagePressed" ) );
674 DALI_TEST_CHECK( SetPropertyMapRetrieved( field, TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT, "filename", "leftHandleMarkerImage" ) );
675 DALI_TEST_CHECK( SetPropertyMapRetrieved( field, TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT, "filename", "rightHandleMarkerImage" ) );
677 // Check the highlight color
678 field.SetProperty( TextField::Property::SELECTION_HIGHLIGHT_COLOR, Color::GREEN );
679 DALI_TEST_EQUALS( field.GetProperty<Vector4>( TextField::Property::SELECTION_HIGHLIGHT_COLOR ), Color::GREEN, TEST_LOCATION );
681 // Decoration bounding box
682 field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( 0, 0, 1, 1 ) );
683 DALI_TEST_EQUALS( field.GetProperty<Rect <int > >( TextField::Property::DECORATION_BOUNDING_BOX ), Rect<int>( 0, 0, 1, 1 ), TEST_LOCATION );
685 // Check the input method setting
686 Property::Map propertyMap;
687 InputMethod::PanelLayout::Type panelLayout = InputMethod::PanelLayout::NUMBER;
688 InputMethod::AutoCapital::Type autoCapital = InputMethod::AutoCapital::WORD;
689 InputMethod::ActionButtonTitle::Type actionButton = InputMethod::ActionButtonTitle::GO;
690 int inputVariation = 1;
691 propertyMap["PANEL_LAYOUT"] = panelLayout;
692 propertyMap["AUTO_CAPITALISE"] = autoCapital;
693 propertyMap["ACTION_BUTTON"] = actionButton;
694 propertyMap["VARIATION"] = inputVariation;
695 field.SetProperty( TextField::Property::INPUT_METHOD_SETTINGS, propertyMap );
697 Property::Value value = field.GetProperty( TextField::Property::INPUT_METHOD_SETTINGS );
699 DALI_TEST_CHECK( value.Get( map ) );
702 DALI_TEST_CHECK( map[ "PANEL_LAYOUT" ].Get( layout ) );
703 DALI_TEST_EQUALS( static_cast<int>(panelLayout), layout, TEST_LOCATION );
706 DALI_TEST_CHECK( map[ "AUTO_CAPITALISE" ].Get( capital ) );
707 DALI_TEST_EQUALS( static_cast<int>(autoCapital), capital, TEST_LOCATION );
710 DALI_TEST_CHECK( map[ "ACTION_BUTTON" ].Get( action ) );
711 DALI_TEST_EQUALS( static_cast<int>(actionButton), action, TEST_LOCATION );
714 DALI_TEST_CHECK( map[ "VARIATION" ].Get( variation ) );
715 DALI_TEST_EQUALS( inputVariation, variation, TEST_LOCATION );
717 // Check input color property.
718 field.SetProperty( TextField::Property::INPUT_COLOR, Color::YELLOW );
719 DALI_TEST_EQUALS( field.GetProperty<Vector4>( TextField::Property::INPUT_COLOR ), Color::YELLOW, TEST_LOCATION );
721 // Check the enable markup property.
722 DALI_TEST_CHECK( !field.GetProperty<bool>( TextField::Property::ENABLE_MARKUP ) );
723 field.SetProperty( TextField::Property::ENABLE_MARKUP, true );
724 DALI_TEST_CHECK( field.GetProperty<bool>( TextField::Property::ENABLE_MARKUP ) );
726 // Check input font properties.
727 field.SetProperty( TextField::Property::INPUT_FONT_FAMILY, "Setting input font family" );
728 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_FAMILY ), "Setting input font family", TEST_LOCATION );
730 fontStyleMapSet.Clear();
731 fontStyleMapSet.Insert( "weight", "bold" );
732 fontStyleMapSet.Insert( "width", "condensed" );
733 fontStyleMapSet.Insert( "slant", "italic" );
735 field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
736 fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
737 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
738 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
740 field.SetProperty( TextField::Property::INPUT_POINT_SIZE, 12.f );
741 DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::INPUT_POINT_SIZE ), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
743 // Reset input font style.
744 fontStyleMapSet.Clear();
745 fontStyleMapSet.Insert( "weight", "normal" );
746 fontStyleMapSet.Insert( "slant", "oblique" );
748 field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
749 fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
750 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
751 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
753 fontStyleMapSet.Clear();
754 fontStyleMapSet.Insert( "slant", "roman" );
756 field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
757 fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
759 // Replace 'roman' for 'normal'.
760 slantValue = fontStyleMapGet.Find( "slant" );
761 if( NULL != slantValue )
763 if( "normal" == slantValue->Get<std::string>() )
765 fontStyleMapGet["slant"] = "roman";
768 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
769 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
771 fontStyleMapSet.Clear();
773 field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
774 fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
775 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
776 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
778 Property::Map underlineMapSet;
779 Property::Map underlineMapGet;
781 underlineMapSet.Insert( "enable", "true" );
782 underlineMapSet.Insert( "color", "red" );
783 underlineMapSet.Insert( "height", "1" );
785 // Check the underline property
786 field.SetProperty( TextField::Property::UNDERLINE, underlineMapSet );
788 underlineMapGet = field.GetProperty<Property::Map>( TextField::Property::UNDERLINE );
789 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
790 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
792 // Check the input underline property
793 field.SetProperty( TextField::Property::INPUT_UNDERLINE, "Underline input properties" );
794 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_UNDERLINE ), std::string("Underline input properties"), TEST_LOCATION );
796 // Check the shadow property
797 Property::Map shadowMapSet;
798 Property::Map shadowMapGet;
800 shadowMapSet.Insert( "color", "green" );
801 shadowMapSet.Insert( "offset", "2 2" );
803 field.SetProperty( TextField::Property::SHADOW, shadowMapSet );
805 shadowMapGet = field.GetProperty<Property::Map>( TextField::Property::SHADOW );
806 DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
807 DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet ), true, TEST_LOCATION );
809 // Check the input shadow property
810 field.SetProperty( TextField::Property::INPUT_SHADOW, "Shadow input properties" );
811 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_SHADOW ), std::string("Shadow input properties"), TEST_LOCATION );
813 // Check the emboss property
814 field.SetProperty( TextField::Property::EMBOSS, "Emboss properties" );
815 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::EMBOSS ), std::string("Emboss properties"), TEST_LOCATION );
817 // Check the input emboss property
818 field.SetProperty( TextField::Property::INPUT_EMBOSS, "Emboss input properties" );
819 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_EMBOSS ), std::string("Emboss input properties"), TEST_LOCATION );
821 // Check the outline property
822 field.SetProperty( TextField::Property::OUTLINE, "Outline properties" );
823 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::OUTLINE ), std::string("Outline properties"), TEST_LOCATION );
825 // Check the input outline property
826 field.SetProperty( TextField::Property::INPUT_OUTLINE, "Outline input properties" );
827 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_OUTLINE ), std::string("Outline input properties"), TEST_LOCATION );
829 // Check the hidden input settings property
830 Property::Map hiddenMapSet;
831 Property::Map hiddenMapGet;
832 hiddenMapSet[ HiddenInput::Property::MODE ] = HiddenInput::Mode::HIDE_ALL;
833 hiddenMapSet[ HiddenInput::Property::SHOW_DURATION ] = 2;
834 hiddenMapSet[ HiddenInput::Property::SUBSTITUTE_COUNT ] = 4;
835 hiddenMapSet[ HiddenInput::Property::SUBSTITUTE_CHARACTER ] = 0x23;
836 field.SetProperty( DevelTextField::Property::HIDDEN_INPUT_SETTINGS, hiddenMapSet );
838 hiddenMapGet = field.GetProperty<Property::Map>( DevelTextField::Property::HIDDEN_INPUT_SETTINGS );
839 DALI_TEST_EQUALS( hiddenMapSet.Count(), hiddenMapGet.Count(), TEST_LOCATION );
840 DALI_TEST_EQUALS( DaliTestCheckMaps( hiddenMapSet, hiddenMapGet ), true, TEST_LOCATION );
845 // Positive Atlas Text Renderer test
846 int utcDaliTextFieldAtlasRenderP(void)
848 ToolkitTestApplication application;
849 tet_infoline(" UtcDaliToolkitTextFieldAtlasRenderP");
850 StyleManager styleManager = StyleManager::Get();
851 styleManager.ApplyDefaultTheme();
852 TextField field = TextField::New();
853 DALI_TEST_CHECK( field );
855 field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
857 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
859 Stage::GetCurrent().Add( field );
863 // Render some text with the shared atlas backend
864 field.SetProperty( TextField::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
865 application.SendNotification();
866 application.Render();
870 tet_result(TET_FAIL);
875 // Positive test for the textChanged signal.
876 int utcDaliTextFieldTextChangedP(void)
878 ToolkitTestApplication application;
879 tet_infoline(" utcDaliTextFieldTextChangedP");
880 TextField field = TextField::New();
881 DALI_TEST_CHECK( field );
883 Stage::GetCurrent().Add( field );
885 // connect to the text changed signal.
886 ConnectionTracker* testTracker = new ConnectionTracker();
887 field.TextChangedSignal().Connect(&TestTextChangedCallback);
888 bool textChangedSignal = false;
889 field.ConnectSignal( testTracker, "textChanged", CallbackFunctor(&textChangedSignal) );
891 gTextChangedCallBackCalled = false;
892 field.SetProperty( TextField::Property::TEXT, "ABC" );
893 DALI_TEST_CHECK( gTextChangedCallBackCalled );
894 DALI_TEST_CHECK( textChangedSignal );
896 application.SendNotification();
898 field.SetKeyInputFocus();
900 gTextChangedCallBackCalled = false;
901 application.ProcessEvent( GenerateKey( "D", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
902 DALI_TEST_CHECK( gTextChangedCallBackCalled );
907 // Negative test for the textChanged signal.
908 int utcDaliTextFieldTextChangedN(void)
910 ToolkitTestApplication application;
911 tet_infoline(" utcDaliTextFieldTextChangedN");
912 TextField field = TextField::New();
913 DALI_TEST_CHECK( field );
915 Stage::GetCurrent().Add( field );
917 // connect to the text changed signal.
918 ConnectionTracker* testTracker = new ConnectionTracker();
919 field.TextChangedSignal().Connect(&TestTextChangedCallback);
920 bool textChangedSignal = false;
921 field.ConnectSignal( testTracker, "textChanged", CallbackFunctor(&textChangedSignal) );
923 gTextChangedCallBackCalled = false;
924 field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "ABC" ); // Setting placeholder, not TEXT
925 DALI_TEST_CHECK( !gTextChangedCallBackCalled );
926 DALI_TEST_CHECK( !textChangedSignal );
931 // Positive test for Max Characters reached signal.
932 int utcDaliTextFieldMaxCharactersReachedP(void)
934 ToolkitTestApplication application;
935 tet_infoline(" utcDaliTextFieldMaxCharactersReachedP");
936 TextField field = TextField::New();
937 DALI_TEST_CHECK( field );
939 Stage::GetCurrent().Add( field );
941 const int maxNumberOfCharacters = 1;
942 field.SetProperty( TextField::Property::MAX_LENGTH, maxNumberOfCharacters );
944 field.SetKeyInputFocus();
946 // connect to the text changed signal.
947 ConnectionTracker* testTracker = new ConnectionTracker();
948 field.MaxLengthReachedSignal().Connect(&TestMaxLengthReachedCallback);
949 bool maxLengthReachedSignal = false;
950 field.ConnectSignal( testTracker, "maxLengthReached", CallbackFunctor(&maxLengthReachedSignal) );
952 gMaxCharactersCallBackCalled = false;
954 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
955 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
957 DALI_TEST_CHECK( gMaxCharactersCallBackCalled );
958 DALI_TEST_CHECK( maxLengthReachedSignal );
963 // Negative test for Max Characters reached signal.
964 int utcDaliTextFieldMaxCharactersReachedN(void)
966 ToolkitTestApplication application;
967 tet_infoline(" utcDaliTextFieldMaxCharactersReachedN");
968 TextField field = TextField::New();
969 DALI_TEST_CHECK( field );
971 Stage::GetCurrent().Add( field );
973 const int maxNumberOfCharacters = 3;
974 field.SetProperty( TextField::Property::MAX_LENGTH, maxNumberOfCharacters );
976 field.SetKeyInputFocus();
978 // connect to the text changed signal.
979 ConnectionTracker* testTracker = new ConnectionTracker();
980 field.MaxLengthReachedSignal().Connect(&TestMaxLengthReachedCallback);
981 bool maxLengthReachedSignal = false;
982 field.ConnectSignal( testTracker, "maxLengthReached", CallbackFunctor(&maxLengthReachedSignal) );
984 gMaxCharactersCallBackCalled = false;
986 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
987 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
989 DALI_TEST_CHECK( !gMaxCharactersCallBackCalled );
990 DALI_TEST_CHECK( !maxLengthReachedSignal );
995 int utcDaliTextFieldInputStyleChanged01(void)
997 ToolkitTestApplication application;
998 tet_infoline(" utcDaliTextFieldInputStyleChanged01");
1000 // The text-field emits signals when the input style changes. These changes of style are
1001 // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
1002 // can't be emitted during the size negotiation as the callbacks may update the UI.
1003 // The text-field adds an idle callback to the adaptor to emit the signals after the size negotiation.
1004 // This creates an implementation of the adaptor stub and a queue of idle callbacks.
1005 application.CreateAdaptor();
1009 char* pathNamePtr = get_current_dir_name();
1010 const std::string pathName( pathNamePtr );
1011 free( pathNamePtr );
1013 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1014 fontClient.SetDpi( 93u, 93u );
1016 fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE );
1017 fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE );
1019 TextField field = TextField::New();
1020 DALI_TEST_CHECK( field );
1023 field.SetSize( 300.f, 50.f );
1024 field.SetParentOrigin( ParentOrigin::TOP_LEFT );
1025 field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1027 field.SetProperty( TextField::Property::ENABLE_MARKUP, true );
1028 field.SetProperty( TextField::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='green'>llo</color> <font weight='bold'>world</font> demo</font>" );
1030 // connect to the text changed signal.
1031 ConnectionTracker* testTracker = new ConnectionTracker();
1032 field.InputStyleChangedSignal().Connect( &TestInputStyleChangedCallback );
1033 bool inputStyleChangedSignal = false;
1034 field.ConnectSignal( testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal) );
1036 Stage::GetCurrent().Add( field );
1038 // Render and notify
1039 application.SendNotification();
1040 application.Render();
1042 // Executes the idle callbacks added by the text control on the change of input style.
1043 application.RunIdles();
1045 gInputStyleChangedCallbackCalled = false;
1046 gInputStyleMask = TextField::InputStyle::NONE;
1047 inputStyleChangedSignal = false;
1049 // Create a tap event to touch the text field.
1050 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 18.f, 25.f ) ) );
1051 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 18.f, 25.f ) ) );
1053 // Render and notify
1054 application.SendNotification();
1055 application.Render();
1057 // Executes the idle callbacks added by the text control on the change of input style.
1058 application.RunIdles();
1060 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1061 if( gInputStyleChangedCallbackCalled )
1063 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextField::InputStyle::FONT_FAMILY | TextField::InputStyle::POINT_SIZE ), TEST_LOCATION );
1065 const std::string fontFamily = field.GetProperty( TextField::Property::INPUT_FONT_FAMILY ).Get<std::string>();
1066 DALI_TEST_EQUALS( fontFamily, "DejaVuSerif", TEST_LOCATION );
1068 const float pointSize = field.GetProperty( TextField::Property::INPUT_POINT_SIZE ).Get<float>();
1069 DALI_TEST_EQUALS( pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1071 DALI_TEST_CHECK( inputStyleChangedSignal );
1073 gInputStyleChangedCallbackCalled = false;
1074 gInputStyleMask = TextField::InputStyle::NONE;
1075 inputStyleChangedSignal = false;
1077 // Create a tap event to touch the text field.
1078 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 30.f, 25.f ) ) );
1079 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 30.f, 25.f ) ) );
1081 // Render and notify
1082 application.SendNotification();
1083 application.Render();
1085 // Executes the idle callbacks added by the text control on the change of input style.
1086 application.RunIdles();
1088 DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
1089 DALI_TEST_CHECK( !inputStyleChangedSignal );
1091 gInputStyleChangedCallbackCalled = false;
1092 gInputStyleMask = TextField::InputStyle::NONE;
1093 inputStyleChangedSignal = false;
1095 // Create a tap event to touch the text field.
1096 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 43.f, 25.f ) ) );
1097 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 43.f, 25.f ) ) );
1099 // Render and notify
1100 application.SendNotification();
1101 application.Render();
1103 // Executes the idle callbacks added by the text control on the change of input style.
1104 application.RunIdles();
1106 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1107 if( gInputStyleChangedCallbackCalled )
1109 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextField::InputStyle::COLOR ), TEST_LOCATION );
1111 const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
1112 DALI_TEST_EQUALS( color, Color::GREEN, TEST_LOCATION );
1114 DALI_TEST_CHECK( inputStyleChangedSignal );
1116 gInputStyleChangedCallbackCalled = false;
1117 gInputStyleMask = TextField::InputStyle::NONE;
1118 inputStyleChangedSignal = false;
1120 // Create a tap event to touch the text field.
1121 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 88.f, 25.f ) ) );
1122 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 88.f, 25.f ) ) );
1124 // Render and notify
1125 application.SendNotification();
1126 application.Render();
1128 // Executes the idle callbacks added by the text control on the change of input style.
1129 application.RunIdles();
1131 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1132 if( gInputStyleChangedCallbackCalled )
1134 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextField::InputStyle::COLOR | TextField::InputStyle::FONT_STYLE ), TEST_LOCATION );
1136 const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
1137 DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
1139 const Property::Map fontStyleMapGet = field.GetProperty( TextField::Property::INPUT_FONT_STYLE ).Get<Property::Map>();
1141 Property::Map fontStyleMapSet;
1142 fontStyleMapSet.Insert( "weight", "bold" );
1144 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
1145 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
1147 DALI_TEST_CHECK( inputStyleChangedSignal );
1149 gInputStyleChangedCallbackCalled = false;
1150 gInputStyleMask = TextField::InputStyle::NONE;
1151 inputStyleChangedSignal = false;
1153 // Create a tap event to touch the text field.
1154 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 115.f, 25.f ) ) );
1155 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 115.f, 25.f ) ) );
1157 // Render and notify
1158 application.SendNotification();
1159 application.Render();
1161 // Executes the idle callbacks added by the text control on the change of input style.
1162 application.RunIdles();
1164 DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
1165 DALI_TEST_CHECK( !inputStyleChangedSignal );
1167 gInputStyleChangedCallbackCalled = false;
1168 gInputStyleMask = TextField::InputStyle::NONE;
1169 inputStyleChangedSignal = false;
1171 // Create a tap event to touch the text field.
1172 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 164.f, 25.f ) ) );
1173 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 164.f, 25.f ) ) );
1175 // Render and notify
1176 application.SendNotification();
1177 application.Render();
1179 // Executes the idle callbacks added by the text control on the change of input style.
1180 application.RunIdles();
1182 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1183 if( gInputStyleChangedCallbackCalled )
1185 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextField::InputStyle::FONT_STYLE ), TEST_LOCATION );
1187 const std::string style = field.GetProperty( TextField::Property::INPUT_FONT_STYLE ).Get<std::string>();
1188 DALI_TEST_CHECK( style.empty() );
1190 DALI_TEST_CHECK( inputStyleChangedSignal );
1192 gInputStyleChangedCallbackCalled = false;
1193 gInputStyleMask = TextField::InputStyle::NONE;
1194 inputStyleChangedSignal = false;
1196 // Create a tap event to touch the text field.
1197 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 191.f, 25.f ) ) );
1198 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 191.f, 25.f ) ) );
1200 // Render and notify
1201 application.SendNotification();
1202 application.Render();
1204 // Executes the idle callbacks added by the text control on the change of input style.
1205 application.RunIdles();
1207 DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
1208 DALI_TEST_CHECK( !inputStyleChangedSignal );
1213 int utcDaliTextFieldInputStyleChanged02(void)
1215 ToolkitTestApplication application;
1216 tet_infoline(" utcDaliTextFieldInputStyleChanged02");
1218 // The text-field emits signals when the input style changes. These changes of style are
1219 // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
1220 // can't be emitted during the size negotiation as the callbacks may update the UI.
1221 // The text-field adds an idle callback to the adaptor to emit the signals after the size negotiation.
1222 // This creates an implementation of the adaptor stub and a queue of idle callbacks.
1223 application.CreateAdaptor();
1227 char* pathNamePtr = get_current_dir_name();
1228 const std::string pathName( pathNamePtr );
1229 free( pathNamePtr );
1231 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1232 fontClient.SetDpi( 93u, 93u );
1234 fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE );
1235 fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE );
1237 TextField field = TextField::New();
1238 DALI_TEST_CHECK( field );
1241 field.SetSize( 300.f, 50.f );
1242 field.SetParentOrigin( ParentOrigin::TOP_LEFT );
1243 field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1245 field.SetProperty( TextField::Property::ENABLE_MARKUP, true );
1246 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>" );
1248 // connect to the text changed signal.
1249 ConnectionTracker* testTracker = new ConnectionTracker();
1250 field.InputStyleChangedSignal().Connect( &TestInputStyleChangedCallback );
1251 bool inputStyleChangedSignal = false;
1252 field.ConnectSignal( testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal) );
1254 Stage::GetCurrent().Add( field );
1256 // Render and notify
1257 application.SendNotification();
1258 application.Render();
1260 // Executes the idle callbacks added by the text control on the change of input style.
1261 application.RunIdles();
1263 gInputStyleChangedCallbackCalled = false;
1264 gInputStyleMask = TextField::InputStyle::NONE;
1265 inputStyleChangedSignal = false;
1267 // Create a tap event to touch the text field.
1268 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 53.f, 25.f ) ) );
1269 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 53.f, 25.f ) ) );
1270 application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 53.f, 25.f ) ) );
1271 application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 53.f, 25.f ) ) );
1273 // Render and notify
1274 application.SendNotification();
1275 application.Render();
1277 // Executes the idle callbacks added by the text control on the change of input style.
1278 application.RunIdles();
1280 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1281 if( gInputStyleChangedCallbackCalled )
1283 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
1284 static_cast<unsigned int>( TextField::InputStyle::FONT_FAMILY |
1285 TextField::InputStyle::POINT_SIZE |
1286 TextField::InputStyle::COLOR ),
1289 const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
1290 DALI_TEST_EQUALS( color, Color::GREEN, TEST_LOCATION );
1292 const std::string fontFamily = field.GetProperty( TextField::Property::INPUT_FONT_FAMILY ).Get<std::string>();
1293 DALI_TEST_EQUALS( fontFamily, "DejaVuSerif", TEST_LOCATION );
1295 const float pointSize = field.GetProperty( TextField::Property::INPUT_POINT_SIZE ).Get<float>();
1296 DALI_TEST_EQUALS( pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1298 DALI_TEST_CHECK( inputStyleChangedSignal );
1300 gInputStyleChangedCallbackCalled = false;
1301 gInputStyleMask = TextField::InputStyle::NONE;
1302 inputStyleChangedSignal = false;
1304 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
1306 // Render and notify
1307 application.SendNotification();
1308 application.Render();
1310 // Executes the idle callbacks added by the text control on the change of input style.
1311 application.RunIdles();
1313 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1314 if( gInputStyleChangedCallbackCalled )
1316 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
1317 static_cast<unsigned int>( TextField::InputStyle::COLOR ),
1320 const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
1321 DALI_TEST_EQUALS( color, Color::BLUE, TEST_LOCATION );
1323 DALI_TEST_CHECK( inputStyleChangedSignal );
1325 gInputStyleChangedCallbackCalled = false;
1326 gInputStyleMask = TextField::InputStyle::NONE;
1327 inputStyleChangedSignal = false;
1329 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
1331 // Render and notify
1332 application.SendNotification();
1333 application.Render();
1335 // Executes the idle callbacks added by the text control on the change of input style.
1336 application.RunIdles();
1338 DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
1339 DALI_TEST_CHECK( !inputStyleChangedSignal );
1341 gInputStyleChangedCallbackCalled = false;
1342 gInputStyleMask = TextField::InputStyle::NONE;
1343 inputStyleChangedSignal = false;
1345 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
1347 // Render and notify
1348 application.SendNotification();
1349 application.Render();
1351 // Executes the idle callbacks added by the text control on the change of input style.
1352 application.RunIdles();
1354 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1355 if( gInputStyleChangedCallbackCalled )
1357 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
1358 static_cast<unsigned int>( TextField::InputStyle::COLOR ),
1361 const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
1362 DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
1364 DALI_TEST_CHECK( inputStyleChangedSignal );
1366 gInputStyleChangedCallbackCalled = false;
1367 gInputStyleMask = TextField::InputStyle::NONE;
1368 inputStyleChangedSignal = false;
1370 field.SetProperty( TextField::Property::INPUT_COLOR, Color::YELLOW );
1372 Property::Map fontStyleMapSet;
1373 fontStyleMapSet.Insert( "weight", "thin" );
1374 fontStyleMapSet.Insert( "width", "condensed" );
1375 fontStyleMapSet.Insert( "slant", "italic" );
1377 field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
1378 field.SetProperty( TextField::Property::INPUT_POINT_SIZE, 20.f );
1380 field.SetProperty( TextField::Property::INPUT_UNDERLINE, "underline" );
1381 field.SetProperty( TextField::Property::INPUT_SHADOW, "shadow" );
1382 field.SetProperty( TextField::Property::INPUT_EMBOSS, "emboss" );
1383 field.SetProperty( TextField::Property::INPUT_OUTLINE, "outline" );
1385 // Render and notify
1386 application.SendNotification();
1387 application.Render();
1389 // Executes the idle callbacks added by the text control on the change of input style.
1390 application.RunIdles();
1392 DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
1393 DALI_TEST_CHECK( !inputStyleChangedSignal );
1395 // Create a tap event to touch the text field.
1396 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 63.f, 25.f ) ) );
1397 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 63.f, 25.f ) ) );
1399 // Render and notify
1400 application.SendNotification();
1401 application.Render();
1403 // Executes the idle callbacks added by the text control on the change of input style.
1404 application.RunIdles();
1406 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1407 if( gInputStyleChangedCallbackCalled )
1409 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
1410 static_cast<unsigned int>( TextField::InputStyle::COLOR |
1411 TextField::InputStyle::POINT_SIZE |
1412 TextField::InputStyle::FONT_STYLE |
1413 TextField::InputStyle::UNDERLINE |
1414 TextField::InputStyle::SHADOW |
1415 TextField::InputStyle::EMBOSS |
1416 TextField::InputStyle::OUTLINE ),
1419 const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
1420 DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
1422 DALI_TEST_CHECK( inputStyleChangedSignal );
1427 int utcDaliTextFieldEvent01(void)
1429 ToolkitTestApplication application;
1430 tet_infoline(" utcDaliTextFieldEvent01");
1432 // Creates a tap event. After creating a tap event the text field should
1433 // have the focus and add text with key events should be possible.
1435 TextField field = TextField::New();
1436 DALI_TEST_CHECK( field );
1438 Stage::GetCurrent().Add( field );
1440 field.SetSize( 300.f, 50.f );
1441 field.SetParentOrigin( ParentOrigin::TOP_LEFT );
1442 field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1444 // Avoid a crash when core load gl resources.
1445 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1447 // Render and notify
1448 application.SendNotification();
1449 application.Render();
1451 // Add a key event but as the text field has not the focus it should do nothing.
1452 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
1454 // Render and notify
1455 application.SendNotification();
1456 application.Render();
1458 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::TEXT ), std::string(""), TEST_LOCATION );
1460 // Create a tap event to touch the text field.
1461 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1462 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1464 // Render and notify
1465 application.SendNotification();
1466 application.Render();
1468 // Now the text field has the focus, so it can handle the key events.
1469 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
1470 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
1472 // Render and notify
1473 application.SendNotification();
1474 application.Render();
1476 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::TEXT ), std::string("aa"), TEST_LOCATION );
1478 // Create a second text field and send key events to it.
1479 TextField field2 = TextField::New();
1481 field2.SetParentOrigin( ParentOrigin::TOP_LEFT );
1482 field2.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1483 field2.SetSize( 100.f, 100.f );
1484 field2.SetPosition( 100.f, 100.f );
1486 Stage::GetCurrent().Add( field2 );
1488 // Render and notify
1489 application.SendNotification();
1490 application.Render();
1492 // Create a tap event on the second text field.
1493 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 125.0f ) ) );
1494 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 125.0f ) ) );
1496 // Render and notify
1497 application.SendNotification();
1498 application.Render();
1500 // The second text field has the focus. It should handle the key events.
1501 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
1502 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
1504 // Render and notify
1505 application.SendNotification();
1506 application.Render();
1508 // Check the text has been added to the second text field.
1509 DALI_TEST_EQUALS( field2.GetProperty<std::string>( TextField::Property::TEXT ), std::string("aa"), TEST_LOCATION );
1514 int utcDaliTextFieldEvent02(void)
1516 ToolkitTestApplication application;
1517 tet_infoline(" utcDaliTextFieldEvent02");
1519 // Checks if the right number of actors are created.
1521 TextField field = TextField::New();
1522 field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
1523 DALI_TEST_CHECK( field );
1524 LoadMarkerImages(application, field);
1526 Stage::GetCurrent().Add( field );
1528 field.SetSize( 300.f, 50.f );
1529 field.SetParentOrigin( ParentOrigin::TOP_LEFT );
1530 field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1532 // Avoid a crash when core load gl resources.
1533 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1535 // Render and notify
1536 application.SendNotification();
1537 application.Render();
1539 // Check there are the expected number of children ( stencil ).
1540 DALI_TEST_EQUALS( field.GetChildCount(), 1u, TEST_LOCATION );
1542 Actor stencil = field.GetChildAt( 0u );
1543 DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION );
1545 // Create a tap event to touch the text field.
1546 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1547 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1549 // Render and notify
1550 application.SendNotification();
1551 application.Render();
1553 Actor layer = field.GetChildAt( 1u );
1554 DALI_TEST_CHECK( layer.IsLayer() );
1556 DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor.
1557 DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION );
1559 // Now the text field has the focus, so it can handle the key events.
1560 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
1561 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
1563 // Render and notify
1564 application.SendNotification();
1565 application.Render();
1567 // Checks the cursor and the renderer have been created.
1568 DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor.
1569 DALI_TEST_EQUALS( stencil.GetChildCount(), 1u, TEST_LOCATION ); // The renderer
1571 Control cursor = Control::DownCast( layer.GetChildAt( 0u ) );
1572 DALI_TEST_CHECK( cursor );
1574 // The offscreen root actor has a container with all the actors which contain the text renderers.
1575 Actor container = stencil.GetChildAt( 0u );
1576 for( unsigned int index = 0; index < container.GetChildCount(); ++index )
1578 Renderer renderer = container.GetChildAt( index ).GetRendererAt( 0u );
1579 DALI_TEST_CHECK( renderer );
1582 // Move the cursor and check the position changes.
1583 Vector3 position1 = cursor.GetCurrentPosition();
1585 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
1586 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
1588 // Render and notify
1589 application.SendNotification();
1590 application.Render();
1592 Vector3 position2 = cursor.GetCurrentPosition();
1594 DALI_TEST_CHECK( position2.x < position1.x );
1596 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
1597 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
1599 // Render and notify
1600 application.SendNotification();
1601 application.Render();
1603 Vector3 position3 = cursor.GetCurrentPosition();
1605 DALI_TEST_EQUALS( position1, position3, TEST_LOCATION ); // Should be in the same position1.
1607 // Send some taps and check the cursor positions.
1609 // Try to tap at the beginning.
1610 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
1611 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
1613 // Render and notify
1614 application.SendNotification();
1615 application.Render();
1617 // Cursor position should be the same than position1.
1618 Vector3 position4 = cursor.GetCurrentPosition();
1620 DALI_TEST_EQUALS( position2, position4, TEST_LOCATION ); // Should be in the same position2.
1622 // Tap away from the start position.
1623 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 16.f, 25.0f ) ) );
1624 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 16.0f, 25.0f ) ) );
1626 // Render and notify
1627 application.SendNotification();
1628 application.Render();
1630 Vector3 position5 = cursor.GetCurrentPosition();
1632 DALI_TEST_CHECK( position5.x > position4.x );
1634 // Remove all the text.
1635 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
1636 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
1637 field.SetProperty( TextField::Property::TEXT, "" );
1639 // Render and notify
1640 application.SendNotification();
1641 application.Render();
1643 // Cursor position should be the same than position2.
1644 Vector3 position6 = cursor.GetCurrentPosition();
1646 DALI_TEST_EQUALS( position2, position6, TEST_LOCATION );// Should be in the same position2.
1648 // Should not be a renderer.
1649 DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION );
1654 int utcDaliTextFieldEvent03(void)
1656 ToolkitTestApplication application;
1657 tet_infoline(" utcDaliTextFieldEvent03");
1659 // Checks if the highlight actor is created.
1661 TextField field = TextField::New();
1662 DALI_TEST_CHECK( field );
1664 Stage::GetCurrent().Add( field );
1666 field.SetProperty( TextField::Property::TEXT, "This is a long text for the size of the text-field." );
1667 field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
1668 field.SetSize( 30.f, 50.f );
1669 field.SetParentOrigin( ParentOrigin::TOP_LEFT );
1670 field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1672 // Avoid a crash when core load gl resources.
1673 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1674 LoadMarkerImages(application, field);
1676 // Render and notify
1677 application.SendNotification();
1678 application.Render();
1680 // Tap first to get the focus.
1681 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1682 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1684 // Render and notify
1685 application.SendNotification();
1686 application.Render();
1688 // Double tap to select a word.
1689 application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 3.f, 25.0f ) ) );
1690 application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 3.f, 25.0f ) ) );
1692 // Render and notify
1693 application.SendNotification();
1694 application.Render();
1696 // The offscreen root actor should have two actors: the renderer and the highlight actor.
1697 Actor stencil = field.GetChildAt( 0u );
1699 // The offscreen root actor has a container with all the actors which contain the text renderers.
1700 Actor container = stencil.GetChildAt( 0u );
1701 for( unsigned int index = 0; index < container.GetChildCount(); ++index )
1703 Renderer renderer = container.GetChildAt( index ).GetRendererAt( 0u );
1704 DALI_TEST_CHECK( renderer );
1707 Renderer highlight = stencil.GetChildAt( 1u ).GetRendererAt( 0u );
1708 DALI_TEST_CHECK( highlight );
1713 int utcDaliTextFieldEvent04(void)
1715 ToolkitTestApplication application;
1716 tet_infoline(" utcDaliTextFieldEvent04");
1718 // Checks if the highlight actor is created.
1720 TextField field = TextField::New();
1721 DALI_TEST_CHECK( field );
1722 Stage::GetCurrent().Add( field );
1723 LoadMarkerImages(application, field);
1724 // Render and notify
1725 application.SendNotification();
1726 application.Render();
1728 field.SetProperty( TextField::Property::TEXT, "This is a long text for the size of the text-field." );
1729 field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
1730 field.SetSize( 300.f, 50.f );
1731 field.SetParentOrigin( ParentOrigin::TOP_LEFT );
1732 field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1734 // Avoid a crash when core load gl resources.
1735 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1736 // Render and notify
1737 application.SendNotification();
1738 application.Render();
1740 // Create a tap event to touch the text field.
1741 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1742 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1743 // Render and notify
1744 application.SendNotification();
1745 application.Render();
1748 // Tap first to get the focus.
1749 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
1750 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
1752 // Render and notify
1753 application.SendNotification();
1754 application.Render();
1756 // Double tap to select a word.
1757 application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
1758 application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
1760 // Render and notify
1761 application.SendNotification();
1762 application.Render();
1765 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 0.f, 40.0f ) ) );
1766 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 0.f, 40.0f ) ) );
1770 int utcDaliTextFieldEvent05(void)
1772 ToolkitTestApplication application;
1773 tet_infoline(" utcDaliTextFieldEvent05");
1775 // Checks dragging of cursor/grab handle
1777 TextField field = TextField::New();
1778 DALI_TEST_CHECK( field );
1779 Stage::GetCurrent().Add( field );
1780 LoadMarkerImages(application, field);
1781 // Render and notify
1782 application.SendNotification();
1783 application.Render();
1785 field.SetProperty( TextField::Property::TEXT, "This is a long text for the size of the text-field." );
1786 field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
1787 field.SetSize( 300.f, 50.f );
1788 field.SetParentOrigin( ParentOrigin::TOP_LEFT );
1789 field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1791 // Avoid a crash when core load gl resources.
1792 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1793 // Render and notify
1794 application.SendNotification();
1795 application.Render();
1797 // Create a tap event to touch the text field.
1798 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1799 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1800 // Render and notify
1801 application.SendNotification();
1802 application.Render();
1805 // Tap first to get the focus.
1806 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
1807 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
1809 // Render and notify
1810 application.SendNotification();
1811 application.Render();
1813 // Double tap to select a word.
1814 application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
1815 application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
1817 // Render and notify
1818 application.SendNotification();
1819 application.Render();
1821 // drag grab handle right
1822 Vector2 pos(0.0f, 40.0f);
1823 SendPan(application, Gesture::Possible, pos);
1824 SendPan(application, Gesture::Started, pos);
1826 Wait(application, 100);
1828 for(int i = 0;i<20;i++)
1830 SendPan(application, Gesture::Continuing, pos);
1835 SendPan(application, Gesture::Finished, pos);
1836 Wait(application, RENDER_FRAME_INTERVAL);
1838 Actor stencil = field.GetChildAt( 1u );
1842 int utcDaliTextFieldEvent06(void)
1844 ToolkitTestApplication application;
1845 tet_infoline(" utcDaliTextFieldEvent06");
1847 // Checks Longpress when in edit mode
1849 TextField field = TextField::New();
1850 DALI_TEST_CHECK( field );
1851 Stage::GetCurrent().Add( field );
1852 LoadMarkerImages(application, field);
1853 // Render and notify
1854 application.SendNotification();
1855 application.Render();
1857 field.SetProperty( TextField::Property::TEXT, "Thisisalongtextforthesizeofthetextfield." );
1858 field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
1859 field.SetSize( 300.f, 50.f );
1860 field.SetParentOrigin( ParentOrigin::TOP_LEFT );
1861 field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1863 // Avoid a crash when core load gl resources.
1864 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1865 // Render and notify
1866 application.SendNotification();
1867 application.Render();
1869 // Create a tap event to touch the text field.
1870 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1871 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1872 // Render and notify
1873 application.SendNotification();
1874 application.Render();
1877 // Tap first to get the focus.
1878 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
1879 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
1881 // Render and notify
1882 application.SendNotification();
1883 application.Render();
1886 application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) );
1887 application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) );
1889 // Render and notify
1890 application.SendNotification();
1891 application.Render();
1896 int utcDaliTextFieldEvent07(void)
1898 ToolkitTestApplication application;
1899 tet_infoline(" utcDaliTextFieldEvent07");
1901 // Checks Longpress to start edit mode
1903 TextField field = TextField::New();
1904 DALI_TEST_CHECK( field );
1905 Stage::GetCurrent().Add( field );
1906 LoadMarkerImages(application, field);
1907 // Render and notify
1908 application.SendNotification();
1909 application.Render();
1911 field.SetProperty( TextField::Property::TEXT, "Thisisalongtextforthesizeofthetextfield." );
1912 field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
1913 field.SetSize( 300.f, 50.f );
1914 field.SetParentOrigin( ParentOrigin::TOP_LEFT );
1915 field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1916 Property::Map propertyMap;
1917 propertyMap["PANEL_LAYOUT"] = InputMethod::PanelLayout::PASSWORD;
1918 field.SetProperty( TextField::Property::INPUT_METHOD_SETTINGS, propertyMap );
1920 // Avoid a crash when core load gl resources.
1921 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1922 // Render and notify
1923 application.SendNotification();
1924 application.Render();
1927 application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) );
1928 application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) );
1930 // Render and notify
1931 application.SendNotification();
1932 application.Render();
1937 int utcDaliTextFieldEvent08(void)
1939 ToolkitTestApplication application;
1940 tet_infoline(" utcDaliTextFieldEvent08");
1942 Dali::Clipboard clipboard = Clipboard::Get();
1943 clipboard.SetItem("testTextFieldEvent");
1945 // Checks Longpress when only place holder text
1947 TextField field = TextField::New();
1948 DALI_TEST_CHECK( field );
1949 Stage::GetCurrent().Add( field );
1950 LoadMarkerImages(application, field);
1951 // Render and notify
1952 application.SendNotification();
1953 application.Render();
1955 field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Setting Placeholder Text" );
1956 field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
1957 field.SetSize( 300.f, 50.f );
1958 field.SetParentOrigin( ParentOrigin::TOP_LEFT );
1959 field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1961 // Avoid a crash when core load gl resources.
1962 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1963 // Render and notify
1964 application.SendNotification();
1965 application.Render();
1968 application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) );
1969 application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) );
1971 // Render and notify
1972 application.SendNotification();
1973 application.Render();
1975 Wait(application, 500);
1978 application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) );
1979 application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) );
1981 // Render and notify
1982 application.SendNotification();
1983 application.Render();
1985 Wait(application, 500);
1987 Stage stage = Stage::GetCurrent();
1988 Layer layer = stage.GetRootLayer();
1989 Actor actor = layer.FindChildByName("optionPaste");
1993 Vector3 worldPosition = actor.GetCurrentWorldPosition();
1994 Vector2 halfStageSize = stage.GetSize() / 2.0f;
1995 Vector2 position(worldPosition.x + halfStageSize.width, worldPosition.y + halfStageSize.height);
1997 Dali::Integration::TouchEvent event;
1998 event = Dali::Integration::TouchEvent();
1999 event.AddPoint( GetPointDownInside( position ) );
2000 application.ProcessEvent( event );
2002 event = Dali::Integration::TouchEvent();
2003 event.AddPoint( GetPointUpInside( position ) );
2004 application.ProcessEvent( event );
2006 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string("testTextFieldEvent"), TEST_LOCATION );
2011 int utcDaliTextFieldEvent09(void)
2013 ToolkitTestApplication application;
2014 tet_infoline(" utcDaliTextFieldEvent09");
2016 TextField field = TextField::New();
2017 DALI_TEST_CHECK( field );
2018 Stage::GetCurrent().Add( field );
2019 LoadMarkerImages(application, field);
2020 // Render and notify
2021 application.SendNotification();
2022 application.Render();
2024 field.SetProperty( TextField::Property::TEXT, "Hello" );
2025 field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
2026 field.SetSize( 300.f, 50.f );
2027 field.SetParentOrigin( ParentOrigin::TOP_LEFT );
2028 field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
2030 // Avoid a crash when core load gl resources.
2031 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
2033 // Create a tap event to touch the text field.
2034 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
2035 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
2036 application.SendNotification();
2037 application.Render();
2040 map[ HiddenInput::Property::MODE ] = HiddenInput::Mode::HIDE_NONE;
2041 field.SetProperty( DevelTextField::Property::HIDDEN_INPUT_SETTINGS, map );
2042 application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2043 application.SendNotification();
2044 application.Render();
2046 map[ HiddenInput::Property::MODE ] = HiddenInput::Mode::HIDE_ALL;
2047 map[ HiddenInput::Property::SUBSTITUTE_CHARACTER ] = 0x23;
2048 field.SetProperty( DevelTextField::Property::HIDDEN_INPUT_SETTINGS, map );
2049 application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2050 application.SendNotification();
2051 application.Render();
2053 map[ HiddenInput::Property::MODE ] = HiddenInput::Mode::HIDE_COUNT;
2054 map[ HiddenInput::Property::SUBSTITUTE_COUNT ] = 2;
2055 field.SetProperty( DevelTextField::Property::HIDDEN_INPUT_SETTINGS, map );
2056 for( unsigned int index = 0u; index < 5u; ++index )
2058 application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2059 application.SendNotification();
2060 application.Render();
2063 map[ HiddenInput::Property::MODE ] = HiddenInput::Mode::SHOW_COUNT;
2064 map[ HiddenInput::Property::SUBSTITUTE_COUNT ] = 2;
2065 field.SetProperty( DevelTextField::Property::HIDDEN_INPUT_SETTINGS, map );
2066 for( unsigned int index = 0u; index < 5u; ++index )
2068 application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2069 application.SendNotification();
2070 application.Render();
2073 map[ HiddenInput::Property::MODE ] = HiddenInput::Mode::SHOW_LAST_CHARACTER;
2074 map[ HiddenInput::Property::SHOW_DURATION ] = 0;
2075 field.SetProperty( DevelTextField::Property::HIDDEN_INPUT_SETTINGS, map );
2076 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2077 application.SendNotification();
2078 application.Render();
2079 application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2080 application.SendNotification();
2081 application.Render();
2083 map[ HiddenInput::Property::SHOW_DURATION ] = 100;
2084 field.SetProperty( DevelTextField::Property::HIDDEN_INPUT_SETTINGS, map );
2085 application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2086 application.SendNotification();
2087 application.Render();
2089 Property::Map mapGet;
2090 mapGet = field.GetProperty<Property::Map>( DevelTextField::Property::HIDDEN_INPUT_SETTINGS );
2091 DALI_TEST_EQUALS( map.Count(), mapGet.Count(), TEST_LOCATION );
2092 DALI_TEST_EQUALS( DaliTestCheckMaps( map, mapGet ), true, TEST_LOCATION );
2097 int utcDaliTextFieldStyleWhilstSelected(void)
2099 ToolkitTestApplication application;
2100 tet_infoline(" utcDaliTextFieldStyleWhilstSelected");
2102 // Change font and styles whilst text is selected whilst word selected
2104 TextField field = TextField::New();
2105 DALI_TEST_CHECK( field );
2106 Stage::GetCurrent().Add( field );
2107 LoadMarkerImages(application, field);
2108 // Render and notify
2109 application.SendNotification();
2110 application.Render();
2112 field.SetProperty( TextField::Property::TEXT, "This is a long text for the size of the text-field." );
2113 field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
2114 field.SetSize( 300.f, 50.f );
2115 field.SetParentOrigin( ParentOrigin::TOP_LEFT );
2116 field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
2118 // Avoid a crash when core load gl resources.
2119 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
2120 // Render and notify
2121 application.SendNotification();
2122 application.Render();
2124 // Create a tap event to touch the text field.
2125 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
2126 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
2127 // Render and notify
2128 application.SendNotification();
2129 application.Render();
2132 // Tap first to get the focus.
2133 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
2134 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
2136 // Render and notify
2137 application.SendNotification();
2138 application.Render();
2140 // Double tap to select a word.
2141 application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
2142 application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
2144 // Render and notify
2145 application.SendNotification();
2146 application.Render();
2148 field.SetProperty( TextField::Property::INPUT_FONT_FAMILY, "Setting input font family" );
2149 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_FAMILY ), "Setting input font family", TEST_LOCATION );
2151 Property::Map fontStyleMapSet;
2152 Property::Map fontStyleMapGet;
2154 fontStyleMapSet.Insert( "weight", "bold" );
2155 fontStyleMapSet.Insert( "slant", "italic" );
2156 field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
2158 fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
2159 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
2160 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
2162 fontStyleMapSet.Clear();
2163 fontStyleMapSet.Insert( "width", "expanded" );
2164 fontStyleMapSet.Insert( "slant", "italic" );
2165 field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
2167 fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
2168 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
2169 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
2171 field.SetProperty( TextField::Property::INPUT_POINT_SIZE, 12.f );
2172 DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::INPUT_POINT_SIZE ), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
2174 field.SetProperty( TextField::Property::TEXT_COLOR, Color::RED );
2175 DALI_TEST_EQUALS( field.GetProperty<Vector4>( TextField::Property::TEXT_COLOR ), Color::RED, TEST_LOCATION );
2177 fontStyleMapSet.Clear();
2178 fontStyleMapSet.Insert( "weight", "bold" );
2179 fontStyleMapSet.Insert( "slant", "italic" );
2181 field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
2183 fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
2184 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
2185 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
2187 fontStyleMapSet.Clear();
2188 fontStyleMapSet.Insert( "width", "expanded" );
2190 field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
2192 fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
2193 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
2194 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
2196 // Press Escape to increase coverage
2197 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2198 application.SendNotification();
2199 application.Render();
2201 DALI_TEST_CHECK( !field.HasKeyInputFocus() );
2206 int utcDaliTextFieldEscKeyLoseFocus(void)
2208 ToolkitTestApplication application;
2209 tet_infoline(" utcDaliTextFieldEscKeyLoseFocus");
2211 // Creates a tap event. After creating a tap event the text field should
2212 // have the focus and add text with key events should be possible.
2214 TextField field = TextField::New();
2215 DALI_TEST_CHECK( field );
2217 Stage::GetCurrent().Add( field );
2219 field.SetSize( 300.f, 50.f );
2220 field.SetParentOrigin( ParentOrigin::TOP_LEFT );
2221 field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
2223 // Avoid a crash when core load gl resources.
2224 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
2226 // Render and notify
2227 application.SendNotification();
2228 application.Render();
2230 // Add a key event but as the text field has not the focus it should do nothing.
2231 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2232 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2234 // Render and notify
2235 application.SendNotification();
2236 application.Render();
2238 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::TEXT ), std::string(""), TEST_LOCATION );
2240 // Create a tap event to touch the text field.
2241 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
2242 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
2244 // Render and notify
2245 application.SendNotification();
2246 application.Render();
2248 // Now the text field has the focus, so it can handle the key events.
2249 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2250 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2251 application.ProcessEvent( GenerateKey( "d", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2252 application.ProcessEvent( GenerateKey( "d", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2254 // Render and notify
2255 application.SendNotification();
2256 application.Render();
2258 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::TEXT ), std::string("ad"), TEST_LOCATION );
2260 // Generate a Esc key event. The text field should lose the focus.
2261 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2262 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2264 // Render and notify
2265 application.SendNotification();
2266 application.Render();
2268 DALI_TEST_EQUALS( false, field.HasKeyInputFocus(), TEST_LOCATION );
2270 // No more text should be introduced
2271 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2272 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2274 // Render and notify
2275 application.SendNotification();
2276 application.Render();
2278 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::TEXT ), std::string("ad"), TEST_LOCATION );
2283 int utcDaliTextFieldSomeSpecialKeys(void)
2285 ToolkitTestApplication application;
2286 tet_infoline(" utcDaliTextFieldSomeSpecialKeys");
2288 // Checks some special keys when the text is selected.
2290 TextField field = TextField::New();
2291 DALI_TEST_CHECK( field );
2292 Stage::GetCurrent().Add( field );
2293 LoadMarkerImages(application, field);
2294 // Render and notify
2295 application.SendNotification();
2296 application.Render();
2298 const std::string longText( "This is a long text for the size of the text-field." );
2300 field.SetProperty( TextField::Property::TEXT, longText );
2301 field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
2302 field.SetSize( 300.f, 50.f );
2303 field.SetParentOrigin( ParentOrigin::TOP_LEFT );
2304 field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
2306 // Avoid a crash when core load gl resources.
2307 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
2308 // Render and notify
2309 application.SendNotification();
2310 application.Render();
2312 // Create a tap event to touch the text field.
2313 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
2314 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
2316 // Render and notify
2317 application.SendNotification();
2318 application.Render();
2320 // Tap first to get the focus.
2321 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
2322 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
2324 // Render and notify
2325 application.SendNotification();
2326 application.Render();
2328 // Double tap to select a word.
2329 application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
2330 application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
2332 // Render and notify
2333 application.SendNotification();
2334 application.Render();
2336 // Generate a Esc key event. The text field should lose the focus.
2337 application.ProcessEvent( GenerateKey( "XF86PowerOff", "XF86PowerOff", DALI_KEY_POWER, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2338 application.ProcessEvent( GenerateKey( "XF86PowerOff", "XF86PowerOff", DALI_KEY_POWER, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2340 // Render and notify
2341 application.SendNotification();
2342 application.Render();
2344 // Generate a Esc key event. The text field should lose the focus.
2345 application.ProcessEvent( GenerateKey( "XF86Menu", "XF86Menu", DALI_KEY_MENU, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2346 application.ProcessEvent( GenerateKey( "XF86Menu", "XF86Menu", DALI_KEY_MENU, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2348 // Render and notify
2349 application.SendNotification();
2350 application.Render();
2352 // Generate a Esc key event. The text field should lose the focus.
2353 application.ProcessEvent( GenerateKey( "XF86Home", "XF86Home", DALI_KEY_HOME, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2354 application.ProcessEvent( GenerateKey( "XF86Home", "XF86Home", DALI_KEY_HOME, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
2356 // Render and notify
2357 application.SendNotification();
2358 application.Render();
2360 // The text shouldn't be deleted.
2361 DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::TEXT ), longText, TEST_LOCATION );