[Libreoffice-commits] core.git: 2 commits - xmloff/CppunitTest_xmloff_uxmloff.mk xmloff/Module_xmloff.mk xmloff/qa xmloff/source

Michael Meeks michael.meeks at suse.com
Thu Mar 14 06:27:27 PDT 2013


 xmloff/CppunitTest_xmloff_uxmloff.mk |   70 ++++++++++++++++++++++++++++++++++
 xmloff/Module_xmloff.mk              |    4 +
 xmloff/qa/unit/uxmloff.cxx           |   71 +++++++++++++++++++++++++++++++++++
 xmloff/source/chart/SchXMLExport.cxx |   12 -----
 xmloff/source/style/impastp4.cxx     |   15 +++++++
 xmloff/source/style/impastpl.hxx     |    1 
 6 files changed, 163 insertions(+), 10 deletions(-)

New commits:
commit b6e60d3eb5c21a98dfa86fde0bb695986058f463
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Thu Mar 14 13:25:05 2013 +0000

    remove redundant property handler factory.
    
    Change-Id: I458f8f4a9575c2afddcd4f4d2f9494bffd5ff127

diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 2e39f93..c3c38ec 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -261,7 +261,6 @@ private:
 public:
     SvXMLExport& mrExport;
     SvXMLAutoStylePoolP& mrAutoStylePool;
-    UniReference< XMLPropertyHandlerFactory > mxPropertyHandlerFactory;
     UniReference< XMLPropertySetMapper > mxPropertySetMapper;
     UniReference< XMLChartExportPropertyMapper > mxExpPropMapper;
 
@@ -1083,15 +1082,8 @@ SchXMLExportHelper_Impl::SchXMLExportHelper_Impl(
 {
     msTableName = OUString( "local-table" );
 
-    // create factory
-    mxPropertyHandlerFactory = new XMLChartPropHdlFactory;
-
-    if( mxPropertyHandlerFactory.is() )
-    {
-        // create property set mapper
-        mxPropertySetMapper = new XMLChartPropertySetMapper;
-    }
-
+    // create property set mapper
+    mxPropertySetMapper = new XMLChartPropertySetMapper;
     mxExpPropMapper = new XMLChartExportPropertyMapper( mxPropertySetMapper, rExport );
 
     // register chart auto-style family
commit 678e35c4ac17219556ce0426043bd4ad905d5cee
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Thu Mar 14 12:08:28 2013 +0000

    xmloff: native code unit testing harness.
    
    Change-Id: I5b9133deea2aa7630752128128f1a222bef99eb1

diff --git a/xmloff/CppunitTest_xmloff_uxmloff.mk b/xmloff/CppunitTest_xmloff_uxmloff.mk
new file mode 100644
index 0000000..37959ad
--- /dev/null
+++ b/xmloff/CppunitTest_xmloff_uxmloff.mk
@@ -0,0 +1,70 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,xmloff_uxmloff))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,xmloff_uxmloff, \
+    xmloff/qa/unit/uxmloff \
+))
+
+
+$(eval $(call gb_CppunitTest_set_include,xmloff_uxmloff,\
+    -I$(SRCDIR)/xmloff/inc \
+    -I$(SRCDIR)/xmloff/source/style \
+    -I$(SRCDIR)/xmloff/source/chart \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,xmloff_uxmloff,\
+    offapi \
+    udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,xmloff_uxmloff))
+
+$(eval $(call gb_CppunitTest_use_library_objects,xmloff_uxmloff,xo))
+
+$(eval $(call gb_CppunitTest_use_externals,xmloff_uxmloff,\
+	boost_headers \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,xmloff_uxmloff, \
+    basegfx \
+    comphelper \
+    cppu \
+    cppuhelper \
+    i18nisolang1 \
+    sal \
+    salhelper \
+	sax \
+    svl \
+	test \
+    tl \
+    utl \
+    vcl \
+	$(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_use_components,xmloff_uxmloff,\
+    configmgr/source/configmgr \
+    fileaccess/source/fileacc \
+    i18npool/util/i18npool \
+    sax/source/expatwrap/expwrap \
+    ucb/source/core/ucb1 \
+    ucb/source/ucp/file/ucpfile1 \
+    unoxml/source/service/unoxml \
+))
+
+#    uui/util/uui \
+#    sfx2/util/sfx \
+#    framework/util/fwk \
+
+$(eval $(call gb_CppunitTest_use_configuration,xmloff_uxmloff))
+
+# vim: set noet sw=4 ts=4:
diff --git a/xmloff/Module_xmloff.mk b/xmloff/Module_xmloff.mk
index cd294ee..886dac6 100644
--- a/xmloff/Module_xmloff.mk
+++ b/xmloff/Module_xmloff.mk
@@ -26,6 +26,10 @@ $(eval $(call gb_Module_add_targets,xmloff,\
     Package_inc \
 ))
 
+$(eval $(call gb_Module_add_check_targets,xmloff,\
+    CppunitTest_xmloff_uxmloff \
+))
+
 $(eval $(call gb_Module_add_subsequentcheck_targets,xmloff,\
     JunitTest_xmloff_unoapi \
 ))
diff --git a/xmloff/qa/unit/uxmloff.cxx b/xmloff/qa/unit/uxmloff.cxx
new file mode 100644
index 0000000..7e04437
--- /dev/null
+++ b/xmloff/qa/unit/uxmloff.cxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sal/config.h>
+#include <test/bootstrapfixture.hxx>
+
+#include <xmloff/xmlexp.hxx>
+#include "SchXMLExport.hxx"
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/util/MeasureUnit.hpp>
+
+using namespace ::com::sun::star;
+
+namespace {
+
+class Test : public test::BootstrapFixture {
+public:
+    Test();
+
+    virtual void setUp();
+    virtual void tearDown();
+
+    void testSomething();
+
+    CPPUNIT_TEST_SUITE(Test);
+    CPPUNIT_TEST(testSomething);
+    CPPUNIT_TEST_SUITE_END();
+private:
+    SvXMLExport *pExport;
+};
+
+
+Test::Test()
+    : pExport( NULL )
+{
+}
+
+void Test::setUp()
+{
+    BootstrapFixture::setUp();
+
+    pExport = new SchXMLExport(/* util::MeasureUnit::CM, */
+                               comphelper::getProcessComponentContext());
+}
+
+void Test::tearDown()
+{
+    delete pExport;
+    BootstrapFixture::tearDown();
+}
+
+void Test::testSomething()
+{
+    OUString s1("A");
+    OUString s2("B");
+    CPPUNIT_ASSERT_MESSAGE("these strings are supposed to be different!", s1 != s2);
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/impastp4.cxx b/xmloff/source/style/impastp4.cxx
index 3b65905..6f6f15c 100644
--- a/xmloff/source/style/impastp4.cxx
+++ b/xmloff/source/style/impastp4.cxx
@@ -78,6 +78,21 @@ void SvXMLAutoStylePoolP_Impl::AddFamily(
         aPrefix += rStrPrefix;
     }
 
+#if OSL_DEBUG_LEVEL > 0
+    XMLFamilyData_Impl aTemporary( nFamily );
+    XMLFamilyDataList_Impl::iterator aFind = maFamilyList.find(aTemporary);
+    if( aFind != maFamilyList.end() )
+    {
+        // FIXME: do we really intend to replace the previous nFamily
+        // entry in this case ?
+        SAL_WARN_IF( aFind->mxMapper != rMapper, "xmloff",
+                     "Adding duplicate family " << rStrName <<
+                     " with mismatching mapper ! " <<
+                     typeid(*aFind->mxMapper.get()).name() << " " <<
+                     typeid(rMapper.get()).name() );
+    }
+#endif
+
     XMLFamilyData_Impl *pFamily = new XMLFamilyData_Impl( nFamily, rStrName, rMapper, aPrefix, bAsFamily );
     maFamilyList.insert(pFamily);
 }
diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx
index 3c6e86c..6122670 100644
--- a/xmloff/source/style/impastpl.hxx
+++ b/xmloff/source/style/impastpl.hxx
@@ -81,6 +81,7 @@ public:
     void ClearEntries();
 };
 
+/// A set that finds and sorts based only on mnFamily
 typedef boost::ptr_set<XMLFamilyData_Impl> XMLFamilyDataList_Impl;
 
 ///////////////////////////////////////////////////////////////////////////////


More information about the Libreoffice-commits mailing list