summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authordiwanshu885 <dmittal885@gmail.com>2020-12-28 16:42:58 +0530
committerXisco Fauli <xiscofauli@libreoffice.org>2021-01-07 15:24:32 +0100
commit572651b74e914e6bdbad2f4a00bf5a6f55905e4d (patch)
tree785d2a1eb1d25e521137db7f0d907596f4970b04 /sc/qa
parent0f7008e91f45cf8e3cee6f372ce012b38a795e26 (diff)
tdf131407 Move UItest to CppUnitTest
Change-Id: I4d40587099bdbe87cf4ab5c9b2acb1ac9ed8cdd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108399 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/uitest/calc_tests3/tdf71339.py35
-rw-r--r--sc/qa/unit/uicalc/uicalc.cxx27
2 files changed, 27 insertions, 35 deletions
diff --git a/sc/qa/uitest/calc_tests3/tdf71339.py b/sc/qa/uitest/calc_tests3/tdf71339.py
deleted file mode 100644
index 0935d3168278..000000000000
--- a/sc/qa/uitest/calc_tests3/tdf71339.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
-import os
-from uitest.uihelper.common import get_state_as_dict
-from uitest.uihelper.calc import enter_text_to_cell
-from libreoffice.calc.document import get_sheet_from_doc
-from libreoffice.calc.conditional_format import get_conditional_format_from_sheet
-from uitest.debug import sleep
-from libreoffice.calc.document import get_cell_by_position
-from libreoffice.uno.propertyvalue import mkPropertyValues
-#Bug: EDITING sigma icon (sum function) operating on selected range
-
-class tdf71339(UITestCase):
-
- def test_tdf71339_autosum_on_selected_range(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, "A2", "1")
- enter_text_to_cell(gridwin, "A3", "1")
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"}))
- self.xUITest.executeCommand(".uno:AutoSum")
-
- self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 0, 3).getFormula(), "=SUM(A1:A3)")
-
- self.ui_test.close_doc()
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 69170a814a0e..a004e2e2c800 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -438,6 +438,33 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf133342)
CPPUNIT_ASSERT_EQUAL(OUString("12 %"), pDoc->GetString(ScAddress(0, 0, 0)));
}
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf71339)
+{
+ mxComponent = loadFromDesktop("private:factory/scalc");
+ ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ ScDocument* pDoc = pModelObj->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+
+ pDoc->SetString(ScAddress(0, 1, 0), "1");
+ pDoc->SetString(ScAddress(0, 2, 0), "1");
+
+ // A1:A3
+ ScRange aMatRange(0, 0, 0, 0, 2, 0);
+ ScDocShell::GetViewData()->GetMarkData().SetMarkArea(aMatRange);
+ dispatchCommand(mxComponent, ".uno:AutoSum", {});
+
+ CPPUNIT_ASSERT_EQUAL(2.0, pDoc->GetValue(ScAddress(0, 3, 0)));
+
+ OUString aFormula;
+ pDoc->GetFormula(0, 3, 0, aFormula);
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: =SUM(A1:A3)
+ // - Actual : =SUM(A2:A3)
+ CPPUNIT_ASSERT_EQUAL(OUString("=SUM(A1:A3)"), aFormula);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */