[Libreoffice-commits] .: sd/prj sd/qa

Thorsten Behrens thorsten at kemper.freedesktop.org
Tue Feb 8 02:49:09 PST 2011


 sd/prj/build.lst        |    1 
 sd/qa/unit/export.map   |    7 ++
 sd/qa/unit/makefile.mk  |  117 ++++++++++++++++++++++++++++++++++++++++
 sd/qa/unit/uimpress.cxx |  137 ++++++++++++++++++++++++++++++++++++++++++++++++
 sd/qa/unit/version.map  |   34 +++++++++++
 5 files changed, 296 insertions(+)

New commits:
commit 14cf7234d5f120213293970be1b2bf6aed4a867c
Author: Thorsten Behrens <tbehrens at novell.com>
Date:   Sun Feb 6 22:53:06 2011 +0100

    Initial unit test framework for Impress

diff --git a/sd/prj/build.lst b/sd/prj/build.lst
index 74df047..43af376 100644
--- a/sd/prj/build.lst
+++ b/sd/prj/build.lst
@@ -46,3 +46,4 @@ sd	sd\source\ui\framework\tools           	nmake	-	all sd_framework_tools sd_inc
 sd	sd\source\ui\annotations				nmake	-	all sd_uiannotations sd_inc NULL
 sd	sd\util									nmake	-	all	sd_util sd_app sd_cgm sd_core sd_dlg sd_docsh sd_eppt sd_filt sd_func sd_grf sd_unid sd_view sd_filter_xml sd_html sd_ppt sd_accessibility sd_animations sd_toolpanel sd_toolpanel_controls sd_tools sd_slsshell sd_slsmodel sd_slsview sd_slscontroller sd_slscache sd_notes sd_controller sd_table sd_slideshow sd_presenter sd_undo sd_helper sd_framework_configuration sd_framework_module sd_framework_tools sd_framework_factories sd_text sd_annotations sd_uiannotations NULL
 sd  sd\qa\unoapi 							nmake 	- 	all sd_qa_unoapi NULL
+sd	sd\qa\unit								nmake	-	all	sd_qa_cppunit sd_util NULL
diff --git a/sd/qa/unit/export.map b/sd/qa/unit/export.map
new file mode 100644
index 0000000..4ca70fa
--- /dev/null
+++ b/sd/qa/unit/export.map
@@ -0,0 +1,7 @@
+UDK_3.0 {
+    global:
+        registerAllTestFunction;
+
+    local:
+        *;
+};
diff --git a/sd/qa/unit/makefile.mk b/sd/qa/unit/makefile.mk
new file mode 100644
index 0000000..0814a35
--- /dev/null
+++ b/sd/qa/unit/makefile.mk
@@ -0,0 +1,117 @@
+# -*- 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
+#       Novell, Inc.
+# Portions created by the Initial Developer are Copyright (C) 2010 the
+# Initial Developer. All Rights Reserved.
+#
+# Contributor(s):  Michael Meeks <michael.meeks at novell.com>
+#                  Caolan 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.
+#
+
+PRJ=..$/..
+PRJNAME=sd
+TARGET=qa_unit
+
+ENABLE_EXCEPTIONS=TRUE
+
+.INCLUDE : settings.mk
+
+#building with stlport, but cppunit was not built with stlport
+.IF "$(USE_SYSTEM_STL)"!="YES"
+.IF "$(SYSTEM_CPPUNIT)"=="YES"
+CFLAGSCXX+=-DADAPT_EXT_STL
+.ENDIF
+.ENDIF
+
+CFLAGSCXX += $(CPPUNIT_CFLAGS)
+
+SHL1TARGET = $(TARGET)
+SHL1OBJS = $(SLO)$/uimpress.obj
+SHL1STDLIBS= \
+    $(BASICLIB)	\
+    $(SFXLIB)		\
+    $(SVTOOLLIB)	\
+    $(SVLLIB)		\
+    $(SVXCORELIB)		\
+    $(EDITENGLIB)		\
+    $(SVXLIB)		\
+    $(BASEGFXLIB) \
+    $(DRAWINGLAYERLIB) \
+    $(I18NISOLANGLIB) \
+    $(VCLLIB)		\
+    $(CPPULIB)		\
+    $(CPPCANVASLIB)	\
+    $(CPPUHELPERLIB)	\
+    $(COMPHELPERLIB)	\
+    $(UCBHELPERLIB)	\
+    $(SALLIB)		\
+    $(SALHELPERLIB)	\
+    $(TOOLSLIB)	\
+    $(TKLIB)	\
+    $(SOTLIB)	\
+    $(UNOTOOLSLIB) \
+    $(XMLOFFLIB)	\
+    $(AVMEDIALIB)	\
+    $(CPPUNITLIB)
+SHL1IMPLIB = i$(SHL1TARGET)
+SHL1LIBS=$(SLB)$/sdraw3.lib $(SLB)$/sdraw3_2.lib $(SLB)$/sdraw3_3.lib
+DEF1NAME = $(SHL1TARGET)
+SHL1VERSIONMAP=version.map
+
+.INCLUDE: target.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) $(MISC)/$(TARGET)/services.rdb $(MISC)$/$(TARGET)$/types.rdb $(MISC)/$(TARGET)/udkapi.rdb
+    @echo ----------------------------------------------------------
+    @echo - start unit test \#1 on library $(SHL1TARGETN)
+    @echo ----------------------------------------------------------
+    $(CPPUNITTESTER) $(SHL1TARGETN) -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/sd/qa/unit/uimpress.cxx b/sd/qa/unit/uimpress.cxx
new file mode 100644
index 0000000..1ce3536
--- /dev/null
+++ b/sd/qa/unit/uimpress.cxx
@@ -0,0 +1,137 @@
+/* -*- 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
+ *       Novell, Inc.
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):  Thorsten Behrens <tbehrens at novell.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_sd.hxx"
+
+#include <cppunit/TestAssert.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
+#include <sal/config.h>
+
+#include <cppuhelper/bootstrap.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <vcl/svapp.hxx>
+#include <sddll.hxx>
+#include <drawdoc.hxx>
+
+#include <iostream>
+#include <vector>
+
+using namespace ::com::sun::star;
+
+namespace {
+
+class Test : public CppUnit::TestFixture {
+public:
+    Test();
+    ~Test();
+
+    virtual void setUp();
+    virtual void tearDown();
+
+    void testAddPage();
+    void testCustomShow();
+
+    CPPUNIT_TEST_SUITE(Test);
+    CPPUNIT_TEST(testAddPage);
+    CPPUNIT_TEST(testCustomShow);
+    CPPUNIT_TEST_SUITE_END();
+
+private:
+    uno::Reference< uno::XComponentContext > m_xContext;
+    SdDrawDocument* m_pDoc;
+};
+
+Test::Test()
+    : m_pDoc(0)
+{
+    m_xContext = cppu::defaultBootstrap_InitialComponentContext();
+
+    uno::Reference<lang::XMultiComponentFactory> xFactory(m_xContext->getServiceManager());
+    uno::Reference<lang::XMultiServiceFactory> xSM(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);
+
+    SdDLL::Init();
+}
+
+void Test::setUp()
+{
+    m_pDoc = new SdDrawDocument(DOCUMENT_TYPE_IMPRESS, NULL);
+}
+
+void Test::tearDown()
+{
+    delete m_pDoc;
+}
+
+Test::~Test()
+{
+    uno::Reference< lang::XComponent >(m_xContext, uno::UNO_QUERY_THROW)->dispose();
+}
+
+void Test::testAddPage()
+{
+    SdrPage* pPage = m_pDoc->AllocPage(false);
+    m_pDoc->InsertPage(pPage);
+    CPPUNIT_ASSERT_MESSAGE("added one page to model",
+                           m_pDoc->GetPageCount()==1);
+    m_pDoc->DeletePage(0);
+    CPPUNIT_ASSERT_MESSAGE("removed one page to model",
+                           m_pDoc->GetPageCount()==0);
+
+    SdrPage* pMasterPage = m_pDoc->AllocPage(true);
+    m_pDoc->InsertMasterPage(pMasterPage);
+    CPPUNIT_ASSERT_MESSAGE("added one master page to model",
+                           m_pDoc->GetMasterPageCount()==1);
+    m_pDoc->DeleteMasterPage(0);
+    CPPUNIT_ASSERT_MESSAGE("removed one master page to model",
+                           m_pDoc->GetMasterPageCount()==0);
+}
+
+void Test::testCustomShow()
+{
+    CPPUNIT_ASSERT_MESSAGE("test generation of custom show list!", 
+                           m_pDoc->GetCustomShowList(TRUE));    
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/qa/unit/version.map b/sd/qa/unit/version.map
new file mode 100644
index 0000000..3308588
--- /dev/null
+++ b/sd/qa/unit/version.map
@@ -0,0 +1,34 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org.  If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+UDK_3_0_0 {
+    global:
+        cppunitTestPlugIn;
+
+    local:
+        *;
+};


More information about the Libreoffice-commits mailing list