LCOV - code coverage report
Current view: top level - sal/qa/osl/profile - osl_old_testprofile.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 16 16 100.0 %
Date: 2015-06-13 12:38:46 Functions: 13 14 92.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <sal/types.h>
      21             : #include "cppunit/TestAssert.h"
      22             : #include "cppunit/TestFixture.h"
      23             : #include "cppunit/extensions/HelperMacros.h"
      24             : #include "cppunit/plugin/TestPlugIn.h"
      25             : 
      26             : #include <osl/profile.h>
      27             : #include <rtl/bootstrap.hxx>
      28             : 
      29             : namespace osl_Profile
      30             : {
      31           3 :     class oldtests : public CppUnit::TestFixture
      32             :     {
      33             :     public:
      34             :         void test_profile();
      35             : 
      36           2 :         CPPUNIT_TEST_SUITE( oldtests );
      37           1 :         CPPUNIT_TEST( test_profile );
      38           5 :         CPPUNIT_TEST_SUITE_END( );
      39             :     };
      40             : 
      41           1 : void oldtests::test_profile()
      42             : {
      43           1 :     rtl::OUString baseUrl;
      44           1 :     CPPUNIT_ASSERT(rtl::Bootstrap::get("UserInstallation", baseUrl));
      45             : 
      46             :     // successful write
      47           1 :     oslProfile hProfile = osl_openProfile( rtl::OUString(baseUrl + "/soffice.ini").pData, osl_Profile_WRITELOCK );
      48           1 :     CPPUNIT_ASSERT(hProfile != 0);
      49           2 :     CPPUNIT_ASSERT_MESSAGE(
      50             :         "cannot write into init file",
      51           1 :         osl_writeProfileBool( hProfile, "testsection", "testbool", 1 ));
      52           1 :     CPPUNIT_ASSERT(osl_closeProfile( hProfile ));
      53             : 
      54             :     // unsuccessful open
      55           1 :     CPPUNIT_ASSERT_EQUAL(oslProfile(0), osl_openProfile( rtl::OUString(baseUrl + "/not_existing_path/soffice.ini").pData, osl_Profile_WRITELOCK ));
      56           1 : }
      57             : 
      58             : } // namespace osl_Profile
      59             : 
      60           1 : CPPUNIT_TEST_SUITE_REGISTRATION( osl_Profile::oldtests );
      61             : 
      62           4 : CPPUNIT_PLUGIN_IMPLEMENT();
      63             : 
      64             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11