[Libreoffice-commits] core.git: include/vcl vcl/source

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Sun May 10 16:35:09 UTC 2020


 include/vcl/field.hxx                      |    1 +
 include/vcl/uitest/metricfielduiobject.hxx |    2 ++
 vcl/source/control/field.cxx               |    6 ++++++
 vcl/source/uitest/uiobject.cxx             |    9 +++++++++
 4 files changed, 18 insertions(+)

New commits:
commit 701f62c023e7a8febe3f9d7294d0ca2bec8a13bc
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Thu May 7 18:45:28 2020 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Sun May 10 18:34:23 2020 +0200

    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 at collabora.com>

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";


More information about the Libreoffice-commits mailing list