[Libreoffice-commits] .: 2 commits - cppuhelper/test sal/qa

Caolán McNamara caolan at kemper.freedesktop.org
Wed Feb 16 13:20:19 PST 2011


 cppuhelper/test/testcontainer.cxx |    2 +-
 sal/qa/osl/file/osl_File.cxx      |   11 ++++++++++-
 sal/qa/osl/file/osl_File_Const.h  |    3 ++-
 3 files changed, 13 insertions(+), 3 deletions(-)

New commits:
commit e32eea1336e1a4af5c44e9019064e2aba4b2a298
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 16 21:19:11 2011 +0000

    make a dir and explicitly disallow creation of dirs in it
    
    i.e. handles building as root

diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index d90230f..3916678 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -5875,10 +5875,19 @@ namespace osl_Directory
         void create_002( )
         {
             //create directory in /tmpname
-            nError1 = ::osl::Directory::create( aTmpName7 );
 #if defined ( WNT ) || defined ( MACOSX )
             nError1 = osl::FileBase::E_ACCES;  /// in Windows, you can create directory in c:/ any way.
+#elif defined (SAL_UNX)
+            nError1 = ::osl::Directory::create( aTmpName7 );
+            CPPUNIT_ASSERT_MESSAGE( "test for create function: create a directory and check its existence.",
+                                    ( osl::FileBase::E_None == nError1 ) );
+            osl_setFileAttributes(aTmpName7.pData, 0);
+            nError1 = ::osl::Directory::create( aTmpName11 );
+
+            osl_setFileAttributes(aTmpName7.pData, osl_File_Attribute_OwnWrite);
             deleteTestDirectory( aTmpName7 );
+#else
+            nError1 = osl::FileBase::E_ACCES;
 #endif
 
             CPPUNIT_ASSERT_MESSAGE( "test for create function: create a directory in root for access test.",
diff --git a/sal/qa/osl/file/osl_File_Const.h b/sal/qa/osl/file/osl_File_Const.h
index 581b059..2b9b184 100644
--- a/sal/qa/osl/file/osl_File_Const.h
+++ b/sal/qa/osl/file/osl_File_Const.h
@@ -159,10 +159,11 @@ OSLTEST_DECLARE( TmpName3, FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP "/tmpdir
 OSLTEST_DECLARE( TmpName4, FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP "/tmpdir/tmpname" );
 OSLTEST_DECLARE( TmpName5, FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP "/tmpdir/../tmpdir/./tmpname" );
 OSLTEST_DECLARE( TmpName6, FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP "/tmpname" );
-OSLTEST_DECLARE( TmpName7, FILE_PREFIX TEST_PLATFORM "tmpname" );
+OSLTEST_DECLARE( TmpName7, FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP "/noaccess" );
 OSLTEST_DECLARE( TmpName8, FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP "/tmpname/tmpdir" );
 OSLTEST_DECLARE( TmpName9, FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP "/tmpdir/../tmpdir/./" );
 OSLTEST_DECLARE_UTF8( TmpName10, FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP "/%E6%9C%AA%E5%91%BD%E5%90%8Dzhgb18030" );
+OSLTEST_DECLARE( TmpName11, FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP "/noaccess/subdir" );
 
 OSLTEST_DECLARE( RelURL1,  "relative/file1" );
 OSLTEST_DECLARE( RelURL2,  "relative/./file2" );
commit 5befd3675b22fdb32f2f075a81d3c83beadb40e4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 16 20:16:21 2011 +0000

    cppcheck: set these as public

diff --git a/cppuhelper/test/testcontainer.cxx b/cppuhelper/test/testcontainer.cxx
index ccf9aed..29d2996 100644
--- a/cppuhelper/test/testcontainer.cxx
+++ b/cppuhelper/test/testcontainer.cxx
@@ -44,6 +44,7 @@ using namespace ::com::sun::star::uno;
 
 class TestListener : public WeakImplHelper1< XVetoableChangeListener >
 {
+public:
     // Methods
     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& /*Source*/ ) throw(::com::sun::star::uno::RuntimeException)
         {
@@ -55,7 +56,6 @@ class TestListener : public WeakImplHelper1< XVetoableChangeListener >
         {
 
         }
-
 };
 
 void test_interfacecontainer()


More information about the Libreoffice-commits mailing list