bump product version to 5.0.4.1
[LibreOffice.git] / xmloff / qa / unit / uxmloff.cxx
blob8b3cb66a010c724b8b3ca76a1e1fffb811854b42
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
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 {
26 public:
27 Test();
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();
37 private:
38 SvXMLExport *pExport;
41 Test::Test()
42 : pExport( NULL )
46 void Test::setUp()
48 BootstrapFixture::setUp();
50 pExport = new SchXMLExport(
51 comphelper::getProcessComponentContext(), "SchXMLExport.Compact",
52 SvXMLExportFlags::ALL);
55 void Test::tearDown()
57 delete pExport;
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(),
73 OUString( "Bob" ) );
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);
80 if (bHack)
81 CPPUNIT_ASSERT_MESSAGE( "style / naming changed", aName == "Bob" );
82 else
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: */