sc/qa/uitest/calc_tests6/moveCopySheet.py |   13 +++++++++++++
 sc/source/ui/miscdlgs/mvtabdlg.cxx        |    1 -
 vcl/source/uitest/uiobject.cxx            |    1 +
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit a8d3b8985a79c216c3c132fb2e6bb0f85a27831a
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Thu Jan 5 08:21:35 2023 +0100
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Thu Jan 5 16:06:06 2023 +0000

    tdf#56973 - Copy/paste (single) sheet is checked but not enabled
    
    Enable the "copy" radio button in the move/copy sheet dialog, if there is 
just a single sheet in a spreadsheet document. Otherwise, users get the 
impression that a single sheet cannot be copied because the "copy" radio button 
is selected but not enabled, i.e., greyed out.
    
    Change-Id: Icf98973585491b0c8c9a74aad3900f6cc2895d11
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145064
    Tested-by: Jenkins
    Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de>

diff --git a/sc/qa/uitest/calc_tests6/moveCopySheet.py 
b/sc/qa/uitest/calc_tests6/moveCopySheet.py
index a80b7c329173..80bd9f830a27 100644
--- a/sc/qa/uitest/calc_tests6/moveCopySheet.py
+++ b/sc/qa/uitest/calc_tests6/moveCopySheet.py
@@ -63,6 +63,19 @@ class moveCopySheet(UITestCase):
             self.assertEqual(document.Sheets[1].Name, "Sheet1")
             self.assertEqual(document.Sheets[2].Name, "moveName")
 
+    # tdf#56973 - copy/paste (single) sheet is checked but not enabled
+    def test_tdf56973_copy_paste_inactive(self):
+        with self.ui_test.create_doc_in_start_center("calc"):
+            with self.ui_test.execute_dialog_through_command(".uno:Move") as 
xDialog:
+                # A single sheet can only be copied
+                xCopyButton = xDialog.getChild("copy")
+                self.assertEqual(get_state_as_dict(xCopyButton)["Checked"], 
"true")
+                self.assertEqual(get_state_as_dict(xCopyButton)["Enabled"], 
"true")
+                # A single sheet can not be moved
+                xMoveButton = xDialog.getChild("move")
+                self.assertEqual(get_state_as_dict(xMoveButton)["Checked"], 
"false")
+                self.assertEqual(get_state_as_dict(xMoveButton)["Enabled"], 
"false")
+
     #tdf#139464 Set OK button label to selected action: Move or Copy
     def test_tdf139464_move_sheet(self):
         with self.ui_test.create_doc_in_start_center("calc"):
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx 
b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index 9cc587aa56e0..e64a29b6b471 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -74,7 +74,6 @@ void ScMoveTableDlg::SetForceCopyTable()
 {
     m_xBtnCopy->set_active(true);
     m_xBtnMove->set_sensitive(false);
-    m_xBtnCopy->set_sensitive(false);
     SetOkBtnLabel();
 }
 
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 0b55d4c96857..9b8616c3906b 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -1018,6 +1018,7 @@ StringMap RadioButtonUIObject::get_state()
 {
     StringMap aMap = WindowUIObject::get_state();
     aMap["Checked"] = OUString::boolean(mxRadioButton->IsChecked());
+    aMap["Enabled"] = OUString::boolean(mxRadioButton->IsEnabled());
 
     return aMap;
 }

Reply via email to