diff options
Diffstat (limited to 'sw/qa/uitest/writer_tests7')
34 files changed, 2037 insertions, 0 deletions
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 000000000..cd4fc8222 --- /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 000000000..2e44dbea6 --- /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: + + 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 000000000..98be1cf36 --- /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")) as writer_doc: + 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 000000000..a1e9d2a7d --- /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 000000000..689410f64 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf119661.py @@ -0,0 +1,81 @@ +# -*- 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})) + + self.ui_test.wait_until_file_is_available(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 000000000..957ef31df --- /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")) as writer_doc: + 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 000000000..34201e858 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf128744.py @@ -0,0 +1,71 @@ +# -*- 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"})) + print(xPasswordDialog.getChildren()) + 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/tdf131936.py b/sw/qa/uitest/writer_tests7/tdf131936.py new file mode 100644 index 000000000..c7403bf2c --- /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"], "Office Open XML Text (Transitional) (.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 000000000..b2704b341 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf132169.py @@ -0,0 +1,43 @@ +# -*- 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: + + #set measurement to points + 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 000000000..971db5f97 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf132714.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_url_for_data_file + +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") + +# 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 000000000..8f8ff94cf --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf133348.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 + +class tdf133348(UITestCase): + def test_tdf133348(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + + self.xUITest.executeCommand(".uno:SelectAll") + xArgs = mkPropertyValues({"Text": "C1"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + + 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": "Known Author"} + actionProps = mkPropertyValues(props) + xFirstName.executeAction("TYPE", actionProps) + + xWriterDoc = self.xUITest.getTopFocusWindow() + 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()) + +# 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 000000000..9200a4ba8 --- /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")) as writer_doc: + + # 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 000000000..28dbc6f12 --- /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 000000000..22c088eb2 --- /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 000000000..00a72bec2 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf135938.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 + +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()) + xName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xName.executeAction("TYPE", mkPropertyValues({"TEXT": "DEF"})) + xInsert.executeAction("CLICK", tuple()) + + # 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") + 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 000000000..8616e5255 --- /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 000000000..3954caca1 --- /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 000000000..242d638e6 --- /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 000000000..42b8b04fa --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf140117.py @@ -0,0 +1,59 @@ +# -*- 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 + xHeaderFirstText = xPageSytle.getByIndex(0).HeaderTextFirst.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 000000000..edac0e451 --- /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 000000000..6cdf178da --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf141158.py @@ -0,0 +1,41 @@ +# -*- 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 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) + xHeaderText = xPageSytle.getByIndex(0).HeaderText.String + 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 000000000..355a9f366 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf141557.py @@ -0,0 +1,37 @@ +# -*- 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 +import org.libreoffice.unotest +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")): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + 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/tdf143574.py b/sw/qa/uitest/writer_tests7/tdf143574.py new file mode 100644 index 000000000..0fc5dc66d --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf143574.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 +import org.libreoffice.unotest +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf143574(UITestCase): + def test_tdf143574(self): + # load the sample file + with self.ui_test.load_file(get_url_for_data_file("tdf143574.odt")): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() + + # check the shape type. + self.assertEqual("com.sun.star.drawing.GroupShape", document.DrawPage.getByIndex(0).ShapeType) + + # select the shape. + self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.ui_test.wait_until_child_is_available('metricfield') + + # go inside the group + self.xUITest.executeCommand(".uno:EnterGroup"); + + # select a shape in the group + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + + # At this point the Writer crashed here before the fix. + self.xUITest.executeCommand(".uno:AddTextBox"); + + self.assertEqual(True, document.DrawPage.getByIndex(0).getByIndex(2).TextBox) + +# 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 000000000..0e069b558 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf143785.py @@ -0,0 +1,43 @@ +# -*- 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 tdf143785(UITestCase): + + def test_tdf143785(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.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") as xDialog: + 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") as xDialog: + 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 000000000..34911ee4c --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf144439.py @@ -0,0 +1,94 @@ +# -*- 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.") + + 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 000000000..f92034edc --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf144578.py @@ -0,0 +1,68 @@ +# -*- 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 + +import time + +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 000000000..b02fa4cbb --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf145093.py @@ -0,0 +1,36 @@ +# -*- 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 tdf145093(UITestCase): + def test_tdf145093(self): + # load the sample file + with self.ui_test.load_file(get_url_for_data_file("tdf39721.fodt")) as document: + + # 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 an other 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 000000000..50ef8575d --- /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 000000000..f535fad2a --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf145178.py @@ -0,0 +1,79 @@ +# -*- 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, 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 000000000..c63ae0bc9 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf146605.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 libreoffice.uno.propertyvalue import mkPropertyValues +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 000000000..8cca7c78e --- /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")) as document: + 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/tdf152964.py b/sw/qa/uitest/writer_tests7/tdf152964.py new file mode 100644 index 000000000..abbf25434 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf152964.py @@ -0,0 +1,50 @@ +# -*- 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 152964 - Undo of tracked deletion of an empty table row crashed Writer + + +class tdf152964(UITestCase): + def test_tdf152964(self): + with self.ui_test.create_doc_in_start_center("writer"): + + # redlining should be on + self.xUITest.executeCommand(".uno:TrackChanges") + # hide changes + self.xUITest.executeCommand(".uno:ShowTrackedChanges") + + # insert a table + 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()) + + # delete its second and first rows + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:DeleteRows") + self.xUITest.executeCommand(".uno:DeleteRows") + + # This crashed Writer + self.xUITest.executeCommand(".uno:Undo") + + # test other Undos and Redos + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Redo") + self.xUITest.executeCommand(".uno:Redo") + self.xUITest.executeCommand(".uno:Redo") + +# 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 000000000..575053a4f --- /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 000000000..b08c1f882 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf90401.py @@ -0,0 +1,165 @@ +# -*- 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 uitest.uihelper.common import select_pos +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 test_tdf90401_remove_personal_info(self): + + # load a test document with a tracked change, and add a comment + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, 'tdf90401-tmp.fodt') + + with self.ui_test.load_file(get_url_for_data_file('redline-autocorrect.fodt')) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild('writer_edit') + + self.xUITest.executeCommand('.uno:SelectAll') + self.xUITest.executeCommand('.uno:InsertAnnotation') + + # enable remove personal info security option + + 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'] == "false": + xRemovePersonal.executeAction('CLICK', tuple()) + self.ui_test.wait_until_property_is_updated(xRemovePersonal, "Selected", "true") + self.assertEqual(get_state_as_dict(xRemovePersonal)["Selected"], "true") + + 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()) + + # 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})) + + self.ui_test.wait_until_file_is_available(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') + + 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: + 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')) as writer_doc: + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild('writer_edit') + + self.xUITest.executeCommand('.uno:SelectAll') + self.xUITest.executeCommand('.uno:InsertAnnotation') + + # enable remove personal info security option + + 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'] == "false": + xRemovePersonal.executeAction('CLICK', tuple()) + self.ui_test.wait_until_property_is_updated(xRemovePersonal, "Selected", "true") + self.assertEqual(get_state_as_dict(xRemovePersonal)["Selected"], "true") + + 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()) + + # 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 + + self.ui_test.wait_until_file_is_available(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') + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |