1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #include <sal/config.h>
11 #include <test/bootstrapfixture.hxx>
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>
22 using namespace ::xmloff::token
;
23 using namespace ::com::sun::star
;
25 class Test
: public test::BootstrapFixture
{
30 virtual void tearDown();
32 void testAutoStylePool();
34 CPPUNIT_TEST_SUITE(Test
);
35 CPPUNIT_TEST(testAutoStylePool
);
36 CPPUNIT_TEST_SUITE_END();
48 BootstrapFixture::setUp();
50 pExport
= new SchXMLExport(/* util::MeasureUnit::CM, */
51 comphelper::getProcessComponentContext());
57 BootstrapFixture::tearDown();
60 void Test::testAutoStylePool()
62 UniReference
< SvXMLAutoStylePoolP
> xPool(
63 new SvXMLAutoStylePoolP( *pExport
) );
64 UniReference
< XMLPropertySetMapper
> xSetMapper(
65 new XMLChartPropertySetMapper( true) );
66 UniReference
< XMLChartExportPropertyMapper
> xExportPropMapper(
67 new XMLChartExportPropertyMapper( xSetMapper
, *pExport
) );
69 xPool
->AddFamily( XML_STYLE_FAMILY_TEXT_PARAGRAPH
,
70 GetXMLToken( XML_PARAGRAPH
),
71 xExportPropMapper
.get(),
74 std::vector
< XMLPropertyState
> aProperties
;
75 OUString aName
= xPool
->Add( XML_STYLE_FAMILY_TEXT_PARAGRAPH
, "", aProperties
);
77 // not that interesting but worth checking
78 CPPUNIT_ASSERT_MESSAGE( "style / naming changed", aName
== "Bob1" );
80 // find ourselves again:
81 OUString aSameName
= xPool
->Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH
, "", aProperties
);
82 CPPUNIT_ASSERT_MESSAGE( "same style not found", aSameName
== aName
);
85 CPPUNIT_TEST_SUITE_REGISTRATION(Test
);
87 CPPUNIT_PLUGIN_IMPLEMENT();
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */