LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/xmloff/qa/unit - uxmloff.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 30 30 100.0 %
Date: 2013-07-09 Functions: 12 13 92.3 %
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             : 
      10             : #include <sal/config.h>
      11             : #include <test/bootstrapfixture.hxx>
      12             : 
      13             : #include <xmloff/xmlexp.hxx>
      14             : #include <xmloff/xmltoken.hxx>
      15             : #include <xmloff/xmlaustp.hxx>
      16             : #include "SchXMLExport.hxx"
      17             : #include "XMLChartPropertySetMapper.hxx"
      18             : #include "impastpl.hxx"
      19             : #include <comphelper/processfactory.hxx>
      20             : #include <com/sun/star/util/MeasureUnit.hpp>
      21             : 
      22             : using namespace ::xmloff::token;
      23             : using namespace ::com::sun::star;
      24             : 
      25           2 : class Test : public test::BootstrapFixture {
      26             : public:
      27             :     Test();
      28             : 
      29             :     virtual void setUp();
      30             :     virtual void tearDown();
      31             : 
      32             :     void testAutoStylePool();
      33             : 
      34           2 :     CPPUNIT_TEST_SUITE(Test);
      35           1 :     CPPUNIT_TEST(testAutoStylePool);
      36           2 :     CPPUNIT_TEST_SUITE_END();
      37             : private:
      38             :     SvXMLExport *pExport;
      39             : };
      40             : 
      41           1 : Test::Test()
      42           1 :     : pExport( NULL )
      43             : {
      44           1 : }
      45             : 
      46           1 : void Test::setUp()
      47             : {
      48           1 :     BootstrapFixture::setUp();
      49             : 
      50             :     pExport = new SchXMLExport(/* util::MeasureUnit::CM, */
      51           1 :                                comphelper::getProcessComponentContext());
      52           1 : }
      53             : 
      54           1 : void Test::tearDown()
      55             : {
      56           1 :     delete pExport;
      57           1 :     BootstrapFixture::tearDown();
      58           1 : }
      59             : 
      60           1 : void Test::testAutoStylePool()
      61             : {
      62             :     UniReference< SvXMLAutoStylePoolP > xPool(
      63           1 :         new SvXMLAutoStylePoolP( *pExport ) );
      64             :     UniReference< XMLPropertySetMapper > xSetMapper(
      65           2 :         new XMLChartPropertySetMapper );
      66             :     UniReference< XMLChartExportPropertyMapper > xExportPropMapper(
      67           2 :         new XMLChartExportPropertyMapper( xSetMapper, *pExport ) );
      68             : 
      69             :     xPool->AddFamily( XML_STYLE_FAMILY_TEXT_PARAGRAPH,
      70           1 :                       GetXMLToken( XML_PARAGRAPH ),
      71           1 :                       xExportPropMapper.get(),
      72           2 :                       OUString( "Bob" ) );
      73             : 
      74           2 :     std::vector< XMLPropertyState > aProperties;
      75           2 :     OUString aName = xPool->Add( XML_STYLE_FAMILY_TEXT_PARAGRAPH, "", aProperties );
      76             : 
      77             :     // not that interesting but worth checking
      78           1 :     CPPUNIT_ASSERT_MESSAGE( "style / naming changed", aName == "Bob1" );
      79             : 
      80             :     // find ourselves again:
      81           2 :     OUString aSameName = xPool->Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, "", aProperties );
      82           2 :     CPPUNIT_ASSERT_MESSAGE( "same style not found", aSameName == aName );
      83           1 : }
      84             : 
      85           1 : CPPUNIT_TEST_SUITE_REGISTRATION(Test);
      86             : 
      87           4 : CPPUNIT_PLUGIN_IMPLEMENT();
      88             : 
      89             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10