From c44e6855a9148dda31d09ba4cbfc5cd7729b8199 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Thu, 14 Mar 2013 17:41:18 +0000 Subject: xmloff: at least do something to test styles. Change-Id: I7982f162ef95a9f10501c860b6f19865bf34744b --- xmloff/qa/unit/uxmloff.cxx | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'xmloff/qa') diff --git a/xmloff/qa/unit/uxmloff.cxx b/xmloff/qa/unit/uxmloff.cxx index 7e04437c3a3b..a0bd4306226b 100644 --- a/xmloff/qa/unit/uxmloff.cxx +++ b/xmloff/qa/unit/uxmloff.cxx @@ -11,14 +11,17 @@ #include #include +#include +#include #include "SchXMLExport.hxx" +#include "XMLChartPropertySetMapper.hxx" +#include "impastpl.hxx" #include #include +using namespace ::xmloff::token; using namespace ::com::sun::star; -namespace { - class Test : public test::BootstrapFixture { public: Test(); @@ -26,16 +29,15 @@ public: virtual void setUp(); virtual void tearDown(); - void testSomething(); + void testAutoStylePool(); CPPUNIT_TEST_SUITE(Test); - CPPUNIT_TEST(testSomething); + CPPUNIT_TEST(testAutoStylePool); CPPUNIT_TEST_SUITE_END(); private: SvXMLExport *pExport; }; - Test::Test() : pExport( NULL ) { @@ -55,17 +57,33 @@ void Test::tearDown() BootstrapFixture::tearDown(); } -void Test::testSomething() +void Test::testAutoStylePool() { - OUString s1("A"); - OUString s2("B"); - CPPUNIT_ASSERT_MESSAGE("these strings are supposed to be different!", s1 != s2); + UniReference< SvXMLAutoStylePoolP > xPool( + new SvXMLAutoStylePoolP( *pExport ) ); + UniReference< XMLPropertySetMapper > xSetMapper( + new XMLChartPropertySetMapper ); + UniReference< XMLChartExportPropertyMapper > xExportPropMapper( + new XMLChartExportPropertyMapper( xSetMapper, *pExport ) ); + + xPool->AddFamily( XML_STYLE_FAMILY_TEXT_PARAGRAPH, + GetXMLToken( XML_PARAGRAPH ), + xExportPropMapper.get(), + OUString( "Bob" ) ); + + std::vector< XMLPropertyState > aProperties; + OUString aName = xPool->Add( XML_STYLE_FAMILY_TEXT_PARAGRAPH, "", aProperties ); + + // not that interesting but worth checking + CPPUNIT_ASSERT_MESSAGE( "style / naming changed", aName == "Bob1" ); + + // find ourselves again: + OUString aSameName = xPool->Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, "", aProperties ); + CPPUNIT_ASSERT_MESSAGE( "same style not found", aSameName == aName ); } CPPUNIT_TEST_SUITE_REGISTRATION(Test); -} - CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit