summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2013-03-14 12:08:28 +0000
committerMichael Meeks <michael.meeks@suse.com>2013-03-14 13:26:42 +0000
commit678e35c4ac17219556ce0426043bd4ad905d5cee (patch)
tree6bfa1687229746e6a2f30f0421a0e10542bfeedc /xmloff
parent533be98148ff40f6205e2ac3b489748cae14ef0d (diff)
xmloff: native code unit testing harness.
Change-Id: I5b9133deea2aa7630752128128f1a222bef99eb1
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/CppunitTest_xmloff_uxmloff.mk70
-rw-r--r--xmloff/Module_xmloff.mk4
-rw-r--r--xmloff/qa/unit/uxmloff.cxx71
-rw-r--r--xmloff/source/style/impastp4.cxx15
-rw-r--r--xmloff/source/style/impastpl.hxx1
5 files changed, 161 insertions, 0 deletions
diff --git a/xmloff/CppunitTest_xmloff_uxmloff.mk b/xmloff/CppunitTest_xmloff_uxmloff.mk
new file mode 100644
index 000000000000..37959ad17966
--- /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 cd294ee70c64..886dac6d878a 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 000000000000..7e04437c3a3b
--- /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 3b65905409fc..6f6f15c49749 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 3c6e86cfe5fa..61226700f09f 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;
///////////////////////////////////////////////////////////////////////////////