summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-03-11 17:22:19 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-03-12 08:51:03 +0100
commitd8e1892d7dd3eb5d4724ef32ce7a110a0087d9e1 (patch)
treeb655601318e93e702cad16cbeff3f157707c8048
parente6f7a3bf40f5df3a17ba58c4735d647bfdda71cb (diff)
tdf#89754: sc_ucalc: Fix test
The original UItest added in 3ba901f050d262cdeccefa5b21b0d32aa7332dc7 < tdf#89754 - don't increment non different consecutive date cells > didn't fail without the fix in place Change-Id: I297f9b3fe713910c1ed40b2de560171911b1ba79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112357 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--sc/qa/uitest/calc_tests3/tdf89754.py45
-rw-r--r--sc/qa/unit/ucalc.cxx15
2 files changed, 15 insertions, 45 deletions
diff --git a/sc/qa/uitest/calc_tests3/tdf89754.py b/sc/qa/uitest/calc_tests3/tdf89754.py
deleted file mode 100644
index 855688c8f45b..000000000000
--- a/sc/qa/uitest/calc_tests3/tdf89754.py
+++ /dev/null
@@ -1,45 +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.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/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 460f85f302c5..b7e89b71fb94 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4920,6 +4920,21 @@ void Test::testAutoFill()
CPPUNIT_ASSERT_EQUAL(aExpected, aFormula);
}
+ // 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, 100, 0, "2012-10-31" );
+ m_pDoc->SetString( 0, 101, 0, "2012-10-31" );
+ m_pDoc->Fill( 0, 100, 0, 101, nullptr, aMarkData, 3, FILL_TO_BOTTOM, FILL_AUTO );
+
+ // tdf#89754, Without the fix in place, this test would have failed with
+ // - Expected: 2012-10-31
+ // - Actual : 2012-11-01
+ CPPUNIT_ASSERT_EQUAL( OUString("2012-10-31"), m_pDoc->GetString( 0, 102, 0 ) );
+ CPPUNIT_ASSERT_EQUAL( OUString("2012-10-31"), m_pDoc->GetString( 0, 103, 0 ) );
+ CPPUNIT_ASSERT_EQUAL( OUString("2012-10-31"), m_pDoc->GetString( 0, 104, 0 ) );
+
m_pDoc->DeleteTab(0);
}