xmloff: at least do something to test styles.

Change-Id: I7982f162ef95a9f10501c860b6f19865bf34744b
This commit is contained in:
Michael Meeks
2013-03-14 17:41:18 +00:00
parent 9d0e346d60
commit c44e6855a9
2 changed files with 30 additions and 11 deletions

View File

@@ -37,6 +37,7 @@ namespace com { namespace sun { namespace star { namespace uno
class XMLOFF_DLLPUBLIC SvXMLAutoStylePoolP : public UniRefBase class XMLOFF_DLLPUBLIC SvXMLAutoStylePoolP : public UniRefBase
{ {
friend class Test;
friend class SvXMLAutoStylePoolP_Impl; friend class SvXMLAutoStylePoolP_Impl;
SvXMLAutoStylePoolP_Impl *pImpl; SvXMLAutoStylePoolP_Impl *pImpl;

View File

@@ -11,14 +11,17 @@
#include <test/bootstrapfixture.hxx> #include <test/bootstrapfixture.hxx>
#include <xmloff/xmlexp.hxx> #include <xmloff/xmlexp.hxx>
#include <xmloff/xmltoken.hxx>
#include <xmloff/xmlaustp.hxx>
#include "SchXMLExport.hxx" #include "SchXMLExport.hxx"
#include "XMLChartPropertySetMapper.hxx"
#include "impastpl.hxx"
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <com/sun/star/util/MeasureUnit.hpp> #include <com/sun/star/util/MeasureUnit.hpp>
using namespace ::xmloff::token;
using namespace ::com::sun::star; using namespace ::com::sun::star;
namespace {
class Test : public test::BootstrapFixture { class Test : public test::BootstrapFixture {
public: public:
Test(); Test();
@@ -26,16 +29,15 @@ public:
virtual void setUp(); virtual void setUp();
virtual void tearDown(); virtual void tearDown();
void testSomething(); void testAutoStylePool();
CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testSomething); CPPUNIT_TEST(testAutoStylePool);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
private: private:
SvXMLExport *pExport; SvXMLExport *pExport;
}; };
Test::Test() Test::Test()
: pExport( NULL ) : pExport( NULL )
{ {
@@ -55,17 +57,33 @@ void Test::tearDown()
BootstrapFixture::tearDown(); BootstrapFixture::tearDown();
} }
void Test::testSomething() void Test::testAutoStylePool()
{ {
OUString s1("A"); UniReference< SvXMLAutoStylePoolP > xPool(
OUString s2("B"); new SvXMLAutoStylePoolP( *pExport ) );
CPPUNIT_ASSERT_MESSAGE("these strings are supposed to be different!", s1 != s2); 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_TEST_SUITE_REGISTRATION(Test);
}
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */