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
, get_url_for_data_file
12 from libreoffice
.calc
.document
import get_cell_by_position
13 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
16 # Bug 123479 - Crash in: ScFormulaResult::GetMatrixFormulaCellToken()
17 class tdf123479(UITestCase
):
18 def test_tdf123479_Crash_ScFormulaResult_GetMatrixFormulaCellToken(self
):
19 #numberingformatpage.ui
20 with self
.ui_test
.load_file(get_url_for_data_file("tdf123479.ods")) as calc_doc
:
21 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
22 gridwin
= xCalcDoc
.getChild("grid_window")
24 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "D14:D16"}))
25 #Open Formula Wizard (Ctrl+F2)
26 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:FunctionDialog") as xDialog
:
27 edArg1
= xDialog
.getChild("ED_ARG1")
28 edArg2
= xDialog
.getChild("ED_ARG2")
29 formulaRes
= xDialog
.getChild("formula_result")
31 #check formula wizard data
32 self
.assertEqual(get_state_as_dict(edArg1
)["Text"], "CHAR(10)")
33 self
.assertEqual(get_state_as_dict(edArg2
)["Text"], "OFFSET($Data.$A$2:$Data.$A$4,0,COLUMN()-3)")
34 self
.assertEqual(get_state_as_dict(formulaRes
)["Text"], "{4;4;4}")
37 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 0).getString(), "Pass/Fail")
39 # vim: set shiftwidth=4 softtabstop=4 expandtab: