[Libreoffice-commits] core.git: sc/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Fri Mar 12 11:38:52 UTC 2021
sc/qa/uitest/calc_tests3/tdf64001.py | 40 -----------------------------------
sc/qa/unit/ucalc.cxx | 27 +++++++++++++++++++++++
sc/qa/unit/ucalc.hxx | 2 +
3 files changed, 29 insertions(+), 40 deletions(-)
New commits:
commit 3eac1691aae5d788269c538fbf609e625fac0c84
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Mar 12 11:33:43 2021 +0100
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Mar 12 12:38:10 2021 +0100
tdf#64001: sc: move UItest to CppUnittest
Change-Id: I8d1e2cddc95d723f02c18b94ce9c7cbe4cdcef8b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112376
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sc/qa/uitest/calc_tests3/tdf64001.py b/sc/qa/uitest/calc_tests3/tdf64001.py
deleted file mode 100644
index 4c19f32c9adc..000000000000
--- a/sc/qa/uitest/calc_tests3/tdf64001.py
+++ /dev/null
@@ -1,40 +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 uitest.debug import sleep
-from libreoffice.calc.document import get_cell_by_position
-from libreoffice.uno.propertyvalue import mkPropertyValues
-
-class tdf64001(UITestCase):
-
- def test_tdf64001(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) Type TRUE in cell A1
- enter_text_to_cell(gridwin, "A1", "TRUE")
- #2) Autofill/drag A1 to A10, all cells show TRUE
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A10"}))
- 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)
- #3) Type FALSE in A11
- enter_text_to_cell(gridwin, "A11", "FALSE")
- #4) Enter in B1: =COUNTIF(A1:A11,TRUE) , hit enter
- enter_text_to_cell(gridwin, "B1", "=COUNTIF(A1:A11,TRUE)")
- #The formula changes to =COUNTIF(A1:A11,1) and displays result of 1 not 10.
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"}))
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 10)
- 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 04fabd9f5414..57525bea2c3a 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4804,6 +4804,33 @@ void Test::testJumpToPrecedentsDependents()
m_pDoc->DeleteTab(0);
}
+void Test::testTdf64001()
+{
+ m_pDoc->InsertTab(0, "test");
+
+ ScMarkData aMarkData(m_pDoc->GetSheetLimits());
+ aMarkData.SelectTable(0, true);
+
+ m_pDoc->SetString( 0, 0, 0, "TRUE" );
+ m_pDoc->Fill( 0, 0, 0, 0, nullptr, aMarkData, 9, FILL_TO_BOTTOM, FILL_AUTO );
+
+ for (SCCOL i = 0; i < 10; ++i)
+ {
+ CPPUNIT_ASSERT_EQUAL( OUString("TRUE"), m_pDoc->GetString( 0, i, 0 ) );
+ }
+
+ m_pDoc->SetString( 0, 10, 0, "FALSE" );
+
+ m_pDoc->SetString( 1, 0, 0, "=COUNTIF(A1:A11;TRUE)" );
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: 10
+ // - Actual : 1
+ CPPUNIT_ASSERT_EQUAL( 10.0, m_pDoc->GetValue( 1, 0, 0 ) );
+
+ m_pDoc->DeleteTab(0);
+}
+
void Test::testAutoFill()
{
m_pDoc->InsertTab(0, "test");
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 9c9b381315ab..5b0a1f2dff3f 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -461,6 +461,7 @@ public:
void testSetBackgroundColor();
void testRenameTable();
+ void testTdf64001();
void testAutoFill();
void testAutoFillSimple();
void testCopyPasteFormulas();
@@ -796,6 +797,7 @@ public:
CPPUNIT_TEST(testJumpToPrecedentsDependents);
CPPUNIT_TEST(testSetBackgroundColor);
CPPUNIT_TEST(testRenameTable);
+ CPPUNIT_TEST(testTdf64001);
CPPUNIT_TEST(testAutoFill);
CPPUNIT_TEST(testAutoFillSimple);
CPPUNIT_TEST(testCopyPasteFormulas);
More information about the Libreoffice-commits
mailing list