[Libreoffice-commits] .: 6 commits - sc/CppunitTest_sc_cellrangesbase.mk sc/CppunitTest_sc_tableautoformatfield.mk sc/CppunitTest_sc_xcellrangesquery.mk sc/Module_sc.mk sc/qa sc/source

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Sun Dec 4 16:43:06 PST 2011


 sc/CppunitTest_sc_cellrangesbase.mk       |  142 ++++++++++++++++++++++++++++++
 sc/CppunitTest_sc_tableautoformatfield.mk |  141 +++++++++++++++++++++++++++++
 sc/CppunitTest_sc_xcellrangesquery.mk     |  141 -----------------------------
 sc/Module_sc.mk                           |    3 
 sc/qa/extras/cellproperties.cxx           |  117 ++++++++++++++++++++++++
 sc/qa/extras/tableautoformatfield.cxx     |  107 ++++++++++++++++++++++
 sc/qa/extras/xcellrangesquery.cxx         |    2 
 sc/source/filter/xml/xmlcelli.cxx         |    2 
 sc/source/ui/namedlg/namedefdlg.cxx       |    4 
 sc/source/ui/namedlg/namedlg.cxx          |   25 +++--
 sc/source/ui/src/namedlg.src              |    4 
 11 files changed, 532 insertions(+), 156 deletions(-)

New commits:
commit 9d5d04776f0a163796a41446852ec59ba76c9c1a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Dec 5 00:53:14 2011 +0100

    add subsequenttest for failing test CellProperties
    
    share test between all services which share the implementation in
    ScCellRangesBase

diff --git a/sc/CppunitTest_sc_cellrangesbase.mk b/sc/CppunitTest_sc_cellrangesbase.mk
index 2c1063f..98d1683 100644
--- a/sc/CppunitTest_sc_cellrangesbase.mk
+++ b/sc/CppunitTest_sc_cellrangesbase.mk
@@ -32,6 +32,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,sc_cellrangesbase))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,sc_cellrangesbase, \
     sc/qa/extras/xcellrangesquery \
+    sc/qa/extras/cellproperties \
 ))
 
 $(eval $(call gb_CppunitTest_add_linked_libs,sc_cellrangesbase, \
diff --git a/sc/qa/extras/cellproperties.cxx b/sc/qa/extras/cellproperties.cxx
new file mode 100644
index 0000000..20e90f4
--- /dev/null
+++ b/sc/qa/extras/cellproperties.cxx
@@ -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 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) 2011 Markus Mohrhard <markus.mohrhard at googlemail.com> (initial developer)
+ *
+ * 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 <test/unoapi_test.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/table/CellVertJustify.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+
+namespace ScCellRangeBase {
+
+class ScCellProperties : public UnoApiTest
+{
+    uno::Reference < beans::XPropertySet > init();
+
+    void testVertJustify();
+    void testRotateReference();
+    CPPUNIT_TEST_SUITE(ScCellProperties);
+    //enable as soon as fixed
+    //CPPUNIT_TEST(testVertJustify);
+    //CPPUNIT_TEST(testRotateReference);
+    CPPUNIT_TEST_SUITE_END();
+};
+
+void ScCellProperties::testVertJustify()
+{
+    uno::Reference< beans::XPropertySet > xCellRangeBase = init();
+    rtl::OUString aVertJustify(RTL_CONSTASCII_USTRINGPARAM("VertJustify"));
+    uno::Any aOldVertJustify = xCellRangeBase->getPropertyValue(aVertJustify);
+    sal_Int32 aValue;
+    CPPUNIT_ASSERT(aOldVertJustify >>= aValue);
+    std::cout << "Old VertJustify value: " << aValue << std::endl;
+
+    uno::Any aNewVertJustify;
+    aNewVertJustify <<= table::CellVertJustify_BOTTOM;
+    xCellRangeBase->setPropertyValue(aVertJustify, aNewVertJustify);
+    uno::Any aVertJustifyControllValue = xCellRangeBase->getPropertyValue(aVertJustify);
+    CPPUNIT_ASSERT(aVertJustifyControllValue >>= aValue);
+    std::cout << "New VertJustify value: " << aValue << std::endl;
+    CPPUNIT_ASSERT_MESSAGE("value has not been changed", aValue == table::CellVertJustify_BOTTOM);
+}
+
+void ScCellProperties::testRotateReference()
+{
+    uno::Reference< beans::XPropertySet > xCellRangeBase = init();
+    rtl::OUString aRotateReference(RTL_CONSTASCII_USTRINGPARAM("RotateReference"));
+    uno::Any aOldRotateReference = xCellRangeBase->getPropertyValue(aRotateReference);
+    sal_Int32 aValue;
+    CPPUNIT_ASSERT(aOldRotateReference >>= aValue);
+    std::cout << "Old RotateReference Value: " << aValue << std::endl;
+
+    uno::Any aNewRotateReference;
+    aNewRotateReference <<= table::CellVertJustify_BOTTOM;
+    xCellRangeBase->setPropertyValue(aRotateReference, aNewRotateReference);
+    uno::Any aRotateReferenceControllValue = xCellRangeBase->getPropertyValue(aRotateReference);
+    CPPUNIT_ASSERT(aRotateReferenceControllValue >>= aValue);
+    std::cout << "New RotateReference value: " << aValue << std::endl;
+    CPPUNIT_ASSERT_MESSAGE("value has not been changed", aValue == table::CellVertJustify_BOTTOM);
+}
+
+uno::Reference< beans::XPropertySet > ScCellProperties::init()
+{
+    rtl::OUString aFileURL;
+    const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("xcellrangesquery.ods"));
+    createFileURL(aFileBase, aFileURL);
+    static uno::Reference< lang::XComponent > xComponent;
+    if( !xComponent.is())
+        xComponent = loadFromDesktop(aFileURL);
+    uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW);
+    CPPUNIT_ASSERT(xDoc.is());
+
+    uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
+    uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
+
+    CPPUNIT_ASSERT_MESSAGE("Could not create interface of type XSpreadsheet", xSheet.is());
+
+    uno::Reference< table::XCellRange > xCellRange(xSheet->getCellRangeByPosition(0,0,3,4), UNO_QUERY_THROW);
+    CPPUNIT_ASSERT(xCellRange.is());
+
+    uno::Reference< beans::XPropertySet > xReturn(xCellRange, UNO_QUERY_THROW);
+
+    CPPUNIT_ASSERT_MESSAGE("Could not create object of type XPropertySet", xReturn.is());
+    return xReturn;
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScCellProperties);
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 1e3b55e23029fcade3b8f708fc037830402dbd28
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Dec 5 00:22:12 2011 +0100

    adjust sc's c++ subsequenttest concept
    
    create one test suite per implementation class:
    move xcellrangesquery into ScCellRangesBase

diff --git a/sc/CppunitTest_sc_cellrangesbase.mk b/sc/CppunitTest_sc_cellrangesbase.mk
new file mode 100644
index 0000000..2c1063f
--- /dev/null
+++ b/sc/CppunitTest_sc_cellrangesbase.mk
@@ -0,0 +1,141 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+# 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.
+#
+# The Initial Developer of the Original Code is
+#       Markus Mohrhard <markus.mohrhard at googlemail.com>
+# Portions created by the Initial Developer are Copyright (C) 2011 the
+# Initial Developer. All Rights Reserved.
+#
+# Major Contributor(s):
+#
+# 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.
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sc_cellrangesbase))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_cellrangesbase, \
+    sc/qa/extras/xcellrangesquery \
+))
+
+$(eval $(call gb_CppunitTest_add_linked_libs,sc_cellrangesbase, \
+    avmedia \
+    basegfx \
+    comphelper \
+    cppu \
+    cppuhelper \
+    drawinglayer \
+    editeng \
+    fileacc \
+    for \
+    forui \
+    i18nisolang1 \
+    msfilter \
+    oox \
+    sal \
+    salhelper \
+    sax \
+    sb \
+    sc \
+    sfx \
+    sot \
+    svl \
+    svt \
+    svx \
+    svxcore \
+	test \
+    tl \
+    tk \
+    ucbhelper \
+	unotest \
+    utl \
+    vbahelper \
+    vcl \
+    xo \
+	$(gb_STDLIBS) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_cellrangesbase,\
+    -I$(realpath $(SRCDIR)/sc/source/ui/inc) \
+    -I$(realpath $(SRCDIR)/sc/inc) \
+    $$(INCLUDE) \
+    -I$(OUTDIR)/inc \
+))
+
+$(eval $(call gb_CppunitTest_add_api,sc_cellrangesbase,\
+    offapi \
+    udkapi \
+))
+
+$(eval $(call gb_CppunitTest_uses_ure,sc_cellrangesbase))
+
+$(eval $(call gb_CppunitTest_add_type_rdbs,sc_cellrangesbase,\
+    types \
+))
+
+$(eval $(call gb_CppunitTest_add_components,sc_cellrangesbase,\
+    basic/util/sb \
+    comphelper/util/comphelp \
+    dbaccess/util/dba \
+    fileaccess/source/fileacc \
+    filter/source/config/cache/filterconfig1 \
+    forms/util/frm \
+    framework/util/fwk \
+    i18npool/util/i18npool \
+    oox/util/oox \
+    package/source/xstor/xstor \
+    package/util/package2 \
+    sax/source/expatwrap/expwrap \
+    sax/source/fastparser/fastsax \
+    sc/util/sc \
+    sc/util/scd \
+    sc/util/scfilt \
+    sc/util/vbaobj \
+    scripting/source/basprov/basprov \
+    scripting/util/scriptframe \
+    sfx2/util/sfx \
+    sot/util/sot \
+    svl/source/fsstor/fsstorage \
+    toolkit/util/tk \
+    unotools/util/utl \
+    unoxml/source/rdf/unordf \
+    unoxml/source/service/unoxml \
+))
+
+$(eval $(call gb_CppunitTest_add_old_components,sc_cellrangesbase,\
+    configmgr \
+    ucb1 \
+    ucpfile1 \
+    ucptdoc1 \
+))
+
+$(eval $(call gb_CppunitTest_set_args,sc_cellrangesbase,\
+    --headless \
+    --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \
+    "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry) module:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry/spool) xcsxcu:$(call gb_CppunitTarget__make_url,$(SRCDIR)/sc/qa/unit/data/registry)" \
+))
+    # .../spool is required for the (somewhat strange) filter configuration
+
+# we need to
+# a) explicitly depend on library msword because it is not implied by a link
+#    relation
+# b) explicitly depend on the sc resource files needed at unit-test runtime
+$(call gb_CppunitTest_get_target,sc_cellrangesbase) : $(call gb_Library_get_target,scfilt) $(WORKDIR)/AllLangRes/sc
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/CppunitTest_sc_xcellrangesquery.mk b/sc/CppunitTest_sc_xcellrangesquery.mk
deleted file mode 100644
index a0e4bf4..0000000
--- a/sc/CppunitTest_sc_xcellrangesquery.mk
+++ /dev/null
@@ -1,141 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#*************************************************************************
-# 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.
-#
-# The Initial Developer of the Original Code is
-#       Markus Mohrhard <markus.mohrhard at googlemail.com>
-# Portions created by the Initial Developer are Copyright (C) 2011 the
-# Initial Developer. All Rights Reserved.
-#
-# Major Contributor(s):
-#
-# 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.
-#*************************************************************************
-
-$(eval $(call gb_CppunitTest_CppunitTest,sc_xcellrangesquery))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,sc_xcellrangesquery, \
-    sc/qa/extras/xcellrangesquery \
-))
-
-$(eval $(call gb_CppunitTest_add_linked_libs,sc_xcellrangesquery, \
-    avmedia \
-    basegfx \
-    comphelper \
-    cppu \
-    cppuhelper \
-    drawinglayer \
-    editeng \
-    fileacc \
-    for \
-    forui \
-    i18nisolang1 \
-    msfilter \
-    oox \
-    sal \
-    salhelper \
-    sax \
-    sb \
-    sc \
-    sfx \
-    sot \
-    svl \
-    svt \
-    svx \
-    svxcore \
-	test \
-    tl \
-    tk \
-    ucbhelper \
-	unotest \
-    utl \
-    vbahelper \
-    vcl \
-    xo \
-	$(gb_STDLIBS) \
-))
-
-$(eval $(call gb_CppunitTest_set_include,sc_xcellrangesquery,\
-    -I$(realpath $(SRCDIR)/sc/source/ui/inc) \
-    -I$(realpath $(SRCDIR)/sc/inc) \
-    $$(INCLUDE) \
-    -I$(OUTDIR)/inc \
-))
-
-$(eval $(call gb_CppunitTest_add_api,sc_xcellrangesquery,\
-    offapi \
-    udkapi \
-))
-
-$(eval $(call gb_CppunitTest_uses_ure,sc_xcellrangesquery))
-
-$(eval $(call gb_CppunitTest_add_type_rdbs,sc_xcellrangesquery,\
-    types \
-))
-
-$(eval $(call gb_CppunitTest_add_components,sc_xcellrangesquery,\
-    basic/util/sb \
-    comphelper/util/comphelp \
-    dbaccess/util/dba \
-    fileaccess/source/fileacc \
-    filter/source/config/cache/filterconfig1 \
-    forms/util/frm \
-    framework/util/fwk \
-    i18npool/util/i18npool \
-    oox/util/oox \
-    package/source/xstor/xstor \
-    package/util/package2 \
-    sax/source/expatwrap/expwrap \
-    sax/source/fastparser/fastsax \
-    sc/util/sc \
-    sc/util/scd \
-    sc/util/scfilt \
-    sc/util/vbaobj \
-    scripting/source/basprov/basprov \
-    scripting/util/scriptframe \
-    sfx2/util/sfx \
-    sot/util/sot \
-    svl/source/fsstor/fsstorage \
-    toolkit/util/tk \
-    unotools/util/utl \
-    unoxml/source/rdf/unordf \
-    unoxml/source/service/unoxml \
-))
-
-$(eval $(call gb_CppunitTest_add_old_components,sc_xcellrangesquery,\
-    configmgr \
-    ucb1 \
-    ucpfile1 \
-    ucptdoc1 \
-))
-
-$(eval $(call gb_CppunitTest_set_args,sc_xcellrangesquery,\
-    --headless \
-    --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \
-    "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry) module:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry/spool) xcsxcu:$(call gb_CppunitTarget__make_url,$(SRCDIR)/sc/qa/unit/data/registry)" \
-))
-    # .../spool is required for the (somewhat strange) filter configuration
-
-# we need to
-# a) explicitly depend on library msword because it is not implied by a link
-#    relation
-# b) explicitly depend on the sc resource files needed at unit-test runtime
-$(call gb_CppunitTest_get_target,sc_xcellrangesquery) : $(call gb_Library_get_target,scfilt) $(WORKDIR)/AllLangRes/sc
-
-# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index c39589b..9c8696b 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -41,7 +41,7 @@ $(eval $(call gb_Module_add_check_targets,sc,\
 
 $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
     CppunitTest_sc_macros_test \
-    CppunitTest_sc_xcellrangesquery \
+    CppunitTest_sc_cellrangesbase \
     CppunitTest_sc_subsequent_filters_test \
     CppunitTest_sc_tableautoformatfield \
     JunitTest_sc_complex \
diff --git a/sc/qa/extras/xcellrangesquery.cxx b/sc/qa/extras/xcellrangesquery.cxx
index 5df4f71..dc9b777 100644
--- a/sc/qa/extras/xcellrangesquery.cxx
+++ b/sc/qa/extras/xcellrangesquery.cxx
@@ -38,7 +38,7 @@
 using namespace com::sun::star;
 
 
-namespace ScCellRangeObj {
+namespace ScCellRangeBase {
 
 class ScXCellRangesQuery : public UnoApiTest
 {
commit d96ef98abe2dfd91918d84efbbf9119c44dce4d3
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Dec 5 00:03:26 2011 +0100

    add subsequent test for failing test TableAutoFormatField
    
    tests are still disabled but problem is related to
    7da57d17b6179e71c8b6d7549ad89eaf3a4a28c6

diff --git a/sc/CppunitTest_sc_tableautoformatfield.mk b/sc/CppunitTest_sc_tableautoformatfield.mk
new file mode 100644
index 0000000..7178929
--- /dev/null
+++ b/sc/CppunitTest_sc_tableautoformatfield.mk
@@ -0,0 +1,141 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+# 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.
+#
+# The Initial Developer of the Original Code is
+#       Markus Mohrhard <markus.mohrhard at googlemail.com>
+# Portions created by the Initial Developer are Copyright (C) 2011 the
+# Initial Developer. All Rights Reserved.
+#
+# Major Contributor(s):
+#
+# 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.
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sc_tableautoformatfield))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_tableautoformatfield, \
+    sc/qa/extras/tableautoformatfield \
+))
+
+$(eval $(call gb_CppunitTest_add_linked_libs,sc_tableautoformatfield, \
+    avmedia \
+    basegfx \
+    comphelper \
+    cppu \
+    cppuhelper \
+    drawinglayer \
+    editeng \
+    fileacc \
+    for \
+    forui \
+    i18nisolang1 \
+    msfilter \
+    oox \
+    sal \
+    salhelper \
+    sax \
+    sb \
+    sc \
+    sfx \
+    sot \
+    svl \
+    svt \
+    svx \
+    svxcore \
+	test \
+    tl \
+    tk \
+    ucbhelper \
+	unotest \
+    utl \
+    vbahelper \
+    vcl \
+    xo \
+	$(gb_STDLIBS) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_tableautoformatfield,\
+    -I$(realpath $(SRCDIR)/sc/source/ui/inc) \
+    -I$(realpath $(SRCDIR)/sc/inc) \
+    $$(INCLUDE) \
+    -I$(OUTDIR)/inc \
+))
+
+$(eval $(call gb_CppunitTest_add_api,sc_tableautoformatfield,\
+    offapi \
+    udkapi \
+))
+
+$(eval $(call gb_CppunitTest_uses_ure,sc_tableautoformatfield))
+
+$(eval $(call gb_CppunitTest_add_type_rdbs,sc_tableautoformatfield,\
+    types \
+))
+
+$(eval $(call gb_CppunitTest_add_components,sc_tableautoformatfield,\
+    basic/util/sb \
+    comphelper/util/comphelp \
+    dbaccess/util/dba \
+    fileaccess/source/fileacc \
+    filter/source/config/cache/filterconfig1 \
+    forms/util/frm \
+    framework/util/fwk \
+    i18npool/util/i18npool \
+    oox/util/oox \
+    package/source/xstor/xstor \
+    package/util/package2 \
+    sax/source/expatwrap/expwrap \
+    sax/source/fastparser/fastsax \
+    sc/util/sc \
+    sc/util/scd \
+    sc/util/scfilt \
+    sc/util/vbaobj \
+    scripting/source/basprov/basprov \
+    scripting/util/scriptframe \
+    sfx2/util/sfx \
+    sot/util/sot \
+    svl/source/fsstor/fsstorage \
+    toolkit/util/tk \
+    unotools/util/utl \
+    unoxml/source/rdf/unordf \
+    unoxml/source/service/unoxml \
+))
+
+$(eval $(call gb_CppunitTest_add_old_components,sc_tableautoformatfield,\
+    configmgr \
+    ucb1 \
+    ucpfile1 \
+    ucptdoc1 \
+))
+
+$(eval $(call gb_CppunitTest_set_args,sc_tableautoformatfield,\
+    --headless \
+    --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \
+    "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry) module:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry/spool) xcsxcu:$(call gb_CppunitTarget__make_url,$(SRCDIR)/sc/qa/unit/data/registry)" \
+))
+    # .../spool is required for the (somewhat strange) filter configuration
+
+# we need to
+# a) explicitly depend on library msword because it is not implied by a link
+#    relation
+# b) explicitly depend on the sc resource files needed at unit-test runtime
+$(call gb_CppunitTest_get_target,sc_tableautoformatfield) : $(call gb_Library_get_target,scfilt) $(WORKDIR)/AllLangRes/sc
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 1cbbc72..c39589b 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -43,6 +43,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
     CppunitTest_sc_macros_test \
     CppunitTest_sc_xcellrangesquery \
     CppunitTest_sc_subsequent_filters_test \
+    CppunitTest_sc_tableautoformatfield \
     JunitTest_sc_complex \
     JunitTest_sc_unoapi \
 ))
diff --git a/sc/qa/extras/tableautoformatfield.cxx b/sc/qa/extras/tableautoformatfield.cxx
new file mode 100644
index 0000000..c405c2e
--- /dev/null
+++ b/sc/qa/extras/tableautoformatfield.cxx
@@ -0,0 +1,107 @@
+/* -*- 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) 2011 Markus Mohrhard <markus.mohrhard at googlemail.com> (initial developer)
+ *
+ * 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 <test/unoapi_test.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/table/CellVertJustify.hpp>
+
+#include <iostream>
+
+namespace ScAutoFormatFieldObj {
+
+class ScTableAutoFormatField : public UnoApiTest
+{
+public:
+
+    uno::Reference< beans::XPropertySet > init();    void testRotateReference();
+    void testVertJustify();
+
+    CPPUNIT_TEST_SUITE(ScTableAutoFormatField);
+    // both tests are broken
+    // related to: 7da57d17b6179e71c8b6d7549ad89eaf3a4a28c6
+    //CPPUNIT_TEST(testRotateReference);
+    //CPPUNIT_TEST(testVertJustify);
+    CPPUNIT_TEST_SUITE_END();
+
+};
+
+uno::Reference< beans::XPropertySet > ScTableAutoFormatField::init()
+{
+    uno::Reference< container::XIndexAccess > xAutoFormatFields( m_xSFactory->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.TableAutoFormats"))), UNO_QUERY_THROW );
+    CPPUNIT_ASSERT(xAutoFormatFields.is());
+    uno::Reference< container::XIndexAccess > xIndex( xAutoFormatFields->getByIndex(0), UNO_QUERY_THROW );
+    CPPUNIT_ASSERT(xIndex.is());
+    uno::Reference< beans::XPropertySet > xReturn( xIndex->getByIndex(0), UNO_QUERY_THROW );
+    CPPUNIT_ASSERT_MESSAGE("could not create table auto formats", xReturn.is());
+    return xReturn;
+}
+
+void ScTableAutoFormatField::testRotateReference()
+{
+    uno::Reference< beans::XPropertySet > xTableAutoFormatField = init();
+    rtl::OUString aRotateReference(RTL_CONSTASCII_USTRINGPARAM("RotateReference"));
+    uno::Any aOldRotateReference = xTableAutoFormatField->getPropertyValue(aRotateReference);
+    sal_Int32 aValue;
+    CPPUNIT_ASSERT(aOldRotateReference >>= aValue);
+    std::cout << "Old RotateReferene Value: " << aValue << std::endl;
+
+    uno::Any aNewRotateReference;
+    aNewRotateReference <<= table::CellVertJustify_BOTTOM;
+    xTableAutoFormatField->setPropertyValue(aRotateReference, aNewRotateReference);
+    uno::Any aRotateReferenceControllValue = xTableAutoFormatField->getPropertyValue(aRotateReference);
+    CPPUNIT_ASSERT(aRotateReferenceControllValue >>= aValue);
+    std::cout << "New VertJustify value: " << aValue << std::endl;
+    CPPUNIT_ASSERT_MESSAGE("value has not been changed", aValue == table::CellVertJustify_BOTTOM);
+}
+
+void ScTableAutoFormatField::testVertJustify()
+{
+    uno::Reference< beans::XPropertySet > xTableAutoFormatField = init();
+    rtl::OUString aVertJustify(RTL_CONSTASCII_USTRINGPARAM("VertJustify"));
+    uno::Any aOldVertJustify = xTableAutoFormatField->getPropertyValue(aVertJustify);
+    sal_Int32 aValue;
+    CPPUNIT_ASSERT(aOldVertJustify >>= aValue);
+    std::cout << "Old VertJustify value: " << aValue << std::endl;
+
+    uno::Any aNewVertJustify;
+    aNewVertJustify <<= table::CellVertJustify_BOTTOM;
+    xTableAutoFormatField->setPropertyValue(aVertJustify, aNewVertJustify);
+    uno::Any aVertJustifyControllValue = xTableAutoFormatField->getPropertyValue(aVertJustify);
+    CPPUNIT_ASSERT(aVertJustifyControllValue >>= aValue);
+    std::cout << "New VertJustify value: " << aValue << std::endl;
+    CPPUNIT_ASSERT_MESSAGE("value has not been changed", aValue == table::CellVertJustify_BOTTOM);
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScTableAutoFormatField);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit f384caf0a8d137166cdc5d24c8577ae24bb93409
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Dec 4 19:16:30 2011 +0100

    don't show the warning message if the name is correct

diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx
index 03b61a7..a485986 100644
--- a/sc/source/ui/namedlg/namedlg.cxx
+++ b/sc/source/ui/namedlg/namedlg.cxx
@@ -404,6 +404,10 @@ void ScNameDlg::NameModified()
         if (!IsNameValid())
             return;
     }
+    else
+    {
+        maFtInfo.SetText( maStrInfoDefault );
+    }
 
     if (!IsFormulaValid())
     {
commit b7b927e5b4d76f4edb9e1c7f115dfbf5a2eae48f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Dec 4 19:06:54 2011 +0100

    ManageNames: set the color of the info text field for warnings

diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx
index b373a1b..f57bd82 100644
--- a/sc/source/ui/namedlg/namedefdlg.cxx
+++ b/sc/source/ui/namedlg/namedefdlg.cxx
@@ -164,14 +164,17 @@ bool ScNameDefDlg::IsNameValid()
         pRangeName = maRangeMap.find(aScope)->second;
     }
 
+    maFtInfo.SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor());
     if (!ScRangeData::IsNameValid( aName, mpDoc ))
     {
+        maFtInfo.SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor());
         maFtInfo.SetText(maErrInvalidNameStr);
         maBtnAdd.Disable();
         return false;
     }
     else if (pRangeName->findByUpperName(ScGlobal::pCharClass->upper(aName)))
     {
+        maFtInfo.SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor());
         maFtInfo.SetText(maErrNameInUse);
         maBtnAdd.Disable();
         return false;
@@ -179,6 +182,7 @@ bool ScNameDefDlg::IsNameValid()
 
     if (!IsFormulaValid())
     {
+        maFtInfo.SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor());
         maBtnAdd.Disable();
         return false;
     }
diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx
index a3a2714..03b61a7 100644
--- a/sc/source/ui/namedlg/namedlg.cxx
+++ b/sc/source/ui/namedlg/namedlg.cxx
@@ -142,7 +142,7 @@ void ScNameDlg::Init()
     OSL_ENSURE( mpViewData && mpDoc, "ViewData oder Document nicht gefunden!" );
 
     //init UI
-
+    maFtInfo.SetStyle(WB_VCENTER);
 
     mpRangeManagerTable = new ScRangeManagerTable(&maNameMgrCtrl, maRangeMap);
     mpRangeManagerTable->SetSelectHdl( LINK( this, ScNameDlg, SelectionChangedHdl_Impl ) );
@@ -288,17 +288,16 @@ bool ScNameDlg::IsNameValid()
 
     if (!ScRangeData::IsNameValid( aName, mpDoc ))
     {
-        maEdName.SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor());
+        maFtInfo.SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor());
         maFtInfo.SetText(maErrInvalidNameStr);
         return false;
     }
     else if (pRangeName && pRangeName->findByUpperName(ScGlobal::pCharClass->upper(aName)))
     {
-        maEdName.SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor());
+        maFtInfo.SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor());
         maFtInfo.SetText(maErrNameInUse);
         return false;
     }
-    maEdName.SetControlBackground(GetSettings().GetStyleSettings().GetFieldColor());
     maFtInfo.SetText( maStrInfoDefault );
     return true;
 }
@@ -310,6 +309,7 @@ bool ScNameDlg::IsFormulaValid()
     ScTokenArray* pCode = aComp.CompileString(maEdAssign.GetText());
     if (pCode->GetCodeError())
     {
+        maFtInfo.SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor());
         delete pCode;
         return false;
     }
@@ -393,23 +393,24 @@ void ScNameDlg::RemovePushed()
 
 void ScNameDlg::NameModified()
 {
-    if (!IsFormulaValid())
-    {
-        //TODO: implement an info text
-        return;
-    }
-
     ScRangeNameLine aLine;
     mpRangeManagerTable->GetCurrentLine(aLine);
     rtl::OUString aOldName = aLine.aName;
     rtl::OUString aNewName = maEdName.GetText();
     aNewName = aNewName.trim();
+    maFtInfo.SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor());
     if (aNewName != aOldName)
     {
         if (!IsNameValid())
             return;
     }
 
+    if (!IsFormulaValid())
+    {
+        //TODO: implement an info text
+        return;
+    }
+
     rtl::OUString aOldScope = aLine.aScope;
     //empty table
     if (aOldScope.isEmpty())
diff --git a/sc/source/ui/src/namedlg.src b/sc/source/ui/src/namedlg.src
index 077a7cb..3e2eb42 100644
--- a/sc/source/ui/src/namedlg.src
+++ b/sc/source/ui/src/namedlg.src
@@ -171,8 +171,8 @@ ModelessDialog RID_SCDLG_NAMES
 
     FixedText FT_INFO
     {
-        Pos = MAP_APPFONT( 5, 127 );
-        Size = MAP_APPFONT( 210, 15 );
+        Pos = MAP_APPFONT( 5, 125 );
+        Size = MAP_APPFONT( 210, 12 );
         TabStop = FALSE;
     };
 
commit 82a548061fcef9eff61c3a23570607db286715b5
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Dec 3 23:42:42 2011 +0100

    missing check for cell import

diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 8fd3de4..3f837a9 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1106,7 +1106,7 @@ void ScXMLTableRowCellContext::EndElement()
                                     pNewCell = new ScFormulaCell( pDoc, aScAddress, pCode, eGrammar, MM_NONE );
                                     delete pCode;
                                 }
-                                else if ( aText[0] == '\'' )
+                                else if ( aText[0] == '\'' && aText.getLength() > 1 )
                                 {
                                     //  for bEnglish, "'" at the beginning is always interpreted as text
                                     //  marker and stripped


More information about the Libreoffice-commits mailing list