summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-11-03 14:21:01 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-11-03 17:34:12 +0100
commit42f106cdab59c2659b1637cc51660487863f475f (patch)
tree4d81630c66b6d1b6eb43e8ce0016138e6bd6c4a1 /sw
parentff6bd3c61fc514658b87cd572f6dc4d7e67f75c4 (diff)
tdf#117895: sw: Add UItest
Change-Id: I252af7af5aa8bea20f959cf3c868fa73cd538749 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124648 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/uitest/writer_tests6/tdf117895.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/sw/qa/uitest/writer_tests6/tdf117895.py b/sw/qa/uitest/writer_tests6/tdf117895.py
new file mode 100644
index 000000000000..5aa6600a835b
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/tdf117895.py
@@ -0,0 +1,59 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# 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 Tdf117895(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())
+ xGeneralEntry = xLoadSaveEntry.getChild('0')
+ xGeneralEntry.executeAction("SELECT", tuple())
+
+ xDocInfo = xDialog.getChild("docinfo")
+ xDocInfo.executeAction("CLICK", tuple())
+ self.assertEqual(enabled, get_state_as_dict(xDocInfo)['Selected'])
+
+ def test_tdf117895(self):
+
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, "tdf117895-temp.odt")
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ 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}))
+
+ 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'])
+
+ 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())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: