From 267c6f2ac71f92999e969232431ba04678e7437e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 07:54:39 +0200 Subject: Adding upstream version 4:24.2.0. Signed-off-by: Daniel Baumann --- sw/qa/uitest/writer_tests7/apply_line_cap.py | 93 ++++++++++++ sw/qa/uitest/writer_tests7/forms.py | 205 +++++++++++++++++++++++++++ sw/qa/uitest/writer_tests7/tdf104795.py | 26 ++++ sw/qa/uitest/writer_tests7/tdf115853.py | 40 ++++++ sw/qa/uitest/writer_tests7/tdf119661.py | 77 ++++++++++ sw/qa/uitest/writer_tests7/tdf122780.py | 23 +++ sw/qa/uitest/writer_tests7/tdf128744.py | 70 +++++++++ sw/qa/uitest/writer_tests7/tdf130199.py | 62 ++++++++ sw/qa/uitest/writer_tests7/tdf131936.py | 24 ++++ sw/qa/uitest/writer_tests7/tdf132169.py | 42 ++++++ sw/qa/uitest/writer_tests7/tdf132714.py | 97 +++++++++++++ sw/qa/uitest/writer_tests7/tdf133348.py | 60 ++++++++ sw/qa/uitest/writer_tests7/tdf134243.py | 21 +++ sw/qa/uitest/writer_tests7/tdf134452.py | 51 +++++++ sw/qa/uitest/writer_tests7/tdf135413.py | 25 ++++ sw/qa/uitest/writer_tests7/tdf135938.py | 69 +++++++++ sw/qa/uitest/writer_tests7/tdf137802.py | 77 ++++++++++ sw/qa/uitest/writer_tests7/tdf137803.py | 49 +++++++ sw/qa/uitest/writer_tests7/tdf139301.py | 60 ++++++++ sw/qa/uitest/writer_tests7/tdf140117.py | 58 ++++++++ sw/qa/uitest/writer_tests7/tdf140863.py | 60 ++++++++ sw/qa/uitest/writer_tests7/tdf141158.py | 39 +++++ sw/qa/uitest/writer_tests7/tdf141557.py | 34 +++++ sw/qa/uitest/writer_tests7/tdf143785.py | 38 +++++ sw/qa/uitest/writer_tests7/tdf144439.py | 116 +++++++++++++++ sw/qa/uitest/writer_tests7/tdf144578.py | 66 +++++++++ sw/qa/uitest/writer_tests7/tdf145093.py | 33 +++++ sw/qa/uitest/writer_tests7/tdf145158.py | 38 +++++ sw/qa/uitest/writer_tests7/tdf145178.py | 78 ++++++++++ sw/qa/uitest/writer_tests7/tdf146605.py | 62 ++++++++ sw/qa/uitest/writer_tests7/tdf150443.py | 46 ++++++ sw/qa/uitest/writer_tests7/tdf156783.py | 63 ++++++++ sw/qa/uitest/writer_tests7/tdf156784.py | 38 +++++ sw/qa/uitest/writer_tests7/tdf156900.py | 46 ++++++ sw/qa/uitest/writer_tests7/tdf46561.py | 97 +++++++++++++ sw/qa/uitest/writer_tests7/tdf90401.py | 139 ++++++++++++++++++ 36 files changed, 2222 insertions(+) create mode 100644 sw/qa/uitest/writer_tests7/apply_line_cap.py create mode 100644 sw/qa/uitest/writer_tests7/forms.py create mode 100644 sw/qa/uitest/writer_tests7/tdf104795.py create mode 100644 sw/qa/uitest/writer_tests7/tdf115853.py create mode 100644 sw/qa/uitest/writer_tests7/tdf119661.py create mode 100644 sw/qa/uitest/writer_tests7/tdf122780.py create mode 100644 sw/qa/uitest/writer_tests7/tdf128744.py create mode 100644 sw/qa/uitest/writer_tests7/tdf130199.py create mode 100644 sw/qa/uitest/writer_tests7/tdf131936.py create mode 100644 sw/qa/uitest/writer_tests7/tdf132169.py create mode 100644 sw/qa/uitest/writer_tests7/tdf132714.py create mode 100644 sw/qa/uitest/writer_tests7/tdf133348.py create mode 100644 sw/qa/uitest/writer_tests7/tdf134243.py create mode 100644 sw/qa/uitest/writer_tests7/tdf134452.py create mode 100644 sw/qa/uitest/writer_tests7/tdf135413.py create mode 100755 sw/qa/uitest/writer_tests7/tdf135938.py create mode 100644 sw/qa/uitest/writer_tests7/tdf137802.py create mode 100644 sw/qa/uitest/writer_tests7/tdf137803.py create mode 100644 sw/qa/uitest/writer_tests7/tdf139301.py create mode 100644 sw/qa/uitest/writer_tests7/tdf140117.py create mode 100644 sw/qa/uitest/writer_tests7/tdf140863.py create mode 100644 sw/qa/uitest/writer_tests7/tdf141158.py create mode 100644 sw/qa/uitest/writer_tests7/tdf141557.py create mode 100644 sw/qa/uitest/writer_tests7/tdf143785.py create mode 100644 sw/qa/uitest/writer_tests7/tdf144439.py create mode 100644 sw/qa/uitest/writer_tests7/tdf144578.py create mode 100644 sw/qa/uitest/writer_tests7/tdf145093.py create mode 100644 sw/qa/uitest/writer_tests7/tdf145158.py create mode 100644 sw/qa/uitest/writer_tests7/tdf145178.py create mode 100644 sw/qa/uitest/writer_tests7/tdf146605.py create mode 100644 sw/qa/uitest/writer_tests7/tdf150443.py create mode 100644 sw/qa/uitest/writer_tests7/tdf156783.py create mode 100644 sw/qa/uitest/writer_tests7/tdf156784.py create mode 100644 sw/qa/uitest/writer_tests7/tdf156900.py create mode 100644 sw/qa/uitest/writer_tests7/tdf46561.py create mode 100644 sw/qa/uitest/writer_tests7/tdf90401.py (limited to 'sw/qa/uitest/writer_tests7') diff --git a/sw/qa/uitest/writer_tests7/apply_line_cap.py b/sw/qa/uitest/writer_tests7/apply_line_cap.py new file mode 100644 index 0000000000..cd4fc8222c --- /dev/null +++ b/sw/qa/uitest/writer_tests7/apply_line_cap.py @@ -0,0 +1,93 @@ +# -*- 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, get_url_for_data_file +from uitest.uihelper.common import select_pos + +class apply_line_cap(UITestCase): + + def test_apply_line_cap(self): + with self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx")) as writer_doc: + + # check FLAT -> ROUND cap style change by selecting the new 'Rounded' preset line styles + + # select second line shape (dashDot) + writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1]) + + # wait for available line style setting + self.ui_test.wait_until_child_is_available('metricfield') + + # line setting dialog window + with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg: + + # get cap style combo box + xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE") + cap_style = get_state_as_dict(xCapStyle)['SelectEntryText'] + + # get line style combo box + xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") + + # select 'Dot (Rounded)', but store the previous value + style = get_state_as_dict(xLineStyle)['SelectEntryText'] + select_pos(xLineStyle, "3") + + + self.assertEqual(cap_style, 'Flat') + self.assertEqual(style, 'Long Dash Dot') + + # check round cap setting, opening the line style dialog again + writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1]) + + # wait for available line style setting + self.ui_test.wait_until_child_is_available('metricfield') + + # line setting dialog window + with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg: + + # get cap style combo box + xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE") + cap_style = get_state_as_dict(xCapStyle)['SelectEntryText'] + + # get line style combo box + xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") + + # select 'Dot', but store the previous value + style = get_state_as_dict(xLineStyle)['SelectEntryText'] + select_pos(xLineStyle, "2") + + + # This was 'Flat' (set only dash style of the line style before) + self.assertEqual(cap_style, 'Round') + self.assertEqual(style, 'Dot (Rounded)') + + # 2. check ROUND -> FLAT cap style change + writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1]) + + # wait for available line style setting + self.ui_test.wait_until_child_is_available('metricfield') + + # line setting dialog window + with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg: + + # get cap style combo box + xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE") + cap_style = get_state_as_dict(xCapStyle)['SelectEntryText'] + + # get line style combo box + xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") + + style = get_state_as_dict(xLineStyle)['SelectEntryText'] + + + # This was 'Flat' (set only dash style of the line style before) + self.assertEqual(cap_style, 'Flat') + self.assertEqual(style, 'Dot') + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/forms.py b/sw/qa/uitest/writer_tests7/forms.py new file mode 100644 index 0000000000..3d6cbf4108 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/forms.py @@ -0,0 +1,205 @@ +# -*- 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, get_url_for_data_file +from uitest.uihelper.common import change_measurement_unit +from uitest.uihelper.common import select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues + +class Forms(UITestCase): + + def test_tdf140486(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf140486.odt")): + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""): + xChild = self.ui_test.wait_until_child_is_available('listbox-Empty string is NULL') + + # Without the fix in place, this test would have failed with + # AssertionError: 'Yes' != 'No' + self.assertEqual("Yes", get_state_as_dict(xChild)['SelectEntryText']) + + def test_tdf140198(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")): + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""): + xChild = self.ui_test.wait_until_child_is_available('listbox-Text type') + + # Without the fix in place, this test would have failed with + # AssertionError: 'Multi-line' != 'Single-line' + self.assertEqual("Multi-line", get_state_as_dict(xChild)['SelectEntryText']) + + def test_tdf141084(self): + + # Reuse document from tdf#140239 + with self.ui_test.load_file(get_url_for_data_file("tdf140239.odt")): + + with self.ui_test.execute_modeless_dialog_through_command(".uno:FormProperties", close_button=""): + xURL = self.ui_test.wait_until_child_is_available('urlcontrol-URL') + + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "3"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "4"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) + + # Without the fix in place, this test would have failed with + # AssertionError: '12345' != 'file:///tmp/tmp/5file:///tmp/tmp/4file://[40 chars]mp/1' + self.assertEqual("12345", get_state_as_dict(xURL)['Text']) + + def test_tdf140239(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf140239.odt")): + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""): + xAction = self.ui_test.wait_until_child_is_available('listbox-Action') + xURL = self.ui_test.wait_until_child_is_available('urlcontrol-URL') + xEntry = self.ui_test.wait_until_child_is_available('entry') + + self.assertEqual("None", get_state_as_dict(xAction)['SelectEntryText']) + self.assertEqual("false", get_state_as_dict(xURL)['Enabled']) + + select_by_text(xAction, "Open document/web page") + + self.assertEqual("Open document/web page", get_state_as_dict(xAction)['SelectEntryText']) + + self.ui_test.wait_until_property_is_updated(xURL, "Enabled", "true") + self.assertEqual("true", get_state_as_dict(xURL)['Enabled']) + + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "3"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "4"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) + + # Without the fix in place, this test would have failed with + # AssertionError: '12345' != '54321' + self.assertEqual("12345", get_state_as_dict(xURL)['Text']) + + xEntry.executeAction("FOCUS", tuple()) + self.assertEqual("Push Button", get_state_as_dict(xEntry)['Text']) + + xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xEntry.executeAction("TYPE", mkPropertyValues({"TEXT": "Push"})) + + # Move the focus to another element so the changes done before will take effect + xAction.executeAction("FOCUS", tuple()) + + # tdf#131522: Without the fix in place, this test would have failed with + # AssertionError: 'Push' != 'Push Button' + self.assertEqual("Push", get_state_as_dict(xEntry)['Text']) + + def test_tdf138701(self): + + # Reuse file from another test + with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")): + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""): + xChild = self.ui_test.wait_until_child_is_available('combobox-Data field') + + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "3"})) + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "4"})) + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) + + # Without the fix in place, this test would have failed with + # AssertionError: '12345' != '54321' + self.assertEqual("12345", get_state_as_dict(xChild)['Text']) + + def test_tdf139486(self): + + # Reuse file from another test + with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")) as document: + + with change_measurement_unit(self, "Centimeter"): + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + drawPage = document.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(0) + self.assertEqual(13996, shape.getSize().Width) + self.assertEqual(2408, shape.getSize().Height) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""): + xWidth = self.ui_test.wait_until_child_is_available('numericfield-Width') + xHeight = self.ui_test.wait_until_child_is_available('numericfield-Height') + + self.assertEqual("14.00 cm", get_state_as_dict(xWidth)['Text']) + self.assertEqual("2.41 cm", get_state_as_dict(xHeight)['Text']) + + xWidth.executeAction("FOCUS", tuple()) + xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xWidth.executeAction("TYPE", mkPropertyValues({"TEXT":"20 cm"})) + + self.assertEqual("20 cm", get_state_as_dict(xWidth)['Text']) + + xHeight.executeAction("FOCUS", tuple()) + xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xHeight.executeAction("TYPE", mkPropertyValues({"TEXT":"5 cm"})) + + self.assertEqual("5 cm", get_state_as_dict(xHeight)['Text']) + + # Move the focus to another element so the changes done before take effect on the document + xDialog = self.xUITest.getTopFocusWindow() + xDialog.getChild('numericfield-PositionY').executeAction("FOCUS", tuple()) + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + # Without the fix in place, the size of the form wouldn't have changed + self.assertEqual(20001, shape.getSize().Width) + self.assertEqual(5001, shape.getSize().Height) + + def test_tdf138271(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf138271.odt")): + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + aOldValue = ["-1000000.00", "1000000.00"] + aNewValue = ["-100.00", "100.00"] + + for i, name in enumerate(['formattedcontrol-Value min.', 'formattedcontrol-Value max.']): + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""): + xChild = self.ui_test.wait_until_child_is_available(name) + + self.assertEqual(aOldValue[i], get_state_as_dict(xChild)['Text']) + + xChild.executeAction("FOCUS", tuple()) + xChild.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xChild.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": aNewValue[i]})) + + #Close the dialog and open it again + self.xUITest.executeCommand(".uno:ControlProperties") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""): + xChild = self.ui_test.wait_until_child_is_available(name) + + # Without the fix in place, this test would have failed here because + # the values wouldn't have changed + self.assertEqual(aNewValue[i], get_state_as_dict(xChild)['Text']) + + self.xUITest.executeCommand(".uno:ControlProperties") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf104795.py b/sw/qa/uitest/writer_tests7/tdf104795.py new file mode 100644 index 0000000000..478a6d3726 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf104795.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_state_as_dict, get_url_for_data_file + +class tdf104795(UITestCase): + + def test_tdf104795(self): + with self.ui_test.load_file(get_url_for_data_file("tdf104795.odt")): + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog: + + sShowSignedText = get_state_as_dict(xDialog.getChild('showsigned'))['Text'] + + + # Without the fix in place, this test would have failed with + # AssertionError: '12/19/2016, 23:06:31, timur.davletshin' != '12/19/2016, 00:00:00, !!br0ken!!' + self.assertEqual("12/19/2016, 23:06:31, timur.davletshin", sShowSignedText.split('@')[0]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf115853.py b/sw/qa/uitest/writer_tests7/tdf115853.py new file mode 100644 index 0000000000..a1e9d2a7dd --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf115853.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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos + +class tdf115853(UITestCase): + + def test_tdf115853(self): + with self.ui_test.create_doc_in_start_center("writer"): + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog: + + xTabs = xDialog.getChild("tabcontrol") + + select_pos(xTabs, "2") + + xAddBtn = xDialog.getChild("add") + xAddBtn.executeAction("CLICK", tuple()) + + xNameBox1 = xDialog.getChild("namebox1") + xNameBox1.executeAction("TYPE", mkPropertyValues({"TEXT":"Text"})) + + xAddBtn = xDialog.getChild("add") + xAddBtn.executeAction("CLICK", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: 'Text' != '' + self.assertEqual("Text", get_state_as_dict(xNameBox1)['Text']) + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf119661.py b/sw/qa/uitest/writer_tests7/tdf119661.py new file mode 100644 index 0000000000..47738bacad --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf119661.py @@ -0,0 +1,77 @@ +# -*- 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 +from org.libreoffice.unotest import systemPathToFileUrl +from tempfile import TemporaryDirectory +import os.path + +class tdf119661(UITestCase): + + def test_tdf119661(self): + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "tdf119661-tmp.odt") + + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:InsertGraphic", close_button="") as xOpenDialog: + xFileName = xOpenDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("LibreOffice.jpg")})) + + xLink = xOpenDialog.getChild("link") + self.assertEqual("false", get_state_as_dict(xLink)['Selected']) + + xLink.executeAction("CLICK", tuple()) + + xOpenBtn = xOpenDialog.getChild("open") + + #Confirmation dialog is displayed + with self.ui_test.execute_dialog_through_action(xOpenBtn, 'CLICK'): + pass + + with self.ui_test.execute_dialog_through_command(".uno:LinkDialog", close_button="close") as xDialog: + + + sLinks = "TB_LINKS" + xLinks = xDialog.getChild(sLinks) + self.assertEqual(1, len(xLinks.getChildren())) + + sFileName = "FULL_FILE_NAME" + xFileName = xDialog.getChild(sFileName) + self.assertTrue(get_state_as_dict(xFileName)["Text"].endswith("/LibreOffice.jpg")) + + sBreakLink = "BREAK_LINK" + xBreakLink = xDialog.getChild(sBreakLink) + + with self.ui_test.execute_blocking_action(xBreakLink.executeAction, + args=("CLICK", tuple()), close_button="yes"): + pass + + # Save Copy as + with self.ui_test.execute_dialog_through_command(".uno:SaveAs", close_button="open") as xDialog: + + xFileName = xDialog.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)): + + self.xUITest.executeCommand(".uno:LinkDialog") + + # Since the image is no longer linked, the link dialog is not open. + # Without the fix in place, this dialog would have been opened + xMainWin = self.xUITest.getTopFocusWindow() + self.assertTrue(sLinks not in xMainWin.getChildren()) + self.assertTrue(sFileName not in xMainWin.getChildren()) + self.assertTrue(sBreakLink not in xMainWin.getChildren()) + self.assertTrue("writer_edit" in xMainWin.getChildren()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf122780.py b/sw/qa/uitest/writer_tests7/tdf122780.py new file mode 100644 index 0000000000..80fe6e4421 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf122780.py @@ -0,0 +1,23 @@ +# -*- 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, get_url_for_data_file + +class tdf122780(UITestCase): + + def test_tdf122780(self): + with self.ui_test.load_file(get_url_for_data_file("tdf122780.docx")): + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog: + + # Without the fix in place, this test would have hung here + self.assertEqual("Normal_x005F", get_state_as_dict(xDialog.getChild('showtemplate'))['Text'][:12]) + self.assertEqual(32767, len(get_state_as_dict(xDialog.getChild('showtemplate'))['Text'])) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf128744.py b/sw/qa/uitest/writer_tests7/tdf128744.py new file mode 100644 index 0000000000..5e38bc548a --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf128744.py @@ -0,0 +1,70 @@ +# -*- 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 +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import get_url_for_data_file + +class tdf128744(UITestCase): + + def test_tdf128744(self): + # load the sample file + with self.ui_test.load_file(get_url_for_data_file("tdf128744.docx")): + + # first try to unprotect Record Changes with an invalid password + + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog: + xRecordChangesCheckbox = xDialog.getChild("recordchanges") + self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true") + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") #tab Security + xProtectBtn = xDialog.getChild("protect") + + # No close_button: click on the "Ok" inside to check the "Invalid password" infobox + with self.ui_test.execute_blocking_action(xProtectBtn.executeAction, args=('CLICK', ()), close_button="") as xPasswordDialog: + self.assertEqual(get_state_as_dict(xPasswordDialog)["DisplayText"], "Enter Password") + xPassword = xPasswordDialog.getChild("pass1ed") + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "bad password"})) + xOkBtn = xPasswordDialog.getChild("ok") + with self.ui_test.execute_blocking_action(xOkBtn.executeAction, args=('CLICK', ())) as xInfoBox: + # "Invalid password" infobox + self.assertEqual(get_state_as_dict(xInfoBox)["DisplayText"], 'Information') + + # now open the dialog again and read the properties, Record Changes checkbox is still enabled + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties", close_button="cancel") as xDialog: + xRecordChangesCheckbox = xDialog.getChild("recordchanges") + self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true") + xResetBtn = xDialog.getChild("reset") + xResetBtn.executeAction("CLICK", tuple()) + + # unprotect Record Changes with the valid password "test" + + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog: + xRecordChangesCheckbox = xDialog.getChild("recordchanges") + self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true") + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") #tab Security + xProtectBtn = xDialog.getChild("protect") + + with self.ui_test.execute_blocking_action(xProtectBtn.executeAction, args=('CLICK', ())) as xPasswordDialog: + self.assertEqual(get_state_as_dict(xPasswordDialog)["DisplayText"], "Enter Password") + xPassword = xPasswordDialog.getChild("pass1ed") + # give the correct password + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "test"})) + + # now open the dialog again and read the properties, Record Changes checkbox is disabled now + with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties", close_button="cancel") as xDialog: + xRecordChangesCheckbox = xDialog.getChild("recordchanges") + self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "false") + xResetBtn = xDialog.getChild("reset") + xResetBtn.executeAction("CLICK", tuple()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf130199.py b/sw/qa/uitest/writer_tests7/tdf130199.py new file mode 100644 index 0000000000..8f9dde57b5 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf130199.py @@ -0,0 +1,62 @@ +# -*- 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 + +class tdf130199(UITestCase): + + def test_tdf130199(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + + # Insert an empty para + self.xUITest.executeCommand(".uno:InsertPara") + + # Insert an empty section + with self.ui_test.execute_dialog_through_command(".uno:InsertSection"): + pass + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + # Insert an extra empty para in the section + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + self.xUITest.executeCommand(".uno:InsertPara") + + self.assertEqual(1, len(document.TextSections)) + self.assertTrue(document.TextSections.Section1.IsVisible) + + with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog: + xHide = xDialog.getChild('hide') + self.assertEqual('false', get_state_as_dict(xHide)['Selected']) + + xHide.executeAction('CLICK', tuple()) + + self.assertFalse(document.TextSections.Section1.IsVisible) + + # Select everything and do not delete the section + self.xUITest.executeCommand(".uno:SelectAll") + + with self.ui_test.execute_dialog_through_command(".uno:Delete", close_button="no") as xDialog: + pass + + self.assertEqual(1, len(document.TextSections)) + self.assertFalse(document.TextSections.Section1.IsVisible) + + # Select everything and delete the section + self.xUITest.executeCommand(".uno:SelectAll") + + with self.ui_test.execute_dialog_through_command(".uno:Delete", close_button="yes") as xDialog: + pass + + self.assertEqual(0, len(document.TextSections)) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf131936.py b/sw/qa/uitest/writer_tests7/tdf131936.py new file mode 100644 index 0000000000..2d929c07d9 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf131936.py @@ -0,0 +1,24 @@ +# -*- 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, get_url_for_data_file + +class tdf131936(UITestCase): + + def test_tdf131936_saveas_docx_version(self): + with self.ui_test.load_file(get_url_for_data_file("tdf131936.docx")): + + with self.ui_test.execute_dialog_through_command(".uno:SaveAs", close_button="cancel") as xDialog: + xFileTypeCombo = xDialog.getChild("file_type") + state = get_state_as_dict(xFileTypeCombo) + self.assertEqual(state["SelectEntryText"], "Word 2010–365 Document (.docx)") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf132169.py b/sw/qa/uitest/writer_tests7/tdf132169.py new file mode 100644 index 0000000000..75a4f27bd4 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf132169.py @@ -0,0 +1,42 @@ +# -*- 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, get_url_for_data_file, type_text +from uitest.uihelper.common import change_measurement_unit + +class tdf132169(UITestCase): + def test_tdf132169(self): + + with self.ui_test.load_file(get_url_for_data_file("shape.odt")) as writer_doc: + + with change_measurement_unit(self, "Point"): + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + #wait until the toolbar is available + xLineMetric = self.ui_test.wait_until_child_is_available('metricfield') + self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "0.0 pt") + + #Check changing value from dialog also works + with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg: + xWidth = xFormatLineDlg.getChild('MTR_FLD_LINE_WIDTH') + type_text(xWidth, "4.0") + + self.ui_test.wait_until_property_is_updated(xLineMetric, "Text", "4.0 pt") + self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "4.0 pt") + + xLineMetric.executeAction("UP", tuple()) + + drawPage = writer_doc.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(0) + + #Without the fix in place, it would have been 310 + self.assertEqual(shape.LineWidth, 176) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf132714.py b/sw/qa/uitest/writer_tests7/tdf132714.py new file mode 100644 index 0000000000..cad8ff24e8 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf132714.py @@ -0,0 +1,97 @@ +# -*- 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.uno.propertyvalue import mkPropertyValues +from com.sun.star.awt import MouseButton +from com.sun.star.awt import MouseEvent + +class tdf132714(UITestCase): + def test_tdf132714(self): + with self.ui_test.load_file(get_url_for_data_file("tdf132714.odt")) as document: + + # delete second row (first data row) in the associated text table of the chart + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + # Without the fix in place, at this point crash occurs. + self.xUITest.executeCommand(".uno:DeleteRows") + + def test_delete_table(self): + with self.ui_test.load_file(get_url_for_data_file("tdf132714.odt")) as document: + + # delete second row (first data row) in the associated text table of the chart + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + # Without the fix in place, at this point crash occurs. + self.xUITest.executeCommand(".uno:DeleteTable") + + # select embedded chart + self.assertEqual(1, document.EmbeddedObjects.Count) + document.CurrentController.select(document.getEmbeddedObjects().getByIndex(0)) + self.assertEqual("SwXTextEmbeddedObject", document.CurrentSelection.getImplementationName()) + + xChartMainTop = self.xUITest.getTopFocusWindow() + xWriterEdit = xChartMainTop.getChild("writer_edit") + # edit object by pressing Enter + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + # create mouse event in the chart area + xFrame = document.getCurrentController().getFrame() + self.assertIsNotNone(xFrame) + xWindow = xFrame.getContainerWindow() + self.assertIsNotNone(xWindow) + + xMouseEvent = MouseEvent() + xMouseEvent.Modifiers = 0 + xMouseEvent.Buttons = MouseButton.LEFT + xMouseEvent.X = 1000 + xMouseEvent.Y = 400 + xMouseEvent.ClickCount = 1 + xMouseEvent.PopupTrigger = False + xMouseEvent.Source = xWindow + + # send mouse event + xToolkitRobot = xWindow.getToolkit() + self.assertIsNotNone(xToolkitRobot) + + # Click in the chart area + + # Without the fix in place, this test would have crashed here + xToolkitRobot.mouseMove(xMouseEvent) + + def test_data_ranges(self): + with self.ui_test.load_file(get_url_for_data_file("tdf132714.odt")) as document: + + # delete second row (first data row) in the associated text table of the chart + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + # Without the fix in place, at this point crash occurs. + self.xUITest.executeCommand(".uno:DeleteTable") + + # select embedded chart + self.assertEqual(1, document.EmbeddedObjects.Count) + document.CurrentController.select(document.getEmbeddedObjects().getByIndex(0)) + self.assertEqual("SwXTextEmbeddedObject", document.CurrentSelection.getImplementationName()) + + xChartMainTop = self.xUITest.getTopFocusWindow() + xWriterEdit = xChartMainTop.getChild("writer_edit") + # edit object by pressing Enter + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + # open DataRanges dialog window + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/Page=") + + # Without the fix in place, this test would have crashed here + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"})) as xDialog: + pass + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf133348.py b/sw/qa/uitest/writer_tests7/tdf133348.py new file mode 100644 index 0000000000..100f26cbd7 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf133348.py @@ -0,0 +1,60 @@ +# -*- 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 + +class tdf133348(UITestCase): + + def change_author_name(self, name): + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialogOpt: + xPages = xDialogOpt.getChild("pages") + xEntry = xPages.getChild('0') + xEntry.executeAction("EXPAND", tuple()) + xGeneralEntry = xEntry.getChild('0') + xGeneralEntry.executeAction("SELECT", tuple()) + xFirstName = xDialogOpt.getChild("firstname") + props = {"TEXT": name} + actionProps = mkPropertyValues(props) + xFirstName.executeAction("TYPE", actionProps) + + def test_tdf133348(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + + try: + self.xUITest.executeCommand(".uno:SelectAll") + xArgs = mkPropertyValues({"Text": "C1"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + + self.change_author_name("Known Author") + + xArgs = mkPropertyValues({"Text": "C2"}) + self.xUITest.executeCommandWithParameters(".uno:ReplyComment", xArgs) + + # Wait for async events to be processed + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + xEnum = document.TextFields.createEnumeration() + self.assertEqual(xEnum.nextElement().Author.strip(), 'Unknown Author') + self.assertEqual(xEnum.nextElement().Author.strip(), 'Known Author') + + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + + # Without the fix in place, it would have crashed here + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + + # all comments have been deleted + self.assertFalse(document.TextFields.createEnumeration().hasMoreElements()) + finally: + self.change_author_name("") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf134243.py b/sw/qa/uitest/writer_tests7/tdf134243.py new file mode 100644 index 0000000000..df6c2abf77 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf134243.py @@ -0,0 +1,21 @@ +# -*- 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 + +class tdf134243(UITestCase): + + def test_tdf134243(self): + with self.ui_test.load_file(get_url_for_data_file("tdf134243.odt")): + + # Without the fix in place, it would hung launching the mailmerge wizard + with self.ui_test.execute_dialog_through_command(".uno:MailMergeWizard", close_button="cancel"): + pass + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf134452.py b/sw/qa/uitest/writer_tests7/tdf134452.py new file mode 100644 index 0000000000..28dbc6f124 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf134452.py @@ -0,0 +1,51 @@ +# -*- 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.common import select_pos + +# Bug 134452 - Applying a table style caused the loss of break/pagedesc props of the table + + +class tdf134452(UITestCase): + def test_tdf134452(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog: + formatlbinstable = xDialog.getChild("formatlbinstable") + entry = formatlbinstable.getChild("1") + entry.executeAction("SELECT", tuple()) + #setting the break and pageDesc properties + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + xbreak = xDialog.getChild("break") + xbreak.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(xbreak)["Selected"]) + xpagestyle = xDialog.getChild("pagestyle") + xpagestyle.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(xpagestyle)["Selected"]) + + #applying table style on the table + #without the fix, break and pageDesc properties would be overridden and lost + document = self.ui_test.get_component() + tables = document.getTextTables() + tables[0].setPropertyValue("TableTemplateName", "Box List Red") + + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + xbreak = xDialog.getChild("break") + self.assertEqual("true", get_state_as_dict(xbreak)["Selected"]) + xpagestyle = xDialog.getChild("pagestyle") + self.assertEqual("true", get_state_as_dict(xpagestyle)["Selected"]) +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf135413.py b/sw/qa/uitest/writer_tests7/tdf135413.py new file mode 100644 index 0000000000..22c088eb2d --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf135413.py @@ -0,0 +1,25 @@ +# -*- 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, get_url_for_data_file + +class tdf135413(UITestCase): + + def test_tdf135413(self): + + # Without the fix in place, this test would have crashed opening the document + # It seems the issue is only reproducible when the UI is displayed, + # thus, test it with a UItest + with self.ui_test.load_file(get_url_for_data_file("tdf135413.docx")): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + self.assertEqual("16", get_state_as_dict(xWriterEdit)["Pages"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf135938.py b/sw/qa/uitest/writer_tests7/tdf135938.py new file mode 100755 index 0000000000..969b8c5b85 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf135938.py @@ -0,0 +1,69 @@ +# -*- 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 tdf135938(UITestCase): + + def test_tdf135938_cross_reference_update(self): + with self.ui_test.create_doc_in_start_center("writer"): + with self.ui_test.execute_modeless_dialog_through_command(".uno:InsertReferenceField", close_button="cancel") as xDialog: + # Select set reference type + xTreelistType = xDialog.getChild("type-ref") + xTreeEntry = xTreelistType.getChild('0') + self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "Set Reference") + xTreeEntry.executeAction("SELECT", tuple()) + + # Insert cross references + xName = xDialog.getChild("name-ref") + xName.executeAction("TYPE", mkPropertyValues({"TEXT": "ABC"})) + xInsert = xDialog.getChild("ok") + xInsert.executeAction("CLICK", tuple()) + + # See the `m_aUpdateTimer.SetTimeout(200)` (to "avoid flickering of buttons") + # in the SwChildWinWrapper ctor in sw/source/uibase/fldui/fldwrap.cxx, where that + # m_aUpdateTimer is started by SwChildWinWrapper::ReInitDlg triggered from the + # xInsert click above. + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.waitUntilAllIdlesDispatched() + + xSelect = xDialog.getChild("select-ref") + self.assertEqual("1", get_state_as_dict(xSelect)["Children"]) + self.assertEqual("ABC", get_state_as_dict(xSelect.getChild(0))["Text"]) + + xName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xName.executeAction("TYPE", mkPropertyValues({"TEXT": "DEF"})) + xInsert.executeAction("CLICK", tuple()) + + self.assertEqual("2", get_state_as_dict(xSelect)["Children"]) + self.assertEqual("ABC", get_state_as_dict(xSelect.getChild(0))["Text"]) + self.assertEqual("DEF", get_state_as_dict(xSelect.getChild(1))["Text"]) + + # Search for insert reference type + xFilter = None + for childIx in range(len(xTreelistType.getChildren())): + xTreeEntry = xTreelistType.getChild(childIx) + if get_state_as_dict(xTreeEntry)["Text"] == "Insert Reference": + xTreeEntry.executeAction("SELECT", tuple()) + # Filter the cross references + xFilter = xDialog.getChild("filter") + xFilter.executeAction("TYPE", mkPropertyValues({"TEXT": "A"})) + # Without the fix in place, this test would have failed with + # AssertionError: 'ABC' != 'DEF', i.e., the text of the name field did not change + self.assertEqual(get_state_as_dict(xName)["Text"], "ABC") + + self.assertEqual("1", get_state_as_dict(xSelect)["Children"]) + break + + # Check if insert reference entry was found + self.assertFalse(xFilter is None) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf137802.py b/sw/qa/uitest/writer_tests7/tdf137802.py new file mode 100644 index 0000000000..8616e52553 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf137802.py @@ -0,0 +1,77 @@ +# -*- 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.uno.propertyvalue import mkPropertyValues +from com.sun.star.text.TextContentAnchorType import AT_PAGE, AT_PARAGRAPH + +class tdf137802(UITestCase): + + def test_tdf137802(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf137802.odt")) as document: + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.assertEqual(document.DrawPage.getCount(), 2) + self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType) + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + self.ui_test.wait_until_child_is_available('metricfield') + + with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog: + + + xDialog.getChild('topage').executeAction("CLICK", tuple()) + + + self.assertEqual(AT_PAGE, document.DrawPage.getByIndex(0).AnchorType) + + self.assertEqual(document.DrawPage.getCount(), 2) + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + # When shape 1 is selected, esc key doesn't put the focus back to the document + # because the shape has a textbox. Move the focus to another shape with tab key + # and then use escape + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ESC"})) + + # Wait until the shape is deselected and the cursor is on the document + self.ui_test.wait_until_child_is_available('FontNameBox') + + # Delete the second paragraph. Shape 2 is anchored to this paragraph + # so it should be deleted + # tdf#137587 fly is no longer deleted by backspace so explicitly select + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+LEFT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + + self.assertEqual(document.DrawPage.getCount(), 1) + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.xUITest.executeCommand(".uno:Delete") + + self.assertEqual(document.DrawPage.getCount(), 0) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(document.DrawPage.getCount(), 1) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(document.DrawPage.getCount(), 2) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf137803.py b/sw/qa/uitest/writer_tests7/tdf137803.py new file mode 100644 index 0000000000..3954caca1b --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf137803.py @@ -0,0 +1,49 @@ +# -*- 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 + + +class tdf137803(UITestCase): + def test_tdf137803(self): + # load the sample file + with self.ui_test.load_file(get_url_for_data_file("tdf137803.odt")) as document: + + # select the shape + self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.ui_test.wait_until_child_is_available('metricfield') + + # open textattrs dialog + with self.ui_test.execute_dialog_through_command(".uno:TextAttributes") as TextDialog: + + # check autosize on + TSB_AUTOGROW_SIZE = TextDialog.getChild('TSB_AUTOGROW_SIZE') + TSB_AUTOGROW_SIZE.executeAction("CLICK",tuple()) + + # get the shape + drawPage = document.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(0) + + # and the textbox + frame = shape.getText() + + # get the positions + shapeYPos = shape.getPropertyValue("VertOrientPosition") + frameYPos = frame.getPropertyValue("VertOrientPosition") + shpsize = shape.getSize().Height + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + # without the fix, at this point the textbox falls apart so this won't be passed + self.assertLess(frameYPos, shapeYPos + shpsize) + + # close the doc + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf139301.py b/sw/qa/uitest/writer_tests7/tdf139301.py new file mode 100644 index 0000000000..242d638e6f --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf139301.py @@ -0,0 +1,60 @@ +# -*- 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, get_url_for_data_file + +class tdf139301(UITestCase): + + styles = ('Long Dash', 'Long Dash Dot', 'Long Dot', 'Double Dash', 'Double Dash Dot', 'Double Dash Dot Dot', 'Dash', 'Dash Dot', 'Dash Dot Dot', 'Dot') + + def test_tdf139301(self): + with self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx")) as writer_doc: + + for i in range(len(self.styles)): + # select next line shape + writer_doc.getCurrentController().select(writer_doc.getDrawPage()[i]) + + # wait for available line style setting + self.ui_test.wait_until_child_is_available('metricfield') + + # line setting dialog window + with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg: + # get line style combo box + xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") + + # check preset line style + style = get_state_as_dict(xLineStyle)['SelectEntryText'] + + + self.assertEqual(style, self.styles[i]) + + def test_round_cap(self): + with self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_round_cap.docx")) as writer_doc: + + style_name_extension = ' (Rounded)' + + for i in range(len(self.styles)): + # select next line shape + writer_doc.getCurrentController().select(writer_doc.getDrawPage()[i]) + + # wait for available line style setting + self.ui_test.wait_until_child_is_available('metricfield') + + # line setting dialog window + with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg: + # get line style combo box + xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") + + # check preset line style + style = get_state_as_dict(xLineStyle)['SelectEntryText'] + + + self.assertEqual(style, self.styles[i] + style_name_extension) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf140117.py b/sw/qa/uitest/writer_tests7/tdf140117.py new file mode 100644 index 0000000000..835d99219f --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf140117.py @@ -0,0 +1,58 @@ +# -*- 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 select_pos +from uitest.uihelper.common import type_text +from uitest.uihelper.common import get_url_for_data_file + +class tdf140117(UITestCase): + def test_tdf140117(self): + # load the sample file + with self.ui_test.load_file(get_url_for_data_file("tdf140117.fodt")) as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + for i in range(3): + xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"})) + + self.xUITest.executeCommand(".uno:JumpToHeader") + + xPageSytle = document.getStyleFamilies().getByIndex(2) + xHeaderText = xPageSytle.getByIndex(0).HeaderText.String + xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String + xHeaderRightText = xPageSytle.getByIndex(0).HeaderTextRight.String + + # Option "same content on left and right pages" is false, + # insert text "XXXX" before actual header text "left" on page 2 + if i == 0: + type_text(xWriterEdit, "XXXX") + + # Option "same content on left and right pages" is true, + # header of page 2 contains the same text as page 1 + elif i == 1: + self.assertEqual("right", xHeaderText) + self.assertEqual("right", xHeaderRightText) + + # Option "same content on left and right pages" is false again. + # This was "right" instead of keeping the header content disabled + # temporarily for the second interaction of the loop. + elif i == 2: + self.assertEqual("XXXXleft", xHeaderLeftText) + + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as PageDialog: + + xTabs = PageDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + # Change option "same content on left and right pages" for the next iteration + Button = xTabs.getChild('checkSameLR') + Button.executeAction("CLICK", tuple()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf140863.py b/sw/qa/uitest/writer_tests7/tdf140863.py new file mode 100644 index 0000000000..edac0e4518 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf140863.py @@ -0,0 +1,60 @@ +# -*- 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 + +class tdf140863(UITestCase): + + def test_tdf140863(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + + # Insert one section + with self.ui_test.execute_dialog_through_command(".uno:InsertSection"): + pass + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + # Insert a page break in the section + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + self.xUITest.executeCommand(".uno:InsertPagebreak") + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + + self.assertEqual(1, len(document.TextSections)) + self.assertTrue(document.TextSections.Section1.IsVisible) + + + with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog: + xHide = xDialog.getChild('hide') + self.assertEqual('false', get_state_as_dict(xHide)['Selected']) + + xHide.executeAction('CLICK', tuple()) + + + self.assertEqual(1, len(document.TextSections)) + self.assertFalse(document.TextSections.Section1.IsVisible) + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") + + with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog: + xHide = xDialog.getChild('hide') + self.assertEqual('true', get_state_as_dict(xHide)['Selected']) + + xHide.executeAction('CLICK', tuple()) + + self.assertEqual(1, len(document.TextSections)) + self.assertTrue(document.TextSections.Section1.IsVisible) + + # Without the fix in place, this test would have failed with + # AssertionError: '1' != '2' + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf141158.py b/sw/qa/uitest/writer_tests7/tdf141158.py new file mode 100644 index 0000000000..8691d801eb --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf141158.py @@ -0,0 +1,39 @@ +# -*- 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 select_pos +from uitest.uihelper.common import get_url_for_data_file + +class TestTdf141158(UITestCase): + def test_tdf141158(self): + # load the desired bugdoc + with self.ui_test.load_file(get_url_for_data_file("TestHiddenHeadersFooters.docx")) as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + # open the page styles dialog and select the headers tab + with self.ui_test.execute_dialog_through_command(".uno:PageStyleName") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + # make the same left right page header state to off and apply the setting + checkSameLR = xDialog.getChild("checkSameLR") + checkSameLR.executeAction("CLICK",tuple()) + + # go to the left header + xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"})) + self.xUITest.executeCommand(".uno:JumpToHeader") + # get the text of the header + xPageSytle = document.getStyleFamilies().getByIndex(2) + xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String + # without the fix in place it was "Right Header" (lost hidden left header), + # with the fix it should pass... + self.assertEqual("Left Header", xHeaderLeftText) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf141557.py b/sw/qa/uitest/writer_tests7/tdf141557.py new file mode 100644 index 0000000000..50c12949c0 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf141557.py @@ -0,0 +1,34 @@ +# -*- 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 com.sun.star.text.TextContentAnchorType import AS_CHARACTER, AT_PARAGRAPH +from uitest.uihelper.common import get_url_for_data_file + +class tdf141557(UITestCase): + def test_tdf141557(self): + # load the sample file + with self.ui_test.load_file(get_url_for_data_file("tdf141557.docx")): + document = self.ui_test.get_component() + + self.assertEqual(AS_CHARACTER, document.DrawPage.getByIndex(0).AnchorType) + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + self.ui_test.wait_until_child_is_available('metricfield') + + with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog: + + + xDialog.getChild('topara').executeAction("CLICK", tuple()) + + + # Without the fix in place, at this point crash occurs. + self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf143785.py b/sw/qa/uitest/writer_tests7/tdf143785.py new file mode 100644 index 0000000000..6e0890b56e --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf143785.py @@ -0,0 +1,38 @@ +# -*- 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 + +class tdf143785(UITestCase): + + def test_tdf143785(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf137802.odt")) as document: + + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + self.ui_test.wait_until_child_is_available('metricfield') + + self.assertEqual(False, document.isModified()) + + with self.ui_test.execute_dialog_through_command(".uno:TransformDialog", close_button="cancel"): + pass + + # Without the fix in place, this test would have failed with + # AssertionError: False != True + self.assertEqual(False, document.isModified()) + + with self.ui_test.execute_dialog_through_command(".uno:FormatArea", close_button="cancel"): + pass + + # tdf#143778: Without the fix in place, this test would have failed with + # AssertionError: False != True + self.assertEqual(False, document.isModified()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf144439.py b/sw/qa/uitest/writer_tests7/tdf144439.py new file mode 100644 index 0000000000..4d0ce465d5 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf144439.py @@ -0,0 +1,116 @@ +# -*- 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 type_text, select_by_text, select_pos, get_state_as_dict + +class tdf144439(UITestCase): + + def test_tdf144439_list(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + # Enter some text + type_text(xWriterEdit, "List item") + # Apply numbering + self.xUITest.executeCommand(".uno:DefaultNumbering") + # Increase level up to 2 + self.xUITest.executeCommand(".uno:IncrementIndent") + + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog: + # Select custom tab + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + # Select numbering + xNumFmt = xDialog.getChild("numfmtlb") + select_by_text(xNumFmt, "1, 2, 3, ...") + + # Increase number of sublevels to show + xSubLevels = xDialog.getChild("sublevels") + xSubLevels.executeAction("UP", tuple()) + + Paragraphs = document.Text.createEnumeration() + Para1 = Paragraphs.nextElement() + self.assertEqual(Para1.String, "List item") + self.assertEqual(Para1.getPropertyValue("ListLabelString"), "1.1.") + + # this section is checking tdf#154864 - Changing starting number of numbered list does nothing + # + + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog: + # Select custom tab + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + # Select numbering + xNumFmt = xDialog.getChild("numfmtlb") + select_by_text(xNumFmt, "1, 2, 3, ...") + + # Increase "start at" + xStartAt = xDialog.getChild("startat") + xStartAt.executeAction("UP", tuple()) + xStartAt.executeAction("UP", tuple()) + + Paragraphs = document.Text.createEnumeration() + Para1 = Paragraphs.nextElement() + self.assertEqual(Para1.String, "List item") + self.assertEqual(Para1.getPropertyValue("ListLabelString"), "1.3.") + + def test_tdf144439_outline(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + # Enter some text + type_text(xWriterEdit, "Outline2") + # Apply outline level 2 (as a style) + self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%202&FamilyName:string=ParagraphStyles") + + with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog: + # Select level "2" + xLevel = xDialog.getChild("level") + xLevel2 = xLevel.getChild("1") + xLevel2.executeAction("SELECT", tuple()) + self.assertEqual("2", get_state_as_dict(xLevel)['SelectEntryText']) + + # Select custom tab + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") + + # Select numbering + xNumFmt = xDialog.getChild("numbering") + select_by_text(xNumFmt, "1, 2, 3, ...") + + # Increase number of sublevels to show + xSubLevels = xDialog.getChild("sublevelsnf") + xSubLevels.executeAction("UP", tuple()) + + Paragraphs = document.Text.createEnumeration() + Para1 = Paragraphs.nextElement() + self.assertEqual(Para1.String, "Outline2") + self.assertEqual(Para1.getPropertyValue("ListLabelString"), "1") + + with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog: + # Select level "1" + xLevel = xDialog.getChild("level") + xLevel2 = xLevel.getChild("0") + xLevel2.executeAction("SELECT", tuple()) + self.assertEqual("1", get_state_as_dict(xLevel)['SelectEntryText']) + + # Select custom tab + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") + + # Select numbering + xNumFmt = xDialog.getChild("numbering") + select_by_text(xNumFmt, "1, 2, 3, ...") + + self.assertEqual(Para1.String, "Outline2") + self.assertEqual(Para1.getPropertyValue("ListLabelString"), "1.1") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf144578.py b/sw/qa/uitest/writer_tests7/tdf144578.py new file mode 100644 index 0000000000..bde11e6b81 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf144578.py @@ -0,0 +1,66 @@ +# -*- 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, get_url_for_data_file + +class tdf144578(UITestCase): + + def test_tdf144578(self): + with self.ui_test.load_file(get_url_for_data_file("tdf144578.odt")) as writer_doc: + with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog: + # Select level "1" + xLevelsTree = xDialog.getChild("level") + xLevel = xLevelsTree.getChild("0") + xLevel.executeAction("SELECT", tuple()) + # Check value for show upper levels + xSubLevels = xDialog.getChild("sublevelsnf") + self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "1") + + # Select level "2" + xLevel = xLevelsTree.getChild("1") + xLevel.executeAction("SELECT", tuple()) + # Check value for show upper levels + xSubLevels = xDialog.getChild("sublevelsnf") + self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "2") + + # Select level "3" + xLevel = xLevelsTree.getChild("2") + xLevel.executeAction("SELECT", tuple()) + # Check value for show upper levels + xSubLevels = xDialog.getChild("sublevelsnf") + self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "3") + + # Select level "3" + xLevel = xLevelsTree.getChild("3") + xLevel.executeAction("SELECT", tuple()) + # Check value for show upper levels + xSubLevels = xDialog.getChild("sublevelsnf") + self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "1") + + # And also verify label strings in outlines + Paragraphs = [] + ParagraphEnum = writer_doc.Text.createEnumeration() + while ParagraphEnum.hasMoreElements(): + Para = ParagraphEnum.nextElement() + Paragraphs.append(Para) + + self.assertEqual(Paragraphs[0].getPropertyValue("ListLabelString"), "I.") + self.assertEqual(Paragraphs[2].getPropertyValue("ListLabelString"), "II.") + self.assertEqual(Paragraphs[4].getPropertyValue("ListLabelString"), "II.A.") + self.assertEqual(Paragraphs[6].getPropertyValue("ListLabelString"), "II.B.") + self.assertEqual(Paragraphs[8].getPropertyValue("ListLabelString"), "III.") + self.assertEqual(Paragraphs[10].getPropertyValue("ListLabelString"), "III.A.") + self.assertEqual(Paragraphs[11].getPropertyValue("ListLabelString"), "III.A.1.") + self.assertEqual(Paragraphs[13].getPropertyValue("ListLabelString"), "III.A.2.") + self.assertEqual(Paragraphs[15].getPropertyValue("ListLabelString"), "III.B.") + self.assertEqual(Paragraphs[17].getPropertyValue("ListLabelString"), "III.C.") + self.assertEqual(Paragraphs[19].getPropertyValue("ListLabelString"), "III.C.1.") + self.assertEqual(Paragraphs[21].getPropertyValue("ListLabelString"), "III.C.2.") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf145093.py b/sw/qa/uitest/writer_tests7/tdf145093.py new file mode 100644 index 0000000000..59d4c3d3c1 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf145093.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 + +class tdf145093(UITestCase): + def test_tdf145093(self): + # load the sample file + with self.ui_test.load_file(get_url_for_data_file("tdf39721.fodt")): + + # redlining should be on + self.xUITest.executeCommand(".uno:TrackChanges") + + # Move Up/Down a list item over a tracked paragraph insertion resulted a crash + # (Note: not only at the end of the document, but check the original + # bug report temporarily, where the problem is triggered by another problem). + + self.xUITest.executeCommand(".uno:MoveDown") + self.xUITest.executeCommand(".uno:MoveDown") + # Note: Move list item from the end of the document creates an extra insertion. + # TODO: fix this other problem, and improve the test with an extra paragraph insertion + self.xUITest.executeCommand(".uno:MoveUp") + + # This was a crash (using invalid pointer) both in Show Changes and Hide Changes modes + self.xUITest.executeCommand(".uno:MoveDown") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf145158.py b/sw/qa/uitest/writer_tests7/tdf145158.py new file mode 100644 index 0000000000..50ef8575da --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf145158.py @@ -0,0 +1,38 @@ +# -*- 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 +from uitest.uihelper.common import select_by_text + +class tdf145158(UITestCase): + + def test_tdf145158(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + xMainWindow = self.xUITest.getTopFocusWindow() + xWriterEdit = xMainWindow.getChild("writer_edit") + + xFontsize = xMainWindow.getChild("fontsizecombobox") + + self.assertEqual("12 pt", get_state_as_dict(xFontsize)['Text']) + + select_by_text(xFontsize, "10.5 pt") + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Test"})) + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + xSizeFont = xDialog.getChild("cbWestSize") + + # Without the fix in place, this test would have failed with + # AssertionError: '10.5 pt' != '11 pt' + self.assertEqual("10.5 pt", get_state_as_dict(xSizeFont)['Text']) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf145178.py b/sw/qa/uitest/writer_tests7/tdf145178.py new file mode 100644 index 0000000000..328539627a --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf145178.py @@ -0,0 +1,78 @@ +# -*- 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, select_pos +from uitest.uihelper.common import get_url_for_data_file + +class tdf145178(UITestCase): + + def test_tdf145178(self): + + with self.ui_test.load_file(get_url_for_data_file('tdf145178.fodt')): + + with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog: + xTree = xDialog.getChild("tree") + self.assertEqual("1", get_state_as_dict(xTree)['Children']) + self.assertEqual("Section1", get_state_as_dict(xTree.getChild('0'))['Text']) + self.assertEqual("Section1", get_state_as_dict(xDialog.getChild('curname'))['Text']) + + xOptions = xDialog.getChild("options") + with self.ui_test.execute_blocking_action( + xOptions.executeAction, args=('CLICK', ())) as xOptDialog: + xTabs = xOptDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + + xFtnExt = xOptDialog.getChild("ftnntattextend") + xFtnNum = xOptDialog.getChild("ftnntnum") + xFtnFrm = xOptDialog.getChild("ftnntnumfmt") + xFtnPre = xOptDialog.getChild("ftnprefix") + xFtnSuf = xOptDialog.getChild("ftnsuffix") + xFtnView = xOptDialog.getChild("ftnnumviewbox") + xFtnOffset = xOptDialog.getChild("ftnoffset") + + self.assertEqual("true", get_state_as_dict(xFtnExt)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xFtnNum)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xFtnFrm)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xFtnPre)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xFtnSuf)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xFtnView)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xFtnOffset)["Enabled"]) + + self.assertEqual("1, 2, 3, ...", get_state_as_dict(xFtnView)["DisplayText"]) + self.assertEqual("(", get_state_as_dict(xFtnPre)["Text"]) + + # Without the fix in place, this test would have failed with + # AssertionError: ')' != '' + self.assertEqual(")", get_state_as_dict(xFtnSuf)["Text"]) + + self.assertEqual("3", get_state_as_dict(xFtnOffset)["Text"]) + + xEndExt = xOptDialog.getChild("endntattextend") + xEndNum = xOptDialog.getChild("endntnum") + xEndFrm = xOptDialog.getChild("endntnumfmt") + xEndPre = xOptDialog.getChild("endprefix") + xEndSuf = xOptDialog.getChild("endsuffix") + xEndView = xOptDialog.getChild("endnumviewbox") + xEndOffset = xOptDialog.getChild("endoffset") + + self.assertEqual("true", get_state_as_dict(xEndExt)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xEndNum)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xEndFrm)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xEndPre)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xEndSuf)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xEndView)["Enabled"]) + self.assertEqual("true", get_state_as_dict(xEndOffset)["Enabled"]) + + self.assertEqual("i, ii, iii, ...", get_state_as_dict(xEndView)["DisplayText"]) + self.assertEqual("[", get_state_as_dict(xEndPre)["Text"]) + self.assertEqual("]", get_state_as_dict(xEndSuf)["Text"]) + + self.assertEqual("2", get_state_as_dict(xEndOffset)["Text"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf146605.py b/sw/qa/uitest/writer_tests7/tdf146605.py new file mode 100644 index 0000000000..3de6f6c107 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf146605.py @@ -0,0 +1,62 @@ +# -*- 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, get_url_for_data_file +from uitest.uihelper.common import select_pos + +class tdf146605(UITestCase): + + def test_tdf146605(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf146605.odt")) as document: + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.assertEqual(1, len(document.TextSections)) + self.assertTrue(document.TextSections.Section1.IsVisible) + self.assertFalse(document.TextSections.Section1.FootnoteIsCollectAtTextEnd) + self.assertFalse(document.TextSections.Section1.EndnoteIsCollectAtTextEnd) + self.assertEqual("2", get_state_as_dict(xWriterEdit)["Pages"]) + + with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog: + xTree = xDialog.getChild("tree") + self.assertEqual("1", get_state_as_dict(xTree)['Children']) + self.assertEqual("Section1", get_state_as_dict(xTree.getChild('0'))['Text']) + self.assertEqual("Section1", get_state_as_dict(xDialog.getChild('curname'))['Text']) + + xOptions = xDialog.getChild("options") + with self.ui_test.execute_blocking_action( + xOptions.executeAction, args=('CLICK', ())) as xOptDialog: + xTabs = xOptDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + + xTextEnd = xOptDialog.getChild("endntattextend") + xNum = xOptDialog.getChild("endntnum") + + self.assertEqual("true", get_state_as_dict(xTextEnd)['Enabled']) + self.assertEqual("false", get_state_as_dict(xTextEnd)['Selected']) + self.assertEqual("false", get_state_as_dict(xNum)['Enabled']) + + xTextEnd.executeAction('CLICK', tuple()) + + self.assertEqual("true", get_state_as_dict(xTextEnd)['Enabled']) + self.assertEqual("true", get_state_as_dict(xTextEnd)['Selected']) + self.assertEqual("true", get_state_as_dict(xNum)['Enabled']) + + self.assertEqual(1, len(document.TextSections)) + self.assertTrue(document.TextSections.Section1.IsVisible) + self.assertFalse(document.TextSections.Section1.FootnoteIsCollectAtTextEnd) + self.assertTrue(document.TextSections.Section1.EndnoteIsCollectAtTextEnd) + + # Without the fix in place, this test would have failed with + # AssertionError: '1' != '2' + self.assertEqual("1", get_state_as_dict(xWriterEdit)["Pages"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf150443.py b/sw/qa/uitest/writer_tests7/tdf150443.py new file mode 100644 index 0000000000..fb39bd8a03 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf150443.py @@ -0,0 +1,46 @@ +# -*- 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, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf150443(UITestCase): + + def test_tdf150443(self): + with self.ui_test.load_file(get_url_for_data_file("tdf150443.docx")): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + + # search term "Jump here!" + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Jump here!"})) + xsearch = xDialog.getChild("search") + xsearch.executeAction("CLICK", tuple()) #first search + xToolkit.processEventsToIdle() + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "4") + + # reject the tracked table row in Manage Changes dialog window + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + changesList = xTrackDlg.getChild("writerchanges") + + items = len(changesList.getChildren()) + + # select tree parent of the actual tracked row deletion in tree list + changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) + xToolkit.processEventsToIdle() + + # Without the fix in place, it would have crashed here + xAccBtn = xTrackDlg.getChild("reject") + xAccBtn.executeAction("CLICK", tuple()) + self.assertEqual(items - 1, len(changesList.getChildren())) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf156783.py b/sw/qa/uitest/writer_tests7/tdf156783.py new file mode 100644 index 0000000000..2ccdb7dcf6 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf156783.py @@ -0,0 +1,63 @@ +# -*- 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.common import select_pos +from uitest.uihelper.common import get_url_for_data_file + +# Bug 156783 - crash fix: setting table border on a table without correct table cursor + +class tdf156783(UITestCase): + def test_tdf156783(self): + with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as self.document: + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + + # accept all tracked changes + self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges") + + # select all tables + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:SelectAll") + + # dialog Table Properties - Borders + with self.ui_test.execute_dialog_through_command(".uno:TableDialog", close_button="ok") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "3") + + sync = xDialog.getChild("sync") + rightmf = xDialog.getChild("rightmf") + leftmf = xDialog.getChild("leftmf") + topmf = xDialog.getChild("topmf") + bottommf = xDialog.getChild("bottommf") + sync.executeAction("CLICK", tuple()) + + rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + rightmf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"})) + leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + leftmf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"})) + topmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + topmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + topmf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"})) + bottommf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + bottommf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + bottommf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"})) + + self.assertEqual(get_state_as_dict(rightmf)["Text"], u"72pt") + self.assertEqual(get_state_as_dict(leftmf)["Text"], u"72pt") + self.assertEqual(get_state_as_dict(topmf)["Text"], u"72pt") + self.assertEqual(get_state_as_dict(bottommf)["Text"], u"72pt") + + # Without the fix in place, this test would have crashed here + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf156784.py b/sw/qa/uitest/writer_tests7/tdf156784.py new file mode 100644 index 0000000000..5cac8fc628 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf156784.py @@ -0,0 +1,38 @@ +# -*- 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 156784 - crash fix: Select All in section starting table with hidden first column + +class tdf156784(UITestCase): + def test_tdf156784(self): + with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as self.document: + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + + # accept all tracked changes + self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges") + + # delete first column + self.xUITest.executeCommand(".uno:DeleteColumns") + + # hide changes + self.xUITest.executeCommand(".uno:ShowTrackedChanges") + + # select cell content + self.xUITest.executeCommand(".uno:SelectAll") + + # This resulted crashing (select section starting table with hidden first column) + self.xUITest.executeCommand(".uno:SelectAll") + + # show changes + self.xUITest.executeCommand(".uno:ShowTrackedChanges") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf156900.py b/sw/qa/uitest/writer_tests7/tdf156900.py new file mode 100644 index 0000000000..545be94242 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf156900.py @@ -0,0 +1,46 @@ +# -*- 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 156900 - no row deletion when there is a hidden last column + +class tdf156900(UITestCase): + def test_tdf156900(self): + with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as self.document: + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + + # accept all tracked changes + self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges") + + # delete last column + self.xUITest.executeCommand(".uno:GoRight") + self.xUITest.executeCommand(".uno:GoRight") + self.xUITest.executeCommand(".uno:GoRight") + self.xUITest.executeCommand(".uno:GoRight") + self.xUITest.executeCommand(".uno:DeleteColumns") + + # hide changes + self.xUITest.executeCommand(".uno:ShowTrackedChanges") + + # delete first row + self.xUITest.executeCommand(".uno:DeleteRows") + + # accept all changes + self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges") + + tables = self.document.getTextTables() + # This was 3 (not deleted row) + self.assertEqual(len(tables[0].getRows()), 2) + + # show changes + self.xUITest.executeCommand(".uno:ShowTrackedChanges") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf46561.py b/sw/qa/uitest/writer_tests7/tdf46561.py new file mode 100644 index 0000000000..575053a4f2 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf46561.py @@ -0,0 +1,97 @@ +# -*- 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 select_pos +from uitest.uihelper.common import type_text +from uitest.uihelper.common import get_url_for_data_file + +class tdf46561(UITestCase): + def check_header_texts(self, master="", first="", left="", right=""): + # Get the current header style and its text contents + xPageStyle = self.document.getStyleFamilies().getByIndex(2) + xHeaderText = xPageStyle.getByIndex(0).HeaderText.String + xHeaderTextFirst = xPageStyle.getByIndex(0).HeaderTextFirst.String + xHeaderTextLeft = xPageStyle.getByIndex(0).HeaderTextLeft.String + xHeaderTextRight = xPageStyle.getByIndex(0).HeaderTextRight.String + + # Check the current values + self.assertEqual(master, xHeaderText) + self.assertEqual(first, xHeaderTextFirst) + self.assertEqual(left, xHeaderTextLeft) + self.assertEqual(right, xHeaderTextRight) + + def test_tdf46561(self): + with self.ui_test.load_file(get_url_for_data_file("tdf46561.odt")): + self.document = self.ui_test.get_component() + self.check_header_texts(master="right", first="1st", left="left", right="right") + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"})) + self.xUITest.executeCommand(".uno:JumpToHeader") + + # Switch "same left and right page headers" on and off a few times + for _ in range(4): + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as PageDialog: + + xTabs = PageDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + Button = xTabs.getChild('checkSameLR') + Button.executeAction("CLICK",tuple()) + + # We should be back to the starting state after 2*k on/off changes + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Enter some additional text in the left page header + type_text(xWriterEdit, "XXXX") + self.check_header_texts(master="right", first="1st", left="XXXXleft", right="right") + + # Now go back one change (before entering "XXXX") + self.xUITest.executeCommand(".uno:Undo") + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Undo the fourth change + self.xUITest.executeCommand(".uno:Undo") + self.check_header_texts(master="right", first="1st", left="right", right="right") + + # Undo the third change + self.xUITest.executeCommand(".uno:Undo") + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Undo the second change + self.xUITest.executeCommand(".uno:Undo") + self.check_header_texts(master="right", first="1st", left="right", right="right") + + # Undo the first change + self.xUITest.executeCommand(".uno:Undo") + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Redo the first change + self.xUITest.executeCommand(".uno:Redo") + self.check_header_texts(master="right", first="1st", left="right", right="right") + + # Redo the second change + self.xUITest.executeCommand(".uno:Redo") + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Redo the third change + self.xUITest.executeCommand(".uno:Redo") + self.check_header_texts(master="right", first="1st", left="right", right="right") + + # Redo the fourth change + self.xUITest.executeCommand(".uno:Redo") + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Redo the final change + self.xUITest.executeCommand(".uno:Redo") + self.check_header_texts(master="right", first="1st", left="XXXXleft", right="right") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf90401.py b/sw/qa/uitest/writer_tests7/tdf90401.py new file mode 100644 index 0000000000..95cc966e1d --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf90401.py @@ -0,0 +1,139 @@ +# -*- 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 type_text +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from org.libreoffice.unotest import systemPathToFileUrl +from tempfile import TemporaryDirectory +import os.path +#Bug 90401 - remove personal info on redlines and annotations + +class tdf90401(UITestCase): + + def change_security_option(self, enabled): + with self.ui_test.execute_dialog_through_command('.uno:OptionsTreeDialog') as xDialog: + xPages = xDialog.getChild('pages') + xGenEntry = xPages.getChild('0') + xSecurityPage = xGenEntry.getChild('6') + xSecurityPage.executeAction('SELECT', tuple()) + # Click Button Options... + xOptions = xDialog.getChild('options') + + with self.ui_test.execute_blocking_action(xOptions.executeAction, args=('CLICK', ()), close_button="") as dialog: + xRemovePersonal = dialog.getChild('removepersonal') + if get_state_as_dict(xRemovePersonal)['Selected'] != enabled: + xRemovePersonal.executeAction('CLICK', tuple()) + self.ui_test.wait_until_property_is_updated(xRemovePersonal, "Selected", enabled) + self.assertEqual(get_state_as_dict(xRemovePersonal)["Selected"], enabled) + + xOkBtn = dialog.getChild('ok') + # FIXME: we can't use close_dialog_through_button here, the dialog doesn't emit the + # event DialogClosed after closing + xOkBtn.executeAction('CLICK', tuple()) + + def test_tdf90401_remove_personal_info(self): + # load a test document with a tracked change, and add a comment + + with TemporaryDirectory() as tempdir: + try: + self.change_security_option("true") + + xFilePath = os.path.join(tempdir, 'tdf90401-tmp.fodt') + + with self.ui_test.load_file(get_url_for_data_file('redline-autocorrect.fodt')): + self.xUITest.executeCommand('.uno:SelectAll') + self.xUITest.executeCommand('.uno:InsertAnnotation') + + # Save Copy as + with self.ui_test.execute_dialog_through_command('.uno:SaveAs', close_button="open") as xDialog: + xFileName = xDialog.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 writer_doc2: + + # check removed personal info on comments + + textfields = writer_doc2.getTextFields() + author = "" + year = -1 + for textfield in textfields: + if textfield.supportsService("com.sun.star.text.TextField.Annotation"): + author = textfield.Author + year = textfield.Date.Year + # This was 'Unknown Author' + self.assertEqual(author, 'Author2') + # This was 2021 + self.assertEqual(year, 0) + + # check removed personal info on tracked changes + with self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges', close_button="close") as xTrackDlg: + xTreeList = xTrackDlg.getChild('writerchanges') + state = get_state_as_dict(xTreeList) + # This was 'NL\t11/03/2020 19:19:05\t', containing personal info + self.assertEqual(state['SelectEntryText'], 'Author1\t01/01/1970 00:00:00\t') + finally: + self.change_security_option("false") + + def test_tdf142902_remove_personal_info_in_DOCX(self): + # load a test document with a tracked change, and add a comment + with TemporaryDirectory() as tempdir: + try: + self.change_security_option("true") + + xFilePath = os.path.join(tempdir, 'redline-para-join-tmp.docx') + + with self.ui_test.load_file(get_url_for_data_file('redline-para-join.docx')): + + self.xUITest.executeCommand('.uno:SelectAll') + self.xUITest.executeCommand('.uno:InsertAnnotation') + + # Save Copy as + with self.ui_test.execute_dialog_through_command('.uno:SaveAs', close_button="") as xDialog: + xFileName = xDialog.getChild('file_name') + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'})) + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'})) + xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath})) + + xOpen = xDialog.getChild("open") + # DOCX confirmation dialog is displayed + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK", close_button="save"): + pass + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as writer_doc2: + + # check removed personal info on comments + + textfields = writer_doc2.getTextFields() + author = "" + year = -1 + for textfield in textfields: + if textfield.supportsService("com.sun.star.text.TextField.Annotation"): + author = textfield.Author + year = textfield.Date.Year + # This was 'Unknown Author' + self.assertEqual(author, 'Author2') + # This was 2021 + self.assertEqual(year, 0) + + # check removed personal info on tracked changes + + with self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges', close_button="close") as xTrackDlg: + xTreeList = xTrackDlg.getChild('writerchanges') + state = get_state_as_dict(xTreeList) + # This was 'NL\t11/03/2020 19:19:05\t', containing personal info + self.assertEqual(state['SelectEntryText'], 'Author1\t01/01/1970 00:00:00\t') + finally: + self.change_security_option("false") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: -- cgit v1.2.3