[dali-toolkit] fix set max character length when text already set 22/246622/12
authora.ghujeh <a.ghujeh@samsung.com>
Mon, 2 Nov 2020 14:05:47 +0000 (16:05 +0200)
committerabdullah <abdullahhasan10@gmail.com>
Tue, 6 Apr 2021 14:52:23 +0000 (17:52 +0300)
commit6864703aa51cfa5aee093145833566ddf91dd910
treeb4a5e4a75b505a91f7f89619c8e8ed68a471ec89
parente7ec909c5ff33b751a8d92d0f38f7f9c2c0ccf2e
[dali-toolkit] fix set max character length when text already set

class SimpleApp : public ConnectionTracker
{
  Window window;
  TextField mTextField;
public:
  SimpleApp(Application& application)
  : mApplication(application)
  {
    mApplication.InitSignal().Connect(this, &SimpleApp::Create);
  }

  void Create(Application& application)
  {
    window = application.GetWindow();
    window.SetBackgroundColor(Vector4(0.04f, 0.345f, 0.392f, 1.0f));

    mTextField = TextField::New();
    mTextField.SetBackgroundColor(Color::WHITE);
    mTextField.SetProperty(TextField::Property::TEXT_COLOR, Color::BLACK);
    mTextField.SetProperty(TextField::Property::TEXT, "123456789");
    mTextField.SetProperty(TextField::Property::MAX_LENGTH, 3);
    mTextField.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
    mTextField.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
    mTextField.SetProperty(Actor::Property::SIZE, Vector2(140.f, 50.f));
    mTextField.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));

    window.Add(mTextField);
  }

private:
  Application& mApplication;
};

int DALI_EXPORT_API main(int argc, char** argv)
{
  Application application = Application::New(&argc, &argv);
  SimpleApp test(application);
  application.MainLoop();

  return 0;
}

Change-Id: I03ddf782eadb0d816e613aea6ef09a1133d7230e
automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp
dali-toolkit/internal/text/text-controller-text-updater.cpp