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
.calc
import enter_text_to_cell
12 from libreoffice
.calc
.document
import get_cell_by_position
13 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
16 class tTest(UITestCase
):
17 def test_fTest_column(self
):
18 with self
.ui_test
.create_doc_in_start_center("calc") as document
:
19 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
20 gridwin
= xCalcDoc
.getChild("grid_window")
22 enter_text_to_cell(gridwin
, "A1", "28")
23 enter_text_to_cell(gridwin
, "A2", "26")
24 enter_text_to_cell(gridwin
, "A3", "31")
25 enter_text_to_cell(gridwin
, "A4", "23")
26 enter_text_to_cell(gridwin
, "A5", "20")
27 enter_text_to_cell(gridwin
, "A6", "27")
28 enter_text_to_cell(gridwin
, "A7", "28")
29 enter_text_to_cell(gridwin
, "A8", "14")
30 enter_text_to_cell(gridwin
, "A9", "4")
31 enter_text_to_cell(gridwin
, "A10", "0")
32 enter_text_to_cell(gridwin
, "A11", "2")
33 enter_text_to_cell(gridwin
, "A12", "8")
34 enter_text_to_cell(gridwin
, "A13", "9")
36 enter_text_to_cell(gridwin
, "B1", "19")
37 enter_text_to_cell(gridwin
, "B2", "13")
38 enter_text_to_cell(gridwin
, "B3", "12")
39 enter_text_to_cell(gridwin
, "B4", "5")
40 enter_text_to_cell(gridwin
, "B5", "34")
41 enter_text_to_cell(gridwin
, "B6", "31")
42 enter_text_to_cell(gridwin
, "B7", "31")
43 enter_text_to_cell(gridwin
, "B8", "12")
44 enter_text_to_cell(gridwin
, "B9", "24")
45 enter_text_to_cell(gridwin
, "B10", "23")
46 enter_text_to_cell(gridwin
, "B11", "19")
47 enter_text_to_cell(gridwin
, "B12", "10")
48 enter_text_to_cell(gridwin
, "B13", "33")
50 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"}))
51 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:FTestDialog") as xDialog
:
52 xvariable1rangeedit
= xDialog
.getChild("variable1-range-edit")
53 xvariable2rangeedit
= xDialog
.getChild("variable2-range-edit")
54 xoutputrangeedit
= xDialog
.getChild("output-range-edit")
55 xgroupedbycolumnsradio
= xDialog
.getChild("groupedby-columns-radio")
57 xvariable1rangeedit
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
58 xvariable1rangeedit
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
59 xvariable1rangeedit
.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"}))
60 xvariable2rangeedit
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
61 xvariable2rangeedit
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
62 xvariable2rangeedit
.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"}))
63 xoutputrangeedit
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
64 xoutputrangeedit
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
65 xoutputrangeedit
.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"}))
66 xgroupedbycolumnsradio
.executeAction("CLICK", tuple())
68 self
.assertEqual(get_cell_by_position(document
, 0, 5, 0).getString(), "F-test")
69 self
.assertEqual(get_cell_by_position(document
, 0, 5, 1).getString(), "Alpha")
71 self
.assertEqual(get_cell_by_position(document
, 0, 5, 3).getString(), "Mean")
72 self
.assertEqual(get_cell_by_position(document
, 0, 5, 4).getString(), "Variance")
73 self
.assertEqual(get_cell_by_position(document
, 0, 5, 5).getString(), "Observations")
74 self
.assertEqual(get_cell_by_position(document
, 0, 5, 6).getString(), "df")
75 self
.assertEqual(get_cell_by_position(document
, 0, 5, 7).getString(), "F")
76 self
.assertEqual(get_cell_by_position(document
, 0, 5, 8).getString(), "P (F<=f) right-tail")
77 self
.assertEqual(get_cell_by_position(document
, 0, 5, 9).getString(), "F Critical right-tail")
78 self
.assertEqual(get_cell_by_position(document
, 0, 5, 10).getString(), "P (F<=f) left-tail")
79 self
.assertEqual(get_cell_by_position(document
, 0, 5, 11).getString(), "F Critical left-tail")
80 self
.assertEqual(get_cell_by_position(document
, 0, 5, 12).getString(), "P two-tail")
81 self
.assertEqual(get_cell_by_position(document
, 0, 5, 13).getString(), "F Critical two-tail")
84 self
.assertEqual(get_cell_by_position(document
, 0, 6, 1).getValue(), 0.05)
85 self
.assertEqual(get_cell_by_position(document
, 0, 6, 2).getString(), "Variable 1")
86 self
.assertEqual(round(get_cell_by_position(document
, 0, 6, 3).getValue(),12), 16.923076923077)
87 self
.assertEqual(round(get_cell_by_position(document
, 0, 6, 4).getValue(),12), 125.076923076923)
88 self
.assertEqual(get_cell_by_position(document
, 0, 6, 5).getValue(), 13)
89 self
.assertEqual(get_cell_by_position(document
, 0, 6, 6).getValue(), 12)
90 self
.assertEqual(round(get_cell_by_position(document
, 0, 6, 7).getValue(),12), 1.324463752376)
91 self
.assertEqual(round(get_cell_by_position(document
, 0, 6, 8).getValue(),12), 0.317061414639)
92 self
.assertEqual(round(get_cell_by_position(document
, 0, 6, 9).getValue(),12), 2.686637112496)
93 self
.assertEqual(round(get_cell_by_position(document
, 0, 6, 10).getValue(),12), 0.682938585361)
94 self
.assertEqual(round(get_cell_by_position(document
, 0, 6, 12).getValue(),12), 0.634122829279)
95 self
.assertEqual(round(get_cell_by_position(document
, 0, 6, 13).getValue(),12), 0.305131354874)
97 self
.assertEqual(get_cell_by_position(document
, 0, 7, 2).getString(), "Variable 2")
98 self
.assertEqual(round(get_cell_by_position(document
, 0, 7, 3).getValue(),12), 20.461538461538)
99 self
.assertEqual(round(get_cell_by_position(document
, 0, 7, 4).getValue(),12), 94.435897435897)
100 self
.assertEqual(get_cell_by_position(document
, 0, 7, 5).getValue(), 13)
101 self
.assertEqual(get_cell_by_position(document
, 0, 7, 6).getValue(), 12)
102 self
.assertEqual(round(get_cell_by_position(document
, 0, 7, 13).getValue(),12), 3.277277094033)
104 self
.xUITest
.executeCommand(".uno:Undo")
105 self
.assertEqual(get_cell_by_position(document
, 0, 5, 0).getString(), "")
108 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:FTestDialog", close_button
="cancel"):
111 # vim: set shiftwidth=4 softtabstop=4 expandtab: