[Libreoffice-commits] .: sw/qa
Caolán McNamara
caolan at kemper.freedesktop.org
Mon Dec 20 08:21:40 PST 2010
sw/qa/core/makefile.mk | 91 ++++++++++++++++++++++++++++++++++++
sw/qa/core/swdoc-test.cxx | 114 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 204 insertions(+), 1 deletion(-)
New commits:
commit 5f53398040f6648d967eb1d3da8ff5578efc8d85
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Dec 20 16:20:30 2010 +0000
cppcheck: port thb's test over and get it to work again
diff --git a/sw/qa/core/makefile.mk b/sw/qa/core/makefile.mk
index 295eca0..f19f5bc 100644
--- a/sw/qa/core/makefile.mk
+++ b/sw/qa/core/makefile.mk
@@ -60,9 +60,98 @@ DEF1NAME =$(SHL1TARGET)
# DEF1EXPORTFILE= export.exp
SHL1VERSIONMAP = export.map
+# 2nd test ------------------------------------------------------------------
+
+SHL2OBJS=$(SLO)$/swdoc-test.obj
+SHL2TARGET=swdoctest
+SHL2STDLIBS+= \
+ $(LNGLIB) \
+ $(BASICLIB) \
+ $(SFXLIB) \
+ $(SVTOOLLIB) \
+ $(SVLLIB) \
+ $(SVXCORELIB) \
+ $(EDITENGLIB) \
+ $(SVXLIB) \
+ $(BASEGFXLIB) \
+ $(DRAWINGLAYERLIB) \
+ $(VCLLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(COMPHELPERLIB) \
+ $(UCBHELPERLIB) \
+ $(TKLIB) \
+ $(VOSLIB) \
+ $(SALLIB) \
+ $(SALHELPERLIB) \
+ $(TOOLSLIB) \
+ $(I18NISOLANGLIB) \
+ $(UNOTOOLSLIB) \
+ $(SOTLIB) \
+ $(XMLOFFLIB) \
+ $(ICUUCLIB) \
+ $(I18NUTILLIB) \
+ $(AVMEDIALIB) \
+ $(CPPUNITLIB)
+
+SHL2IMPLIB= i$(SHL2TARGET)
+DEF2NAME =$(SHL2TARGET)
+SHL2VERSIONMAP = export.map
+
+# linking statically against sw parts
+SHL2LIBS=\
+ $(SLB)$/swall.lib \
+ $(SLB)$/core1.lib \
+ $(SLB)$/core2.lib \
+ $(SLB)$/core3.lib \
+ $(SLB)$/core4.lib \
+ $(SLB)$/filter.lib \
+ $(SLB)$/ui1.lib \
+ $(SLB)$/ui2.lib
+
# END ------------------------------------------------------------------
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
+
+.IF "$(OS)" == "WNT"
+my_file = file:///
+.ELSE
+my_file = file://
+.END
+
+ALLTAR: test
+
+$(MISC)$/$(TARGET)$/types.rdb .ERRREMOVE : $(SOLARBINDIR)$/types.rdb
+ $(MKDIRHIER) $(@:d)
+ $(GNUCOPY) $? $@
+
+$(MISC)/$(TARGET)/udkapi.rdb .ERRREMOVE : $(SOLARBINDIR)$/udkapi.rdb
+ $(MKDIRHIER) $(@:d)
+ $(GNUCOPY) $? $@
+
+#Make a services.rdb with the services we know we need to get up and running
+$(MISC)/$(TARGET)/services.rdb .ERRREMOVE : $(MISC)/$(TARGET)/udkapi.rdb makefile.mk
+ $(MKDIRHIER) $(@:d)
+ $(REGCOMP) -register -br $(MISC)/$(TARGET)/udkapi.rdb -r $@ -wop \
+ -c $(DLLPRE)fwk$(DLLPOSTFIX)$(DLLPOST)
+
+#Tweak things so that we use the .res files in the solver
+STAR_RESOURCEPATH:=$(PWD)/$(BIN)$(PATH_SEPERATOR)$(SOLARBINDIR)
+.EXPORT : STAR_RESOURCEPATH
+
+test .PHONY: $(SHL1TARGETN) $(SHL2TARGETN) $(MISC)/$(TARGET)/services.rdb $(MISC)$/$(TARGET)$/types.rdb $(MISC)/$(TARGET)/udkapi.rdb
+ @echo ----------------------------------------------------------
+ @echo - start unit test \#1 on library $(SHL1TARGETN)
+ @echo ----------------------------------------------------------
+ $(CPPUNITTESTER) $(SHL1TARGETN)
+ @echo ----------------------------------------------------------
+ @echo - start unit test \#2 on library $(SHL2TARGETN)
+ @echo ----------------------------------------------------------
+ $(CPPUNITTESTER) $(SHL2TARGETN) -headless -invisible \
+ -env:UNO_SERVICES=$(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb \
+ -env:UNO_TYPES="$(my_file)$(PWD)/$(MISC)/$(TARGET)/types.rdb $(my_file)$(PWD)/$(MISC)/$(TARGET)/udkapi.rdb" \
+ -env:OOO_BASE_DIR="$(my_file)$(PWD)/$(MISC)/$(TARGET)" \
+ -env:BRAND_BASE_DIR="$(my_file)$(PWD)/$(MISC)/$(TARGET)" \
+ -env:UNO_USER_PACKAGES_CACHE="$(my_file)$(PWD)/$(MISC)/$(TARGET)"
diff --git a/sw/qa/core/swdoc-test.cxx b/sw/qa/core/swdoc-test.cxx
new file mode 100644
index 0000000..fd299ae
--- /dev/null
+++ b/sw/qa/core/swdoc-test.cxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * Thorsten Behrens <tbehrens at novell.com>
+ *
+ * Contributor(s):
+ * Thorsten Behrens <tbehrens at novell.com>
+ * Caolán McNamara <caolanm at redhat.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#include "precompiled_sw.hxx"
+
+#include "preextstl.h"
+#include <cppunit/TestSuite.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/TestCase.h>
+#include <cppunit/plugin/TestPlugIn.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include "postextstl.h"
+
+#include <osl/file.hxx>
+#include <osl/process.h>
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/bootstrap.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <comphelper/processfactory.hxx>
+#include <vcl/svapp.hxx>
+#include <sfx2/app.hxx>
+
+#include "init.hxx"
+#include "swtypes.hxx"
+#include "doc.hxx"
+
+using namespace ::com::sun::star;
+
+/* Implementation of Swdoc-Test class */
+
+class SwDocTest : public CppUnit::TestFixture
+{
+public:
+ SwDocTest();
+ ~SwDocTest();
+
+ virtual void setUp();
+ virtual void tearDown();
+
+ void randomTest()
+ {
+ CPPUNIT_ASSERT_MESSAGE("SwDoc::IsRedlineOn()", !m_pDoc->IsRedlineOn());
+ }
+
+ CPPUNIT_TEST_SUITE(SwDocTest);
+ CPPUNIT_TEST(randomTest);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ uno::Reference<uno::XComponentContext> m_xContext;
+ uno::Reference<lang::XMultiComponentFactory> m_xFactory;
+ SwDoc *m_pDoc;
+};
+
+SwDocTest::SwDocTest()
+{
+ m_xContext = cppu::defaultBootstrap_InitialComponentContext();
+ m_xFactory = m_xContext->getServiceManager();
+
+ uno::Reference<lang::XMultiServiceFactory> xSM(m_xFactory, uno::UNO_QUERY_THROW);
+
+ //Without this we're crashing because callees are using
+ //getProcessServiceFactory. In general those should be removed in favour
+ //of retaining references to the root ServiceFactory as its passed around
+ comphelper::setProcessServiceFactory(xSM);
+
+ InitVCL(xSM);
+
+ SwDLL::Init();
+}
+
+void SwDocTest::setUp()
+{
+ m_pDoc = new SwDoc;
+}
+
+SwDocTest::~SwDocTest()
+{
+}
+
+void SwDocTest::tearDown()
+{
+ delete m_pDoc;
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwDocTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list