summaryrefslogtreecommitdiff
path: root/svx/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-12-15 17:17:56 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-12-15 22:41:14 +0100
commitfdeb04f7c59cf8032fe17072ed779e70505cc6ab (patch)
treeadad4589f2021a26b989814b17b3c24830cf7d55 /svx/qa
parent7763692e50191e2074f56e9bf698c843eed0ad00 (diff)
tdf#129961 svx: finish UI for table shadow as direct format
Normally properties on an SdrObject is set using SetAttributes(), but that would take the selection controller into account, so we would call SvxTableController::SetAttributes(), which sets the item set on the selected cells instead. So use SetAttrToMarked() instead, which works on the shape's item set, even in the table case. Don't replace all existing items because we only have shadow properties here and also a disabled shadow is still a (set) SdrOnOffItem (with value=false), so no old SdrOnOffItem will be forgotten in the shape's item set. Also add an outer undo grouping, so once the user presses OK in the table properties dialog, we only create a single user-visible undo action, not two. Change-Id: I77b55ba1f07b8d0eeac5070e0ec07d39573d1f9a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107781 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'svx/qa')
-rw-r--r--svx/qa/uitest/table/tablecontroller.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/svx/qa/uitest/table/tablecontroller.py b/svx/qa/uitest/table/tablecontroller.py
new file mode 100644
index 000000000000..27ed4a1d7ccb
--- /dev/null
+++ b/svx/qa/uitest/table/tablecontroller.py
@@ -0,0 +1,45 @@
+#
+# 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
+
+
+# Test for SvxTableController.
+class SvxTableControllerTest(UITestCase):
+
+ def testOnFormatTable(self):
+ # Create an Impress document with a single table in it.
+ self.ui_test.create_doc_in_start_center("impress")
+ template = self.xUITest.getTopFocusWindow()
+ self.ui_test.close_dialog_through_button(template.getChild("cancel"))
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:Delete")
+ self.xUITest.executeCommand(".uno:InsertTable?Columns:short=2&Rows:short=2")
+
+ # Enable shadow.
+ self.ui_test.execute_dialog_through_command(".uno:TableDialog")
+ tableDialog = self.xUITest.getTopFocusWindow()
+ tabs = tableDialog.getChild("tabcontrol")
+ # Select "shadow".
+ select_pos(tabs, "4")
+ shadowCheckbox = tableDialog.getChild("TSB_SHOW_SHADOW")
+ shadowCheckbox.executeAction("CLICK", tuple())
+ self.ui_test.close_dialog_through_button(tableDialog.getChild("ok"))
+
+ # Check if the shadow was enabled.
+ component = self.ui_test.get_component()
+ drawPage = component.getDrawPages().getByIndex(0)
+ shape = drawPage.getByIndex(0)
+ # Without the accompanying fix in place, this test would have failed with:
+ # AssertionError: False != True
+ # i.e. the table still had no shadow.
+ self.assertEqual(shape.Shadow, True)
+
+ # Close the document.
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: