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", Color::GREEN );
731 shadowMapSet.Insert( "offset", Vector2(2.0f, 2.0f) );
732 shadowMapSet.Insert( "blurRadius", 3.0f );
734 editor.SetProperty( TextEditor::Property::SHADOW, shadowMapSet );
736 shadowMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::SHADOW );
737 DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
738 DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet ), true, TEST_LOCATION );
740 // Check the input shadow property
741 editor.SetProperty( TextEditor::Property::INPUT_SHADOW, "Shadow input properties" );
742 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_SHADOW ), std::string("Shadow input properties"), TEST_LOCATION );
744 // Check the emboss property
745 editor.SetProperty( TextEditor::Property::EMBOSS, "Emboss properties" );
746 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::EMBOSS ), std::string("Emboss properties"), TEST_LOCATION );
748 // Check the input emboss property
749 editor.SetProperty( TextEditor::Property::INPUT_EMBOSS, "Emboss input properties" );
750 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_EMBOSS ), std::string("Emboss input properties"), TEST_LOCATION );
752 // Check the outline property
754 // Test string type first
755 // This is purely to maintain backward compatibility, but we don't support string as the outline property type.
756 editor.SetProperty( TextEditor::Property::OUTLINE, "Outline properties" );
757 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::OUTLINE ), std::string("Outline properties"), TEST_LOCATION );
759 // Then test the property map type
760 Property::Map outlineMapSet;
761 Property::Map outlineMapGet;
763 outlineMapSet["color"] = Color::RED;
764 outlineMapSet["width"] = 2.0f;
766 editor.SetProperty( TextEditor::Property::OUTLINE, outlineMapSet );
768 outlineMapSet["color"] = "red";
769 outlineMapSet["width"] = "2";
770 outlineMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::OUTLINE );
771 DALI_TEST_EQUALS( outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION );
772 DALI_TEST_EQUALS( DaliTestCheckMaps( outlineMapGet, outlineMapSet ), true, TEST_LOCATION );
774 // Check the input outline property
775 editor.SetProperty( TextEditor::Property::INPUT_OUTLINE, "Outline input properties" );
776 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_OUTLINE ), std::string("Outline input properties"), TEST_LOCATION );
778 // Check the smooth scroll property
779 DALI_TEST_EQUALS( editor.GetProperty<bool>( TextEditor::Property::SMOOTH_SCROLL ), false, TEST_LOCATION );
780 editor.SetProperty( TextEditor::Property::SMOOTH_SCROLL, true );
781 DALI_TEST_EQUALS( editor.GetProperty<bool>( TextEditor::Property::SMOOTH_SCROLL ), true, TEST_LOCATION );
783 // Check the smooth scroll duration property
784 editor.SetProperty( TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.2f );
785 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::SMOOTH_SCROLL_DURATION ), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
787 // Check the scroll bar property
788 DALI_TEST_EQUALS( editor.GetProperty<bool>( TextEditor::Property::ENABLE_SCROLL_BAR ), false, TEST_LOCATION );
789 editor.SetProperty( TextEditor::Property::ENABLE_SCROLL_BAR, true );
790 DALI_TEST_EQUALS( editor.GetProperty<bool>( TextEditor::Property::ENABLE_SCROLL_BAR ), true, TEST_LOCATION );
792 editor.SetProperty( TextEditor::Property::SCROLL_BAR_SHOW_DURATION, 0.3f );
793 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::SCROLL_BAR_SHOW_DURATION ), 0.3f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
794 editor.SetProperty( TextEditor::Property::SCROLL_BAR_FADE_DURATION, 0.2f );
795 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::SCROLL_BAR_FADE_DURATION ), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
797 // Check the pixel size of font
798 editor.SetProperty( TextEditor::Property::PIXEL_SIZE, 20.f );
799 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::PIXEL_SIZE ), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
801 // Check placeholder text properties.
802 editor.SetProperty( DevelTextEditor::Property::PLACEHOLDER_TEXT, "Setting Placeholder Text" );
803 DALI_TEST_EQUALS( editor.GetProperty<std::string>( DevelTextEditor::Property::PLACEHOLDER_TEXT ), std::string("Setting Placeholder Text"), TEST_LOCATION );
805 // Check placeholder text's color property.
806 editor.SetProperty( DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR, Color::RED );
807 DALI_TEST_EQUALS( editor.GetProperty<Vector4>( DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR ), Color::RED, TEST_LOCATION );
809 // Check the enable selection property
810 editor.SetProperty( TextEditor::Property::ENABLE_SELECTION, false );
811 DALI_TEST_EQUALS( editor.GetProperty<bool>( TextEditor::Property::ENABLE_SELECTION ), false, TEST_LOCATION );
813 // Check the placeholder property with pixel size
814 Property::Map placeholderPixelSizeMapSet;
815 Property::Map placeholderPixelSizeMapGet;
816 Property::Map placeholderFontstyleMap;
817 placeholderPixelSizeMapSet["text"] = "Setting Placeholder Text";
818 placeholderPixelSizeMapSet["textFocused"] = "Setting Placeholder Text Focused";
819 placeholderPixelSizeMapSet["color"] = Color::BLUE;
820 placeholderPixelSizeMapSet["fontFamily"] = "Arial";
821 placeholderPixelSizeMapSet["pixelSize"] = 15.0f;
823 placeholderFontstyleMap.Insert( "weight", "bold" );
824 placeholderPixelSizeMapSet["fontStyle"] = placeholderFontstyleMap;
825 editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderPixelSizeMapSet );
827 placeholderPixelSizeMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::PLACEHOLDER );
828 DALI_TEST_EQUALS( placeholderPixelSizeMapGet.Count(), placeholderPixelSizeMapSet.Count(), TEST_LOCATION );
830 tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value");
831 Property::Map placeholderConversionMap;
832 placeholderConversionMap[ Text::PlaceHolder::Property::TEXT ] = placeholderPixelSizeMapSet["text"];
833 placeholderConversionMap[ Text::PlaceHolder::Property::TEXT_FOCUSED ] = placeholderPixelSizeMapSet["textFocused"] ;
834 placeholderConversionMap[ Text::PlaceHolder::Property::COLOR ] = placeholderPixelSizeMapSet["color"];
835 placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderPixelSizeMapSet["fontStyle"];
836 placeholderConversionMap[ Text::PlaceHolder::Property::FONT_FAMILY ] = placeholderPixelSizeMapSet["fontFamily"];
837 placeholderConversionMap[ Text::PlaceHolder::Property::PIXEL_SIZE ] = placeholderPixelSizeMapSet["pixelSize"];
839 DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderPixelSizeMapGet, placeholderConversionMap ), true, TEST_LOCATION );
841 // Check the placeholder property with point size
842 Property::Map placeholderMapSet;
843 Property::Map placeholderMapGet;
844 placeholderMapSet["text"] = "Setting Placeholder Text";
845 placeholderMapSet["textFocused"] = "Setting Placeholder Text Focused";
846 placeholderMapSet["color"] = Color::RED;
847 placeholderMapSet["fontFamily"] = "Arial";
848 placeholderMapSet["pointSize"] = 12.0f;
849 // Check the placeholder font style property
850 placeholderFontstyleMap.Clear();
852 placeholderFontstyleMap.Insert( "weight", "bold" );
853 placeholderFontstyleMap.Insert( "width", "condensed" );
854 placeholderFontstyleMap.Insert( "slant", "italic" );
855 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
856 editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet );
858 placeholderMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::PLACEHOLDER );
859 DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION );
861 tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value");
862 placeholderConversionMap.Clear();
863 placeholderConversionMap[ Text::PlaceHolder::Property::TEXT ] = placeholderMapSet["text"];
864 placeholderConversionMap[ Text::PlaceHolder::Property::TEXT_FOCUSED ] = placeholderMapSet["textFocused"] ;
865 placeholderConversionMap[ Text::PlaceHolder::Property::COLOR ] = placeholderMapSet["color"];
866 placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderPixelSizeMapSet["fontStyle"];
867 placeholderConversionMap[ Text::PlaceHolder::Property::FONT_FAMILY ] = placeholderMapSet["fontFamily"];
868 placeholderConversionMap[ Text::PlaceHolder::Property::POINT_SIZE ] = placeholderMapSet["pointSize"];
869 DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderConversionMap ), true, TEST_LOCATION );
872 placeholderFontstyleMap.Clear();
873 placeholderFontstyleMap.Insert( "weight", "normal" );
874 placeholderFontstyleMap.Insert( "slant", "oblique" );
875 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
876 editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet );
878 placeholderMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::PLACEHOLDER );
879 DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION );
880 placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderMapSet["fontStyle"];
881 DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderConversionMap ), true, TEST_LOCATION );
883 placeholderFontstyleMap.Clear();
884 placeholderFontstyleMap.Insert( "slant", "roman" );
885 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
886 editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet );
888 placeholderMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::PLACEHOLDER );
890 placeholderFontstyleMap.Clear();
891 placeholderMapSet["fontStyle"] = placeholderFontstyleMap;
893 editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet );
894 placeholderMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::PLACEHOLDER );
895 DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION );
896 placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderMapSet["fontStyle"];
897 DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderConversionMap ), true, TEST_LOCATION );
902 // Positive Atlas Text Renderer test
903 int utcDaliTextEditorAtlasRenderP(void)
905 ToolkitTestApplication application;
906 tet_infoline(" UtcDaliToolkitTextEditorAtlasRenderP");
907 StyleManager styleManager = StyleManager::Get();
908 styleManager.ApplyDefaultTheme();
909 TextEditor editor = TextEditor::New();
910 DALI_TEST_CHECK( editor );
912 editor.SetProperty( TextEditor::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
914 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
916 Stage::GetCurrent().Add( editor );
920 // Render some text with the shared atlas backend
921 editor.SetProperty( TextEditor::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
922 application.SendNotification();
923 application.Render();
927 tet_result(TET_FAIL);
932 // Positive test for the textChanged signal.
933 int utcDaliTextEditorTextChangedP(void)
935 ToolkitTestApplication application;
936 tet_infoline(" utcDaliTextEditorTextChangedP");
937 TextEditor editor = TextEditor::New();
938 DALI_TEST_CHECK( editor );
940 Stage::GetCurrent().Add( editor );
942 // connect to the text changed signal.
943 ConnectionTracker* testTracker = new ConnectionTracker();
944 editor.TextChangedSignal().Connect( &TestTextChangedCallback );
945 bool textChangedSignal = false;
946 editor.ConnectSignal( testTracker, "textChanged", CallbackFunctor(&textChangedSignal) );
948 gTextChangedCallBackCalled = false;
949 editor.SetProperty( TextEditor::Property::TEXT, "ABC" );
950 DALI_TEST_CHECK( gTextChangedCallBackCalled );
951 DALI_TEST_CHECK( textChangedSignal );
953 application.SendNotification();
955 editor.SetKeyInputFocus();
957 gTextChangedCallBackCalled = false;
958 application.ProcessEvent( GenerateKey( "D", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
959 DALI_TEST_CHECK( gTextChangedCallBackCalled );
964 int utcDaliTextEditorInputStyleChanged01(void)
966 ToolkitTestApplication application;
967 tet_infoline(" utcDaliTextEditorInputStyleChanged01");
969 // The text-editor emits signals when the input style changes. These changes of style are
970 // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
971 // can't be emitted during the size negotiation as the callbacks may update the UI.
972 // The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
973 // This creates an implementation of the adaptor stub and a queue of idle callbacks.
974 application.CreateAdaptor();
978 char* pathNamePtr = get_current_dir_name();
979 const std::string pathName( pathNamePtr );
982 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
983 fontClient.SetDpi( 93u, 93u );
985 fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE );
986 fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE );
988 TextEditor editor = TextEditor::New();
989 DALI_TEST_CHECK( editor );
992 editor.SetSize( 300.f, 50.f );
993 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
994 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
996 editor.SetProperty( TextEditor::Property::ENABLE_MARKUP, true );
997 editor.SetProperty( TextEditor::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='green'>llo</color> <font weight='bold'>world</font> demo</font>" );
999 // connect to the text changed signal.
1000 ConnectionTracker* testTracker = new ConnectionTracker();
1001 editor.InputStyleChangedSignal().Connect( &TestInputStyleChangedCallback );
1002 bool inputStyleChangedSignal = false;
1003 editor.ConnectSignal( testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal) );
1005 Stage::GetCurrent().Add( editor );
1007 // Render and notify
1008 application.SendNotification();
1009 application.Render();
1011 // Executes the idle callbacks added by the text control on the change of input style.
1012 application.RunIdles();
1014 gInputStyleChangedCallbackCalled = false;
1015 gInputStyleMask = TextEditor::InputStyle::NONE;
1016 inputStyleChangedSignal = false;
1018 // Create a tap event to touch the text editor.
1019 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 18.f, 25.f ) ) );
1020 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 18.f, 25.f ) ) );
1022 // Render and notify
1023 application.SendNotification();
1024 application.Render();
1026 // Executes the idle callbacks added by the text control on the change of input style.
1027 application.RunIdles();
1029 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1030 if( gInputStyleChangedCallbackCalled )
1032 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextEditor::InputStyle::FONT_FAMILY | TextEditor::InputStyle::POINT_SIZE ), TEST_LOCATION );
1034 const std::string fontFamily = editor.GetProperty( TextEditor::Property::INPUT_FONT_FAMILY ).Get<std::string>();
1035 DALI_TEST_EQUALS( fontFamily, "DejaVuSerif", TEST_LOCATION );
1037 const float pointSize = editor.GetProperty( TextEditor::Property::INPUT_POINT_SIZE ).Get<float>();
1038 DALI_TEST_EQUALS( pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1040 DALI_TEST_CHECK( inputStyleChangedSignal );
1042 gInputStyleChangedCallbackCalled = false;
1043 gInputStyleMask = TextEditor::InputStyle::NONE;
1044 inputStyleChangedSignal = false;
1046 // Create a tap event to touch the text editor.
1047 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 30.f, 25.f ) ) );
1048 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 30.f, 25.f ) ) );
1050 // Render and notify
1051 application.SendNotification();
1052 application.Render();
1054 // Executes the idle callbacks added by the text control on the change of input style.
1055 application.RunIdles();
1057 DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
1058 DALI_TEST_CHECK( !inputStyleChangedSignal );
1060 gInputStyleChangedCallbackCalled = false;
1061 gInputStyleMask = TextEditor::InputStyle::NONE;
1062 inputStyleChangedSignal = false;
1064 // Create a tap event to touch the text editor.
1065 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 43.f, 25.f ) ) );
1066 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 43.f, 25.f ) ) );
1068 // Render and notify
1069 application.SendNotification();
1070 application.Render();
1072 // Executes the idle callbacks added by the text control on the change of input style.
1073 application.RunIdles();
1075 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1076 if( gInputStyleChangedCallbackCalled )
1078 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextEditor::InputStyle::COLOR ), TEST_LOCATION );
1080 const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
1081 DALI_TEST_EQUALS( color, Color::GREEN, TEST_LOCATION );
1083 DALI_TEST_CHECK( inputStyleChangedSignal );
1085 gInputStyleChangedCallbackCalled = false;
1086 gInputStyleMask = TextEditor::InputStyle::NONE;
1087 inputStyleChangedSignal = false;
1089 // Create a tap event to touch the text editor.
1090 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 88.f, 25.f ) ) );
1091 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 88.f, 25.f ) ) );
1093 // Render and notify
1094 application.SendNotification();
1095 application.Render();
1097 // Executes the idle callbacks added by the text control on the change of input style.
1098 application.RunIdles();
1100 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1101 if( gInputStyleChangedCallbackCalled )
1103 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextEditor::InputStyle::COLOR | TextEditor::InputStyle::FONT_STYLE ), TEST_LOCATION );
1105 const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
1106 DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
1108 Property::Map fontStyleMapSet;
1109 Property::Map fontStyleMapGet;
1111 fontStyleMapSet.Insert( "weight", "bold" );
1113 fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
1114 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
1115 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
1117 DALI_TEST_CHECK( inputStyleChangedSignal );
1119 gInputStyleChangedCallbackCalled = false;
1120 gInputStyleMask = TextEditor::InputStyle::NONE;
1121 inputStyleChangedSignal = false;
1123 // Create a tap event to touch the text editor.
1124 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 115.f, 25.f ) ) );
1125 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 115.f, 25.f ) ) );
1127 // Render and notify
1128 application.SendNotification();
1129 application.Render();
1131 // Executes the idle callbacks added by the text control on the change of input style.
1132 application.RunIdles();
1134 DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
1135 DALI_TEST_CHECK( !inputStyleChangedSignal );
1137 gInputStyleChangedCallbackCalled = false;
1138 gInputStyleMask = TextEditor::InputStyle::NONE;
1139 inputStyleChangedSignal = false;
1141 // Create a tap event to touch the text editor.
1142 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 164.f, 25.f ) ) );
1143 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 164.f, 25.f ) ) );
1145 // Render and notify
1146 application.SendNotification();
1147 application.Render();
1149 // Executes the idle callbacks added by the text control on the change of input style.
1150 application.RunIdles();
1152 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1153 if( gInputStyleChangedCallbackCalled )
1155 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextEditor::InputStyle::FONT_STYLE ), TEST_LOCATION );
1157 Property::Map fontStyleMapSet;
1158 Property::Map fontStyleMapGet;
1160 fontStyleMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::INPUT_FONT_STYLE );
1161 DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
1162 DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
1164 DALI_TEST_CHECK( inputStyleChangedSignal );
1166 gInputStyleChangedCallbackCalled = false;
1167 gInputStyleMask = TextEditor::InputStyle::NONE;
1168 inputStyleChangedSignal = false;
1170 // Create a tap event to touch the text editor.
1171 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 191.f, 25.f ) ) );
1172 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 191.f, 25.f ) ) );
1174 // Render and notify
1175 application.SendNotification();
1176 application.Render();
1178 // Executes the idle callbacks added by the text control on the change of input style.
1179 application.RunIdles();
1181 DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
1182 DALI_TEST_CHECK( !inputStyleChangedSignal );
1187 int utcDaliTextEditorInputStyleChanged02(void)
1189 ToolkitTestApplication application;
1190 tet_infoline(" utcDaliTextEditorInputStyleChanged02");
1192 // The text-editor emits signals when the input style changes. These changes of style are
1193 // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
1194 // can't be emitted during the size negotiation as the callbacks may update the UI.
1195 // The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
1196 // This creates an implementation of the adaptor stub and a queue of idle callbacks.
1197 application.CreateAdaptor();
1201 char* pathNamePtr = get_current_dir_name();
1202 const std::string pathName( pathNamePtr );
1203 free( pathNamePtr );
1205 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1206 fontClient.SetDpi( 93u, 93u );
1208 fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE );
1209 fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE );
1211 TextEditor editor = TextEditor::New();
1212 DALI_TEST_CHECK( editor );
1215 editor.SetSize( 300.f, 50.f );
1216 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
1217 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1219 editor.SetProperty( TextEditor::Property::ENABLE_MARKUP, true );
1220 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>" );
1222 // connect to the text changed signal.
1223 ConnectionTracker* testTracker = new ConnectionTracker();
1224 editor.InputStyleChangedSignal().Connect( &TestInputStyleChangedCallback );
1225 bool inputStyleChangedSignal = false;
1226 editor.ConnectSignal( testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal) );
1228 Stage::GetCurrent().Add( editor );
1230 // Render and notify
1231 application.SendNotification();
1232 application.Render();
1234 // Executes the idle callbacks added by the text control on the change of input style.
1235 application.RunIdles();
1237 gInputStyleChangedCallbackCalled = false;
1238 gInputStyleMask = TextEditor::InputStyle::NONE;
1239 inputStyleChangedSignal = false;
1241 // Create a tap event to touch the text editor.
1242 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 53.f, 25.f ) ) );
1243 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 53.f, 25.f ) ) );
1244 application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 53.f, 25.f ) ) );
1245 application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 53.f, 25.f ) ) );
1247 // Render and notify
1248 application.SendNotification();
1249 application.Render();
1251 // Executes the idle callbacks added by the text control on the change of input style.
1252 application.RunIdles();
1254 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1255 if( gInputStyleChangedCallbackCalled )
1257 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
1258 static_cast<unsigned int>( TextEditor::InputStyle::FONT_FAMILY |
1259 TextEditor::InputStyle::POINT_SIZE |
1260 TextEditor::InputStyle::COLOR ),
1263 const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
1264 DALI_TEST_EQUALS( color, Color::GREEN, TEST_LOCATION );
1266 const std::string fontFamily = editor.GetProperty( TextEditor::Property::INPUT_FONT_FAMILY ).Get<std::string>();
1267 DALI_TEST_EQUALS( fontFamily, "DejaVuSerif", TEST_LOCATION );
1269 const float pointSize = editor.GetProperty( TextEditor::Property::INPUT_POINT_SIZE ).Get<float>();
1270 DALI_TEST_EQUALS( pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1272 DALI_TEST_CHECK( inputStyleChangedSignal );
1274 gInputStyleChangedCallbackCalled = false;
1275 gInputStyleMask = TextEditor::InputStyle::NONE;
1276 inputStyleChangedSignal = false;
1278 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1280 // Render and notify
1281 application.SendNotification();
1282 application.Render();
1284 // Executes the idle callbacks added by the text control on the change of input style.
1285 application.RunIdles();
1287 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1288 if( gInputStyleChangedCallbackCalled )
1290 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
1291 static_cast<unsigned int>( TextEditor::InputStyle::COLOR ),
1294 const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
1295 DALI_TEST_EQUALS( color, Color::BLUE, TEST_LOCATION );
1297 DALI_TEST_CHECK( inputStyleChangedSignal );
1299 gInputStyleChangedCallbackCalled = false;
1300 gInputStyleMask = TextEditor::InputStyle::NONE;
1301 inputStyleChangedSignal = false;
1303 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1305 // Render and notify
1306 application.SendNotification();
1307 application.Render();
1309 // Executes the idle callbacks added by the text control on the change of input style.
1310 application.RunIdles();
1312 DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
1313 DALI_TEST_CHECK( !inputStyleChangedSignal );
1315 gInputStyleChangedCallbackCalled = false;
1316 gInputStyleMask = TextEditor::InputStyle::NONE;
1317 inputStyleChangedSignal = false;
1319 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1321 // Render and notify
1322 application.SendNotification();
1323 application.Render();
1325 // Executes the idle callbacks added by the text control on the change of input style.
1326 application.RunIdles();
1328 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1329 if( gInputStyleChangedCallbackCalled )
1331 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
1332 static_cast<unsigned int>( TextEditor::InputStyle::COLOR ),
1335 const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
1336 DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
1338 DALI_TEST_CHECK( inputStyleChangedSignal );
1340 gInputStyleChangedCallbackCalled = false;
1341 gInputStyleMask = TextEditor::InputStyle::NONE;
1342 inputStyleChangedSignal = false;
1344 editor.SetProperty( TextEditor::Property::INPUT_COLOR, Color::YELLOW );
1346 Property::Map fontStyleMapSet;
1347 fontStyleMapSet.Insert( "weight", "thin" );
1348 fontStyleMapSet.Insert( "width", "condensed" );
1349 fontStyleMapSet.Insert( "slant", "italic" );
1351 editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, fontStyleMapSet );
1352 editor.SetProperty( TextEditor::Property::INPUT_POINT_SIZE, 20.f );
1353 editor.SetProperty( TextEditor::Property::INPUT_LINE_SPACING, 5.f );
1355 editor.SetProperty( TextEditor::Property::INPUT_UNDERLINE, "underline" );
1356 editor.SetProperty( TextEditor::Property::INPUT_SHADOW, "shadow" );
1357 editor.SetProperty( TextEditor::Property::INPUT_EMBOSS, "emboss" );
1358 editor.SetProperty( TextEditor::Property::INPUT_OUTLINE, "outline" );
1360 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1362 // Render and notify
1363 application.SendNotification();
1364 application.Render();
1366 // Executes the idle callbacks added by the text control on the change of input style.
1367 application.RunIdles();
1369 DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
1370 DALI_TEST_CHECK( !inputStyleChangedSignal );
1372 // Create a tap event to touch the text editor.
1373 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 63.f, 25.f ) ) );
1374 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 63.f, 25.f ) ) );
1376 // Render and notify
1377 application.SendNotification();
1378 application.Render();
1380 // Executes the idle callbacks added by the text control on the change of input style.
1381 application.RunIdles();
1383 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1384 if( gInputStyleChangedCallbackCalled )
1386 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
1387 static_cast<unsigned int>( TextEditor::InputStyle::COLOR |
1388 TextEditor::InputStyle::POINT_SIZE |
1389 TextEditor::InputStyle::FONT_STYLE |
1390 TextEditor::InputStyle::LINE_SPACING |
1391 TextEditor::InputStyle::UNDERLINE |
1392 TextEditor::InputStyle::SHADOW |
1393 TextEditor::InputStyle::EMBOSS |
1394 TextEditor::InputStyle::OUTLINE ),
1397 const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
1398 DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
1400 DALI_TEST_CHECK( inputStyleChangedSignal );
1402 gInputStyleChangedCallbackCalled = false;
1403 gInputStyleMask = TextEditor::InputStyle::NONE;
1404 inputStyleChangedSignal = false;
1406 editor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVuSerif" );
1408 fontStyleMapSet.Clear();
1409 fontStyleMapSet.Insert( "weight", "black" );
1410 fontStyleMapSet.Insert( "width", "expanded" );
1411 fontStyleMapSet.Insert( "slant", "oblique" );
1413 editor.SetProperty( TextEditor::Property::FONT_STYLE, fontStyleMapSet );
1415 // Create a tap event to touch the text editor.
1416 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 30.f, 25.f ) ) );
1417 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 30.f, 25.f ) ) );
1419 // Render and notify
1420 application.SendNotification();
1421 application.Render();
1423 // Executes the idle callbacks added by the text control on the change of input style.
1424 application.RunIdles();
1426 DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
1427 if( gInputStyleChangedCallbackCalled )
1429 DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
1430 static_cast<unsigned int>( TextEditor::InputStyle::COLOR |
1431 TextEditor::InputStyle::POINT_SIZE |
1432 TextEditor::InputStyle::FONT_STYLE ),
1435 const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
1436 DALI_TEST_EQUALS( color, Color::YELLOW, TEST_LOCATION );
1438 DALI_TEST_CHECK( inputStyleChangedSignal );
1443 int utcDaliTextEditorEvent01(void)
1445 ToolkitTestApplication application;
1446 tet_infoline(" utcDaliTextEditorEvent01");
1448 // Creates a tap event. After creating a tap event the text editor should
1449 // have the focus and add text with key events should be possible.
1451 TextEditor editor = TextEditor::New();
1452 DALI_TEST_CHECK( editor );
1454 Stage::GetCurrent().Add( editor );
1456 editor.SetSize( 300.f, 50.f );
1457 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
1458 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1460 // Avoid a crash when core load gl resources.
1461 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1463 // Render and notify
1464 application.SendNotification();
1465 application.Render();
1467 // Add a key event but as the text editor has not the focus it should do nothing.
1468 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1470 // Render and notify
1471 application.SendNotification();
1472 application.Render();
1474 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string(""), TEST_LOCATION );
1476 // Create a tap event to touch the text editor.
1477 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1478 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1480 // Render and notify
1481 application.SendNotification();
1482 application.Render();
1484 // Now the text editor has the focus, so it can handle the key events.
1485 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1486 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1488 // Render and notify
1489 application.SendNotification();
1490 application.Render();
1492 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string("aa"), TEST_LOCATION );
1494 // Create a second text editor and send key events to it.
1495 TextEditor editor2 = TextEditor::New();
1497 editor2.SetParentOrigin( ParentOrigin::TOP_LEFT );
1498 editor2.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1499 editor2.SetSize( 100.f, 100.f );
1500 editor2.SetPosition( 100.f, 100.f );
1502 Stage::GetCurrent().Add( editor2 );
1504 // Render and notify
1505 application.SendNotification();
1506 application.Render();
1508 // Create a tap event on the second text editor.
1509 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 125.0f ) ) );
1510 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 125.0f ) ) );
1512 // Render and notify
1513 application.SendNotification();
1514 application.Render();
1516 // The second text editor has the focus. It should handle the key events.
1517 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1518 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1520 // Render and notify
1521 application.SendNotification();
1522 application.Render();
1524 // Check the text has been added to the second text editor.
1525 DALI_TEST_EQUALS( editor2.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string("aa"), TEST_LOCATION );
1530 int utcDaliTextEditorEvent02(void)
1532 ToolkitTestApplication application;
1533 tet_infoline(" utcDaliTextEditorEvent02");
1535 // Checks if the right number of actors are created.
1537 TextEditor editor = TextEditor::New();
1538 editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
1539 DALI_TEST_CHECK( editor );
1541 Stage::GetCurrent().Add( editor );
1543 editor.SetSize( 300.f, 50.f );
1544 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
1545 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1547 // Avoid a crash when core load gl resources.
1548 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1550 // Render and notify
1551 application.SendNotification();
1552 application.Render();
1554 // Check there are the expected number of children (the stencil).
1555 DALI_TEST_EQUALS( editor.GetChildCount(), 1u, TEST_LOCATION );
1557 Actor stencil = editor.GetChildAt( 0u );
1559 // Create a tap event to touch the text editor.
1560 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1561 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
1563 // Render and notify
1564 application.SendNotification();
1565 application.Render();
1567 Actor layer = editor.GetChildAt( 1u );
1568 DALI_TEST_CHECK( layer.IsLayer() );
1570 DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor.
1571 DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION );
1573 // Now the text editor has the focus, so it can handle the key events.
1574 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1575 application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1577 // Render and notify
1578 application.SendNotification();
1579 application.Render();
1581 // Checks the cursor and the renderer have been created.
1582 DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor.
1583 DALI_TEST_EQUALS( stencil.GetChildCount(), 1u, TEST_LOCATION ); // The renderer
1585 Control cursor = Control::DownCast( layer.GetChildAt( 0u ) );
1586 DALI_TEST_CHECK( cursor );
1588 // The stencil actor has a container with all the actors which contain the text renderers.
1589 Actor container = stencil.GetChildAt( 0u );
1590 for( unsigned int index = 0; index < container.GetChildCount(); ++index )
1592 Renderer renderer = container.GetChildAt( index ).GetRendererAt( 0u );
1593 DALI_TEST_CHECK( renderer );
1596 // Move the cursor and check the position changes.
1597 Vector3 position1 = cursor.GetCurrentPosition();
1599 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1600 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1602 // Render and notify
1603 application.SendNotification();
1604 application.Render();
1606 Vector3 position2 = cursor.GetCurrentPosition();
1608 DALI_TEST_CHECK( position2.x < position1.x );
1610 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1611 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1613 // Render and notify
1614 application.SendNotification();
1615 application.Render();
1617 Vector3 position3 = cursor.GetCurrentPosition();
1619 DALI_TEST_EQUALS( position1, position3, TEST_LOCATION ); // Should be in the same position1.
1621 // Send some taps and check the cursor positions.
1623 // Try to tap at the beginning.
1624 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
1625 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
1627 // Render and notify
1628 application.SendNotification();
1629 application.Render();
1631 // Cursor position should be the same than position1.
1632 Vector3 position4 = cursor.GetCurrentPosition();
1634 DALI_TEST_EQUALS( position2, position4, TEST_LOCATION ); // Should be in the same position2.
1636 // Tap away from the start position.
1637 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 16.f, 25.0f ) ) );
1638 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 16.0f, 25.0f ) ) );
1640 // Render and notify
1641 application.SendNotification();
1642 application.Render();
1644 Vector3 position5 = cursor.GetCurrentPosition();
1646 DALI_TEST_CHECK( position5.x > position4.x );
1648 // Remove all the text.
1649 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1650 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1651 editor.SetProperty( TextEditor::Property::TEXT, "" );
1653 // Render and notify
1654 application.SendNotification();
1655 application.Render();
1657 // Cursor position should be the same than position2.
1658 Vector3 position6 = cursor.GetCurrentPosition();
1660 DALI_TEST_EQUALS( position2, position6, TEST_LOCATION );// Should be in the same position2.
1662 // Should not be a renderer.
1663 DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION );
1668 int utcDaliTextEditorEvent03(void)
1670 ToolkitTestApplication application;
1671 tet_infoline(" utcDaliTextEditorEvent03");
1673 // Checks if the highlight actor is created.
1675 TextEditor editor = TextEditor::New();
1676 DALI_TEST_CHECK( editor );
1678 Stage::GetCurrent().Add( editor );
1680 editor.SetProperty( TextEditor::Property::TEXT, "This is a long text for the size of the text-editor." );
1681 editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
1682 editor.SetSize( 30.f, 50.f );
1683 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
1684 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1686 // Avoid a crash when core load gl resources.
1687 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1689 // Render and notify
1690 application.SendNotification();
1691 application.Render();
1693 // Send some taps and check text controller with clipboard window
1694 Dali::Clipboard clipboard = Clipboard::Get();
1695 clipboard.ShowClipboard();
1696 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1697 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1698 clipboard.HideClipboard();
1700 // Render and notify
1701 application.SendNotification();
1702 application.Render();
1704 // Tap first to get the focus.
1705 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1706 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1708 // Render and notify
1709 application.SendNotification();
1710 application.Render();
1712 // Double tap to select a word.
1713 application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 3.f, 25.0f ) ) );
1714 application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 3.f, 25.0f ) ) );
1716 // Render and notify
1717 application.SendNotification();
1718 application.Render();
1720 // The stencil actor should have two actors: the renderer and the highlight actor.
1721 Actor stencil = editor.GetChildAt( 0u );
1723 // Highlight needs to be drawn before text, so should come first in child order
1724 Renderer highlight = stencil.GetChildAt( 0u ).GetRendererAt( 0u );
1725 DALI_TEST_CHECK( highlight );
1727 // The stencil actor has a container with all the actors which contain the text renderers.
1728 Actor container = stencil.GetChildAt( 1u );
1729 for( unsigned int index = 0; index < container.GetChildCount(); ++index )
1731 Renderer renderer = container.GetChildAt( index ).GetRendererAt( 0u );
1732 DALI_TEST_CHECK( renderer );
1735 // Double tap out of bounds
1736 application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 29.f, 25.0f ) ) );
1737 application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 29.f, 25.0f ) ) );
1739 // Render and notify
1740 application.SendNotification();
1741 application.Render();
1743 // The stencil actor should have one actors: the renderer actor.
1744 stencil = editor.GetChildAt( 0u );
1746 // The stencil actor has a container with all the actors which contain the text renderers.
1747 container = stencil.GetChildAt( 0u );
1748 for( unsigned int index = 0; index < container.GetChildCount(); ++index )
1750 Renderer renderer = container.GetChildAt( index ).GetRendererAt( 0u );
1751 DALI_TEST_CHECK( renderer );
1757 int utcDaliTextEditorEvent04(void)
1759 ToolkitTestApplication application;
1760 tet_infoline(" utcDaliTextEditorEvent04");
1762 // Checks if the highlight actor is created.
1764 TextEditor editor = TextEditor::New();
1765 DALI_TEST_CHECK( editor );
1767 Stage::GetCurrent().Add( editor );
1769 editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworl" );
1770 editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
1771 editor.SetSize( 100.f, 50.f );
1772 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
1773 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1775 // Avoid a crash when core load gl resources.
1776 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1778 // Render and notify
1779 application.SendNotification();
1780 application.Render();
1782 // Tap on the text editor
1783 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1784 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1786 // Render and notify
1787 application.SendNotification();
1788 application.Render();
1790 // Move at the end of the text.
1791 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1792 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1794 // Render and notify
1795 application.SendNotification();
1796 application.Render();
1798 for( unsigned int index = 0u; index < 10u; ++index )
1800 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1801 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1803 // Render and notify
1804 application.SendNotification();
1805 application.Render();
1809 application.ProcessEvent( GenerateKey( "d", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1811 // Render and notify
1812 application.SendNotification();
1813 application.Render();
1815 DALI_TEST_EQUALS( "Hello\nworld", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
1817 // Add some key events
1818 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1819 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1821 // Render and notify
1822 application.SendNotification();
1823 application.Render();
1825 for( unsigned int index = 0u; index < 10u; ++index )
1827 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1828 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1830 // Render and notify
1831 application.SendNotification();
1832 application.Render();
1836 application.ProcessEvent( GenerateKey( " ", " ", KEY_WHITE_SPACE_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1838 // Render and notify
1839 application.SendNotification();
1840 application.Render();
1842 DALI_TEST_EQUALS( " Hello\nworld", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
1847 int utcDaliTextEditorEvent05(void)
1849 ToolkitTestApplication application;
1850 tet_infoline(" utcDaliTextEditorEvent05");
1852 // Checks if the highlight actor is created.
1854 TextEditor editor = TextEditor::New();
1855 DALI_TEST_CHECK( editor );
1857 Stage::GetCurrent().Add( editor );
1859 editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworl" );
1860 editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
1861 editor.SetSize( 50.f, 50.f );
1862 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
1863 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1864 editor.SetProperty( TextEditor::Property::SMOOTH_SCROLL, true );
1865 editor.SetProperty( TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.2f );
1866 editor.SetProperty( TextEditor::Property::ENABLE_SCROLL_BAR, true );
1867 editor.SetProperty( TextEditor::Property::SCROLL_BAR_SHOW_DURATION, 0.3f );
1868 editor.SetProperty( TextEditor::Property::SCROLL_BAR_FADE_DURATION, 0.2f );
1870 // Avoid a crash when core load gl resources.
1871 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1873 // Render and notify
1874 application.SendNotification();
1875 application.Render();
1877 // Tap on the text editor
1878 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1879 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1881 // Render and notify
1882 application.SendNotification();
1883 application.Render();
1885 // Move at the end of the text.
1886 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1887 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1889 // Render and notify
1890 application.SendNotification();
1891 application.Render();
1893 for( unsigned int index = 0u; index < 10u; ++index )
1896 application.ProcessEvent( GenerateKey( "d", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1898 // Render and notify
1899 application.SendNotification();
1900 application.Render();
1902 // Modify duration after scroll is enabled
1903 editor.SetProperty( TextEditor::Property::SMOOTH_SCROLL_DURATION, 0.1f );
1905 // Continuous scroll left to increase coverage
1906 for( unsigned int index = 0u; index < 10u; ++index )
1908 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1910 // Render and notify
1911 application.SendNotification();
1912 application.Render();
1914 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::SMOOTH_SCROLL_DURATION ), 0.1f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1915 DALI_TEST_EQUALS( editor.GetProperty<bool>( TextEditor::Property::SMOOTH_SCROLL ), true, TEST_LOCATION );
1916 DALI_TEST_EQUALS( editor.GetProperty<bool>( TextEditor::Property::ENABLE_SCROLL_BAR ), true, TEST_LOCATION );
1917 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::SCROLL_BAR_SHOW_DURATION ), 0.3f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1918 DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::SCROLL_BAR_FADE_DURATION ), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
1920 // Press Escape to increase coverage
1921 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1922 application.SendNotification();
1923 application.Render();
1925 DALI_TEST_CHECK( !editor.HasKeyInputFocus() );
1930 int utcDaliTextEditorEvent06(void)
1932 ToolkitTestApplication application;
1933 tet_infoline(" utcDaliTextEditorEvent06");
1935 // Checks if the highlight actor is created.
1937 TextEditor editor = TextEditor::New();
1938 DALI_TEST_CHECK( editor );
1940 Stage::GetCurrent().Add( editor );
1942 editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworld\nHello world" );
1943 editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
1944 editor.SetSize( 100.f, 50.f );
1945 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
1946 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1948 // Avoid a crash when core load gl resources.
1949 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
1951 // Render and notify
1952 application.SendNotification();
1953 application.Render();
1955 // Tap on the text editor
1956 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1957 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
1959 // Render and notify
1960 application.SendNotification();
1961 application.Render();
1963 // Move to seconds line of the text.
1964 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1966 // Render and notify
1967 application.SendNotification();
1968 application.Render();
1970 float layoutHeight = editor.GetHeightForWidth( 100.f );
1973 // Add another script characters ( glyph height is defferent )
1974 application.ProcessEvent( GenerateKey( "d", "ㅁ", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1975 application.ProcessEvent( GenerateKey( "d", "ኢ", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1977 // Delete characters
1978 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1979 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1981 DALI_TEST_EQUALS( layoutHeight, editor.GetHeightForWidth( 100.f ), TEST_LOCATION );
1983 // Render and notify
1984 application.SendNotification();
1985 application.Render();
1987 DALI_TEST_EQUALS( "Hello\nworld\nHello world", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
1990 application.ProcessEvent( GenerateKey( "", "", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1991 application.SendNotification();
1992 application.Render();
1994 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1995 application.SendNotification();
1996 application.Render();
1998 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_VOLUME_UP, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
1999 application.SendNotification();
2000 application.Render();
2002 application.ProcessEvent( GenerateKey( "", "", DALI_KEY_VOLUME_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
2003 application.SendNotification();
2004 application.Render();
2009 int utcDaliTextEditorHandles(void)
2011 ToolkitTestApplication application;
2012 tet_infoline(" utcDaliTextEditorHandles");
2014 TextEditor editor = TextEditor::New();
2015 DALI_TEST_CHECK( editor );
2017 Stage::GetCurrent().Add( editor );
2019 editor.SetProperty( TextEditor::Property::TEXT, "This is a long text for the size of the text-editor." );
2020 editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
2021 editor.SetProperty( TextEditor::Property::GRAB_HANDLE_IMAGE, HANDLE_IMAGE_FILE_NAME );
2022 editor.SetProperty( TextEditor::Property::SMOOTH_SCROLL, true );
2024 editor.SetSize( 30.f, 500.f );
2025 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
2026 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
2028 // Avoid a crash when core load gl resources.
2029 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
2031 // Render and notify
2032 application.SendNotification();
2033 application.Render();
2035 // Tap first to get the focus.
2036 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
2037 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
2039 // Render and notify
2040 application.SendNotification();
2041 application.Render();
2043 // Tap to create the grab handle.
2044 application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
2045 application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
2047 // Render and notify
2048 application.SendNotification();
2049 application.Render();
2051 // Get the active layer where the text's decoration is added.
2052 Actor activeLayer = editor.GetChildAt( 1u );
2054 // Get the handle's actor.
2055 Actor handle = activeLayer.GetChildAt( 1u );
2056 handle.SetSize( 100.f, 100.f );
2058 // Render and notify
2059 application.SendNotification();
2060 application.Render();
2062 // Touch the grab handle to set it as pressed.
2063 Vector2 touchPos( 10.0f, 50.0f );
2064 Dali::Integration::TouchEvent event;
2065 event = Dali::Integration::TouchEvent();
2066 event.AddPoint( GetPointDownInside( touchPos ) );
2067 application.ProcessEvent( event );
2069 // Render and notify
2070 application.SendNotification();
2071 application.Render();
2073 // drag grab handle right
2074 SendPan(application, Gesture::Possible, touchPos);
2075 SendPan(application, Gesture::Started, touchPos);
2077 Wait(application, 100);
2079 for(int i = 0;i<20;i++)
2081 SendPan(application, Gesture::Continuing, touchPos);
2086 SendPan(application, Gesture::Finished, touchPos);
2089 // Release the grab handle.
2090 event = Dali::Integration::TouchEvent();
2091 event.AddPoint( GetPointUpInside( touchPos ) );
2092 application.ProcessEvent( event );
2094 // Render and notify
2095 application.SendNotification();
2096 application.Render();
2102 int utcDaliTextEditorUnderPropertyStringP(void)
2104 ToolkitTestApplication application;
2105 tet_infoline(" utcDaliTextEditorUnderPropertyStringP");
2106 TextEditor editor = TextEditor::New();
2107 DALI_TEST_CHECK( editor );
2109 std::string underlineSettings1( "{\"enable\":\"true\",\"color\":\"red\",\"height\":\"1\"}" );
2111 Stage::GetCurrent().Add( editor );
2113 editor.SetProperty( TextEditor::Property::UNDERLINE, underlineSettings1 );
2114 DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::UNDERLINE ), underlineSettings1, TEST_LOCATION );
2116 tet_infoline("Set underline settings with a map");
2117 // Check the input underline property
2118 Property::Map underlineMapSet;
2119 Property::Map underlineMapGet;
2120 underlineMapSet.Insert( "enable", "true" );
2121 underlineMapSet.Insert( "color", "blue" );
2122 underlineMapSet.Insert( "height", "2" );
2124 editor.SetProperty( TextEditor::Property::UNDERLINE, underlineMapSet );
2125 underlineMapGet = editor.GetProperty<Property::Map>( TextEditor::Property::UNDERLINE );
2126 DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
2127 DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapSet, underlineMapGet ), true, TEST_LOCATION );
2129 tet_infoline("Set underline settings with a string");
2130 editor.SetProperty( TextEditor::Property::UNDERLINE, underlineSettings1 );
2131 Property::Value value = editor.GetProperty( TextEditor::Property::UNDERLINE );
2134 DALI_TEST_EQUALS( result , underlineSettings1, TEST_LOCATION );
2136 tet_infoline("Trying to set invalid underline settings, should not update and stay at previous settings");
2137 std::string underlineSettingsVoid( "{\"enable\":\"true\",\"coooolor\":\"blue\",\"heeeight\":\"4\"}" );
2138 editor.SetProperty( TextEditor::Property::UNDERLINE, underlineSettingsVoid );
2139 value = editor.GetProperty( TextEditor::Property::UNDERLINE );
2141 DALI_TEST_EQUALS( result , underlineSettings1, TEST_LOCATION );
2146 int utcDaliTextEditorShadowPropertyStringP(void)
2148 ToolkitTestApplication application;
2149 tet_infoline(" utcDaliTextEditorUnderPropertyStringP Setting Shadow propeties by string");
2151 TextEditor editor = TextEditor::New();
2153 std::string shadowSettings( "{\"color\":\"green\",\"offset\":\"2 2\",\"blurRadius\":\"0\"}" );
2155 Stage::GetCurrent().Add( editor );
2157 editor.SetProperty( TextEditor::Property::SHADOW, "{\"color\":\"green\",\"offset\":\"2 2\",\"blurRadius\":\"0\"}" );
2159 Property::Value value = editor.GetProperty<std::string>( TextEditor::Property::SHADOW );
2163 DALI_TEST_EQUALS( result, shadowSettings, TEST_LOCATION );
2168 int utcDaliTextEditorFontStylePropertyStringP(void)
2170 ToolkitTestApplication application;
2171 tet_infoline(" utcDaliTextEditorFontStylePropertyStringP Setting FontStyle propeties by string");
2173 TextEditor editor = TextEditor::New();
2175 std::string fontStyleSettings( "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
2177 Stage::GetCurrent().Add( editor );
2179 editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
2181 Property::Value value = editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE );
2185 DALI_TEST_EQUALS( result, fontStyleSettings, TEST_LOCATION );
2190 int utcDaliTextEditorGetPropertyLinecountP(void)
2192 ToolkitTestApplication application;
2194 tet_infoline(" utcDaliTextEditorGetPropertyLinecount getting line count property");
2198 TextEditor editor = TextEditor::New();
2199 editor.SetProperty( TextEditor::Property::POINT_SIZE, 10) ;
2200 editor.SetProperty( TextEditor::Property::TEXT,
2201 "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST ");
2203 Stage::GetCurrent().Add( editor );
2205 editor.SetSize( 100.0f, 100.0f );
2206 lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
2207 DALI_TEST_EQUALS( lineCount, 14, TEST_LOCATION );
2209 editor.SetSize( 50.0f, 100.0f );
2210 lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
2211 DALI_TEST_EQUALS( lineCount, 28, TEST_LOCATION );
2216 int utcDaliTextEditorScrollStateChangedSignalTest(void)
2219 ToolkitTestApplication application;
2220 tet_infoline(" UtcDaliTextEditorScrollStateChangedSignalTest");
2222 TextEditor editor = TextEditor::New();
2223 DALI_TEST_CHECK( editor );
2225 Stage::GetCurrent().Add( editor );
2227 editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
2228 editor.SetSize( 50.f, 50.f );
2229 editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
2230 editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
2231 editor.SetProperty( TextEditor::Property::ENABLE_SCROLL_BAR, true );
2232 editor.SetKeyboardFocusable(true);
2234 bool startedCalled = false;
2235 bool finishedCalled = false;
2237 ScrollStateChangeCallback callback( startedCalled, finishedCalled );
2238 editor.ScrollStateChangedSignal().Connect( &callback, &ScrollStateChangeCallback::Callback );
2240 KeyboardFocusManager::Get().SetCurrentFocusActor( editor );
2242 // Render and notify
2243 application.SendNotification();
2244 application.Render();
2246 editor.SetProperty( TextEditor::Property::TEXT, "Long enough message for TextEditor!");
2247 application.SendNotification();
2248 application.Render(6000);
2250 application.SendNotification();
2251 DALI_TEST_EQUALS( startedCalled, true, TEST_LOCATION );
2252 DALI_TEST_EQUALS( finishedCalled, true, TEST_LOCATION );
2257 int UtcDaliToolkitTextEditorTextWrapMode(void)
2259 ToolkitTestApplication application;
2260 tet_infoline(" UtcDaliToolkitTextEditorTextWarpMode");
2264 TextEditor editor = TextEditor::New();
2265 editor.SetSize( 150.0f, 300.f );
2266 editor.SetProperty( TextEditor::Property::TEXT, "Hello world Hello world" );
2268 Stage::GetCurrent().Add( editor );
2270 editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, "WORD" );
2271 DALI_TEST_EQUALS( editor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
2273 application.SendNotification();
2274 application.Render();
2276 lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
2277 DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
2279 editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, "CHARACTER" );
2280 DALI_TEST_EQUALS( editor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
2282 application.SendNotification();
2283 application.Render();
2285 lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
2286 DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );
2288 editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, Text::LineWrap::WORD );
2289 DALI_TEST_EQUALS( editor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
2291 application.SendNotification();
2292 application.Render();
2294 lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
2295 DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
2297 editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, Text::LineWrap::CHARACTER );
2298 DALI_TEST_EQUALS( editor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
2300 application.SendNotification();
2301 application.Render();
2303 lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
2304 DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );