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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 12 14:25:14 UTC 2021


 sc/qa/uitest/calc_tests2/tdf105268.py |   35 ----------------------------------
 sc/qa/unit/ucalc.cxx                  |   14 +++++++++++++
 2 files changed, 14 insertions(+), 35 deletions(-)

New commits:
commit 1af1458fa44c6ed9f73a68696f494657ef8e2bc5
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Mar 12 12:09:42 2021 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Mar 12 15:24:25 2021 +0100

    tdf#105268: sc: move UItest to CppUnittest
    
    Change-Id: I90d896b14b7e75d1586aa4ea329b0d80a32d45fe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112380
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/qa/uitest/calc_tests2/tdf105268.py b/sc/qa/uitest/calc_tests2/tdf105268.py
deleted file mode 100644
index f501e3511048..000000000000
--- a/sc/qa/uitest/calc_tests2/tdf105268.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# -*- 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.common import select_pos
-from uitest.uihelper.calc import enter_text_to_cell
-from libreoffice.calc.document import get_cell_by_position
-from libreoffice.uno.propertyvalue import mkPropertyValues
-#Bug 105268 - Auto Fill: The Next Value for "001-001-001" is "001-001-002" Rather than "001-001000"
-
-class tdf105268(UITestCase):
-    def test_tdf105268(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()
-        enter_text_to_cell(gridwin, "A1", "001-001-001")
-        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"}))
-        self.ui_test.execute_dialog_through_command(".uno:FillSeries")
-        xDialog = self.xUITest.getTopFocusWindow()
-        xautofill = xDialog.getChild("autofill")
-        xautofill.executeAction("CLICK", tuple())
-        xOK = xDialog.getChild("ok")
-        self.ui_test.close_dialog_through_button(xOK)
-        self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "001-001-001")
-        self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "001-001-002")
-        self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "001-001-003")
-
-        self.ui_test.close_doc()
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 57525bea2c3a..5fab68bcf3f1 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4989,6 +4989,20 @@ void Test::testAutoFill()
     CPPUNIT_ASSERT_EQUAL( OUString("4.5"), m_pDoc->GetString( 0, 65, 0 ) );
     CPPUNIT_ASSERT_EQUAL( OUString("4.6"), m_pDoc->GetString( 0, 66, 0 ) );
 
+    // Clear column A for a new test.
+    clearRange(m_pDoc, ScRange(0,0,0,0,MAXROW,0));
+    m_pDoc->SetRowHidden(0, MAXROW, 0, false); // Show all rows.
+
+    m_pDoc->SetString( 0, 70, 0, "001-001-001" );
+    m_pDoc->Fill( 0, 70, 0, 70, nullptr, aMarkData, 3, FILL_TO_BOTTOM, FILL_AUTO );
+
+    // tdf#105268: Without the fix in place, this test would have failed with
+    // - Expected: 001-001-002
+    // - Actual  : 001-001000
+    CPPUNIT_ASSERT_EQUAL( OUString("001-001-002"), m_pDoc->GetString( 0, 71, 0 ) );
+    CPPUNIT_ASSERT_EQUAL( OUString("001-001-003"), m_pDoc->GetString( 0, 72, 0 ) );
+    CPPUNIT_ASSERT_EQUAL( OUString("001-001-004"), m_pDoc->GetString( 0, 73, 0 ) );
+
     m_pDoc->DeleteTab(0);
 }
 


More information about the Libreoffice-commits mailing list