sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py | 83 +++++----- sw/source/core/crsr/swcrsr.cxx | 7 2 files changed, 45 insertions(+), 45 deletions(-)
New commits: commit c3ec8b8d9db7b2e985b25f0e765c227c2477bf87 Author: Xisco Fauli <[email protected]> AuthorDate: Tue Jan 31 11:39:42 2023 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Tue Jan 31 14:56:30 2023 +0000 uitest: Always change doc info setting back to false otherwise it won't be changed if an exception is raised affering other tests as seen in https://gerrit.libreoffice.org/c/core/+/130530/2/sw/qa/uitest/writer_tests6/save_readonly_with_password.py#50 Change-Id: Ife443cc6627025a05a0a33ba1c86140f087dd70c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146333 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py b/sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py index 746d9a75075c..0df0dc504dde 100644 --- a/sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py +++ b/sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py @@ -19,7 +19,6 @@ class edit_file_properties_before_saving(UITestCase): def change_doc_info_setting(self, enabled): with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: - xPages = xDialog.getChild("pages") xLoadSaveEntry = xPages.getChild('1') xLoadSaveEntry.executeAction("EXPAND", tuple()) @@ -38,27 +37,28 @@ class edit_file_properties_before_saving(UITestCase): with self.ui_test.create_doc_in_start_center("writer"): - self.change_doc_info_setting("true") + try: + self.change_doc_info_setting("true") - # 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})) + # 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") - with self.ui_test.execute_dialog_through_action(xOpen, "CLICK") as xPropertiesDialog: - xReadOnly = xPropertiesDialog.getChild("readonly") - xReadOnly.executeAction("CLICK", tuple()) - self.assertEqual("true", get_state_as_dict(xReadOnly)['Selected']) + xOpen = xDialog.getChild("open") + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK") as xPropertiesDialog: + xReadOnly = xPropertiesDialog.getChild("readonly") + xReadOnly.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(xReadOnly)['Selected']) + finally: + # Put this setting back to false, otherwise it might affect other tests + self.change_doc_info_setting("false") self.ui_test.wait_until_file_is_available(xFilePath) with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as doc2: - - self.change_doc_info_setting("false") - # Without the fix in place, this test would have failed here self.assertTrue(doc2.isReadonly()) @@ -69,35 +69,36 @@ class edit_file_properties_before_saving(UITestCase): with self.ui_test.create_doc_in_start_center("writer"): - self.change_doc_info_setting("true") - - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - type_text(xWriterEdit, "XXXX") - - # Close document and save - with self.ui_test.execute_dialog_through_command('.uno:CloseDoc', close_button="") as xConfirmationDialog: - xSave = xConfirmationDialog.getChild("save") - - with self.ui_test.execute_dialog_through_action(xSave, "CLICK", 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") - with self.ui_test.execute_dialog_through_action(xOpen, "CLICK") as xPropertiesDialog: - # Without the fix in place, this test would have crashed here - xReadOnly = xPropertiesDialog.getChild("readonly") - xReadOnly.executeAction("CLICK", tuple()) - self.assertEqual("true", get_state_as_dict(xReadOnly)['Selected']) + try: + self.change_doc_info_setting("true") + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + type_text(xWriterEdit, "XXXX") + + # Close document and save + with self.ui_test.execute_dialog_through_command('.uno:CloseDoc', close_button="") as xConfirmationDialog: + xSave = xConfirmationDialog.getChild("save") + + with self.ui_test.execute_dialog_through_action(xSave, "CLICK", 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") + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK") as xPropertiesDialog: + # Without the fix in place, this test would have crashed here + xReadOnly = xPropertiesDialog.getChild("readonly") + xReadOnly.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(xReadOnly)['Selected']) + finally: + # Put this setting back to false, otherwise it might affect other tests + self.change_doc_info_setting("false") self.ui_test.wait_until_file_is_available(xFilePath) with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as doc2: - - self.change_doc_info_setting("false") - self.assertTrue(doc2.isReadonly()) # vim: set shiftwidth=4 softtabstop=4 expandtab: commit a3cd59aa9e6ea3dfbfb725201ca143c3ec29aa81 Author: Michael Stahl <[email protected]> AuthorDate: Thu Jan 26 13:43:28 2023 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Tue Jan 31 14:56:28 2023 +0000 tdf#114973 sw: IsSelOvr() should not leave the text Jumping from body to header is certainly unexpected, call FindNextCnt() which does additional checks to stay in the same text environment. Change-Id: If54bff62cac420dc0990b6be070b81fa56365c50 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146256 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 5aeee226479427062ac885be407671981d6940ef) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146205 Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 132bbe644610..e3bb1a02c8d8 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -219,7 +219,7 @@ namespace } } -bool SwCursor::IsSelOvr( SwCursorSelOverFlags eFlags ) +bool SwCursor::IsSelOvr(SwCursorSelOverFlags const eFlags) { SwDoc& rDoc = GetDoc(); SwNodes& rNds = rDoc.GetNodes(); @@ -341,7 +341,7 @@ bool SwCursor::IsSelOvr( SwCursorSelOverFlags eFlags ) bool bGoNxt = m_vSavePos.back().nNode < rPtPos.GetNodeIndex(); for (;;) { - pFrame = bGoNxt ? pFrame->GetNextContentFrame() : pFrame->GetPrevContentFrame(); + pFrame = bGoNxt ? pFrame->FindNextCnt(true) : pFrame->FindPrevCnt(); if (!pFrame || 0 != pFrame->getFrameArea().Height() ) break; } @@ -354,8 +354,7 @@ bool SwCursor::IsSelOvr( SwCursorSelOverFlags eFlags ) pFrame = static_cast<const SwContentNode*>(pNd)->getLayoutFrame( rDoc.getIDocumentLayoutAccess().GetCurrentLayout() ); while ( pFrame && 0 == pFrame->getFrameArea().Height() ) { - pFrame = bGoNxt ? pFrame->GetNextContentFrame() - : pFrame->GetPrevContentFrame(); + pFrame = bGoNxt ? pFrame->FindNextCnt(true) : pFrame->FindPrevCnt(); } }
