diff --git a/cui/source/tabpages/measure.cxx b/cui/source/tabpages/measure.cxx index 7ac2ef7f0433..6ef6d5211ae5 100644 --- a/cui/source/tabpages/measure.cxx +++ b/cui/source/tabpages/measure.cxx @@ -124,6 +124,8 @@ SvxMeasurePage::SvxMeasurePage(weld::Container* pPage, weld::DialogController* p m_xMtrFldHelpline2Len->connect_value_changed(aLink); m_xMtrFldHelpline2Len->set_range(-10000, 10000, FieldUnit::MM); m_xMtrFldDecimalPlaces->connect_value_changed(LINK(this, SvxMeasurePage, ChangeAttrSpinHdl_Impl)); + // tdf#171746 - limit number of decimal places to prevent numeric overflow + m_xMtrFldDecimalPlaces->set_range(0, 5); m_xTsbBelowRefEdge->connect_toggled(LINK(this, SvxMeasurePage, ChangeAttrClickHdl_Impl)); m_xTsbParallel->connect_toggled( LINK( this, SvxMeasurePage, ChangeAttrClickHdl_Impl)); m_xTsbShowUnit->connect_toggled(LINK(this, SvxMeasurePage, ChangeAttrClickHdl_Impl)); diff --git a/sd/qa/uitest/impress_tests/dimensionLinesTabPage.py b/sd/qa/uitest/impress_tests/dimensionLinesTabPage.py new file mode 100644 index 000000000000..e7b10abcaa1e --- /dev/null +++ b/sd/qa/uitest/impress_tests/dimensionLinesTabPage.py @@ -0,0 +1,29 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class dimensionLinesTabPage(UITestCase): + + def test_tdf171746_number_decimal_places_limit(self): + with self.ui_test.create_doc_in_start_center("draw"): + xArgs = mkPropertyValues({"KeyModifier": 8192}) + self.xUITest.executeCommandWithParameters(".uno:MeasureLine", xArgs) + + with self.ui_test.execute_dialog_through_command(".uno:measureAttributes") as xDialog: + xDecimalPlaces = xDialog.getChild("MTR_FLD_DECIMALPLACES") + for _ in range(5): + xDecimalPlaces.executeAction("UP", tuple()) + # Without the fix in place, this test would have failed with + # AssertionError: '5' != '7' + self.assertEqual(get_state_as_dict(xDecimalPlaces)["Text"], "5") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file