diff options
Diffstat (limited to 'sc/qa/uitest/calc_tests8')
-rw-r--r-- | sc/qa/uitest/calc_tests8/navigator.py | 184 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests8/tdf119343.py | 33 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests8/tdf124829.py | 26 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests8/tdf125051.py | 40 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests8/tdf126248.py | 89 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests8/tdf131638.py | 26 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests8/tdf137726.py | 27 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests8/tdf144457.py | 47 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests8/tdf144940.py | 61 | ||||
-rwxr-xr-x | sc/qa/uitest/calc_tests8/tdf147086.py | 56 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests8/tdf152717.py | 30 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests8/tdf54768.py | 32 |
12 files changed, 651 insertions, 0 deletions
diff --git a/sc/qa/uitest/calc_tests8/navigator.py b/sc/qa/uitest/calc_tests8/navigator.py new file mode 100644 index 0000000000..ec8fa2ae9a --- /dev/null +++ b/sc/qa/uitest/calc_tests8/navigator.py @@ -0,0 +1,184 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +class navigator(UITestCase): + + def test_rename_sheet(self): + with self.ui_test.load_file(get_url_for_data_file("navigator.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWin = xCalcDoc.getChild("grid_window") + + self.xUITest.executeCommand(".uno:Sidebar") + xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"})) + + xCalcDoc = self.xUITest.getTopFocusWindow() + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") + xContentBox = xNavigatorPanel.getChild('contentbox') + xSheets = xContentBox.getChild("0") + self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets') + self.assertEqual(len(xSheets.getChildren()), 2) + self.assertEqual(get_state_as_dict(xSheets.getChild('0'))['Text'], 'Sheet1') + self.assertEqual(get_state_as_dict(xSheets.getChild('1'))['Text'], 'S2') + xRangeNames = xContentBox.getChild("1") + self.assertEqual(get_state_as_dict(xRangeNames)['Text'], 'Range names') + self.assertEqual(len(xRangeNames.getChildren()), 2) + self.assertEqual(get_state_as_dict(xRangeNames.getChild('0'))['Text'], 'first (Sheet1)') + self.assertEqual(get_state_as_dict(xRangeNames.getChild('1'))['Text'], 'second (Sheet1)') + + #The document has one comment too + xComments = xContentBox.getChild("6") + self.assertEqual(get_state_as_dict(xComments)['Text'], 'Comments') + self.assertEqual(len(xComments.getChildren()), 1) + self.assertEqual(get_state_as_dict(xComments.getChild('0'))['Text'], 'Test Comment') + + with self.ui_test.execute_dialog_through_command(".uno:RenameTable") as xDialog: + xname_entry = xDialog.getChild("name_entry") + xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT": "S1"})) + + xCalcDoc = self.xUITest.getTopFocusWindow() + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") + xContentBox = xNavigatorPanel.getChild('contentbox') + xSheets = xContentBox.getChild("0") + self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets') + self.assertEqual(len(xSheets.getChildren()), 2) + self.assertEqual(get_state_as_dict(xSheets.getChild('0'))['Text'], 'S1') + self.assertEqual(get_state_as_dict(xSheets.getChild('1'))['Text'], 'S2') + xRangeNames = xContentBox.getChild("1") + self.assertEqual(get_state_as_dict(xRangeNames)['Text'], 'Range names') + self.assertEqual(len(xRangeNames.getChildren()), 2) + self.assertEqual(get_state_as_dict(xRangeNames.getChild('0'))['Text'], 'first (S1)') + self.assertEqual(get_state_as_dict(xRangeNames.getChild('1'))['Text'], 'second (S1)') + + self.xUITest.executeCommand(".uno:Undo") + + xCalcDoc = self.xUITest.getTopFocusWindow() + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") + xContentBox = xNavigatorPanel.getChild('contentbox') + xSheets = xContentBox.getChild("0") + self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets') + self.assertEqual(len(xSheets.getChildren()), 2) + self.assertEqual(get_state_as_dict(xSheets.getChild('0'))['Text'], 'Sheet1') + self.assertEqual(get_state_as_dict(xSheets.getChild('1'))['Text'], 'S2') + xRangeNames = xContentBox.getChild("1") + self.assertEqual(get_state_as_dict(xRangeNames)['Text'], 'Range names') + self.assertEqual(len(xRangeNames.getChildren()), 2) + #FIXME: tdf#133082 + #self.assertEqual(get_state_as_dict(xRangeNames.getChild('0'))['Text'], 'first (Sheet1)') + #self.assertEqual(get_state_as_dict(xRangeNames.getChild('1'))['Text'], 'second (Sheet1)') + + self.xUITest.executeCommand(".uno:Sidebar") + + def test_tdf98493(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf98493.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWin = xCalcDoc.getChild("grid_window") + + self.assertEqual(get_state_as_dict(xGridWin)["SelectedTable"], "2") + + self.xUITest.executeCommand(".uno:Sidebar") + xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"})) + + xCalcDoc = self.xUITest.getTopFocusWindow() + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") + xToolBar = xNavigatorPanel.getChild("toolbox2") + xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'toggle' button + + xContentBox = xNavigatorPanel.getChild('contentbox') + + # tdf#133079, without the fix in place, it would be 8 + self.assertEqual(len(xContentBox.getChildren()), 1) + + xSheets = xContentBox.getChild('0') + self.assertEqual(len(xSheets.getChildren()), 12) + + #key=item position, value=sheet ( there are hidden sheets ) + results = { '1': '0', '5': '4', '6': '4', '11': '10'} + + for k, v in results.items(): + xChild = xSheets.getChild(k) + xChild.executeAction("DOUBLECLICK", tuple()) + + self.assertEqual(get_state_as_dict(xGridWin)["SelectedTable"], v) + + self.xUITest.executeCommand(".uno:Sidebar") + + + def test_tdf134390(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWin = xCalcDoc.getChild("grid_window") + + self.xUITest.executeCommand(".uno:Sidebar") + xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"})) + + xCalcDoc = self.xUITest.getTopFocusWindow() + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") + xToolBar = xNavigatorPanel.getChild("toolbox2") + xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'toggle' button + + xRow = xNavigatorPanel.getChild('row') + xColumn = xNavigatorPanel.getChild('column') + + self.assertEqual(get_state_as_dict(xColumn)['Value'], '1') + self.assertEqual(get_state_as_dict(xRow)['Value'], '1') + self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "0") + self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], "0") + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + + xColumn.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xColumn.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xColumn.executeAction("TYPE", mkPropertyValues({"TEXT":"B"})) + xColumn.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + xToolkit.processEventsToIdle() +# disable flakey UITest +# self.assertEqual(get_state_as_dict(xColumn)['Value'], '2') + + xRow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xRow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xRow.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + xRow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + xToolkit.processEventsToIdle() + self.assertEqual(get_state_as_dict(xRow)['Value'], '2') + + # Without the fix in place, this test would have failed with + # AssertionError: '0' != '1' + self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "1") +# disable flaky test +# self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], "1") + + self.xUITest.executeCommand(".uno:Sidebar") + + + def test_tdf141973(self): + with self.ui_test.load_file(get_url_for_data_file("tdf141973.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWin = xCalcDoc.getChild("grid_window") + + self.xUITest.executeCommand(".uno:Sidebar") + + # Without the fix in place, this test would have crashed here + xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"})) + + xCalcDoc = self.xUITest.getTopFocusWindow() + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") + xContentBox = xNavigatorPanel.getChild('contentbox') + xDrawings = xContentBox.getChild("7") + self.assertEqual('Drawing objects', get_state_as_dict(xDrawings)['Text']) + self.assertEqual(len(xDrawings.getChildren()), 1) + self.assertEqual('withname', get_state_as_dict(xDrawings.getChild('0'))['Text']) + + self.xUITest.executeCommand(".uno:Sidebar") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf119343.py b/sc/qa/uitest/calc_tests8/tdf119343.py new file mode 100644 index 0000000000..0d4581f18b --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf119343.py @@ -0,0 +1,33 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 119343 - EDITING: copied and pasted cells containing formulas are not recalculated (2) +class tdf119343(UITestCase): + def test_tdf119343_copy_paste_formula(self): + #numberingformatpage.ui + with self.ui_test.load_file(get_url_for_data_file("tdf119343.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "M295"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + self.xUITest.executeCommand(".uno:Paste") + #verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 12, 295).getString(), "Q11005355") + self.assertEqual(get_cell_by_position(calc_doc, 0, 12, 294).getString(), "Q1099565") + self.assertEqual(get_cell_by_position(calc_doc, 0, 12, 293).getString(), "Q108420") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf124829.py b/sc/qa/uitest/calc_tests8/tdf124829.py new file mode 100644 index 0000000000..f515b265f9 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf124829.py @@ -0,0 +1,26 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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_url_for_data_file + + +# Bug 124829 - CRASH: cutting and undoing a sheet with external links +class tdf124829(UITestCase): + def test_tdf124829_Crash_cutting_undo_sheet_external_links(self): + #numberingformatpage.ui + with self.ui_test.load_file(get_url_for_data_file("tdf124829.ods")) as calc_doc: + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Cut") + for i in range(40): + self.xUITest.executeCommand(".uno:Undo") + + #verify; no crashes + self.assertEqual(calc_doc.Sheets.getCount(), 6) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf125051.py b/sc/qa/uitest/calc_tests8/tdf125051.py new file mode 100644 index 0000000000..89314b2690 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf125051.py @@ -0,0 +1,40 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.calc import enter_text_to_cell + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 125051 - EDITING: CRASH when start SpellCheck +class tdf125051(UITestCase): + def test_tdf125051_crash_spelling_dialog(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "text") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + with self.ui_test.execute_dialog_through_command(".uno:SpellDialog"): + pass + + xDialog = self.xUITest.getTopFocusWindow() #Spelling dialog + #open options + optionsBtn = xDialog.getChild("options") + + self.ui_test.execute_dialog_through_action(optionsBtn, "CLICK", None, "DialogExecute", "cancel") + + closeBtn = xDialog.getChild("close") #close Spelling dialog + self.ui_test.close_dialog_through_button(closeBtn) + + #verify, we didn't crash + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "text") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf126248.py b/sc/qa/uitest/calc_tests8/tdf126248.py new file mode 100644 index 0000000000..9e65f9c3d5 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf126248.py @@ -0,0 +1,89 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text + +class tdf126248(UITestCase): + + def assertFontName(self, gridwin, fontName): + + #Open the sidebar + self.xUITest.executeCommand(".uno:Sidebar") + gridwin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "TextPropertyPanel"})) + + xCalcDoc = self.xUITest.getTopFocusWindow() + + xFontName = xCalcDoc.getChild("fontnamecombobox") + self.ui_test.wait_until_property_is_updated(xFontName, "Text", fontName) + self.assertEqual(fontName, get_state_as_dict(xFontName)['Text']) + + #Close the sidebar + self.xUITest.executeCommand(".uno:Sidebar") + + def changeLocalSetting(self, language): + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: + xPages = xDialog.getChild("pages") + xLanguageEntry = xPages.getChild('2') + xLanguageEntry.executeAction("EXPAND", tuple()) + xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0') + xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) + + # Check asian support is enabled + asianlanguage = xDialog.getChild("asiansupport") + self.assertEqual("true", get_state_as_dict(asianlanguage)['Selected']) + + localeSetting = xDialog.getChild("localesetting") + select_by_text(localeSetting, language) + self.ui_test.wait_until_property_is_updated(localeSetting, 'SelectEntryText', language) + self.assertEqual(language, get_state_as_dict(localeSetting)['SelectEntryText']) + + def test_tdf126248(self): + + with self.ui_test.create_doc_in_start_center("calc"): + + try: + self.changeLocalSetting("Chinese (traditional)") + + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + # Get current font names from the Format Cell dialog + westFontName = get_state_as_dict(xDialog.getChild("edWestFontName"))['Text'] + eastFontName = get_state_as_dict(xDialog.getChild("edCJKFontName"))['Text'] + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "Test") + + # Without the fix in place, this test would have failed here + self.assertFontName(gridwin, westFontName) + + enter_text_to_cell(gridwin, "B1", "測試") + + self.assertFontName(gridwin, eastFontName) + + finally: + self.changeLocalSetting("English (USA)") + + enter_text_to_cell(gridwin, "C1", "Test") + + self.assertFontName(gridwin, westFontName) + + enter_text_to_cell(gridwin, "D1", "測試") + + self.assertFontName(gridwin, eastFontName) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf131638.py b/sc/qa/uitest/calc_tests8/tdf131638.py new file mode 100644 index 0000000000..bafbfc5d85 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf131638.py @@ -0,0 +1,26 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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_url_for_data_file +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf137726(UITestCase): + + def test_tdf137726(self): + with self.ui_test.load_file(get_url_for_data_file("tdf131638.ods")) as calc_doc: + MainWindow = self.xUITest.getTopFocusWindow() + grid_window = MainWindow.getChild("grid_window") + grid_window.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + grid_window.executeAction("TYPE", mkPropertyValues({"TEXT": "-/2"})) + grid_window.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getString(), "-/2") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf137726.py b/sc/qa/uitest/calc_tests8/tdf137726.py new file mode 100644 index 0000000000..d80b51b6dc --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf137726.py @@ -0,0 +1,27 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 + +class tdf137726(UITestCase): + + def test_tdf137726(self): + with self.ui_test.create_doc_in_start_center("calc"): + # three dialogs are displayed one after the other, click OK in all of them + with self.ui_test.execute_dialog_through_command(".uno:DataDataPilotRun"): + pass + + for i in range(2): + xDialog = self.xUITest.getTopFocusWindow() + xOKBtn = xDialog.getChild('ok') + self.ui_test.close_dialog_through_button(xOKBtn) + + # Without the fix in place, this test would have hung here + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf144457.py b/sc/qa/uitest/calc_tests8/tdf144457.py new file mode 100644 index 0000000000..575171580a --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf144457.py @@ -0,0 +1,47 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf144457(UITestCase): + + def test_tdf144457(self): + + with self.ui_test.create_doc_in_start_center("calc"): + + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: + xPages = xDialog.getChild("pages") + xLanguageEntry = xPages.getChild('2') + xLanguageEntry.executeAction("EXPAND", tuple()) + xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0') + xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) + + xDatePatterns = xDialog.getChild("datepatterns") + + self.assertEqual("M/D/Y;M/D", get_state_as_dict(xDatePatterns)['Text']) + + try: + xDatePatterns.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xDatePatterns.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xDatePatterns.executeAction("TYPE", mkPropertyValues({"TEXT":"m/d/y"})) + + # Without the fix in place, this test would have failed with + # AssertionError: 'M/D/Y' != 'm/M/dM/M/d/M/M/dM/M/d/yM/M/dM/M/d/M/M/dM/M/d/y' + self.assertEqual("M/D/Y", get_state_as_dict(xDatePatterns)['Text']) + finally: + # reset default value + xDatePatterns.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xDatePatterns.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xDatePatterns.executeAction("TYPE", mkPropertyValues({"TEXT":"m/d/y;m/d"})) + + self.assertEqual("M/D/Y;M/D", get_state_as_dict(xDatePatterns)['Text']) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf144940.py b/sc/qa/uitest/calc_tests8/tdf144940.py new file mode 100644 index 0000000000..9e577bf728 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf144940.py @@ -0,0 +1,61 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 libreoffice.uno.propertyvalue import mkPropertyValues +from tempfile import TemporaryDirectory +from org.libreoffice.unotest import systemPathToFileUrl +import os.path + +class tdf144940(UITestCase): + + def test_tdf144940(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "tdf144940-tmp.ods") + + with self.ui_test.create_doc_in_start_center("calc"): + + with self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + xCheckHeaderOn = xDialog.getChild("checkHeaderOn") + xCheckSameFP = xDialog.getChild("checkSameFP") + xCheckSameLR = xDialog.getChild("checkSameLR") + + self.assertEqual("true", get_state_as_dict(xCheckHeaderOn)["Selected"]) + self.assertEqual("true", get_state_as_dict(xCheckSameLR)["Selected"]) + self.assertEqual("false", get_state_as_dict(xCheckSameFP)["Selected"]) + + xCheckSameFP.executeAction("CLICK", tuple()) + + self.assertEqual("true", get_state_as_dict(xCheckSameFP)["Selected"]) + + with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="open") as xSaveDialog: + xFileName = xSaveDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + + xPageStyles = document.StyleFamilies[1] + xDefaultPageStyle = xPageStyles[0] + + # Without the fix in place, this test would have failed with + # AssertionError: False is not true + self.assertTrue(xDefaultPageStyle.HeaderOn) + self.assertTrue(xDefaultPageStyle.FooterOn) + self.assertTrue(xDefaultPageStyle.FirstPageHeaderIsShared) + self.assertTrue(xDefaultPageStyle.FirstPageFooterIsShared) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf147086.py b/sc/qa/uitest/calc_tests8/tdf147086.py new file mode 100755 index 0000000000..1be3d6adb2 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf147086.py @@ -0,0 +1,56 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 libreoffice.uno.propertyvalue import mkPropertyValues +from com.sun.star.beans import PropertyValue +from org.libreoffice.unotest import systemPathToFileUrl +from uitest.uihelper.common import select_by_text +from tempfile import TemporaryDirectory +import os.path + +#Bug 147086 - Password in .xlsx creates readonly sheet + +class tdf147086(UITestCase): + + def test_tdf147086(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "tdf147086_tmp.xlsx") + + with self.ui_test.create_doc_in_start_center("calc"): + # Save the document + with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="") as xSaveDialog: + xFileName = xSaveDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + xFileTypeCombo = xSaveDialog.getChild("file_type") + select_by_text(xFileTypeCombo, "Excel 2007–365 (.xlsx)") + xPasswordCheckButton = xSaveDialog.getChild("password") + xPasswordCheckButton.executeAction("CLICK", tuple()) + xOpen = xSaveDialog.getChild("open") + + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK", close_button="") as xPasswordDialog: + xReadonly = xPasswordDialog.getChild("readonly") + xReadonly.executeAction("CLICK", tuple()) + + xOk = xPasswordDialog.getChild("ok") + # XLSX confirmation dialog is displayed + with self.ui_test.execute_dialog_through_action(xOk, "CLICK", close_button="save"): + pass + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath), [PropertyValue(Name="Silent", Value=True)]) as document: + + self.assertTrue(document.isReadonly()) + + self.xUITest.executeCommand(".uno:EditDoc") + + self.assertFalse(document.isReadonly()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf152717.py b/sc/qa/uitest/calc_tests8/tdf152717.py new file mode 100644 index 0000000000..7083c651ae --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf152717.py @@ -0,0 +1,30 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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_url_for_data_file +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position + +class tdf152717(UITestCase): + + def test_tdf152717(self): + + with self.ui_test.create_doc_in_start_center("calc") as calc_document: + calcDoc = self.xUITest.getTopFocusWindow() + + xGridWindow = calcDoc.getChild("grid_window") + + # Use an existing document + enter_text_to_cell(xGridWindow, "A1", "=DDE(\"soffice\";\"" + get_url_for_data_file("tdf119954.ods") + "\";\"Sheet1.A1\")") + + # Without the fix in place, this test would have failed with + # AssertionError: 1.0 != 0.0 + self.assertEqual(1.0, get_cell_by_position(calc_document, 0, 0, 0).getValue()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf54768.py b/sc/qa/uitest/calc_tests8/tdf54768.py new file mode 100644 index 0000000000..a4342fb8e2 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf54768.py @@ -0,0 +1,32 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_url_for_data_file + +class tdf54768(UITestCase): + def test_tdf54768(self): + # This document contains an image with an original size of 7.99cm x 5.74cm. + # The image has been cropped 2.73cm at the top. + # Also, it has been resized to a width of 4.04cm. + with self.ui_test.load_file(get_url_for_data_file("tdf54768.ods")) as document: + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + # select the image + xGridWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Image"})) + + # click "Original Size" + self.xUITest.executeCommand(".uno:OriginalSize") + + # tdf#155863: Without the fix in place, the image stays cropped, + # but stretches to the size of original image + self.assertEqual(7988, document.DrawPages[0].getByIndex(0).Size.Width) + self.assertEqual(3005, document.DrawPages[0].getByIndex(0).Size.Height) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |