merge the formfield patch from ooo-build
[ooovba.git] / sal / qa / osl / profile / osl_old_testprofile.cxx
blob65a8d491a21792a9f0c08c06ef684ac7589fd6b9
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: osl_old_testprofile.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sal.hxx"
34 // LLA:
35 // this file is converted to use with testshl2
36 // original was placed in sal/test/textenc.cxx
39 // -----------------------------------------------------------------------------
40 #include <stdio.h>
41 #include <osl/profile.h>
43 #include <cppunit/simpleheader.hxx>
45 //==================================================================================================
46 // -----------------------------------------------------------------------------
47 namespace osl_Profile
49 class oldtests : public CppUnit::TestFixture
51 public:
52 void test_profile();
54 CPPUNIT_TEST_SUITE( oldtests );
55 CPPUNIT_TEST( test_profile );
56 CPPUNIT_TEST_SUITE_END( );
59 void oldtests::test_profile(void)
61 oslProfile hProfile;
62 rtl_uString* ustrProfileName=0;
63 rtl_uString* ustrProfileName2=0;
65 rtl_uString_newFromAscii(&ustrProfileName,"//./tmp/soffice.ini");
66 rtl_uString_newFromAscii(&ustrProfileName2,"//./tmp/not_existing_path/soffice.ini");
69 // successful write
70 if (hProfile = osl_openProfile( ustrProfileName, 0 ))
72 if (! osl_writeProfileBool( hProfile, "testsection", "testbool", 1 ))
73 printf( "### cannot write into init file!\n" );
75 osl_closeProfile( hProfile );
78 // unsuccessful write
79 if (hProfile = osl_openProfile( ustrProfileName2, 0 ))
81 if (osl_writeProfileBool( hProfile, "testsection", "testbool", 1 ))
82 printf( "### unexpected success writing into test2.ini!\n" );
84 osl_closeProfile( hProfile );
87 rtl_uString_release(ustrProfileName);
88 rtl_uString_release(ustrProfileName2);
91 } // namespace osl_Profile
93 // -----------------------------------------------------------------------------
94 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_Profile::oldtests, "osl_Profile" );
96 // -----------------------------------------------------------------------------
97 NOADDITIONAL;