Ensure text-controller returns false when it doesn't use key. 97/140597/2
authorminho.sun <minho.sun@samsung.com>
Tue, 25 Jul 2017 13:23:24 +0000 (22:23 +0900)
committerminho.sun <minho.sun@samsung.com>
Wed, 26 Jul 2017 06:28:38 +0000 (15:28 +0900)
Ensure text-controller returns false when it doesn't use key.
Plus, add tct cases for coverage.

Change-Id: I328af4c216e22cf7a3aff2d5ce2dea3780168f3a
Signed-off-by: minho.sun <minho.sun@samsung.com>
automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp
dali-toolkit/internal/text/text-controller.cpp

index a052525..3fd4bd6 100644 (file)
@@ -1930,7 +1930,22 @@ int utcDaliTextEditorEvent06(void)
 
   DALI_TEST_EQUALS( "Hello\nworld\nHello world", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
 
 
   DALI_TEST_EQUALS( "Hello\nworld\nHello world", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
 
+  // For coverage
+  application.ProcessEvent( GenerateKey( "", "", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+  application.SendNotification();
+  application.Render();
+
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+  application.SendNotification();
+  application.Render();
 
 
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_VOLUME_UP, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+  application.SendNotification();
+  application.Render();
+
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_VOLUME_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+  application.SendNotification();
+  application.Render();
 
   END_TEST;
 }
 
   END_TEST;
 }
index feb620b..64e6a55 100644 (file)
@@ -2219,6 +2219,7 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
     {
       // In some platforms arrive key events with no key code.
       // Do nothing.
     {
       // In some platforms arrive key events with no key code.
       // Do nothing.
+      return false;
     }
     else if( Dali::DALI_KEY_ESCAPE == keyCode )
     {
     }
     else if( Dali::DALI_KEY_ESCAPE == keyCode )
     {
@@ -2288,11 +2289,13 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
       // and a character is typed after the type of a upper case latin character.
 
       // Do nothing.
       // and a character is typed after the type of a upper case latin character.
 
       // Do nothing.
+      return false;
     }
     else if( ( Dali::DALI_KEY_VOLUME_UP == keyCode ) || ( Dali::DALI_KEY_VOLUME_DOWN == keyCode ) )
     {
       // This branch avoids calling the InsertText() method of the 'else' branch which can delete selected text.
       // Do nothing.
     }
     else if( ( Dali::DALI_KEY_VOLUME_UP == keyCode ) || ( Dali::DALI_KEY_VOLUME_DOWN == keyCode ) )
     {
       // This branch avoids calling the InsertText() method of the 'else' branch which can delete selected text.
       // Do nothing.
+      return false;
     }
     else
     {
     }
     else
     {