summaryrefslogtreecommitdiff
path: root/sal/qa/osl/profile
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-03-04 13:46:16 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-03-04 13:46:16 +0100
commit3dcf6647109feeaa199e64d30a71407e225be582 (patch)
tree9e8706f46aa41d0471f648fbb8b51be8890e0b74 /sal/qa/osl/profile
parent7d3909b493773d49c491ff54a8607eab8b14e0ce (diff)
Fix CppunitTest_sal_osl_profile
Change-Id: Ie66636881a2e4c754bd95f9d1d72e0b4fc2828df
Diffstat (limited to 'sal/qa/osl/profile')
-rw-r--r--sal/qa/osl/profile/osl_old_testprofile.cxx43
1 files changed, 12 insertions, 31 deletions
diff --git a/sal/qa/osl/profile/osl_old_testprofile.cxx b/sal/qa/osl/profile/osl_old_testprofile.cxx
index 5bdededb7eea..cc8fe8ca00ce 100644
--- a/sal/qa/osl/profile/osl_old_testprofile.cxx
+++ b/sal/qa/osl/profile/osl_old_testprofile.cxx
@@ -23,10 +23,8 @@
#include "cppunit/extensions/HelperMacros.h"
#include "cppunit/plugin/TestPlugIn.h"
-#include <stdio.h>
#include <osl/profile.h>
-
-
+#include <rtl/bootstrap.hxx>
namespace osl_Profile
{
@@ -42,36 +40,19 @@ namespace osl_Profile
void oldtests::test_profile(void)
{
- oslProfile hProfile;
- rtl_uString* ustrProfileName=0;
- rtl_uString* ustrProfileName2=0;
-
- rtl_uString_newFromAscii(&ustrProfileName,"//./tmp/soffice.ini");
- rtl_uString_newFromAscii(&ustrProfileName2,"//./tmp/not_existing_path/soffice.ini");
-
+ rtl::OUString baseUrl;
+ CPPUNIT_ASSERT(rtl::Bootstrap::get("UserInstallation", baseUrl));
// successful write
- hProfile = osl_openProfile( ustrProfileName, 0 );
- if (hProfile != 0)
- {
- if (! osl_writeProfileBool( hProfile, "testsection", "testbool", 1 ))
- printf( "### cannot write into init file!\n" );
-
- osl_closeProfile( hProfile );
- }
-
- // unsuccessful write
- hProfile = osl_openProfile( ustrProfileName2, 0 );
- if (hProfile != 0)
- {
- if (osl_writeProfileBool( hProfile, "testsection", "testbool", 1 ))
- printf( "### unexpected success writing into test2.ini!\n" );
-
- osl_closeProfile( hProfile );
- }
-
- rtl_uString_release(ustrProfileName);
- rtl_uString_release(ustrProfileName2);
+ oslProfile hProfile = osl_openProfile( rtl::OUString(baseUrl + "/soffice.ini").pData, osl_Profile_WRITELOCK );
+ CPPUNIT_ASSERT(hProfile != 0);
+ CPPUNIT_ASSERT_MESSAGE(
+ "cannot write into init file",
+ osl_writeProfileBool( hProfile, "testsection", "testbool", 1 ));
+ CPPUNIT_ASSERT(osl_closeProfile( hProfile ));
+
+ // unsuccessful open
+ CPPUNIT_ASSERT_EQUAL(oslProfile(0), osl_openProfile( rtl::OUString(baseUrl + "/not_existing_path/soffice.ini").pData, osl_Profile_WRITELOCK ));
}
} // namespace osl_Profile