LCOV - code coverage report
Current view: top level - unotest/source/cpp - bootstrapfixturebase.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 27 31 87.1 %
Date: 2012-08-25 Functions: 8 11 72.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 32 64 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * Version: MPL 1.1 / GPLv3+ / LGPLv3+
       4                 :            :  *
       5                 :            :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :            :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :            :  * the License or as specified alternatively below. You may obtain a copy of
       8                 :            :  * the License at http://www.mozilla.org/MPL/
       9                 :            :  *
      10                 :            :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :            :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :            :  * for the specific language governing rights and limitations under the
      13                 :            :  * License.
      14                 :            :  *
      15                 :            :  * Major Contributor(s):
      16                 :            :  *   Copyright (C) 2011 Michael Meeks <michael.meeks@suse.com>
      17                 :            :  *   Caolán McNamara <caolanm@redhat.com>
      18                 :            :  *
      19                 :            :  * All Rights Reserved.
      20                 :            :  *
      21                 :            :  * For minor contributions see the git repository.
      22                 :            :  *
      23                 :            :  * Alternatively, the contents of this file may be used under the terms of
      24                 :            :  * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
      25                 :            :  * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
      26                 :            :  * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
      27                 :            :  * instead of those above.
      28                 :            :  */
      29                 :            : #include <unotest/bootstrapfixturebase.hxx>
      30                 :            : #include <rtl/strbuf.hxx>
      31                 :            : #include <rtl/bootstrap.hxx>
      32                 :            : #include <cppuhelper/bootstrap.hxx>
      33                 :            : #include <ucbhelper/contentbroker.hxx>
      34                 :            : #include <comphelper/processfactory.hxx>
      35                 :            : 
      36                 :            : #include <com/sun/star/lang/Locale.hpp>
      37                 :            : #include <com/sun/star/lang/XComponent.hpp>
      38                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      39                 :            : 
      40                 :            : using namespace ::com::sun::star;
      41                 :            : 
      42                 :            : // NB. this constructor is called before any tests are run, once for each
      43                 :            : // test function in a rather non-intuitive way. This is why all the 'real'
      44                 :            : // heavy lifting is deferred until setUp. setUp and tearDown are interleaved
      45                 :            : // between the tests as you might expect.
      46                 :        940 : test::BootstrapFixtureBase::BootstrapFixtureBase()
      47                 :        940 :     : m_aSrcRootURL("file://"), m_aSolverRootURL( m_aSrcRootURL )
      48                 :            : {
      49                 :            : #ifndef ANDROID
      50                 :        940 :     const char* pSrcRoot = getenv( "SRC_ROOT" );
      51 [ +  - ][ +  - ]:        940 :     CPPUNIT_ASSERT_MESSAGE("SRC_ROOT env variable not set", pSrcRoot != NULL && pSrcRoot[0] != 0);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ -  + ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
      52                 :        940 :     const char* pSolverRoot = getenv( "OUTDIR_FOR_BUILD" );
      53 [ +  - ][ +  - ]:        940 :     CPPUNIT_ASSERT_MESSAGE("$OUTDIR_FOR_BUILD env variable not set", pSolverRoot != NULL && pSolverRoot[0] != 0);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ -  + ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
      54                 :            : #ifdef WNT
      55                 :            :     if (pSrcRoot[1] == ':')
      56                 :            :         m_aSrcRootURL += rtl::OUString::createFromAscii( "/" );
      57                 :            :     if (pSolverRoot[1] == ':')
      58                 :            :         m_aSolverRootURL += rtl::OUString::createFromAscii( "/" );
      59                 :            : #endif
      60                 :            : #else
      61                 :            :     const char* pSrcRoot = "/assets";
      62                 :            :     const char* pSolverRoot = "/assets";
      63                 :            : #endif
      64                 :        940 :     m_aSrcRootPath = rtl::OUString::createFromAscii( pSrcRoot );
      65                 :        940 :     m_aSrcRootURL += m_aSrcRootPath;
      66                 :            : 
      67                 :        940 :     m_aSolverRootPath = rtl::OUString::createFromAscii( pSolverRoot );
      68                 :        940 :     m_aSolverRootURL += m_aSolverRootPath;
      69                 :        940 : }
      70                 :            : 
      71                 :        940 : test::BootstrapFixtureBase::~BootstrapFixtureBase()
      72                 :            : {
      73         [ -  + ]:        940 : }
      74                 :            : 
      75                 :        465 : ::rtl::OUString test::BootstrapFixtureBase::getURLFromSrc( const char *pPath )
      76                 :            : {
      77                 :        465 :     return m_aSrcRootURL + rtl::OUString::createFromAscii( pPath );
      78                 :            : }
      79                 :            : 
      80                 :         33 : ::rtl::OUString test::BootstrapFixtureBase::getPathFromSrc( const char *pPath )
      81                 :            : {
      82                 :         33 :     return m_aSrcRootPath + rtl::OUString::createFromAscii( pPath );
      83                 :            : }
      84                 :            : 
      85                 :          0 : ::rtl::OUString test::BootstrapFixtureBase::getURLFromSolver( const char *pPath )
      86                 :            : {
      87                 :          0 :     return m_aSolverRootURL + rtl::OUString::createFromAscii( pPath );
      88                 :            : }
      89                 :            : 
      90                 :          0 : ::rtl::OUString test::BootstrapFixtureBase::getPathFromSolver( const char *pPath )
      91                 :            : {
      92                 :          0 :     return m_aSolverRootPath + rtl::OUString::createFromAscii( pPath );
      93                 :            : }
      94                 :            : 
      95                 :        940 : void test::BootstrapFixtureBase::setUp()
      96                 :            : {
      97                 :            :     // set UserInstallation to user profile dir in test/user-template
      98                 :        940 :     rtl::Bootstrap aDefaultVars;
      99                 :        940 :     rtl::OUString sUserInstallURL = m_aSolverRootURL + rtl::OUString("/unittest");
     100                 :        940 :     aDefaultVars.set(rtl::OUString("UserInstallation"), sUserInstallURL);
     101                 :            : 
     102 [ +  - ][ +  - ]:        940 :     m_xContext = comphelper::getProcessComponentContext();
     103 [ +  - ][ +  - ]:        940 :     m_xFactory = m_xContext->getServiceManager();
                 [ +  - ]
     104 [ +  - ][ +  - ]:        940 :     m_xSFactory = uno::Reference<lang::XMultiServiceFactory>(m_xFactory, uno::UNO_QUERY_THROW);
     105                 :        940 : }
     106                 :            : 
     107                 :        940 : void test::BootstrapFixtureBase::tearDown()
     108                 :            : {
     109 [ +  - ][ +  - ]:       1288 : }
     110                 :            : 
     111                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10