187d2adbcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
387d2adbcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
487d2adbcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
587d2adbcSAndrew Rist  * distributed with this work for additional information
687d2adbcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
787d2adbcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
887d2adbcSAndrew Rist  * "License"); you may not use this file except in compliance
987d2adbcSAndrew Rist  * with the License.  You may obtain a copy of the License at
1087d2adbcSAndrew Rist  *
1187d2adbcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1287d2adbcSAndrew Rist  *
1387d2adbcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
1487d2adbcSAndrew Rist  * software distributed under the License is distributed on an
1587d2adbcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1687d2adbcSAndrew Rist  * KIND, either express or implied.  See the License for the
1787d2adbcSAndrew Rist  * specific language governing permissions and limitations
1887d2adbcSAndrew Rist  * under the License.
1987d2adbcSAndrew Rist  *
2087d2adbcSAndrew Rist  *************************************************************/
2187d2adbcSAndrew Rist 
2287d2adbcSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sal.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // LLA:
28cdf0e10cSrcweir // this file is converted to use with testshl2
29cdf0e10cSrcweir // original was placed in sal/test/textenc.cxx
30cdf0e10cSrcweir 
31cdf0e10cSrcweir 
32cdf0e10cSrcweir // -----------------------------------------------------------------------------
33cdf0e10cSrcweir #include <stdio.h>
34cdf0e10cSrcweir #include <osl/profile.h>
35cdf0e10cSrcweir 
36*2a2e2c38SDamjan Jovanovic #include "gtest/gtest.h"
37cdf0e10cSrcweir 
38cdf0e10cSrcweir //==================================================================================================
39cdf0e10cSrcweir // -----------------------------------------------------------------------------
40cdf0e10cSrcweir namespace osl_Profile
41cdf0e10cSrcweir {
42*2a2e2c38SDamjan Jovanovic     class oldtests : public ::testing::Test
43cdf0e10cSrcweir     {
44cdf0e10cSrcweir     public:
45cdf0e10cSrcweir     };
46cdf0e10cSrcweir 
TEST_F(oldtests,test_profile)47*2a2e2c38SDamjan Jovanovic TEST_F(oldtests, test_profile)
48cdf0e10cSrcweir {
49cdf0e10cSrcweir 	oslProfile hProfile;
50cdf0e10cSrcweir     rtl_uString* ustrProfileName=0;
51cdf0e10cSrcweir     rtl_uString* ustrProfileName2=0;
52cdf0e10cSrcweir 
53cdf0e10cSrcweir     rtl_uString_newFromAscii(&ustrProfileName,"//./tmp/soffice.ini");
54cdf0e10cSrcweir     rtl_uString_newFromAscii(&ustrProfileName2,"//./tmp/not_existing_path/soffice.ini");
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 	// successful write
58cdf0e10cSrcweir     hProfile = osl_openProfile( ustrProfileName, 0 );
59cdf0e10cSrcweir 	if (hProfile != 0)
60cdf0e10cSrcweir 	{
61cdf0e10cSrcweir 		if (! osl_writeProfileBool( hProfile, "testsection", "testbool", 1 ))
62cdf0e10cSrcweir 			printf( "### cannot write into init file!\n" );
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 		osl_closeProfile( hProfile );
65cdf0e10cSrcweir 	}
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 	// unsuccessful write
68cdf0e10cSrcweir     hProfile = osl_openProfile( ustrProfileName2, 0 );
69cdf0e10cSrcweir 	if (hProfile != 0)
70cdf0e10cSrcweir 	{
71cdf0e10cSrcweir 		if (osl_writeProfileBool( hProfile, "testsection", "testbool", 1 ))
72cdf0e10cSrcweir 			printf( "### unexpected success writing into test2.ini!\n" );
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 		osl_closeProfile( hProfile );
75cdf0e10cSrcweir 	}
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     rtl_uString_release(ustrProfileName);
78cdf0e10cSrcweir     rtl_uString_release(ustrProfileName2);
79cdf0e10cSrcweir }
80cdf0e10cSrcweir 
81cdf0e10cSrcweir } // namespace osl_Profile
82cdf0e10cSrcweir 
main(int argc,char ** argv)83*2a2e2c38SDamjan Jovanovic int main(int argc, char **argv)
84*2a2e2c38SDamjan Jovanovic {
85*2a2e2c38SDamjan Jovanovic     ::testing::InitGoogleTest(&argc, argv);
86*2a2e2c38SDamjan Jovanovic     return RUN_ALL_TESTS();
87*2a2e2c38SDamjan Jovanovic }
88