diff options
Diffstat (limited to '')
27 files changed, 1574 insertions, 0 deletions
diff --git a/sd/qa/uitest/impress_tests/autocorrectOptions.py b/sd/qa/uitest/impress_tests/autocorrectOptions.py new file mode 100644 index 000000000..a79facecc --- /dev/null +++ b/sd/qa/uitest/impress_tests/autocorrectOptions.py @@ -0,0 +1,101 @@ +# -*- 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 +import time +from uitest.uihelper.common import select_pos + +class autocorrectOptions(UITestCase): + + def test_autocorrect_options_impress(self): + with self.ui_test.create_doc_in_start_center("impress"): + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + with self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab replace + origtext = xDialog.getChild("origtext") + newtext = xDialog.getChild("newtext") + xnew = xDialog.getChild("new") + xdelete = xDialog.getChild("delete") + xtabview = xDialog.getChild("tabview") + xreset = xDialog.getChild("reset") + nrRows = get_state_as_dict(xtabview)["VisibleCount"] + + self.assertTrue(int(nrRows) > 0) + + #add new rule + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) + xnew.executeAction("CLICK", tuple()) + nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"] + nrRowsDiff = int(nrRowsNew) - int(nrRows) + self.assertEqual(nrRowsDiff, 1) #we have +1 rule + #delete rule + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) + xdelete.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules + + select_pos(xTabs, "1") #tab Exceptions + #abbreviations + abbrev = xDialog.getChild("abbrev") + newabbrev = xDialog.getChild("newabbrev") + delabbrev = xDialog.getChild("delabbrev") + abbrevlist = xDialog.getChild("abbrevlist") + + nrRowsAbb = get_state_as_dict(abbrevlist)["VisibleCount"] + + self.assertTrue(int(nrRowsAbb) > 0) + + abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"})) + newabbrev.executeAction("CLICK", tuple()) + nrRowsAbbNew = get_state_as_dict(abbrevlist)["VisibleCount"] + nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb) + self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule + delabbrev.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], nrRowsAbb) #we have default nr of rules + + #words with two initial capitals + double = xDialog.getChild("double") + newdouble = xDialog.getChild("newdouble") + deldouble = xDialog.getChild("deldouble") + doublelist = xDialog.getChild("doublelist") + + nrRowsDouble = get_state_as_dict(doublelist)["VisibleCount"] + + self.assertTrue(int(nrRowsDouble) > 0) + + double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"})) + newdouble.executeAction("CLICK", tuple()) + nrRowsDoubleNew = get_state_as_dict(doublelist)["VisibleCount"] + nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and + self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule + deldouble.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(doublelist)["VisibleCount"], nrRowsDouble) #we have default nr of rules + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/customSlideShow.py b/sd/qa/uitest/impress_tests/customSlideShow.py new file mode 100644 index 000000000..f070a1ca1 --- /dev/null +++ b/sd/qa/uitest/impress_tests/customSlideShow.py @@ -0,0 +1,74 @@ +# -*- 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 +import importlib +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import get_state_as_dict, type_text + +class customSlideShow(UITestCase): + def test_customSlideShow(self): + with self.ui_test.create_doc_in_start_center("impress"): + MainWindow = self.xUITest.getTopFocusWindow() + TemplateDialog = self.xUITest.getTopFocusWindow() + cancel = TemplateDialog.getChild("close") + self.ui_test.close_dialog_through_button(cancel) + with self.ui_test.execute_dialog_through_command(".uno:CustomShowDialog") as CustomSlideShows: + new = CustomSlideShows.getChild("new") + + with self.ui_test.execute_blocking_action(new.executeAction, args=('CLICK', ())) as DefineCustomSlideShow: + customname = DefineCustomSlideShow.getChild("customname") + customname.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + customname.executeAction("TYPE", mkPropertyValues({"TEXT": "a"})) + customname.executeAction("TYPE", mkPropertyValues({"TEXT": "a"})) + pages = DefineCustomSlideShow.getChild("pages") + xEntry = pages.getChild("0") + xEntry.executeAction("SELECT", tuple()) + add = DefineCustomSlideShow.getChild("add") + add.executeAction("CLICK",tuple()) + + #verify + with self.ui_test.execute_dialog_through_command(".uno:CustomShowDialog") as CustomSlideShows: + edit = CustomSlideShows.getChild("edit") + customshowlist = CustomSlideShows.getChild("customshowlist") + self.assertEqual(get_state_as_dict(customshowlist)["SelectionCount"], "1") + + with self.ui_test.execute_blocking_action(edit.executeAction, args=('CLICK', ()), close_button="cancel") as DefineCustomSlideShow: + customname = DefineCustomSlideShow.getChild("customname") + self.assertEqual(get_state_as_dict(customname)["Text"], "aa") + custompages = DefineCustomSlideShow.getChild("custompages") + pages = DefineCustomSlideShow.getChild("pages") + remove = DefineCustomSlideShow.getChild("remove") + self.assertEqual(get_state_as_dict(custompages)["Children"], "1") + self.assertEqual(get_state_as_dict(pages)["Children"], "1") + xEntry = custompages.getChild("0") + xEntry.executeAction("SELECT", tuple()) +# remove.executeAction("CLICK",tuple()) #tdf126951 + self.assertEqual(get_state_as_dict(custompages)["Children"], "1") + self.assertEqual(get_state_as_dict(pages)["Children"], "1") + + delete = CustomSlideShows.getChild("delete") + customshowlist = CustomSlideShows.getChild("customshowlist") + self.assertEqual(get_state_as_dict(customshowlist)["Children"], "1") + +# delete.executeAction("CLICK",tuple()) +# self.assertEqual(get_state_as_dict(customshowlist)["Children"], "0") + + def test_tdf143125(self): + with self.ui_test.create_doc_in_start_center("impress"): + MainWindow = self.xUITest.getTopFocusWindow() + TemplateDialog = self.xUITest.getTopFocusWindow() + cancel = TemplateDialog.getChild("close") + self.ui_test.close_dialog_through_button(cancel) + with self.ui_test.execute_dialog_through_command(".uno:CustomShowDialog") as CustomSlideShows: + # Without the fix in place, this test would have crashed here + pass + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/embedded.py b/sd/qa/uitest/impress_tests/embedded.py new file mode 100644 index 000000000..e324424f6 --- /dev/null +++ b/sd/qa/uitest/impress_tests/embedded.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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position + +class EmbeddedDocument(UITestCase): + + def test_open_embedded_document(self): + with self.ui_test.load_file(get_url_for_data_file("embedded.pptx")): + + xImpressDoc = self.xUITest.getTopFocusWindow() + xEditWin = xImpressDoc.getChild("impress_win") + + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Object 2"})) + + xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + document = self.ui_test.get_component() + self.assertEqual("Name", get_cell_by_position(document, 0, 0, 0).getString()) + self.assertEqual("NWell", get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual("PWell", get_cell_by_position(document, 0, 0, 2).getString()) + self.assertEqual("Active", get_cell_by_position(document, 0, 0, 3).getString()) + self.assertEqual("NoPoly", get_cell_by_position(document, 0, 0, 4).getString()) + self.assertEqual("Poly", get_cell_by_position(document, 0, 0, 5).getString()) + self.assertEqual("Sized", get_cell_by_position(document, 0, 0, 6).getString()) + + self.xUITest.executeCommand(".uno:CloseDoc") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/exportToPDF.py b/sd/qa/uitest/impress_tests/exportToPDF.py new file mode 100644 index 000000000..4dcaa4954 --- /dev/null +++ b/sd/qa/uitest/impress_tests/exportToPDF.py @@ -0,0 +1,82 @@ +# -*- 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 +from org.libreoffice.unotest import systemPathToFileUrl +from tempfile import TemporaryDirectory +import os.path + +class exportToPDF(UITestCase): + + def test_checkDefaultValues(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, 'exportToPDFFromImpress-tmp.pdf') + + with self.ui_test.create_doc_in_start_center("impress"): + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + xDoc = self.xUITest.getTopFocusWindow() + xEdit = xDoc.getChild("impress_win") + + xEdit.executeAction("TYPE", mkPropertyValues({"TEXT":"Hello World"})) + + # Export as PDF + with self.ui_test.execute_dialog_through_command('.uno:ExportToPDF', close_button="") as xDialog: + + selectedChildren = ['bookmarks', 'display', 'effects', 'enablea11y', 'enablecopy', 'exporturl', 'forms', 'reduceresolution'] + + for child in selectedChildren: + self.assertEqual("true", get_state_as_dict(xDialog.getChild(child))['Selected']) + + nonSelectedChildren = ['allowdups', 'center', 'comments', 'convert', 'embed', 'emptypages', 'export', 'exportplaceholders', + 'firstonleft', 'hiddenpages', 'menubar', 'notes', 'onlynotes', 'open', 'pdfa', 'pdfua', 'resize', 'singlepagesheets', + 'tagged', 'toolbar', 'usereferencexobject', 'viewpdf', 'watermark', 'window'] + + for child in nonSelectedChildren: + self.assertEqual("false", get_state_as_dict(xDialog.getChild(child))['Selected']) + + checkedChildren = ['all', 'allbookmarks', 'changeany', 'default', 'defaultlayout', 'fitdefault', 'jpegcompress', 'pageonly', 'printhigh'] + + for child in checkedChildren: + self.assertEqual("true", get_state_as_dict(xDialog.getChild(child))['Checked']) + + nonCheckedChildren = ['changecomment', 'changeform', 'changeinsdel', 'changenone', 'contfacinglayout', 'contlayout', 'fitvis', + 'fitwidth', 'fitwin', 'fitzoom', 'losslesscompress', 'openinternet', 'openpdf', 'outline', 'printlow', 'printnone', 'range', + 'selection', 'singlelayout', 'thumbs', 'visiblebookmark'] + + for child in nonCheckedChildren: + self.assertEqual("false", get_state_as_dict(xDialog.getChild(child))['Checked']) + + self.assertEqual("300 DPI", get_state_as_dict(xDialog.getChild("resolution"))['Text']) + self.assertEqual("90", get_state_as_dict(xDialog.getChild("quality"))['Value']) + self.assertEqual("FDF", get_state_as_dict(xDialog.getChild("format"))['DisplayText']) + + xOk = xDialog.getChild("ok") + with self.ui_test.execute_dialog_through_action(xOk, "CLICK", close_button="open") as xSaveDialog: + xFileName = xSaveDialog.getChild('file_name') + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'})) + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'})) + xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath})) + + self.ui_test.wait_until_file_is_available(xFilePath) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + + self.assertEqual("", document.DrawPages[0].getByIndex(0).String) + self.assertEqual(" ", document.DrawPages[0].getByIndex(1).String) + self.assertEqual(" ", document.DrawPages[0].getByIndex(2).String) + self.assertEqual("Hello World", document.DrawPages[0].getByIndex(3).String) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/insertSlide.py b/sd/qa/uitest/impress_tests/insertSlide.py new file mode 100644 index 000000000..f81d0792f --- /dev/null +++ b/sd/qa/uitest/impress_tests/insertSlide.py @@ -0,0 +1,53 @@ +# -*- 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 +import time +from uitest.uihelper.common import select_pos +#Bug 85360 - LibreOffice crashes and crashes desktop too on inserting 4th slide + +class insertSlide(UITestCase): + + def test_insert_slide(self): + with self.ui_test.create_doc_in_start_center("impress") as document: + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + self.assertEqual(document.DrawPages.getCount(), 1) #nr. of pages + + self.xUITest.executeCommand(".uno:InsertPage") + + #verify + self.assertEqual(document.DrawPages.getCount(), 2) #nr. of pages + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.DrawPages.getCount(), 1) #nr. of pages + + def test_tdf85360_insert_4th_slide(self): + with self.ui_test.create_doc_in_start_center("impress") as document: + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + self.assertEqual(document.DrawPages.getCount(), 1) #nr. of pages + + self.xUITest.executeCommand(".uno:InsertPage") + self.xUITest.executeCommand(".uno:InsertPage") + self.xUITest.executeCommand(".uno:InsertPage") + self.xUITest.executeCommand(".uno:InsertPage") + #verify + self.assertEqual(document.DrawPages.getCount(), 5) #nr. of pages + #undo + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.DrawPages.getCount(), 1) #nr. of pages +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/masterElements.py b/sd/qa/uitest/impress_tests/masterElements.py new file mode 100644 index 000000000..ad277ca25 --- /dev/null +++ b/sd/qa/uitest/impress_tests/masterElements.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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +import time +from uitest.uihelper.common import select_pos + +class masterElements(UITestCase): + + def test_master_elements(self): + with self.ui_test.create_doc_in_start_center("impress"): + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + with self.ui_test.execute_dialog_through_command(".uno:MasterLayouts") as xDialog: + + xpagenumber = xDialog.getChild("pagenumber") + xfooter = xDialog.getChild("footer") + datetime = xDialog.getChild("datetime") + xpagenumber.executeAction("CLICK", tuple()) + xfooter.executeAction("CLICK", tuple()) + datetime.executeAction("CLICK", tuple()) + + + #verify + with self.ui_test.execute_dialog_through_command(".uno:MasterLayouts") as xDialog: + xfooter = xDialog.getChild("footer") + datetime = xDialog.getChild("datetime") + xpagenumber = xDialog.getChild("pagenumber") + + self.assertEqual(get_state_as_dict(xfooter)["Selected"], "false") + self.assertEqual(get_state_as_dict(datetime)["Selected"], "false") + self.assertEqual(get_state_as_dict(xpagenumber)["Selected"], "false") + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/masterSlides.py b/sd/qa/uitest/impress_tests/masterSlides.py new file mode 100644 index 000000000..c413537af --- /dev/null +++ b/sd/qa/uitest/impress_tests/masterSlides.py @@ -0,0 +1,47 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class masterSlides(UITestCase): + + def test_change_master_slide_from_dialog(self): + + with self.ui_test.create_doc_in_start_center("impress"): + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + xImpress = self.xUITest.getTopFocusWindow() + xMasterSlide = xImpress.getChild("masterslide") + self.assertEqual("Default", get_state_as_dict(xMasterSlide)['SelectEntryText']) + + xMasterButton = xImpress.getChild("masterslidebutton") + xMasterButton.executeAction("CLICK", tuple()) + + self.xUITest.executeCommand(".uno:InsertMasterPage") + + xCloseMasterButton = xImpress.getChild("closemasterslide") + xCloseMasterButton.executeAction("CLICK", tuple()) + + with self.ui_test.execute_dialog_through_command(".uno:PresentationLayout") as xDialog: + + xSelect = xDialog.getChild('select') + xSelect.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + + + xMasterSlide = xImpress.getChild("masterslide") + self.assertEqual("Default 1", get_state_as_dict(xMasterSlide)['SelectEntryText']) + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/renameSlide.py b/sd/qa/uitest/impress_tests/renameSlide.py new file mode 100644 index 000000000..c47e9f490 --- /dev/null +++ b/sd/qa/uitest/impress_tests/renameSlide.py @@ -0,0 +1,47 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict + +class renameSlide(UITestCase): + + def test_rename_slide(self): + with self.ui_test.create_doc_in_start_center("impress"): + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + with self.ui_test.execute_dialog_through_command(".uno:RenamePage") as xDialog: + + name_entry = xDialog.getChild("name_entry") + name_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"})) + + + #verify + with self.ui_test.execute_dialog_through_command(".uno:RenamePage") as xDialog: + + name_entry = xDialog.getChild("name_entry") + self.assertEqual(get_state_as_dict(name_entry)["Text"], "NewName") + + self.xUITest.executeCommand(".uno:InsertPage") + + with self.ui_test.execute_dialog_through_command(".uno:RenamePage", close_button="cancel") as xDialog: + + xOKBtn = xDialog.getChild("ok") + self.assertEqual("true", get_state_as_dict(xOKBtn)['Enabled']) + + name_entry = xDialog.getChild("name_entry") + name_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"})) + + self.assertEqual("false", get_state_as_dict(xOKBtn)['Enabled']) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/save_readonly_with_password.py b/sd/qa/uitest/impress_tests/save_readonly_with_password.py new file mode 100644 index 000000000..caca0126a --- /dev/null +++ b/sd/qa/uitest/impress_tests/save_readonly_with_password.py @@ -0,0 +1,107 @@ +# -*- 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 org.libreoffice.unotest import systemPathToFileUrl +from uitest.uihelper.common import select_by_text +from tempfile import TemporaryDirectory +import os.path + +class save_readonly_with_password(UITestCase): + + #Bug 145511 - FILESAVE to PPTX as read-only with additional password protection for editing not working + def test_save_to_pptx(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "tdf144374-tmp.pptx") + + with self.ui_test.create_doc_in_start_center("impress"): + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + # Save the document + with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="") as xSaveDialog: + xFileName = xSaveDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + xFileTypeCombo = xSaveDialog.getChild("file_type") + select_by_text(xFileTypeCombo, "Office Open XML Presentation (.pptx)") + xPasswordCheckButton = xSaveDialog.getChild("password") + xPasswordCheckButton.executeAction("CLICK", tuple()) + xOpen = xSaveDialog.getChild("open") + + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK", close_button="") as xPasswordDialog: + xReadonly = xPasswordDialog.getChild("readonly") + xReadonly.executeAction("CLICK", tuple()) + xNewPassword = xPasswordDialog.getChild("newpassroEntry") + xNewPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + xConfirmPassword = xPasswordDialog.getChild("confirmropassEntry") + xConfirmPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + xOk = xPasswordDialog.getChild("ok") + # PPTX confirmation dialog is displayed + with self.ui_test.execute_dialog_through_action(xOk, "CLICK", close_button="save"): + pass + + self.ui_test.wait_until_file_is_available(xFilePath) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + + self.assertTrue(document.isReadonly()) + + # Without the fix in place, this dialog wouldn't have been displayed + with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog: + xPassword = xDialog.getChild("newpassEntry") + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + self.assertFalse(document.isReadonly()) + + def test_save_to_odp(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "readonly_with_password_tmp.odp") + + with self.ui_test.create_doc_in_start_center("impress"): + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + # Save the document + with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="") as xSaveDialog: + xFileName = xSaveDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + xPasswordCheckButton = xSaveDialog.getChild("password") + xPasswordCheckButton.executeAction("CLICK", tuple()) + xOpen = xSaveDialog.getChild("open") + + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK") as xPasswordDialog: + xReadonly = xPasswordDialog.getChild("readonly") + xReadonly.executeAction("CLICK", tuple()) + xNewPassword = xPasswordDialog.getChild("newpassroEntry") + xNewPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + xConfirmPassword = xPasswordDialog.getChild("confirmropassEntry") + xConfirmPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + self.ui_test.wait_until_file_is_available(xFilePath) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + + self.assertTrue(document.isReadonly()) + + with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog: + xPassword = xDialog.getChild("newpassEntry") + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + self.assertFalse(document.isReadonly()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/slideShowSettings.py b/sd/qa/uitest/impress_tests/slideShowSettings.py new file mode 100644 index 000000000..16fbdc840 --- /dev/null +++ b/sd/qa/uitest/impress_tests/slideShowSettings.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, type_text, select_pos + +class slideShowSettings(UITestCase): + def test_slideShowSettings(self): + with self.ui_test.create_doc_in_start_center("impress"): + MainWindow = self.xUITest.getTopFocusWindow() + TemplateDialog = self.xUITest.getTopFocusWindow() + cancel = TemplateDialog.getChild("close") + self.ui_test.close_dialog_through_button(cancel) + self.xUITest.executeCommand(".uno:InsertPage") + with self.ui_test.execute_dialog_through_command(".uno:PresentationDialog") as PresentationDialog: + + xfrom = PresentationDialog.getChild("from") + xfrom.executeAction("CLICK",tuple()) + from_cb = PresentationDialog.getChild("from_cb") + select_pos(from_cb, "0") + window = PresentationDialog.getChild("window") + window.executeAction("CLICK",tuple()) + manualslides = PresentationDialog.getChild("manualslides") + manualslides.executeAction("CLICK",tuple()) + pointervisible = PresentationDialog.getChild("pointervisible") + pointervisible.executeAction("CLICK",tuple()) + pointeraspen = PresentationDialog.getChild("pointeraspen") + pointeraspen.executeAction("CLICK",tuple()) + animationsallowed = PresentationDialog.getChild("animationsallowed") + animationsallowed.executeAction("CLICK",tuple()) + changeslidesbyclick = PresentationDialog.getChild("changeslidesbyclick") + changeslidesbyclick.executeAction("CLICK",tuple()) + + #verify + with self.ui_test.execute_dialog_through_command(".uno:PresentationDialog", close_button="cancel") as PresentationDialog: + xfrom = PresentationDialog.getChild("from") + self.assertEqual(get_state_as_dict(xfrom)["Checked"], "true") + from_cb = PresentationDialog.getChild("from_cb") + self.assertEqual(get_state_as_dict(from_cb)["SelectEntryText"], "Slide 1") + manualslides = PresentationDialog.getChild("manualslides") + self.assertEqual(get_state_as_dict(manualslides)["Selected"], "true") + pointervisible = PresentationDialog.getChild("pointervisible") + self.assertEqual(get_state_as_dict(pointervisible)["Selected"], "true") + pointeraspen = PresentationDialog.getChild("pointeraspen") + self.assertEqual(get_state_as_dict(pointeraspen)["Selected"], "true") + animationsallowed = PresentationDialog.getChild("animationsallowed") + self.assertEqual(get_state_as_dict(animationsallowed)["Selected"], "false") + changeslidesbyclick = PresentationDialog.getChild("changeslidesbyclick") + self.assertEqual(get_state_as_dict(changeslidesbyclick)["Selected"], "false") + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf106612.py b/sd/qa/uitest/impress_tests/tdf106612.py new file mode 100644 index 000000000..6ca8fbbaf --- /dev/null +++ b/sd/qa/uitest/impress_tests/tdf106612.py @@ -0,0 +1,47 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict + +class Tdf106612(UITestCase): + + def test_tdf106612(self): + with self.ui_test.create_doc_in_start_center("impress"): + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + xImpressDoc = self.xUITest.getTopFocusWindow() + + xEditWin = xImpressDoc.getChild("impress_win") + + self.xUITest.executeCommand(".uno:DuplicatePage") + + self.assertEqual("2", get_state_as_dict(xEditWin)["CurrentSlide"]) + + xEditWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SdNavigatorPanel"})) + + xTree = xImpressDoc.getChild("tree") + self.assertEqual(2, len(xTree.getChildren())) + + self.assertEqual("Slide 1", get_state_as_dict(xTree.getChild('0'))['Text']) + self.assertEqual(2, len(xTree.getChild('0').getChildren())) + + self.assertEqual("Slide 2", get_state_as_dict(xTree.getChild('1'))['Text']) + self.assertEqual(2, len(xTree.getChild('1').getChildren())) + + xTree.getChild('0').executeAction("DOUBLECLICK", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: '1' != '2' + self.assertEqual("1", get_state_as_dict(xEditWin)["CurrentSlide"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf125449.py b/sd/qa/uitest/impress_tests/tdf125449.py new file mode 100644 index 000000000..242a79e65 --- /dev/null +++ b/sd/qa/uitest/impress_tests/tdf125449.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 uitest.uihelper.common import select_pos +from com.sun.star.awt.GradientStyle import LINEAR + +class tdf125449(UITestCase): + + def test_tdf125449(self): + + with self.ui_test.create_doc_in_start_center("impress") as document: + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as xPageSetupDlg: + + tabcontrol = xPageSetupDlg.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + xBtn = xPageSetupDlg.getChild('btngradient') + xBtn.executeAction("CLICK", tuple()) + + xAngle = xPageSetupDlg.getChild('anglemtr') + xAngle.executeAction("UP", tuple()) + + + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.Style, LINEAR) + self.assertEqual( + hex(document.DrawPages.getByIndex(0).Background.FillGradient.StartColor), '0xdde8cb') + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.Angle, 450) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.Border, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.XOffset, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.YOffset, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.StartIntensity, 100) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.EndIntensity, 100) + + # Without the patch in place, this test would have failed with + # AssertionError: '' != 'gradient' + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradientName, 'gradient') + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf127900.py b/sd/qa/uitest/impress_tests/tdf127900.py new file mode 100644 index 000000000..b85e602fa --- /dev/null +++ b/sd/qa/uitest/impress_tests/tdf127900.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 uitest.uihelper.common import select_pos, get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_url_for_data_file + +class tdf127900(UITestCase): + + def test_tdf127900(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf127900.fodp")) as doc: + + xMasterLang = doc.MasterPages.getByIndex(0).getByIndex(1).CharLocale.Language + xSlideLang = doc.DrawPages.getByIndex(1).getByIndex(1).CharLocale.Language + + self.assertEqual(xMasterLang, xSlideLang) + + self.xUITest.executeCommand(".uno:SlideMasterPage") + + xMaster = self.xUITest.getTopFocusWindow().getChild("impress_win") + + xMaster.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + xMaster.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDlg: + + select_pos(xDlg.getChild("cbWestLanguage"), "10") + + xMasterLang = doc.MasterPages.getByIndex(0).getByIndex(1).CharLocale.Language + xSlideLang = doc.DrawPages.getByIndex(1).getByIndex(1).CharLocale.Language + + self.assertEqual(xMasterLang, xSlideLang) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf130440.py b/sd/qa/uitest/impress_tests/tdf130440.py new file mode 100644 index 000000000..73fe44b31 --- /dev/null +++ b/sd/qa/uitest/impress_tests/tdf130440.py @@ -0,0 +1,65 @@ +# -*- 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 tdf129346(UITestCase): + + def test_run(self): + with self.ui_test.create_doc_in_start_center("impress") as document: + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + + self.assertEqual(document.CurrentController.getCurrentPage().Number, 1) + self.xUITest.executeCommand(".uno:DuplicatePage") + xToolkit.processEventsToIdle() + self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) + + xDoc = self.xUITest.getTopFocusWindow() + xEdit = xDoc.getChild("impress_win") + # Type "test" into the text box + xEdit.executeAction("TYPE", mkPropertyValues({"TEXT":"test"})) + # Go to Page 1, which also forces to end edit box + xEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "1"})) + xToolkit.processEventsToIdle() + + # We should be at Page 1 + self.assertEqual(document.CurrentController.getCurrentPage().Number, 1) + + # Undo sends us to Page 2 and undo-es the text edit + self.xUITest.executeCommand(".uno:Undo") + xToolkit.processEventsToIdle() + self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) + + # Undo sends us to page 1 and undo-es command ".uno:DuplicatePage" + self.xUITest.executeCommand(".uno:Undo") + xToolkit.processEventsToIdle() + self.assertEqual(document.CurrentController.getCurrentPage().Number, 1) + + # Redo ".uno:DuplicatePage" - we go to Page 2 + self.xUITest.executeCommand(".uno:Redo") + xToolkit.processEventsToIdle() + self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) + + # Redo text edit + self.xUITest.executeCommand(".uno:Redo") + + xDoc = self.xUITest.getTopFocusWindow() + xEdit = xDoc.getChild("impress_win") + xEdit.executeAction("TYPE", mkPropertyValues({"TEXT":"test"})) + + xToolkit.processEventsToIdle() + #Without the accompanying fix in place, it would fail with AssertionError: 2 != 1 + self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf133713.py b/sd/qa/uitest/impress_tests/tdf133713.py new file mode 100644 index 000000000..a4195fd2b --- /dev/null +++ b/sd/qa/uitest/impress_tests/tdf133713.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.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.framework import UITestCase + +class Tdf133713(UITestCase): + + def test_Tdf133713(self): + with self.ui_test.create_doc_in_start_center("impress") as document: + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + xDoc = self.xUITest.getTopFocusWindow() + xEditWin = xDoc.getChild("impress_win") + + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + + xEditWin.executeAction("TYPE", mkPropertyValues({"TEXT":"one"})) + xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xEditWin.executeAction("TYPE", mkPropertyValues({"TEXT":"two"})) + xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xEditWin.executeAction("TYPE", mkPropertyValues({"TEXT":"three"})) + + self.xUITest.executeCommand(".uno:SelectAll") + + with self.ui_test.execute_dialog_through_command(".uno:OutlineBullet") as xDialog: + xNumFormat = xDialog.getChild("numfmtlb") + xSelection = xDialog.getChild("selectionrb") + xIndent = xDialog.getChild("indentmf") + xRelSize = xDialog.getChild("relsize") + + # Check some default values + self.assertEqual("Bullet", get_state_as_dict(xNumFormat)["DisplayText"]) + self.assertEqual("true", get_state_as_dict(xSelection)["Checked"]) + self.assertEqual("0", get_state_as_dict(xIndent)["Value"]) + self.assertEqual("45%", get_state_as_dict(xRelSize)["Text"]) + + drawPage = document.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(1) + xEnumeration = shape.Text.createEnumeration() + + # Without the fix in place, this test would have failed with + # AssertionError: 0 != None + for i in range(3): + self.assertEqual(0, xEnumeration.nextElement().NumberingLevel) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf134734.py b/sd/qa/uitest/impress_tests/tdf134734.py new file mode 100644 index 000000000..404e75dd7 --- /dev/null +++ b/sd/qa/uitest/impress_tests/tdf134734.py @@ -0,0 +1,102 @@ +# -*- 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 com.sun.star.drawing.FillStyle import SOLID +import importlib + +class TestClass(UITestCase): + def test_master_page_background(self): + with self.ui_test.create_doc_in_start_center("impress") as document: + TemplateDialog = self.xUITest.getTopFocusWindow() + close = TemplateDialog.getChild("close") + self.ui_test.close_dialog_through_button(close) + + # set margins and fill color + with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog: + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize") + self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "false") + spinMargLeft = DrawPageDialog.getChild("spinMargLeft") + for _ in range(20): + spinMargLeft.executeAction("UP",tuple()) + spinMargRight = DrawPageDialog.getChild("spinMargRight") + for _ in range(15): + spinMargRight.executeAction("UP",tuple()) + spinMargTop = DrawPageDialog.getChild("spinMargTop") + for _ in range(10): + spinMargTop.executeAction("UP",tuple()) + spinMargBot = DrawPageDialog.getChild("spinMargBot") + for _ in range(5): + spinMargBot.executeAction("UP",tuple()) + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + btncolor = DrawPageDialog.getChild("btncolor") + btncolor.executeAction("CLICK",tuple()) + + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillStyle, SOLID) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderLeft, 1016) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderRight, 762) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderTop, 508) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderBottom, 254) + self.assertEqual( + document.MasterPages.getByIndex(0).BackgroundFullSize, False) + + # check it + with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog: + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize") + self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "false") + checkBackgroundFullSize.executeAction("CLICK",tuple()) + + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillStyle, SOLID) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderLeft, 1016) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderRight, 762) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderTop, 508) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderBottom, 254) + self.assertEqual( + document.MasterPages.getByIndex(0).BackgroundFullSize, True) + + # uncheck it again + with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog: + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize") + self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "true") + checkBackgroundFullSize.executeAction("CLICK",tuple()) + + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillStyle, SOLID) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderLeft, 1016) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderRight, 762) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderTop, 508) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderBottom, 254) + self.assertEqual( + document.MasterPages.getByIndex(0).BackgroundFullSize, False) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf137637.py b/sd/qa/uitest/impress_tests/tdf137637.py new file mode 100644 index 000000000..fa2a16472 --- /dev/null +++ b/sd/qa/uitest/impress_tests/tdf137637.py @@ -0,0 +1,57 @@ +# -*- 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 Tdf137637(UITestCase): + + def test_tdf137637(self): + with self.ui_test.create_doc_in_start_center("impress") as document: + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + # Insert shape with Ctrl key + xArgs = mkPropertyValues({"KeyModifier": 8192}) + self.xUITest.executeCommandWithParameters(".uno:BasicShapes.rectangle", xArgs) + + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + + xImpressDoc = self.xUITest.getTopFocusWindow() + + xEditWin = xImpressDoc.getChild("impress_win") + + xEditWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SdCustomAnimationPanel"})) + + # Without the fix in place, this test would have failed with + # AttributeError: 'NoneType' object has no attribute 'getImplementationName' + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + + xAnimationList = xImpressDoc.getChild("custom_animation_list") + self.assertEqual('0', get_state_as_dict(xAnimationList)['Children']) + + xAddBtn = xImpressDoc.getChild("add_effect") + xAddBtn.executeAction("CLICK", tuple()) + + self.assertEqual('1', get_state_as_dict(xAnimationList)['Children']) + + self.xUITest.executeCommand(".uno:Undo") + + # tdf#135033: Without the fix in place, this test would have failed with + # AssertionError: '0' != '1' + self.assertEqual('0', get_state_as_dict(xAnimationList)['Children']) + + # tdf#145030: Without the fix in place, this test would have failed with + # AttributeError: 'NoneType' object has no attribute 'getImplementationName' + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sd/qa/uitest/impress_tests/tdf137729.py b/sd/qa/uitest/impress_tests/tdf137729.py new file mode 100644 index 000000000..e5b3d1fb6 --- /dev/null +++ b/sd/qa/uitest/impress_tests/tdf137729.py @@ -0,0 +1,52 @@ +# -*- 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 select_pos +from com.sun.star.drawing.HatchStyle import SINGLE +from uitest.uihelper.common import get_state_as_dict + +class tdf137729(UITestCase): + + def test_tdf137729(self): + + with self.ui_test.create_doc_in_start_center("impress") as document: + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as xPageSetupDlg: + + tabcontrol = xPageSetupDlg.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + xBtn = xPageSetupDlg.getChild('btnhatch') + xBtn.executeAction("CLICK", tuple()) + + xDistance = xPageSetupDlg.getChild('distancemtr') + xDistance.executeAction("UP", tuple()) + + + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillHatch.Style, SINGLE ) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillHatch.Color, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillHatch.Distance, 152) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillHatch.Angle, 0) + + # Without the patch in place, this test would have failed with + # AssertionError: '' != 'hatch' + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillHatchName, 'hatch') + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf139511.py b/sd/qa/uitest/impress_tests/tdf139511.py new file mode 100644 index 000000000..3c1988510 --- /dev/null +++ b/sd/qa/uitest/impress_tests/tdf139511.py @@ -0,0 +1,52 @@ +# -*- 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 change_measurement_unit + +class tdf139511(UITestCase): + + def test_tdf139511(self): + with self.ui_test.create_doc_in_start_center("impress") as document: + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + change_measurement_unit(self, "Centimeter") + + self.xUITest.executeCommand(".uno:InsertTable?Columns:short=4&Rows:short=4") + + self.assertEqual(8004, document.DrawPages[0].getByIndex(2).BoundRect.Height) + self.assertEqual(14104, document.DrawPages[0].getByIndex(2).BoundRect.Width) + + with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog: + + + xWidth = xDialog.getChild('MTR_FLD_WIDTH') + xHeight = xDialog.getChild('MTR_FLD_HEIGHT') + + xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) + xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + xWidth.executeAction("TYPE", mkPropertyValues({"TEXT": "10"})) + + xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) + xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + xHeight.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) + + + + # Without the fix in place, this test would have failed with + # AssertionError: 5005 != 8004 + self.assertEqual(5005, document.DrawPages[0].getByIndex(2).BoundRect.Height) + self.assertEqual(10005, document.DrawPages[0].getByIndex(2).BoundRect.Width) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf141297.py b/sd/qa/uitest/impress_tests/tdf141297.py new file mode 100644 index 000000000..c7a9e3057 --- /dev/null +++ b/sd/qa/uitest/impress_tests/tdf141297.py @@ -0,0 +1,82 @@ +# -*- 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 tdf141297(UITestCase): + + def test_tdf141297(self): + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "tdf141297-tmp.odp") + + with self.ui_test.create_doc_in_start_center("impress"): + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + 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()) + + xOpen = xOpenDialog.getChild("open") + #Confirmation dialog is displayed + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK"): + pass + + with self.ui_test.execute_dialog_through_command(".uno:ManageLinks", 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:ManageLinks") + + # 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("impress_win" in xMainWin.getChildren()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf141708.py b/sd/qa/uitest/impress_tests/tdf141708.py new file mode 100644 index 000000000..bb9298f68 --- /dev/null +++ b/sd/qa/uitest/impress_tests/tdf141708.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 + +class tdf141708(UITestCase): + + def test_tdf141708(self): + + with self.ui_test.create_doc_in_start_center("impress"): + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.xUITest.executeCommand(".uno:Navigator") + + self.xUITest.executeCommand(".uno:CloseDoc") + + with self.ui_test.create_doc_in_start_center("impress"): + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + # Without the fix in place, this test would have crashed here + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf144943.py b/sd/qa/uitest/impress_tests/tdf144943.py new file mode 100644 index 000000000..9bf5a891f --- /dev/null +++ b/sd/qa/uitest/impress_tests/tdf144943.py @@ -0,0 +1,31 @@ +# -*- 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 + +#Bug 144943 - FILEOPEN PPTX Read-only passwords on PPTX files are not working + +class tdf144943(UITestCase): + + def test_tdf144943(self): + with self.ui_test.load_file(get_url_for_data_file("tdf144943.pptx")): + document = self.ui_test.get_component() + + # Without the fix in place, this test would have failed with + # AssertionError: False is not true + self.assertTrue(document.isReadonly()) + + with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog: + xPassword = xDialog.getChild("newpassEntry") + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + self.assertFalse(document.isReadonly()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf146019.py b/sd/qa/uitest/impress_tests/tdf146019.py new file mode 100644 index 000000000..16e0290ab --- /dev/null +++ b/sd/qa/uitest/impress_tests/tdf146019.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 get_url_for_data_file + +class tdf146019(UITestCase): + + def test_tdf146019(self): + + with self.ui_test.create_doc_in_start_center("impress") as document: + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + with self.ui_test.execute_dialog_through_command(".uno:InsertGraphic", close_button="open") as xOpenDialog: + + xFileName = xOpenDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf146019.jpg")})) + + # Before the fix, a dialog was displayed at this point + + # Check the shape is rotated, height > width + drawPage = document.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(2) + self.assertEqual(8996, shape.getSize().Width) + self.assertEqual(11745, shape.getSize().Height) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf82616.py b/sd/qa/uitest/impress_tests/tdf82616.py new file mode 100644 index 000000000..7f6b1db82 --- /dev/null +++ b/sd/qa/uitest/impress_tests/tdf82616.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.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import change_measurement_unit +from uitest.framework import UITestCase + +class Tdf82616(UITestCase): + + def test_tdf82616(self): + with self.ui_test.create_doc_in_start_center("impress") as document: + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + change_measurement_unit(self, 'Centimeter') + + xImpressDoc = self.xUITest.getTopFocusWindow() + + self.assertIsNone(document.CurrentSelection) + + xEditWin = xImpressDoc.getChild("impress_win") + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + + with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: + self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) + self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) + self.assertEqual('1.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) + self.assertEqual('3.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) + self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) + + xEditWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PosSizePropertyPanel"})) + + xHorizontalPos = xImpressDoc.getChild("horizontalpos") + self.ui_test.wait_until_property_is_updated(xHorizontalPos, "Value", "1.4") + self.assertEqual("1.4", get_state_as_dict(xHorizontalPos)['Value']) + + xVerticalPos = xImpressDoc.getChild("verticalpos") + self.ui_test.wait_until_property_is_updated(xVerticalPos, "Value", "3.69") + self.assertEqual("3.69", get_state_as_dict(xVerticalPos)['Value']) + + xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") + xDrawinglayerObject.executeAction("MOVE", mkPropertyValues({"X": "-5000", "Y":"-10000"})) + + with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: + self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) + self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) + self.assertEqual('-3.6', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) + self.assertEqual('-6.32', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) + self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) + + # Without the fix in place, this test would have failed with + # AssertionError: '-3.6' != '0' + self.ui_test.wait_until_property_is_updated(xHorizontalPos, "Value", "-3.6") + self.assertEqual("-3.6", get_state_as_dict(xHorizontalPos)['Value']) + + self.ui_test.wait_until_property_is_updated(xVerticalPos, "Value", "-6.32") + self.assertEqual("-6.32", get_state_as_dict(xVerticalPos)['Value']) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf91762.py b/sd/qa/uitest/impress_tests/tdf91762.py new file mode 100644 index 000000000..2b3282413 --- /dev/null +++ b/sd/qa/uitest/impress_tests/tdf91762.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 +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf91762(UITestCase): + + def test_tdf91762(self): + with self.ui_test.create_doc_in_start_center("impress") as document: + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.xUITest.executeCommand(".uno:AssignLayout?WhatLayout:long=1") + + with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog: + self.assertEqual('5', get_state_as_dict(xDialog.getChild('columns'))['Text']) + self.assertEqual('2', get_state_as_dict(xDialog.getChild('rows'))['Text']) + + self.assertEqual(1929, document.DrawPages[0].getByIndex(1).BoundRect.Height) + self.assertEqual(25198, document.DrawPages[0].getByIndex(1).Size.Width) + self.assertEqual(1923, document.DrawPages[0].getByIndex(1).Size.Height) + + self.assertEqual(1400, document.DrawPages[0].getByIndex(1).Position.X) + self.assertEqual(3685, document.DrawPages[0].getByIndex(1).Position.Y) + + xDoc = self.xUITest.getTopFocusWindow() + xEdit = xDoc.getChild("impress_win") + for i in range(5): + xEdit.executeAction("TYPE", mkPropertyValues({"TEXT":"test"})) + xEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + # tdf#138011: Without the fix in place, this test would have failed with + # AssertionError: 5504 != 3559 + self.assertEqual(5504, document.DrawPages[0].getByIndex(1).BoundRect.Height) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/textColumnsDialog.py b/sd/qa/uitest/impress_tests/textColumnsDialog.py new file mode 100644 index 000000000..2d13c6a9f --- /dev/null +++ b/sd/qa/uitest/impress_tests/textColumnsDialog.py @@ -0,0 +1,52 @@ +# -*- 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.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import change_measurement_unit, select_pos +from uitest.framework import UITestCase + +class textColumnsDialog(UITestCase): + + def test_textColumnsDialog(self): + with self.ui_test.create_doc_in_start_center("impress") as document: + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + change_measurement_unit(self, 'Centimeter') + + xImpressDoc = self.xUITest.getTopFocusWindow() + + xEditWin = xImpressDoc.getChild("impress_win") + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + + # Test defaults and set some values + with self.ui_test.execute_dialog_through_command(".uno:TextAttributes") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + colNumber = xDialog.getChild('FLD_COL_NUMBER') + colSpacing = xDialog.getChild('MTR_FLD_COL_SPACING') + self.assertEqual('1', get_state_as_dict(colNumber)['Text']) + self.assertEqual('0.00 cm', get_state_as_dict(colSpacing)['Text']) + colNumber.executeAction("SET", mkPropertyValues({"TEXT": "3"})) + colSpacing.executeAction("SET", mkPropertyValues({"TEXT": "1.5"})) + + # Test that settings persist + with self.ui_test.execute_dialog_through_command(".uno:TextAttributes") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + colNumber = xDialog.getChild('FLD_COL_NUMBER') + colSpacing = xDialog.getChild('MTR_FLD_COL_SPACING') + self.assertEqual('3', get_state_as_dict(colNumber)['Text']) + self.assertEqual('1.50 cm', get_state_as_dict(colSpacing)['Text']) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests2/tdf153161.py b/sd/qa/uitest/impress_tests2/tdf153161.py new file mode 100644 index 000000000..db14d7986 --- /dev/null +++ b/sd/qa/uitest/impress_tests2/tdf153161.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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +class TestTdf153161(UITestCase): + + def testTdf153161(self): + url = get_url_for_data_file('tdf153161_FlushToSave.odp') + + with self.ui_test.load_file(url) as document: + oldText = document.DrawPages[0].getByIndex(1).String + self.assertTrue(oldText.startswith('在没有版本控制系统的时期')) + + xImpressDoc = self.xUITest.getTopFocusWindow() + xEditWin = xImpressDoc.getChild('impress_win') + xEditWin.executeAction('SELECT', mkPropertyValues({'OBJECT':'Unnamed Drawinglayer object 1'})) + + # Type something, getting into text editing mode (appending) automatically + xEditWin.executeAction('TYPE', mkPropertyValues({'TEXT': 'Foo Bar'})) + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + self.xUITest.executeCommand('.uno:Save') + + # Reload and check that the edit was saved + with self.ui_test.load_file(url) as document: + self.assertEqual(oldText + 'Foo Bar', document.DrawPages[0].getByIndex(1).String) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |