summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-11-15 20:08:48 +0100
committerMiklos Vajna <vmiklos@collabora.com>2023-11-16 08:31:08 +0100
commit06e3877dc2cf22e00d04b48453e9ab0b948c3ca2 (patch)
tree0a13ac15ec33176d535e04273d0064c20aeb9911 /xmloff
parentc0fffdc36df687fe8e4eff49e5a00d3a3c1eb370 (diff)
comphelper: use c++20 contains() instead of find() and end()
Whether an element is contained inside a container is better to be checked with contains() instead of find() because contains() conveys the intent more clearly. Change-Id: I267d915c95fcf9c98b2e11daa89c8fe801e59a75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159484 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/qa/unit/text.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx
index 5188770a32ba..2a5350423c0d 100644
--- a/xmloff/qa/unit/text.cxx
+++ b/xmloff/qa/unit/text.cxx
@@ -126,7 +126,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testBibliographyLocalUrl)
uno::Reference<beans::XPropertySet> xPortion(xPortionEnum->nextElement(), uno::UNO_QUERY);
xField.set(xPortion->getPropertyValue("TextField"), uno::UNO_QUERY);
comphelper::SequenceAsHashMap aMap(xField->getPropertyValue("Fields"));
- CPPUNIT_ASSERT(aMap.find("LocalURL") != aMap.end());
+ CPPUNIT_ASSERT(aMap.contains("LocalURL"));
auto aActual = aMap["LocalURL"].get<OUString>();
CPPUNIT_ASSERT_EQUAL(OUString("file:///home/me/test.pdf"), aActual);
}
@@ -165,15 +165,15 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testBibliographyTargetURL1)
xField.set(xPortion->getPropertyValue("TextField"), uno::UNO_QUERY);
comphelper::SequenceAsHashMap aMap(xField->getPropertyValue("Fields"));
- CPPUNIT_ASSERT(aMap.find("URL") != aMap.end());
+ CPPUNIT_ASSERT(aMap.contains("URL"));
CPPUNIT_ASSERT_EQUAL(OUString("https://display.url/test1.pdf#page=1"),
aMap["URL"].get<OUString>());
- CPPUNIT_ASSERT(aMap.find("TargetURL") != aMap.end());
+ CPPUNIT_ASSERT(aMap.contains("TargetURL"));
CPPUNIT_ASSERT_EQUAL(OUString("https://target.url/test2.pdf#page=2"),
aMap["TargetURL"].get<OUString>());
- CPPUNIT_ASSERT(aMap.find("TargetType") != aMap.end());
+ CPPUNIT_ASSERT(aMap.contains("TargetType"));
CPPUNIT_ASSERT_EQUAL(OUString("1"), aMap["TargetType"].get<OUString>());
}