summaryrefslogtreecommitdiffstats
path: root/sc/qa/uitest/statistics
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /sc/qa/uitest/statistics
parentInitial commit. (diff)
downloadlibreoffice-upstream.tar.xz
libreoffice-upstream.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--sc/qa/uitest/statistics/anova.py147
-rw-r--r--sc/qa/uitest/statistics/chiSquare.py95
-rw-r--r--sc/qa/uitest/statistics/correlation.py202
-rw-r--r--sc/qa/uitest/statistics/covariance.py200
-rw-r--r--sc/qa/uitest/statistics/data/regression.odsbin0 -> 27410 bytes
-rw-r--r--sc/qa/uitest/statistics/data/tdf76731.odsbin0 -> 18393 bytes
-rw-r--r--sc/qa/uitest/statistics/descriptiveStatistics.py163
-rw-r--r--sc/qa/uitest/statistics/exponentialSmoothing.py189
-rw-r--r--sc/qa/uitest/statistics/fTest.py121
-rw-r--r--sc/qa/uitest/statistics/movingAverage.py182
-rw-r--r--sc/qa/uitest/statistics/regression.py121
-rw-r--r--sc/qa/uitest/statistics/sampling.py115
-rw-r--r--sc/qa/uitest/statistics/tTest.py122
-rw-r--r--sc/qa/uitest/statistics/tdf76731.py73
-rw-r--r--sc/qa/uitest/statistics/zTest.py112
15 files changed, 1842 insertions, 0 deletions
diff --git a/sc/qa/uitest/statistics/anova.py b/sc/qa/uitest/statistics/anova.py
new file mode 100644
index 000000000..50237ef92
--- /dev/null
+++ b/sc/qa/uitest/statistics/anova.py
@@ -0,0 +1,147 @@
+# -*- 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.common import select_pos
+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
+
+class anova(UITestCase):
+ def test_statistic_anova(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()
+ #fill data
+ enter_text_to_cell(gridwin, "A1", "Maths")
+ enter_text_to_cell(gridwin, "A2", "47")
+ enter_text_to_cell(gridwin, "A3", "36")
+ enter_text_to_cell(gridwin, "A4", "40")
+ enter_text_to_cell(gridwin, "A5", "39")
+ enter_text_to_cell(gridwin, "A7", "47")
+ enter_text_to_cell(gridwin, "A8", "29")
+ enter_text_to_cell(gridwin, "A9", "27")
+ enter_text_to_cell(gridwin, "A10", "57")
+ enter_text_to_cell(gridwin, "A11", "56")
+ enter_text_to_cell(gridwin, "A12", "57")
+ enter_text_to_cell(gridwin, "A13", "26")
+
+ enter_text_to_cell(gridwin, "B1", "Physics")
+ enter_text_to_cell(gridwin, "B2", "67")
+ enter_text_to_cell(gridwin, "B3", "68")
+ enter_text_to_cell(gridwin, "B4", "65")
+ enter_text_to_cell(gridwin, "B5", "64")
+ enter_text_to_cell(gridwin, "B6", "38")
+ enter_text_to_cell(gridwin, "B7", "84")
+ enter_text_to_cell(gridwin, "B8", "80")
+ enter_text_to_cell(gridwin, "B9", "49")
+ enter_text_to_cell(gridwin, "B10", "49")
+ enter_text_to_cell(gridwin, "B11", "33")
+
+ enter_text_to_cell(gridwin, "C1", "Biology")
+ enter_text_to_cell(gridwin, "C2", "33")
+ enter_text_to_cell(gridwin, "C3", "42")
+ enter_text_to_cell(gridwin, "C4", "44")
+ enter_text_to_cell(gridwin, "C5", "60")
+ enter_text_to_cell(gridwin, "C6", "43")
+ enter_text_to_cell(gridwin, "C7", "62")
+ enter_text_to_cell(gridwin, "C8", "51")
+ enter_text_to_cell(gridwin, "C9", "40")
+ enter_text_to_cell(gridwin, "C10", "12")
+ enter_text_to_cell(gridwin, "C11", "60")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:C13"}))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AnalysisOfVarianceDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xinputrangeedit = xDialog.getChild("input-range-edit")
+ xoutputrangeedit = xDialog.getChild("output-range-edit")
+ xradiotwofactor = xDialog.getChild("radio-two-factor")
+ xradiosinglefactor = xDialog.getChild("radio-single-factor")
+ xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio")
+ xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")
+ xalphaspin = xDialog.getChild("alpha-spin")
+
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$2:$C$13"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"}))
+ xradiosinglefactor.executeAction("CLICK", tuple())
+ xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xalphaspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.05"}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "ANOVA - Single Factor")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Groups")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Column 1")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Column 2")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "Column 3")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "Source of Variation")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "Between Groups")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "Within Groups")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "Total")
+
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getString(), "Count")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue(), 11)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 10)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 10)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 8).getString(), "SS")
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),11), 1876.56832844573)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 10).getValue(),10), 6025.1090909091)
+ #bug 80583
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 11).getValue(),11), 7901.67741935484)
+
+ self.assertEqual(get_cell_by_position(document, 0, 7, 3).getString(), "Sum")
+ self.assertEqual(get_cell_by_position(document, 0, 7, 4).getValue(), 461)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 5).getValue(), 597)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue(), 447)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 8).getString(), "df")
+ self.assertEqual(get_cell_by_position(document, 0, 7, 9).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 10).getValue(), 28)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 11).getValue(), 30)
+
+ self.assertEqual(get_cell_by_position(document, 0, 8, 3).getString(), "Mean")
+ self.assertEqual(round(get_cell_by_position(document, 0, 8, 4).getValue(), 12), 41.909090909091)
+ self.assertEqual(get_cell_by_position(document, 0, 8, 5).getValue(), 59.7)
+ self.assertEqual(get_cell_by_position(document, 0, 8, 6).getValue(), 44.7)
+ self.assertEqual(get_cell_by_position(document, 0, 8, 8).getString(), "MS")
+ self.assertEqual(round(get_cell_by_position(document, 0, 8, 9).getValue(),11), 938.28416422287)
+ self.assertEqual(round(get_cell_by_position(document, 0, 8, 10).getValue(),11), 215.18246753247)
+
+ self.assertEqual(get_cell_by_position(document, 0, 9, 3).getString(), "Variance")
+ self.assertEqual(round(get_cell_by_position(document, 0, 9, 4).getValue(),11), 139.49090909091)
+ self.assertEqual(round(get_cell_by_position(document, 0, 9, 5).getValue(),12), 287.122222222222)
+ self.assertEqual(round(get_cell_by_position(document, 0, 9, 6).getValue(),12), 227.344444444444)
+ self.assertEqual(get_cell_by_position(document, 0, 9, 8).getString(), "F")
+ self.assertEqual(round(get_cell_by_position(document, 0, 9, 9).getValue(),13), 4.3604117704492)
+
+ self.assertEqual(get_cell_by_position(document, 0, 10, 8).getString(), "P-value")
+ self.assertEqual(round(get_cell_by_position(document, 0, 10, 9).getValue(),14), 0.02246149518799)
+
+ self.assertEqual(get_cell_by_position(document, 0, 11, 8).getString(), "F critical")
+ self.assertEqual(round(get_cell_by_position(document, 0, 11, 9).getValue(),13), 3.3403855582378)
+
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AnalysisOfVarianceDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/chiSquare.py b/sc/qa/uitest/statistics/chiSquare.py
new file mode 100644
index 000000000..5016e71f8
--- /dev/null
+++ b/sc/qa/uitest/statistics/chiSquare.py
@@ -0,0 +1,95 @@
+# -*- 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.common import select_pos
+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
+
+class chiSquare(UITestCase):
+ def test_chiSquare(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()
+ #fill data
+ enter_text_to_cell(gridwin, "A1", "28")
+ enter_text_to_cell(gridwin, "A2", "26")
+ enter_text_to_cell(gridwin, "A3", "31")
+ enter_text_to_cell(gridwin, "A4", "23")
+ enter_text_to_cell(gridwin, "A5", "20")
+ enter_text_to_cell(gridwin, "A6", "27")
+ enter_text_to_cell(gridwin, "A7", "28")
+ enter_text_to_cell(gridwin, "A8", "14")
+ enter_text_to_cell(gridwin, "A9", "4")
+ enter_text_to_cell(gridwin, "A10", "0")
+ enter_text_to_cell(gridwin, "A11", "2")
+ enter_text_to_cell(gridwin, "A12", "8")
+ enter_text_to_cell(gridwin, "A13", "9")
+
+ enter_text_to_cell(gridwin, "B1", "19")
+ enter_text_to_cell(gridwin, "B2", "13")
+ enter_text_to_cell(gridwin, "B3", "12")
+ enter_text_to_cell(gridwin, "B4", "5")
+ enter_text_to_cell(gridwin, "B5", "34")
+ enter_text_to_cell(gridwin, "B6", "31")
+ enter_text_to_cell(gridwin, "B7", "31")
+ enter_text_to_cell(gridwin, "B8", "12")
+ enter_text_to_cell(gridwin, "B9", "24")
+ enter_text_to_cell(gridwin, "B10", "23")
+ enter_text_to_cell(gridwin, "B11", "19")
+ enter_text_to_cell(gridwin, "B12", "10")
+ enter_text_to_cell(gridwin, "B13", "33")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"}))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ChiSquareTestDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xinputrangeedit = xDialog.getChild("input-range-edit")
+ xoutputrangeedit = xDialog.getChild("output-range-edit")
+ xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio")
+ xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")
+
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"}))
+ xgroupedbycolumnsradio.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Test of Independence (Chi-Square)")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha")
+
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "df")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "P-value")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Test Statistic")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Critical Value")
+
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 12)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 4).getValue(),12), 91.687005584173)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 5).getValue(),12), 21.026069817483)
+
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ChiSquareTestDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/correlation.py b/sc/qa/uitest/statistics/correlation.py
new file mode 100644
index 000000000..a005e7830
--- /dev/null
+++ b/sc/qa/uitest/statistics/correlation.py
@@ -0,0 +1,202 @@
+# -*- 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.common import select_pos
+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
+
+class correlation(UITestCase):
+ def test_statistic_correlation_column(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()
+ #fill data
+ enter_text_to_cell(gridwin, "A1", "Maths")
+ enter_text_to_cell(gridwin, "A2", "47")
+ enter_text_to_cell(gridwin, "A3", "36")
+ enter_text_to_cell(gridwin, "A4", "40")
+ enter_text_to_cell(gridwin, "A5", "39")
+ enter_text_to_cell(gridwin, "A7", "47")
+ enter_text_to_cell(gridwin, "A8", "29")
+ enter_text_to_cell(gridwin, "A9", "27")
+ enter_text_to_cell(gridwin, "A10", "57")
+ enter_text_to_cell(gridwin, "A11", "56")
+ enter_text_to_cell(gridwin, "A12", "57")
+ enter_text_to_cell(gridwin, "A13", "26")
+
+ enter_text_to_cell(gridwin, "B1", "Physics")
+ enter_text_to_cell(gridwin, "B2", "67")
+ enter_text_to_cell(gridwin, "B3", "68")
+ enter_text_to_cell(gridwin, "B4", "65")
+ enter_text_to_cell(gridwin, "B5", "64")
+ enter_text_to_cell(gridwin, "B6", "38")
+ enter_text_to_cell(gridwin, "B7", "84")
+ enter_text_to_cell(gridwin, "B8", "80")
+ enter_text_to_cell(gridwin, "B9", "49")
+ enter_text_to_cell(gridwin, "B10", "49")
+ enter_text_to_cell(gridwin, "B11", "33")
+
+ enter_text_to_cell(gridwin, "C1", "Biology")
+ enter_text_to_cell(gridwin, "C2", "33")
+ enter_text_to_cell(gridwin, "C3", "42")
+ enter_text_to_cell(gridwin, "C4", "44")
+ enter_text_to_cell(gridwin, "C5", "60")
+ enter_text_to_cell(gridwin, "C6", "43")
+ enter_text_to_cell(gridwin, "C7", "62")
+ enter_text_to_cell(gridwin, "C8", "51")
+ enter_text_to_cell(gridwin, "C9", "40")
+ enter_text_to_cell(gridwin, "C10", "12")
+ enter_text_to_cell(gridwin, "C11", "60")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C13"}))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xinputrangeedit = xDialog.getChild("input-range-edit")
+ xoutputrangeedit = xDialog.getChild("output-range-edit")
+ xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio")
+ xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")
+
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"}))
+ xgroupedbyrowsradio.executeAction("CLICK", tuple())
+ xgroupedbycolumnsradio.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Correlations")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Column 1")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Column 2")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Column 3")
+
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "Column 1")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 1)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),14), -0.40292549168204)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 3).getValue(),14), -0.21076428363645)
+
+ self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString(), "Column 2")
+ self.assertEqual(get_cell_by_position(document, 0, 7, 2).getValue(), 1)
+ self.assertEqual(round(get_cell_by_position(document, 0, 7, 3).getValue(),14), 0.23097140475091)
+
+ self.assertEqual(get_cell_by_position(document, 0, 8, 0).getString(), "Column 3")
+ self.assertEqual(get_cell_by_position(document, 0, 8, 3).getValue(), 1)
+
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.ui_test.close_doc()
+
+ def test_statistic_correlation_row(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()
+ #fill data
+ enter_text_to_cell(gridwin, "A1", "Maths")
+ enter_text_to_cell(gridwin, "A2", "Physics")
+ enter_text_to_cell(gridwin, "A3", "Biology")
+
+ enter_text_to_cell(gridwin, "B1", "47")
+ enter_text_to_cell(gridwin, "B2", "67")
+ enter_text_to_cell(gridwin, "B3", "33")
+
+ enter_text_to_cell(gridwin, "C1", "36")
+ enter_text_to_cell(gridwin, "C2", "68")
+ enter_text_to_cell(gridwin, "C3", "42")
+
+ enter_text_to_cell(gridwin, "D1", "40")
+ enter_text_to_cell(gridwin, "D2", "65")
+ enter_text_to_cell(gridwin, "D3", "44")
+
+ enter_text_to_cell(gridwin, "E1", "39")
+ enter_text_to_cell(gridwin, "E2", "64")
+ enter_text_to_cell(gridwin, "E3", "60")
+
+ enter_text_to_cell(gridwin, "F2", "38")
+ enter_text_to_cell(gridwin, "F3", "43")
+
+ enter_text_to_cell(gridwin, "G1", "47")
+ enter_text_to_cell(gridwin, "G2", "84")
+ enter_text_to_cell(gridwin, "G3", "62")
+
+ enter_text_to_cell(gridwin, "H1", "29")
+ enter_text_to_cell(gridwin, "H2", "80")
+ enter_text_to_cell(gridwin, "H3", "51")
+
+ enter_text_to_cell(gridwin, "I1", "27")
+ enter_text_to_cell(gridwin, "I2", "49")
+ enter_text_to_cell(gridwin, "I3", "40")
+
+ enter_text_to_cell(gridwin, "J1", "57")
+ enter_text_to_cell(gridwin, "J2", "49")
+ enter_text_to_cell(gridwin, "J3", "12")
+
+ enter_text_to_cell(gridwin, "K1", "56")
+ enter_text_to_cell(gridwin, "K2", "33")
+ enter_text_to_cell(gridwin, "K3", "60")
+
+ enter_text_to_cell(gridwin, "L1", "57")
+
+ enter_text_to_cell(gridwin, "M1", "26")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:M3"}))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xinputrangeedit = xDialog.getChild("input-range-edit")
+ xoutputrangeedit = xDialog.getChild("output-range-edit")
+ xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio")
+ xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")
+
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$M$3"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$A$7"}))
+ xgroupedbyrowsradio.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "Correlations")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 7).getString(), "Row 1")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 8).getString(), "Row 2")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 9).getString(), "Row 3")
+
+ self.assertEqual(get_cell_by_position(document, 0, 1, 6).getString(), "Row 1")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 7).getValue(), 1)
+ self.assertEqual(round(get_cell_by_position(document, 0, 1, 8).getValue(),15), -0.402925491682042)
+ self.assertEqual(round(get_cell_by_position(document, 0, 1, 9).getValue(),15), -0.210764283636454)
+
+ self.assertEqual(get_cell_by_position(document, 0, 2, 6).getString(), "Row 2")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 8).getValue(), 1)
+ self.assertEqual(round(get_cell_by_position(document, 0, 2, 9).getValue(),14), 0.23097140475091)
+
+ self.assertEqual(get_cell_by_position(document, 0, 3, 6).getString(), "Row 3")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 9).getValue(), 1)
+
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/covariance.py b/sc/qa/uitest/statistics/covariance.py
new file mode 100644
index 000000000..3787a4586
--- /dev/null
+++ b/sc/qa/uitest/statistics/covariance.py
@@ -0,0 +1,200 @@
+# -*- 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.common import select_pos
+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
+
+class covariance(UITestCase):
+ def test_statistic_covariance_column(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()
+ #fill data
+ enter_text_to_cell(gridwin, "A1", "Maths")
+ enter_text_to_cell(gridwin, "A2", "47")
+ enter_text_to_cell(gridwin, "A3", "36")
+ enter_text_to_cell(gridwin, "A4", "40")
+ enter_text_to_cell(gridwin, "A5", "39")
+ enter_text_to_cell(gridwin, "A7", "47")
+ enter_text_to_cell(gridwin, "A8", "29")
+ enter_text_to_cell(gridwin, "A9", "27")
+ enter_text_to_cell(gridwin, "A10", "57")
+ enter_text_to_cell(gridwin, "A11", "56")
+ enter_text_to_cell(gridwin, "A12", "57")
+ enter_text_to_cell(gridwin, "A13", "26")
+
+ enter_text_to_cell(gridwin, "B1", "Physics")
+ enter_text_to_cell(gridwin, "B2", "67")
+ enter_text_to_cell(gridwin, "B3", "68")
+ enter_text_to_cell(gridwin, "B4", "65")
+ enter_text_to_cell(gridwin, "B5", "64")
+ enter_text_to_cell(gridwin, "B6", "38")
+ enter_text_to_cell(gridwin, "B7", "84")
+ enter_text_to_cell(gridwin, "B8", "80")
+ enter_text_to_cell(gridwin, "B9", "49")
+ enter_text_to_cell(gridwin, "B10", "49")
+ enter_text_to_cell(gridwin, "B11", "33")
+
+ enter_text_to_cell(gridwin, "C1", "Biology")
+ enter_text_to_cell(gridwin, "C2", "33")
+ enter_text_to_cell(gridwin, "C3", "42")
+ enter_text_to_cell(gridwin, "C4", "44")
+ enter_text_to_cell(gridwin, "C5", "60")
+ enter_text_to_cell(gridwin, "C6", "43")
+ enter_text_to_cell(gridwin, "C7", "62")
+ enter_text_to_cell(gridwin, "C8", "51")
+ enter_text_to_cell(gridwin, "C9", "40")
+ enter_text_to_cell(gridwin, "C10", "12")
+ enter_text_to_cell(gridwin, "C11", "60")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C13"}))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xinputrangeedit = xDialog.getChild("input-range-edit")
+ xoutputrangeedit = xDialog.getChild("output-range-edit")
+ xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio")
+ xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")
+
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"}))
+ xgroupedbycolumnsradio.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Covariances")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Column 1")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Column 2")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Column 3")
+
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "Column 1")
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 1).getValue(),11), 126.80991735537)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),12), -61.444444444444)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 3).getValue()), -32)
+
+ self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString(), "Column 2")
+ self.assertEqual(round(get_cell_by_position(document, 0, 7, 2).getValue(),2), 258.41)
+ self.assertEqual(round(get_cell_by_position(document, 0, 7, 3).getValue(),2), 53.11)
+
+ self.assertEqual(get_cell_by_position(document, 0, 8, 0).getString(), "Column 3")
+ self.assertEqual(round(get_cell_by_position(document, 0, 8, 3).getValue(),2), 204.61)
+
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.ui_test.close_doc()
+
+ def test_statistic_covariance_row(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()
+ #fill data
+ enter_text_to_cell(gridwin, "A1", "Maths")
+ enter_text_to_cell(gridwin, "A2", "Physics")
+ enter_text_to_cell(gridwin, "A3", "Biology")
+
+ enter_text_to_cell(gridwin, "B1", "47")
+ enter_text_to_cell(gridwin, "B2", "67")
+ enter_text_to_cell(gridwin, "B3", "33")
+
+ enter_text_to_cell(gridwin, "C1", "36")
+ enter_text_to_cell(gridwin, "C2", "68")
+ enter_text_to_cell(gridwin, "C3", "42")
+
+ enter_text_to_cell(gridwin, "D1", "40")
+ enter_text_to_cell(gridwin, "D2", "65")
+ enter_text_to_cell(gridwin, "D3", "44")
+
+ enter_text_to_cell(gridwin, "E1", "39")
+ enter_text_to_cell(gridwin, "E2", "64")
+ enter_text_to_cell(gridwin, "E3", "60")
+
+ enter_text_to_cell(gridwin, "F2", "38")
+ enter_text_to_cell(gridwin, "F3", "43")
+
+ enter_text_to_cell(gridwin, "G1", "47")
+ enter_text_to_cell(gridwin, "G2", "84")
+ enter_text_to_cell(gridwin, "G3", "62")
+
+ enter_text_to_cell(gridwin, "H1", "29")
+ enter_text_to_cell(gridwin, "H2", "80")
+ enter_text_to_cell(gridwin, "H3", "51")
+
+ enter_text_to_cell(gridwin, "I1", "27")
+ enter_text_to_cell(gridwin, "I2", "49")
+ enter_text_to_cell(gridwin, "I3", "40")
+
+ enter_text_to_cell(gridwin, "J1", "57")
+ enter_text_to_cell(gridwin, "J2", "49")
+ enter_text_to_cell(gridwin, "J3", "12")
+
+ enter_text_to_cell(gridwin, "K1", "56")
+ enter_text_to_cell(gridwin, "K2", "33")
+ enter_text_to_cell(gridwin, "K3", "60")
+
+ enter_text_to_cell(gridwin, "L1", "57")
+
+ enter_text_to_cell(gridwin, "M1", "26")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:M3"}))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xinputrangeedit = xDialog.getChild("input-range-edit")
+ xoutputrangeedit = xDialog.getChild("output-range-edit")
+ xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio")
+ xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")
+
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$M$3"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$A$7"}))
+ xgroupedbyrowsradio.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "Covariances")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 7).getString(), "Row 1")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 8).getString(), "Row 2")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 9).getString(), "Row 3")
+
+ self.assertEqual(get_cell_by_position(document, 0, 1, 6).getString(), "Row 1")
+ self.assertEqual(round(get_cell_by_position(document, 0, 1, 7).getValue(),10), 126.8099173554)
+ self.assertEqual(round(get_cell_by_position(document, 0, 1, 8).getValue(),12), -61.444444444444)
+ self.assertEqual(round(get_cell_by_position(document, 0, 1, 9).getValue()), -32)
+
+ self.assertEqual(get_cell_by_position(document, 0, 2, 6).getString(), "Row 2")
+ self.assertEqual(round(get_cell_by_position(document, 0, 2, 8).getValue(),2), 258.41)
+ self.assertEqual(round(get_cell_by_position(document, 0, 2, 9).getValue(),2), 53.11)
+
+ self.assertEqual(get_cell_by_position(document, 0, 3, 6).getString(), "Row 3")
+ self.assertEqual(round(get_cell_by_position(document, 0, 3, 9).getValue(),2), 204.61)
+
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/data/regression.ods b/sc/qa/uitest/statistics/data/regression.ods
new file mode 100644
index 000000000..1c8b72cc9
--- /dev/null
+++ b/sc/qa/uitest/statistics/data/regression.ods
Binary files differ
diff --git a/sc/qa/uitest/statistics/data/tdf76731.ods b/sc/qa/uitest/statistics/data/tdf76731.ods
new file mode 100644
index 000000000..6435d5f50
--- /dev/null
+++ b/sc/qa/uitest/statistics/data/tdf76731.ods
Binary files differ
diff --git a/sc/qa/uitest/statistics/descriptiveStatistics.py b/sc/qa/uitest/statistics/descriptiveStatistics.py
new file mode 100644
index 000000000..112803418
--- /dev/null
+++ b/sc/qa/uitest/statistics/descriptiveStatistics.py
@@ -0,0 +1,163 @@
+# -*- 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.common import select_pos
+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
+
+class descriptiveStatistics(UITestCase):
+ def test_descriptive_statistics(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()
+ #fill data
+ enter_text_to_cell(gridwin, "A1", "Math")
+ enter_text_to_cell(gridwin, "A2", "47")
+ enter_text_to_cell(gridwin, "A3", "36")
+ enter_text_to_cell(gridwin, "A4", "40")
+ enter_text_to_cell(gridwin, "A5", "39")
+ enter_text_to_cell(gridwin, "A7", "47")
+ enter_text_to_cell(gridwin, "A8", "29")
+ enter_text_to_cell(gridwin, "A9", "27")
+ enter_text_to_cell(gridwin, "A10", "57")
+ enter_text_to_cell(gridwin, "A11", "56")
+ enter_text_to_cell(gridwin, "A12", "57")
+ enter_text_to_cell(gridwin, "A13", "26")
+
+
+ enter_text_to_cell(gridwin, "B1", "Physics")
+ enter_text_to_cell(gridwin, "B2", "67")
+ enter_text_to_cell(gridwin, "B3", "68")
+ enter_text_to_cell(gridwin, "B4", "65")
+ enter_text_to_cell(gridwin, "B5", "64")
+ enter_text_to_cell(gridwin, "B6", "38")
+ enter_text_to_cell(gridwin, "B7", "84")
+ enter_text_to_cell(gridwin, "B8", "80")
+ enter_text_to_cell(gridwin, "B9", "49")
+ enter_text_to_cell(gridwin, "B10", "49")
+ enter_text_to_cell(gridwin, "B11", "33")
+
+ enter_text_to_cell(gridwin, "C1", "Biology")
+ enter_text_to_cell(gridwin, "C2", "33")
+ enter_text_to_cell(gridwin, "C3", "42")
+ enter_text_to_cell(gridwin, "C4", "44")
+ enter_text_to_cell(gridwin, "C5", "60")
+ enter_text_to_cell(gridwin, "C6", "43")
+ enter_text_to_cell(gridwin, "C7", "62")
+ enter_text_to_cell(gridwin, "C8", "51")
+ enter_text_to_cell(gridwin, "C9", "40")
+ enter_text_to_cell(gridwin, "C10", "12")
+ enter_text_to_cell(gridwin, "C11", "60")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C13"}))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:DescriptiveStatisticsDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xinputrangeedit = xDialog.getChild("input-range-edit")
+ xoutputrangeedit = xDialog.getChild("output-range-edit")
+
+ xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio")
+ xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")
+
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"}))
+
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$F$1"}))
+
+ xgroupedbyrowsradio.executeAction("CLICK", tuple())
+ xgroupedbycolumnsradio.executeAction("CLICK", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString() , "Mean")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString() , "Standard Error")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString() , "Mode")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString() , "Median")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString() , "First Quartile")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString() , "Third Quartile")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 7).getString() , "Variance")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString() , "Standard Deviation")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString() , "Kurtosis")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString() , "Skewness")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString() , "Range")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 12).getString() , "Minimum")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString() , "Maximum")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 14).getString() , "Sum")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 15).getString() , "Count")
+
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString() , "Column 1")
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 1).getValue(),12) , 41.909090909091)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),13) , 3.5610380137731)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue() , 47)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue() , 40)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue() , 32.5)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue() , 51.5)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 7).getValue(),11) , 139.49090909091)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 8).getValue(),12) , 11.810626955878)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),13) , -1.4621677980825)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 10).getValue(),14) , 0.01524095329036)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 11).getValue() , 31)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 12).getValue() , 26)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 13).getValue() , 57)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 14).getValue() , 461)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 15).getValue() , 11)
+
+ self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString() , "Column 2")
+ self.assertEqual(round(get_cell_by_position(document, 0, 7, 1).getValue(),1) , 59.7)
+ self.assertEqual(round(get_cell_by_position(document, 0, 7, 2).getValue(),14) , 5.35837869343164)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 3).getValue() , 49)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 4).getValue() , 64.5)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 5).getValue() , 49)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue() , 67.75)
+ self.assertEqual(round(get_cell_by_position(document, 0, 7, 7).getValue(),11) , 287.12222222222)
+ self.assertEqual(round(get_cell_by_position(document, 0, 7, 8).getValue(),12) , 16.944681236961)
+ self.assertEqual(round(get_cell_by_position(document, 0, 7, 9).getValue(),14) , -0.94159887458526)
+ self.assertEqual(round(get_cell_by_position(document, 0, 7, 10).getValue(),13) , -0.2226426904338)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 11).getValue() , 51)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 12).getValue() , 33)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 13).getValue() , 84)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 14).getValue() , 597)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 15).getValue() , 10)
+
+ self.assertEqual(get_cell_by_position(document, 0, 8, 0).getString() , "Column 3")
+ self.assertEqual(get_cell_by_position(document, 0, 8, 1).getValue() , 44.7)
+ self.assertEqual(round(get_cell_by_position(document, 0, 8, 2).getValue(),13) , 4.7680650629416)
+ self.assertEqual(get_cell_by_position(document, 0, 8, 3).getValue() , 60)
+ self.assertEqual(get_cell_by_position(document, 0, 8, 4).getValue() , 43.5)
+ self.assertEqual(get_cell_by_position(document, 0, 8, 5).getValue() , 40.5)
+ self.assertEqual(get_cell_by_position(document, 0, 8, 6).getValue() , 57.75)
+ self.assertEqual(round(get_cell_by_position(document, 0, 8, 7).getValue(),11) , 227.34444444444)
+ self.assertEqual(round(get_cell_by_position(document, 0, 8, 8).getValue(),11) , 15.07794563077)
+ self.assertEqual(round(get_cell_by_position(document, 0, 8, 9).getValue(),12) , 1.418052718986)
+ self.assertEqual(round(get_cell_by_position(document, 0, 8, 10).getValue(),14) , -0.97668033725691)
+ self.assertEqual(get_cell_by_position(document, 0, 8, 11).getValue() , 50)
+ self.assertEqual(get_cell_by_position(document, 0, 8, 12).getValue() , 12)
+ self.assertEqual(get_cell_by_position(document, 0, 8, 13).getValue() , 62)
+ self.assertEqual(get_cell_by_position(document, 0, 8, 14).getValue() , 447)
+ self.assertEqual(get_cell_by_position(document, 0, 8, 15).getValue() , 10)
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:DescriptiveStatisticsDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/exponentialSmoothing.py b/sc/qa/uitest/statistics/exponentialSmoothing.py
new file mode 100644
index 000000000..7ea2c23ec
--- /dev/null
+++ b/sc/qa/uitest/statistics/exponentialSmoothing.py
@@ -0,0 +1,189 @@
+# -*- 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.common import select_pos
+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
+
+class exponentialSmoothing(UITestCase):
+ def test_exponential_smoothing_column(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()
+ #fill data
+ enter_text_to_cell(gridwin, "A1", "1")
+ enter_text_to_cell(gridwin, "A2", "0")
+ enter_text_to_cell(gridwin, "A3", "0")
+ enter_text_to_cell(gridwin, "A4", "0")
+ enter_text_to_cell(gridwin, "A5", "0")
+ enter_text_to_cell(gridwin, "A7", "0")
+ enter_text_to_cell(gridwin, "A8", "0")
+ enter_text_to_cell(gridwin, "A9", "0")
+ enter_text_to_cell(gridwin, "A10", "0")
+ enter_text_to_cell(gridwin, "A11", "0")
+ enter_text_to_cell(gridwin, "A12", "0")
+ enter_text_to_cell(gridwin, "A13", "0")
+
+ enter_text_to_cell(gridwin, "B1", "0")
+ enter_text_to_cell(gridwin, "B2", "0")
+ enter_text_to_cell(gridwin, "B3", "1")
+ enter_text_to_cell(gridwin, "B4", "0")
+ enter_text_to_cell(gridwin, "B5", "0")
+ enter_text_to_cell(gridwin, "B6", "0")
+ enter_text_to_cell(gridwin, "B7", "0")
+ enter_text_to_cell(gridwin, "B8", "0")
+ enter_text_to_cell(gridwin, "B9", "0")
+ enter_text_to_cell(gridwin, "B10", "0")
+ enter_text_to_cell(gridwin, "B11", "0")
+ enter_text_to_cell(gridwin, "B12", "0")
+ enter_text_to_cell(gridwin, "B13", "0")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"}))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xinputrangeedit = xDialog.getChild("input-range-edit")
+ xoutputrangeedit = xDialog.getChild("output-range-edit")
+ xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio")
+ xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")
+ xmoothingfactorspin = xDialog.getChild("smoothing-factor-spin")
+
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"}))
+ xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.5"}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Alpha")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 0.5)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Column 1")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 0.5)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 6).getValue(), 0.25)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 7).getValue(), 0.125)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 8).getValue(), 0.0625)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 9).getValue(), 0.03125)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 10).getValue(), 0.015625)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 11).getValue(), 0.0078125)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 12).getValue(), 0.00390625)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 13).getValue(), 0.001953125)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 14).getValue(), 0.0009765625)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 15).getValue(), 0.00048828125)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 16).getValue(), 0.000244140625)
+
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getString(), "Column 2")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 0.5)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 7).getValue(), 0.25)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 8).getValue(), 0.125)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 9).getValue(), 0.0625)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 10).getValue(), 0.03125)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 11).getValue(), 0.015625)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 12).getValue(), 0.0078125)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 13).getValue(), 0.00390625)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 14).getValue(), 0.001953125)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 15).getValue(), 0.0009765625)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 16).getValue(), 0.00048828125)
+
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.ui_test.close_doc()
+
+ def test_exponential_smoothing_row(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()
+ #fill data
+ enter_text_to_cell(gridwin, "A1", "1")
+ enter_text_to_cell(gridwin, "A2", "0")
+ enter_text_to_cell(gridwin, "A3", "0")
+ enter_text_to_cell(gridwin, "A4", "0")
+ enter_text_to_cell(gridwin, "A5", "0")
+ enter_text_to_cell(gridwin, "A7", "0")
+ enter_text_to_cell(gridwin, "A8", "0")
+ enter_text_to_cell(gridwin, "A9", "0")
+ enter_text_to_cell(gridwin, "A10", "0")
+ enter_text_to_cell(gridwin, "A11", "0")
+ enter_text_to_cell(gridwin, "A12", "0")
+ enter_text_to_cell(gridwin, "A13", "0")
+
+ enter_text_to_cell(gridwin, "B1", "0")
+ enter_text_to_cell(gridwin, "B2", "0")
+ enter_text_to_cell(gridwin, "B3", "1")
+ enter_text_to_cell(gridwin, "B4", "0")
+ enter_text_to_cell(gridwin, "B5", "0")
+ enter_text_to_cell(gridwin, "B6", "0")
+ enter_text_to_cell(gridwin, "B7", "0")
+ enter_text_to_cell(gridwin, "B8", "0")
+ enter_text_to_cell(gridwin, "B9", "0")
+ enter_text_to_cell(gridwin, "B10", "0")
+ enter_text_to_cell(gridwin, "B11", "0")
+ enter_text_to_cell(gridwin, "B12", "0")
+ enter_text_to_cell(gridwin, "B13", "0")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"}))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xinputrangeedit = xDialog.getChild("input-range-edit")
+ xoutputrangeedit = xDialog.getChild("output-range-edit")
+ xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio")
+ xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")
+ xmoothingfactorspin = xDialog.getChild("smoothing-factor-spin")
+
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"}))
+ xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.5"}))
+ xgroupedbyrowsradio.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Alpha")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 0.5)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Row 1")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 0.5)
+
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getString(), "Row 2")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 0)
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/fTest.py b/sc/qa/uitest/statistics/fTest.py
new file mode 100644
index 000000000..1f2762c4f
--- /dev/null
+++ b/sc/qa/uitest/statistics/fTest.py
@@ -0,0 +1,121 @@
+# -*- 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.common import select_pos
+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
+
+class tTest(UITestCase):
+ def test_fTest_column(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()
+ #fill data
+ enter_text_to_cell(gridwin, "A1", "28")
+ enter_text_to_cell(gridwin, "A2", "26")
+ enter_text_to_cell(gridwin, "A3", "31")
+ enter_text_to_cell(gridwin, "A4", "23")
+ enter_text_to_cell(gridwin, "A5", "20")
+ enter_text_to_cell(gridwin, "A6", "27")
+ enter_text_to_cell(gridwin, "A7", "28")
+ enter_text_to_cell(gridwin, "A8", "14")
+ enter_text_to_cell(gridwin, "A9", "4")
+ enter_text_to_cell(gridwin, "A10", "0")
+ enter_text_to_cell(gridwin, "A11", "2")
+ enter_text_to_cell(gridwin, "A12", "8")
+ enter_text_to_cell(gridwin, "A13", "9")
+
+ enter_text_to_cell(gridwin, "B1", "19")
+ enter_text_to_cell(gridwin, "B2", "13")
+ enter_text_to_cell(gridwin, "B3", "12")
+ enter_text_to_cell(gridwin, "B4", "5")
+ enter_text_to_cell(gridwin, "B5", "34")
+ enter_text_to_cell(gridwin, "B6", "31")
+ enter_text_to_cell(gridwin, "B7", "31")
+ enter_text_to_cell(gridwin, "B8", "12")
+ enter_text_to_cell(gridwin, "B9", "24")
+ enter_text_to_cell(gridwin, "B10", "23")
+ enter_text_to_cell(gridwin, "B11", "19")
+ enter_text_to_cell(gridwin, "B12", "10")
+ enter_text_to_cell(gridwin, "B13", "33")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"}))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:FTestDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xvariable1rangeedit = xDialog.getChild("variable1-range-edit")
+ xvariable2rangeedit = xDialog.getChild("variable2-range-edit")
+ xoutputrangeedit = xDialog.getChild("output-range-edit")
+ xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio")
+ xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")
+
+ xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"}))
+ xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"}))
+ xgroupedbycolumnsradio.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "F-test")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha")
+
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Mean")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Variance")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Observations")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "df")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 7).getString(), "F")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "P (F<=f) right-tail")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "F Critical right-tail")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "P (F<=f) left-tail")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "F Critical left-tail")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 12).getString(), "P two-tail")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "F Critical two-tail")
+
+
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getString(), "Variable 1")
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 3).getValue(),12), 16.923076923077)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 4).getValue(),12), 125.076923076923)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 13)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 12)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 7).getValue(),12), 1.324463752376)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 8).getValue(),12), 0.317061414639)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),12), 2.686637112496)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 10).getValue(),12), 0.682938585361)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 12).getValue(),12), 0.634122829279)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 13).getValue(),12), 0.305131354874)
+
+ self.assertEqual(get_cell_by_position(document, 0, 7, 2).getString(), "Variable 2")
+ self.assertEqual(round(get_cell_by_position(document, 0, 7, 3).getValue(),12), 20.461538461538)
+ self.assertEqual(round(get_cell_by_position(document, 0, 7, 4).getValue(),12), 94.435897435897)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 5).getValue(), 13)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue(), 12)
+ self.assertEqual(round(get_cell_by_position(document, 0, 7, 13).getValue(),12), 3.277277094033)
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:FTestDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/movingAverage.py b/sc/qa/uitest/statistics/movingAverage.py
new file mode 100644
index 000000000..9f94aaf29
--- /dev/null
+++ b/sc/qa/uitest/statistics/movingAverage.py
@@ -0,0 +1,182 @@
+# -*- 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.common import select_pos
+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
+
+class movingAverage(UITestCase):
+ def test_moving_average_column(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()
+ #fill data
+ enter_text_to_cell(gridwin, "A1", "1")
+ enter_text_to_cell(gridwin, "A2", "0")
+ enter_text_to_cell(gridwin, "A3", "0")
+ enter_text_to_cell(gridwin, "A4", "0")
+ enter_text_to_cell(gridwin, "A5", "0")
+ enter_text_to_cell(gridwin, "A7", "0")
+ enter_text_to_cell(gridwin, "A8", "0")
+ enter_text_to_cell(gridwin, "A9", "0")
+ enter_text_to_cell(gridwin, "A10", "0")
+ enter_text_to_cell(gridwin, "A11", "0")
+ enter_text_to_cell(gridwin, "A12", "0")
+ enter_text_to_cell(gridwin, "A13", "0")
+
+ enter_text_to_cell(gridwin, "B1", "0")
+ enter_text_to_cell(gridwin, "B2", "0")
+ enter_text_to_cell(gridwin, "B3", "1")
+ enter_text_to_cell(gridwin, "B4", "0")
+ enter_text_to_cell(gridwin, "B5", "0")
+ enter_text_to_cell(gridwin, "B6", "0")
+ enter_text_to_cell(gridwin, "B7", "0")
+ enter_text_to_cell(gridwin, "B8", "0")
+ enter_text_to_cell(gridwin, "B9", "0")
+ enter_text_to_cell(gridwin, "B10", "0")
+ enter_text_to_cell(gridwin, "B11", "0")
+ enter_text_to_cell(gridwin, "B12", "0")
+ enter_text_to_cell(gridwin, "B13", "0")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"}))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xinputrangeedit = xDialog.getChild("input-range-edit")
+ xoutputrangeedit = xDialog.getChild("output-range-edit")
+ xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio")
+ xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")
+ xintervalspin = xDialog.getChild("interval-spin")
+
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"}))
+ xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xintervalspin.executeAction("TYPE", mkPropertyValues({"TEXT":"3"}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Column 1")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "#N/A")
+ self.assertEqual(round(get_cell_by_position(document, 0, 5, 2).getValue(),8), 0.33333333)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 6).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 7).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 8).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 9).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 10).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 11).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 12).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "#N/A")
+
+
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "Column 2")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getString(), "#N/A")
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),8), 0.33333333)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 3).getValue(),8), 0.33333333)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 4).getValue(),8), 0.33333333)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 7).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 9).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 10).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 11).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 12).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 13).getString(), "#N/A")
+
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.ui_test.close_doc()
+
+ def test_moving_average_row(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()
+ #fill data
+ enter_text_to_cell(gridwin, "A1", "1")
+ enter_text_to_cell(gridwin, "A2", "0")
+ enter_text_to_cell(gridwin, "A3", "0")
+ enter_text_to_cell(gridwin, "A4", "0")
+ enter_text_to_cell(gridwin, "A5", "0")
+ enter_text_to_cell(gridwin, "A7", "0")
+ enter_text_to_cell(gridwin, "A8", "0")
+ enter_text_to_cell(gridwin, "A9", "0")
+ enter_text_to_cell(gridwin, "A10", "0")
+ enter_text_to_cell(gridwin, "A11", "0")
+ enter_text_to_cell(gridwin, "A12", "0")
+ enter_text_to_cell(gridwin, "A13", "0")
+
+ enter_text_to_cell(gridwin, "B1", "0")
+ enter_text_to_cell(gridwin, "B2", "0")
+ enter_text_to_cell(gridwin, "B3", "1")
+ enter_text_to_cell(gridwin, "B4", "0")
+ enter_text_to_cell(gridwin, "B5", "0")
+ enter_text_to_cell(gridwin, "B6", "0")
+ enter_text_to_cell(gridwin, "B7", "0")
+ enter_text_to_cell(gridwin, "B8", "0")
+ enter_text_to_cell(gridwin, "B9", "0")
+ enter_text_to_cell(gridwin, "B10", "0")
+ enter_text_to_cell(gridwin, "B11", "0")
+ enter_text_to_cell(gridwin, "B12", "0")
+ enter_text_to_cell(gridwin, "B13", "0")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"}))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xinputrangeedit = xDialog.getChild("input-range-edit")
+ xoutputrangeedit = xDialog.getChild("output-range-edit")
+ xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio")
+ xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")
+ xintervalspin = xDialog.getChild("interval-spin")
+
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"}))
+ xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xintervalspin.executeAction("TYPE", mkPropertyValues({"TEXT":"3"}))
+ xgroupedbyrowsradio.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Row 1")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "#N/A")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "#N/A")
+
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "Row 2")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getString(), "#N/A")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getString(), "#N/A")
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/regression.py b/sc/qa/uitest/statistics/regression.py
new file mode 100644
index 000000000..db9c3a08c
--- /dev/null
+++ b/sc/qa/uitest/statistics/regression.py
@@ -0,0 +1,121 @@
+# -*- 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.common import select_pos
+from uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.calc.document import get_sheet_from_doc
+from uitest.debug import sleep
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+import org.libreoffice.unotest
+import pathlib
+
+def get_url_for_data_file(file_name):
+ return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
+
+class regression(UITestCase):
+ def test_regression_row(self):
+ self._regression_check(data_groupedby_column = False)
+
+ def test_regression_column(self):
+ self._regression_check(data_groupedby_column = True)
+
+ def _regression_check(self, data_groupedby_column = True):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("regression.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ # Initially the final check status is "FALSE" (failed).
+ self.assertEqual(get_cell_by_position(document, 14, 1, 6).getString(), "FALSE",
+ "Check status must be FALSE before the test")
+ self._do_regression(regression_type = "LINEAR", data_groupedby_column = data_groupedby_column, calc_intercept = True)
+ self._do_regression(regression_type = "LINEAR", data_groupedby_column = data_groupedby_column, calc_intercept = False)
+ self._do_regression(regression_type = "LOG", data_groupedby_column = data_groupedby_column)
+ self._do_regression(regression_type = "POWER", data_groupedby_column = data_groupedby_column)
+ self.assertEqual(get_cell_by_position(document, 14, 1, 6).getString(), "TRUE",
+ "One of more of the checks failed for data_groupedby_column = {}, manually try with the document".
+ format(data_groupedby_column))
+ self.ui_test.close_doc()
+
+ def _do_regression(self, regression_type, data_groupedby_column = True, calc_intercept = True):
+ assert(regression_type == "LINEAR" or regression_type == "LOG" or regression_type == "POWER")
+ self.ui_test.execute_modeless_dialog_through_command(".uno:RegressionDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xvariable1rangeedit = xDialog.getChild("variable1-range-edit")
+ xvariable2rangeedit = xDialog.getChild("variable2-range-edit")
+ xoutputrangeedit = xDialog.getChild("output-range-edit")
+ xwithlabelscheck = xDialog.getChild("withlabels-check")
+ xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio")
+ xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")
+ xlinearradio = xDialog.getChild("linear-radio")
+ xlogarithmicradio = xDialog.getChild("logarithmic-radio")
+ xpowerradio = xDialog.getChild("power-radio")
+ xnointerceptcheck = xDialog.getChild("nointercept-check")
+
+ ## Set the X, Y and output ranges
+ xvariable1rangeedit.executeAction("FOCUS", tuple()) # Without this the range parser does not kick in somehow
+ xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ if data_groupedby_column:
+ xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$DataInColumns.$A$1:$C$11"}))
+ else:
+ xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$DataInRows.$A$1:$K$3"}))
+
+ xvariable2rangeedit.executeAction("FOCUS", tuple()) # Without this the range parser does not kick in somehow
+ xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ if data_groupedby_column:
+ xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$DataInColumns.$D$1:$D$11"}))
+ else:
+ xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$DataInRows.$A$4:$K$4"}))
+ # The data ranges have labels in them
+ if (get_state_as_dict(xwithlabelscheck)["Selected"]) == "false":
+ xwithlabelscheck.executeAction("CLICK", tuple())
+
+ xoutputrangeedit.executeAction("FOCUS", tuple()) # Without this the range parser does not kick in somehow
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ if regression_type == "LINEAR":
+ if calc_intercept:
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$ActualLinear.$A$1"}))
+ else:
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$ActualLinearNoIntercept.$A$1"}))
+ elif regression_type == "LOG":
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$ActualLog.$A$1"}))
+ else:
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$ActualPower.$A$1"}))
+
+ if data_groupedby_column:
+ xgroupedbycolumnsradio.executeAction("CLICK", tuple())
+ else:
+ xgroupedbyrowsradio.executeAction("CLICK", tuple())
+
+ if regression_type == "LINEAR":
+ xlinearradio.executeAction("CLICK", tuple())
+ elif regression_type == "LOG":
+ xlogarithmicradio.executeAction("CLICK", tuple())
+ else:
+ xpowerradio.executeAction("CLICK", tuple())
+
+ if not calc_intercept:
+ xnointerceptcheck.executeAction("CLICK", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ def test_regression_cancel(self):
+ calc_doc = self.ui_test.create_doc_in_start_center("calc")
+ self.ui_test.execute_modeless_dialog_through_command(".uno:RegressionDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/sampling.py b/sc/qa/uitest/statistics/sampling.py
new file mode 100644
index 000000000..dd3fd2698
--- /dev/null
+++ b/sc/qa/uitest/statistics/sampling.py
@@ -0,0 +1,115 @@
+# -*- 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.common import select_pos
+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
+
+class sampling(UITestCase):
+ def test_statistic_sampling(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()
+ #fill data
+ enter_text_to_cell(gridwin, "A1", "11")
+ enter_text_to_cell(gridwin, "A2", "12")
+ enter_text_to_cell(gridwin, "A3", "13")
+ enter_text_to_cell(gridwin, "A4", "14")
+ enter_text_to_cell(gridwin, "A5", "15")
+ enter_text_to_cell(gridwin, "A6", "16")
+ enter_text_to_cell(gridwin, "A7", "17")
+ enter_text_to_cell(gridwin, "A8", "18")
+ enter_text_to_cell(gridwin, "A9", "19")
+
+ enter_text_to_cell(gridwin, "B1", "21")
+ enter_text_to_cell(gridwin, "B2", "22")
+ enter_text_to_cell(gridwin, "B3", "23")
+ enter_text_to_cell(gridwin, "B4", "24")
+ enter_text_to_cell(gridwin, "B5", "25")
+ enter_text_to_cell(gridwin, "B6", "26")
+ enter_text_to_cell(gridwin, "B7", "27")
+ enter_text_to_cell(gridwin, "B8", "28")
+ enter_text_to_cell(gridwin, "B9", "29")
+
+ enter_text_to_cell(gridwin, "C1", "31")
+ enter_text_to_cell(gridwin, "C2", "32")
+ enter_text_to_cell(gridwin, "C3", "33")
+ enter_text_to_cell(gridwin, "C4", "34")
+ enter_text_to_cell(gridwin, "C5", "35")
+ enter_text_to_cell(gridwin, "C6", "36")
+ enter_text_to_cell(gridwin, "C7", "37")
+ enter_text_to_cell(gridwin, "C8", "38")
+ enter_text_to_cell(gridwin, "C9", "39")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C9"}))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SamplingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xinputrangeedit = xDialog.getChild("input-range-edit")
+ xoutputrangeedit = xDialog.getChild("output-range-edit")
+ xrandommethodradio = xDialog.getChild("random-method-radio")
+ xsamplesizespin = xDialog.getChild("sample-size-spin")
+ xperiodicmethodradio = xDialog.getChild("periodic-method-radio")
+ xperiodspin = xDialog.getChild("period-spin")
+
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$9"}))
+
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$F$1"}))
+
+ xperiodicmethodradio.executeAction("CLICK", tuple())
+
+ xperiodspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xperiodspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xperiodspin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 12)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue() , 14)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue() , 16)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue() , 18)
+
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getValue(), 22)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue() , 24)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue() , 26)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue() , 28)
+
+ self.assertEqual(get_cell_by_position(document, 0, 7, 0).getValue(), 32)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 1).getValue() , 34)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 2).getValue() , 36)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 3).getValue() , 38)
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue() , 0)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue() , 0)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue() , 0)
+
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue() , 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue() , 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue() , 0)
+
+ self.assertEqual(get_cell_by_position(document, 0, 7, 0).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 1).getValue() , 0)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 2).getValue() , 0)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 3).getValue() , 0)
+
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SamplingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/tTest.py b/sc/qa/uitest/statistics/tTest.py
new file mode 100644
index 000000000..035bb4ef6
--- /dev/null
+++ b/sc/qa/uitest/statistics/tTest.py
@@ -0,0 +1,122 @@
+# -*- 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.common import select_pos
+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
+
+class tTest(UITestCase):
+ def test_tTest_column(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()
+ #fill data
+ enter_text_to_cell(gridwin, "A1", "28")
+ enter_text_to_cell(gridwin, "A2", "26")
+ enter_text_to_cell(gridwin, "A3", "31")
+ enter_text_to_cell(gridwin, "A4", "23")
+ enter_text_to_cell(gridwin, "A5", "20")
+ enter_text_to_cell(gridwin, "A6", "27")
+ enter_text_to_cell(gridwin, "A7", "28")
+ enter_text_to_cell(gridwin, "A8", "14")
+ enter_text_to_cell(gridwin, "A9", "4")
+ enter_text_to_cell(gridwin, "A10", "0")
+ enter_text_to_cell(gridwin, "A11", "2")
+ enter_text_to_cell(gridwin, "A12", "8")
+ enter_text_to_cell(gridwin, "A13", "9")
+
+ enter_text_to_cell(gridwin, "B1", "19")
+ enter_text_to_cell(gridwin, "B2", "13")
+ enter_text_to_cell(gridwin, "B3", "12")
+ enter_text_to_cell(gridwin, "B4", "5")
+ enter_text_to_cell(gridwin, "B5", "34")
+ enter_text_to_cell(gridwin, "B6", "31")
+ enter_text_to_cell(gridwin, "B7", "31")
+ enter_text_to_cell(gridwin, "B8", "12")
+ enter_text_to_cell(gridwin, "B9", "24")
+ enter_text_to_cell(gridwin, "B10", "23")
+ enter_text_to_cell(gridwin, "B11", "19")
+ enter_text_to_cell(gridwin, "B12", "10")
+ enter_text_to_cell(gridwin, "B13", "33")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"}))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:TTestDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xvariable1rangeedit = xDialog.getChild("variable1-range-edit")
+ xvariable2rangeedit = xDialog.getChild("variable2-range-edit")
+ xoutputrangeedit = xDialog.getChild("output-range-edit")
+ xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio")
+ xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")
+
+ xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"}))
+ xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"}))
+ xgroupedbycolumnsradio.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Paired t-test")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Hypothesized Mean Difference")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Mean")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Variance")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "Observations")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 7).getString(), "Pearson Correlation")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "Observed Mean Difference")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "Variance of the Differences")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "df")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "t Stat")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 12).getString(), "P (T<=t) one-tail")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "t Critical one-tail")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 14).getString(), "P (T<=t) two-tail")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 15).getString(), "t Critical two-tail")
+
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getString(), "Variable 1")
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 4).getValue(),12), 16.923076923077)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 5).getValue(),12), 125.076923076923)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 13)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 7).getValue(),12), -0.061753977175)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 8).getValue(),12), -3.538461538462)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),12), 232.935897435897)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 10).getValue(), 12)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 11).getValue(),12), -0.835926213674)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 12).getValue(),12), 0.209765144211)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 13).getValue(),12), 1.782287555649)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 14).getValue(),12), 0.419530288422)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 15).getValue(),12), 2.178812829667)
+
+ self.assertEqual(get_cell_by_position(document, 0, 7, 3).getString(), "Variable 2")
+ self.assertEqual(round(get_cell_by_position(document, 0, 7, 4).getValue(),12), 20.461538461538)
+ self.assertEqual(round(get_cell_by_position(document, 0, 7, 5).getValue(),12), 94.435897435897)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue(), 13)
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:TTestDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/tdf76731.py b/sc/qa/uitest/statistics/tdf76731.py
new file mode 100644
index 000000000..0dc1f86cb
--- /dev/null
+++ b/sc/qa/uitest/statistics/tdf76731.py
@@ -0,0 +1,73 @@
+# -*- 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.common import select_pos
+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
+import org.libreoffice.unotest
+import pathlib
+#Bug 76731 - ANOVA: F critical is not shown
+
+def get_url_for_data_file(file_name):
+ return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
+
+class anova(UITestCase):
+ def test_tdf76731_anova(self):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf76731.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #1. Open the attached sample document in Calc.
+ #2. Select the data range, i.e. A1:C5.
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C5"}))
+ #3. Choose Data - Analysis of Variance (ANOVA).
+ #4. Choose an arbitrary output cell and click OK.
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AnalysisOfVarianceDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xinputrangeedit = xDialog.getChild("input-range-edit")
+ xoutputrangeedit = xDialog.getChild("output-range-edit")
+ xradiotwofactor = xDialog.getChild("radio-two-factor")
+ xradiosinglefactor = xDialog.getChild("radio-single-factor")
+ xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio")
+ xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")
+ xalphaspin = xDialog.getChild("alpha-spin")
+
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"}))
+ xradiosinglefactor.executeAction("CLICK", tuple())
+ xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xalphaspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.05"}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #Verify, Table of results is shown, "F critical" cell has "#NAME?" error value.
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "ANOVA - Single Factor")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Groups")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Column 1")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Column 2")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "Column 3")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "Source of Variation")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "Between Groups")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "Within Groups")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "Total")
+
+ self.assertEqual(get_cell_by_position(document, 0, 11, 8).getString(), "F critical")
+ self.assertEqual(round(get_cell_by_position(document, 0, 11, 9).getValue(),9), 3.885293835)
+
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
diff --git a/sc/qa/uitest/statistics/zTest.py b/sc/qa/uitest/statistics/zTest.py
new file mode 100644
index 000000000..a7f791e1a
--- /dev/null
+++ b/sc/qa/uitest/statistics/zTest.py
@@ -0,0 +1,112 @@
+# -*- 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.common import select_pos
+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
+
+class zTest(UITestCase):
+ def test_zTest_column(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()
+ #fill data
+ enter_text_to_cell(gridwin, "A1", "28")
+ enter_text_to_cell(gridwin, "A2", "26")
+ enter_text_to_cell(gridwin, "A3", "31")
+ enter_text_to_cell(gridwin, "A4", "23")
+ enter_text_to_cell(gridwin, "A5", "20")
+ enter_text_to_cell(gridwin, "A6", "27")
+ enter_text_to_cell(gridwin, "A7", "28")
+ enter_text_to_cell(gridwin, "A8", "14")
+ enter_text_to_cell(gridwin, "A9", "4")
+ enter_text_to_cell(gridwin, "A10", "0")
+ enter_text_to_cell(gridwin, "A11", "2")
+ enter_text_to_cell(gridwin, "A12", "8")
+ enter_text_to_cell(gridwin, "A13", "9")
+
+ enter_text_to_cell(gridwin, "B1", "19")
+ enter_text_to_cell(gridwin, "B2", "13")
+ enter_text_to_cell(gridwin, "B3", "12")
+ enter_text_to_cell(gridwin, "B4", "5")
+ enter_text_to_cell(gridwin, "B5", "34")
+ enter_text_to_cell(gridwin, "B6", "31")
+ enter_text_to_cell(gridwin, "B7", "31")
+ enter_text_to_cell(gridwin, "B8", "12")
+ enter_text_to_cell(gridwin, "B9", "24")
+ enter_text_to_cell(gridwin, "B10", "23")
+ enter_text_to_cell(gridwin, "B11", "19")
+ enter_text_to_cell(gridwin, "B12", "10")
+ enter_text_to_cell(gridwin, "B13", "33")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"}))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ZTestDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xvariable1rangeedit = xDialog.getChild("variable1-range-edit")
+ xvariable2rangeedit = xDialog.getChild("variable2-range-edit")
+ xoutputrangeedit = xDialog.getChild("output-range-edit")
+ xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio")
+ xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")
+
+ xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"}))
+ xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"}))
+ xgroupedbycolumnsradio.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "z-test")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha")
+
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Hypothesized Mean Difference")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Known Variance")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Mean")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "Observations")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 7).getString(), "Observed Mean Difference")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "z")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "P (Z<=z) one-tail")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "z Critical one-tail")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "P (Z<=z) two-tail")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 12).getString(), "z Critical two-tail")
+
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getString(), "Variable 1")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue(), 0)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 5).getValue(),12), 16.923076923077)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 10).getValue(),12), 1.644853626951)
+ self.assertEqual(round(get_cell_by_position(document, 0, 6, 12).getValue(),12), 1.959963984540)
+
+ self.assertEqual(get_cell_by_position(document, 0, 7, 3).getString(), "Variable 2")
+ self.assertEqual(get_cell_by_position(document, 0, 7, 4).getValue(), 0)
+ self.assertEqual(round(get_cell_by_position(document, 0, 7, 5).getValue(),12), 20.461538461538)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue(), 13)
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+
+ # test cancel button
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ZTestDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: