diff options
author | Henry Castro <hcastro@collabora.com> | 2020-05-07 18:45:28 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2020-05-10 18:34:23 +0200 |
commit | 701f62c023e7a8febe3f9d7294d0ca2bec8a13bc (patch) | |
tree | 9f9a7a9db6c62813e03be60a788bb51e13d857a7 | |
parent | 0784df709d5d8d39e2ba3778702466e57e1270d4 (diff) |
lok: override get_state of the MetricFieldObject class
used for unit testing
Change-Id: I7d8ed976837b488bfb22d865583b8d4f1f0978ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93688
Tested-by: Jenkins
Reviewed-by: Henry Castro <hcastro@collabora.com>
-rw-r--r-- | include/vcl/field.hxx | 1 | ||||
-rw-r--r-- | include/vcl/uitest/metricfielduiobject.hxx | 2 | ||||
-rw-r--r-- | vcl/source/control/field.cxx | 6 | ||||
-rw-r--r-- | vcl/source/uitest/uiobject.cxx | 9 |
4 files changed, 18 insertions, 0 deletions
diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx index beb3a30c356f..a8620f876ffd 100644 --- a/include/vcl/field.hxx +++ b/include/vcl/field.hxx @@ -150,6 +150,7 @@ public: sal_Int64 Normalize( sal_Int64 nValue ) const; sal_Int64 Denormalize( sal_Int64 nValue ) const; + OUString GetValueString() const; virtual void SetValueFromString(const OUString& rStr); protected: diff --git a/include/vcl/uitest/metricfielduiobject.hxx b/include/vcl/uitest/metricfielduiobject.hxx index a23c555225a0..21ff7ac88d11 100644 --- a/include/vcl/uitest/metricfielduiobject.hxx +++ b/include/vcl/uitest/metricfielduiobject.hxx @@ -24,6 +24,8 @@ public: virtual void execute(const OUString& rAction, const StringMap& rParameters) override; + virtual StringMap get_state() override; + static std::unique_ptr<UIObject> create(vcl::Window* pWindow); protected: diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index f443abdd2ad7..ff2507e05563 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -625,6 +625,12 @@ sal_Int64 NumericFormatter::GetValueFromString(const OUString& rStr) const return mnLastValue; } +OUString NumericFormatter::GetValueString() const +{ + return Application::GetSettings().GetNeutralLocaleDataWrapper(). + getNum(GetValue(), GetDecimalDigits(), false, false); +} + // currently used by online void NumericFormatter::SetValueFromString(const OUString& rStr) { diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index a387fb41ab02..d4a7855bcf97 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -10,6 +10,7 @@ #include <vcl/uitest/uiobject.hxx> #include <vcl/uitest/metricfielduiobject.hxx> +#include <vcl/svapp.hxx> #include <vcl/combobox.hxx> #include <vcl/event.hxx> #include <vcl/floatwin.hxx> @@ -1317,6 +1318,14 @@ void MetricFieldUIObject::execute(const OUString& rAction, SpinFieldUIObject::execute(rAction, rParameters); } +StringMap MetricFieldUIObject::get_state() +{ + StringMap aMap = EditUIObject::get_state(); + aMap["Value"] = mxMetricField->GetValueString(); + + return aMap; +} + OUString MetricFieldUIObject::get_name() const { return "MetricFieldUIObject"; |