summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-06-23 12:34:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-06-26 13:12:31 +0200
commit0193b284e880a659ab73160e42238e1d5fe5cf8f (patch)
treeda09299838a6afb43d7c601803a6bab787489854 /test
parent2ef138de767c312188d41a7f206234eafac3108b (diff)
new loplugin:constexprliteral
OUStringLiteral should be declared constexpr, to enforce that it is initialised at compile-time and not runtime. This seems to make a different at least on Visual Studio Change-Id: I1698f5fa22ddb480347c2f4d444530c2e0e88d92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153499 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'test')
-rw-r--r--test/source/sheet/cellarealink.cxx10
-rw-r--r--test/source/sheet/databaserange.cxx22
-rw-r--r--test/source/sheet/datapilotitem.cxx4
-rw-r--r--test/source/sheet/xarrayformularange.cxx2
-rw-r--r--test/source/sheet/xspreadsheets2.cxx2
-rw-r--r--test/source/text/textsettings.cxx6
6 files changed, 23 insertions, 23 deletions
diff --git a/test/source/sheet/cellarealink.cxx b/test/source/sheet/cellarealink.cxx
index bfaf4c3fe99b..412d1b6260e3 100644
--- a/test/source/sheet/cellarealink.cxx
+++ b/test/source/sheet/cellarealink.cxx
@@ -22,7 +22,7 @@ void CellAreaLink::testUrl()
{
uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW);
- static const OUStringLiteral propName(u"Url");
+ static constexpr OUStringLiteral propName(u"Url");
OUString aUrl;
CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aUrl);
@@ -39,7 +39,7 @@ void CellAreaLink::testFilter()
{
uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW);
- static const OUStringLiteral propName(u"Filter");
+ static constexpr OUStringLiteral propName(u"Filter");
OUString aFilter;
CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aFilter);
@@ -56,7 +56,7 @@ void CellAreaLink::testFilterOptions()
{
uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW);
- static const OUStringLiteral propName(u"FilterOptions");
+ static constexpr OUStringLiteral propName(u"FilterOptions");
OUString aFilterOptions;
CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aFilterOptions);
@@ -75,7 +75,7 @@ void CellAreaLink::testRefreshDelay()
{
uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW);
- static const OUStringLiteral propName(u"RefreshDelay");
+ static constexpr OUStringLiteral propName(u"RefreshDelay");
sal_Int32 aRefreshDelay = 0;
CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aRefreshDelay);
@@ -94,7 +94,7 @@ void CellAreaLink::testRefreshPeriod()
{
uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW);
- static const OUStringLiteral propName(u"RefreshPeriod");
+ static constexpr OUStringLiteral propName(u"RefreshPeriod");
sal_Int32 aRefreshPeriod = 0;
CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aRefreshPeriod);
diff --git a/test/source/sheet/databaserange.cxx b/test/source/sheet/databaserange.cxx
index d87e3723ce3b..a9e316be7ce3 100644
--- a/test/source/sheet/databaserange.cxx
+++ b/test/source/sheet/databaserange.cxx
@@ -26,7 +26,7 @@ void DatabaseRange::testMoveCells()
{
uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW);
- static const OUStringLiteral propName(u"MoveCells");
+ static constexpr OUStringLiteral propName(u"MoveCells");
bool bMoveCells = true;
CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bMoveCells);
@@ -43,7 +43,7 @@ void DatabaseRange::testKeepFormats()
{
uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW);
- static const OUStringLiteral propName(u"KeepFormats");
+ static constexpr OUStringLiteral propName(u"KeepFormats");
bool bKeepFormats = true;
CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bKeepFormats);
@@ -60,7 +60,7 @@ void DatabaseRange::testStripData()
{
uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW);
- static const OUStringLiteral propName(u"StripData");
+ static constexpr OUStringLiteral propName(u"StripData");
bool bStripData = true;
CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bStripData);
@@ -77,7 +77,7 @@ void DatabaseRange::testAutoFilter()
{
uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW);
- static const OUStringLiteral propName(u"AutoFilter");
+ static constexpr OUStringLiteral propName(u"AutoFilter");
bool bAutoFilter = true;
CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bAutoFilter);
@@ -94,7 +94,7 @@ void DatabaseRange::testUseFilterCriteriaSource()
{
uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW);
- static const OUStringLiteral propName(u"UseFilterCriteriaSource");
+ static constexpr OUStringLiteral propName(u"UseFilterCriteriaSource");
bool bUseFilterCriteriaSource = true;
CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bUseFilterCriteriaSource);
@@ -113,7 +113,7 @@ void DatabaseRange::testFilterCriteriaSource()
{
uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW);
- static const OUStringLiteral propName(u"FilterCriteriaSource");
+ static constexpr OUStringLiteral propName(u"FilterCriteriaSource");
table::CellRangeAddress cellRangeAddress;
CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= cellRangeAddress);
@@ -132,7 +132,7 @@ void DatabaseRange::testRefreshPeriod()
{
uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW);
- static const OUStringLiteral propName(u"RefreshPeriod");
+ static constexpr OUStringLiteral propName(u"RefreshPeriod");
sal_Int32 aRefreshPeriod = 1;
CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= aRefreshPeriod);
@@ -151,7 +151,7 @@ void DatabaseRange::testFromSelection()
{
uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW);
- static const OUStringLiteral propName(u"FromSelection");
+ static constexpr OUStringLiteral propName(u"FromSelection");
bool bFromSelection = true;
CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bFromSelection);
@@ -168,7 +168,7 @@ void DatabaseRange::testTokenIndex()
{
uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW);
- static const OUStringLiteral propName(u"TokenIndex");
+ static constexpr OUStringLiteral propName(u"TokenIndex");
sal_Int32 aTokenIndex = 0;
CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= aTokenIndex);
@@ -185,7 +185,7 @@ void DatabaseRange::testTotalsRow()
{
uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW);
- static const OUStringLiteral propName(u"TotalsRow");
+ static constexpr OUStringLiteral propName(u"TotalsRow");
bool bTotalsRow = true;
CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bTotalsRow);
@@ -202,7 +202,7 @@ void DatabaseRange::testContainsHeader()
{
uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW);
- static const OUStringLiteral propName(u"ContainsHeader");
+ static constexpr OUStringLiteral propName(u"ContainsHeader");
bool bContainsHeader = false;
CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bContainsHeader);
diff --git a/test/source/sheet/datapilotitem.cxx b/test/source/sheet/datapilotitem.cxx
index bfbe2110afec..625b1e634807 100644
--- a/test/source/sheet/datapilotitem.cxx
+++ b/test/source/sheet/datapilotitem.cxx
@@ -24,7 +24,7 @@ void DataPilotItem::testProperties()
{
uno::Reference<beans::XPropertySet> xItem(init(), UNO_QUERY_THROW);
- static const OUStringLiteral propNameIS(u"IsHidden");
+ static constexpr OUStringLiteral propNameIS(u"IsHidden");
bool bIsHidden = true;
CPPUNIT_ASSERT(xItem->getPropertyValue(propNameIS) >>= bIsHidden);
@@ -36,7 +36,7 @@ void DataPilotItem::testProperties()
CPPUNIT_ASSERT(xItem->getPropertyValue(propNameIS) >>= bIsHidden);
CPPUNIT_ASSERT_MESSAGE("Value of IsHidden wasn't changed", !bIsHidden);
- static const OUStringLiteral propNameSD(u"ShowDetail");
+ static constexpr OUStringLiteral propNameSD(u"ShowDetail");
bool bShowDetail = false;
CPPUNIT_ASSERT(xItem->getPropertyValue(propNameSD) >>= bShowDetail);
diff --git a/test/source/sheet/xarrayformularange.cxx b/test/source/sheet/xarrayformularange.cxx
index f7f30a1af73e..55372e18589c 100644
--- a/test/source/sheet/xarrayformularange.cxx
+++ b/test/source/sheet/xarrayformularange.cxx
@@ -27,7 +27,7 @@ void XArrayFormulaRange::testGetSetArrayFormula()
{
uno::Reference<sheet::XArrayFormulaRange> xAFR(init(), UNO_QUERY_THROW);
- static const OUStringLiteral sFormula(u"=1 + 2 * 5");
+ static constexpr OUStringLiteral sFormula(u"=1 + 2 * 5");
xAFR->setArrayFormula(sFormula);
uno::Reference<sheet::XCellRangeAddressable> xCRA(xAFR, UNO_QUERY_THROW);
diff --git a/test/source/sheet/xspreadsheets2.cxx b/test/source/sheet/xspreadsheets2.cxx
index 3bd539710480..c783d7f6b565 100644
--- a/test/source/sheet/xspreadsheets2.cxx
+++ b/test/source/sheet/xspreadsheets2.cxx
@@ -243,7 +243,7 @@ void XSpreadsheets2::testImportCellStyle()
//new style created in dest
uno::Reference< beans::XPropertySet > xSrcCellPropSet (xSrcCell, UNO_QUERY_THROW);
- static const OUStringLiteral aCellProperty(u"CellStyle");
+ static constexpr OUStringLiteral aCellProperty(u"CellStyle");
OUString aSrcStyleName;
CPPUNIT_ASSERT(xSrcCellPropSet->getPropertyValue(aCellProperty) >>= aSrcStyleName);
diff --git a/test/source/text/textsettings.cxx b/test/source/text/textsettings.cxx
index 112fc939dee9..2003156074b3 100644
--- a/test/source/text/textsettings.cxx
+++ b/test/source/text/textsettings.cxx
@@ -44,7 +44,7 @@ bool isPropertyReadOnly(css::uno::Reference<css::beans::XPropertySet> const& rxP
// [property] string PrinterName;
void testPrinterName(css::uno::Reference<css::beans::XPropertySet> const& rxSettings)
{
- static const OUStringLiteral rPropertyName(u"PrinterName");
+ static constexpr OUStringLiteral rPropertyName(u"PrinterName");
if (!extstsProperty(rxSettings, rPropertyName))
return; // Property is sometimes not set - bug? it is not defined as optional
@@ -67,7 +67,7 @@ void testPrinterName(css::uno::Reference<css::beans::XPropertySet> const& rxSett
// [optional, property] short PrinterIndependentLayout;
void testPrinterIndependentLayout(css::uno::Reference<css::beans::XPropertySet> const& rxSettings)
{
- static const OUStringLiteral rPropertyName(u"PrinterIndependentLayout");
+ static constexpr OUStringLiteral rPropertyName(u"PrinterIndependentLayout");
if (!extstsProperty(rxSettings, rPropertyName))
return; // Property is optional
@@ -91,7 +91,7 @@ void testPrinterIndependentLayout(css::uno::Reference<css::beans::XPropertySet>
// [optional, property] com::sun::star::i18n::XForbiddenCharacters ForbiddenCharacters;
void testForbiddenCharacters(css::uno::Reference<css::beans::XPropertySet> const& rxSettings)
{
- static const OUStringLiteral rPropertyName(u"ForbiddenCharacters");
+ static constexpr OUStringLiteral rPropertyName(u"ForbiddenCharacters");
if (!extstsProperty(rxSettings, rPropertyName))
return; // Property is optional