diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-20 21:07:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-21 13:15:32 +0200 |
commit | 7049328fb2d656d8454d4f704ad75d057e766c0b (patch) | |
tree | 0e8f2e1cce68c6a07c82d5e8496a64f716fecfde /sw/qa | |
parent | a003e4ff69263c7feb8e97e3291e5579fbd181ac (diff) |
loplugin:stringadd replace OUStringLiteral temporaries with OUString::Concat
Change-Id: I656f06a74d9f0180ae460264563d6a935c7d2c60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114377
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/globalfilter/globalfilter.cxx | 39 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter2.cxx | 4 | ||||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export2.cxx | 2 | ||||
-rw-r--r-- | sw/qa/unit/swmodeltestbase.cxx | 4 |
6 files changed, 27 insertions, 26 deletions
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index f84bc2ffc9bd..f51a1132b60a 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -122,7 +122,7 @@ void Test::testEmbeddedGraphicRoundtrip() mxComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument"); // Check whether graphic exported well after it was swapped out - const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); + const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 2, getShapes()); // First image @@ -174,7 +174,7 @@ void Test::testLinkedGraphicRT() mxComponent->dispose(); mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/document_with_linked_graphic.odt"), "com.sun.star.text.TextDocument"); - const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); + const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); // Export the document and import again for a check uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -256,7 +256,7 @@ void Test::testImageWithSpecialID() mxComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument"); // Check whether graphic exported well - const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); + const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 2, getShapes()); uno::Reference<drawing::XShape> xImage = getShape(1); @@ -351,7 +351,7 @@ void Test::testGraphicShape() mxComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument"); // Check whether graphic exported well - const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); + const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 2, getShapes()); uno::Reference<drawing::XShape> xImage = lcl_getShape(mxComponent, true); @@ -376,7 +376,7 @@ void Test::testGraphicShape() // Second image is a linked one xImage = lcl_getShape(mxComponent, false); XPropSet.set(xImage, uno::UNO_QUERY); - const OString sFailedImageLoad = OStringLiteral("Couldn't load the shape/image for ") + rFilterName.toUtf8(); + const OString sFailedImageLoad = OString::Concat("Couldn't load the shape/image for ") + rFilterName.toUtf8(); CPPUNIT_ASSERT_MESSAGE(sFailedImageLoad.getStr(), xImage.is()); // Check size @@ -457,7 +457,7 @@ void Test::testMultipleIdenticalGraphics() mxComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument"); // Check whether graphic exported well - const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); + const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); auto aGraphics = lcl_getGraphics(mxComponent); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), size_t(5), aGraphics.size()); @@ -473,7 +473,8 @@ void Test::testMultipleIdenticalGraphics() // Check all addresses are the same bool bResult = std::equal(aGfxLinkAddresses.begin() + 1, aGfxLinkAddresses.end(), aGfxLinkAddresses.begin()); - const OString sGraphicNotTheSameFailedMessage = OStringLiteral("Graphics not the same for filter: '") + rFilterName.toUtf8() + OStringLiteral("'"); + const OString sGraphicNotTheSameFailedMessage = OString::Concat("Graphics not the same for filter: '") + + rFilterName.toUtf8() + OString::Concat("'"); CPPUNIT_ASSERT_EQUAL_MESSAGE(sGraphicNotTheSameFailedMessage.getStr(), true, bResult); } } @@ -497,7 +498,7 @@ void Test::testCharHighlightBody() mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/char_highlight.docx"), "com.sun.star.text.TextDocument"); - const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); + const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); // Export the document and import again for a check uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -593,7 +594,7 @@ void Test::testCharStyleHighlight() mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/tdf138345_charstyle_highlight.odt"), "com.sun.star.text.TextDocument"); - const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); + const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); // Export the document and import again for a check uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -730,7 +731,7 @@ void Test::testMSCharBackgroundEditing() mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/char_background_editing.docx"), "com.sun.star.text.TextDocument"); - const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); + const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); // Check whether import was done on the right way uno::Reference< text::XTextRange > xPara = getParagraph(1); @@ -842,7 +843,7 @@ void Test::testCharBackgroundToHighlighting() mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/char_background.odt"), "com.sun.star.text.TextDocument"); - OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); + OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); SvtFilterOptions& rOpt = SvtFilterOptions::Get(); @@ -911,7 +912,7 @@ void Test::testSkipImages() for (auto const & rFilterNamePair : aFilterNames) { bool bSkipImages = !rFilterNamePair.second.isEmpty(); - OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterNamePair.first.toUtf8(); + OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterNamePair.first.toUtf8(); if (mxComponent.is()) mxComponent->dispose(); @@ -1274,7 +1275,7 @@ void Test::testRedlineFlags() // tdf#97103 check that redline mode is properly restored CPPUNIT_ASSERT_EQUAL_MESSAGE( - OString(OStringLiteral("redline mode not restored in ") + rFilterName.toUtf8()).getStr(), + OString(OString::Concat("redline mode not restored in ") + rFilterName.toUtf8()).getStr(), static_cast<int>(nRedlineFlags), static_cast<int>(rIDRA.GetRedlineFlags())); } } @@ -1290,7 +1291,7 @@ void Test::testBulletAsImage() for (OUString const & rFilterName : aFilterNames) { - OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); + OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); if (mxComponent.is()) mxComponent->dispose(); @@ -1433,7 +1434,7 @@ void Test::testTextFormField() mxComponent->dispose(); mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/text_form_field.odt"), "com.sun.star.text.TextDocument"); - const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); + const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); // Export the document and import again for a check uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -1488,7 +1489,7 @@ void Test::testCheckBoxFormField() mxComponent->dispose(); mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/checkbox_form_field.odt"), "com.sun.star.text.TextDocument"); - const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); + const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); // Export the document and import again for a check uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -1551,7 +1552,7 @@ void Test::testDropDownFormField() mxComponent->dispose(); mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/dropdown_form_field.odt"), "com.sun.star.text.TextDocument"); - const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); + const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); // Export the document and import again for a check uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -1636,7 +1637,7 @@ void Test::testDateFormField() mxComponent->dispose(); mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/date_form_field.odt"), "com.sun.star.text.TextDocument"); - const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); + const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); // Export the document and import again for a check uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -1752,7 +1753,7 @@ void Test::testDateFormFieldCharacterFormatting() mxComponent->dispose(); mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/extras/globalfilter/data/date_form_field_char_formatting.odt"), "com.sun.star.text.TextDocument"); - const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8(); + const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8(); // Export the document and import again for a check uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 280d29f3d596..3e34dd10946f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -649,7 +649,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf112118_DOCX, "tdf112118.docx") for (const auto& side : style.sideParams) { const OUString sSide = OUString::createFromAscii(side.sideName); - const OString sStage = style.styleName + OStringLiteral(" ") + side.sideName; + const OString sStage = style.styleName + OString::Concat(" ") + side.sideName; sal_Int32 nMargin = getProperty<sal_Int32>(xStyle, sSide + "Margin"); CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(sStage + " margin width").getStr(), diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index f56cf50d328d..e7d9e38153ab 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -4473,7 +4473,7 @@ void SwUiWriterTest::testEmbeddedDataSource() // Load: should have a component and a data source, too. // Path with "#" must not cause issues - load(OUString(DATA_DIRECTORY + OUStringLiteral(u"hash%23path/")), "embedded-data-source.odt"); + load(OUString(DATA_DIRECTORY + OUString::Concat(u"hash%23path/")), "embedded-data-source.odt"); CPPUNIT_ASSERT(xDatabaseContext->hasByName("calc-data-source")); // Data source has a table named Sheet1. diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index e017bc2c7077..02811994e525 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -1641,7 +1641,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloatButton) for (const OUString& aTestFile : aTestFiles) { OString sTestFileName = OUStringToOString(aTestFile, RTL_TEXTENCODING_UTF8); - OString sFailureMessage = OStringLiteral("Failure in the test file: ") + sTestFileName; + OString sFailureMessage = OString::Concat("Failure in the test file: ") + sTestFileName; load(FLOATING_TABLE_DATA_DIRECTORY, sTestFileName.getStr()); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); @@ -1715,7 +1715,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloating) for (const OUString& aTestFile : aTestFiles) { OString sTestFileName = OUStringToOString(aTestFile, RTL_TEXTENCODING_UTF8); - OString sFailureMessage = OStringLiteral("Failure in the test file: ") + sTestFileName; + OString sFailureMessage = OString::Concat("Failure in the test file: ") + sTestFileName; // Test what happens when pushing the unfloat button load(FLOATING_TABLE_DATA_DIRECTORY, "unfloatable_floating_table.docx"); diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index 5b60fb1b87be..a1f8fe239d7a 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -983,7 +983,7 @@ DECLARE_WW8EXPORT_TEST(testTdf112118_DOC, "tdf112118.doc") for (const auto& side : style.sideParams) { const OUString sSide = OUString::createFromAscii(side.sideName); - const OString sStage = style.styleName + OStringLiteral(" ") + side.sideName; + const OString sStage = style.styleName + OString::Concat(" ") + side.sideName; sal_Int32 nMargin = getProperty<sal_Int32>(xStyle, sSide + "Margin"); CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(sStage + " margin width").getStr(), diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx index 632441524eb3..7a158abf7e3b 100644 --- a/sw/qa/unit/swmodeltestbase.cxx +++ b/sw/qa/unit/swmodeltestbase.cxx @@ -604,8 +604,8 @@ void SwModelTestBase::reload(const char* pFilter, const char* filename, const ch else { OString aMessage - = OStringLiteral("validation requested, but don't know how to validate ") + filename - + " (" + OUStringToOString(aFilterName, RTL_TEXTENCODING_UTF8) + ")"; + = OString::Concat("validation requested, but don't know how to validate ") + + filename + " (" + OUStringToOString(aFilterName, RTL_TEXTENCODING_UTF8) + ")"; CPPUNIT_FAIL(aMessage.getStr()); } } |