1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 from uitest
.framework
import UITestCase
10 from uitest
.uihelper
.common
import get_state_as_dict
11 from libreoffice
.calc
.document
import get_cell_by_position
12 from libreoffice
.calc
.csv_dialog
import load_csv_file
14 class Td114878(UITestCase
):
16 def test_tdf114878(self
):
18 # First import the file with 'Evaluate Formulas' unchecked
19 with
load_csv_file(self
, "tdf114878.csv", True):
20 # Without the fix in place, this test would have failed with
21 # Could not find child with id: evaluateformulas
24 document
= self
.ui_test
.get_component()
26 self
.assertEqual("=-3+5", get_cell_by_position(document
, 0, 0, 0).getString())
27 self
.assertEqual('=TRUE()', get_cell_by_position(document
, 0, 0, 1).getString())
28 self
.assertEqual('=4*10', get_cell_by_position(document
, 0, 0, 2).getString())
29 self
.assertEqual('=SUM(A1:A3)', get_cell_by_position(document
, 0, 0, 3).getString())
31 self
.ui_test
.close_doc()
33 # Now import the file with 'Evaluate Formulas' checked
34 with
load_csv_file(self
, "tdf114878.csv", True) as xDialog
:
35 xEvalutateFormulas
= xDialog
.getChild("evaluateformulas")
36 xEvalutateFormulas
.executeAction("CLICK", tuple())
37 self
.assertEqual('true', get_state_as_dict(xEvalutateFormulas
)['Selected'])
39 document
= self
.ui_test
.get_component()
41 self
.assertEqual("2", get_cell_by_position(document
, 0, 0, 0).getString())
42 self
.assertEqual('1', get_cell_by_position(document
, 0, 0, 1).getString())
43 self
.assertEqual('40', get_cell_by_position(document
, 0, 0, 2).getString())
44 self
.assertEqual('43', get_cell_by_position(document
, 0, 0, 3).getString())
46 self
.ui_test
.close_doc()
48 # vim: set shiftwidth=4 softtabstop=4 expandtab: