[Libreoffice-commits] .: 2 commits - editeng/CppunitTest_editeng_core.mk editeng/Module_editeng.mk editeng/qa sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Apr 11 11:30:40 PDT 2012


 editeng/CppunitTest_editeng_core.mk |   84 +++++++++++++++++++++
 editeng/Module_editeng.mk           |    1 
 editeng/qa/unit/core-test.cxx       |  141 ++++++++++++++++++++++++++++++++++++
 sc/inc/document.hxx                 |    1 
 sc/source/core/data/documen2.cxx    |    2 
 5 files changed, 226 insertions(+), 3 deletions(-)

New commits:
commit d241251638d80bc6e2b737088e02c96bfa8c5c63
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Apr 11 14:29:11 2012 -0400

    Attempt to add general-purpose unit test for editeng.
    
    But instantiating EditEngine causes segfault.  The line is commented
    out for now.

diff --git a/editeng/CppunitTest_editeng_core.mk b/editeng/CppunitTest_editeng_core.mk
new file mode 100644
index 0000000..e612de1
--- /dev/null
+++ b/editeng/CppunitTest_editeng_core.mk
@@ -0,0 +1,84 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+# Copyright 2000, 2011 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.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,editeng_core))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,editeng_core, \
+    editeng/qa/unit/core-test \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,editeng_core, \
+    basegfx \
+    comphelper \
+    cppu \
+    cppuhelper \
+    editeng \
+    i18nisolang1 \
+    i18nutil \
+    lng \
+    sal \
+    salhelper \
+    sot \
+    svl \
+    svt \
+    test \
+    tk \
+    tl \
+    ucbhelper \
+    utl \
+    vcl \
+    xo \
+    $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,editeng_core,\
+    icuuc \
+))
+
+$(eval $(call gb_CppunitTest_set_include,editeng_core,\
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,editeng_core,\
+    offapi \
+    udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_components,editeng_core,\
+    configmgr/source/configmgr \
+    framework/util/fwk \
+    i18npool/util/i18npool \
+    sfx2/util/sfx \
+    ucb/source/core/ucb1 \
+    ucb/source/ucp/file/ucpfile1 \
+    unoxml/source/service/unoxml \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,editeng_core))
+
+# vim: set noet sw=4 ts=4:
diff --git a/editeng/Module_editeng.mk b/editeng/Module_editeng.mk
index fd49b94..b767098 100644
--- a/editeng/Module_editeng.mk
+++ b/editeng/Module_editeng.mk
@@ -37,6 +37,7 @@ $(eval $(call gb_Module_add_targets,editeng,\
 # add any runtime tests (unit tests) here
 # remove if no tests
 $(eval $(call gb_Module_add_check_targets,editeng,\
+    CppunitTest_editeng_core \
     CppunitTest_editeng_borderline \
 ))
 
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx
new file mode 100644
index 0000000..43e668c
--- /dev/null
+++ b/editeng/qa/unit/core-test.cxx
@@ -0,0 +1,141 @@
+/* -*- 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 or as specified alternatively below. 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.
+ *
+ * Major Contributor(s):
+ *   Copyright (C) 2012 Kohei Yoshida <kohei.yoshida at suse.com>
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * 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 "sal/config.h"
+#include "sal/precppunit.hxx"
+
+#include "test/bootstrapfixture.hxx"
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "svl/itempool.hxx"
+#include "editeng/editeng.hxx"
+#include "editeng/eeitem.hxx"
+#include "editeng/editids.hrc"
+
+namespace {
+
+const SfxItemInfo aItemInfos[] = {
+    { SID_ATTR_FRAMEDIRECTION, SFX_ITEM_POOLABLE },         // EE_PARA_WRITINGDIR
+    { 0, SFX_ITEM_POOLABLE },                               // EE_PARA_XMLATTRIBS
+    { SID_ATTR_PARA_HANGPUNCTUATION, SFX_ITEM_POOLABLE },   // EE_PARA_HANGINGPUNCTUATION
+    { SID_ATTR_PARA_FORBIDDEN_RULES, SFX_ITEM_POOLABLE },
+    { SID_ATTR_PARA_SCRIPTSPACE, SFX_ITEM_POOLABLE },       // EE_PARA_ASIANCJKSPACING
+    { SID_ATTR_NUMBERING_RULE, SFX_ITEM_POOLABLE },         // EE_PARA_NUMBULL
+    { 0, SFX_ITEM_POOLABLE },                               // EE_PARA_HYPHENATE
+    { 0, SFX_ITEM_POOLABLE },                               // EE_PARA_BULLETSTATE
+    { 0, SFX_ITEM_POOLABLE },                               // EE_PARA_OUTLLRSPACE
+    { SID_ATTR_PARA_OUTLLEVEL, SFX_ITEM_POOLABLE },         // EE_PARA_OUTLLEVEL
+    { SID_ATTR_PARA_BULLET, SFX_ITEM_POOLABLE },            // EE_PARA_BULLET
+    { SID_ATTR_LRSPACE, SFX_ITEM_POOLABLE },                // EE_PARA_LRSPACE
+    { SID_ATTR_ULSPACE, SFX_ITEM_POOLABLE },                // EE_PARA_ULSPACE
+    { SID_ATTR_PARA_LINESPACE, SFX_ITEM_POOLABLE },         // EE_PARA_SBL
+    { SID_ATTR_PARA_ADJUST, SFX_ITEM_POOLABLE },            // EE_PARA_JUST
+    { SID_ATTR_TABSTOP, SFX_ITEM_POOLABLE },                // EE_PARA_TABS
+    { SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD, SFX_ITEM_POOLABLE }, // EE_PARA_JUST_METHOD
+    { SID_ATTR_ALIGN_VER_JUSTIFY, SFX_ITEM_POOLABLE },      // EE_PARA_VER_JUST
+    { SID_ATTR_CHAR_COLOR, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_FONT, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_SCALEWIDTH, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_WEIGHT, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_UNDERLINE, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_STRIKEOUT, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_POSTURE, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_CONTOUR, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_SHADOWED, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_ESCAPEMENT, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_AUTOKERN, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_KERNING, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_LANGUAGE, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_CJK_LANGUAGE, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_CTL_LANGUAGE, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_CJK_FONT, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_CTL_FONT, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_CJK_FONTHEIGHT, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_CTL_FONTHEIGHT, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_CJK_WEIGHT, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_CTL_WEIGHT, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_CJK_POSTURE, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_CTL_POSTURE, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEM_POOLABLE },
+    { SID_ATTR_CHAR_RELIEF, SFX_ITEM_POOLABLE },
+    { 0, SFX_ITEM_POOLABLE },                           // EE_CHAR_RUBI_DUMMY
+    { 0, SFX_ITEM_POOLABLE },                           // EE_CHAR_XMLATTRIBS
+    { SID_ATTR_CHAR_OVERLINE, SFX_ITEM_POOLABLE },
+    { 0, SFX_ITEM_POOLABLE },                           // EE_FEATURE_TAB
+    { 0, SFX_ITEM_POOLABLE },                           // EE_FEATURE_LINEBR
+    { SID_ATTR_CHAR_CHARSETCOLOR, SFX_ITEM_POOLABLE },  // EE_FEATURE_NOTCONV
+    { SID_FIELD, SFX_ITEM_POOLABLE }
+};
+
+class TestPool : public SfxItemPool
+{
+public:
+    TestPool() : SfxItemPool("TestPool", EE_ITEMS_START, EE_ITEMS_END, aItemInfos, NULL, true) {}
+    virtual ~TestPool() {}
+};
+
+class Test : public test::BootstrapFixture
+{
+public:
+    Test();
+
+    virtual void setUp();
+    virtual void tearDown();
+
+    void testConstruction();
+
+    CPPUNIT_TEST_SUITE(Test);
+    CPPUNIT_TEST(testConstruction);
+    CPPUNIT_TEST_SUITE_END();
+};
+
+Test::Test() {}
+
+void Test::setUp() {}
+
+void Test::tearDown() {}
+
+void Test::testConstruction()
+{
+    TestPool aPool;
+
+    // TODO: fix me
+//  EditEngine aEngine(&aPool);
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit c8e99f447da0148eec097bd6b36ab2e87a354b22
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Apr 11 12:37:49 2012 -0400

    Removing a member that's not used.

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 42b2949..bc96ea5 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -237,7 +237,6 @@ private:
     SfxUndoManager*     mpUndoManager;
     ScFieldEditEngine*  pEditEngine;                    // uses pEditPool from xPoolHelper
     ScNoteEditEngine*   pNoteEngine;                    // uses pEditPool from xPoolHelper
-    SfxItemPool*    pNoteItemPool; // SfxItemPool to be used if pDrawLayer not created.
     SfxObjectShell*     pShell;
     SfxPrinter*         pPrinter;
     VirtualDevice*      pVirtualDevice_100th_mm;
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index ab4abd0..c22d977 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -130,7 +130,6 @@ ScDocument::ScDocument( ScDocumentMode  eMode,
         mpUndoManager( NULL ),
         pEditEngine( NULL ),
         pNoteEngine( NULL ),
-        pNoteItemPool( NULL ),
         pShell( pDocShell ),
         pPrinter( NULL ),
         pVirtualDevice_100th_mm( NULL ),
@@ -435,7 +434,6 @@ ScDocument::~ScDocument()
     delete pChangeTrack;
     delete pEditEngine;
     delete pNoteEngine;
-    SfxItemPool::Free(pNoteItemPool);
     delete pChangeViewSettings;         // und weg damit
     delete pVirtualDevice_100th_mm;
 


More information about the Libreoffice-commits mailing list