tdf#171746 - Limit number of decimal places to prevent numeric overflow
In the dimension lines tab page, limit number of decimal places to prevent numeric overflow in the preview image. Change-Id: I0205e045d6baa84e7419f7d90e17f44f8290ba7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203603 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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:
|
||||
Reference in New Issue
Block a user