summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2021-04-17 14:13:52 +0200
committerLászló Németh <nemeth@numbertext.org>2021-04-17 23:09:38 +0200
commitdb7ef0a9ed21b0271345249b97a7a10d60d259e6 (patch)
tree71ceda533c5031b90f61926af35eaaf34465d8a3 /sw/qa
parent11a4e270450089238c4ec6fc8548a98c0999edfe (diff)
tdf#30709 sw Style Inspector: show bookmark data
If the current character position is there in a bookmark (or in multiple bookmarks), show bookmark names and RDF metadata under the node "Bookmarks" in the Style Inspector. Follow-up of commit dd45df62d217db59be3f515b6c7e1bfd17ec4350 "tdf#30709 sw: show RDF metadata in Style Inspector". Change-Id: I943682bd13e7760a8f7a8d534f497e88f2769275 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114225 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/uitest/data/bookmark-metadata.odtbin0 -> 9521 bytes
-rw-r--r--sw/qa/uitest/styleInspector/styleInspector.py57
2 files changed, 57 insertions, 0 deletions
diff --git a/sw/qa/uitest/data/bookmark-metadata.odt b/sw/qa/uitest/data/bookmark-metadata.odt
new file mode 100644
index 000000000000..3eec9abcfb57
--- /dev/null
+++ b/sw/qa/uitest/data/bookmark-metadata.odt
Binary files differ
diff --git a/sw/qa/uitest/styleInspector/styleInspector.py b/sw/qa/uitest/styleInspector/styleInspector.py
index a869df19baa3..6d531e96793e 100644
--- a/sw/qa/uitest/styleInspector/styleInspector.py
+++ b/sw/qa/uitest/styleInspector/styleInspector.py
@@ -189,4 +189,61 @@ class styleNavigator(UITestCase):
self.xUITest.executeCommand(".uno:Sidebar")
self.ui_test.close_doc()
+ def test_bookmark_metadata(self):
+ self.ui_test.load_file(get_url_for_data_file("bookmark-metadata.odt"))
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"}))
+
+ xListBox = xWriterEdit.getChild('listbox_fonts')
+
+ # The cursor is on text without metadata
+ self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
+ self.assertEqual("Default Paragraph Style", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
+ self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('3').getChildren()))
+
+ self.xUITest.executeCommand(".uno:GoDown")
+
+ # The cursor is on text with paragraph metadata showed under direct paragraph formatting
+ self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
+ self.assertEqual("Default Paragraph Style", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
+ self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
+
+ # Outer bookmark
+ xBookmarkFormatting = xListBox.getChild('4')
+ self.assertEqual(1, len(xBookmarkFormatting.getChildren()))
+ self.assertEqual("Bookmark 1", get_state_as_dict(xBookmarkFormatting.getChild('0'))['Text'])
+
+ self.xUITest.executeCommand(".uno:GoDown")
+
+ # Inner bookmark
+ xBookmarkFormatting = xListBox.getChild('4')
+ self.assertEqual(2, len(xBookmarkFormatting.getChildren()))
+
+ self.assertEqual("Bookmark 1", get_state_as_dict(xBookmarkFormatting.getChild('0'))['Text'])
+ xMetadata = xBookmarkFormatting.getChild('0').getChild('0')
+ self.assertEqual(2, len(xMetadata.getChildren()))
+ self.assertEqual("xml:id\tID-566430c5-9857-4ff2-be6d-57d127368d88", get_state_as_dict(xMetadata.getChild('0'))['Text'])
+ self.assertEqual("http://www.w3.org/1999/02/22-rdf-syntax-ns#type\tBookmark", get_state_as_dict(xMetadata.getChild('1'))['Text'])
+
+ self.assertEqual("Bookmark 2", get_state_as_dict(xBookmarkFormatting.getChild('1'))['Text'])
+ xMetadata = xBookmarkFormatting.getChild('1').getChild('0')
+ self.assertEqual(2, len(xMetadata.getChildren()))
+ self.assertEqual("xml:id\tID-941142c3-924d-4884-a521-cb6a2dd26f04", get_state_as_dict(xMetadata.getChild('0'))['Text'])
+ self.assertEqual("http://www.w3.org/1999/02/22-rdf-syntax-ns#type\tBookmark", get_state_as_dict(xMetadata.getChild('1'))['Text'])
+
+ # Only in outer bookmark again
+ self.xUITest.executeCommand(".uno:GoDown")
+ xBookmarkFormatting = xListBox.getChild('4')
+ self.assertEqual(1, len(xBookmarkFormatting.getChildren()))
+ self.assertEqual("Bookmark 1", get_state_as_dict(xBookmarkFormatting.getChild('0'))['Text'])
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+ self.ui_test.close_doc()
+
# vim: set shiftwidth=4 softtabstop=4 expandtab: