diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-11 14:29:11 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-11 14:30:58 -0400 |
commit | d241251638d80bc6e2b737088e02c96bfa8c5c63 (patch) | |
tree | 0c3156ebfbbcd0c6148e103c90906a5dfcdb986d /editeng | |
parent | c8e99f447da0148eec097bd6b36ab2e87a354b22 (diff) |
Attempt to add general-purpose unit test for editeng.
But instantiating EditEngine causes segfault. The line is commented
out for now.
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/CppunitTest_editeng_core.mk | 84 | ||||
-rw-r--r-- | editeng/Module_editeng.mk | 1 | ||||
-rw-r--r-- | editeng/qa/unit/core-test.cxx | 141 |
3 files changed, 226 insertions, 0 deletions
diff --git a/editeng/CppunitTest_editeng_core.mk b/editeng/CppunitTest_editeng_core.mk new file mode 100644 index 000000000000..e612de14fd83 --- /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 fd49b94f5ffe..b7670989d4ba 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 000000000000..43e668c642af --- /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@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: */ |