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.
21 #include <dali/public-api/rendering/renderer.h>
22 #include <dali/devel-api/adaptor-framework/clipboard.h>
23 #include <dali/integration-api/events/key-event-integ.h>
24 #include <dali/integration-api/events/touch-event-integ.h>
25 #include <dali/integration-api/events/tap-gesture-event.h>
26 #include <dali/integration-api/events/pan-gesture-event.h>
27 #include <dali-toolkit-test-suite-utils.h>
28 #include <dali-toolkit/dali-toolkit.h>
29 #include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
32 using namespace Toolkit;
34 void dali_texteditor_startup(void)
36 test_return_value = TET_UNDEF;
39 void dali_texteditor_cleanup(void)
41 test_return_value = TET_PASS;
47 const char* const PROPERTY_NAME_RENDERING_BACKEND = "renderingBackend";
48 const char* const PROPERTY_NAME_TEXT = "text";
49 const char* const PROPERTY_NAME_TEXT_COLOR = "textColor";
50 const char* const PROPERTY_NAME_FONT_FAMILY = "fontFamily";
51 const char* const PROPERTY_NAME_FONT_STYLE = "fontStyle";
52 const char* const PROPERTY_NAME_POINT_SIZE = "pointSize";
53 const char* const PROPERTY_NAME_HORIZONTAL_ALIGNMENT = "horizontalAlignment";
54 const char* const PROPERTY_NAME_SCROLL_THRESHOLD = "scrollThreshold";
55 const char* const PROPERTY_NAME_SCROLL_SPEED = "scrollSpeed";
56 const char* const PROPERTY_NAME_PRIMARY_CURSOR_COLOR = "primaryCursorColor";
57 const char* const PROPERTY_NAME_SECONDARY_CURSOR_COLOR = "secondaryCursorColor";
58 const char* const PROPERTY_NAME_ENABLE_CURSOR_BLINK = "enableCursorBlink";
59 const char* const PROPERTY_NAME_CURSOR_BLINK_INTERVAL = "cursorBlinkInterval";
60 const char* const PROPERTY_NAME_CURSOR_BLINK_DURATION = "cursorBlinkDuration";
61 const char* const PROPERTY_NAME_CURSOR_WIDTH = "cursorWidth";
62 const char* const PROPERTY_NAME_GRAB_HANDLE_IMAGE = "grabHandleImage";
63 const char* const PROPERTY_NAME_GRAB_HANDLE_PRESSED_IMAGE = "grabHandlePressedImage";
64 const char* const PROPERTY_NAME_SELECTION_HANDLE_IMAGE_LEFT = "selectionHandleImageLeft";
65 const char* const PROPERTY_NAME_SELECTION_HANDLE_IMAGE_RIGHT = "selectionHandleImageRight";
66 const char* const PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_LEFT = "selectionHandlePressedImageLeft";
67 const char* const PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = "selectionHandlePressedImageRight";
68 const char* const PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_LEFT = "selectionHandleMarkerImageLeft";
69 const char* const PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_RIGHT = "selectionHandleMarkerImageRight";
70 const char* const PROPERTY_NAME_SELECTION_HIGHLIGHT_COLOR = "selectionHighlightColor";
71 const char* const PROPERTY_NAME_DECORATION_BOUNDING_BOX = "decorationBoundingBox";
72 const char* const PROPERTY_NAME_ENABLE_MARKUP = "enableMarkup";
73 const char* const PROPERTY_NAME_INPUT_COLOR = "inputColor";
74 const char* const PROPERTY_NAME_INPUT_FONT_FAMILY = "inputFontFamily";
75 const char* const PROPERTY_NAME_INPUT_FONT_STYLE = "inputFontStyle";
76 const char* const PROPERTY_NAME_INPUT_POINT_SIZE = "inputPointSize";
78 const char* const PROPERTY_NAME_LINE_SPACING = "lineSpacing";
79 const char* const PROPERTY_NAME_INPUT_LINE_SPACING = "inputLineSpacing";
80 const char* const PROPERTY_NAME_UNDERLINE = "underline";
81 const char* const PROPERTY_NAME_INPUT_UNDERLINE = "inputUnderline";
82 const char* const PROPERTY_NAME_SHADOW = "shadow";
83 const char* const PROPERTY_NAME_INPUT_SHADOW = "inputShadow";
84 const char* const PROPERTY_NAME_EMBOSS = "emboss";
85 const char* const PROPERTY_NAME_INPUT_EMBOSS = "inputEmboss";
86 const char* const PROPERTY_NAME_OUTLINE = "outline";
87 const char* const PROPERTY_NAME_INPUT_OUTLINE = "inputOutline";
89 const char* const PROPERTY_NAME_SMOOTH_SCROLL = "smoothScroll";
90 const char* const PROPERTY_NAME_SMOOTH_SCROLL_DURATION = "smoothScrollDuration";
91 const char* const PROPERTY_NAME_ENABLE_SCROLL_BAR = "enableScrollBar";
92 const char* const PROPERTY_NAME_SCROLL_BAR_SHOW_DURATION = "scrollBarShowDuration";
93 const char* const PROPERTY_NAME_SCROLL_BAR_FADE_DURATION = "scrollBarFadeDuration";
94 const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
95 const char* const PROPERTY_NAME_LINE_COUNT = "lineCount";
96 const char* const PROPERTY_NAME_PLACEHOLDER_TEXT = "placeholderText";
97 const char* const PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR = "placeholderTextColor";
98 const char* const PROPERTY_NAME_ENABLE_SELECTION = "enableSelection";
99 const char* const PROPERTY_NAME_PLACEHOLDER = "placeholder";
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 TO_MILLISECONDS = 1000.f;
108 const float TO_SECONDS = 1.f / TO_MILLISECONDS;
109 const float RENDER_FRAME_INTERVAL = 16.66f;
111 const float SCROLL_THRESHOLD = 10.f;
112 const float SCROLL_SPEED = 300.f;
114 const unsigned int DEFAULT_FONT_SIZE = 1152u;
115 const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
117 const int KEY_A_CODE = 38;
118 const int KEY_D_CODE = 40;
119 const int KEY_WHITE_SPACE_CODE = 65;
121 const char* HANDLE_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/insertpoint-icon.png";
123 const std::string DEFAULT_DEVICE_NAME("hwKeyboard");
125 static bool gTextChangedCallBackCalled;
126 static bool gInputStyleChangedCallbackCalled;
127 static Dali::Toolkit::TextEditor::InputStyle::Mask gInputStyleMask;
129 struct CallbackFunctor
131 CallbackFunctor(bool* callbackFlag)
132 : mCallbackFlag( callbackFlag )
138 *mCallbackFlag = true;
143 static void TestTextChangedCallback( TextEditor control )
145 tet_infoline(" TestTextChangedCallback");
147 gTextChangedCallBackCalled = true;
150 static void TestInputStyleChangedCallback( TextEditor control, TextEditor::InputStyle::Mask mask )
152 tet_infoline(" TestInputStyleChangedCallback");
154 gInputStyleChangedCallbackCalled = true;
155 gInputStyleMask = mask;
158 // Generate a TapGestureEvent to send to Core.
159 Integration::TapGestureEvent GenerateTap(
160 Gesture::State state,
161 unsigned int numberOfTaps,
162 unsigned int numberOfTouches,
165 Integration::TapGestureEvent tap( state );
167 tap.numberOfTaps = numberOfTaps;
168 tap.numberOfTouches = numberOfTouches;
174 // Generate a PanGestureEvent to send to Core
175 Integration::PanGestureEvent GeneratePan( Gesture::State state,
176 const Vector2& previousPosition,
177 const Vector2& currentPosition,
178 unsigned long timeDelta,
179 unsigned int numberOfTouches = 1u )
181 Integration::PanGestureEvent pan(state);
183 pan.previousPosition = previousPosition;
184 pan.currentPosition = currentPosition;
185 pan.timeDelta = timeDelta;
186 pan.numberOfTouches = numberOfTouches;
191 // Generate a KeyEvent to send to Core.
192 Integration::KeyEvent GenerateKey( const std::string& keyName,
193 const std::string& keyString,
196 unsigned long timeStamp,
197 const Integration::KeyEvent::State& keyState,
198 const std::string& deviceName = DEFAULT_DEVICE_NAME,
199 const Device::Class::Type& deviceClass = Device::Class::NONE,
200 const Device::Subclass::Type& deviceSubclass = Device::Subclass::NONE )
202 return Integration::KeyEvent( keyName,
214 * Helper to generate PanGestureEvent
216 * @param[in] application Application instance
217 * @param[in] state The Gesture State
218 * @param[in] pos The current position of touch.
220 static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos)
224 if( (state == Gesture::Started) ||
225 (state == Gesture::Possible) )
231 application.ProcessEvent( GeneratePan( state, last, pos, 16 ) );
238 * Simulate time passed by.
240 * @note this will always process at least 1 frame (1/60 sec)
242 * @param application Test application instance
243 * @param duration Time to pass in milliseconds.
244 * @return The actual time passed in milliseconds
246 static int Wait(ToolkitTestApplication& application, int duration = 0)
250 for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
252 application.SendNotification();
253 application.Render(RENDER_FRAME_INTERVAL);
254 time += RENDER_FRAME_INTERVAL;
260 Dali::Integration::Point GetPointDownInside( Vector2& pos )
262 Dali::Integration::Point point;
263 point.SetState( PointState::DOWN );
264 point.SetScreenPosition( pos );
268 Dali::Integration::Point GetPointUpInside( Vector2& pos )
270 Dali::Integration::Point point;
271 point.SetState( PointState::UP );
272 point.SetScreenPosition( pos );
276 bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet )
278 if( fontStyleMapGet.Count() == fontStyleMapSet.Count() )
280 for( unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index )
282 const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue( index );
284 Property::Value* valueSet = NULL;
285 if ( valueGet.first.type == Property::Key::INDEX )
287 valueSet = fontStyleMapSet.Find( valueGet.first.indexKey );
291 // Get Key is a string so searching Set Map for a string key
292 valueSet = fontStyleMapSet.Find( valueGet.first.stringKey );
295 if( NULL != valueSet )
297 if( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() )
299 tet_printf( " Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
305 if ( valueGet.first.type == Property::Key::INDEX )
307 tet_printf( " The key %d doesn't exist.", valueGet.first.indexKey );
311 tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
321 class ScrollStateChangeCallback : public Dali::ConnectionTracker
324 ScrollStateChangeCallback(bool& startedCalled, bool& finishedCalled)
325 : mStartedCalled( startedCalled ),
326 mFinishedCalled( finishedCalled )
330 void Callback( TextEditor editor, TextEditor::Scroll::Type type )
332 if( type == TextEditor::Scroll::STARTED )
334 mStartedCalled = true;
336 else if( type == TextEditor::Scroll::FINISHED )
338 mFinishedCalled = true;
342 bool& mStartedCalled;
343 bool& mFinishedCalled;
348 int UtcDaliToolkitTextEditorConstructorP(void)
350 ToolkitTestApplication application;
351 tet_infoline(" UtcDaliToolkitTextEditorConstructorP");
352 TextEditor textEditor;
353 DALI_TEST_CHECK( !textEditor );
357 int UtcDaliToolkitTextEditorNewP(void)
359 ToolkitTestApplication application;
360 tet_infoline(" UtcDaliToolkitTextEditorNewP");
361 TextEditor textEditor = TextEditor::New();
362 DALI_TEST_CHECK( textEditor );
366 int UtcDaliToolkitTextEditorDownCastP(void)
368 ToolkitTestApplication application;
369 tet_infoline(" UtcDaliToolkitTextEditorDownCastP");
370 TextEditor textEditor1 = TextEditor::New();
371 BaseHandle object( textEditor1 );
373 TextEditor textEditor2 = TextEditor::DownCast( object );
374 DALI_TEST_CHECK( textEditor2 );
376 TextEditor textEditor3 = DownCast< TextEditor >( object );
377 DALI_TEST_CHECK( textEditor3 );
381 int UtcDaliToolkitTextEditorDownCastN(void)
383 ToolkitTestApplication application;
384 tet_infoline(" UtcDaliToolkitTextEditorDownCastN");
385 BaseHandle uninitializedObject;
386 TextEditor textEditor1 = TextEditor::DownCast( uninitializedObject );
387 DALI_TEST_CHECK( !textEditor1 );
389 TextEditor textEditor2 = DownCast< TextEditor >( uninitializedObject );
390 DALI_TEST_CHECK( !textEditor2 );
394 int UtcDaliToolkitTextEditorCopyConstructorP(void)
396 ToolkitTestApplication application;
397 tet_infoline(" UtcDaliToolkitTextEditorCopyConstructorP");
398 TextEditor textEditor = TextEditor::New();
399 textEditor.SetProperty( TextEditor::Property::TEXT, "Test" );
401 TextEditor copy( textEditor );
402 DALI_TEST_CHECK( copy );
403 DALI_TEST_CHECK( copy.GetProperty<std::string>( TextEditor::Property::TEXT ) == textEditor.GetProperty<std::string>( TextEditor::Property::TEXT ) );
407 int UtcDaliToolkitTextEditorAssignmentOperatorP(void)
409 ToolkitTestApplication application;
410 tet_infoline(" UtcDaliToolkitTextEditorAssignmentOperatorP");
411 TextEditor textEditor = TextEditor::New();
412 textEditor.SetProperty( TextEditor::Property::TEXT, "Test" );
414 TextEditor copy = textEditor;
415 DALI_TEST_CHECK( copy );
416 DALI_TEST_CHECK( copy.GetProperty<std::string>( TextEditor::Property::TEXT ) == textEditor.GetProperty<std::string>( TextEditor::Property::TEXT ) );
420 int UtcDaliTextEditorNewP(void)
422 ToolkitTestApplication application;
423 tet_infoline(" UtcDaliToolkitTextEditorNewP");
424 TextEditor textEditor = TextEditor::New();
425 DALI_TEST_CHECK( textEditor );
429 // Positive test case for a method
430 int UtcDaliTextEditorGetPropertyP(void)
432 ToolkitTestApplication application;
433 tet_infoline(" UtcDaliToolkitTextEditorGetPropertyP");
434 TextEditor editor = TextEditor::New();
435 DALI_TEST_CHECK( editor );
437 // Check Property Indices are correct
438 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_RENDERING_BACKEND ) == TextEditor::Property::RENDERING_BACKEND );
439 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_TEXT ) == TextEditor::Property::TEXT );
440 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_TEXT_COLOR ) == TextEditor::Property::TEXT_COLOR );
441 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_FONT_FAMILY ) == TextEditor::Property::FONT_FAMILY );
442 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_FONT_STYLE ) == TextEditor::Property::FONT_STYLE );
443 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_POINT_SIZE ) == TextEditor::Property::POINT_SIZE );
444 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_HORIZONTAL_ALIGNMENT ) == TextEditor::Property::HORIZONTAL_ALIGNMENT );
445 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SCROLL_THRESHOLD ) == TextEditor::Property::SCROLL_THRESHOLD );
446 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SCROLL_SPEED ) == TextEditor::Property::SCROLL_SPEED );
447 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PRIMARY_CURSOR_COLOR ) == TextEditor::Property::PRIMARY_CURSOR_COLOR );
448 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SECONDARY_CURSOR_COLOR ) == TextEditor::Property::SECONDARY_CURSOR_COLOR );
449 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_CURSOR_BLINK ) == TextEditor::Property::ENABLE_CURSOR_BLINK );
450 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_CURSOR_BLINK_INTERVAL ) == TextEditor::Property::CURSOR_BLINK_INTERVAL );
451 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_CURSOR_BLINK_DURATION ) == TextEditor::Property::CURSOR_BLINK_DURATION );
452 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_CURSOR_WIDTH ) == TextEditor::Property::CURSOR_WIDTH );
453 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_GRAB_HANDLE_IMAGE ) == TextEditor::Property::GRAB_HANDLE_IMAGE );
454 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_GRAB_HANDLE_PRESSED_IMAGE ) == TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE );
455 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_IMAGE_LEFT ) == TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT );
456 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_IMAGE_RIGHT ) == TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT );
457 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_LEFT ) == TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT );
458 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT ) == TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT );
459 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_LEFT ) == TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT );
460 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SELECTION_HANDLE_MARKER_IMAGE_RIGHT ) == TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT );
461 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SELECTION_HIGHLIGHT_COLOR ) == TextEditor::Property::SELECTION_HIGHLIGHT_COLOR );
462 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_DECORATION_BOUNDING_BOX ) == TextEditor::Property::DECORATION_BOUNDING_BOX );
463 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_MARKUP ) == TextEditor::Property::ENABLE_MARKUP );
464 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_COLOR ) == TextEditor::Property::INPUT_COLOR );
465 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_FONT_FAMILY ) == TextEditor::Property::INPUT_FONT_FAMILY );
466 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_FONT_STYLE ) == TextEditor::Property::INPUT_FONT_STYLE );
467 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_POINT_SIZE ) == TextEditor::Property::INPUT_POINT_SIZE );
469 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_LINE_SPACING ) == TextEditor::Property::LINE_SPACING );
470 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_LINE_SPACING ) == TextEditor::Property::INPUT_LINE_SPACING );
471 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_UNDERLINE ) == TextEditor::Property::UNDERLINE );
472 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_UNDERLINE ) == TextEditor::Property::INPUT_UNDERLINE );
473 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SHADOW ) == TextEditor::Property::SHADOW );
474 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_SHADOW ) == TextEditor::Property::INPUT_SHADOW );
475 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_EMBOSS ) == TextEditor::Property::EMBOSS );
476 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_EMBOSS ) == TextEditor::Property::INPUT_EMBOSS );
477 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextEditor::Property::OUTLINE );
478 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_OUTLINE ) == TextEditor::Property::INPUT_OUTLINE );
479 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SMOOTH_SCROLL ) == TextEditor::Property::SMOOTH_SCROLL );
480 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SMOOTH_SCROLL_DURATION ) == TextEditor::Property::SMOOTH_SCROLL_DURATION );
481 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_SCROLL_BAR ) == TextEditor::Property::ENABLE_SCROLL_BAR );
482 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SCROLL_BAR_SHOW_DURATION ) == TextEditor::Property::SCROLL_BAR_SHOW_DURATION );
483 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SCROLL_BAR_FADE_DURATION ) == TextEditor::Property::SCROLL_BAR_FADE_DURATION );
484 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PIXEL_SIZE ) == TextEditor::Property::PIXEL_SIZE );
485 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_LINE_COUNT) == TextEditor::Property::LINE_COUNT );
486 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_SELECTION ) == TextEditor::Property::ENABLE_SELECTION );
487 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER ) == TextEditor::Property::PLACEHOLDER );
488 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT ) == DevelTextEditor::Property::PLACEHOLDER_TEXT );
489 DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR ) == DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR );
494 bool SetPropertyMapRetrieved( TextEditor& editor, const Property::Index property, const std::string mapKey, const std::string mapValue )
497 Property::Map imageMap;
498 imageMap[mapKey] =mapValue;
500 editor.SetProperty( property , imageMap );
501 Property::Value propValue = editor.GetProperty( property );
502 Property::Map* resultMap = propValue.GetMap();
504 if ( resultMap->Find( mapKey )->Get< std::string>() == mapValue )
512 // Positive test case for a method
513 int UtcDaliTextEditorSetPropertyP(void)
515 ToolkitTestApplication application;
516 tet_infoline(" UtcDaliToolkitTextEditorSetPropertyP");
517 TextEditor editor = TextEditor::New();
518 DALI_TEST_CHECK( editor );
519 Stage::GetCurrent().Add( editor );
521 // Note - we can't check the defaults since the stylesheets are platform-specific
523 // Check the render backend property.
524 editor.SetProperty( TextEditor::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
525 DALI_TEST_EQUALS( (Text::RenderingType)editor.GetProperty<int>( TextEditor::Property::RENDERING_BACKEND ), Text::RENDERING_SHARED_ATLAS, TEST_LOCATION );
527 // Check text property.
528 editor.SetProperty( TextEditor::Property::TEXT, "Setting Text" );
529 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string("Setting Text"), TEST_LOCATION );
531 // Check text's color property
532 editor.SetProperty( TextEditor::Property::TEXT_COLOR, Color::WHITE );
533 DALI_TEST_EQUALS( editor.GetProperty<Vector4>( TextEditor::Property::TEXT_COLOR ), Color::WHITE, TEST_LOCATION );
535 // Check font properties.
536 editor.SetProperty( TextEditor::Property::FONT_FAMILY, "Setting font family" );
537 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
539 Property::Map fontStyleMapSet;
540 Property::Map fontStyleMapGet;
541 Property::Value* slantValue = NULL;
543 fontStyleMapSet.Insert( "weight", "bold" );
544 fontStyleMapSet.Insert( "width", "condensed" );
545 fontStyleMapSet.Insert( "slant", "italic" );
547 editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet );
548 fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::FONT_STYLE );
549 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
550 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
552 editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
553 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
556 fontStyleMapSet.Clear();
557 fontStyleMapSet.Insert( "weight", "normal" );
558 fontStyleMapSet.Insert( "slant", "oblique" );
559 editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet );
560 fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::FONT_STYLE );
561 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
562 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
564 fontStyleMapSet.Clear();
565 fontStyleMapSet.Insert( "slant", "roman" );
566 editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet );
567 fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::FONT_STYLE );
569 // Replace 'roman' for 'normal'.
570 slantValue = fontStyleMapGet.Find( "slant" );
571 if( NULL != slantValue )
573 if( "normal" == slantValue->Get<std::string>() )
575 fontStyleMapGet["slant"] = "roman";
578 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
579 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
581 fontStyleMapSet.Clear();
583 editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet );
584 fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::FONT_STYLE );
585 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
586 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
588 // Check that the Alignment properties can be correctly set
589 editor.SetProperty( TextEditor::Property::HORIZONTAL_ALIGNMENT, "END" );
590 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::HORIZONTAL_ALIGNMENT ), "END", TEST_LOCATION );
592 // Check scroll properties.
593 editor.SetProperty( TextEditor::Property::SCROLL_THRESHOLD, 1.f );
594 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::SCROLL_THRESHOLD ), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
595 editor.SetProperty( TextEditor::Property::SCROLL_SPEED, 100.f );
596 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::SCROLL_SPEED ), 100.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
598 // Check cursor properties
599 editor.SetProperty( TextEditor::Property::PRIMARY_CURSOR_COLOR, Color::RED );
600 DALI_TEST_EQUALS( editor.GetProperty<Vector4>( TextEditor::Property::PRIMARY_CURSOR_COLOR ), Color::RED, TEST_LOCATION );
601 editor.SetProperty( TextEditor::Property::SECONDARY_CURSOR_COLOR, Color::BLUE );
602 DALI_TEST_EQUALS( editor.GetProperty<Vector4>( TextEditor::Property::SECONDARY_CURSOR_COLOR ), Color::BLUE, TEST_LOCATION );
604 editor.SetProperty( TextEditor::Property::ENABLE_CURSOR_BLINK, false );
605 DALI_TEST_EQUALS( editor.GetProperty<bool>( TextEditor::Property::ENABLE_CURSOR_BLINK ), false, TEST_LOCATION );
606 editor.SetProperty( TextEditor::Property::CURSOR_BLINK_INTERVAL, 1.f );
607 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::CURSOR_BLINK_INTERVAL ), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
608 editor.SetProperty( TextEditor::Property::CURSOR_BLINK_DURATION, 10.f );
609 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::CURSOR_BLINK_DURATION ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
610 editor.SetProperty( TextEditor::Property::CURSOR_WIDTH, 1 );
611 DALI_TEST_EQUALS( editor.GetProperty<int>( TextEditor::Property::CURSOR_WIDTH ), 1, TEST_LOCATION );
613 // Check handle images
614 editor.SetProperty( TextEditor::Property::GRAB_HANDLE_IMAGE, "image1" );
615 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::GRAB_HANDLE_IMAGE ), "image1", TEST_LOCATION );
616 editor.SetProperty( TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE, "image2" );
617 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE ), "image2", TEST_LOCATION );
618 editor.SetProperty( TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, "image3" );
620 // Check handle images
621 DALI_TEST_CHECK( SetPropertyMapRetrieved( editor, TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT, "filename", "leftHandleImage" ) );
622 DALI_TEST_CHECK( SetPropertyMapRetrieved( editor, TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT, "filename", "rightHandleImage" ) );
623 DALI_TEST_CHECK( SetPropertyMapRetrieved( editor, TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT, "filename", "leftHandleImagePressed" ) );
624 DALI_TEST_CHECK( SetPropertyMapRetrieved( editor, TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, "filename", "rightHandleImagePressed" ) );
625 DALI_TEST_CHECK( SetPropertyMapRetrieved( editor, TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT, "filename", "leftHandleMarkerImage" ) );
626 DALI_TEST_CHECK( SetPropertyMapRetrieved( editor, TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT, "filename", "rightHandleMarkerImage" ) );
628 // Check the highlight color
629 editor.SetProperty( TextEditor::Property::SELECTION_HIGHLIGHT_COLOR, Color::GREEN );
630 DALI_TEST_EQUALS( editor.GetProperty<Vector4>( TextEditor::Property::SELECTION_HIGHLIGHT_COLOR ), Color::GREEN, TEST_LOCATION );
632 // Decoration bounding box
633 editor.SetProperty( TextEditor::Property::DECORATION_BOUNDING_BOX, Rect<int>( 0, 0, 1, 1 ) );
634 DALI_TEST_EQUALS( editor.GetProperty<Rect <int > >( TextEditor::Property::DECORATION_BOUNDING_BOX ), Rect<int>( 0, 0, 1, 1 ), TEST_LOCATION );
636 // Check the enable markup property.
637 DALI_TEST_CHECK( !editor.GetProperty<bool>( TextEditor::Property::ENABLE_MARKUP ) );
638 editor.SetProperty( TextEditor::Property::ENABLE_MARKUP, true );
639 DALI_TEST_CHECK( editor.GetProperty<bool>( TextEditor::Property::ENABLE_MARKUP ) );
641 // Check input color property.
642 editor.SetProperty( TextEditor::Property::INPUT_COLOR, Color::YELLOW );
643 DALI_TEST_EQUALS( editor.GetProperty<Vector4>( TextEditor::Property::INPUT_COLOR ), Color::YELLOW, TEST_LOCATION );
645 // Check input font properties.
646 editor.SetProperty( TextEditor::Property::INPUT_FONT_FAMILY, "Setting input font family" );
647 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_FAMILY ), "Setting input font family", TEST_LOCATION );
649 fontStyleMapSet.Clear();
650 fontStyleMapSet.Insert( "weight", "bold" );
651 fontStyleMapSet.Insert( "width", "condensed" );
652 fontStyleMapSet.Insert( "slant", "italic" );
654 editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet );
655 fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
656 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
657 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
659 editor.SetProperty( TextEditor::Property::INPUT_POINT_SIZE, 12.f );
660 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::INPUT_POINT_SIZE ), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
662 // Reset input font style.
663 fontStyleMapSet.Clear();
664 fontStyleMapSet.Insert( "weight", "normal" );
665 fontStyleMapSet.Insert( "slant", "oblique" );
667 editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet );
668 fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
669 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
670 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
672 fontStyleMapSet.Clear();
673 fontStyleMapSet.Insert( "slant", "roman" );
675 editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet );
676 fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
678 // Replace 'roman' for 'normal'.
679 slantValue = fontStyleMapGet.Find( "slant" );
680 if( NULL != slantValue )
682 if( "normal" == slantValue->Get<std::string>() )
684 fontStyleMapGet["slant"] = "roman";
687 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
688 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
690 fontStyleMapSet.Clear();
692 editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet );
693 fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
694 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
695 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
697 // Check the line spacing property
698 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
699 editor.SetProperty( TextEditor::Property::LINE_SPACING, 10.f );
700 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::LINE_SPACING ), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
702 // Check the input line spacing property
703 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::INPUT_LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
704 editor.SetProperty( TextEditor::Property::INPUT_LINE_SPACING, 20.f );
705 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::INPUT_LINE_SPACING ), 20.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
707 // Check the underline property
709 Property::Map underlineMapSet;
710 Property::Map underlineMapGet;
712 underlineMapSet.Insert( "enable", "true" );
713 underlineMapSet.Insert( "color", "red" );
714 underlineMapSet.Insert( "height", "1" );
716 editor.SetProperty( TextEditor::Property::UNDERLINE, underlineMapSet );
718 underlineMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::UNDERLINE );
719 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
720 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
722 // Check the input underline property
723 editor.SetProperty( TextEditor::Property::INPUT_UNDERLINE, "Underline input properties" );
724 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_UNDERLINE ), std::string("Underline input properties"), TEST_LOCATION );
726 // Check the shadow property
727 Property::Map shadowMapSet;
728 Property::Map shadowMapGet;
730 shadowMapSet.Insert( "color", "green" );
731 shadowMapSet.Insert( "offset", "2 2" );
733 editor.SetProperty( TextEditor::Property::SHADOW, shadowMapSet );
735 shadowMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::SHADOW );
736 DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
737 DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet ), true, TEST_LOCATION );
739 // Check the input shadow property
740 editor.SetProperty( TextEditor::Property::INPUT_SHADOW, "Shadow input properties" );
741 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_SHADOW ), std::string("Shadow input properties"), TEST_LOCATION );
743 // Check the emboss property
744 editor.SetProperty( TextEditor::Property::EMBOSS, "Emboss properties" );
745 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::EMBOSS ), std::string("Emboss properties"), TEST_LOCATION );
747 // Check the input emboss property
748 editor.SetProperty( TextEditor::Property::INPUT_EMBOSS, "Emboss input properties" );
749 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_EMBOSS ), std::string("Emboss input properties"), TEST_LOCATION );
751 // Check the outline property
753 // Test string type first
754 // This is purely to maintain backward compatibility, but we don't support string as the outline property type.
755 editor.SetProperty( TextEditor::Property::OUTLINE, "Outline properties" );
756 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::OUTLINE ), std::string("Outline properties"), TEST_LOCATION );
758 // Then test the property map type
759 Property::Map outlineMapSet;
760 Property::Map outlineMapGet;
762 outlineMapSet["color"] = Color::RED;
763 outlineMapSet["width"] = 2.0f;
765 editor.SetProperty( TextEditor::Property::OUTLINE, outlineMapSet );
767 outlineMapSet["color"] = "red";
768 outlineMapSet["width"] = "2";
769 outlineMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::OUTLINE );
770 DALI_TEST_EQUALS( outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION );
771 DALI_TEST_EQUALS( DaliTestCheckMaps( outlineMapGet, outlineMapSet ), true, TEST_LOCATION );
773 // Check the input outline property
774 editor.SetProperty( TextEditor::Property::INPUT_OUTLINE, "Outline input properties" );
775 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_OUTLINE ), std::string("Outline input properties"), TEST_LOCATION );
777 // Check the smooth scroll property
778 DALI_TEST_EQUALS( editor.GetProperty<bool>( TextEditor::Property::SMOOTH_SCROLL ), false, TEST_LOCATION );
779 editor.SetProperty( TextEditor::Property::SMOOTH_SCROLL, true );
780 DALI_TEST_EQUALS( editor.GetProperty<bool>( TextEditor::Property::SMOOTH_SCROLL ), true, TEST_LOCATION );
782 // Check the smooth scroll duration property
783 editor.SetProperty( TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.2f );
784 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::SMOOTH_SCROLL_DURATION ), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
786 // Check the scroll bar property
787 DALI_TEST_EQUALS( editor.GetProperty<bool>( TextEditor::Property::ENABLE_SCROLL_BAR ), false, TEST_LOCATION );
788 editor.SetProperty( TextEditor::Property::ENABLE_SCROLL_BAR, true );
789 DALI_TEST_EQUALS( editor.GetProperty<bool>( TextEditor::Property::ENABLE_SCROLL_BAR ), true, TEST_LOCATION );
791 editor.SetProperty( TextEditor::Property::SCROLL_BAR_SHOW_DURATION, 0.3f );
792 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::SCROLL_BAR_SHOW_DURATION ), 0.3f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
793 editor.SetProperty( TextEditor::Property::SCROLL_BAR_FADE_DURATION, 0.2f );
794 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::SCROLL_BAR_FADE_DURATION ), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
796 // Check the pixel size of font
797 editor.SetProperty( TextEditor::Property::PIXEL_SIZE, 20.f );
798 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::PIXEL_SIZE ), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
800 // Check placeholder text properties.
801 editor.SetProperty( DevelTextEditor::Property::PLACEHOLDER_TEXT, "Setting Placeholder Text" );
802 DALI_TEST_EQUALS( editor.GetProperty<std::string>( DevelTextEditor::Property::PLACEHOLDER_TEXT ), std::string("Setting Placeholder Text"), TEST_LOCATION );
804 // Check placeholder text's color property.
805 editor.SetProperty( DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR, Color::RED );
806 DALI_TEST_EQUALS( editor.GetProperty<Vector4>( DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR ), Color::RED, TEST_LOCATION );
808 // Check the enable selection property
809 editor.SetProperty( TextEditor::Property::ENABLE_SELECTION, false );
810 DALI_TEST_EQUALS( editor.GetProperty<bool>( TextEditor::Property::ENABLE_SELECTION ), false, TEST_LOCATION );
812 // Check the placeholder property with pixel size
813 Property::Map placeholderPixelSizeMapSet;
814 Property::Map placeholderPixelSizeMapGet;
815 Property::Map placeholderFontstyleMap;
816 placeholderPixelSizeMapSet["text"] = "Setting Placeholder Text";
817 placeholderPixelSizeMapSet["textFocused"] = "Setting Placeholder Text Focused";
818 placeholderPixelSizeMapSet["color"] = Color::BLUE;
819 placeholderPixelSizeMapSet["fontFamily"] = "Arial";
820 placeholderPixelSizeMapSet["pixelSize"] = 15.0f;
822 placeholderFontstyleMap.Insert( "weight", "bold" );
823 placeholderPixelSizeMapSet["fontStyle"] = placeholderFontstyleMap;
824 editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderPixelSizeMapSet );
826 placeholderPixelSizeMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::PLACEHOLDER );
827 DALI_TEST_EQUALS( placeholderPixelSizeMapGet.Count(), placeholderPixelSizeMapSet.Count(), TEST_LOCATION );
829 tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value");
830 Property::Map placeholderConversionMap;
831 placeholderConversionMap[ Text::PlaceHolder::Property::TEXT ] = placeholderPixelSizeMapSet["text"];
832 placeholderConversionMap[ Text::PlaceHolder::Property::TEXT_FOCUSED ] = placeholderPixelSizeMapSet["textFocused"] ;
833 placeholderConversionMap[ Text::PlaceHolder::Property::COLOR ] = placeholderPixelSizeMapSet["color"];
834 placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderPixelSizeMapSet["fontStyle"];
835 placeholderConversionMap[ Text::PlaceHolder::Property::FONT_FAMILY ] = placeholderPixelSizeMapSet["fontFamily"];
836 placeholderConversionMap[ Text::PlaceHolder::Property::PIXEL_SIZE ] = placeholderPixelSizeMapSet["pixelSize"];
838 DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderPixelSizeMapGet, placeholderConversionMap ), true, TEST_LOCATION );
840 // Check the placeholder property with point size
841 Property::Map placeholderMapSet;
842 Property::Map placeholderMapGet;
843 placeholderMapSet["text"] = "Setting Placeholder Text";
844 placeholderMapSet["textFocused"] = "Setting Placeholder Text Focused";
845 placeholderMapSet["color"] = Color::RED;
846 placeholderMapSet["fontFamily"] = "Arial";
847 placeholderMapSet["pointSize"] = 12.0f;
848 // Check the placeholder font style property
849 placeholderFontstyleMap.Clear();
851 placeholderFontstyleMap.Insert( "weight", "bold" );
852 placeholderFontstyleMap.Insert( "width", "condensed" );
853 placeholderFontstyleMap.Insert( "slant", "italic" );
854 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
855 editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet );
857 placeholderMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::PLACEHOLDER );
858 DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION );
860 tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value");
861 placeholderConversionMap.Clear();
862 placeholderConversionMap[ Text::PlaceHolder::Property::TEXT ] = placeholderMapSet["text"];
863 placeholderConversionMap[ Text::PlaceHolder::Property::TEXT_FOCUSED ] = placeholderMapSet["textFocused"] ;
864 placeholderConversionMap[ Text::PlaceHolder::Property::COLOR ] = placeholderMapSet["color"];
865 placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderPixelSizeMapSet["fontStyle"];
866 placeholderConversionMap[ Text::PlaceHolder::Property::FONT_FAMILY ] = placeholderMapSet["fontFamily"];
867 placeholderConversionMap[ Text::PlaceHolder::Property::POINT_SIZE ] = placeholderMapSet["pointSize"];
868 DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderConversionMap ), true, TEST_LOCATION );
871 placeholderFontstyleMap.Clear();
872 placeholderFontstyleMap.Insert( "weight", "normal" );
873 placeholderFontstyleMap.Insert( "slant", "oblique" );
874 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
875 editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet );
877 placeholderMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::PLACEHOLDER );
878 DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION );
879 placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderMapSet["fontStyle"];
880 DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderConversionMap ), true, TEST_LOCATION );
882 placeholderFontstyleMap.Clear();
883 placeholderFontstyleMap.Insert( "slant", "roman" );
884 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
885 editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet );
887 placeholderMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::PLACEHOLDER );
889 placeholderFontstyleMap.Clear();
890 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
892 editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet );
893 placeholderMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::PLACEHOLDER );
894 DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION );
895 placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderMapSet["fontStyle"];
896 DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderConversionMap ), true, TEST_LOCATION );
901 // Positive Atlas Text Renderer test
902 int utcDaliTextEditorAtlasRenderP(void)
904 ToolkitTestApplication application;
905 tet_infoline(" UtcDaliToolkitTextEditorAtlasRenderP");
906 StyleManager styleManager = StyleManager::Get();
907 styleManager.ApplyDefaultTheme();
908 TextEditor editor = TextEditor::New();
909 DALI_TEST_CHECK( editor );
911 editor.SetProperty( TextEditor::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
913 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
915 Stage::GetCurrent().Add( editor );
919 // Render some text with the shared atlas backend
920 editor.SetProperty( TextEditor::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
921 application.SendNotification();
922 application.Render();
926 tet_result(TET_FAIL);
931 // Positive test for the textChanged signal.
932 int utcDaliTextEditorTextChangedP(void)
934 ToolkitTestApplication application;
935 tet_infoline(" utcDaliTextEditorTextChangedP");
936 TextEditor editor = TextEditor::New();
937 DALI_TEST_CHECK( editor );
939 Stage::GetCurrent().Add( editor );
941 // connect to the text changed signal.
942 ConnectionTracker* testTracker = new ConnectionTracker();
943 editor.TextChangedSignal().Connect( &TestTextChangedCallback );
944 bool textChangedSignal = false;
945 editor.ConnectSignal( testTracker, "textChanged", CallbackFunctor(&textChangedSignal) );
947 gTextChangedCallBackCalled = false;
948 editor.SetProperty( TextEditor::Property::TEXT, "ABC" );
949 DALI_TEST_CHECK( gTextChangedCallBackCalled );
950 DALI_TEST_CHECK( textChangedSignal );
952 application.SendNotification();
954 editor.SetKeyInputFocus();
956 gTextChangedCallBackCalled = false;
957 application.ProcessEvent( GenerateKey( "D", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
958 DALI_TEST_CHECK( gTextChangedCallBackCalled );
963 int utcDaliTextEditorInputStyleChanged01(void)
965 ToolkitTestApplication application;
966 tet_infoline(" utcDaliTextEditorInputStyleChanged01");
968 // The text-editor emits signals when the input style changes. These changes of style are
969 // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
970 // can't be emitted during the size negotiation as the callbacks may update the UI.
971 // The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
972 // This creates an implementation of the adaptor stub and a queue of idle callbacks.
973 application.CreateAdaptor();
977 char* pathNamePtr = get_current_dir_name();
978 const std::string pathName( pathNamePtr );
981 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
982 fontClient.SetDpi( 93u, 93u );
984 fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE );
985 fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE );
987 TextEditor editor = TextEditor::New();
988 DALI_TEST_CHECK( editor );
991 editor.SetSize( 300.f, 50.f );
992 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
993 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
995 editor.SetProperty( TextEditor::Property::ENABLE_MARKUP, true );
996 editor.SetProperty( TextEditor::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='green'>llo</color> <font weight='bold'>world</font> demo</font>" );
998 // connect to the text changed signal.
999 ConnectionTracker* testTracker = new ConnectionTracker();
1000 editor.InputStyleChangedSignal().Connect( &TestInputStyleChangedCallback );
1001 bool inputStyleChangedSignal = false;
1002 editor.ConnectSignal( testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal) );
1004 Stage::GetCurrent().Add( editor );
1006 // Render and notify
1007 application.SendNotification();
1008 application.Render();
1010 // Executes the idle callbacks added by the text control on the change of input style.
1011 application.RunIdles();
1013 gInputStyleChangedCallbackCalled = false;
1014 gInputStyleMask = TextEditor::InputStyle::NONE;
1015 inputStyleChangedSignal = false;
1017 // Create a tap event to touch the text editor.
1018 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 18.f, 25.f ) ) );
1019 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 18.f, 25.f ) ) );
1021 // Render and notify
1022 application.SendNotification();
1023 application.Render();
1025 // Executes the idle callbacks added by the text control on the change of input style.
1026 application.RunIdles();
1028 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1029 if( gInputStyleChangedCallbackCalled )
1031 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextEditor::InputStyle::FONT_FAMILY | TextEditor::InputStyle::POINT_SIZE ), TEST_LOCATION );
1033 const std::string fontFamily = editor.GetProperty( TextEditor::Property::INPUT_FONT_FAMILY ).Get<std::string>();
1034 DALI_TEST_EQUALS( fontFamily, "DejaVuSerif", TEST_LOCATION );
1036 const float pointSize = editor.GetProperty( TextEditor::Property::INPUT_POINT_SIZE ).Get<float>();
1037 DALI_TEST_EQUALS( pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1039 DALI_TEST_CHECK( inputStyleChangedSignal );
1041 gInputStyleChangedCallbackCalled = false;
1042 gInputStyleMask = TextEditor::InputStyle::NONE;
1043 inputStyleChangedSignal = false;
1045 // Create a tap event to touch the text editor.
1046 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 30.f, 25.f ) ) );
1047 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 30.f, 25.f ) ) );
1049 // Render and notify
1050 application.SendNotification();
1051 application.Render();
1053 // Executes the idle callbacks added by the text control on the change of input style.
1054 application.RunIdles();
1056 DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
1057 DALI_TEST_CHECK( !inputStyleChangedSignal );
1059 gInputStyleChangedCallbackCalled = false;
1060 gInputStyleMask = TextEditor::InputStyle::NONE;
1061 inputStyleChangedSignal = false;
1063 // Create a tap event to touch the text editor.
1064 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 43.f, 25.f ) ) );
1065 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 43.f, 25.f ) ) );
1067 // Render and notify
1068 application.SendNotification();
1069 application.Render();
1071 // Executes the idle callbacks added by the text control on the change of input style.
1072 application.RunIdles();
1074 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1075 if( gInputStyleChangedCallbackCalled )
1077 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextEditor::InputStyle::COLOR ), TEST_LOCATION );
1079 const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
1080 DALI_TEST_EQUALS( color, Color::GREEN, TEST_LOCATION );
1082 DALI_TEST_CHECK( inputStyleChangedSignal );
1084 gInputStyleChangedCallbackCalled = false;
1085 gInputStyleMask = TextEditor::InputStyle::NONE;
1086 inputStyleChangedSignal = false;
1088 // Create a tap event to touch the text editor.
1089 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 88.f, 25.f ) ) );
1090 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 88.f, 25.f ) ) );
1092 // Render and notify
1093 application.SendNotification();
1094 application.Render();
1096 // Executes the idle callbacks added by the text control on the change of input style.
1097 application.RunIdles();
1099 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1100 if( gInputStyleChangedCallbackCalled )
1102 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextEditor::InputStyle::COLOR | TextEditor::InputStyle::FONT_STYLE ), TEST_LOCATION );
1104 const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
1105 DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
1107 Property::Map fontStyleMapSet;
1108 Property::Map fontStyleMapGet;
1110 fontStyleMapSet.Insert( "weight", "bold" );
1112 fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
1113 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
1114 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
1116 DALI_TEST_CHECK( inputStyleChangedSignal );
1118 gInputStyleChangedCallbackCalled = false;
1119 gInputStyleMask = TextEditor::InputStyle::NONE;
1120 inputStyleChangedSignal = false;
1122 // Create a tap event to touch the text editor.
1123 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 115.f, 25.f ) ) );
1124 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 115.f, 25.f ) ) );
1126 // Render and notify
1127 application.SendNotification();
1128 application.Render();
1130 // Executes the idle callbacks added by the text control on the change of input style.
1131 application.RunIdles();
1133 DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
1134 DALI_TEST_CHECK( !inputStyleChangedSignal );
1136 gInputStyleChangedCallbackCalled = false;
1137 gInputStyleMask = TextEditor::InputStyle::NONE;
1138 inputStyleChangedSignal = false;
1140 // Create a tap event to touch the text editor.
1141 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 164.f, 25.f ) ) );
1142 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 164.f, 25.f ) ) );
1144 // Render and notify
1145 application.SendNotification();
1146 application.Render();
1148 // Executes the idle callbacks added by the text control on the change of input style.
1149 application.RunIdles();
1151 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1152 if( gInputStyleChangedCallbackCalled )
1154 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextEditor::InputStyle::FONT_STYLE ), TEST_LOCATION );
1156 Property::Map fontStyleMapSet;
1157 Property::Map fontStyleMapGet;
1159 fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
1160 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
1161 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
1163 DALI_TEST_CHECK( inputStyleChangedSignal );
1165 gInputStyleChangedCallbackCalled = false;
1166 gInputStyleMask = TextEditor::InputStyle::NONE;
1167 inputStyleChangedSignal = false;
1169 // Create a tap event to touch the text editor.
1170 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 191.f, 25.f ) ) );
1171 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 191.f, 25.f ) ) );
1173 // Render and notify
1174 application.SendNotification();
1175 application.Render();
1177 // Executes the idle callbacks added by the text control on the change of input style.
1178 application.RunIdles();
1180 DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
1181 DALI_TEST_CHECK( !inputStyleChangedSignal );
1186 int utcDaliTextEditorInputStyleChanged02(void)
1188 ToolkitTestApplication application;
1189 tet_infoline(" utcDaliTextEditorInputStyleChanged02");
1191 // The text-editor emits signals when the input style changes. These changes of style are
1192 // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
1193 // can't be emitted during the size negotiation as the callbacks may update the UI.
1194 // The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
1195 // This creates an implementation of the adaptor stub and a queue of idle callbacks.
1196 application.CreateAdaptor();
1200 char* pathNamePtr = get_current_dir_name();
1201 const std::string pathName( pathNamePtr );
1202 free( pathNamePtr );
1204 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1205 fontClient.SetDpi( 93u, 93u );
1207 fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE );
1208 fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE );
1210 TextEditor editor = TextEditor::New();
1211 DALI_TEST_CHECK( editor );
1214 editor.SetSize( 300.f, 50.f );
1215 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
1216 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1218 editor.SetProperty( TextEditor::Property::ENABLE_MARKUP, true );
1219 editor.SetProperty( TextEditor::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='blue'> l</color><color value='green'>lo</color> <font weight='bold'>world</font> demo</font>" );
1221 // connect to the text changed signal.
1222 ConnectionTracker* testTracker = new ConnectionTracker();
1223 editor.InputStyleChangedSignal().Connect( &TestInputStyleChangedCallback );
1224 bool inputStyleChangedSignal = false;
1225 editor.ConnectSignal( testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal) );
1227 Stage::GetCurrent().Add( editor );
1229 // Render and notify
1230 application.SendNotification();
1231 application.Render();
1233 // Executes the idle callbacks added by the text control on the change of input style.
1234 application.RunIdles();
1236 gInputStyleChangedCallbackCalled = false;
1237 gInputStyleMask = TextEditor::InputStyle::NONE;
1238 inputStyleChangedSignal = false;
1240 // Create a tap event to touch the text editor.
1241 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 53.f, 25.f ) ) );
1242 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 53.f, 25.f ) ) );
1243 application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 53.f, 25.f ) ) );
1244 application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 53.f, 25.f ) ) );
1246 // Render and notify
1247 application.SendNotification();
1248 application.Render();
1250 // Executes the idle callbacks added by the text control on the change of input style.
1251 application.RunIdles();
1253 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1254 if( gInputStyleChangedCallbackCalled )
1256 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
1257 static_cast<unsigned int>( TextEditor::InputStyle::FONT_FAMILY |
1258 TextEditor::InputStyle::POINT_SIZE |
1259 TextEditor::InputStyle::COLOR ),
1262 const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
1263 DALI_TEST_EQUALS( color, Color::GREEN, TEST_LOCATION );
1265 const std::string fontFamily = editor.GetProperty( TextEditor::Property::INPUT_FONT_FAMILY ).Get<std::string>();
1266 DALI_TEST_EQUALS( fontFamily, "DejaVuSerif", TEST_LOCATION );
1268 const float pointSize = editor.GetProperty( TextEditor::Property::INPUT_POINT_SIZE ).Get<float>();
1269 DALI_TEST_EQUALS( pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1271 DALI_TEST_CHECK( inputStyleChangedSignal );
1273 gInputStyleChangedCallbackCalled = false;
1274 gInputStyleMask = TextEditor::InputStyle::NONE;
1275 inputStyleChangedSignal = false;
1277 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1279 // Render and notify
1280 application.SendNotification();
1281 application.Render();
1283 // Executes the idle callbacks added by the text control on the change of input style.
1284 application.RunIdles();
1286 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1287 if( gInputStyleChangedCallbackCalled )
1289 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
1290 static_cast<unsigned int>( TextEditor::InputStyle::COLOR ),
1293 const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
1294 DALI_TEST_EQUALS( color, Color::BLUE, TEST_LOCATION );
1296 DALI_TEST_CHECK( inputStyleChangedSignal );
1298 gInputStyleChangedCallbackCalled = false;
1299 gInputStyleMask = TextEditor::InputStyle::NONE;
1300 inputStyleChangedSignal = false;
1302 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1304 // Render and notify
1305 application.SendNotification();
1306 application.Render();
1308 // Executes the idle callbacks added by the text control on the change of input style.
1309 application.RunIdles();
1311 DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
1312 DALI_TEST_CHECK( !inputStyleChangedSignal );
1314 gInputStyleChangedCallbackCalled = false;
1315 gInputStyleMask = TextEditor::InputStyle::NONE;
1316 inputStyleChangedSignal = false;
1318 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1320 // Render and notify
1321 application.SendNotification();
1322 application.Render();
1324 // Executes the idle callbacks added by the text control on the change of input style.
1325 application.RunIdles();
1327 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1328 if( gInputStyleChangedCallbackCalled )
1330 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
1331 static_cast<unsigned int>( TextEditor::InputStyle::COLOR ),
1334 const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
1335 DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
1337 DALI_TEST_CHECK( inputStyleChangedSignal );
1339 gInputStyleChangedCallbackCalled = false;
1340 gInputStyleMask = TextEditor::InputStyle::NONE;
1341 inputStyleChangedSignal = false;
1343 editor.SetProperty( TextEditor::Property::INPUT_COLOR, Color::YELLOW );
1345 Property::Map fontStyleMapSet;
1346 fontStyleMapSet.Insert( "weight", "thin" );
1347 fontStyleMapSet.Insert( "width", "condensed" );
1348 fontStyleMapSet.Insert( "slant", "italic" );
1350 editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet );
1351 editor.SetProperty( TextEditor::Property::INPUT_POINT_SIZE, 20.f );
1352 editor.SetProperty( TextEditor::Property::INPUT_LINE_SPACING, 5.f );
1354 editor.SetProperty( TextEditor::Property::INPUT_UNDERLINE, "underline" );
1355 editor.SetProperty( TextEditor::Property::INPUT_SHADOW, "shadow" );
1356 editor.SetProperty( TextEditor::Property::INPUT_EMBOSS, "emboss" );
1357 editor.SetProperty( TextEditor::Property::INPUT_OUTLINE, "outline" );
1359 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1361 // Render and notify
1362 application.SendNotification();
1363 application.Render();
1365 // Executes the idle callbacks added by the text control on the change of input style.
1366 application.RunIdles();
1368 DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
1369 DALI_TEST_CHECK( !inputStyleChangedSignal );
1371 // Create a tap event to touch the text editor.
1372 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 63.f, 25.f ) ) );
1373 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 63.f, 25.f ) ) );
1375 // Render and notify
1376 application.SendNotification();
1377 application.Render();
1379 // Executes the idle callbacks added by the text control on the change of input style.
1380 application.RunIdles();
1382 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1383 if( gInputStyleChangedCallbackCalled )
1385 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
1386 static_cast<unsigned int>( TextEditor::InputStyle::COLOR |
1387 TextEditor::InputStyle::POINT_SIZE |
1388 TextEditor::InputStyle::FONT_STYLE |
1389 TextEditor::InputStyle::LINE_SPACING |
1390 TextEditor::InputStyle::UNDERLINE |
1391 TextEditor::InputStyle::SHADOW |
1392 TextEditor::InputStyle::EMBOSS |
1393 TextEditor::InputStyle::OUTLINE ),
1396 const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
1397 DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
1399 DALI_TEST_CHECK( inputStyleChangedSignal );
1401 gInputStyleChangedCallbackCalled = false;
1402 gInputStyleMask = TextEditor::InputStyle::NONE;
1403 inputStyleChangedSignal = false;
1405 editor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVuSerif" );
1407 fontStyleMapSet.Clear();
1408 fontStyleMapSet.Insert( "weight", "black" );
1409 fontStyleMapSet.Insert( "width", "expanded" );
1410 fontStyleMapSet.Insert( "slant", "oblique" );
1412 editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet );
1414 // Create a tap event to touch the text editor.
1415 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 30.f, 25.f ) ) );
1416 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 30.f, 25.f ) ) );
1418 // Render and notify
1419 application.SendNotification();
1420 application.Render();
1422 // Executes the idle callbacks added by the text control on the change of input style.
1423 application.RunIdles();
1425 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1426 if( gInputStyleChangedCallbackCalled )
1428 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
1429 static_cast<unsigned int>( TextEditor::InputStyle::COLOR |
1430 TextEditor::InputStyle::POINT_SIZE |
1431 TextEditor::InputStyle::FONT_STYLE ),
1434 const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
1435 DALI_TEST_EQUALS( color, Color::YELLOW, TEST_LOCATION );
1437 DALI_TEST_CHECK( inputStyleChangedSignal );
1442 int utcDaliTextEditorEvent01(void)
1444 ToolkitTestApplication application;
1445 tet_infoline(" utcDaliTextEditorEvent01");
1447 // Creates a tap event. After creating a tap event the text editor should
1448 // have the focus and add text with key events should be possible.
1450 TextEditor editor = TextEditor::New();
1451 DALI_TEST_CHECK( editor );
1453 Stage::GetCurrent().Add( editor );
1455 editor.SetSize( 300.f, 50.f );
1456 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
1457 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1459 // Avoid a crash when core load gl resources.
1460 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1462 // Render and notify
1463 application.SendNotification();
1464 application.Render();
1466 // Add a key event but as the text editor has not the focus it should do nothing.
1467 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1469 // Render and notify
1470 application.SendNotification();
1471 application.Render();
1473 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string(""), TEST_LOCATION );
1475 // Create a tap event to touch the text editor.
1476 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1477 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1479 // Render and notify
1480 application.SendNotification();
1481 application.Render();
1483 // Now the text editor has the focus, so it can handle the key events.
1484 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1485 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1487 // Render and notify
1488 application.SendNotification();
1489 application.Render();
1491 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string("aa"), TEST_LOCATION );
1493 // Create a second text editor and send key events to it.
1494 TextEditor editor2 = TextEditor::New();
1496 editor2.SetParentOrigin( ParentOrigin::TOP_LEFT );
1497 editor2.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1498 editor2.SetSize( 100.f, 100.f );
1499 editor2.SetPosition( 100.f, 100.f );
1501 Stage::GetCurrent().Add( editor2 );
1503 // Render and notify
1504 application.SendNotification();
1505 application.Render();
1507 // Create a tap event on the second text editor.
1508 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 125.0f ) ) );
1509 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 125.0f ) ) );
1511 // Render and notify
1512 application.SendNotification();
1513 application.Render();
1515 // The second text editor has the focus. It should handle the key events.
1516 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1517 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1519 // Render and notify
1520 application.SendNotification();
1521 application.Render();
1523 // Check the text has been added to the second text editor.
1524 DALI_TEST_EQUALS( editor2.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string("aa"), TEST_LOCATION );
1529 int utcDaliTextEditorEvent02(void)
1531 ToolkitTestApplication application;
1532 tet_infoline(" utcDaliTextEditorEvent02");
1534 // Checks if the right number of actors are created.
1536 TextEditor editor = TextEditor::New();
1537 editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
1538 DALI_TEST_CHECK( editor );
1540 Stage::GetCurrent().Add( editor );
1542 editor.SetSize( 300.f, 50.f );
1543 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
1544 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1546 // Avoid a crash when core load gl resources.
1547 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1549 // Render and notify
1550 application.SendNotification();
1551 application.Render();
1553 // Check there are the expected number of children (the stencil).
1554 DALI_TEST_EQUALS( editor.GetChildCount(), 1u, TEST_LOCATION );
1556 Actor stencil = editor.GetChildAt( 0u );
1558 // Create a tap event to touch the text editor.
1559 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1560 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1562 // Render and notify
1563 application.SendNotification();
1564 application.Render();
1566 Actor layer = editor.GetChildAt( 1u );
1567 DALI_TEST_CHECK( layer.IsLayer() );
1569 DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor.
1570 DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION );
1572 // Now the text editor has the focus, so it can handle the key events.
1573 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1574 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1576 // Render and notify
1577 application.SendNotification();
1578 application.Render();
1580 // Checks the cursor and the renderer have been created.
1581 DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor.
1582 DALI_TEST_EQUALS( stencil.GetChildCount(), 1u, TEST_LOCATION ); // The renderer
1584 Control cursor = Control::DownCast( layer.GetChildAt( 0u ) );
1585 DALI_TEST_CHECK( cursor );
1587 // The stencil actor has a container with all the actors which contain the text renderers.
1588 Actor container = stencil.GetChildAt( 0u );
1589 for( unsigned int index = 0; index < container.GetChildCount(); ++index )
1591 Renderer renderer = container.GetChildAt( index ).GetRendererAt( 0u );
1592 DALI_TEST_CHECK( renderer );
1595 // Move the cursor and check the position changes.
1596 Vector3 position1 = cursor.GetCurrentPosition();
1598 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1599 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1601 // Render and notify
1602 application.SendNotification();
1603 application.Render();
1605 Vector3 position2 = cursor.GetCurrentPosition();
1607 DALI_TEST_CHECK( position2.x < position1.x );
1609 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1610 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1612 // Render and notify
1613 application.SendNotification();
1614 application.Render();
1616 Vector3 position3 = cursor.GetCurrentPosition();
1618 DALI_TEST_EQUALS( position1, position3, TEST_LOCATION ); // Should be in the same position1.
1620 // Send some taps and check the cursor positions.
1622 // Try to tap at the beginning.
1623 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
1624 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
1626 // Render and notify
1627 application.SendNotification();
1628 application.Render();
1630 // Cursor position should be the same than position1.
1631 Vector3 position4 = cursor.GetCurrentPosition();
1633 DALI_TEST_EQUALS( position2, position4, TEST_LOCATION ); // Should be in the same position2.
1635 // Tap away from the start position.
1636 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 16.f, 25.0f ) ) );
1637 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 16.0f, 25.0f ) ) );
1639 // Render and notify
1640 application.SendNotification();
1641 application.Render();
1643 Vector3 position5 = cursor.GetCurrentPosition();
1645 DALI_TEST_CHECK( position5.x > position4.x );
1647 // Remove all the text.
1648 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1649 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1650 editor.SetProperty( TextEditor::Property::TEXT, "" );
1652 // Render and notify
1653 application.SendNotification();
1654 application.Render();
1656 // Cursor position should be the same than position2.
1657 Vector3 position6 = cursor.GetCurrentPosition();
1659 DALI_TEST_EQUALS( position2, position6, TEST_LOCATION );// Should be in the same position2.
1661 // Should not be a renderer.
1662 DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION );
1667 int utcDaliTextEditorEvent03(void)
1669 ToolkitTestApplication application;
1670 tet_infoline(" utcDaliTextEditorEvent03");
1672 // Checks if the highlight actor is created.
1674 TextEditor editor = TextEditor::New();
1675 DALI_TEST_CHECK( editor );
1677 Stage::GetCurrent().Add( editor );
1679 editor.SetProperty( TextEditor::Property::TEXT, "This is a long text for the size of the text-editor." );
1680 editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
1681 editor.SetSize( 30.f, 50.f );
1682 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
1683 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1685 // Avoid a crash when core load gl resources.
1686 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1688 // Render and notify
1689 application.SendNotification();
1690 application.Render();
1692 // Send some taps and check text controller with clipboard window
1693 Dali::Clipboard clipboard = Clipboard::Get();
1694 clipboard.ShowClipboard();
1695 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1696 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1697 clipboard.HideClipboard();
1699 // Render and notify
1700 application.SendNotification();
1701 application.Render();
1703 // Tap first to get the focus.
1704 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1705 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1707 // Render and notify
1708 application.SendNotification();
1709 application.Render();
1711 // Double tap to select a word.
1712 application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 3.f, 25.0f ) ) );
1713 application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 3.f, 25.0f ) ) );
1715 // Render and notify
1716 application.SendNotification();
1717 application.Render();
1719 // The stencil actor should have two actors: the renderer and the highlight actor.
1720 Actor stencil = editor.GetChildAt( 0u );
1722 // Highlight needs to be drawn before text, so should come first in child order
1723 Renderer highlight = stencil.GetChildAt( 0u ).GetRendererAt( 0u );
1724 DALI_TEST_CHECK( highlight );
1726 // The stencil actor has a container with all the actors which contain the text renderers.
1727 Actor container = stencil.GetChildAt( 1u );
1728 for( unsigned int index = 0; index < container.GetChildCount(); ++index )
1730 Renderer renderer = container.GetChildAt( index ).GetRendererAt( 0u );
1731 DALI_TEST_CHECK( renderer );
1734 // Double tap out of bounds
1735 application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 29.f, 25.0f ) ) );
1736 application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 29.f, 25.0f ) ) );
1738 // Render and notify
1739 application.SendNotification();
1740 application.Render();
1742 // The stencil actor should have one actors: the renderer actor.
1743 stencil = editor.GetChildAt( 0u );
1745 // The stencil actor has a container with all the actors which contain the text renderers.
1746 container = stencil.GetChildAt( 0u );
1747 for( unsigned int index = 0; index < container.GetChildCount(); ++index )
1749 Renderer renderer = container.GetChildAt( index ).GetRendererAt( 0u );
1750 DALI_TEST_CHECK( renderer );
1756 int utcDaliTextEditorEvent04(void)
1758 ToolkitTestApplication application;
1759 tet_infoline(" utcDaliTextEditorEvent04");
1761 // Checks if the highlight actor is created.
1763 TextEditor editor = TextEditor::New();
1764 DALI_TEST_CHECK( editor );
1766 Stage::GetCurrent().Add( editor );
1768 editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworl" );
1769 editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
1770 editor.SetSize( 100.f, 50.f );
1771 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
1772 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1774 // Avoid a crash when core load gl resources.
1775 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1777 // Render and notify
1778 application.SendNotification();
1779 application.Render();
1781 // Tap on the text editor
1782 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1783 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1785 // Render and notify
1786 application.SendNotification();
1787 application.Render();
1789 // Move at the end of the text.
1790 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1791 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1793 // Render and notify
1794 application.SendNotification();
1795 application.Render();
1797 for( unsigned int index = 0u; index < 10u; ++index )
1799 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1800 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1802 // Render and notify
1803 application.SendNotification();
1804 application.Render();
1808 application.ProcessEvent( GenerateKey( "d", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1810 // Render and notify
1811 application.SendNotification();
1812 application.Render();
1814 DALI_TEST_EQUALS( "Hello\nworld", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
1816 // Add some key events
1817 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1818 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1820 // Render and notify
1821 application.SendNotification();
1822 application.Render();
1824 for( unsigned int index = 0u; index < 10u; ++index )
1826 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1827 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1829 // Render and notify
1830 application.SendNotification();
1831 application.Render();
1835 application.ProcessEvent( GenerateKey( " ", " ", KEY_WHITE_SPACE_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1837 // Render and notify
1838 application.SendNotification();
1839 application.Render();
1841 DALI_TEST_EQUALS( " Hello\nworld", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
1846 int utcDaliTextEditorEvent05(void)
1848 ToolkitTestApplication application;
1849 tet_infoline(" utcDaliTextEditorEvent05");
1851 // Checks if the highlight actor is created.
1853 TextEditor editor = TextEditor::New();
1854 DALI_TEST_CHECK( editor );
1856 Stage::GetCurrent().Add( editor );
1858 editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworl" );
1859 editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
1860 editor.SetSize( 50.f, 50.f );
1861 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
1862 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1863 editor.SetProperty( TextEditor::Property::SMOOTH_SCROLL, true );
1864 editor.SetProperty( TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.2f );
1865 editor.SetProperty( TextEditor::Property::ENABLE_SCROLL_BAR, true );
1866 editor.SetProperty( TextEditor::Property::SCROLL_BAR_SHOW_DURATION, 0.3f );
1867 editor.SetProperty( TextEditor::Property::SCROLL_BAR_FADE_DURATION, 0.2f );
1869 // Avoid a crash when core load gl resources.
1870 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1872 // Render and notify
1873 application.SendNotification();
1874 application.Render();
1876 // Tap on the text editor
1877 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1878 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1880 // Render and notify
1881 application.SendNotification();
1882 application.Render();
1884 // Move at the end of the text.
1885 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1886 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1888 // Render and notify
1889 application.SendNotification();
1890 application.Render();
1892 for( unsigned int index = 0u; index < 10u; ++index )
1895 application.ProcessEvent( GenerateKey( "d", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1897 // Render and notify
1898 application.SendNotification();
1899 application.Render();
1901 // Modify duration after scroll is enabled
1902 editor.SetProperty( TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.1f );
1904 // Continuous scroll left to increase coverage
1905 for( unsigned int index = 0u; index < 10u; ++index )
1907 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1909 // Render and notify
1910 application.SendNotification();
1911 application.Render();
1913 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::SMOOTH_SCROLL_DURATION ), 0.1f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1914 DALI_TEST_EQUALS( editor.GetProperty<bool>( TextEditor::Property::SMOOTH_SCROLL ), true, TEST_LOCATION );
1915 DALI_TEST_EQUALS( editor.GetProperty<bool>( TextEditor::Property::ENABLE_SCROLL_BAR ), true, TEST_LOCATION );
1916 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::SCROLL_BAR_SHOW_DURATION ), 0.3f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1917 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::SCROLL_BAR_FADE_DURATION ), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1919 // Press Escape to increase coverage
1920 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1921 application.SendNotification();
1922 application.Render();
1924 DALI_TEST_CHECK( !editor.HasKeyInputFocus() );
1929 int utcDaliTextEditorEvent06(void)
1931 ToolkitTestApplication application;
1932 tet_infoline(" utcDaliTextEditorEvent06");
1934 // Checks if the highlight actor is created.
1936 TextEditor editor = TextEditor::New();
1937 DALI_TEST_CHECK( editor );
1939 Stage::GetCurrent().Add( editor );
1941 editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworld\nHello world" );
1942 editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
1943 editor.SetSize( 100.f, 50.f );
1944 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
1945 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1947 // Avoid a crash when core load gl resources.
1948 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1950 // Render and notify
1951 application.SendNotification();
1952 application.Render();
1954 // Tap on the text editor
1955 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1956 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1958 // Render and notify
1959 application.SendNotification();
1960 application.Render();
1962 // Move to seconds line of the text.
1963 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1965 // Render and notify
1966 application.SendNotification();
1967 application.Render();
1969 float layoutHeight = editor.GetHeightForWidth( 100.f );
1972 // Add another script characters ( glyph height is defferent )
1973 application.ProcessEvent( GenerateKey( "d", "ㅁ", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1974 application.ProcessEvent( GenerateKey( "d", "ኢ", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1976 // Delete characters
1977 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1978 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1980 DALI_TEST_EQUALS( layoutHeight, editor.GetHeightForWidth( 100.f ), TEST_LOCATION );
1982 // Render and notify
1983 application.SendNotification();
1984 application.Render();
1986 DALI_TEST_EQUALS( "Hello\nworld\nHello world", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
1989 application.ProcessEvent( GenerateKey( "", "", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1990 application.SendNotification();
1991 application.Render();
1993 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1994 application.SendNotification();
1995 application.Render();
1997 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_VOLUME_UP, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1998 application.SendNotification();
1999 application.Render();
2001 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_VOLUME_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
2002 application.SendNotification();
2003 application.Render();
2008 int utcDaliTextEditorHandles(void)
2010 ToolkitTestApplication application;
2011 tet_infoline(" utcDaliTextEditorHandles");
2013 TextEditor editor = TextEditor::New();
2014 DALI_TEST_CHECK( editor );
2016 Stage::GetCurrent().Add( editor );
2018 editor.SetProperty( TextEditor::Property::TEXT, "This is a long text for the size of the text-editor." );
2019 editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
2020 editor.SetProperty( TextEditor::Property::GRAB_HANDLE_IMAGE, HANDLE_IMAGE_FILE_NAME );
2021 editor.SetProperty( TextEditor::Property::SMOOTH_SCROLL, true );
2023 editor.SetSize( 30.f, 500.f );
2024 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
2025 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
2027 // Avoid a crash when core load gl resources.
2028 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
2030 // Render and notify
2031 application.SendNotification();
2032 application.Render();
2034 // Tap first to get the focus.
2035 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
2036 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
2038 // Render and notify
2039 application.SendNotification();
2040 application.Render();
2042 // Tap to create the grab handle.
2043 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
2044 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
2046 // Render and notify
2047 application.SendNotification();
2048 application.Render();
2050 // Get the active layer where the text's decoration is added.
2051 Actor activeLayer = editor.GetChildAt( 1u );
2053 // Get the handle's actor.
2054 Actor handle = activeLayer.GetChildAt( 1u );
2055 handle.SetSize( 100.f, 100.f );
2057 // Render and notify
2058 application.SendNotification();
2059 application.Render();
2061 // Touch the grab handle to set it as pressed.
2062 Vector2 touchPos( 10.0f, 50.0f );
2063 Dali::Integration::TouchEvent event;
2064 event = Dali::Integration::TouchEvent();
2065 event.AddPoint( GetPointDownInside( touchPos ) );
2066 application.ProcessEvent( event );
2068 // Render and notify
2069 application.SendNotification();
2070 application.Render();
2072 // drag grab handle right
2073 SendPan(application, Gesture::Possible, touchPos);
2074 SendPan(application, Gesture::Started, touchPos);
2076 Wait(application, 100);
2078 for(int i = 0;i<20;i++)
2080 SendPan(application, Gesture::Continuing, touchPos);
2085 SendPan(application, Gesture::Finished, touchPos);
2088 // Release the grab handle.
2089 event = Dali::Integration::TouchEvent();
2090 event.AddPoint( GetPointUpInside( touchPos ) );
2091 application.ProcessEvent( event );
2093 // Render and notify
2094 application.SendNotification();
2095 application.Render();
2101 int utcDaliTextEditorUnderPropertyStringP(void)
2103 ToolkitTestApplication application;
2104 tet_infoline(" utcDaliTextEditorUnderPropertyStringP");
2105 TextEditor editor = TextEditor::New();
2106 DALI_TEST_CHECK( editor );
2108 std::string underlineSettings1( "{\"enable\":\"true\",\"color\":\"red\",\"height\":\"1\"}" );
2110 Stage::GetCurrent().Add( editor );
2112 editor.SetProperty( TextEditor::Property::UNDERLINE, underlineSettings1 );
2113 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::UNDERLINE ), underlineSettings1, TEST_LOCATION );
2115 tet_infoline("Set underline settings with a map");
2116 // Check the input underline property
2117 Property::Map underlineMapSet;
2118 Property::Map underlineMapGet;
2119 underlineMapSet.Insert( "enable", "true" );
2120 underlineMapSet.Insert( "color", "blue" );
2121 underlineMapSet.Insert( "height", "2" );
2123 editor.SetProperty( TextEditor::Property::UNDERLINE, underlineMapSet );
2124 underlineMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::UNDERLINE );
2125 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
2126 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapSet, underlineMapGet ), true, TEST_LOCATION );
2128 tet_infoline("Set underline settings with a string");
2129 editor.SetProperty( TextEditor::Property::UNDERLINE, underlineSettings1 );
2130 Property::Value value = editor.GetProperty( TextEditor::Property::UNDERLINE );
2133 DALI_TEST_EQUALS( result , underlineSettings1, TEST_LOCATION );
2135 tet_infoline("Trying to set invalid underline settings, should not update and stay at previous settings");
2136 std::string underlineSettingsVoid( "{\"enable\":\"true\",\"coooolor\":\"blue\",\"heeeight\":\"4\"}" );
2137 editor.SetProperty( TextEditor::Property::UNDERLINE, underlineSettingsVoid );
2138 value = editor.GetProperty( TextEditor::Property::UNDERLINE );
2140 DALI_TEST_EQUALS( result , underlineSettings1, TEST_LOCATION );
2145 int utcDaliTextEditorShadowPropertyStringP(void)
2147 ToolkitTestApplication application;
2148 tet_infoline(" utcDaliTextEditorUnderPropertyStringP Setting Shadow propeties by string");
2150 TextEditor editor = TextEditor::New();
2152 std::string shadowSettings( "{\"color\":\"green\",\"offset\":\"2 2\"}" );
2154 Stage::GetCurrent().Add( editor );
2156 editor.SetProperty( TextEditor::Property::SHADOW, "{\"color\":\"green\",\"offset\":\"2 2\"}" );
2158 Property::Value value = editor.GetProperty<std::string>( TextEditor::Property::SHADOW );
2162 DALI_TEST_EQUALS( result, shadowSettings, TEST_LOCATION );
2167 int utcDaliTextEditorFontStylePropertyStringP(void)
2169 ToolkitTestApplication application;
2170 tet_infoline(" utcDaliTextEditorFontStylePropertyStringP Setting FontStyle propeties by string");
2172 TextEditor editor = TextEditor::New();
2174 std::string fontStyleSettings( "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
2176 Stage::GetCurrent().Add( editor );
2178 editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
2180 Property::Value value = editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE );
2184 DALI_TEST_EQUALS( result, fontStyleSettings, TEST_LOCATION );
2189 int utcDaliTextEditorGetPropertyLinecountP(void)
2191 ToolkitTestApplication application;
2193 tet_infoline(" utcDaliTextEditorGetPropertyLinecount getting line count property");
2197 TextEditor editor = TextEditor::New();
2198 editor.SetProperty( TextEditor::Property::POINT_SIZE, 10) ;
2199 editor.SetProperty( TextEditor::Property::TEXT,
2200 "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST ");
2202 Stage::GetCurrent().Add( editor );
2204 editor.SetSize( 100.0f, 100.0f );
2205 lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
2206 DALI_TEST_EQUALS( lineCount, 14, TEST_LOCATION );
2208 editor.SetSize( 50.0f, 100.0f );
2209 lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
2210 DALI_TEST_EQUALS( lineCount, 28, TEST_LOCATION );
2215 int utcDaliTextEditorScrollStateChangedSignalTest(void)
2218 ToolkitTestApplication application;
2219 tet_infoline(" UtcDaliTextEditorScrollStateChangedSignalTest");
2221 TextEditor editor = TextEditor::New();
2222 DALI_TEST_CHECK( editor );
2224 Stage::GetCurrent().Add( editor );
2226 editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
2227 editor.SetSize( 50.f, 50.f );
2228 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
2229 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
2230 editor.SetProperty( TextEditor::Property::ENABLE_SCROLL_BAR, true );
2231 editor.SetKeyboardFocusable(true);
2233 bool startedCalled = false;
2234 bool finishedCalled = false;
2236 ScrollStateChangeCallback callback( startedCalled, finishedCalled );
2237 editor.ScrollStateChangedSignal().Connect( &callback, &ScrollStateChangeCallback::Callback );
2239 KeyboardFocusManager::Get().SetCurrentFocusActor( editor );
2241 // Render and notify
2242 application.SendNotification();
2243 application.Render();
2245 editor.SetProperty( TextEditor::Property::TEXT, "Long enough message for TextEditor!");
2246 application.SendNotification();
2247 application.Render(6000);
2249 application.SendNotification();
2250 DALI_TEST_EQUALS( startedCalled, true, TEST_LOCATION );
2251 DALI_TEST_EQUALS( finishedCalled, true, TEST_LOCATION );
2256 int UtcDaliToolkitTextEditorTextWrapMode(void)
2258 ToolkitTestApplication application;
2259 tet_infoline(" UtcDaliToolkitTextEditorTextWarpMode");
2263 TextEditor editor = TextEditor::New();
2264 editor.SetSize( 150.0f, 300.f );
2265 editor.SetProperty( TextEditor::Property::TEXT, "Hello world Hello world" );
2267 Stage::GetCurrent().Add( editor );
2269 editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, "WORD" );
2270 DALI_TEST_EQUALS( editor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
2272 application.SendNotification();
2273 application.Render();
2275 lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
2276 DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
2278 editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, "CHARACTER" );
2279 DALI_TEST_EQUALS( editor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
2281 application.SendNotification();
2282 application.Render();
2284 lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
2285 DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );
2287 editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, Text::LineWrap::WORD );
2288 DALI_TEST_EQUALS( editor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
2290 application.SendNotification();
2291 application.Render();
2293 lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
2294 DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
2296 editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, Text::LineWrap::CHARACTER );
2297 DALI_TEST_EQUALS( editor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
2299 application.SendNotification();
2300 application.Render();
2302 lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
2303 DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );