+
+int utcDaliTextEditorEvent05(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorEvent05");
+
+ // Checks if the highlight actor is created.
+
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK( editor );
+
+ Stage::GetCurrent().Add( editor );
+
+ editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworl" );
+ editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
+ editor.SetSize( 50.f, 50.f );
+ editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ editor.SetProperty( DevelTextEditor::Property::SMOOTH_SCROLL, true );
+ editor.SetProperty( DevelTextEditor::Property::SMOOTH_SCROLL_DURATION, 0.2f );
+ editor.SetProperty( DevelTextEditor::Property::ENABLE_SCROLL_BAR, true );
+ editor.SetProperty( DevelTextEditor::Property::SCROLL_BAR_SHOW_DURATION, 0.3f );
+ editor.SetProperty( DevelTextEditor::Property::SCROLL_BAR_FADE_DURATION, 0.2f );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Tap on the text editor
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Move at the end of the text.
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ for( unsigned int index = 0u; index < 10u; ++index )
+ {
+ // Add a character
+ application.ProcessEvent( GenerateKey( "d", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+ }
+ // Modify duration after scroll is enabled
+ editor.SetProperty( DevelTextEditor::Property::SMOOTH_SCROLL_DURATION, 0.1f );
+
+ // Continuous scroll left to increase coverage
+ for( unsigned int index = 0u; index < 10u; ++index )
+ {
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+ }
+ DALI_TEST_EQUALS( editor.GetProperty<float>( DevelTextEditor::Property::SMOOTH_SCROLL_DURATION ), 0.1f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( editor.GetProperty<bool>( DevelTextEditor::Property::SMOOTH_SCROLL ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( editor.GetProperty<bool>( DevelTextEditor::Property::ENABLE_SCROLL_BAR ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( editor.GetProperty<float>( DevelTextEditor::Property::SCROLL_BAR_SHOW_DURATION ), 0.3f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( editor.GetProperty<float>( DevelTextEditor::Property::SCROLL_BAR_FADE_DURATION ), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ // Press Escape to increase coverage
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( !editor.HasKeyInputFocus() );
+
+ END_TEST;
+}
+
+int utcDaliTextEditorHandles(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorHandles");
+
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK( editor );
+
+ Stage::GetCurrent().Add( editor );
+
+ editor.SetProperty( TextEditor::Property::TEXT, "This is a long text for the size of the text-editor." );
+ editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
+ editor.SetProperty( TextEditor::Property::GRAB_HANDLE_IMAGE, HANDLE_IMAGE_FILE_NAME );
+ editor.SetProperty( DevelTextEditor::Property::SMOOTH_SCROLL, true );
+
+ editor.SetSize( 30.f, 500.f );
+ editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Tap first to get the focus.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Tap to create the grab handle.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Get the active layer where the text's decoration is added.
+ Actor activeLayer = editor.GetChildAt( 1u );
+
+ // Get the handle's actor.
+ Actor handle = activeLayer.GetChildAt( 1u );
+ handle.SetSize( 100.f, 100.f );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Touch the grab handle to set it as pressed.
+ Vector2 touchPos( 10.0f, 50.0f );
+ Dali::Integration::TouchEvent event;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( GetPointDownInside( touchPos ) );
+ application.ProcessEvent( event );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // drag grab handle right
+ SendPan(application, Gesture::Possible, touchPos);
+ SendPan(application, Gesture::Started, touchPos);
+ touchPos.x += 5.0f;
+ Wait(application, 100);
+
+ for(int i = 0;i<20;i++)
+ {
+ SendPan(application, Gesture::Continuing, touchPos);
+ touchPos.x += 5.0f;
+ Wait(application);
+ }
+
+ SendPan(application, Gesture::Finished, touchPos);
+ Wait(application);
+
+ // Release the grab handle.
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( GetPointUpInside( touchPos ) );
+ application.ProcessEvent( event );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ END_TEST;
+}
+