Update common test util
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-imf-manager.cpp
index 355b3ed..edb97ba 100644 (file)
@@ -1,28 +1,26 @@
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 // CLASS HEADER
 #include "toolkit-imf-manager.h"
 
 // EXTERNAL INCLUDES
-#include <boost/bind.hpp>
-
-#include <dali/dali.h>
+#include <dali/public-api/object/base-object.h>
 #include <dali/integration-api/debug.h>
-#include <dali/integration-api/events/key-event-integ.h>
 
 namespace Dali
 {
@@ -36,8 +34,10 @@ class RenderSurface;
 class ImfManager : public Dali::BaseObject
 {
 public:
-  typedef Dali::ImfManager::ImfManagerSignalV2 ImfManagerSignalV2;
-  typedef Dali::ImfManager::ImfEventSignalV2 ImfEventSignalV2;
+  typedef Dali::ImfManager::ImfManagerSignalType ImfManagerSignalType;
+  typedef Dali::ImfManager::ImfEventSignalType ImfEventSignalType;
+  typedef Dali::ImfManager::StatusSignalType ImfStatusSignalType;
+  typedef Dali::ImfManager::VoidSignalType ImfVoidSignalType;
 
 public:
   static Dali::ImfManager Get();
@@ -50,16 +50,20 @@ public:
   void Reset();
 
   bool RestoreAfterFocusLost() const;
-  void SetRestoreAferFocusLost( bool toggle );
+  void SetRestoreAfterFocusLost( bool toggle );
   void NotifyCursorPosition();
-  int GetCursorPosition();
   void SetCursorPosition( unsigned int cursorPosition );
-  void SetSurroundingText( std::string text );
-  std::string GetSurroundingText();
+  unsigned int GetCursorPosition() const;
+  void SetSurroundingText( const std::string& text );
+  const std::string& GetSurroundingText() const;
+  void ApplyOptions( const InputMethodOptions& options );
 
 public:  // Signals
-  ImfManagerSignalV2& ActivatedSignal() { return mActivatedSignalV2; }
-  ImfEventSignalV2& EventReceivedSignal() { return mEventSignalV2; }
+  ImfManagerSignalType& ActivatedSignal() { return mActivatedSignal; }
+  ImfEventSignalType& EventReceivedSignal() { return mEventSignal; }
+  ImfStatusSignalType& StatusChangedSignal() { return mKeyboardStatusSignal; }
+  ImfVoidSignalType& ResizedSignal() { return mKeyboardResizeSignal; }
+  ImfVoidSignalType& LanguageChangedSignal() { return mKeyboardLanguageChangedSignal; }
 
 protected:
   virtual ~ImfManager();
@@ -78,11 +82,13 @@ private:
   std::string mSurroundingText;
   bool mRestoreAfterFocusLost:1;             ///< Whether the keyboard needs to be restored (activated ) after focus regained.
   bool mIdleCallbackConnected:1;             ///< Whether the idle callback is already connected.
+  InputMethodOptions        mOptions;
 
-  std::vector<Dali::Integration::KeyEvent> mKeyEvents; ///< Stores key events to be sent from idle call-back.
-  ImfManagerSignalV2      mActivatedSignalV2;
-  ImfEventSignalV2        mEventSignalV2;
-
+  ImfManagerSignalType      mActivatedSignal;
+  ImfEventSignalType        mEventSignal;
+  ImfStatusSignalType       mKeyboardStatusSignal;
+  ImfVoidSignalType         mKeyboardResizeSignal;
+  ImfVoidSignalType         mKeyboardLanguageChangedSignal;
 
   static Dali::ImfManager mToolkitImfManager;
 
@@ -121,10 +127,9 @@ Dali::ImfManager ImfManager::Get()
 
 ImfManager::ImfManager( /*Ecore_X_Window ecoreXwin*/ )
 : mIMFCursorPosition( 0 ),
-  mSurroundingText(""),
+  mSurroundingText(),
   mRestoreAfterFocusLost( false ),
-  mIdleCallbackConnected( false ),
-  mKeyEvents()
+  mIdleCallbackConnected( false )
 {
   CreateContext( /*ecoreXwin*/ );
   ConnectCallbacks();
@@ -170,7 +175,7 @@ bool ImfManager::RestoreAfterFocusLost() const
   return mRestoreAfterFocusLost;
 }
 
-void ImfManager::SetRestoreAferFocusLost( bool toggle )
+void ImfManager::SetRestoreAfterFocusLost( bool toggle )
 {
   mRestoreAfterFocusLost = toggle;
 }
@@ -179,26 +184,30 @@ void ImfManager::NotifyCursorPosition()
 {
 }
 
-int ImfManager::GetCursorPosition()
+void ImfManager::SetCursorPosition( unsigned int cursorPosition )
 {
-  return mIMFCursorPosition;
+  mIMFCursorPosition = static_cast< int >( cursorPosition );
 }
 
-void ImfManager::SetCursorPosition( unsigned int cursorPosition )
+unsigned int ImfManager::GetCursorPosition() const
 {
-  mIMFCursorPosition = ( int )cursorPosition;
+  return static_cast<unsigned int>( mIMFCursorPosition );
 }
 
-void ImfManager::SetSurroundingText( std::string text )
+void ImfManager::SetSurroundingText( const std::string& text )
 {
   mSurroundingText = text;
 }
 
-std::string ImfManager::GetSurroundingText()
+const std::string& ImfManager::GetSurroundingText() const
 {
   return mSurroundingText;
 }
 
+void ImfManager::ApplyOptions( const InputMethodOptions& options )
+{
+}
+
 } // Adaptor
 
 } // Internal
@@ -221,11 +230,6 @@ ImfManager ImfManager::Get()
   return Internal::Adaptor::ImfManager::Get();
 }
 
-ImfContext ImfManager::GetContext()
-{
-  return NULL;
-}
-
 void ImfManager::Activate()
 {
   Internal::Adaptor::ImfManager::GetImplementation(*this).Activate();
@@ -241,9 +245,9 @@ bool ImfManager::RestoreAfterFocusLost() const
   return Internal::Adaptor::ImfManager::GetImplementation(*this).RestoreAfterFocusLost();
 }
 
-void ImfManager::SetRestoreAferFocusLost( bool toggle )
+void ImfManager::SetRestoreAfterFocusLost( bool toggle )
 {
-  Internal::Adaptor::ImfManager::GetImplementation(*this).SetRestoreAferFocusLost( toggle );
+  Internal::Adaptor::ImfManager::GetImplementation(*this).SetRestoreAfterFocusLost( toggle );
 }
 
 void ImfManager::Reset()
@@ -261,31 +265,55 @@ void ImfManager::SetCursorPosition( unsigned int SetCursorPosition )
   Internal::Adaptor::ImfManager::GetImplementation(*this).SetCursorPosition( SetCursorPosition );
 }
 
-int ImfManager::GetCursorPosition()
+unsigned int ImfManager::GetCursorPosition() const
 {
   return Internal::Adaptor::ImfManager::GetImplementation(*this).GetCursorPosition();
 }
 
-void ImfManager::SetSurroundingText( std::string text )
+void ImfManager::SetSurroundingText( const std::string& text )
 {
   Internal::Adaptor::ImfManager::GetImplementation(*this).SetSurroundingText( text );
 }
 
-std::string ImfManager::GetSurroundingText()
+const std::string& ImfManager::GetSurroundingText() const
 {
   return Internal::Adaptor::ImfManager::GetImplementation(*this).GetSurroundingText();
 }
 
-ImfManager::ImfManagerSignalV2& ImfManager::ActivatedSignal()
+void ImfManager::NotifyTextInputMultiLine( bool multiLine )
+{
+}
+
+void ImfManager::ApplyOptions( const InputMethodOptions& options )
+{
+  Internal::Adaptor::ImfManager::GetImplementation(*this).ApplyOptions( options );
+}
+
+ImfManager::ImfManagerSignalType& ImfManager::ActivatedSignal()
 {
   return Internal::Adaptor::ImfManager::GetImplementation(*this).ActivatedSignal();
 }
 
-ImfManager::ImfEventSignalV2& ImfManager::EventReceivedSignal()
+ImfManager::ImfEventSignalType& ImfManager::EventReceivedSignal()
 {
   return Internal::Adaptor::ImfManager::GetImplementation(*this).EventReceivedSignal();
 }
 
+ImfManager::StatusSignalType& ImfManager::StatusChangedSignal()
+{
+  return Internal::Adaptor::ImfManager::GetImplementation(*this).StatusChangedSignal();
+}
+
+ImfManager::VoidSignalType& ImfManager::ResizedSignal()
+{
+  return Internal::Adaptor::ImfManager::GetImplementation(*this).ResizedSignal();
+}
+
+ImfManager::VoidSignalType& ImfManager::LanguageChangedSignal()
+{
+  return Internal::Adaptor::ImfManager::GetImplementation(*this).LanguageChangedSignal();
+}
+
 ImfManager::ImfManager(Internal::Adaptor::ImfManager *impl)
   : BaseHandle(impl)
 {