diff options
-rw-r--r-- | include/test/sheet/spreadsheetdocumentsettings.hxx | 34 | ||||
-rw-r--r-- | qadevOOo/Jar_OOoRunner.mk | 1 | ||||
-rw-r--r-- | qadevOOo/objdsc/sc/com.sun.star.comp.office.ScModelObj.csv | 18 | ||||
-rw-r--r-- | qadevOOo/objdsc/sc/com.sun.star.comp.office.ScSpreadsheetSettingsObj.csv | 18 | ||||
-rw-r--r-- | qadevOOo/tests/java/ifc/sheet/_SpreadsheetDocumentSettings.java | 141 | ||||
-rw-r--r-- | sc/CppunitTest_sc_spreadsheetsettingsobj.mk | 72 | ||||
-rw-r--r-- | sc/Module_sc.mk | 1 | ||||
-rw-r--r-- | sc/qa/extras/scmodelobj.cxx | 10 | ||||
-rw-r--r-- | sc/qa/extras/scspreadsheetsettingsobj.cxx | 78 | ||||
-rw-r--r-- | test/Library_subsequenttest.mk | 1 | ||||
-rw-r--r-- | test/source/sheet/spreadsheetdocumentsettings.cxx | 190 |
11 files changed, 384 insertions, 180 deletions
diff --git a/include/test/sheet/spreadsheetdocumentsettings.hxx b/include/test/sheet/spreadsheetdocumentsettings.hxx new file mode 100644 index 000000000000..1385541576c6 --- /dev/null +++ b/include/test/sheet/spreadsheetdocumentsettings.hxx @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_TEST_SHEET_SPREADSHEETDOCUMENTSETTINGS_HXX +#define INCLUDED_TEST_SHEET_SPREADSHEETDOCUMENTSETTINGS_HXX + +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <test/testdllapi.hxx> + +namespace apitest +{ +class OOO_DLLPUBLIC_TEST SpreadsheetDocumentSettings +{ +public: + virtual css::uno::Reference<css::uno::XInterface> init() = 0; + + void testSpreadsheetDocumentSettingsProperties(); + +protected: + ~SpreadsheetDocumentSettings() {} +}; +} + +#endif // INCLUDED_TEST_SHEET_SPREADSHEETDOCUMENTSETTINGS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk index 26231e68ee5a..a4c1b2d0105f 100644 --- a/qadevOOo/Jar_OOoRunner.mk +++ b/qadevOOo/Jar_OOoRunner.mk @@ -566,7 +566,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\ qadevOOo/tests/java/ifc/sheet/_FunctionDescription \ qadevOOo/tests/java/ifc/sheet/_SheetSortDescriptor \ qadevOOo/tests/java/ifc/sheet/_SpreadsheetDocument \ - qadevOOo/tests/java/ifc/sheet/_SpreadsheetDocumentSettings \ qadevOOo/tests/java/ifc/sheet/_TableAutoFormatField \ qadevOOo/tests/java/ifc/sheet/_XActivationBroadcaster \ qadevOOo/tests/java/ifc/sheet/_XArrayFormulaRange \ diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScModelObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScModelObj.csv index 69b54496331b..a1f591442897 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScModelObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScModelObj.csv @@ -52,24 +52,6 @@ "ScModelObj";"com::sun::star::sheet::SpreadsheetDocument";"SheetLinks" "ScModelObj";"com::sun::star::sheet::SpreadsheetDocument";"AreaLinks" "ScModelObj";"com::sun::star::sheet::SpreadsheetDocument";"DDELinks" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"IsIterationEnabled" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"IterationCount" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"IterationEpsilon" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"StandardDecimals" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"NullDate" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"DefaultTabStop" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"IgnoreCase" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"CalcAsShown" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"MatchWholeCell" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"SpellOnline" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"LookUpLabels" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"RegularExpressions" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"ForbiddenCharacters#optional" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"HasDrawPages#optional" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"CharLocale#optional" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"CharLocaleAsian#optional" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"CharLocaleComplex#optional" -"ScModelObj";"com::sun::star::sheet::SpreadsheetDocumentSettings#optional";"Wildcards#optional" "ScModelObj";"com::sun::star::document::OfficeDocument";"AutomaticControlFocus#optional" "ScModelObj";"com::sun::star::document::OfficeDocument";"ApplyFormDesignMode#optional" "ScModelObj";"com::sun::star::document::OfficeDocument";"RuntimeUID#optional" diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScSpreadsheetSettingsObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScSpreadsheetSettingsObj.csv index 2d15f48c3a7b..7a473c2de4b9 100644 --- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScSpreadsheetSettingsObj.csv +++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScSpreadsheetSettingsObj.csv @@ -5,21 +5,3 @@ "ScSpreadsheetSettingsObj";"com::sun::star::beans::XPropertySet";"removePropertyChangeListener()" "ScSpreadsheetSettingsObj";"com::sun::star::beans::XPropertySet";"addVetoableChangeListener()" "ScSpreadsheetSettingsObj";"com::sun::star::beans::XPropertySet";"removeVetoableChangeListener()" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"IsIterationEnabled" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"IterationCount" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"IterationEpsilon" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"StandardDecimals" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"NullDate" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"DefaultTabStop" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"IgnoreCase" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"CalcAsShown" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"MatchWholeCell" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"SpellOnline" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"LookUpLabels" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"RegularExpressions" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"ForbiddenCharacters#optional" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"HasDrawPages#optional" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"CharLocale#optional" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"CharLocaleAsian#optional" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"CharLocaleComplex#optional" -"ScSpreadsheetSettingsObj";"com::sun::star::sheet::SpreadsheetDocumentSettings";"Wildcards#optional" diff --git a/qadevOOo/tests/java/ifc/sheet/_SpreadsheetDocumentSettings.java b/qadevOOo/tests/java/ifc/sheet/_SpreadsheetDocumentSettings.java deleted file mode 100644 index 8a00babb9c85..000000000000 --- a/qadevOOo/tests/java/ifc/sheet/_SpreadsheetDocumentSettings.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -package ifc.sheet; - -import lib.MultiPropertyTest; - -import com.sun.star.i18n.ForbiddenCharacters; -import com.sun.star.i18n.XForbiddenCharacters; -import com.sun.star.lang.Locale; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.util.Date; - - -/** -* Testing <code>com.sun.star.sheet.SpreadsheetDocumentSettings</code> -* service properties : -* <ul> -* <li><code> IsIterationEnabled</code></li> -* <li><code> IterationCount</code></li> -* <li><code> IterationEpsilon</code></li> -* <li><code> StandardDecimals</code></li> -* <li><code> NullDate</code></li> -* <li><code> DefaultTabStop</code></li> -* <li><code> IgnoreCase</code></li> -* <li><code> CalcAsShown</code></li> -* <li><code> MatchWholeCell</code></li> -* <li><code> SpellOnline</code></li> -* <li><code> LookUpLabels</code></li> -* <li><code> RegularExpressions</code></li> -* <li><code> ForbiddenCharacters</code></li> -* <li><code> HasDrawPages</code></li> -* <li><code> Wildcards</code></li> -* </ul> <p> -* Properties testing is automated by <code>lib.MultiPropertyTest</code>. -* @see com.sun.star.sheet.SpreadsheetDocumentSettings -*/ -public class _SpreadsheetDocumentSettings extends MultiPropertyTest { - /** - *This class is destined to custom test of property <code>NullDate</code>. - */ - protected PropertyTester DateTester = new PropertyTester() { - @Override - protected Object getNewValue(String propName, Object oldValue) { - Date date = (Date) oldValue; - Date newDate = new Date((short) (date.Day - 1), date.Month, - date.Year); - - return newDate; - } - }; - - /** - *This class is destined to custom test of property <code>ForbiddenCharacters</code>. - */ - protected PropertyTester ChrTester = new PropertyTester() { - @Override - protected Object getNewValue(String propName, Object oldValue) { - return new ForbiddenChrTest(); - } - - @Override - protected boolean compare(Object obj1, Object obj2) { - Locale loc = new Locale("ru", "RU", ""); - XForbiddenCharacters fc1 = UnoRuntime.queryInterface( - XForbiddenCharacters.class, - obj1); - XForbiddenCharacters fc2 = UnoRuntime.queryInterface( - XForbiddenCharacters.class, - obj2); - boolean has1 = fc1.hasForbiddenCharacters(loc); - boolean has2 = fc2.hasForbiddenCharacters(loc); - - return has1 == has2; - } - }; - - /** - * Test property <code>NullDate</code> using custom <code>PropertyTest</code>. - */ - public void _NullDate() { - testProperty("NullDate", DateTester); - } - - /** - * Test property <code>ForbiddenCharacters</code> using custom <code>PropertyTest</code>. - */ - public void _ForbiddenCharacters() { - testProperty("ForbiddenCharacters", ChrTester); - } - - /** - * Class implements interface <code>XForbiddenCharacters</code>. - * It's destined to custom test of property <code>ForbiddenCharacters</code>. - * Feature of the class that it supports forbidden characters - * for russian locale. - * @see com.sun.star.i18n.XForbiddenCharacters - */ - protected static class ForbiddenChrTest implements XForbiddenCharacters { - protected Locale locale = new Locale("ru", "RU", ""); - protected ForbiddenCharacters chrs = new ForbiddenCharacters("q", "w"); - - public ForbiddenCharacters getForbiddenCharacters(Locale rLocale) - throws com.sun.star.container.NoSuchElementException { - if (rLocale.Country.equals(locale.Country) && - rLocale.Language.equals(locale.Language) && - rLocale.Variant.equals(locale.Variant)) { - return chrs; - } - - throw new com.sun.star.container.NoSuchElementException(); - } - - public void setForbiddenCharacters(Locale rLocale, - ForbiddenCharacters rForbiddenCharacters) { - } - - public void removeForbiddenCharacters(Locale rLocale) { - } - - public boolean hasForbiddenCharacters(Locale rLocale) { - return rLocale.Country.equals(locale.Country) && - rLocale.Language.equals(locale.Language) && - rLocale.Variant.equals(locale.Variant); - } - } -} diff --git a/sc/CppunitTest_sc_spreadsheetsettingsobj.mk b/sc/CppunitTest_sc_spreadsheetsettingsobj.mk new file mode 100644 index 000000000000..f39201002bb3 --- /dev/null +++ b/sc/CppunitTest_sc_spreadsheetsettingsobj.mk @@ -0,0 +1,72 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +#************************************************************************* +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +#************************************************************************* + +$(eval $(call gb_CppunitTest_CppunitTest,sc_spreadsheetsettingsobj)) + +$(eval $(call gb_CppunitTest_use_external,sc_spreadsheetsettingsobj,boost_headers)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sc_spreadsheetsettingsobj, \ + sc/qa/extras/scspreadsheetsettingsobj \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,sc_spreadsheetsettingsobj, \ + basegfx \ + comphelper \ + cppu \ + cppuhelper \ + drawinglayer \ + editeng \ + for \ + forui \ + i18nlangtag \ + msfilter \ + oox \ + sal \ + salhelper \ + sax \ + sb \ + sc \ + sfx \ + sot \ + subsequenttest \ + svl \ + svt \ + svx \ + svxcore \ + test \ + tk \ + tl \ + ucbhelper \ + unotest \ + utl \ + vbahelper \ + vcl \ + xo \ +)) + +$(eval $(call gb_CppunitTest_set_include,sc_spreadsheetsettingsobj,\ + -I$(SRCDIR)/sc/source/ui/inc \ + -I$(SRCDIR)/sc/inc \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_CppunitTest_use_sdk_api,sc_spreadsheetsettingsobj)) + +$(eval $(call gb_CppunitTest_use_ure,sc_spreadsheetsettingsobj)) +$(eval $(call gb_CppunitTest_use_vcl,sc_spreadsheetsettingsobj)) + +$(eval $(call gb_CppunitTest_use_components,sc_spreadsheetsettingsobj,\ + $(sc_unoapi_common_components) \ +)) + +$(eval $(call gb_CppunitTest_use_configuration,sc_spreadsheetsettingsobj)) + +# vim: set noet sw=4 ts=4: diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index 6e3a5090d71b..68537c5d7d2e 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -156,6 +156,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\ CppunitTest_sc_spreadsheetsettings \ CppunitTest_sc_shapeobj \ CppunitTest_sc_sheetlinkobj \ + CppunitTest_sc_spreadsheetsettingsobj \ )) $(eval $(call gb_Module_add_perfcheck_targets,sc,\ diff --git a/sc/qa/extras/scmodelobj.cxx b/sc/qa/extras/scmodelobj.cxx index 0b1e9c8118b3..9e57c88b0add 100644 --- a/sc/qa/extras/scmodelobj.cxx +++ b/sc/qa/extras/scmodelobj.cxx @@ -8,6 +8,7 @@ */ #include <test/unoapi_test.hxx> +#include <test/sheet/spreadsheetdocumentsettings.hxx> #include <test/sheet/xconsolidatable.hxx> #include <test/sheet/xgoalseek.hxx> @@ -21,8 +22,10 @@ using namespace css::uno; namespace sc_apitest { -class ScModelObj : public UnoApiTest, public apitest::XConsolidatable, - public apitest::XGoalSeek +class ScModelObj : public UnoApiTest, + public apitest::SpreadsheetDocumentSettings, + public apitest::XConsolidatable, + public apitest::XGoalSeek { public: virtual void setUp() override; @@ -34,6 +37,9 @@ public: CPPUNIT_TEST_SUITE(ScModelObj); + // SpreadsheetDocumentSettings + CPPUNIT_TEST(testSpreadsheetDocumentSettingsProperties); + // XConsolidatable CPPUNIT_TEST(testCreateConsolidationDescriptor); CPPUNIT_TEST(testConsolidate); diff --git a/sc/qa/extras/scspreadsheetsettingsobj.cxx b/sc/qa/extras/scspreadsheetsettingsobj.cxx new file mode 100644 index 000000000000..f19e0b1d8297 --- /dev/null +++ b/sc/qa/extras/scspreadsheetsettingsobj.cxx @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <test/calc_unoapi_test.hxx> +#include <test/sheet/spreadsheetdocumentsettings.hxx> + +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/uno/XInterface.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +using namespace css; +using namespace css::uno; +using namespace com::sun::star; + +namespace sc_apitest +{ +class ScSpreadsheetSettingsobj : public CalcUnoApiTest, public apitest::SpreadsheetDocumentSettings +{ +public: + ScSpreadsheetSettingsobj(); + + virtual uno::Reference<uno::XInterface> init() override; + virtual void setUp() override; + virtual void tearDown() override; + + CPPUNIT_TEST_SUITE(ScSpreadsheetSettingsobj); + + // GlobalSheetSettingsobj + CPPUNIT_TEST(testSpreadsheetDocumentSettingsProperties); + + CPPUNIT_TEST_SUITE_END(); + +private: + uno::Reference<lang::XComponent> mxComponent; +}; + +ScSpreadsheetSettingsobj::ScSpreadsheetSettingsobj() + : CalcUnoApiTest("/sc/qa/extras/testdocuments") +{ +} + +uno::Reference<uno::XInterface> ScSpreadsheetSettingsobj::init() +{ + uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is()); + + return xDoc; +} + +void ScSpreadsheetSettingsobj::setUp() +{ + CalcUnoApiTest::setUp(); + // create a calc document + mxComponent = loadFromDesktop("private:factory/scalc"); +} + +void ScSpreadsheetSettingsobj::tearDown() +{ + closeDocument(mxComponent); + CalcUnoApiTest::tearDown(); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(ScSpreadsheetSettingsobj); + +} // end namespace + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk index ce88ef80a817..ff608b0d389b 100644 --- a/test/Library_subsequenttest.mk +++ b/test/Library_subsequenttest.mk @@ -56,6 +56,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\ test/source/sheet/documentsettings \ test/source/sheet/globalsheetsettings \ test/source/sheet/scenario \ + test/source/sheet/spreadsheetdocumentsettings \ test/source/sheet/spreadsheetviewsettings \ test/source/sheet/subtotaldescriptor \ test/source/sheet/shape \ diff --git a/test/source/sheet/spreadsheetdocumentsettings.cxx b/test/source/sheet/spreadsheetdocumentsettings.cxx new file mode 100644 index 000000000000..c57c5b911fe3 --- /dev/null +++ b/test/source/sheet/spreadsheetdocumentsettings.cxx @@ -0,0 +1,190 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <unoapi_property_testers.hxx> +#include <test/sheet/spreadsheetdocumentsettings.hxx> + +#include <com/sun/star/awt/XDevice.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/i18n/XForbiddenCharacters.hpp> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/extensions/HelperMacros.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void SpreadsheetDocumentSettings::testSpreadsheetDocumentSettingsProperties() +{ + uno::Reference<beans::XPropertySet> xSpreadsheetDocumentSettings(init(), UNO_QUERY_THROW); + OUString propName; + uno::Any aNewValue; + + propName = "IsIterationEnabled"; + testBooleanProperty(xSpreadsheetDocumentSettings, propName); + + propName = "IterationCount"; + testLongProperty(xSpreadsheetDocumentSettings, propName); + + propName = "IterationEpsilon"; + testDoubleProperty(xSpreadsheetDocumentSettings, propName); + + propName = "StandardDecimals"; + testShortProperty(xSpreadsheetDocumentSettings, propName); + + propName = "NullDate"; + util::Date aNullDateGet; + util::Date aNullDateSet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue: NullDate", + xSpreadsheetDocumentSettings->getPropertyValue(propName) + >>= aNullDateGet); + + aNewValue <<= util::Date(1, 1, 2000); + xSpreadsheetDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetDocumentSettings->getPropertyValue(propName) >>= aNullDateSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unabel to set PropertyValue: NullDate", sal_Int16(2000), + aNullDateSet.Year); + + propName = "DefaultTabStop"; + testShortProperty(xSpreadsheetDocumentSettings, propName); + + propName = "IgnoreCase"; + testBooleanProperty(xSpreadsheetDocumentSettings, propName); + + propName = "CalcAsShown"; + testBooleanProperty(xSpreadsheetDocumentSettings, propName); + + propName = "MatchWholeCell"; + testBooleanProperty(xSpreadsheetDocumentSettings, propName); + + propName = "SpellOnline"; + testBooleanProperty(xSpreadsheetDocumentSettings, propName); + + propName = "LookUpLabels"; + testBooleanProperty(xSpreadsheetDocumentSettings, propName); + + propName = "RegularExpressions"; + testBooleanProperty(xSpreadsheetDocumentSettings, propName); + + propName = "ForbiddenCharacters"; + uno::Reference<i18n::XForbiddenCharacters> xForbiddenCharactersGet; + uno::Reference<i18n::XForbiddenCharacters> xForbiddenCharactersSet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue: ForbiddenCharacters", + xSpreadsheetDocumentSettings->getPropertyValue(propName) + >>= xForbiddenCharactersGet); + + lang::Locale aForbiddenCharactersLocale; + aForbiddenCharactersLocale.Language = "ru"; + aForbiddenCharactersLocale.Country = "RU"; + + uno::Reference<i18n::XForbiddenCharacters> xForbiddenCharactersNew; + aNewValue <<= xForbiddenCharactersNew; + xSpreadsheetDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetDocumentSettings->getPropertyValue(propName) + >>= xForbiddenCharactersSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Able to set PropertyValue: ForbiddenCharacters", + xForbiddenCharactersGet->hasForbiddenCharacters(aForbiddenCharactersLocale), + xForbiddenCharactersSet->hasForbiddenCharacters(aForbiddenCharactersLocale)); + + propName = "HasDrawPages"; + testBooleanReadonlyProperty(xSpreadsheetDocumentSettings, propName); + + propName = "CharLocale"; + lang::Locale aCharLocaleGet; + lang::Locale aCharLocaleSet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue: CharLocale", + xSpreadsheetDocumentSettings->getPropertyValue(propName) + >>= aCharLocaleGet); + + lang::Locale aCharLocaleNew; + aCharLocaleNew.Language = "en"; + aCharLocaleNew.Country = "CA"; + aNewValue <<= aCharLocaleNew; + xSpreadsheetDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetDocumentSettings->getPropertyValue(propName) >>= aCharLocaleSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue: CharLocale", aCharLocaleNew.Country, + aCharLocaleSet.Country); + + propName = "CharLocaleAsian"; + lang::Locale aCharLocaleAsianGet; + lang::Locale aCharLocaleAsianSet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue: CharLocaleAsian", + xSpreadsheetDocumentSettings->getPropertyValue(propName) + >>= aCharLocaleAsianGet); + + lang::Locale aCharLocaleAsianNew; + aCharLocaleAsianNew.Language = "en"; + aCharLocaleAsianNew.Country = "CA"; + aNewValue <<= aCharLocaleAsianNew; + xSpreadsheetDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetDocumentSettings->getPropertyValue(propName) + >>= aCharLocaleAsianSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue: CharLocaleAsian", + aCharLocaleAsianNew.Country, aCharLocaleAsianSet.Country); + + propName = "CharLocaleComplex"; + lang::Locale aCharLocaleComplexGet; + lang::Locale aCharLocaleComplexSet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue: CharLocaleComplex", + xSpreadsheetDocumentSettings->getPropertyValue(propName) + >>= aCharLocaleComplexGet); + + lang::Locale aCharLocaleComplexNew; + aCharLocaleComplexNew.Language = "en"; + aCharLocaleComplexNew.Country = "CA"; + aNewValue <<= aCharLocaleComplexNew; + xSpreadsheetDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetDocumentSettings->getPropertyValue(propName) + >>= aCharLocaleComplexSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue: CharLocaleComplex", + aCharLocaleComplexNew.Country, aCharLocaleComplexSet.Country); + + propName = "IsLoaded"; + testBooleanProperty(xSpreadsheetDocumentSettings, propName); + + propName = "IsUndoEnabled"; + testBooleanProperty(xSpreadsheetDocumentSettings, propName); + + propName = "IsAdjustHeightEnabled"; + testBooleanProperty(xSpreadsheetDocumentSettings, propName); + + propName = "IsExecuteLinkEnabled"; + testBooleanProperty(xSpreadsheetDocumentSettings, propName); + + propName = "ReferenceDevice"; + uno::Reference<awt::XDevice> xDeviceGet; + uno::Reference<awt::XDevice> xDeviceSet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue: ReferenceDevice", + xSpreadsheetDocumentSettings->getPropertyValue(propName) >>= xDeviceGet); + + uno::Reference<awt::XDevice> xDeviceNew; + aNewValue <<= xDeviceNew; + xSpreadsheetDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetDocumentSettings->getPropertyValue(propName) >>= xDeviceSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue: ReferenceDevice", + xDeviceSet->getInfo().Width, xDeviceGet->getInfo().Width); + + propName = "RecordChanges"; + testBooleanProperty(xSpreadsheetDocumentSettings, propName); + + propName = "IsRecordChangesProtected"; + testBooleanReadonlyProperty(xSpreadsheetDocumentSettings, propName); + + propName = "Wildcards"; + testBooleanProperty(xSpreadsheetDocumentSettings, propName); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |