sc/qa/uitest/calc_tests2/tdf165846.py                          |   32 
++++++++++
 sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx |    3 
 2 files changed, 35 insertions(+)

New commits:
commit dedaf2a87bca8b903fc42f441c7185921cf03312
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Mon Sep 15 18:07:55 2025 +0200
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Tue Sep 16 21:11:53 2025 +0200

    tdf#165846 - Ensure degrees of freedom (nu value) is greater than 0
    
    Change-Id: I900d0b5436bc9417e4f91eac1434c8ae79bd70a1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190988
    Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de>
    Tested-by: Jenkins

diff --git a/sc/qa/uitest/calc_tests2/tdf165846.py 
b/sc/qa/uitest/calc_tests2/tdf165846.py
new file mode 100644
index 000000000000..d17e5aad5832
--- /dev/null
+++ b/sc/qa/uitest/calc_tests2/tdf165846.py
@@ -0,0 +1,32 @@
+# -*- 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 select_by_text
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+# Bug 165846 - Ensure degrees of freedom (nu value) is greater than 0
+class tdf165846(UITestCase):
+    def test_tdf165846_nu_min_value(self):
+        with self.ui_test.create_doc_in_start_center("calc"):
+            with 
self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog")
 as xDialog:
+                # Select chi squared distribution
+                xDistributionCombo = xDialog.getChild("distribution-combo")
+                select_by_text(xDistributionCombo, "Chi Squared")
+
+                # Select an incorrect degrees of freedom (nu) value
+                xParameter1Spin = xDialog.getChild("parameter1-spin")
+                xParameter1Spin.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
+                xParameter1Spin.executeAction("DOWN", tuple())
+
+                # Without the fix in place, this test would have failed with
+                # AssertionError: '0.0001' != '-1.0000'
+                self.assertEqual("0.0001", 
get_state_as_dict(xParameter1Spin)["Text"])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx 
b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
index 60d88fb06d03..6d953affb021 100644
--- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
@@ -469,6 +469,9 @@ IMPL_LINK_NOARG(ScRandomNumberGeneratorDialog, 
DistributionChanged, weld::ComboB
         case DIST_CHI_SQUARED:
         {
             
mxParameter1Text->set_label(ScResId(STR_RNG_PARAMETER_STANDARD_NU_VALUE));
+            // tdf#165846 - ensure degrees of freedom (nu value) is greater 
than 0
+            mxParameter1Value->set_min(1);
+            mxParameter1Value->set_value(PRECISION);
 
             mxParameter2Text->hide();
             mxParameter2Value->hide();

Reply via email to