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
{
29 virtual void setUp() SAL_OVERRIDE
;
30 virtual void tearDown() SAL_OVERRIDE
;
32 void testAutoStylePool();
34 CPPUNIT_TEST_SUITE(Test
);
35 CPPUNIT_TEST(testAutoStylePool
);
36 CPPUNIT_TEST_SUITE_END();
48 BootstrapFixture::setUp();
50 pExport
= new SchXMLExport(
51 comphelper::getProcessComponentContext(), "SchXMLExport.Compact",
52 SvXMLExportFlags::ALL
);
58 BootstrapFixture::tearDown();
61 void Test::testAutoStylePool()
63 rtl::Reference
< SvXMLAutoStylePoolP
> xPool(
64 new SvXMLAutoStylePoolP( *pExport
) );
65 rtl::Reference
< XMLPropertySetMapper
> xSetMapper(
66 new XMLChartPropertySetMapper( true) );
67 rtl::Reference
< XMLChartExportPropertyMapper
> xExportPropMapper(
68 new XMLChartExportPropertyMapper( xSetMapper
, *pExport
) );
70 xPool
->AddFamily( XML_STYLE_FAMILY_TEXT_PARAGRAPH
,
71 GetXMLToken( XML_PARAGRAPH
),
72 xExportPropMapper
.get(),
75 std::vector
< XMLPropertyState
> aProperties
;
76 OUString aName
= xPool
->Add( XML_STYLE_FAMILY_TEXT_PARAGRAPH
, "", aProperties
);
78 // not that interesting but worth checking
79 bool bHack
= (getenv("LIBO_ONEWAY_STABLE_ODF_EXPORT") != NULL
);
81 CPPUNIT_ASSERT_MESSAGE( "style / naming changed", aName
== "Bob" );
83 CPPUNIT_ASSERT_MESSAGE( "style / naming changed", aName
== "Bob1" );
85 // find ourselves again:
86 OUString aSameName
= xPool
->Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH
, "", aProperties
);
87 CPPUNIT_ASSERT_MESSAGE( "same style not found", aSameName
== aName
);
90 CPPUNIT_TEST_SUITE_REGISTRATION(Test
);
92 CPPUNIT_PLUGIN_IMPLEMENT();
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */