[Libreoffice-commits] core.git: sfx2/source sw/qa
Andreas Heinisch (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 3 22:37:58 UTC 2021
sfx2/source/dialog/dinfdlg.cxx | 9 +++++++++
sw/qa/uitest/writer_tests/tdf81457.py | 25 ++++++++++++++-----------
2 files changed, 23 insertions(+), 11 deletions(-)
New commits:
commit 4d5c96be4362902144c83708f40f77766244ca06
Author: Andreas Heinisch <andreas.heinisch at yahoo.de>
AuthorDate: Wed May 19 09:37:33 2021 +0200
Commit: Andreas Heinisch <andreas.heinisch at yahoo.de>
CommitDate: Wed Aug 4 00:37:23 2021 +0200
tdf#123919 - Sort custom document properties
Sort custom document properties on opening the dialog under File >
Properties > Custom Properties. The sorting order in the document's xml
still depends on the generated handle of the document property itself.
Change-Id: I12c4f641d22ca0a3db2f4c6ef54f41c113aeeaa5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115780
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch at yahoo.de>
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 13349d3bf47c..82265a0d7a1d 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1973,6 +1973,15 @@ void SfxCustomPropertiesPage::Reset( const SfxItemSet* rItemSet )
m_xPropertiesCtrl->ClearAllLines();
const SfxDocumentInfoItem& rInfoItem = rItemSet->Get(SID_DOCINFO);
std::vector< std::unique_ptr<CustomProperty> > aCustomProps = rInfoItem.GetCustomProperties();
+ // tdf#123919 - sort custom document properties
+ auto const sort = comphelper::string::NaturalStringSorter(
+ comphelper::getProcessComponentContext(),
+ Application::GetSettings().GetLanguageTag().getLocale());
+ std::sort(aCustomProps.begin(), aCustomProps.end(),
+ [&sort](const std::unique_ptr<CustomProperty>& rLHS,
+ const std::unique_ptr<CustomProperty>& rRHS) {
+ return sort.compare(rLHS->m_sName, rRHS->m_sName) < 0;
+ });
m_xPropertiesCtrl->SetCustomProperties(std::move(aCustomProps));
}
diff --git a/sw/qa/uitest/writer_tests/tdf81457.py b/sw/qa/uitest/writer_tests/tdf81457.py
index 52db731e8723..ff021a4f7ee4 100644
--- a/sw/qa/uitest/writer_tests/tdf81457.py
+++ b/sw/qa/uitest/writer_tests/tdf81457.py
@@ -20,18 +20,21 @@ class tdf81457(UITestCase):
xTabs = xDialog.getChild("tabcontrol")
select_pos(xTabs, "2") #tab Custom properties
- aExpectedNames = ['BookMarkCount', 'BookMarkInfo1', 'BookMarkInfo10', 'BookMarkInfo11',
- 'BookMarkInfo12', 'BookMarkInfo13']
- aExpectedValues = ['78', '00FF0000FF010', '00FF0000FF1E0', '00FF0000FF1E0',
- '00FF0000FF210', '00FF0000FF230']
-
- for i in range(6):
- xNameBox = xDialog.getChild("namebox" + str(i + 1))
- xTypeBox = xDialog.getChild("typebox" + str(i + 1))
- xValueEdit = xDialog.getChild("valueedit" + str(i + 1))
- self.assertEqual(aExpectedNames[i], get_state_as_dict(xNameBox)['Text'])
+ # tdf#123919 - custom document properties are sorted now
+ aExpectedDocProp = {
+ 2: {'aAndra': 'Ja'},
+ 4: {'BookMarkCount': '78'},
+ 5: {'BookMarkInfo1': '00FF0000FF010'},
+ 6: {'BookMarkInfo2': '00FF0000FF030'}}
+
+ for pos, aDocProp in aExpectedDocProp.items():
+ xNameBox = xDialog.getChild("namebox" + str(pos))
+ xTypeBox = xDialog.getChild("typebox" + str(pos))
+ xValueEdit = xDialog.getChild("valueedit" + str(pos))
+ name, value = aDocProp.popitem()
+ self.assertEqual(name, get_state_as_dict(xNameBox)['Text'])
self.assertEqual('Text', get_state_as_dict(xTypeBox)['DisplayText'])
- self.assertEqual(aExpectedValues[i], get_state_as_dict(xValueEdit)['Text'][:13])
+ self.assertEqual(value, get_state_as_dict(xValueEdit)['Text'][:13])
More information about the Libreoffice-commits
mailing list