Revert "[Tizen] Add parameter (bool immediate) to TextChanged signal in interface"
authorBowon Ryu <bowon.ryu@samsung.com>
Tue, 30 Mar 2021 04:29:57 +0000 (13:29 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Tue, 30 Mar 2021 04:29:57 +0000 (13:29 +0900)
This reverts commit 0250415b791ea823d1f63d32644b194396ca500e.

automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp
dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp
dali-toolkit/internal/controls/text-controls/text-editor-impl.h
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.h
dali-toolkit/internal/text/text-controller-event-handler.cpp
dali-toolkit/internal/text/text-controller-text-updater.cpp
dali-toolkit/internal/text/text-editable-control-interface.h

index 4a0c12d..06d3307 100644 (file)
@@ -964,27 +964,36 @@ int utcDaliTextEditorTextChangedP(void)
 
   gTextChangedCallBackCalled = false;
   editor.SetProperty( TextEditor::Property::TEXT, "ABC" );
+  application.SendNotification();
+  application.Render();
   DALI_TEST_CHECK( gTextChangedCallBackCalled );
   DALI_TEST_CHECK( textChangedSignal );
 
-  application.SendNotification();
   editor.SetKeyInputFocus();
 
   gTextChangedCallBackCalled = false;
   application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.SendNotification();
+  application.Render();
   DALI_TEST_CHECK( gTextChangedCallBackCalled );
 
   // Remove all text
   editor.SetProperty( TextField::Property::TEXT, "" );
+  application.SendNotification();
+  application.Render();
 
   // Pressing backspace key: TextChangedCallback should not be called when there is no text in texteditor.
   gTextChangedCallBackCalled = false;
   application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.SendNotification();
+  application.Render();
   DALI_TEST_CHECK( !gTextChangedCallBackCalled );
 
   // Pressing delete key: TextChangedCallback should not be called when there is no text in texteditor.
   gTextChangedCallBackCalled = false;
   application.ProcessEvent( GenerateKey( "", "", "", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "Delete", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.SendNotification();
+  application.Render();
   DALI_TEST_CHECK( !gTextChangedCallBackCalled );
 
   END_TEST;
index e81752e..0795816 100644 (file)
@@ -1034,27 +1034,36 @@ int utcDaliTextFieldTextChangedP(void)
 
   gTextChangedCallBackCalled = false;
   field.SetProperty( TextField::Property::TEXT, "ABC" );
+  application.SendNotification();
+  application.Render();
   DALI_TEST_CHECK( gTextChangedCallBackCalled );
   DALI_TEST_CHECK( textChangedSignal );
 
-  application.SendNotification();
   field.SetKeyInputFocus();
 
   gTextChangedCallBackCalled = false;
   application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.SendNotification();
+  application.Render();
   DALI_TEST_CHECK( gTextChangedCallBackCalled );
 
   // Remove all text
   field.SetProperty( TextField::Property::TEXT, "" );
+  application.SendNotification();
+  application.Render();
 
   // Pressing backspace key: TextChangedCallback should not be called when there is no text in textfield.
   gTextChangedCallBackCalled = false;
   application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.SendNotification();
+  application.Render();
   DALI_TEST_CHECK( !gTextChangedCallBackCalled );
 
   // Pressing delete key: TextChangedCallback should not be called when there is no text in textfield.
   gTextChangedCallBackCalled = false;
   application.ProcessEvent( GenerateKey( "", "", "", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "Delete", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.SendNotification();
+  application.Render();
   DALI_TEST_CHECK( !gTextChangedCallBackCalled );
 
   END_TEST;
index 9f70e6a..3d48333 100644 (file)
@@ -1450,7 +1450,9 @@ void TextEditor::OnRelayout(const Vector2& size, RelayoutContainer& container)
     // If there is text changed, callback is called.
     if(mTextChanged)
     {
-      EmitTextChangedSignal();
+      Dali::Toolkit::TextEditor handle(GetOwner());
+      mTextChangedSignal.Emit(handle);
+      mTextChanged = false;
     }
   }
 
@@ -1665,23 +1667,9 @@ void TextEditor::CaretMoved(unsigned int position)
   }
 }
 
-void TextEditor::TextChanged(bool immediate)
+void TextEditor::TextChanged()
 {
-  if(immediate) // Emits TextChangedSignal immediately
-  {
-    EmitTextChangedSignal();
-  }
-  else
-  {
-    mTextChanged = true;
-  }
-}
-
-void TextEditor::EmitTextChangedSignal()
-{
-  Dali::Toolkit::TextEditor handle(GetOwner());
-  mTextChangedSignal.Emit(handle);
-  mTextChanged = false;
+  mTextChanged = true;
 }
 
 void TextEditor::MaxLengthReached()
index a8b9a0c..4c408ca 100644 (file)
@@ -205,7 +205,7 @@ private: // From Control
   /**
    * @copydoc Text::EditableControlInterface::TextChanged()
    */
-  void TextChanged(bool immediate) override;
+  void TextChanged() override;
 
   /**
    * @copydoc Text::EditableControlInterface::MaxLengthReached()
@@ -329,11 +329,6 @@ private: // Implementation
   void OnIdleSignal();
 
   /**
-   * @brief Emits TextChanged signal.
-   */
-  void EmitTextChangedSignal();
-
-  /**
    * @brief set RenderActor's position with new scrollPosition
    *
    * Apply updated scroll position or start scroll animation if VerticalScrollAnimation is enabled
@@ -407,7 +402,7 @@ private: // Data
   bool  mScrollAnimationEnabled : 1;
   bool  mScrollBarEnabled : 1;
   bool  mScrollStarted : 1;
-  bool  mTextChanged : 1; ///< If true, emits TextChangedSignal in next OnRelayout().
+  bool  mTextChanged : 1;
 
   struct AccessibleImpl : public DevelControl::AccessibleImpl,
                           public virtual Dali::Accessibility::Text,
index f15f137..131cc73 100644 (file)
@@ -1403,7 +1403,9 @@ void TextField::OnRelayout(const Vector2& size, RelayoutContainer& container)
     // If there is text changed, callback is called.
     if(mTextChanged)
     {
-      EmitTextChangedSignal();
+      Dali::Toolkit::TextField handle(GetOwner());
+      mTextChangedSignal.Emit(handle);
+      mTextChanged = false;
     }
   }
 
@@ -1712,23 +1714,9 @@ void TextField::CaretMoved(unsigned int position)
   }
 }
 
-void TextField::TextChanged(bool immediate)
+void TextField::TextChanged()
 {
-  if(immediate) // Emits TextChangedSignal immediately
-  {
-    EmitTextChangedSignal();
-  }
-  else
-  {
-    mTextChanged = true;
-  }
-}
-
-void TextField::EmitTextChangedSignal()
-{
-  Dali::Toolkit::TextField handle(GetOwner());
-  mTextChangedSignal.Emit(handle);
-  mTextChanged = false;
+  mTextChanged = true;
 }
 
 void TextField::MaxLengthReached()
index 75b6f99..ad5c6b8 100644 (file)
@@ -198,7 +198,7 @@ private: // From Control
   /**
    * @copydoc Text::EditableControlInterface::TextChanged()
    */
-  void TextChanged(bool immediate) override;
+  void TextChanged() override;
 
   /**
    * @copydoc Text::EditableControlInterface::MaxLengthReached()
@@ -300,11 +300,6 @@ private: // Implementation
   void OnIdleSignal();
 
   /**
-   * @brief Emits TextChanged signal.
-   */
-  void EmitTextChangedSignal();
-
-  /**
    * Construct a new TextField.
    */
   TextField();
@@ -364,7 +359,7 @@ private: // Data
   int   mRenderingBackend;
   int   mExceedPolicy;
   bool  mHasBeenStaged : 1;
-  bool  mTextChanged : 1; ///< If true, emits TextChangedSignal in next OnRelayout().
+  bool  mTextChanged : 1;
 
 protected:
   struct AccessibleImpl : public DevelControl::AccessibleImpl,
index ce0bf59..c6c4058 100644 (file)
@@ -287,7 +287,7 @@ bool Controller::EventHandler::KeyEvent(Controller& controller, const Dali::KeyE
      (NULL != controller.mImpl->mEditableControlInterface))
   {
     // Do this last since it provides callbacks into application code
-    controller.mImpl->mEditableControlInterface->TextChanged(false);
+    controller.mImpl->mEditableControlInterface->TextChanged();
   }
 
   return true;
@@ -742,7 +742,7 @@ InputMethodContext::CallbackData Controller::EventHandler::OnInputMethodContextE
      (NULL != controller.mImpl->mEditableControlInterface))
   {
     // Do this last since it provides callbacks into application code
-    controller.mImpl->mEditableControlInterface->TextChanged(false);
+    controller.mImpl->mEditableControlInterface->TextChanged();
   }
 
   return callbackData;
@@ -852,7 +852,7 @@ void Controller::EventHandler::TextPopupButtonTouched(Controller& controller, Da
 
       if(NULL != controller.mImpl->mEditableControlInterface)
       {
-        controller.mImpl->mEditableControlInterface->TextChanged(true);
+        controller.mImpl->mEditableControlInterface->TextChanged();
       }
       break;
     }
index 6fb472e..c22e207 100644 (file)
@@ -153,7 +153,7 @@ void Controller::TextUpdater::SetText(Controller& controller, const std::string&
   // Do this last since it provides callbacks into application code.
   if(NULL != impl.mEditableControlInterface)
   {
-    impl.mEditableControlInterface->TextChanged(true);
+    impl.mEditableControlInterface->TextChanged();
   }
 }
 
@@ -433,7 +433,7 @@ void Controller::TextUpdater::PasteText(Controller& controller, const std::strin
   if(NULL != impl.mEditableControlInterface)
   {
     // Do this last since it provides callbacks into application code
-    impl.mEditableControlInterface->TextChanged(true);
+    impl.mEditableControlInterface->TextChanged();
   }
 }
 
index 4bd0de0..0f55494 100644 (file)
@@ -59,10 +59,8 @@ public:
 
   /**
    * @brief Called to signal that text has been inserted or deleted.
-   * 
-   * @param[in] immediate If true, it immediately emits the signal, if false, only emits once the signal when OnRelayout() is called next time.
    */
-  virtual void TextChanged(bool immediate) = 0;
+  virtual void TextChanged() = 0;
 
   /**
    * @brief Called when the number of characters to be inserted exceeds the maximum limit