[Libreoffice-commits] core.git: sc/qa sc/source

Andreas Heinisch (via logerrit) logerrit at kemper.freedesktop.org
Thu Mar 11 10:07:51 UTC 2021


 sc/qa/uitest/calc_tests3/tdf89754.py |   45 +++++++++++++++++++++++++++++++++++
 sc/source/core/data/table4.cxx       |    7 +++++
 2 files changed, 52 insertions(+)

New commits:
commit 3ba901f050d262cdeccefa5b21b0d32aa7332dc7
Author:     Andreas Heinisch <andreas.heinisch at yahoo.de>
AuthorDate: Sat Mar 6 10:38:43 2021 +0100
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Thu Mar 11 11:07:07 2021 +0100

    tdf#89754 - don't increment non different consecutive date cells
    
    Change-Id: I6fedc0fe286ebe8b0110360391e8d3325fc2ca25
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112054
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/qa/uitest/calc_tests3/tdf89754.py b/sc/qa/uitest/calc_tests3/tdf89754.py
new file mode 100644
index 000000000000..855688c8f45b
--- /dev/null
+++ b/sc/qa/uitest/calc_tests3/tdf89754.py
@@ -0,0 +1,45 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# 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 uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+#tdf#89754 - EDITING: 'Autofill - Date' don't increment non different consecutive date cells
+
+class tdf89754(UITestCase):
+
+    def test_tdf89754_autofill_date(self):
+        calc_doc = self.ui_test.create_doc_in_start_center("calc")
+        xCalcDoc = self.xUITest.getTopFocusWindow()
+        gridwin = xCalcDoc.getChild("grid_window")
+        document = self.ui_test.get_component()
+
+        #1 - A1: 2012-10-31 and A2: 2012-10-31
+        enter_text_to_cell(gridwin, "A1", "2012-10-31")
+        enter_text_to_cell(gridwin, "A2", "2012-10-31")
+
+        #2 - Select A1:A5
+        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
+
+        #3 - Edit -> fill -> Series -> Down
+        self.ui_test.execute_dialog_through_command(".uno:FillSeries")
+        xDialog = self.xUITest.getTopFocusWindow()
+        xOK = xDialog.getChild("ok")
+        self.ui_test.close_dialog_through_button(xOK)
+
+        #4 - Expected: All Cells show the initial date
+        self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 41213)
+        self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 41213)
+        self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 41213)
+        self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 41213)
+        self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 41213)
+
+        self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 4db88f60bb7c..02e6c1c31d83 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -588,6 +588,13 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                         rInc = nCmpInc;
                     }
                 }
+                else
+                {
+                    // tdf#89754 - don't increment non different consecutive date cells
+                    rCmd = FILL_DATE;
+                    rDateCmd = FILL_DAY;
+                    rInc = 0.0;
+                }
             }
             else                            // single date -> increment by days
             {


More information about the Libreoffice-commits mailing list