diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-05-11 14:39:19 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-05-11 16:49:00 +0200 |
commit | abd630e81bc150d05e4129cc22752ecf461777c7 (patch) | |
tree | fe4438005c8736558bc36378f946749159a1eb0f /configmgr/qa/unit | |
parent | dbacaf49ea7f1ed44c5e7a1ec5547d7a165a8c54 (diff) |
Allow all hierarchical path segments to be ['...'] quoted
...and not just set elements. <https://gerrit.libreoffice.org/c/core/+/151660>
"tdf#104005 Don't allow changing finalized properties" found that some existing
property names include "/", which makes them unusable with e.g.
getPropertyByHierarchicalName.
The most obvious solution is to allow ['...'] quoting (without a leading
template name, though) for all kinds of hierarchical path segments. (In theory,
that would cause backwards incompatibility, as e.g. a property named ['foo']
could no longer be referenced by a ['foo'] path segment (it would need to be
referenced by a ['['foo']'] path segment instead). But in practice,
that path segment ['foo'] would have been rejected in the past anyway, as it did
not reference a set element.)
To make this work, the meaning of the setElement out-parameter of
configmgr::Data::parseSegment is changed to only be true if the segment uses
['...'] notation including a leading (non-empty) template name.
What this change does not (yet) address is writing out such quoted (group or
set) names in the hierarchical paths written out in configmgr::writeModFile,
where necessary. (It never writes out names of properties as parts of
hierarchical names, so this wouldn't be an issue for the existing problematic
properties containing "/" in their names, anyway.)
Change-Id: I635d823c7bbb6b8ac5869c7e0130ba8cfd329599
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151673
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'configmgr/qa/unit')
-rw-r--r-- | configmgr/qa/unit/test.cxx | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/configmgr/qa/unit/test.cxx b/configmgr/qa/unit/test.cxx index 60d19be8472c..aa5b137413d3 100644 --- a/configmgr/qa/unit/test.cxx +++ b/configmgr/qa/unit/test.cxx @@ -205,12 +205,23 @@ void Test::setUp() void Test::testKeyFetch() { - OUString s; - CPPUNIT_ASSERT( - getKey( - "/org.openoffice.System", - "L10N/Locale") >>= - s); + { + OUString s; + CPPUNIT_ASSERT( + getKey( + "/org.openoffice.System", + "L10N/Locale") >>= + s); + } + { + auto const v = getKey( + "/org.openoffice.Office.Embedding", + "MimeTypeClassIDRelations/['application/vnd.sun.xml.report.chart']"); + OUString s; + CPPUNIT_ASSERT(v >>= s); + CPPUNIT_ASSERT_EQUAL(OUString("80243D39-6741-46C5-926E-069164FF87BB"), s); + // cf. officecfg/registry/data/org/openoffice/Office/Embedding.xcu + } } void Test::testKeySet() |