[Libreoffice-commits] core.git: 2 commits - cui/source unotest/source

Stephan Bergmann sbergman at redhat.com
Tue Sep 15 04:22:46 PDT 2015


 cui/source/options/optpath.cxx      |    8 +++-----
 unotest/source/cpp/filters-test.cxx |   22 +++++++++++-----------
 2 files changed, 14 insertions(+), 16 deletions(-)

New commits:
commit 23a0d1ff82f7ff81a131dba812d908a7a44a5386
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Sep 15 13:22:03 2015 +0200

    Use CPPUNIT_ASSERT_EQUAL
    
    Change-Id: Id4305098e3139bb21711fefb350fa2574e3638cd

diff --git a/unotest/source/cpp/filters-test.cxx b/unotest/source/cpp/filters-test.cxx
index 2bd61f2..384302e 100644
--- a/unotest/source/cpp/filters-test.cxx
+++ b/unotest/source/cpp/filters-test.cxx
@@ -30,25 +30,25 @@ void decode(const OUString& rIn, const OUString &rOut)
 
     rtlCipherError result = rtl_cipher_init(cipher, rtl_Cipher_DirectionDecode, aKey, SAL_N_ELEMENTS(aKey), 0, 0);
 
-    CPPUNIT_ASSERT_MESSAGE("cipher init failed", result == rtl_Cipher_E_None);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("cipher init failed", rtl_Cipher_E_None, result);
 
     osl::File aIn(rIn);
-    CPPUNIT_ASSERT(osl::FileBase::E_None == aIn.open(osl_File_OpenFlag_Read));
+    CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, aIn.open(osl_File_OpenFlag_Read));
 
     osl::File aOut(rOut);
-    CPPUNIT_ASSERT(osl::FileBase::E_None == aOut.open(osl_File_OpenFlag_Write));
+    CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, aOut.open(osl_File_OpenFlag_Write));
 
     sal_uInt8 in[8192];
     sal_uInt8 out[8192];
     sal_uInt64 nBytesRead, nBytesWritten;
     while(true)
     {
-        CPPUNIT_ASSERT(osl::FileBase::E_None == aIn.read(in, sizeof(in), nBytesRead));
+        CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, aIn.read(in, sizeof(in), nBytesRead));
         if (!nBytesRead)
             break;
-        CPPUNIT_ASSERT(rtl_Cipher_E_None == rtl_cipher_decode(cipher, in, nBytesRead, out, sizeof(out)));
-        CPPUNIT_ASSERT(osl::FileBase::E_None == aOut.write(out, nBytesRead, nBytesWritten));
-        CPPUNIT_ASSERT(nBytesRead == nBytesWritten);
+        CPPUNIT_ASSERT_EQUAL(rtl_Cipher_E_None, rtl_cipher_decode(cipher, in, nBytesRead, out, sizeof(out)));
+        CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, aOut.write(out, nBytesRead, nBytesWritten));
+        CPPUNIT_ASSERT_EQUAL(nBytesRead, nBytesWritten);
     }
 
     rtl_cipher_destroy(cipher);
@@ -61,7 +61,7 @@ void FiltersTest::recursiveScan(filterStatus nExpected,
 {
     osl::Directory aDir(rURL);
 
-    CPPUNIT_ASSERT(osl::FileBase::E_None == aDir.open());
+    CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, aDir.open());
     osl::DirectoryItem aItem;
     osl::FileStatus aFileStatus(osl_FileStatus_Mask_FileURL|osl_FileStatus_Mask_Type);
     std::set<OUString> dirs;
@@ -111,7 +111,7 @@ void FiltersTest::recursiveScan(filterStatus nExpected,
         OUString realUrl;
         if (bEncrypted)
         {
-            CPPUNIT_ASSERT(osl::FileBase::E_None == osl::FileBase::createTempFile(NULL, NULL, &sTmpFile));
+            CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, osl::FileBase::createTempFile(NULL, NULL, &sTmpFile));
             decode(sURL, sTmpFile);
             realUrl = sTmpFile;
         }
@@ -141,9 +141,9 @@ void FiltersTest::recursiveScan(filterStatus nExpected,
         if (nExpected == test::indeterminate)
             continue;
         filterStatus nResult = bRes ? test::pass : test::fail;
-        CPPUNIT_ASSERT_MESSAGE(aRes.getStr(), nResult == nExpected);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(aRes.getStr(), nExpected, nResult);
     }
-    CPPUNIT_ASSERT(osl::FileBase::E_None == aDir.close());
+    CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, aDir.close());
 }
 
 void FiltersTest::testDir(const OUString &rFilter,
commit 6781d85afc790351d7535f82ccb8ec50b9672449
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Sep 15 12:35:59 2015 +0200

    Remove unnecessary cDelim vars
    
    Change-Id: I7ee144881abd032262563d123778905e9c2d7857

diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index 4c5e101..9959cba 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -147,12 +147,11 @@ static OUString Convert_Impl( const OUString& rValue )
     if (rValue.isEmpty())
         return aReturn;
 
-    const sal_Unicode cDelim = MULTIPATH_DELIMITER;
     sal_Int32 nPos = 0;
 
     for (;;)
     {
-        OUString aValue = rValue.getToken( 0, cDelim, nPos );
+        OUString aValue = rValue.getToken( 0, MULTIPATH_DELIMITER, nPos );
         INetURLObject aObj( aValue );
         if ( aObj.GetProtocol() == INetProtocol::File )
             aReturn += aObj.PathToFileName();
@@ -799,13 +798,12 @@ void SvxPathTabPage::SetPathList(
         }
 
         // save user paths
-        char cDelim = MULTIPATH_DELIMITER;
-        const sal_Int32 nCount = comphelper::string::getTokenCount(_rUserPath, cDelim);
+        const sal_Int32 nCount = comphelper::string::getTokenCount(_rUserPath, MULTIPATH_DELIMITER);
         Sequence< OUString > aPathSeq( nCount );
         OUString* pArray = aPathSeq.getArray();
         sal_Int32 nPos = 0;
         for ( sal_Int32 i = 0; i < nCount; ++i )
-            pArray[i] = _rUserPath.getToken( 0, cDelim, nPos );
+            pArray[i] = _rUserPath.getToken( 0, MULTIPATH_DELIMITER, nPos );
         Any aValue = makeAny( aPathSeq );
         pImpl->m_xPathSettings->setPropertyValue(
             sCfgName + POSTFIX_USER, aValue);


More information about the Libreoffice-commits mailing list