[Libreoffice-commits] core.git: vcl/qa vcl/source vcl/workben

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 5 15:02:38 UTC 2020


 vcl/qa/cppunit/FontFeatureTest.cxx         |   17 ++++++++---------
 vcl/qa/cppunit/app/test_IconThemeInfo.cxx  |   15 +++++----------
 vcl/qa/cppunit/pdfexport/pdfexport.cxx     |    3 +--
 vcl/source/control/calendar.cxx            |    8 ++------
 vcl/source/control/imivctl1.cxx            |    3 +--
 vcl/source/font/PhysicalFontCollection.cxx |    3 +--
 vcl/source/gdi/pdfwriter_impl.cxx          |    3 +--
 vcl/source/graphic/GraphicObject.cxx       |    3 +--
 vcl/source/treelist/svtabbx.cxx            |    7 ++-----
 vcl/workben/svptest.cxx                    |    4 +---
 vcl/workben/vcldemo.cxx                    |    4 +---
 11 files changed, 24 insertions(+), 46 deletions(-)

New commits:
commit 27c48894cf45fc34f24ae5e1e8bd7a33ab544359
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Jun 5 15:27:38 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Jun 5 17:01:58 2020 +0200

    Upcoming loplugin:elidestringvar: vcl
    
    Change-Id: Id746bbb3caeb7555e2a89b13fa6dcb089778002a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95597
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/vcl/qa/cppunit/FontFeatureTest.cxx b/vcl/qa/cppunit/FontFeatureTest.cxx
index e4040f35bf39..bd8595902449 100644
--- a/vcl/qa/cppunit/FontFeatureTest.cxx
+++ b/vcl/qa/cppunit/FontFeatureTest.cxx
@@ -68,15 +68,14 @@ void FontFeatureTest::testGetFontFeatures()
 
     CPPUNIT_ASSERT_EQUAL(size_t(53), rDefaultFontFeatures.size());
 
-    OUString aExpectedFeaturesString = "c2sc case dlig fina frac hlig liga lnum "
-                                       "locl onum pnum sa01 sa02 sa03 sa04 sa05 "
-                                       "sa06 sa07 sa08 salt sinf smcp ss01 ss02 "
-                                       "ss03 sups tnum zero ingl cpsp lith litt "
-                                       "itlc para algn arti circ dash dbls foot "
-                                       "frsp grkn hang lng minu nfsp name quot "
-                                       "texm thou vari caps ligc ";
-
-    CPPUNIT_ASSERT_EQUAL(aExpectedFeaturesString, aFeaturesString);
+    CPPUNIT_ASSERT_EQUAL(OUString("c2sc case dlig fina frac hlig liga lnum "
+                                  "locl onum pnum sa01 sa02 sa03 sa04 sa05 "
+                                  "sa06 sa07 sa08 salt sinf smcp ss01 ss02 "
+                                  "ss03 sups tnum zero ingl cpsp lith litt "
+                                  "itlc para algn arti circ dash dbls foot "
+                                  "frsp grkn hang lng minu nfsp name quot "
+                                  "texm thou vari caps ligc "),
+                         aFeaturesString);
 
     // Check C2SC feature
     {
diff --git a/vcl/qa/cppunit/app/test_IconThemeInfo.cxx b/vcl/qa/cppunit/app/test_IconThemeInfo.cxx
index d2e466d89f94..a68df2f78b9e 100644
--- a/vcl/qa/cppunit/app/test_IconThemeInfo.cxx
+++ b/vcl/qa/cppunit/app/test_IconThemeInfo.cxx
@@ -54,8 +54,7 @@ class IconThemeInfoTest : public CppUnit::TestFixture
 void
 IconThemeInfoTest::UpperCaseDisplayNameIsReturnedForNonDefaultId()
 {
-    OUString const id("katze");
-    OUString displayName = vcl::IconThemeInfo::ThemeIdToDisplayName(id);
+    OUString displayName = vcl::IconThemeInfo::ThemeIdToDisplayName("katze");
     CPPUNIT_ASSERT_EQUAL_MESSAGE("theme id is properly uppercased", OUString("Katze"), displayName);
 }
 
@@ -69,16 +68,14 @@ IconThemeInfoTest::ImagesZipIsNotValid()
 void
 IconThemeInfoTest::ImagesColibreZipIsValid()
 {
-    OUString const id("file://images_colibre.zip");
-    bool valid = vcl::IconThemeInfo::UrlCanBeParsed(id);
+    bool valid = vcl::IconThemeInfo::UrlCanBeParsed("file://images_colibre.zip");
     CPPUNIT_ASSERT_EQUAL_MESSAGE("images_colibre.zip is a valid theme name", true, valid);
 }
 
 void
 IconThemeInfoTest::ThemeIdIsDetectedFromFileNameWithUnderscore()
 {
-    OUString const fname("images_colibre.zip");
-    OUString sname = vcl::IconThemeInfo::FileNameToThemeId(fname);
+    OUString sname = vcl::IconThemeInfo::FileNameToThemeId("images_colibre.zip");
     CPPUNIT_ASSERT_EQUAL_MESSAGE("'colibre' theme id is returned for 'images_colibre.zip'", OUString("colibre"), sname);
 }
 
@@ -86,9 +83,8 @@ void
 IconThemeInfoTest::ExceptionIsThrownWhenIdCannotBeDetermined1()
 {
     bool thrown = false;
-    OUString const fname("images_colibre");
     try {
-        vcl::IconThemeInfo::FileNameToThemeId(fname);
+        vcl::IconThemeInfo::FileNameToThemeId("images_colibre");
     }
     catch (std::runtime_error&) {
         thrown = true;
@@ -100,9 +96,8 @@ void
 IconThemeInfoTest::ExceptionIsThrownWhenIdCannotBeDetermined2()
 {
     bool thrown = false;
-    OUString const fname("image_colibre.zip");
     try {
-        vcl::IconThemeInfo::FileNameToThemeId(fname);
+        vcl::IconThemeInfo::FileNameToThemeId("image_colibre.zip");
     }
     catch (std::runtime_error&) {
         thrown = true;
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 45eb62921bcb..754f86af2bd0 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -1170,12 +1170,11 @@ void PdfExportTest::testTdf115117_1a()
     int nChars = FPDFText_CountChars(pPdfTextPage);
     CPPUNIT_ASSERT_EQUAL(44, nChars);
 
-    OUString aExpectedText = "ti ti test ti\r\nti test fi fl ffi ffl test fi";
     std::vector<sal_uInt32> aChars(nChars);
     for (int i = 0; i < nChars; i++)
         aChars[i] = FPDFText_GetUnicode(pPdfTextPage, i);
     OUString aActualText(aChars.data(), aChars.size());
-    CPPUNIT_ASSERT_EQUAL(aExpectedText, aActualText);
+    CPPUNIT_ASSERT_EQUAL(OUString("ti ti test ti\r\nti test fi fl ffi ffl test fi"), aActualText);
 
     FPDFText_ClosePage(pPdfTextPage);
 #endif
diff --git a/vcl/source/control/calendar.cxx b/vcl/source/control/calendar.cxx
index 0baecf397d5f..585e4868ca12 100644
--- a/vcl/source/control/calendar.cxx
+++ b/vcl/source/control/calendar.cxx
@@ -202,9 +202,7 @@ void Calendar::ImplFormat()
         if ( (aOutSize.Width() <= 1) || (aOutSize.Height() <= 1) )
             return;
 
-        OUString const a99Text("99");
-
-        long n99TextWidth = GetTextWidth( a99Text );
+        long n99TextWidth = GetTextWidth( "99" );
         long nTextHeight = GetTextHeight();
 
         // calculate width and x-position
@@ -1529,10 +1527,8 @@ void Calendar::EndSelection()
 
 Size Calendar::CalcWindowSizePixel() const
 {
-    OUString  const a99Text("99");
-
     Size    aSize;
-    long    n99TextWidth = GetTextWidth( a99Text );
+    long    n99TextWidth = GetTextWidth( "99" );
     long    nTextHeight = GetTextHeight();
 
     aSize.AdjustWidth((n99TextWidth+DAY_OFFX)*7);
diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx
index 4efb7596abbb..b6a2902b0417 100644
--- a/vcl/source/control/imivctl1.cxx
+++ b/vcl/source/control/imivctl1.cxx
@@ -2108,8 +2108,7 @@ Size SvxIconChoiceCtrl_Impl::GetMinGrid() const
     Size aMinSize( aImageSize );
     aMinSize.AdjustWidth(2 * LROFFS_BOUND );
     aMinSize.AdjustHeight(TBOFFS_BOUND );  // single offset is enough (FileDlg)
-    OUString const aStrDummy( "XXX" );
-    Size aTextSize( pView->GetTextWidth( aStrDummy ), pView->GetTextHeight() );
+    Size aTextSize( pView->GetTextWidth( "XXX" ), pView->GetTextHeight() );
     if( nWinBits & WB_ICON )
     {
         aMinSize.AdjustHeight(VER_DIST_BMP_STRING );
diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx
index 43ca203ff2d2..c40077dc1b1e 100644
--- a/vcl/source/font/PhysicalFontCollection.cxx
+++ b/vcl/source/font/PhysicalFontCollection.cxx
@@ -357,10 +357,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyBySubstFontAttr( c
         const FontWeight eSearchWeight = rFontAttr.Weight;
         const FontWidth  eSearchWidth  = rFontAttr.Width;
         const FontItalic eSearchSlant  = ITALIC_DONTKNOW;
-        const OUString aSearchName;
 
         pFoundData = FindFontFamilyByAttributes( nSearchType,
-            eSearchWeight, eSearchWidth, eSearchSlant, aSearchName );
+            eSearchWeight, eSearchWidth, eSearchSlant, "" );
 
         if( pFoundData )
             return pFoundData;
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index b1f027441cda..6400198890a5 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -5081,8 +5081,7 @@ sal_Int32 PDFWriterImpl::emitOutputIntent()
     aLine.append( " 0 obj\n"
                   "<</Type/OutputIntent/S/GTS_PDFA1/OutputConditionIdentifier");
 
-    OUString const aComment( "sRGB IEC61966-2.1"  );
-    appendLiteralStringEncrypt( aComment ,nOIObject, aLine );
+    appendLiteralStringEncrypt( OUStringLiteral("sRGB IEC61966-2.1") ,nOIObject, aLine );
     aLine.append("/DestOutputProfile ");
     aLine.append( nICCObject );
     aLine.append( " 0 R>>\nendobj\n\n" );
diff --git a/vcl/source/graphic/GraphicObject.cxx b/vcl/source/graphic/GraphicObject.cxx
index 377945ef2e32..0447bddfd637 100644
--- a/vcl/source/graphic/GraphicObject.cxx
+++ b/vcl/source/graphic/GraphicObject.cxx
@@ -894,8 +894,7 @@ Graphic GraphicObject::GetTransformedGraphic( const GraphicAttr* pAttr ) const
 
 bool GraphicObject::isGraphicObjectUniqueIdURL(OUString const & rURL)
 {
-    const OUString aPrefix("vnd.sun.star.GraphicObject:");
-    return rURL.startsWith(aPrefix);
+    return rURL.startsWith("vnd.sun.star.GraphicObject:");
 }
 
 // calculate scalings between real image size and logic object size. This
diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index 7c4b44631540..5c8661f901d7 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -854,9 +854,6 @@ OUString SvHeaderTabListBox::GetAccessibleObjectDescription( ::vcl::AccessibleBr
 
     if( _eType == ::vcl::BBTYPE_TABLECELL && _nPos != -1 )
     {
-        const OUString sVar1( "%1" );
-        const OUString sVar2( "%2" );
-
         sal_uInt16 nColumnCount = GetColumnCount();
         if (nColumnCount > 0)
         {
@@ -864,11 +861,11 @@ OUString SvHeaderTabListBox::GetAccessibleObjectDescription( ::vcl::AccessibleBr
             sal_uInt16 nColumn  = static_cast< sal_uInt16 >( _nPos % nColumnCount );
 
             OUString aText( VclResId(STR_SVT_ACC_DESC_TABLISTBOX) );
-            aText = aText.replaceFirst( sVar1, OUString::number( nRow ) );
+            aText = aText.replaceFirst( "%1", OUString::number( nRow ) );
             OUString sColHeader = m_pImpl->m_pHeaderBar->GetItemText( m_pImpl->m_pHeaderBar->GetItemId( nColumn ) );
             if ( sColHeader.isEmpty() )
                 sColHeader = OUString::number( nColumn );
-            aText = aText.replaceFirst( sVar2, sColHeader );
+            aText = aText.replaceFirst( "%2", sColHeader );
             aRetText = aText;
         }
     }
diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx
index 06937d2255ed..77c7ac3cb28b 100644
--- a/vcl/workben/svptest.cxx
+++ b/vcl/workben/svptest.cxx
@@ -242,11 +242,9 @@ void MyWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rR
         sal_uInt8 nBlue  = (i << 2) & 0xC0;
         rRenderContext.SetTextColor(Color(nRed, nGreen, nBlue));
 
-        OUString aPrintText = "SVP test program";
-
         rRenderContext.DrawText(tools::Rectangle(Point((aPaperSize.Width() - 4000) / 2, 2000),
                                 Size(aPaperSize.Width() - 2100, aPaperSize.Height() - 4000)),
-                                aPrintText,
+                                "SVP test program",
                                 DrawTextFlags::MultiLine);
     }
 
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 13bdfed953bf..d9f9efb78c29 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -397,8 +397,6 @@ public:
         {
             rDev.SetClipRegion( vcl::Region(r) );
 
-            OUString const aLatinText("Click any rect to zoom!!!!");
-
             const unsigned char pTextUTF8[] = {
                 0xd9, 0x88, 0xd8, 0xa7, 0xd8, 0xad, 0xd9, 0x90,
                 0xd8, 0xaf, 0xd9, 0x92, 0x20, 0xd8, 0xa5, 0xd8,
@@ -419,7 +417,7 @@ public:
             if (bArabicText)
                 aText = aArabicText;
             else
-                aText = aLatinText;
+                aText = "Click any rect to zoom!!!!";
 
             std::vector<OUString> aFontNames;
 


More information about the Libreoffice-commits mailing list