diff options
Diffstat (limited to '')
297 files changed, 35524 insertions, 0 deletions
diff --git a/test/CppunitTest_test_xpath.mk b/test/CppunitTest_test_xpath.mk new file mode 100644 index 000000000..f36741048 --- /dev/null +++ b/test/CppunitTest_test_xpath.mk @@ -0,0 +1,27 @@ +# -*- 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,test_xpath)) + +$(eval $(call gb_CppunitTest_add_exception_objects,test_xpath, \ + test/qa/cppunit/test_xpath \ +)) + +$(eval $(call gb_CppunitTest_use_externals,test_xpath,\ + libxml2 \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,test_xpath, \ + sal \ + test \ +)) + +$(eval $(call gb_CppunitTest_use_sdk_api,test_xpath)) + +# vim: set noet sw=4 ts=4: diff --git a/test/IwyuFilter_test.yaml b/test/IwyuFilter_test.yaml new file mode 100644 index 000000000..2c6bb3b88 --- /dev/null +++ b/test/IwyuFilter_test.yaml @@ -0,0 +1,79 @@ +--- +assumeFilename: test/source/unoapi_test.cxx +blacklist: + test/source/vclbootstrapprotector.cxx: + # Used in Coverity-specific #ifdef + - sal/log.hxx + test/source/container/xchild.cxx: + # Actually used + - com/sun/star/uno/XInterface.hpp + test/source/container/xnamereplace.cxx: + # Actually used + - com/sun/star/uno/Any.hxx + test/source/drawing/xshape.cxx: + # Needed for template + - test/cppunitasserthelper.hxx + test/source/drawing/captionshape.cxx: + # Needed for template + - test/cppunitasserthelper.hxx + test/source/helper/shape.cxx: + # Actually used + - com/sun/star/lang/XComponent.hpp + test/source/sheet/databaserange.cxx: + # Actually used + - com/sun/star/sheet/XDatabaseRange.hpp + # Needed for template + - test/cppunitasserthelper.hxx + test/source/sheet/sheetcell.cxx: + # Needed for template + - test/cppunitasserthelper.hxx + test/source/sheet/sheetcellrange.cxx: + # Needed for template + - test/cppunitasserthelper.hxx + test/source/sheet/sheetfilterdescriptor.cxx: + # Needed for template + - test/cppunitasserthelper.hxx + test/source/sheet/xarealink.cxx: + # Needed for template + - test/cppunitasserthelper.hxx + test/source/sheet/xcalculatable.cxx: + # Actually used + - com/sun/star/table/XCell.hpp + test/source/sheet/xcelladdressable.cxx: + # Needed for template + - test/cppunitasserthelper.hxx + test/source/sheet/xcellrangereferrer.cxx: + # Needed for template + - test/cppunitasserthelper.hxx + test/source/sheet/xconsolidationdescriptor.cxx: + # Needed for template + - test/cppunitasserthelper.hxx + test/source/sheet/xdocumentauditing.cxx: + # Actually used + - com/sun/star/awt/Point.hpp + - com/sun/star/beans/PropertyValue.hpp + - com/sun/star/frame/XFrame.hpp + test/source/sheet/xformulaquery.cxx: + # Needed for template + - test/cppunitasserthelper.hxx + test/source/sheet/xlabelrange.cxx: + # Needed for template + - test/cppunitasserthelper.hxx + test/source/sheet/xnamedrange.cxx: + # Actually used + - com/sun/star/sheet/XNamedRange.hpp + test/source/sheet/xscenarioenhanced.cxx: + # Needed for template + - test/cppunitasserthelper.hxx + test/source/sheet/xsheetannotationanchor.cxx: + # Needed for template + - test/cppunitasserthelper.hxx + test/source/sheet/xsheetcellrangecontainer.cxx: + # Needed for template + - test/cppunitasserthelper.hxx + test/source/table/xtablechart.cxx: + # Needed for template + - test/cppunitasserthelper.hxx + test/source/text/textcontent.cxx: + # Actually used + - com/sun/star/text/TextContentAnchorType.hpp diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk new file mode 100644 index 000000000..0715cc47a --- /dev/null +++ b/test/Library_subsequenttest.mk @@ -0,0 +1,206 @@ +# -*- 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_Library_Library,subsequenttest)) + +$(eval $(call gb_Library_set_include,subsequenttest,\ + $$(INCLUDE) \ +)) + +$(eval $(call gb_Library_add_defs,subsequenttest,\ + -DOOO_DLLIMPLEMENTATION_TEST \ +)) + +$(eval $(call gb_Library_use_common_precompiled_header,subsequenttest)) + +$(eval $(call gb_Library_use_sdk_api,subsequenttest)) + +$(eval $(call gb_Library_use_libraries,subsequenttest,\ + comphelper \ + cppu \ + cppuhelper \ + i18nlangtag \ + sal \ + test \ + tl \ + utl \ + unotest \ + vcl \ +)) + +$(eval $(call gb_Library_use_externals,subsequenttest,\ + boost_headers \ + cppunit \ +)) + +$(eval $(call gb_Library_add_exception_objects,subsequenttest,\ + test/source/unoapi_test \ + test/source/calc_unoapi_test \ + test/source/beans/xpropertyset \ + test/source/chart/xchartdata \ + test/source/container/xchild \ + test/source/container/xelementaccess \ + test/source/container/xenumeration \ + test/source/container/xenumerationaccess \ + test/source/container/xindexaccess \ + test/source/container/xnameaccess \ + test/source/container/xnamecontainer \ + test/source/container/xnamed \ + test/source/container/xnamereplace \ + test/source/document/xactionlockable \ + test/source/document/xembeddedobjectsupplier \ + test/source/document/xlinktargetsupplier \ + test/source/drawing/captionshape \ + test/source/drawing/xdrawpages \ + test/source/drawing/xgluepointssupplier \ + test/source/drawing/xshapedescriptor \ + test/source/drawing/xshapegrouper \ + test/source/drawing/xshape \ + test/source/drawing/xshapes \ + test/source/lang/xserviceinfo \ + test/source/lang/xcomponent \ + test/source/sheet/cellarealink \ + test/source/sheet/cellproperties \ + test/source/sheet/databaseimportdescriptor \ + test/source/sheet/databaserange \ + test/source/sheet/datapilotfield \ + test/source/sheet/datapilotitem \ + test/source/sheet/documentsettings \ + test/source/sheet/functiondescription \ + test/source/sheet/globalsheetsettings \ + test/source/sheet/scenario \ + test/source/sheet/shape \ + test/source/sheet/sheetcell \ + test/source/sheet/sheetcellrange \ + test/source/sheet/sheetcellranges \ + test/source/sheet/sheetfilterdescriptor \ + test/source/sheet/sheetlink \ + test/source/sheet/sheetsortdescriptor2 \ + test/source/sheet/spreadsheet \ + test/source/sheet/spreadsheetdocumentsettings \ + test/source/sheet/spreadsheetviewsettings \ + test/source/sheet/subtotaldescriptor \ + test/source/sheet/tableautoformat \ + test/source/sheet/tablevalidation \ + test/source/sheet/xactivationbroadcaster \ + test/source/sheet/xarealink \ + test/source/sheet/xarealinks \ + test/source/sheet/xarrayformularange \ + test/source/sheet/xcalculatable \ + test/source/sheet/xcelladdressable \ + test/source/sheet/xcellformatrangessupplier \ + test/source/sheet/xcellrangeaddressable \ + test/source/sheet/xcellrangedata \ + test/source/sheet/xcellrangeformula \ + test/source/sheet/xcellrangemovement \ + test/source/sheet/xcellrangereferrer \ + test/source/sheet/xcellrangesquery \ + test/source/sheet/xcellseries \ + test/source/sheet/xconsolidatable \ + test/source/sheet/xconsolidationdescriptor \ + test/source/sheet/xdatabaserange \ + test/source/sheet/xdatabaseranges \ + test/source/sheet/xdatapilotdescriptor \ + test/source/sheet/xdatapilotfield \ + test/source/sheet/xdatapilotfieldgrouping \ + test/source/sheet/xdatapilottable \ + test/source/sheet/xdatapilottable2 \ + test/source/sheet/xdatapilottables \ + test/source/sheet/xdatapilottablessupplier \ + test/source/sheet/xddelink \ + test/source/sheet/xddelinks \ + test/source/sheet/xdocumentauditing \ + test/source/sheet/xformulaquery \ + test/source/sheet/xfunctiondescriptions \ + test/source/sheet/xgoalseek \ + test/source/sheet/xheaderfootercontent \ + test/source/sheet/xlabelrange \ + test/source/sheet/xlabelranges \ + test/source/sheet/xmultiformulatokens \ + test/source/sheet/xmultipleoperation \ + test/source/sheet/xnamedrange \ + test/source/sheet/xnamedranges \ + test/source/sheet/xprintareas \ + test/source/sheet/xrecentfunctions \ + test/source/sheet/xscenario \ + test/source/sheet/xscenarioenhanced \ + test/source/sheet/xscenarios \ + test/source/sheet/xscenariossupplier \ + test/source/sheet/xsheetannotation \ + test/source/sheet/xsheetannotationanchor \ + test/source/sheet/xsheetannotations \ + test/source/sheet/xsheetannotationshapesupplier \ + test/source/sheet/xsheetannotationssupplier \ + test/source/sheet/xsheetauditing \ + test/source/sheet/xsheetcellcursor \ + test/source/sheet/xsheetcellrange \ + test/source/sheet/xsheetcellrangecontainer \ + test/source/sheet/xsheetcellranges \ + test/source/sheet/xsheetcondition \ + test/source/sheet/xsheetconditionalentries \ + test/source/sheet/xsheetconditionalentry \ + test/source/sheet/xsheetfilterable \ + test/source/sheet/xsheetfilterableex \ + test/source/sheet/xsheetfilterdescriptor \ + test/source/sheet/xsheetfilterdescriptor2 \ + test/source/sheet/xsheetfilterdescriptor3 \ + test/source/sheet/xsheetlinkable \ + test/source/sheet/xsheetoperation \ + test/source/sheet/xsheetoutline \ + test/source/sheet/xsheetpagebreak \ + test/source/sheet/xspreadsheet \ + test/source/sheet/xspreadsheetdocument \ + test/source/sheet/xspreadsheets \ + test/source/sheet/xspreadsheets2 \ + test/source/sheet/xspreadsheetview \ + test/source/sheet/xsubtotalcalculatable \ + test/source/sheet/xsubtotaldescriptor \ + test/source/sheet/xsubtotalfield \ + test/source/sheet/xuniquecellformatrangessupplier\ + test/source/sheet/xusedareacursor \ + test/source/sheet/xviewfreezable \ + test/source/sheet/xviewpane \ + test/source/sheet/xviewsplitable \ + test/source/style/xstyleloader \ + test/source/table/tablecolumn \ + test/source/table/tablerow \ + test/source/table/xcell \ + test/source/table/xcellcursor \ + test/source/table/xcellrange \ + test/source/table/xcolumnrowrange \ + test/source/table/xtablechart \ + test/source/table/xtablecharts \ + test/source/table/xtablechartssupplier \ + test/source/table/xtablecolumns \ + test/source/table/xtablerows \ + test/source/text/baseindex \ + test/source/text/textcontent \ + test/source/text/xsimpletext \ + test/source/text/xtext \ + test/source/text/xtextcontent \ + test/source/text/xtextfield \ + test/source/text/xtextrange \ + test/source/text/xdocumentindex \ + test/source/text/textdocumentsettings \ + test/source/text/textprintersettings \ + test/source/text/textsettings \ + test/source/text/textdocumentindex \ + test/source/util/searchdescriptor \ + test/source/util/xindent \ + test/source/util/xmergeable \ + test/source/util/xrefreshable \ + test/source/util/xreplaceable \ + test/source/util/xreplacedescriptor \ + test/source/util/xsearchable \ + test/source/util/xsearchdescriptor \ + test/source/view/xcontrolaccess \ + test/source/view/xformlayeraccess \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/test/Library_test.mk b/test/Library_test.mk new file mode 100644 index 000000000..4be059857 --- /dev/null +++ b/test/Library_test.mk @@ -0,0 +1,58 @@ +# -*- 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_Library_Library,test)) + +$(eval $(call gb_Library_set_include,test,\ + $$(INCLUDE) \ +)) + +$(eval $(call gb_Library_add_defs,test,\ + -DOOO_DLLIMPLEMENTATION_TEST \ +)) + +$(eval $(call gb_Library_use_sdk_api,test)) + +$(eval $(call gb_Library_use_externals,test,\ + boost_headers \ + cppunit \ + libxml2 \ + valgrind \ +)) + +$(eval $(call gb_Library_use_libraries,test,\ + basegfx \ + comphelper \ + cppu \ + cppuhelper \ + i18nlangtag \ + sal \ + svt \ + test-setupvcl \ + tl \ + utl \ + unotest \ + vcl \ + drawinglayer \ +)) + +$(eval $(call gb_Library_add_exception_objects,test,\ + test/source/bootstrapfixture \ + test/source/diff/diff \ + test/source/callgrind \ + test/source/xmltesttools \ + test/source/htmltesttools \ + test/source/screenshot_test \ + test/source/unoapi_property_testers \ + test/source/helper/form \ + test/source/helper/shape \ + test/source/helper/transferable \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/test/Library_test_setupvcl.mk b/test/Library_test_setupvcl.mk new file mode 100644 index 000000000..16f79ddf3 --- /dev/null +++ b/test/Library_test_setupvcl.mk @@ -0,0 +1,36 @@ +# -*- 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_Library_Library,test-setupvcl)) + +$(eval $(call gb_Library_add_defs,test-setupvcl,\ + -DOOO_DLLIMPLEMENTATION_TEST_SETUPVCL \ +)) + +$(eval $(call gb_Library_add_exception_objects,test-setupvcl, \ + test/source/setupvcl \ +)) + +$(eval $(call gb_Library_use_externals,test-setupvcl, \ + boost_headers \ +)) + +$(eval $(call gb_Library_use_libraries,test-setupvcl, \ + comphelper \ + cppu \ + i18nlangtag \ + sal \ + tl \ + utl \ + vcl \ +)) + +$(eval $(call gb_Library_use_sdk_api,test-setupvcl)) + +# vim: set noet sw=4 ts=4: diff --git a/test/Library_vclbootstrapprotector.mk b/test/Library_vclbootstrapprotector.mk new file mode 100644 index 000000000..d01bc6679 --- /dev/null +++ b/test/Library_vclbootstrapprotector.mk @@ -0,0 +1,34 @@ +# -*- 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_Library_Library,vclbootstrapprotector)) + +$(eval $(call gb_Library_add_exception_objects,vclbootstrapprotector, \ + test/source/vclbootstrapprotector \ +)) + +$(eval $(call gb_Library_use_externals,vclbootstrapprotector, \ + boost_headers \ + cppunit \ +)) + +$(eval $(call gb_Library_use_libraries,vclbootstrapprotector, \ + comphelper \ + cppu \ + i18nlangtag \ + sal \ + test-setupvcl \ + tl \ + utl \ + vcl \ +)) + +$(eval $(call gb_Library_use_sdk_api,vclbootstrapprotector)) + +# vim: set noet sw=4 ts=4: diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 000000000..ccb1c85a0 --- /dev/null +++ b/test/Makefile @@ -0,0 +1,7 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/test/Module_test.mk b/test/Module_test.mk new file mode 100644 index 000000000..080cc855b --- /dev/null +++ b/test/Module_test.mk @@ -0,0 +1,28 @@ +# -*- 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_Module_Module,test)) + +ifneq (,$(filter DESKTOP,$(BUILD_TYPE))) + +$(eval $(call gb_Module_add_targets,test,\ + Library_test \ + Library_test_setupvcl \ + Library_subsequenttest \ + Library_vclbootstrapprotector \ + Package_unittest \ +)) + +$(eval $(call gb_Module_add_check_targets,test,\ + CppunitTest_test_xpath \ +)) + +endif + +# vim: set noet sw=4 ts=4: diff --git a/test/Package_unittest.mk b/test/Package_unittest.mk new file mode 100644 index 000000000..5973615ed --- /dev/null +++ b/test/Package_unittest.mk @@ -0,0 +1,32 @@ +# -*- 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_Package_Package,test_unittest,$(SRCDIR)/test/user-template)) + +$(eval $(call gb_Package_set_outdir,test_unittest,$(WORKDIR))) + +$(eval $(call gb_Package_add_file,test_unittest,unittest/registry/modifications.xcd,registry/modifications.xcd)) +$(eval $(call gb_Package_add_file,test_unittest,unittest/user/wordbook/sl.dic,user/wordbook/sl.dic)) +$(eval $(call gb_Package_add_file,test_unittest,unittest/user/wordbook/en-US.dic,user/wordbook/en-US.dic)) +$(eval $(call gb_Package_add_file,test_unittest,unittest/user/database/biblio.odb,user/database/biblio.odb)) +$(eval $(call gb_Package_add_file,test_unittest,unittest/user/database/biblio/biblio.dbf,user/database/biblio/biblio.dbf)) +$(eval $(call gb_Package_add_file,test_unittest,unittest/user/database/biblio/biblio.dbt,user/database/biblio/biblio.dbt)) +$(eval $(call gb_Package_add_file,test_unittest,unittest/user/wordbook/technical.dic,user/wordbook/technical.dic)) +$(eval $(call gb_Package_add_file,test_unittest,unittest/user/wordbook/en-GB.dic,user/wordbook/en-GB.dic)) +$(eval $(call gb_Package_add_file,test_unittest,unittest/user/autotext/en-US/template.bau,user/autotext/en-US/template.bau)) +$(eval $(call gb_Package_add_file,test_unittest,unittest/user/autotext/en-US/standard.bau,user/autotext/en-US/standard.bau)) +$(eval $(call gb_Package_add_file,test_unittest,unittest/user/autotext/en-US/crdbus50.bau,user/autotext/en-US/crdbus50.bau)) +$(eval $(call gb_Package_add_file,test_unittest,unittest/user/config/soffice.cfg/.dummy,empty-directory-dummy)) +$(eval $(call gb_Package_add_file,test_unittest,unittest/user/autocorr/acor_en-US.dat,user/autocorr/acor_fr.dat)) +$(eval $(call gb_Package_add_file,test_unittest,unittest/user/config/soffice.cfg/modules/scalc/popupmenu/draw.xml,user/config/soffice.cfg/modules/scalc/popupmenu/draw.xml)) +$(eval $(call gb_Package_add_file,test_unittest,unittest/user/config/soffice.cfg/modules/scalc/popupmenu/anchor.xml,user/config/soffice.cfg/modules/scalc/popupmenu/anchor.xml)) +$(eval $(call gb_Package_add_file,test_unittest,unittest/user/config/soffice.cfg/modules/swriter/popupmenu/text.xml,user/config/soffice.cfg/modules/swriter/popupmenu/text.xml)) +$(eval $(call gb_Package_add_file,test_unittest,unittest/user/config/soffice.cfg/modules/simpress/popupmenu/page.xml,user/config/soffice.cfg/modules/simpress/popupmenu/page.xml)) + +# vim: set noet sw=4 ts=4: diff --git a/test/README b/test/README new file mode 100644 index 000000000..dc0afd80a --- /dev/null +++ b/test/README @@ -0,0 +1,4 @@ +Test harness code for C++ unit testing + +Many of these tests are run during the build process. In that case on +unix, if a test fails follow the error messages to debug it under gdb. diff --git a/test/README.vars b/test/README.vars new file mode 100644 index 000000000..2157d9497 --- /dev/null +++ b/test/README.vars @@ -0,0 +1,3 @@ +Environment variables in VCL: + +LO_TEST_LOCALE - the locale to be used during unit tests. Defaults to en-US. diff --git a/test/qa/cppunit/test_xpath.cxx b/test/qa/cppunit/test_xpath.cxx new file mode 100644 index 000000000..12852fc7d --- /dev/null +++ b/test/qa/cppunit/test_xpath.cxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 <sal/types.h> +#include <test/xmltesttools.hxx> +#include <unotest/bootstrapfixturebase.hxx> + +class TestXPath : public CppUnit::TestFixture, public XmlTestTools +{ +}; + +CPPUNIT_TEST_FIXTURE(TestXPath, test_getXPath) +{ + const xmlChar s_xml[] = "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" + "<xml><item attrib='val'>text</item></xml>"; + xmlDocUniquePtr pTable(xmlParseDoc(s_xml)); + CPPUNIT_ASSERT(pTable); + // Must get existing element content without errors + CPPUNIT_ASSERT_ASSERTION_PASS(getXPath(pTable, "/xml/item", "")); + // Must error out when getting non-existing element + CPPUNIT_ASSERT_ASSERTION_FAIL(getXPath(pTable, "/xml/no_item", "")); + // Must get existing attribute value correctly + CPPUNIT_ASSERT_ASSERTION_PASS(getXPath(pTable, "/xml/item", "attrib")); + // Must fail when requested non-empty attribute doesn't exist + CPPUNIT_ASSERT_ASSERTION_FAIL(getXPath(pTable, "/xml/item", "no_attrib")); + // Must return empty string if not asking an attribute, regardless what is its content + CPPUNIT_ASSERT_EQUAL(OUString(), getXPath(pTable, "/xml/item", "")); + // Must properly return attribute content + CPPUNIT_ASSERT_EQUAL(OUString("val"), getXPath(pTable, "/xml/item", "attrib")); + // Trying to get position of missing child of a node must fail assertion + CPPUNIT_ASSERT_ASSERTION_FAIL(getXPathPosition(pTable, "/xml/item", "absent")); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/beans/xpropertyset.cxx b/test/source/beans/xpropertyset.cxx new file mode 100644 index 000000000..d42bc836c --- /dev/null +++ b/test/source/beans/xpropertyset.cxx @@ -0,0 +1,338 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/beans/xpropertyset.hxx> + +#include <com/sun/star/beans/Property.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XVetoableChangeListener.hpp> +#include <com/sun/star/lang/EventObject.hpp> +#include <com/sun/star/util/DateTime.hpp> + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Type.h> + +#include <cppuhelper/implbase.hxx> +#include <rtl/ref.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +XPropertySet::PropsToTest::PropsToTest() + : initialized(false) +{ +} + +namespace +{ +class MockedPropertyChangeListener : public ::cppu::WeakImplHelper<beans::XPropertyChangeListener> +{ +public: + MockedPropertyChangeListener() + : m_bListenerCalled(false) + { + } + + bool m_bListenerCalled; + + virtual void SAL_CALL propertyChange(const beans::PropertyChangeEvent& /* xEvent */) override + { + m_bListenerCalled = true; + } + + virtual void SAL_CALL disposing(const lang::EventObject& /* xEventObj */) override {} +}; + +class MockedVetoableChangeListener : public ::cppu::WeakImplHelper<beans::XVetoableChangeListener> +{ +public: + MockedVetoableChangeListener() + : m_bListenerCalled(false) + { + } + + bool m_bListenerCalled; + + virtual void SAL_CALL vetoableChange(const beans::PropertyChangeEvent& /* xEvent */) override + { + m_bListenerCalled = true; + } + + virtual void SAL_CALL disposing(const lang::EventObject& /* xEventObj */) override {} +}; +} + +void XPropertySet::testPropertyChangeListener() +{ + uno::Reference<beans::XPropertySet> xPropSet(init(), uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySetInfo> xPropInfo = xPropSet->getPropertySetInfo(); + fillPropsToTest(xPropInfo); + + for (const auto& aName : maPropsToTest.bound) + { + rtl::Reference<MockedPropertyChangeListener> xListener = new MockedPropertyChangeListener(); + xPropSet->addPropertyChangeListener( + aName, uno::Reference<beans::XPropertyChangeListener>(xListener.get())); + if (!isPropertyValueChangeable(aName)) + continue; + + CPPUNIT_ASSERT(xListener->m_bListenerCalled); + + xListener->m_bListenerCalled = false; + xPropSet->removePropertyChangeListener( + aName, uno::Reference<beans::XPropertyChangeListener>(xListener.get())); + isPropertyValueChangeable(aName); + CPPUNIT_ASSERT(!xListener->m_bListenerCalled); + } +} + +void XPropertySet::testVetoableChangeListener() +{ + uno::Reference<beans::XPropertySet> xPropSet(init(), uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySetInfo> xPropInfo = xPropSet->getPropertySetInfo(); + fillPropsToTest(xPropInfo); + + for (const auto& aName : maPropsToTest.bound) + { + rtl::Reference<MockedVetoableChangeListener> xListener = new MockedVetoableChangeListener(); + xPropSet->addVetoableChangeListener( + aName, uno::Reference<beans::XVetoableChangeListener>(xListener.get())); + if (!isPropertyValueChangeable(aName)) + continue; + + CPPUNIT_ASSERT(xListener->m_bListenerCalled); + + xListener->m_bListenerCalled = false; + xPropSet->removeVetoableChangeListener( + aName, uno::Reference<beans::XVetoableChangeListener>(xListener.get())); + isPropertyValueChangeable(aName); + CPPUNIT_ASSERT(!xListener->m_bListenerCalled); + } +} + +void XPropertySet::testGetPropertySetInfo() +{ + uno::Reference<beans::XPropertySet> xPropSet(init(), UNO_QUERY_THROW); + uno::Reference<beans::XPropertySetInfo> xPropInfo = xPropSet->getPropertySetInfo(); + if (xPropInfo.is()) + { + fillPropsToTest(xPropInfo); + } + else + { + // TODO: Add a means for the client code to populate the PropsToTest. + } +} + +void XPropertySet::testSetPropertyValue() +{ + testGetPropertySetInfo(); + + for (size_t i = 0, n = maPropsToTest.normal.size(); i < n; ++i) + { + bool bSuccess = isPropertyValueChangeable(maPropsToTest.normal[i]); + CPPUNIT_ASSERT(bSuccess); + } +} + +void XPropertySet::testGetPropertyValue() +{ + testGetPropertySetInfo(); + uno::Reference<beans::XPropertySet> xPropSet(init(), UNO_QUERY_THROW); + + // Check read-only properties. + for (size_t i = 0, n = maPropsToTest.readonly.size(); i < n; ++i) + { + bool bSuccess = getSinglePropertyValue(xPropSet, maPropsToTest.readonly[i]); + CPPUNIT_ASSERT(bSuccess); + } + + // Check writable properties. + for (size_t i = 0, n = maPropsToTest.normal.size(); i < n; ++i) + { + bool bSuccess = getSinglePropertyValue(xPropSet, maPropsToTest.normal[i]); + CPPUNIT_ASSERT(bSuccess); + } +} + +bool XPropertySet::isPropertyValueChangeable(const OUString& rName) +{ + bool bIgnore = isPropertyIgnored(rName); + if (bIgnore) + return false; + + uno::Reference<beans::XPropertySet> xPropSet(init(), UNO_QUERY_THROW); + try + { + uno::Any any = xPropSet->getPropertyValue(rName); + const uno::Type& type = any.getValueType(); + if (type == cppu::UnoType<bool>::get()) + { + // boolean type + bool bOld = any.get<bool>(); + xPropSet->setPropertyValue(rName, makeAny(!bOld)); + } + else if (type == cppu::UnoType<sal_Int8>::get()) + { + // 8-bit integer + sal_Int8 nOld = any.get<sal_Int8>(); + sal_Int8 nNew = nOld + 1; + xPropSet->setPropertyValue(rName, makeAny(nNew)); + } + else if (type == cppu::UnoType<sal_Int16>::get()) + { + // 16-bit integer + sal_Int16 nOld = any.get<sal_Int16>(); + sal_Int16 nNew = nOld + 1; + xPropSet->setPropertyValue(rName, makeAny(nNew)); + } + else if (type == cppu::UnoType<sal_Int32>::get()) + { + // 32-bit integer + sal_Int32 nOld = any.get<sal_Int32>(); + sal_Int32 nNew = nOld + 3; + xPropSet->setPropertyValue(rName, makeAny(nNew)); + } + else if (type == cppu::UnoType<sal_Int64>::get()) + { + // 64-bit integer + sal_Int64 nOld = any.get<sal_Int64>(); + sal_Int64 nNew = nOld + 4; + xPropSet->setPropertyValue(rName, makeAny(nNew)); + } + else if (type == cppu::UnoType<float>::get()) + { + // single precision + float fOld = any.get<float>(); + float fNew = fOld + 1.2; + xPropSet->setPropertyValue(rName, makeAny(fNew)); + } + else if (type == cppu::UnoType<double>::get()) + { + // double precision + double fOld = any.get<double>(); + double fNew = fOld + 1.3; + xPropSet->setPropertyValue(rName, makeAny(fNew)); + } + else if (type == cppu::UnoType<OUString>::get()) + { + // string type + OUString aOld = any.get<OUString>(); + OUString aNew = aOld + "foo"; + xPropSet->setPropertyValue(rName, makeAny(aNew)); + } + else if (type == cppu::UnoType<util::DateTime>::get()) + { + // date time type + util::DateTime aDT = any.get<util::DateTime>(); + aDT.Year += 1; + xPropSet->setPropertyValue(rName, makeAny(aDT)); + } + else + { + std::cout << "Unknown type:\n" + "Type: " + << type.getTypeName() + << "\n" + "Name: " + << rName << "\n"; + CPPUNIT_ASSERT_MESSAGE( + "XPropertySet::isPropertyValueChangeable: unknown type in Any tested.", false); + } + + uno::Any anyTest = xPropSet->getPropertyValue(rName); + return any != anyTest; + } + catch (const uno::Exception&) + { + std::cout << "Exception thrown while retrieving with property: " << rName << "\n"; + CPPUNIT_ASSERT_MESSAGE("XPropertySet::isPropertyValueChangeable: exception thrown while " + "retrieving the property value.", + false); + } + + return false; +} + +void XPropertySet::fillPropsToTest(const uno::Reference<beans::XPropertySetInfo>& xPropInfo) +{ + if (maPropsToTest.initialized) + return; + + const uno::Sequence<beans::Property> aProps = xPropInfo->getProperties(); + + // some properties should not be changed in a unspecific way. + // TODO: Maybe we should mark these properties read-only, instead of + // giving them a special treatment here? + std::set<OUString> aSkip; + aSkip.insert("PrinterName"); + aSkip.insert("CharRelief"); + aSkip.insert("IsLayerMode"); + + for (const beans::Property& aProp : aProps) + { + if (aSkip.count(aProp.Name) > 0) + continue; + + if ((aProp.Attributes & beans::PropertyAttribute::READONLY) != 0) + { + maPropsToTest.readonly.push_back(aProp.Name); + continue; + } + + if ((aProp.Attributes & beans::PropertyAttribute::MAYBEVOID) != 0) + continue; + + bool bBound = (aProp.Attributes & beans::PropertyAttribute::BOUND) != 0; + bool bConstrained = (aProp.Attributes & beans::PropertyAttribute::CONSTRAINED) != 0; + bool bCanChange = isPropertyValueChangeable(aProp.Name); + + if (bBound && bCanChange) + maPropsToTest.bound.push_back(aProp.Name); + + if (bConstrained && bCanChange) + maPropsToTest.constrained.push_back(aProp.Name); + + if (bCanChange) + maPropsToTest.normal.push_back(aProp.Name); + } + + maPropsToTest.initialized = true; +} + +bool XPropertySet::getSinglePropertyValue(const uno::Reference<beans::XPropertySet>& xPropSet, + const OUString& rName) +{ + try + { + xPropSet->getPropertyValue(rName); + return true; + } + catch (const uno::Exception&) + { + } + return false; +} + +bool XPropertySet::isPropertyIgnored(const OUString& rName) +{ + return m_IgnoreValue.count(rName) > 0; +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx new file mode 100644 index 000000000..4d6b54a8f --- /dev/null +++ b/test/source/bootstrapfixture.cxx @@ -0,0 +1,240 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 <config_features.h> + +#include <test/bootstrapfixture.hxx> +#include <vcl/errinf.hxx> +#include <sal/log.hxx> +#include <comphelper/processfactory.hxx> + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/ucb/XContentProvider.hpp> +#include <com/sun/star/ucb/XUniversalContentBroker.hpp> + +#include <vcl/svapp.hxx> +#include <tools/link.hxx> +#include <vcl/graphicfilter.hxx> +#include <osl/file.hxx> +#include <osl/process.h> +#include <unotools/tempfile.hxx> +#include <vcl/scheduler.hxx> + +#include <memory> +#include <cstring> + +#include "setupvcl.hxx" + +using namespace ::com::sun::star; + +static void aBasicErrorFunc( const OUString &rErr, const OUString &rAction ) +{ + OString aErr = "Unexpected dialog: " + + OUStringToOString( rAction, RTL_TEXTENCODING_ASCII_US ) + + " Error: " + + OUStringToOString( rErr, RTL_TEXTENCODING_ASCII_US ); + CPPUNIT_ASSERT_MESSAGE( aErr.getStr(), false); +} + +// NB. this constructor is called before any tests are run, once for each +// test function in a rather non-intuitive way. This is why all the 'real' +// heavy lifting is deferred until setUp. setUp and tearDown are interleaved +// between the tests as you might expect. +test::BootstrapFixture::BootstrapFixture( bool bAssertOnDialog, bool bNeedUCB ) + : m_bNeedUCB( bNeedUCB ) + , m_bAssertOnDialog( bAssertOnDialog ) +{ +} + +extern "C" +{ + +static void test_init_impl(bool bAssertOnDialog, bool bNeedUCB, + lang::XMultiServiceFactory * pSFactory) +{ + if (bAssertOnDialog) + ErrorRegistry::RegisterDisplay( aBasicErrorFunc ); + + // Make GraphicConverter work, normally done in desktop::Desktop::Main() + Application::SetFilterHdl( + LINK(nullptr, test::BootstrapFixture, ImplInitFilterHdl)); + + if (bNeedUCB) + { + // initialise unconfigured UCB: + uno::Reference<ucb::XUniversalContentBroker> xUcb(pSFactory->createInstance("com.sun.star.ucb.UniversalContentBroker"), uno::UNO_QUERY_THROW); + uno::Reference<ucb::XContentProvider> xFileProvider(pSFactory->createInstance("com.sun.star.ucb.FileContentProvider"), uno::UNO_QUERY_THROW); + xUcb->registerContentProvider(xFileProvider, "file", true); + uno::Reference<ucb::XContentProvider> xTdocProvider(pSFactory->createInstance("com.sun.star.ucb.TransientDocumentsContentProvider"), uno::UNO_QUERY); + if (xTdocProvider.is()) + { + xUcb->registerContentProvider(xTdocProvider, "vnd.sun.star.tdoc", true); + } + } +} + +// this is called from pyuno +SAL_DLLPUBLIC_EXPORT void test_init(lang::XMultiServiceFactory *pFactory) +{ + try + { + ::comphelper::setProcessServiceFactory(pFactory); + test::setUpVcl(true); // hard-code python tests to headless + test_init_impl(false, true, pFactory); + } + catch (...) { abort(); } +} + +// this is called from pyuno +SAL_DLLPUBLIC_EXPORT void test_deinit() +{ + DeInitVCL(); +} + +} // extern "C" + +void test::BootstrapFixture::setUp() +{ + test::BootstrapFixtureBase::setUp(); + + test_init_impl(m_bAssertOnDialog, m_bNeedUCB, m_xSFactory.get()); + +#if OSL_DEBUG_LEVEL > 0 + Scheduler::ProcessEventsToIdle(); +#endif + + mxComponentContext.set(comphelper::getComponentContext(getMultiServiceFactory())); +} + +test::BootstrapFixture::~BootstrapFixture() +{ +} + +#if HAVE_EXPORT_VALIDATION +namespace { + +OString loadFile(const OUString& rURL) +{ + osl::File aFile(rURL); + osl::FileBase::RC eStatus = aFile.open(osl_File_OpenFlag_Read); + CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, eStatus); + sal_uInt64 nSize; + aFile.getSize(nSize); + std::unique_ptr<char[]> aBytes(new char[nSize]); + sal_uInt64 nBytesRead; + aFile.read(aBytes.get(), nSize, nBytesRead); + CPPUNIT_ASSERT_EQUAL(nSize, nBytesRead); + OString aContent(aBytes.get(), nBytesRead); + + return aContent; +} + +} +#endif + +void test::BootstrapFixture::validate(const OUString& rPath, test::ValidationFormat eFormat) const +{ +#if HAVE_EXPORT_VALIDATION + OUString var; + if( eFormat == test::OOXML ) + { + var = "OFFICEOTRON"; + } + else if ( eFormat == test::ODF ) + { + var = "ODFVALIDATOR"; + } + else if ( eFormat == test::MSBINARY ) + { +#if HAVE_BFFVALIDATOR + var = "BFFVALIDATOR"; +#else + // Binary Format Validator is disabled + return; +#endif + } + OUString aValidator; + oslProcessError e = osl_getEnvironment(var.pData, &aValidator.pData); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + OUString("cannot get env var " + var).toUtf8().getStr(), + osl_Process_E_None, e); + CPPUNIT_ASSERT_MESSAGE( + OUString("empty get env var " + var).toUtf8().getStr(), + !aValidator.isEmpty()); + + if (eFormat == test::ODF) + { + // invoke without -e so that we know when something new is written + // in loext namespace that isn't yet in the custom schema + aValidator += " -M " + + m_directories.getPathFromSrc("/schema/libreoffice/OpenDocument-manifest-schema-v1.3+libreoffice.rng") + + " -D " + + m_directories.getPathFromSrc("/schema/libreoffice/OpenDocument-dsig-schema-v1.3+libreoffice.rng") + + " -O " + + m_directories.getPathFromSrc("/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng") + + " -m " + + m_directories.getPathFromSrc("/schema/mathml2/mathml2.xsd"); + } + + utl::TempFile aOutput; + aOutput.EnableKillingFile(); + OUString aOutputFile = aOutput.GetFileName(); + OUString aCommand = aValidator + " " + rPath + " > " + aOutputFile; + + SAL_INFO("test", "BootstrapFixture::validate: executing '" << aCommand << "'"); + int returnValue = system(OUStringToOString(aCommand, RTL_TEXTENCODING_UTF8).getStr()); + + OString aContentString = loadFile(aOutput.GetURL()); + OUString aContentOUString = OStringToOUString(aContentString, RTL_TEXTENCODING_UTF8); + + if( eFormat == test::OOXML && !aContentOUString.isEmpty() ) + { + // check for validation errors here + sal_Int32 nIndex = aContentOUString.lastIndexOf("Grand total of errors in submitted package: "); + if(nIndex == -1) + { + SAL_WARN("test", "no summary line"); + } + else + { + sal_Int32 nStartOfNumber = nIndex + std::strlen("Grand total of errors in submitted package: "); + OUString aNumber = aContentOUString.copy(nStartOfNumber); + sal_Int32 nErrors = aNumber.toInt32(); + OString aMsg = "validation error in OOXML export: Errors: " + OString::number(nErrors); + if(nErrors) + { + SAL_WARN("test", aContentOUString); + } + CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsg.getStr(), sal_Int32(0), nErrors); + } + } + else if( eFormat == test::ODF && !aContentOUString.isEmpty() ) + { + if( aContentOUString.indexOf("Error") != -1 ) + { + SAL_WARN("test", aContentOUString); + CPPUNIT_FAIL(aContentString.getStr()); + } + } + CPPUNIT_ASSERT_EQUAL_MESSAGE( + OUStringToOString("failed to execute: " + aCommand + "\n" + aContentOUString, + RTL_TEXTENCODING_UTF8).getStr(), 0, returnValue); +#else + (void)rPath; + (void)eFormat; +#endif +} + +IMPL_STATIC_LINK( + test::BootstrapFixture, ImplInitFilterHdl, ConvertData&, rData, bool) +{ + return GraphicFilter::GetGraphicFilter().GetFilterCallback().Call( rData ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/calc_unoapi_test.cxx b/test/source/calc_unoapi_test.cxx new file mode 100644 index 000000000..8d7e218d9 --- /dev/null +++ b/test/source/calc_unoapi_test.cxx @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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> + +using namespace css; +using namespace css::uno; + +CalcUnoApiTest::CalcUnoApiTest(const OUString& path) + : UnoApiTest(path) +{ +} + +void CalcUnoApiTest::setUp() +{ + UnoApiTest::setUp(); + + // This is a bit of a fudge, we do this to ensure that ScGlobals::ensure, + // which is a private symbol to us, gets called + m_xCalcComponent = + getMultiServiceFactory()->createInstance("com.sun.star.comp.Calc.SpreadsheetDocument"); + CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xCalcComponent.is()); +} + +void CalcUnoApiTest::tearDown() +{ + uno::Reference< lang::XComponent >( m_xCalcComponent, UNO_QUERY_THROW )->dispose(); + UnoApiTest::tearDown(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/callgrind.cxx b/test/source/callgrind.cxx new file mode 100644 index 000000000..d5e864aa8 --- /dev/null +++ b/test/source/callgrind.cxx @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/callgrind.hxx> + +#ifdef HAVE_VALGRIND_HEADERS +#include <valgrind/callgrind.h> +#else +#define CALLGRIND_START_INSTRUMENTATION +#define CALLGRIND_ZERO_STATS +#define CALLGRIND_STOP_INSTRUMENTATION +#define CALLGRIND_DUMP_STATS_AT(name) (void)name; +#endif + +void callgrindStart() +{ + CALLGRIND_ZERO_STATS; + CALLGRIND_START_INSTRUMENTATION; +}; + +void callgrindDump(const char* name) +{ + CALLGRIND_STOP_INSTRUMENTATION; + CALLGRIND_DUMP_STATS_AT(name); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/chart/xchartdata.cxx b/test/source/chart/xchartdata.cxx new file mode 100644 index 000000000..dcecf33a0 --- /dev/null +++ b/test/source/chart/xchartdata.cxx @@ -0,0 +1,96 @@ +/* -*- 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/chart/xchartdata.hxx> +#include <cppuhelper/implbase.hxx> +#include <rtl/ref.hxx> + +#include <com/sun/star/chart/ChartDataChangeEvent.hpp> +#include <com/sun/star/chart/XChartData.hpp> +#include <com/sun/star/chart/XChartDataArray.hpp> +#include <com/sun/star/chart/XChartDataChangeEventListener.hpp> +#include <com/sun/star/lang/EventObject.hpp> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +namespace +{ +class MockedChartDataChangeEventListener + : public ::cppu::WeakImplHelper<chart::XChartDataChangeEventListener> +{ +public: + MockedChartDataChangeEventListener() + : m_bListenerCalled(false) + { + } + + bool m_bListenerCalled; + virtual void SAL_CALL chartDataChanged(const chart::ChartDataChangeEvent& /* rEvent */) override + { + m_bListenerCalled = true; + } + + virtual void SAL_CALL disposing(const lang::EventObject& /* xEvent */) override {} +}; +} + +void XChartData::testGetNotANumber() +{ + uno::Reference<chart::XChartData> xCD(init(), uno::UNO_QUERY_THROW); + const double fNaN = xCD->getNotANumber(); + + CPPUNIT_ASSERT(fNaN != 1.0); +} + +void XChartData::testIsNotANumber() +{ + uno::Reference<chart::XChartData> xCD(init(), uno::UNO_QUERY_THROW); + const double fNaN = xCD->getNotANumber(); + CPPUNIT_ASSERT(xCD->isNotANumber(fNaN)); + CPPUNIT_ASSERT(!xCD->isNotANumber(fNaN + 1.0)); +} + +void XChartData::testChartDataChangeEventListener() +{ + uno::Reference<chart::XChartData> xCD(init(), uno::UNO_QUERY_THROW); + + rtl::Reference<MockedChartDataChangeEventListener> pListener0 + = new MockedChartDataChangeEventListener(); + xCD->addChartDataChangeEventListener( + uno::Reference<chart::XChartDataChangeEventListener>(pListener0.get())); + rtl::Reference<MockedChartDataChangeEventListener> pListener1 + = new MockedChartDataChangeEventListener(); + xCD->addChartDataChangeEventListener( + uno::Reference<chart::XChartDataChangeEventListener>(pListener1.get())); + + uno::Reference<chart::XChartDataArray> xCDD(xCD, uno::UNO_QUERY_THROW); + uno::Sequence<uno::Sequence<double>> aData = xCDD->getData(); + aData[0][0] += 1.0; + xCDD->setData(aData); + CPPUNIT_ASSERT(pListener0->m_bListenerCalled); + CPPUNIT_ASSERT(pListener1->m_bListenerCalled); + + pListener0->m_bListenerCalled = false; + pListener1->m_bListenerCalled = false; + + xCD->removeChartDataChangeEventListener( + uno::Reference<chart::XChartDataChangeEventListener>(pListener1.get())); + aData[0][0] += 1.0; + xCDD->setData(aData); + CPPUNIT_ASSERT(pListener0->m_bListenerCalled); + CPPUNIT_ASSERT(!pListener1->m_bListenerCalled); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/container/xchild.cxx b/test/source/container/xchild.cxx new file mode 100644 index 000000000..eac97b0eb --- /dev/null +++ b/test/source/container/xchild.cxx @@ -0,0 +1,38 @@ +/* -*- 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/container/xchild.hxx> + +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/uno/XInterface.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XChild::testGetSetParent() +{ + uno::Reference<container::XChild> xChild(init(), UNO_QUERY_THROW); + uno::Reference<uno::XInterface> xInterface(xChild, UNO_QUERY_THROW); + xInterface = xChild->getParent(); + + CPPUNIT_ASSERT_MESSAGE("Successfully able to Get Parent", xInterface); + + xChild->setParent(xInterface); + + CPPUNIT_ASSERT_MESSAGE("Successfully able to Set Parent", xChild); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/container/xelementaccess.cxx b/test/source/container/xelementaccess.cxx new file mode 100644 index 000000000..4ec751520 --- /dev/null +++ b/test/source/container/xelementaccess.cxx @@ -0,0 +1,36 @@ +/* -*- 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/container/xelementaccess.hxx> + +#include <com/sun/star/container/XElementAccess.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XElementAccess::testGetElementType() +{ + uno::Reference<container::XElementAccess> xElementAccess(init(), UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(m_aType, xElementAccess->getElementType()); +} + +void XElementAccess::testHasElements() +{ + uno::Reference<container::XElementAccess> xElementAccess(init(), UNO_QUERY_THROW); + CPPUNIT_ASSERT(xElementAccess->hasElements()); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/container/xenumeration.cxx b/test/source/container/xenumeration.cxx new file mode 100644 index 000000000..190ef27fe --- /dev/null +++ b/test/source/container/xenumeration.cxx @@ -0,0 +1,43 @@ +/* -*- 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/container/xenumeration.hxx> + +#include <com/sun/star/container/NoSuchElementException.hpp> +#include <com/sun/star/container/XEnumeration.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XEnumeration::testHasMoreElements() +{ + uno::Reference<container::XEnumeration> xEnumeration(init(), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT(xEnumeration->hasMoreElements()); +} + +void XEnumeration::testNextElement() +{ + uno::Reference<container::XEnumeration> xEnumeration(init(), uno::UNO_QUERY_THROW); + + // unwind all elements from the enumeration + while (xEnumeration->hasMoreElements()) + CPPUNIT_ASSERT_NO_THROW(xEnumeration->nextElement()); + + CPPUNIT_ASSERT_THROW_MESSAGE("Incorrect exception", xEnumeration->nextElement(), + container::NoSuchElementException); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/container/xenumerationaccess.cxx b/test/source/container/xenumerationaccess.cxx new file mode 100644 index 000000000..e3c53064e --- /dev/null +++ b/test/source/container/xenumerationaccess.cxx @@ -0,0 +1,31 @@ +/* -*- 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/container/xenumerationaccess.hxx> + +#include <com/sun/star/container/XEnumerationAccess.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XEnumerationAccess::testCreateEnumeration() +{ + uno::Reference<container::XEnumerationAccess> xEnumerationAccess(init(), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_MESSAGE("Unable to create enumeration", xEnumerationAccess->createEnumeration()); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/container/xindexaccess.cxx b/test/source/container/xindexaccess.cxx new file mode 100644 index 000000000..7fc08027c --- /dev/null +++ b/test/source/container/xindexaccess.cxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/container/xindexaccess.hxx> + +#include <com/sun/star/container/XIndexAccess.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XIndexAccess::testGetCount() +{ + uno::Reference<container::XIndexAccess> xIndexAccess(init(), UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(m_nItems, xIndexAccess->getCount()); +} + +void XIndexAccess::testGetByIndex() +{ + uno::Reference<container::XIndexAccess> xIndexAccess(init(), UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(m_nItems, xIndexAccess->getCount()); + + if (m_nItems > 0) + { + Any aAny = xIndexAccess->getByIndex(0); + CPPUNIT_ASSERT(aAny.hasValue()); + + aAny = xIndexAccess->getByIndex(m_nItems / 2); + CPPUNIT_ASSERT(aAny.hasValue()); + + aAny = xIndexAccess->getByIndex(m_nItems - 1); + CPPUNIT_ASSERT(aAny.hasValue()); + } +} + +void XIndexAccess::testGetByIndexException() +{ + uno::Reference<container::XIndexAccess> xIndexAccess(init(), UNO_QUERY_THROW); + xIndexAccess->getByIndex(m_nItems); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/container/xnameaccess.cxx b/test/source/container/xnameaccess.cxx new file mode 100644 index 000000000..3616c4cda --- /dev/null +++ b/test/source/container/xnameaccess.cxx @@ -0,0 +1,55 @@ +/* -*- 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/container/xnameaccess.hxx> + +#include <com/sun/star/container/NoSuchElementException.hpp> +#include <com/sun/star/container/XNameAccess.hpp> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XNameAccess::testGetByName() +{ + uno::Reference<container::XNameAccess> xNA(init(), uno::UNO_QUERY_THROW); + + // test with existing name + CPPUNIT_ASSERT_NO_THROW(xNA->getByName(m_aName)); + // test with non-existing name + CPPUNIT_ASSERT_THROW(xNA->getByName(m_aName + "UnitTest"), container::NoSuchElementException); +} + +void XNameAccess::testGetElementNames() +{ + uno::Reference<container::XNameAccess> xNA(init(), uno::UNO_QUERY_THROW); + uno::Sequence<OUString> aNames = xNA->getElementNames(); + + CPPUNIT_ASSERT(aNames.hasElements()); +} + +void XNameAccess::testHasByName() +{ + uno::Reference<container::XNameAccess> xNA(init(), uno::UNO_QUERY_THROW); + + // test with existing name + CPPUNIT_ASSERT(xNA->hasByName(m_aName)); + // test with non-existing name + CPPUNIT_ASSERT(!xNA->hasByName(m_aName + "UnitTest")); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/container/xnamecontainer.cxx b/test/source/container/xnamecontainer.cxx new file mode 100644 index 000000000..5df1e76b3 --- /dev/null +++ b/test/source/container/xnamecontainer.cxx @@ -0,0 +1,101 @@ +/* -*- 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/container/xnamecontainer.hxx> + +#include <com/sun/star/container/ElementExistException.hpp> +#include <com/sun/star/container/NoSuchElementException.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XNameContainer::testInsertByName() +{ + uno::Reference<container::XNameContainer> xNameContainer(init(), uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT(!xNameContainer->hasByName(m_aName + "Insert")); + xNameContainer->insertByName(m_aName + "Insert", m_aElement); + CPPUNIT_ASSERT(xNameContainer->hasByName(m_aName + "Insert")); +} + +void XNameContainer::testInsertByNameEmptyName() +{ + uno::Reference<container::XNameContainer> xNameContainer(init(), uno::UNO_QUERY_THROW); + + uno::Any aAny; + CPPUNIT_ASSERT_THROW(xNameContainer->insertByName("", aAny), lang::IllegalArgumentException); +} + +void XNameContainer::testInsertByNameInvalidElement() +{ + uno::Reference<container::XNameContainer> xNameContainer(init(), uno::UNO_QUERY_THROW); + + // TODO: Find a way to create an invalid element. + // CPPUNIT_ASSERT_THROW(xNameContainer->insertByName("Dummy", nullptr), + // lang::IllegalArgumentException); +} + +void XNameContainer::testInsertByNameDuplicate() +{ + uno::Reference<container::XNameContainer> xNameContainer(init(), uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT(!xNameContainer->hasByName(m_aName + "Duplicate")); + xNameContainer->insertByName(m_aName + "Duplicate", m_aElement); + CPPUNIT_ASSERT(xNameContainer->hasByName(m_aName + "Duplicate")); + + bool bExceptionThrown = false; + try + { + xNameContainer->insertByName(m_aName + "Duplicate", m_aElement); + } + catch (const container::ElementExistException&) + { + bExceptionThrown = true; + } + catch (const lang::IllegalArgumentException&) + { + bExceptionThrown = true; + } + CPPUNIT_ASSERT(bExceptionThrown); +} + +void XNameContainer::testRemoveByName() +{ + uno::Reference<container::XNameContainer> xNameContainer(init(), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT(xNameContainer->hasByName(m_aName)); + xNameContainer->removeByName(m_aName); + CPPUNIT_ASSERT(!xNameContainer->hasByName(m_aName)); +} + +void XNameContainer::testRemoveByNameEmptyName() +{ + uno::Reference<container::XNameContainer> xNameContainer(init(), uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT_THROW(xNameContainer->removeByName(""), lang::IllegalArgumentException); +} + +void XNameContainer::testRemoveByNameNoneExistingElement() +{ + uno::Reference<container::XNameContainer> xNameContainer(init(), uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT_THROW(xNameContainer->removeByName("UnitTest"), + container::NoSuchElementException); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/container/xnamed.cxx b/test/source/container/xnamed.cxx new file mode 100644 index 000000000..799011f41 --- /dev/null +++ b/test/source/container/xnamed.cxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/container/xnamed.hxx> +#include <rtl/ustring.hxx> + +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/uno/RuntimeException.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void XNamed::testGetName() +{ + uno::Reference< container::XNamed > xNamed(init(), UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(m_aTestName, xNamed->getName()); +} + +void XNamed::testSetName() +{ + uno::Reference< container::XNamed > xNamed(init(), UNO_QUERY_THROW); + OUString aTestName("NewName"); + + xNamed->setName(aTestName); + CPPUNIT_ASSERT_EQUAL(aTestName, xNamed->getName()); + + // restore old name + xNamed->setName(m_aTestName); + CPPUNIT_ASSERT_EQUAL(m_aTestName, xNamed->getName()); +} + +void XNamed::testSetNameByScSheetLinkObj() +{ + uno::Reference<container::XNamed> xNamed(init(), uno::UNO_QUERY_THROW); + OUString aTestName(m_aTestName.replaceAll("ScSheetLinkObj", "NewScSheetLinkObj")); + + xNamed->setName(aTestName); + CPPUNIT_ASSERT_EQUAL(aTestName, xNamed->getName()); + + // restore old name + xNamed->setName(m_aTestName); + CPPUNIT_ASSERT_EQUAL(m_aTestName, xNamed->getName()); +} + +void XNamed::testSetNameThrowsException() +{ + uno::Reference<container::XNamed> xNamed(init(), uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT_THROW(xNamed->setName("NewName"), uno::RuntimeException); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/container/xnamereplace.cxx b/test/source/container/xnamereplace.cxx new file mode 100644 index 000000000..2475cb5a0 --- /dev/null +++ b/test/source/container/xnamereplace.cxx @@ -0,0 +1,37 @@ +/* -*- 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/container/xnamereplace.hxx> + +#include <com/sun/star/container/XNameReplace.hpp> + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XNameReplace::testReplaceByName() +{ + uno::Reference<container::XNameReplace> xNameReplace(init(), uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT_NO_THROW(xNameReplace->replaceByName(m_aReplacementName, m_aReplacementElement)); + uno::Any aAny = xNameReplace->getByName(m_aReplacementName); + + // we deliberately avoid uno::UNO_QUERY_THROW, so a test on .is() can be made + uno::Reference<uno::XInterface> xElement(aAny, uno::UNO_QUERY); + CPPUNIT_ASSERT(xElement.is()); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/diff/README b/test/source/diff/README new file mode 100644 index 000000000..2ed65928d --- /dev/null +++ b/test/source/diff/README @@ -0,0 +1,5 @@ +This xml diff is an adapted version of the version at git://people.freedesktop.org/~mmohrhard/xmldiff. +Please write a mail to <markus.mohrhard@googlemail.com> after modifying this version with a patch otherwise it +might get overridden when updating the version in the source tree. + +!This xml diff is still experimental! diff --git a/test/source/diff/diff.cxx b/test/source/diff/diff.cxx new file mode 100644 index 000000000..e0ba939d4 --- /dev/null +++ b/test/source/diff/diff.cxx @@ -0,0 +1,417 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + +#define USE_CPPUNIT 1 + +#include <test/xmldiff.hxx> + +#include <libxml/xpath.h> +#include <libxml/parser.h> + +#include <set> +#include <sstream> +#include <cassert> +#include <vector> + +#if USE_CPPUNIT +#include <cppunit/TestAssert.h> +#endif + +#include <rtl/math.hxx> + +namespace { + +struct tolerance +{ + ~tolerance() + { + xmlFree(elementName); + xmlFree(attribName); + } + + tolerance() + : elementName(nullptr) + , attribName(nullptr) + , relative(false) + , value(0.0) + { + } + + tolerance(const tolerance& tol) + { + elementName = xmlStrdup(tol.elementName); + attribName = xmlStrdup(tol.attribName); + relative = tol.relative; + value = tol.value; + } + + xmlChar* elementName; + xmlChar* attribName; + bool relative; + double value; + bool operator<(const tolerance& rTol) const + { + int cmp = xmlStrcmp(elementName, rTol.elementName); + if(cmp == 0) + { + cmp = xmlStrcmp(attribName, rTol.attribName); + } + + return cmp < 0; + } +}; + +class XMLDiff +{ +public: + XMLDiff(const char* pFileName, const char* pContent, int size, const char* pToleranceFileName); + ~XMLDiff(); + + bool compare(); +private: + typedef std::set<tolerance> ToleranceContainer; + + void loadToleranceFile(xmlDocPtr xmlTolerance); + bool compareAttributes(xmlNodePtr node1, xmlNodePtr node2); + bool compareElements(xmlNode* node1, xmlNode* node2); + + /// Error message for cppunit that prints out when expected and found are not equal. + void cppunitAssertEqual(const xmlChar *expected, const xmlChar *found); + + /// Error message for cppunit that prints out when expected and found are not equal - for doubles. + void cppunitAssertEqualDouble(const xmlNodePtr node, const xmlAttrPtr attr, double expected, double found, double delta); + + ToleranceContainer toleranceContainer; + xmlDocPtr xmlFile1; + xmlDocPtr xmlFile2; + std::string fileName; +}; + +} + +XMLDiff::XMLDiff( const char* pFileName, const char* pContent, int size, const char* pToleranceFile) + : xmlFile1(xmlParseFile(pFileName)) + , xmlFile2(xmlParseMemory(pContent, size)) + , fileName(pFileName) +{ + if(pToleranceFile) + { + xmlDocPtr xmlToleranceFile = xmlParseFile(pToleranceFile); + loadToleranceFile(xmlToleranceFile); + xmlFreeDoc(xmlToleranceFile); + } +} + +XMLDiff::~XMLDiff() +{ + xmlFreeDoc(xmlFile1); + xmlFreeDoc(xmlFile2); +} + +namespace { + +void readAttributesForTolerance(xmlNodePtr node, tolerance& tol) +{ + xmlChar* elementName = xmlGetProp(node, BAD_CAST("elementName")); + tol.elementName = elementName; + + xmlChar* attribName = xmlGetProp(node, BAD_CAST("attribName")); + tol.attribName = attribName; + + xmlChar* value = xmlGetProp(node, BAD_CAST("value")); + double val = xmlXPathCastStringToNumber(value); + xmlFree(value); + tol.value = val; + + xmlChar* relative = xmlGetProp(node, BAD_CAST("relative")); + bool rel = false; + if(xmlStrEqual(relative, BAD_CAST("true"))) + rel = true; + xmlFree(relative); + tol.relative = rel; +} + +} + +void XMLDiff::loadToleranceFile(xmlDocPtr xmlToleranceFile) +{ + xmlNodePtr root = xmlDocGetRootElement(xmlToleranceFile); +#if USE_CPPUNIT + CPPUNIT_ASSERT_MESSAGE("did not find correct tolerance file", xmlStrEqual( root->name, BAD_CAST("tolerances") )); +#else + if(!xmlStrEqual( root->name, BAD_CAST("tolerances") )) + { + assert(false); + return; + } +#endif + xmlNodePtr child = nullptr; + for (child = root->children; child != nullptr; child = child->next) + { + // assume a valid xml file + if(child->type != XML_ELEMENT_NODE) + continue; + + assert(xmlStrEqual(child->name, BAD_CAST("tolerance"))); + + tolerance tol; + readAttributesForTolerance(child, tol); + toleranceContainer.insert(tol); + } +} + +bool XMLDiff::compare() +{ + xmlNode* root1 = xmlDocGetRootElement(xmlFile1); + xmlNode* root2 = xmlDocGetRootElement(xmlFile2); + +#if USE_CPPUNIT + CPPUNIT_ASSERT(root1); + CPPUNIT_ASSERT(root2); + cppunitAssertEqual(root1->name, root2->name); +#else + if (!root1 || !root2) + return false; + if(!xmlStrEqual(root1->name, root2->name)) + return false; +#endif + return compareElements(root1, root2); +} + +namespace { + +bool checkForEmptyChildren(xmlNodePtr node) +{ + if(!node) + return true; + + for(; node != nullptr; node = node->next) + { + if (node->type == XML_ELEMENT_NODE) + return false; + } + return true; +} + +} + +bool XMLDiff::compareElements(xmlNode* node1, xmlNode* node2) +{ +#if USE_CPPUNIT + cppunitAssertEqual(node1->name, node2->name); +#else + if (!xmlStrEqual( node1->name, node2->name )) + return false; +#endif + + //compare attributes + bool sameAttribs = compareAttributes(node1, node2); +#if USE_CPPUNIT + CPPUNIT_ASSERT(sameAttribs); +#else + if (!sameAttribs) + return false; +#endif + + // compare children + xmlNode* child2 = nullptr; + xmlNode* child1 = nullptr; + for(child1 = node1->children, child2 = node2->children; child1 != nullptr && child2 != nullptr; child1 = child1->next, child2 = child2->next) + { + if (child1->type == XML_ELEMENT_NODE) + { + bool bCompare = compareElements(child1, child2); + if(!bCompare) + { + return false; + } + } + } + +#if USE_CPPUNIT + CPPUNIT_ASSERT(checkForEmptyChildren(child1)); + CPPUNIT_ASSERT(checkForEmptyChildren(child2)); +#else + if(!checkForEmptyChildren(child1) || !checkForEmptyChildren(child2)) + return false; +#endif + + return true; +} + +void XMLDiff::cppunitAssertEqual(const xmlChar *expected, const xmlChar *found) +{ +#if USE_CPPUNIT + std::stringstream stringStream; + stringStream << "Reference: " << fileName << "\n- Expected: " << reinterpret_cast<const char*>(expected) << "\n- Found: " << reinterpret_cast<const char*>(found); + + CPPUNIT_ASSERT_MESSAGE(stringStream.str(), xmlStrEqual(expected, found)); +#endif +} + +void XMLDiff::cppunitAssertEqualDouble(const xmlNodePtr node, const xmlAttrPtr attr, double expected, double found, double delta) +{ +#if USE_CPPUNIT + xmlChar * path = xmlGetNodePath(node); + std::stringstream stringStream; + stringStream << "Reference: " << fileName << "\n- Node: " << reinterpret_cast<const char*>(path) << "\n- Attr: " << reinterpret_cast<const char*>(attr->name); + xmlFree(path); + + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(stringStream.str(), expected, found, delta); +#endif +} + +namespace { + +bool compareValuesWithTolerance(double val1, double val2, double tolerance, bool relative) +{ + if(relative) + { + return (val1/tolerance) <= val2 && val2 <= (val1*tolerance); + } + else + { + return (val1 - tolerance) <= val2 && val2 <= (val1 + tolerance); + } +} + +} + +bool XMLDiff::compareAttributes(xmlNodePtr node1, xmlNodePtr node2) +{ + xmlAttrPtr attr1 = nullptr; + xmlAttrPtr attr2 = nullptr; + for(attr1 = node1->properties, attr2 = node2->properties; attr1 != nullptr && attr2 != nullptr; attr1 = attr1->next, attr2 = attr2->next) + { +#if USE_CPPUNIT + cppunitAssertEqual(attr1->name, attr2->name); +#else + if (!xmlStrEqual( attr1->name, attr2->name )) + return false; +#endif + + xmlChar* val1 = xmlGetProp(node1, attr1->name); + xmlChar* val2 = xmlGetProp(node2, attr2->name); + + double dVal1 = xmlXPathCastStringToNumber(val1); + double dVal2 = xmlXPathCastStringToNumber(val2); + + if(!std::isnan(dVal1) || !std::isnan(dVal2)) + { + //compare by value and respect tolerance + tolerance tol; + tol.elementName = xmlStrdup(node1->name); + tol.attribName = xmlStrdup(attr1->name); + ToleranceContainer::iterator itr = toleranceContainer.find( tol ); + bool useTolerance = false; + if (itr != toleranceContainer.end()) + { + useTolerance = true; + } + + if (useTolerance) + { + bool valInTolerance = compareValuesWithTolerance(dVal1, dVal2, itr->value, itr->relative); +#if USE_CPPUNIT + std::stringstream stringStream("Expected Value: "); + stringStream << dVal1 << "; Found Value: " << dVal2 << "; Tolerance: " << itr->value; + stringStream << "; Relative: " << itr->relative; + CPPUNIT_ASSERT_MESSAGE(stringStream.str(), valInTolerance); +#else + if (!valInTolerance) + return false; +#endif + } + else + { +#if USE_CPPUNIT + cppunitAssertEqualDouble(node1, attr1, dVal1, dVal2, 1e-08); +#else + if (dVal1 != dVal2) + return false; +#endif + } + } + else + { + +#if USE_CPPUNIT + cppunitAssertEqual(val1, val2); +#else + if(!xmlStrEqual( val1, val2 )) + return false; +#endif + } + + xmlFree(val1); + xmlFree(val2); + } + + // unequal number of attributes +#ifdef CPPUNIT_ASSERT + if (attr1 || attr2) + { + std::stringstream failStream; + failStream << "Unequal number of attributes in "; + // print chain from document root + std::vector<std::string> parents; + auto n = node1; + while (n) + { + if (n->name) + parents.push_back(std::string(reinterpret_cast<const char *>(n->name))); + n = n->parent; + } + bool first = true; + for (auto it = parents.rbegin(); it != parents.rend(); ++it) + { + if (!first) + failStream << "->"; + first = false; + failStream << *it; + } + failStream << " Attr1: "; + attr1 = node1->properties; + while (attr1 != nullptr) + { + xmlChar* val1 = xmlGetProp(node1, attr1->name); + failStream << BAD_CAST(attr1->name) << "=" << BAD_CAST(val1) << ", "; + xmlFree(val1); + attr1 = attr1->next; + } + + failStream << " Attr2: "; + attr2 = node2->properties; + while (attr2 != nullptr) + { + xmlChar* val2 = xmlGetProp(node2, attr2->name); + failStream << BAD_CAST(attr2->name) << "=" << BAD_CAST(val2) << ", "; + xmlFree(val2); + attr2 = attr2->next; + } + CPPUNIT_ASSERT_MESSAGE(failStream.str(), false); + } +#else + if (attr1 || attr2) + return false; +#endif + + return true; +} + + +bool +doXMLDiff(char const*const pFileName, char const*const pContent, int const size, + char const*const pToleranceFileName) +{ + XMLDiff aDiff(pFileName, pContent, size, pToleranceFileName); + return aDiff.compare(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/document/xactionlockable.cxx b/test/source/document/xactionlockable.cxx new file mode 100644 index 000000000..47d2774ae --- /dev/null +++ b/test/source/document/xactionlockable.cxx @@ -0,0 +1,46 @@ +/* -*- 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/document/xactionlockable.hxx> +#include <sal/types.h> + +#include <com/sun/star/document/XActionLockable.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XActionLockable::testAddRemoveActionLock() +{ + uno::Reference<document::XActionLockable> xAL(init(), uno::UNO_QUERY_THROW); + + xAL->addActionLock(); + CPPUNIT_ASSERT(xAL->isActionLocked()); + + xAL->removeActionLock(); + CPPUNIT_ASSERT(!xAL->isActionLocked()); +} + +void XActionLockable::testSetResetActionLock() +{ + uno::Reference<document::XActionLockable> xAL(init(), uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT_NO_THROW(xAL->setActionLocks(0)); + + const sal_Int16 nLocks = xAL->resetActionLocks(); + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), nLocks); + CPPUNIT_ASSERT(!xAL->isActionLocked()); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/document/xembeddedobjectsupplier.cxx b/test/source/document/xembeddedobjectsupplier.cxx new file mode 100644 index 000000000..baa2ecbfb --- /dev/null +++ b/test/source/document/xembeddedobjectsupplier.cxx @@ -0,0 +1,30 @@ +/* -*- 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/document/xembeddedobjectsupplier.hxx> + +#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XEmbeddedObjectSupplier::testGetEmbeddedObject() +{ + uno::Reference<document::XEmbeddedObjectSupplier> xEOS(init(), uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT(xEOS->getEmbeddedObject()); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/document/xlinktargetsupplier.cxx b/test/source/document/xlinktargetsupplier.cxx new file mode 100644 index 000000000..eec08a900 --- /dev/null +++ b/test/source/document/xlinktargetsupplier.cxx @@ -0,0 +1,30 @@ +/* -*- 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/document/xlinktargetsupplier.hxx> + +#include <com/sun/star/document/XLinkTargetSupplier.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XLinkTargetSupplier::testGetLinks() +{ + uno::Reference<document::XLinkTargetSupplier> xLinkTargetSupplier(init(), UNO_QUERY_THROW); + CPPUNIT_ASSERT(xLinkTargetSupplier->getLinks()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/drawing/captionshape.cxx b/test/source/drawing/captionshape.cxx new file mode 100644 index 000000000..66093e70d --- /dev/null +++ b/test/source/drawing/captionshape.cxx @@ -0,0 +1,178 @@ +/* -*- 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/cppunitasserthelper.hxx> +#include <test/drawing/captionshape.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/awt/Point.hpp> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void CaptionShape::testCaptionShapeProperties() +{ + uno::Reference<beans::XPropertySet> xCaptionShape(init(), UNO_QUERY_THROW); + OUString propName; + uno::Any aNewValue; + + propName = "CornerRadius"; + sal_Int32 nCornerRadiusGet = 5; + sal_Int32 nCornerRadiusSet = 0; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue CornerRadius", + xCaptionShape->getPropertyValue(propName) >>= nCornerRadiusGet); + + aNewValue <<= nCornerRadiusGet + 5; + xCaptionShape->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= nCornerRadiusSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue CornerRadius", nCornerRadiusGet + 5, + nCornerRadiusSet); + + propName = "CaptionPoint"; + awt::Point aCaptionPointGet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue of CaptionPoint", + xCaptionShape->getPropertyValue(propName) >>= aCaptionPointGet); + + awt::Point aCaptionPointSet; + aNewValue <<= awt::Point(5, 5); + xCaptionShape->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= aCaptionPointSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue of CaptionPoint", aCaptionPointSet, + awt::Point(5, 5)); + + propName = "CaptionType"; + sal_Int16 captionTypeGet = 0; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue of CaptionType", + xCaptionShape->getPropertyValue(propName) >>= captionTypeGet); + + sal_Int16 captionTypeSet = 0; + const sal_Int16 FIVE = 5; + aNewValue <<= FIVE; + xCaptionShape->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionTypeSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionType", FIVE, + captionTypeSet); + + propName = "CaptionIsFixedAngle"; + bool captionIsFixedAngleGet = false; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue of CaptionPointIsFixedAngle", + xCaptionShape->getPropertyValue(propName) >>= captionIsFixedAngleGet); + + bool captionIsFixedAngleSet = false; + aNewValue <<= !captionIsFixedAngleGet; + xCaptionShape->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionIsFixedAngleSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionPointisFixedAngle", + captionIsFixedAngleSet, !captionIsFixedAngleGet); + + propName = "CaptionAngle"; + sal_Int32 captionAngleGet = {}; + CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionAngle", + xCaptionShape->getPropertyValue(propName) >>= captionAngleGet); + + sal_Int32 captionAngleSet = 0; + aNewValue <<= captionAngleGet + 5; + xCaptionShape->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionAngleSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionAngle", captionAngleSet, + captionAngleGet + 5); + + propName = "CaptionGap"; + sal_Int32 captionGapGet = {}; + CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionGap", + xCaptionShape->getPropertyValue(propName) >>= captionGapGet); + + sal_Int32 captionGapSet = 0; + aNewValue <<= captionGapGet + 5; + xCaptionShape->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionGapSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionGap", captionGapSet, + captionGapGet + 5); + + propName = "CaptionEscapeDirection"; + sal_Int32 captionEscapeDirectionGet = {}; + CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionEscapeDirection", + xCaptionShape->getPropertyValue(propName) >>= captionEscapeDirectionGet); + + sal_Int32 captionEscapeDirectionSet = 0; + aNewValue <<= captionEscapeDirectionGet + 5; + xCaptionShape->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionEscapeDirectionSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionEscapeDirection", + captionEscapeDirectionSet, captionEscapeDirectionGet + 5); + + propName = "CaptionIsEscapeRelative"; + bool captionIsEscapeRelativeGet = false; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue of CaptionIsEscapeRelative", + xCaptionShape->getPropertyValue(propName) + >>= captionIsEscapeRelativeGet); + + bool captionIsEscapeRelativeSet = false; + aNewValue <<= !captionIsEscapeRelativeGet; + xCaptionShape->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionIsEscapeRelativeSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionIsEscapeRelative", + captionIsEscapeRelativeSet, !captionIsEscapeRelativeGet); + + propName = "CaptionEscapeRelative"; + sal_Int32 captionEscapeRelativeGet = {}; + CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionEscapeRelative", + xCaptionShape->getPropertyValue(propName) >>= captionEscapeRelativeGet); + + sal_Int32 captionEscapeRelativeSet = 0; + aNewValue <<= captionEscapeRelativeGet + 5; + xCaptionShape->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionEscapeRelativeSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionEscapeRelative", + captionEscapeRelativeSet, captionEscapeRelativeGet + 5); + + propName = "CaptionEscapeAbsolute"; + sal_Int32 captionEscapeAbsoluteGet = {}; + CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionEscapeAbsolute", + xCaptionShape->getPropertyValue(propName) >>= captionEscapeAbsoluteGet); + + sal_Int32 captionEscapeAbsoluteSet = 0; + aNewValue <<= captionEscapeAbsoluteGet + 5; + xCaptionShape->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionEscapeAbsoluteSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionEscapeAbsolute", + captionEscapeAbsoluteSet, captionEscapeAbsoluteGet + 5); + + propName = "CaptionLineLength"; + sal_Int32 captionLineLengthGet = {}; + CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionLineLength", + xCaptionShape->getPropertyValue(propName) >>= captionLineLengthGet); + + sal_Int32 captionLineLengthSet = 0; + aNewValue <<= captionLineLengthGet + 5; + xCaptionShape->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionLineLengthSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionEscapeAbsolute", + captionLineLengthSet, captionLineLengthGet + 5); + + propName = "CaptionIsFitLineLength"; + bool captionIsFitLineLengthGet = false; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue of CaptionIsFitLineLength", + xCaptionShape->getPropertyValue(propName) >>= captionIsFitLineLengthGet); + + bool captionIsFitLineLengthSet = false; + aNewValue <<= !captionIsFitLineLengthGet; + xCaptionShape->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xCaptionShape->getPropertyValue(propName) >>= captionIsFitLineLengthSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set the PropertyValue of CaptionIsFitLineLength", + captionIsFitLineLengthSet, !captionIsFitLineLengthGet); +} +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/drawing/xdrawpages.cxx b/test/source/drawing/xdrawpages.cxx new file mode 100644 index 000000000..be57c4852 --- /dev/null +++ b/test/source/drawing/xdrawpages.cxx @@ -0,0 +1,50 @@ +/* -*- 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/drawing/xdrawpages.hxx> + +#include <com/sun/star/drawing/XDrawPage.hpp> +#include <com/sun/star/drawing/XDrawPages.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <sal/types.h> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XDrawPages::testInsertNewByIndex() +{ + uno::Reference<drawing::XDrawPages> xDrawPages(init(), uno::UNO_QUERY_THROW); + const sal_Int32 nCount = xDrawPages->getCount(); + + uno::Reference<drawing::XDrawPage> xDP(xDrawPages->insertNewByIndex(0), uno::UNO_SET_THROW); + CPPUNIT_ASSERT(xDP.is()); + CPPUNIT_ASSERT_EQUAL(nCount + 1, xDrawPages->getCount()); +} + +void XDrawPages::testRemove() +{ + uno::Reference<drawing::XDrawPages> xDrawPages(init(), uno::UNO_QUERY_THROW); + const sal_Int32 nCount = xDrawPages->getCount(); + + uno::Reference<drawing::XDrawPage> xDP(xDrawPages->insertNewByIndex(0), uno::UNO_SET_THROW); + CPPUNIT_ASSERT(xDP.is()); + + xDrawPages->remove(xDP); + CPPUNIT_ASSERT_EQUAL(nCount, xDrawPages->getCount()); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/drawing/xgluepointssupplier.cxx b/test/source/drawing/xgluepointssupplier.cxx new file mode 100644 index 000000000..186c18d71 --- /dev/null +++ b/test/source/drawing/xgluepointssupplier.cxx @@ -0,0 +1,32 @@ +/* -*- 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/drawing/xgluepointssupplier.hxx> + +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/drawing/XGluePointsSupplier.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XGluePointsSupplier::testGetGluePoints() +{ + uno::Reference<drawing::XGluePointsSupplier> xGPS(init(), uno::UNO_QUERY_THROW); + + uno::Reference<container::XIndexContainer> xIC = xGPS->getGluePoints(); + CPPUNIT_ASSERT(xIC->getCount()); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/drawing/xshape.cxx b/test/source/drawing/xshape.cxx new file mode 100644 index 000000000..a63b89265 --- /dev/null +++ b/test/source/drawing/xshape.cxx @@ -0,0 +1,56 @@ +/* -*- 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/drawing/xshape.hxx> +#include <test/cppunitasserthelper.hxx> + +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/drawing/XShape.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XShape::testGetSetPosition() +{ + uno::Reference<drawing::XShape> xShape(init(), uno::UNO_QUERY_THROW); + if (m_bObjSupportsPosition) + { + awt::Point aOldPoint = xShape->getPosition(); + CPPUNIT_ASSERT_NO_THROW( + xShape->setPosition(awt::Point(aOldPoint.X + 100, aOldPoint.Y + 100))); + + awt::Point aNewPoint = xShape->getPosition(); + CPPUNIT_ASSERT_EQUAL(awt::Point(aOldPoint.X + 100, aOldPoint.Y + 100), aNewPoint); + } + CPPUNIT_ASSERT(true); +} + +void XShape::testGetSetSize() +{ + uno::Reference<drawing::XShape> xShape(init(), uno::UNO_QUERY_THROW); + + awt::Size aOldSize = xShape->getSize(); + + CPPUNIT_ASSERT_NO_THROW(xShape->setSize(awt::Size(aOldSize.Width + 10, aOldSize.Height + 10))); + + awt::Size aNewSize = xShape->getSize(); + const sal_Int16 aAcceptableLimit = 2; + CPPUNIT_ASSERT(aOldSize.Height - aNewSize.Height <= aAcceptableLimit); + CPPUNIT_ASSERT(aOldSize.Height - aNewSize.Height <= aAcceptableLimit); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/drawing/xshapedescriptor.cxx b/test/source/drawing/xshapedescriptor.cxx new file mode 100644 index 000000000..ff14513ef --- /dev/null +++ b/test/source/drawing/xshapedescriptor.cxx @@ -0,0 +1,30 @@ +/* -*- 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/drawing/xshapedescriptor.hxx> + +#include <com/sun/star/drawing/XShapeDescriptor.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XShapeDescriptor::testGetShapeType() +{ + uno::Reference<drawing::XShapeDescriptor> xSD(init(), uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL(m_aShapeType, xSD->getShapeType()); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/drawing/xshapegrouper.cxx b/test/source/drawing/xshapegrouper.cxx new file mode 100644 index 000000000..353faa1e7 --- /dev/null +++ b/test/source/drawing/xshapegrouper.cxx @@ -0,0 +1,57 @@ +/* -*- 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/drawing/xshapegrouper.hxx> +#include <sal/types.h> + +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/drawing/XShapeGroup.hpp> +#include <com/sun/star/drawing/XShapeGrouper.hpp> +#include <com/sun/star/drawing/XShapes.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XShapeGrouper::testGroup() +{ + uno::Reference<drawing::XShapeGrouper> xSG(init(), uno::UNO_QUERY_THROW); + + uno::Reference<drawing::XShapes> xShapes(m_xDrawPage, uno::UNO_QUERY_THROW); + const sal_Int32 nCountBeforeGroup = xShapes->getCount(); + + uno::Reference<drawing::XShape> xShape(xSG->group(xShapes), uno::UNO_QUERY_THROW); + const sal_Int32 nCountAfterGroup = xShapes->getCount(); + + CPPUNIT_ASSERT(xShape.is()); + CPPUNIT_ASSERT(nCountAfterGroup < nCountBeforeGroup); +} + +void XShapeGrouper::testUngroup() +{ + uno::Reference<drawing::XShapeGrouper> xSG(init(), uno::UNO_QUERY_THROW); + + uno::Reference<drawing::XShapes> xShapes(m_xDrawPage, uno::UNO_QUERY_THROW); + uno::Reference<drawing::XShape> xShape(xSG->group(xShapes), uno::UNO_QUERY_THROW); + uno::Reference<drawing::XShapeGroup> xShapeGroup(xShape, uno::UNO_QUERY_THROW); + + const sal_Int32 nCountAfterGroup = xShapes->getCount(); + + xSG->ungroup(xShapeGroup); + const sal_Int32 nCountAfterUngroup = xShapes->getCount(); + + CPPUNIT_ASSERT(nCountAfterUngroup != nCountAfterGroup); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/drawing/xshapes.cxx b/test/source/drawing/xshapes.cxx new file mode 100644 index 000000000..d836daf2b --- /dev/null +++ b/test/source/drawing/xshapes.cxx @@ -0,0 +1,38 @@ +/* -*- 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/drawing/xshapes.hxx> +#include <sal/types.h> + +#include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XShapes::testAddRemove() +{ + uno::Reference<drawing::XShapes> xShapes(init(), uno::UNO_QUERY_THROW); + + const sal_Int32 nCountBeforeAdd = xShapes->getCount(); + xShapes->add(m_xShape); + const sal_Int32 nCountAfterAdd = xShapes->getCount(); + CPPUNIT_ASSERT_EQUAL(nCountBeforeAdd + 1, nCountAfterAdd); + + xShapes->remove(m_xShape); + const sal_Int32 nCountAfterRemove = xShapes->getCount(); + CPPUNIT_ASSERT_EQUAL(nCountBeforeAdd, nCountAfterRemove); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/helper/form.cxx b/test/source/helper/form.cxx new file mode 100644 index 000000000..77e6b1635 --- /dev/null +++ b/test/source/helper/form.cxx @@ -0,0 +1,61 @@ +/* -*- 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/helper/form.hxx> +#include <sal/types.h> + +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/drawing/XControlShape.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XInterface.hpp> + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> + +using namespace css; + +namespace apitest::helper::form +{ +uno::Reference<drawing::XControlShape> + OOO_DLLPUBLIC_TEST createCommandButton(const uno::Reference<lang::XComponent>& r_xComponent, + const sal_Int32 nX, const sal_Int32 nY, + const sal_Int32 nHeight, const sal_Int32 nWidth) +{ + return createControlShape(r_xComponent, "CommandButton", nX, nY, nHeight, nWidth); +} + +uno::Reference<drawing::XControlShape> OOO_DLLPUBLIC_TEST createControlShape( + const uno::Reference<lang::XComponent>& r_xComponent, const OUString& r_aKind, + const sal_Int32 nX, const sal_Int32 nY, const sal_Int32 nHeight, const sal_Int32 nWidth) +{ + uno::Reference<lang::XMultiServiceFactory> xMSF(r_xComponent, uno::UNO_QUERY_THROW); + + uno::Reference<drawing::XControlShape> xControlShape( + xMSF->createInstance("com.sun.star.drawing.ControlShape"), uno::UNO_QUERY_THROW); + + uno::Reference<uno::XInterface> aComponent( + xMSF->createInstance("com.sun.star.form.component." + r_aKind), uno::UNO_SET_THROW); + uno::Reference<beans::XPropertySet> xPropertySet(aComponent, uno::UNO_QUERY_THROW); + xPropertySet->setPropertyValue("DefaultControl", + uno::makeAny("com.sun.star.form.control." + r_aKind)); + uno::Reference<awt::XControlModel> xControlModel(aComponent, uno::UNO_QUERY_THROW); + + xControlShape->setSize(awt::Size(nHeight, nWidth)); + xControlShape->setPosition(awt::Point(nX, nY)); + + xControlShape->setControl(xControlModel); + + return xControlShape; +} + +} // namespace apitest::helper::form + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/helper/shape.cxx b/test/source/helper/shape.cxx new file mode 100644 index 000000000..4fafcc0c7 --- /dev/null +++ b/test/source/helper/shape.cxx @@ -0,0 +1,71 @@ +/* -*- 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/helper/shape.hxx> +#include <sal/types.h> + +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/beans/PropertyVetoException.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +using namespace css; + +namespace apitest::helper::shape +{ +uno::Reference<drawing::XShape> + OOO_DLLPUBLIC_TEST createEllipse(const uno::Reference<lang::XComponent>& r_xComponent, + const sal_Int32 nX, const sal_Int32 nY, const sal_Int32 nWidth, + const sal_Int32 nHeight) +{ + return createShape(r_xComponent, "Ellipse", nX, nY, nWidth, nHeight); +} + +uno::Reference<drawing::XShape> + OOO_DLLPUBLIC_TEST createLine(const uno::Reference<lang::XComponent>& r_xComponent, + const sal_Int32 nX, const sal_Int32 nY, const sal_Int32 nWidth, + const sal_Int32 nHeight) +{ + return createShape(r_xComponent, "Line", nX, nY, nWidth, nHeight); +} + +uno::Reference<drawing::XShape> + OOO_DLLPUBLIC_TEST createRectangle(const uno::Reference<lang::XComponent>& r_xComponent, + const sal_Int32 nX, const sal_Int32 nY, + const sal_Int32 nWidth, const sal_Int32 nHeight) +{ + return createShape(r_xComponent, "Rectangle", nX, nY, nWidth, nHeight); +} + +uno::Reference<drawing::XShape> + OOO_DLLPUBLIC_TEST createShape(const uno::Reference<lang::XComponent>& r_xComponent, + const OUString& r_aKind, const sal_Int32 nX, const sal_Int32 nY, + const sal_Int32 nWidth, const sal_Int32 nHeight) +{ + uno::Reference<lang::XMultiServiceFactory> xMSF(r_xComponent, uno::UNO_QUERY_THROW); + uno::Reference<drawing::XShape> xShape( + xMSF->createInstance("com.sun.star.drawing." + r_aKind + "Shape"), uno::UNO_QUERY_THROW); + + try + { + xShape->setPosition(awt::Point(nX, nY)); + xShape->setSize(awt::Size(nWidth, nHeight)); + } + catch (const beans::PropertyVetoException&) + { + } + + return xShape; +} + +} // namespace apitest::helper::shape + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/helper/transferable.cxx b/test/source/helper/transferable.cxx new file mode 100644 index 000000000..e8990d925 --- /dev/null +++ b/test/source/helper/transferable.cxx @@ -0,0 +1,81 @@ +/* -*- 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/helper/transferable.hxx> +#include <com/sun/star/datatransfer/UnsupportedFlavorException.hpp> + +using namespace css; + +namespace apitest::helper::transferable +{ +OString OOO_DLLPUBLIC_TEST getTextSelection( + const css::uno::Reference<css::datatransfer::XTransferable>& xTransferable, OString mimeType) +{ + if (!xTransferable.is()) + return OString(); + + // Take care of UTF-8 text here. + bool bConvert = false; + sal_Int32 nIndex = 0; + if (mimeType.getToken(0, ';', nIndex) == "text/plain") + { + if (mimeType.getToken(0, ';', nIndex) == "charset=utf-8") + { + mimeType = "text/plain;charset=utf-16"; + bConvert = true; + } + } + + datatransfer::DataFlavor aFlavor; + aFlavor.MimeType = OUString::fromUtf8(mimeType.getStr()); + if (mimeType == "text/plain;charset=utf-16") + aFlavor.DataType = cppu::UnoType<OUString>::get(); + else + aFlavor.DataType = cppu::UnoType<uno::Sequence<sal_Int8>>::get(); + + if (!xTransferable.is() || !xTransferable->isDataFlavorSupported(aFlavor)) + return OString(); + + uno::Any aAny; + try + { + aAny = xTransferable->getTransferData(aFlavor); + } + catch (const css::datatransfer::UnsupportedFlavorException&) + { + return OString(); + } + catch (const css::uno::Exception&) + { + return OString(); + } + + OString aRet; + if (aFlavor.DataType == cppu::UnoType<OUString>::get()) + { + OUString aString; + aAny >>= aString; + if (bConvert) + aRet = OUStringToOString(aString, RTL_TEXTENCODING_UTF8); + else + aRet = OString(reinterpret_cast<const char*>(aString.getStr()), + aString.getLength() * sizeof(sal_Unicode)); + } + else + { + uno::Sequence<sal_Int8> aSequence; + aAny >>= aSequence; + aRet = OString(reinterpret_cast<char*>(aSequence.getArray()), aSequence.getLength()); + } + return aRet; +} + +} // namespace apitest::helper::transferable + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/htmltesttools.cxx b/test/source/htmltesttools.cxx new file mode 100644 index 000000000..9f9a1bbdd --- /dev/null +++ b/test/source/htmltesttools.cxx @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/htmltesttools.hxx> + +#include <memory> + +htmlDocUniquePtr HtmlTestTools::parseHtml(utl::TempFile const & aTempFile) +{ + SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ); + htmlDocUniquePtr doc = parseHtmlStream(&aFileStream); + xmlFree(doc->name); + doc->name = reinterpret_cast<char *>( + xmlStrdup( + reinterpret_cast<xmlChar const *>( + OUStringToOString( + aTempFile.GetURL(), RTL_TEXTENCODING_UTF8).getStr()))); + return doc; +} + +htmlDocUniquePtr HtmlTestTools::parseHtmlStream(SvStream* pStream) +{ + std::size_t nSize = pStream->remainingSize(); + std::unique_ptr<sal_uInt8[]> pBuffer(new sal_uInt8[nSize + 1]); + pStream->ReadBytes(pBuffer.get(), nSize); + pBuffer[nSize] = 0; + return htmlDocUniquePtr(htmlParseDoc(reinterpret_cast<xmlChar*>(pBuffer.get()), nullptr)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/isheadless.hxx b/test/source/isheadless.hxx new file mode 100644 index 000000000..c9f22232b --- /dev/null +++ b/test/source/isheadless.hxx @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + +#pragma once + +#include <sal/config.h> + +#include <rtl/process.h> +#include <rtl/ustring.hxx> +#include <sal/types.h> + +namespace test { + +inline bool isHeadless() { + sal_uInt32 n = rtl_getAppCommandArgCount(); + for (sal_uInt32 i = 0; i != n; ++i) { + OUString arg; + rtl_getAppCommandArg(i, &arg.pData); + if (arg == "--headless") { + return true; + } + } + return false; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/lang/xcomponent.cxx b/test/source/lang/xcomponent.cxx new file mode 100644 index 000000000..abe5111e4 --- /dev/null +++ b/test/source/lang/xcomponent.cxx @@ -0,0 +1,80 @@ +/* -*- 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 <cppuhelper/implbase.hxx> +#include <test/lang/xcomponent.hxx> + +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XEventListener.hpp> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; +namespace +{ +struct TestEventListener final : ::cppu::WeakImplHelper<lang::XEventListener> +{ + bool m_hasDisposingCalled; + TestEventListener() + : m_hasDisposingCalled(false) + { + } + virtual void SAL_CALL disposing(const lang::EventObject&) override + { + m_hasDisposingCalled = true; + } +}; +} + +namespace apitest +{ +void XComponent::testAddEventListener() +{ + Reference<lang::XComponent> xComponent(init(), uno::UNO_QUERY_THROW); + auto pListenerAdded(new TestEventListener()); + Reference<lang::XEventListener> xListenerAdded(pListenerAdded); + xComponent->addEventListener(xListenerAdded); + xComponent->dispose(); + CPPUNIT_ASSERT_EQUAL(true, pListenerAdded->m_hasDisposingCalled); +} + +void XComponent::testRemoveEventListener() +{ + Reference<lang::XComponent> xComponent(init(), uno::UNO_QUERY_THROW); + auto pListenerAddedAndRemoved(new TestEventListener()); + Reference<lang::XEventListener> xListenerAddedAndRemoved(pListenerAddedAndRemoved); + xComponent->addEventListener(xListenerAddedAndRemoved); + xComponent->removeEventListener(xListenerAddedAndRemoved); + xComponent->dispose(); + CPPUNIT_ASSERT_EQUAL(false, pListenerAddedAndRemoved->m_hasDisposingCalled); +} + +void XComponent::testDispose() +{ + Reference<lang::XComponent> xComponent(init(), uno::UNO_QUERY_THROW); + auto pListenerAdded(new TestEventListener()); + Reference<lang::XEventListener> xListenerAdded(pListenerAdded); + xComponent->addEventListener(xListenerAdded); + xComponent->dispose(); + CPPUNIT_ASSERT_EQUAL(true, pListenerAdded->m_hasDisposingCalled); +} + +void XComponent::testDisposedByDesktopTerminate() +{ + Reference<lang::XComponent> xComponent(init(), uno::UNO_QUERY_THROW); + auto pListenerAdded(new TestEventListener()); + Reference<lang::XEventListener> xListenerAdded(pListenerAdded); + xComponent->addEventListener(xListenerAdded); + triggerDesktopTerminate(); + CPPUNIT_ASSERT_EQUAL(true, pListenerAdded->m_hasDisposingCalled); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/lang/xserviceinfo.cxx b/test/source/lang/xserviceinfo.cxx new file mode 100644 index 000000000..54a19cf2a --- /dev/null +++ b/test/source/lang/xserviceinfo.cxx @@ -0,0 +1,48 @@ +/* -*- 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/lang/xserviceinfo.hxx> + +#include <com/sun/star/lang/XServiceInfo.hpp> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XServiceInfo::testGetImplementationName() +{ + uno::Reference<lang::XServiceInfo> xSI(init(), uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL(m_aImplName, xSI->getImplementationName()); +} + +void XServiceInfo::testGetSupportedServiceNames() +{ + uno::Reference<lang::XServiceInfo> xSI(init(), uno::UNO_QUERY_THROW); + + uno::Sequence<OUString> aServiceNames = xSI->getSupportedServiceNames(); + CPPUNIT_ASSERT(aServiceNames.hasElements()); +} + +void XServiceInfo::testSupportsService() +{ + uno::Reference<lang::XServiceInfo> xSI(init(), uno::UNO_QUERY_THROW); + + for (const auto& aServiceName : m_aServiceNames) + CPPUNIT_ASSERT(xSI->supportsService(aServiceName)); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/screenshot_test.cxx b/test/source/screenshot_test.cxx new file mode 100644 index 000000000..b1bdf7d98 --- /dev/null +++ b/test/source/screenshot_test.cxx @@ -0,0 +1,279 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 <sal/config.h> + +#include <iostream> + +#include <test/screenshot_test.hxx> + +#include <com/sun/star/frame/Desktop.hpp> +#include <comphelper/processfactory.hxx> +#include <vcl/abstdlg.hxx> +#include <vcl/pngwrite.hxx> +#include <vcl/svapp.hxx> +#include <vcl/virdev.hxx> +#include <vcl/weld.hxx> +#include <tools/stream.hxx> + + +namespace { + void splitHelpId( const OString& rHelpId, OUString& rDirname, OUString &rBasename ) + { + sal_Int32 nIndex = rHelpId.lastIndexOf( '/' ); + + if( nIndex > 0 ) + rDirname = OStringToOUString( rHelpId.copy( 0, nIndex ), RTL_TEXTENCODING_UTF8 ); + + if( rHelpId.getLength() > nIndex+1 ) + rBasename= OStringToOUString( rHelpId.copy( nIndex+1 ), RTL_TEXTENCODING_UTF8 ); + } +} + +using namespace css; +using namespace css::uno; + + /// the target directory for screenshots +static constexpr OUStringLiteral g_aScreenshotDirectory("screenshots"); + +ScreenshotTest::ScreenshotTest() + : maKnownDialogs() + , maParent(nullptr, "vcl/ui/screenshotparent.ui", "ScreenShot") + , mxParentWidget(maParent.getDialog()->weld_content_area()) +{ + maCurrentLanguage = OUString::fromUtf8(getenv("LO_TEST_LOCALE")); +} + +ScreenshotTest::~ScreenshotTest() +{ +} + +void ScreenshotTest::setUp() +{ + test::BootstrapFixture::setUp(); + + mxDesktop = css::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) ); + CPPUNIT_ASSERT_MESSAGE("no desktop!", mxDesktop.is()); + + osl::Directory::create( m_directories.getURLFromWorkdir( g_aScreenshotDirectory)) ; + + // initialize maKnownDialogs + if (maKnownDialogs.empty()) + { + registerKnownDialogsByID(maKnownDialogs); + } +} + +void ScreenshotTest::implSaveScreenshot(const BitmapEx& rScreenshot, const OString& rScreenshotId) +{ + OUString aDirname, aBasename; + splitHelpId(rScreenshotId, aDirname, aBasename); + aDirname = g_aScreenshotDirectory + "/" + aDirname + + ( (maCurrentLanguage == "en-US") ? OUString() : "/" + maCurrentLanguage ); + + auto const dirUrl = m_directories.getURLFromWorkdir(aDirname); + auto const e = osl::Directory::createPath(dirUrl); + if (e != osl::FileBase::E_EXIST) { + CPPUNIT_ASSERT_EQUAL_MESSAGE( + OUStringToOString( + "Failed to create " + dirUrl, RTL_TEXTENCODING_UTF8).getStr(), + osl::FileBase::E_None, e); + } + + auto const pngUrl = OUString(dirUrl + "/" + aBasename + ".png"); + SvFileStream aNew(pngUrl, StreamMode::WRITE | StreamMode::TRUNC); + CPPUNIT_ASSERT_MESSAGE(OUStringToOString("Failed to open <" + pngUrl + ">: " + OUString::number(sal_uInt32(aNew.GetErrorCode())), RTL_TEXTENCODING_UTF8).getStr(), aNew.IsOpen()); + + std::cout << "saving " << pngUrl << ":\n"; + vcl::PNGWriter aPNGWriter(rScreenshot); + aPNGWriter.Write(aNew); +} + +void ScreenshotTest::saveScreenshot(VclAbstractDialog const & rDialog) +{ + const BitmapEx aScreenshot(rDialog.createScreenshot()); + + if (!aScreenshot.IsEmpty()) + { + const OString aScreenshotId = rDialog.GetScreenshotId(); + + if (!aScreenshotId.isEmpty()) + { + implSaveScreenshot(aScreenshot, aScreenshotId); + } + } +} + +void ScreenshotTest::saveScreenshot(weld::Window& rDialog) +{ + VclPtr<VirtualDevice> xDialogSurface(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT)); + rDialog.draw(*xDialogSurface); + const BitmapEx aScreenshot(xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel())); + + if (!aScreenshot.IsEmpty()) + { + const OString aScreenshotId = rDialog.get_help_id(); + assert(!aScreenshotId.isEmpty()); + implSaveScreenshot(aScreenshot, aScreenshotId); + } +} + +VclPtr<VclAbstractDialog> ScreenshotTest::createDialogByName(const OString& rName) +{ + const mapType::const_iterator aHit = maKnownDialogs.find(rName); + + if (aHit != maKnownDialogs.end()) + { + return createDialogByID((*aHit).second); + } + + return VclPtr<VclAbstractDialog>(); +} + +void ScreenshotTest::dumpDialogToPath(VclAbstractDialog& rDialog) +{ + const std::vector<OString> aPageDescriptions(rDialog.getAllPageUIXMLDescriptions()); + + if (!aPageDescriptions.empty()) + { + for (size_t a(0); a < aPageDescriptions.size(); a++) + { + if (rDialog.selectPageByUIXMLDescription(aPageDescriptions[a])) + { + saveScreenshot(rDialog); + } + else + { + CPPUNIT_ASSERT(false); + } + } + } + else + { + saveScreenshot(rDialog); + } +} + +void ScreenshotTest::dumpDialogToPath(weld::Builder& rBuilder) +{ + std::unique_ptr<weld::Window> xDialog(rBuilder.create_screenshot_window()); + + auto xTabCtrl = rBuilder.weld_notebook("tabcontrol"); + + int nPages = xTabCtrl ? xTabCtrl->get_n_pages() : 0; + if (nPages) + { + for (int i = 0; i < nPages; ++i) + { + OString sIdent(xTabCtrl->get_page_ident(i)); + xTabCtrl->set_current_page(sIdent); + if (xTabCtrl->get_current_page_ident() == sIdent) + { + OString sOrigHelpId(xDialog->get_help_id()); + // skip empty pages + weld::Container* pPage = xTabCtrl->get_page(sIdent); + OString sBuildableName(pPage->get_buildable_name()); + if (!sBuildableName.isEmpty() && !sBuildableName.startsWith("__")) + xDialog->set_help_id(pPage->get_help_id()); + saveScreenshot(*xDialog); + xDialog->set_help_id(sOrigHelpId); + } + else + { + CPPUNIT_ASSERT(false); + } + } + } + else + { + saveScreenshot(*xDialog); + } +} + +void ScreenshotTest::dumpDialogToPath(const OString& rUIXMLDescription) +{ + if (!rUIXMLDescription.isEmpty()) + { + bool bNonConforming = rUIXMLDescription == "modules/swriter/ui/sidebarstylepresets.ui" || + rUIXMLDescription == "modules/swriter/ui/sidebartheme.ui" || + rUIXMLDescription == "modules/swriter/ui/notebookbar.ui" || + rUIXMLDescription == "modules/scalc/ui/sidebaralignment.ui" || + rUIXMLDescription == "modules/scalc/ui/sidebarcellappearance.ui" || + rUIXMLDescription == "modules/scalc/ui/sidebarnumberformat.ui" || + rUIXMLDescription == "sfx/ui/helpbookmarkpage.ui" || + rUIXMLDescription == "sfx/ui/helpcontentpage.ui" || + rUIXMLDescription == "sfx/ui/helpindexpage.ui" || + rUIXMLDescription == "sfx/ui/helpsearchpage.ui" || + rUIXMLDescription == "sfx/ui/startcenter.ui" || + rUIXMLDescription == "svx/ui/datanavigator.ui" || + rUIXMLDescription == "svx/ui/xformspage.ui" || + rUIXMLDescription == "modules/dbreport/ui/conditionwin.ui"; + if (bNonConforming) // skip these broken ones + return; + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(mxParentWidget.get(), OStringToOUString(rUIXMLDescription, RTL_TEXTENCODING_UTF8))); + dumpDialogToPath(*xBuilder); + } +} + +void ScreenshotTest::processAllKnownDialogs() +{ + for (const auto& rDialog : getKnownDialogs()) + { + ScopedVclPtr<VclAbstractDialog> pDlg(createDialogByID(rDialog.second)); + + if (pDlg) + { + // known dialog, dump screenshot to path + dumpDialogToPath(*pDlg); + } + else + { + // unknown dialog, should not happen in this basic loop. + // You have probably forgotten to add a case and + // implementation to createDialogByID, please do this + } + } +} + +void ScreenshotTest::processDialogBatchFile(const OUString& rFile) +{ + test::Directories aDirectories; + const OUString aURL(aDirectories.getURLFromSrc(rFile)); + SvFileStream aStream(aURL, StreamMode::READ); + OString aNextUIFile; + const OString aComment("#"); + + while (aStream.ReadLine(aNextUIFile)) + { + if (!aNextUIFile.isEmpty() && !aNextUIFile.startsWith(aComment)) + { + std::cout << "processing " << aNextUIFile << ":\n"; + + // first check if it's a known dialog + ScopedVclPtr<VclAbstractDialog> pDlg(createDialogByName(aNextUIFile)); + + if (pDlg) + { + // known dialog, dump screenshot to path + dumpDialogToPath(*pDlg); + } + else + { + // unknown dialog, try fallback to generic created + // Builder-generated instance. Keep in mind that Dialogs + // using this mechanism will probably not be layouted well + // since the setup/initialization part is missing. Thus, + // only use for fallback when only the UI file is available. + dumpDialogToPath(aNextUIFile); + } + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/setupvcl.cxx b/test/source/setupvcl.cxx new file mode 100644 index 000000000..56c0a3b3c --- /dev/null +++ b/test/source/setupvcl.cxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 <sal/config.h> + +#include <com/sun/star/configuration/theDefaultProvider.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/util/XFlushable.hpp> +#include <comphelper/processfactory.hxx> +#include <i18nlangtag/languagetag.hxx> +#include <i18nlangtag/mslangid.hxx> +#include <unotools/configmgr.hxx> +#include <unotools/syslocaleoptions.hxx> +#include <vcl/svapp.hxx> + +#include "isheadless.hxx" +#include "setupvcl.hxx" + +namespace { + +struct Hook { // LINK only works as a member of a class... + DECL_STATIC_LINK(Hook, deinitHook, LinkParamNone *, void); +}; + +// HACK so that defaultBootstrap_InitialComponentContext (in +// unobootstrapprotector) is called before InitVCL (below), but component +// context is disposed (redundantly again in unobootstrapprotector) from within +// DeInitVCL (cf. Desktop::DeInit, desktop/source/app/app.cxx): +IMPL_STATIC_LINK_NOARG(Hook, deinitHook, LinkParamNone *, void) { + css::uno::Reference<css::uno::XComponentContext> context; + try { + context = comphelper::getProcessComponentContext(); + } catch (css::uno::RuntimeException &) {} + if (context.is()) { + css::uno::Reference<css::lang::XMultiServiceFactory> config; + try { + config = css::configuration::theDefaultProvider::get(context); + } catch (css::uno::DeploymentException &) {} + if (config.is()) { + utl::ConfigManager::storeConfigItems(); + css::uno::Reference<css::util::XFlushable>( + config, css::uno::UNO_QUERY_THROW)->flush(); + } + css::uno::Reference<css::lang::XComponent>( + context, css::uno::UNO_QUERY_THROW)->dispose(); + comphelper::setProcessServiceFactory(nullptr); + } +} + +} + +void test::setUpVcl(bool const forceHeadless) { + // Force locale (and resource files loaded): + OUString locale; + if (getenv("LO_TEST_LOCALE") != nullptr) + locale = OUString::fromUtf8(getenv("LO_TEST_LOCALE")); + else + locale = "en-US"; + + SvtSysLocaleOptions localOptions; + localOptions.SetLocaleConfigString(locale); + localOptions.SetUILocaleConfigString(locale); + LanguageTag tag(locale); + MsLangId::setConfiguredSystemUILanguage(tag.getLanguageType(false)); + LanguageTag::setConfiguredSystemLanguage(tag.getLanguageType(false)); + InitVCL(); + if (forceHeadless || isHeadless()) { + Application::EnableHeadlessMode(false); + } + Application::setDeInitHook(LINK(nullptr, Hook, deinitHook)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/setupvcl.hxx b/test/source/setupvcl.hxx new file mode 100644 index 000000000..78d4683e5 --- /dev/null +++ b/test/source/setupvcl.hxx @@ -0,0 +1,26 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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_SETUPVCL_HXX +#define INCLUDED_TEST_SETUPVCL_HXX + +#include <sal/config.h> + +#include <test/testdllapi.hxx> + +namespace test { + +// Calls InitVCL etc.; needed from multiple places in the test infrastructure: +OOO_DLLPUBLIC_TEST_SETUPVCL void setUpVcl(bool forceHeadless = false); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/cellarealink.cxx b/test/source/sheet/cellarealink.cxx new file mode 100644 index 000000000..d73f4e09c --- /dev/null +++ b/test/source/sheet/cellarealink.cxx @@ -0,0 +1,114 @@ +/* -*- 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/sheet/cellarealink.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void CellAreaLink::testUrl() +{ + uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW); + + const OUString propName("Url"); + + OUString aUrl; + CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aUrl); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Default Url already changed", m_aFileURL, aUrl); + + uno::Any aNewUrl; + aNewUrl <<= OUString("file:///tmp"); + xCellAreaLink->setPropertyValue(propName, aNewUrl); + CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aUrl); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Value of Url wasn't changed", OUString("file:///tmp"), aUrl); +} + +void CellAreaLink::testFilter() +{ + uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW); + + const OUString propName("Filter"); + + OUString aFilter; + CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aFilter); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Default Filter already changed", OUString("calc8"), aFilter); + + uno::Any aNewFilter; + aNewFilter <<= OUString("UnitTest"); + xCellAreaLink->setPropertyValue(propName, aNewFilter); + CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aFilter); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Value of Filter wasn't changed", OUString("UnitTest"), aFilter); +} + +void CellAreaLink::testFilterOptions() +{ + uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW); + + const OUString propName("FilterOptions"); + + OUString aFilterOptions; + CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aFilterOptions); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Default FilterOptions already changed", OUString(""), + aFilterOptions); + + uno::Any aNewFilterOptions; + aNewFilterOptions <<= OUString("UnitTest"); + xCellAreaLink->setPropertyValue(propName, aNewFilterOptions); + CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aFilterOptions); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Value of FilterOptions wasn't changed", OUString("UnitTest"), + aFilterOptions); +} + +void CellAreaLink::testRefreshDelay() +{ + uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW); + + const OUString propName("RefreshDelay"); + + sal_Int32 aRefreshDelay = 0; + CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aRefreshDelay); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Default RefreshDelay already changed", sal_Int32(0), + aRefreshDelay); + + uno::Any aNewRefreshDelay; + aNewRefreshDelay <<= static_cast<sal_Int32>(42); + xCellAreaLink->setPropertyValue(propName, aNewRefreshDelay); + CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aRefreshDelay); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Value of RefreshDelay wasn't changed", sal_Int32(42), + aRefreshDelay); +} + +void CellAreaLink::testRefreshPeriod() +{ + uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW); + + const OUString propName("RefreshPeriod"); + + sal_Int32 aRefreshPeriod = 0; + CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aRefreshPeriod); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Default RefreshPeriod already changed", sal_Int32(0), + aRefreshPeriod); + + uno::Any aNewRefreshPeriod; + aNewRefreshPeriod <<= static_cast<sal_Int32>(42); + xCellAreaLink->setPropertyValue(propName, aNewRefreshPeriod); + CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aRefreshPeriod); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Value of RefreshPeriod wasn't changed", sal_Int32(42), + aRefreshPeriod); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/cellproperties.cxx b/test/source/sheet/cellproperties.cxx new file mode 100644 index 000000000..8650eaa85 --- /dev/null +++ b/test/source/sheet/cellproperties.cxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/cellproperties.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> + +#include <cppunit/TestAssert.h> +#include <iostream> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void CellProperties::testVertJustify() +{ + uno::Reference< beans::XPropertySet > xCellRangeBase(init(),UNO_QUERY_THROW); + OUString aVertJustify("VertJustify"); + uno::Any aOldVertJustify = xCellRangeBase->getPropertyValue(aVertJustify); + sal_Int32 aValue = 0; + CPPUNIT_ASSERT(aOldVertJustify >>= aValue); + std::cout << "Old VertJustify value: " << aValue << std::endl; + + uno::Any aNewVertJustify; + aNewVertJustify <<= static_cast<sal_Int32>(3); + xCellRangeBase->setPropertyValue(aVertJustify, aNewVertJustify); + uno::Any aVertJustifyControllValue = xCellRangeBase->getPropertyValue(aVertJustify); + CPPUNIT_ASSERT(aVertJustifyControllValue >>= aValue); + std::cout << "New VertJustify value: " << aValue << std::endl; + CPPUNIT_ASSERT_EQUAL_MESSAGE("value has not been changed", sal_Int32(3), aValue); +} + +void CellProperties::testRotateReference() +{ + uno::Reference< beans::XPropertySet > xCellRangeBase(init(),UNO_QUERY_THROW); + OUString aRotateReference("RotateReference"); + uno::Any aOldRotateReference = xCellRangeBase->getPropertyValue(aRotateReference); + sal_Int32 aValue = 0; + CPPUNIT_ASSERT(aOldRotateReference >>= aValue); + std::cout << "Old RotateReference Value: " << aValue << std::endl; + + uno::Any aNewRotateReference; + aNewRotateReference <<= static_cast<sal_Int32>(3); + xCellRangeBase->setPropertyValue(aRotateReference, aNewRotateReference); + uno::Any aRotateReferenceControllValue = xCellRangeBase->getPropertyValue(aRotateReference); + CPPUNIT_ASSERT(aRotateReferenceControllValue >>= aValue); + std::cout << "New RotateReference value: " << aValue << std::endl; + CPPUNIT_ASSERT_EQUAL_MESSAGE("value has not been changed", sal_Int32(3), aValue); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/databaseimportdescriptor.cxx b/test/source/sheet/databaseimportdescriptor.cxx new file mode 100644 index 000000000..ea17b871b --- /dev/null +++ b/test/source/sheet/databaseimportdescriptor.cxx @@ -0,0 +1,102 @@ +/* -*- 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/sheet/databaseimportdescriptor.hxx> + +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/sheet/DataImportMode.hpp> +#include <com/sun/star/util/XImportable.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void DatabaseImportDescriptor::testDatabaseImportDescriptorProperties() +{ + uno::Reference<beans::XPropertySet> xDatabaseImportDescriptor(init(), UNO_QUERY_THROW); + uno::Reference<util::XImportable> xImportable(getXImportable(), UNO_QUERY_THROW); + uno::Sequence<beans::PropertyValue> aPropValues = xImportable->createImportDescriptor(true); + + for (auto& rPropValue : aPropValues) + { + uno::Any aOldValue; + uno::Any aNewValue; + if (rPropValue.Name == "DatabaseName" || rPropValue.Name == "SourceObject" + || rPropValue.Name == "ConnectionResource") + { + OUString aValue; + aOldValue = rPropValue.Value; + aOldValue >>= aValue; + OString aMsgGet = "Unable to get PropertyValue " + + OUStringToOString(rPropValue.Name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsgGet.getStr(), OUString(""), aValue); + + aNewValue <<= OUString("New"); + rPropValue.Value = aNewValue; + + aOldValue = rPropValue.Value; + aOldValue >>= aValue; + OString aMsgSet = "Unable to set PropertyValue " + + OUStringToOString(rPropValue.Name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsgSet.getStr(), OUString("New"), aValue); + } + else if (rPropValue.Name == "IsNative") + { + bool aValue = true; + aOldValue = rPropValue.Value; + aOldValue >>= aValue; + OString aMsgGet = "Unable to get PropertyValue " + + OUStringToOString(rPropValue.Name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_MESSAGE(aMsgGet.getStr(), !aValue); + + aNewValue <<= true; + rPropValue.Value = aNewValue; + + aOldValue = rPropValue.Value; + aOldValue >>= aValue; + OString aMsgSet = "Unable to set PropertyValue " + + OUStringToOString(rPropValue.Name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_MESSAGE(aMsgSet.getStr(), aValue); + } + else if (rPropValue.Name == "SourceType") + { + sheet::DataImportMode aValue; + aOldValue = rPropValue.Value; + aOldValue >>= aValue; + OString aMsgGet = "Unable to get PropertyValue " + + OUStringToOString(rPropValue.Name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsgGet.getStr(), sheet::DataImportMode_NONE, aValue); + + aNewValue <<= sheet::DataImportMode_SQL; + rPropValue.Value = aNewValue; + + aOldValue = rPropValue.Value; + aOldValue >>= aValue; + OString aMsgSet = "Unable to set PropertyValue " + + OUStringToOString(rPropValue.Name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsgSet.getStr(), sheet::DataImportMode_SQL, aValue); + } + else + { + OString aMsg = "Unsupported PropertyValue " + + OUStringToOString(rPropValue.Name, RTL_TEXTENCODING_UTF8); + CPPUNIT_FAIL(aMsg.getStr()); + } + } +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/databaserange.cxx b/test/source/sheet/databaserange.cxx new file mode 100644 index 000000000..7079c8ffa --- /dev/null +++ b/test/source/sheet/databaserange.cxx @@ -0,0 +1,216 @@ +/* -*- 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/sheet/databaserange.hxx> +#include <test/cppunitasserthelper.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/sheet/XDatabaseRange.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest { + +void DatabaseRange::testMoveCells() +{ + uno::Reference< beans::XPropertySet > xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); + + const OUString propName("MoveCells"); + + bool bMoveCells = true; + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bMoveCells); + CPPUNIT_ASSERT_MESSAGE("Default MoveCells already changed", !bMoveCells); + + uno::Any aNewMoveCells; + aNewMoveCells <<= true; + xDatabaseRange->setPropertyValue(propName, aNewMoveCells); + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bMoveCells); + CPPUNIT_ASSERT_MESSAGE("Value of MoveCells wasn't changed", bMoveCells); +} + +void DatabaseRange::testKeepFormats() +{ + uno::Reference< beans::XPropertySet > xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); + + const OUString propName("KeepFormats"); + + bool bKeepFormats = true; + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bKeepFormats); + CPPUNIT_ASSERT_MESSAGE("Default KeepFormats already changed", !bKeepFormats); + + uno::Any aNewKeepFormats; + aNewKeepFormats <<= true; + xDatabaseRange->setPropertyValue(propName, aNewKeepFormats); + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bKeepFormats); + CPPUNIT_ASSERT_MESSAGE("Value of KeepFormats wasn't changed", bKeepFormats); +} + +void DatabaseRange::testStripData() +{ + uno::Reference< beans::XPropertySet > xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); + + const OUString propName("StripData"); + + bool bStripData = true; + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bStripData); + CPPUNIT_ASSERT_MESSAGE("Default StripData already changed", !bStripData); + + uno::Any aNewStripData; + aNewStripData <<= true; + xDatabaseRange->setPropertyValue(propName, aNewStripData); + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bStripData); + CPPUNIT_ASSERT_MESSAGE("Value of StripData wasn't changed", bStripData); +} + +void DatabaseRange::testAutoFilter() +{ + uno::Reference< beans::XPropertySet > xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); + + const OUString propName("AutoFilter"); + + bool bAutoFilter = true; + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bAutoFilter); + CPPUNIT_ASSERT_MESSAGE("Default AutoFilter already changed", !bAutoFilter); + + uno::Any aNewAutoFilter; + aNewAutoFilter <<= true; + xDatabaseRange->setPropertyValue(propName, aNewAutoFilter); + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bAutoFilter); + CPPUNIT_ASSERT_MESSAGE("Value of AutoFilter wasn't changed", bAutoFilter); +} + +void DatabaseRange::testUseFilterCriteriaSource() +{ + uno::Reference< beans::XPropertySet > xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); + + const OUString propName("UseFilterCriteriaSource"); + + bool bUseFilterCriteriaSource = true; + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bUseFilterCriteriaSource); + CPPUNIT_ASSERT_MESSAGE("Default UseFilterCriteriaSource already changed", !bUseFilterCriteriaSource); + + uno::Any aNewUseFilterCriteriaSource; + aNewUseFilterCriteriaSource <<= true; + xDatabaseRange->setPropertyValue(propName, aNewUseFilterCriteriaSource); + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bUseFilterCriteriaSource); + CPPUNIT_ASSERT_MESSAGE("Value of UseFilterCriteriaSource wasn't changed", bUseFilterCriteriaSource); +} + +void DatabaseRange::testFilterCriteriaSource() +{ + uno::Reference< beans::XPropertySet > xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); + + const OUString propName("FilterCriteriaSource"); + + table::CellRangeAddress cellRangeAddress; + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= cellRangeAddress); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Default RefreshPeriod already changed", + table::CellRangeAddress(0,0,0,0,0), cellRangeAddress); + + uno::Any aFilterCriteriaSource; + aFilterCriteriaSource <<= table::CellRangeAddress(1,1,1,1,1); + xDatabaseRange->setPropertyValue(propName, aFilterCriteriaSource); + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= cellRangeAddress); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Value of FilterCriteriaSource wasn't changed", + table::CellRangeAddress(1,1,1,1,1), cellRangeAddress); +} + +void DatabaseRange::testRefreshPeriod() +{ + uno::Reference< beans::XPropertySet > xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); + + const OUString propName("RefreshPeriod"); + + sal_Int32 aRefreshPeriod = 1; + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= aRefreshPeriod); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Default RefreshPeriod already changed", sal_Int32(0), aRefreshPeriod); + + uno::Any aNewRefreshPeriod; + aNewRefreshPeriod <<= static_cast<sal_Int32>(42); + xDatabaseRange->setPropertyValue(propName, aNewRefreshPeriod); + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= aRefreshPeriod); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Value of RefreshPeriod wasn't changed", sal_Int32(42), aRefreshPeriod); +} + +void DatabaseRange::testFromSelection() +{ + uno::Reference< beans::XPropertySet > xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); + + const OUString propName("FromSelection"); + + bool bFromSelection = true; + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bFromSelection); + CPPUNIT_ASSERT_MESSAGE("Default FromSelection already changed", !bFromSelection); + + uno::Any aNewFromSelection; + aNewFromSelection <<= true; + xDatabaseRange->setPropertyValue(propName, aNewFromSelection); + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bFromSelection); + CPPUNIT_ASSERT_MESSAGE("Value of FromSelection wasn't changed", bFromSelection); +} + +void DatabaseRange::testTokenIndex() +{ + uno::Reference< beans::XPropertySet > xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); + + const OUString propName("TokenIndex"); + + sal_Int32 aTokenIndex = 0; + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= aTokenIndex); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Default TotalIndex already changed", sal_Int32(1), aTokenIndex); + + uno::Any aNewTokenIndex; + aNewTokenIndex <<= static_cast<sal_Int32>(42); + xDatabaseRange->setPropertyValue(propName, aNewTokenIndex); + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= aTokenIndex); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Value of TotalIndex was changed", sal_Int32(1), aTokenIndex); +} + +void DatabaseRange::testTotalsRow() +{ + uno::Reference< beans::XPropertySet > xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); + + const OUString propName("TotalsRow"); + + bool bTotalsRow = true; + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bTotalsRow); + CPPUNIT_ASSERT_MESSAGE("Default TotalsRow already changed", !bTotalsRow); + + uno::Any aNewTotalsRow; + aNewTotalsRow <<= true; + xDatabaseRange->setPropertyValue(propName, aNewTotalsRow); + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bTotalsRow); + CPPUNIT_ASSERT_MESSAGE("Value of TotalsRow wasn't changed", bTotalsRow); +} + +void DatabaseRange::testContainsHeader() +{ + uno::Reference< beans::XPropertySet > xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); + + const OUString propName("ContainsHeader"); + + bool bContainsHeader = false; + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bContainsHeader); + CPPUNIT_ASSERT_MESSAGE("Default ContainsHeader already changed", bContainsHeader); + + uno::Any aNewContainsHeader; + aNewContainsHeader <<= false; + xDatabaseRange->setPropertyValue(propName, aNewContainsHeader); + CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bContainsHeader); + CPPUNIT_ASSERT_MESSAGE("Value of ContainsHeader wasn't changed", !bContainsHeader); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/datapilotfield.cxx b/test/source/sheet/datapilotfield.cxx new file mode 100644 index 000000000..020f33680 --- /dev/null +++ b/test/source/sheet/datapilotfield.cxx @@ -0,0 +1,189 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/datapilotfield.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp> +#include <com/sun/star/sheet/DataPilotFieldSortMode.hpp> +#include <com/sun/star/sheet/DataPilotFieldReferenceItemType.hpp> +#include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp> +#include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp> +#include <com/sun/star/sheet/DataPilotFieldReference.hpp> +#include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp> + +#include <rtl/ustring.hxx> +#include <cppunit/TestAssert.h> +#include <iostream> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void DataPilotField::testSortInfo() +{ + uno::Reference< beans::XPropertySet> xPropSet(init(),UNO_QUERY_THROW); + sheet::DataPilotFieldSortInfo aSortInfoValue; + OUString aSortInfo("SortInfo"); + aSortInfoValue.Field = "Col1"; + aSortInfoValue.IsAscending = false; + aSortInfoValue.Mode = sheet::DataPilotFieldSortMode::MANUAL; + uno::Any aValue; + aValue <<= aSortInfoValue; + xPropSet->setPropertyValue(aSortInfo, aValue); + + sheet::DataPilotFieldSortInfo aNewSortInfoValue; + aValue = xPropSet->getPropertyValue(aSortInfo); + CPPUNIT_ASSERT( aValue >>= aNewSortInfoValue ); + CPPUNIT_ASSERT_EQUAL_MESSAGE("set value should be the same as got value", aSortInfoValue.Field, aNewSortInfoValue.Field); + CPPUNIT_ASSERT_EQUAL_MESSAGE("set value should be the same as got value", aSortInfoValue.Mode, aNewSortInfoValue.Mode); + CPPUNIT_ASSERT_EQUAL_MESSAGE("set value should be the same as got value", aSortInfoValue.IsAscending, aNewSortInfoValue.IsAscending); + + //setting HasSortInfo only makes sense for false, for true the uno implementation does nothing + bool bHasSortInfo(false); + OUString aHasSortInfo("HasSortInfo"); + aValue = xPropSet->getPropertyValue(aHasSortInfo); + CPPUNIT_ASSERT( aValue >>= bHasSortInfo ); + CPPUNIT_ASSERT_MESSAGE("should have sort info", bHasSortInfo); + + bHasSortInfo = false; + aValue <<= bHasSortInfo; + xPropSet->setPropertyValue(aHasSortInfo, aValue); + + aValue = xPropSet->getPropertyValue(aHasSortInfo); + CPPUNIT_ASSERT( aValue >>= bHasSortInfo ); + CPPUNIT_ASSERT_MESSAGE("should have no sort info", !bHasSortInfo); +} + +void DataPilotField::testLayoutInfo() +{ + uno::Reference< beans::XPropertySet > xPropSet(init(),UNO_QUERY_THROW); + sheet::DataPilotFieldLayoutInfo aLayoutInfoValue; + OUString aLayoutInfo("LayoutInfo"); + aLayoutInfoValue.AddEmptyLines = false; + aLayoutInfoValue.LayoutMode = sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_BOTTOM; + uno::Any aValue; + aValue <<= aLayoutInfoValue; + xPropSet->setPropertyValue(aLayoutInfo, aValue); + + sheet::DataPilotFieldLayoutInfo aNewLayoutInfoValue; + aValue = xPropSet->getPropertyValue(aLayoutInfo); + CPPUNIT_ASSERT( aValue >>= aNewLayoutInfoValue ); + CPPUNIT_ASSERT_EQUAL_MESSAGE("set value should be the same as the got value", aLayoutInfoValue.LayoutMode, aNewLayoutInfoValue.LayoutMode); + CPPUNIT_ASSERT_EQUAL_MESSAGE("set value should be the same as the got value", aLayoutInfoValue.AddEmptyLines, aNewLayoutInfoValue.AddEmptyLines); + + //setting HasLayoutInfo only makes sense for false, tor true the uno implementation does nothing + bool bHasLayoutInfo(false); + OUString aHasLayoutInfo("HasLayoutInfo"); + aValue = xPropSet->getPropertyValue(aHasLayoutInfo); + CPPUNIT_ASSERT( aValue >>= bHasLayoutInfo ); + CPPUNIT_ASSERT_MESSAGE("should have layout information", bHasLayoutInfo); + + bHasLayoutInfo = false; + aValue <<= bHasLayoutInfo; + xPropSet->setPropertyValue(aHasLayoutInfo, aValue); + + aValue = xPropSet->getPropertyValue(aHasLayoutInfo); + CPPUNIT_ASSERT( aValue >>= bHasLayoutInfo ); + CPPUNIT_ASSERT_MESSAGE("should have no longer sort information", !bHasLayoutInfo); +} + +void DataPilotField::testAutoShowInfo() +{ + uno::Reference< beans::XPropertySet > xPropSet(init(),UNO_QUERY_THROW); + sheet::DataPilotFieldAutoShowInfo aAutoShowInfoValue; + aAutoShowInfoValue.DataField = "Col1"; + aAutoShowInfoValue.IsEnabled = true; + OUString aAutoShowInfo("AutoShowInfo"); + uno::Any aValue; + aValue <<= aAutoShowInfoValue; + xPropSet->setPropertyValue(aAutoShowInfo, aValue); + + sheet::DataPilotFieldAutoShowInfo aNewAutoShowInfoValue; + aValue = xPropSet->getPropertyValue(aAutoShowInfo); + CPPUNIT_ASSERT( aValue >>= aNewAutoShowInfoValue ); + CPPUNIT_ASSERT_EQUAL_MESSAGE("set value should be the same as the got value", aAutoShowInfoValue.DataField, aNewAutoShowInfoValue.DataField); + CPPUNIT_ASSERT_EQUAL_MESSAGE("set value should be the same as the got value", aAutoShowInfoValue.IsEnabled, aNewAutoShowInfoValue.IsEnabled); + + //setting HasLayoutInfo only makes sense for false, tor true the uno implementation does nothing + bool bHasAutoShowInfo(false); + OUString aHasAutoShowInfo("HasAutoShowInfo"); + aValue = xPropSet->getPropertyValue(aHasAutoShowInfo); + CPPUNIT_ASSERT( aValue >>= bHasAutoShowInfo ); + CPPUNIT_ASSERT_MESSAGE("should have AutoShow information", bHasAutoShowInfo); + + bHasAutoShowInfo = false; + aValue <<= bHasAutoShowInfo; + xPropSet->setPropertyValue(aHasAutoShowInfo, aValue); + + aValue = xPropSet->getPropertyValue(aHasAutoShowInfo); + CPPUNIT_ASSERT( aValue >>= bHasAutoShowInfo ); + CPPUNIT_ASSERT_MESSAGE("should have no longer AutoShow information", !bHasAutoShowInfo); +} + +void DataPilotField::testReference() +{ + uno::Reference< beans::XPropertySet > xPropSet(init(),UNO_QUERY_THROW); + sheet::DataPilotFieldReference aReferenceValue; + aReferenceValue.ReferenceField = "Col1"; + aReferenceValue.ReferenceItemType = sheet::DataPilotFieldReferenceItemType::NAMED; + OUString aReference("Reference"); + uno::Any aValue; + aValue <<= aReferenceValue; + xPropSet->setPropertyValue(aReference, aValue); + + sheet::DataPilotFieldReference aNewReferenceValue; + aValue = xPropSet->getPropertyValue(aReference); + CPPUNIT_ASSERT( aValue >>= aNewReferenceValue ); + CPPUNIT_ASSERT_EQUAL_MESSAGE("set value should be the same as the got value", aReferenceValue.ReferenceField, aNewReferenceValue.ReferenceField); + CPPUNIT_ASSERT_EQUAL_MESSAGE("set value should be the same as the got value", aReferenceValue.ReferenceItemType, aNewReferenceValue.ReferenceItemType); + + //setting HasReference only makes sense for false, tor true the uno implementation does nothing + bool bHasReference(false); + OUString aHasReference("HasReference"); + aValue = xPropSet->getPropertyValue(aHasReference); + CPPUNIT_ASSERT( aValue >>= bHasReference ); + CPPUNIT_ASSERT_MESSAGE("should have Reference information", bHasReference); + + bHasReference = false; + aValue <<= bHasReference; + xPropSet->setPropertyValue(aHasReference, aValue); + + aValue = xPropSet->getPropertyValue(aHasReference); + CPPUNIT_ASSERT( aValue >>= bHasReference ); + CPPUNIT_ASSERT_MESSAGE("should have no longer reference information", !bHasReference); +} + +void DataPilotField::testIsGroupField() +{ + uno::Reference< beans::XPropertySet > xPropSet(init(),UNO_QUERY_THROW); + uno::Any aValue; + OUString aIsGroupField("IsGroupField"); + bool bIsGroupField(false); + + aValue = xPropSet->getPropertyValue(aIsGroupField); + CPPUNIT_ASSERT( aValue >>= bIsGroupField); + //only setting to false is supported + if (bIsGroupField) + { + bIsGroupField = false; + aValue <<= bIsGroupField; + + xPropSet->setPropertyValue(aIsGroupField, aValue); + aValue = xPropSet->getPropertyValue(aIsGroupField); + CPPUNIT_ASSERT(aValue >>= bIsGroupField); + CPPUNIT_ASSERT_MESSAGE("setting IsGroupField is supported and should have happened", !bIsGroupField); + } + else + std::cout << "Could not test IsGroupField" << std::endl; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/datapilotitem.cxx b/test/source/sheet/datapilotitem.cxx new file mode 100644 index 000000000..33fe34920 --- /dev/null +++ b/test/source/sheet/datapilotitem.cxx @@ -0,0 +1,70 @@ +/* -*- 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/sheet/datapilotitem.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest { + +void DataPilotItem::testProperties() +{ + uno::Reference< beans::XPropertySet > xItem(init(), UNO_QUERY_THROW); + + + const OUString propNameIS("IsHidden"); + + bool bIsHidden = true; + CPPUNIT_ASSERT(xItem->getPropertyValue(propNameIS) >>= bIsHidden); + CPPUNIT_ASSERT_MESSAGE("Default IsHidden already changed", !bIsHidden); + + uno::Any aNewIsHidden; + aNewIsHidden <<= false; + xItem->setPropertyValue(propNameIS, aNewIsHidden); + CPPUNIT_ASSERT(xItem->getPropertyValue(propNameIS) >>= bIsHidden); + CPPUNIT_ASSERT_MESSAGE("Value of IsHidden wasn't changed", !bIsHidden); + + + const OUString propNameSD("ShowDetail"); + + bool bShowDetail = false; + CPPUNIT_ASSERT(xItem->getPropertyValue(propNameSD) >>= bShowDetail); + CPPUNIT_ASSERT_MESSAGE("Default ShowDetail already changed", bShowDetail); + + uno::Any aNewShowDetail; + aNewShowDetail <<= true; + xItem->setPropertyValue(propNameSD, aNewShowDetail); + CPPUNIT_ASSERT(xItem->getPropertyValue(propNameSD) >>= bShowDetail); + CPPUNIT_ASSERT_MESSAGE("Value of ShowDetail wasn't changed", bShowDetail); + + + const OUString propNameP("Position"); + + sal_Int32 nPosition = 42; + CPPUNIT_ASSERT(xItem->getPropertyValue(propNameP) >>= nPosition); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Default Position already changed", sal_Int32(0), nPosition); + + // FIXME: This throws somehow a com.sun.star.lang.IllegalArgumentException + //uno::Any aNewPosition; + //aNewPosition <<= static_cast<sal_Int32>(42); + //xItem->setPropertyValue(propNameP, aNewPosition); + //CPPUNIT_ASSERT(xItem->getPropertyValue(propNameP) >>= nPosition); + //CPPUNIT_ASSERT_EQUAL_MESSAGE("Value of Position wasn't changed", sal_Int32(42), nPosition); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/documentsettings.cxx b/test/source/sheet/documentsettings.cxx new file mode 100644 index 000000000..644b7273c --- /dev/null +++ b/test/source/sheet/documentsettings.cxx @@ -0,0 +1,183 @@ +/* -*- 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/sheet/documentsettings.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void DocumentSettings::testDocumentSettingsProperties() +{ + uno::Reference<beans::XPropertySet> xDocumentSettings(init(), UNO_QUERY_THROW); + OUString propName; + uno::Any aNewValue; + + propName = "ShowZeroValues"; + bool aShowZeroValues = false; + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aShowZeroValues); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ShowZeroValues", aShowZeroValues); + + aNewValue <<= false; + xDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aShowZeroValues); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ShowZeroValues", !aShowZeroValues); + + propName = "ShowNotes"; + bool aShowNotes = false; + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aShowNotes); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ShowNotes", aShowNotes); + + aNewValue <<= false; + xDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aShowNotes); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ShowNotes", !aShowNotes); + + propName = "ShowGrid"; + bool aShowGrid = false; + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aShowGrid); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ShowGrid", aShowGrid); + + aNewValue <<= false; + xDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aShowGrid); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ShowGrid", !aShowGrid); + + propName = "ShowPageBreaks"; + bool aShowPageBreaks = false; + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aShowPageBreaks); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ShowPageBreaks", aShowPageBreaks); + + aNewValue <<= false; + xDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aShowPageBreaks); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ShowPageBreaks", !aShowPageBreaks); + + propName = "HasColumnRowHeaders"; + bool aHasColumnRowHeaders = false; + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aHasColumnRowHeaders); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue HasColumnRowHeaders", aHasColumnRowHeaders); + + aNewValue <<= false; + xDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aHasColumnRowHeaders); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue HasColumnRowHeaders", + !aHasColumnRowHeaders); + + propName = "HasSheetTabs"; + bool aHasSheetTabs = false; + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aHasSheetTabs); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue HasSheetTabs", aHasSheetTabs); + + aNewValue <<= false; + xDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aHasSheetTabs); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue HasSheetTabs", !aHasSheetTabs); + + propName = "IsOutlineSymbolsSet"; + bool aIsOutlineSymbolsSet = false; + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aIsOutlineSymbolsSet); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue IsOutlineSymbolsSet", aIsOutlineSymbolsSet); + + aNewValue <<= false; + xDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aIsOutlineSymbolsSet); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue IsOutlineSymbolsSet", + !aIsOutlineSymbolsSet); + + propName = "IsSnapToRaster"; + bool aIsSnapToRaster = true; + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aIsSnapToRaster); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue IsSnapToRaster", !aIsSnapToRaster); + + aNewValue <<= true; + xDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aIsSnapToRaster); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue IsSnapToRaster", aIsSnapToRaster); + + propName = "RasterIsVisible"; + bool aRasterIsVisible = true; + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterIsVisible); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue RasterIsVisible", !aRasterIsVisible); + + aNewValue <<= true; + xDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterIsVisible); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue RasterIsVisible", aRasterIsVisible); + + propName = "RasterResolutionX"; + sal_Int32 aRasterResolutionX = 0; + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterResolutionX); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue RasterResolutionX", sal_Int32(1270), + aRasterResolutionX); + + aNewValue <<= sal_Int32(42); + xDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterResolutionX); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue RasterResolutionX", sal_Int32(42), + aRasterResolutionX); + + propName = "RasterResolutionY"; + sal_Int32 aRasterResolutionY = 0; + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterResolutionY); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue RasterResolutionY", sal_Int32(1270), + aRasterResolutionY); + + aNewValue <<= sal_Int32(42); + xDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterResolutionY); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue RasterResolutionY", sal_Int32(42), + aRasterResolutionY); + + propName = "RasterSubdivisionX"; + sal_Int32 aRasterSubdivisionX = 0; + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterSubdivisionX); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue RasterSubdivisionX", sal_Int32(1), + aRasterSubdivisionX); + + aNewValue <<= sal_Int32(42); + xDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterSubdivisionX); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue RasterSubdivisionX", sal_Int32(42), + aRasterSubdivisionX); + + propName = "RasterSubdivisionY"; + sal_Int32 aRasterSubdivisionY = 0; + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterSubdivisionY); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue RasterSubdivisionY", sal_Int32(1), + aRasterSubdivisionY); + + aNewValue <<= sal_Int32(42); + xDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aRasterSubdivisionY); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue RasterSubdivisionY", sal_Int32(42), + aRasterSubdivisionY); + + propName = "IsRasterAxisSynchronized"; + bool aIsRasterAxisSynchronized = false; + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aIsRasterAxisSynchronized); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue IsRasterAxisSynchronized", + aIsRasterAxisSynchronized); + + aNewValue <<= false; + xDocumentSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xDocumentSettings->getPropertyValue(propName) >>= aIsRasterAxisSynchronized); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue IsRasterAxisSynchronized", + !aIsRasterAxisSynchronized); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/functiondescription.cxx b/test/source/sheet/functiondescription.cxx new file mode 100644 index 000000000..e90a138e8 --- /dev/null +++ b/test/source/sheet/functiondescription.cxx @@ -0,0 +1,85 @@ +/* -*- 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 <vector> + +#include <test/sheet/functiondescription.hxx> + +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/sheet/FunctionArgument.hpp> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void FunctionDescription::testFunctionDescriptionProperties() +{ + const uno::Sequence<beans::PropertyValue> aFunctionDescription(init()); + + std::vector<OUString> names; + // Only test the get/read operation of the values, because set/write operation doesn't + // make any sense. It doesn't trigger any changes. + // See discussion: nabble.documentfoundation.org/Testing-UNO-API-service-properties-td4236286.html. + for (const auto& value : aFunctionDescription) + { + if (value.Name == "Id") + { + names.push_back(value.Name); + sal_Int32 nValue = 0; + CPPUNIT_ASSERT(value.Value >>= nValue); + } + else if (value.Name == "Category") + { + names.push_back(value.Name); + sal_Int32 nValue = 0; + CPPUNIT_ASSERT(value.Value >>= nValue); + } + else if (value.Name == "Name") + { + names.push_back(value.Name); + OUString sValue; + CPPUNIT_ASSERT(value.Value >>= sValue); + } + else if (value.Name == "Description") + { + names.push_back(value.Name); + OUString sValue; + CPPUNIT_ASSERT(value.Value >>= sValue); + } + else if (value.Name == "Arguments") + { + names.push_back(value.Name); + uno::Sequence<sheet::FunctionArgument> sArguments; + CPPUNIT_ASSERT(value.Value >>= sArguments); + } + else + { + OString aMsg = "Unsupported PropertyValue: " + + OUStringToOString(value.Name, RTL_TEXTENCODING_UTF8); + CPPUNIT_FAIL(aMsg.getStr()); + } + } + + CPPUNIT_ASSERT_MESSAGE("Property Id not found", + std::count(std::begin(names), std::end(names), "Id")); + CPPUNIT_ASSERT_MESSAGE("Property Category not found", + std::count(std::begin(names), std::end(names), "Category")); + CPPUNIT_ASSERT_MESSAGE("Property Name not found", + std::count(std::begin(names), std::end(names), "Name")); + CPPUNIT_ASSERT_MESSAGE("Property Description not found", + std::count(std::begin(names), std::end(names), "Description")); + CPPUNIT_ASSERT_MESSAGE("Property Arguments not found", + std::count(std::begin(names), std::end(names), "Arguments")); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/globalsheetsettings.cxx b/test/source/sheet/globalsheetsettings.cxx new file mode 100644 index 000000000..5018120ae --- /dev/null +++ b/test/source/sheet/globalsheetsettings.cxx @@ -0,0 +1,232 @@ +/* -*- 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/sheet/globalsheetsettings.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void GlobalSheetSettings::testGlobalSheetSettingsProperties() +{ + uno::Reference<beans::XPropertySet> xGlobalSheetSettings(init(), UNO_QUERY_THROW); + OUString propName; + uno::Any aNewValue; + + propName = "MoveSelection"; + bool aMoveSelection = false; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aMoveSelection); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue MoveSelection", aMoveSelection); + + aNewValue <<= false; + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aMoveSelection); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue MoveSelection", !aMoveSelection); + + propName = "MoveDirection"; + sal_Int16 aMoveDirection = 42; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aMoveDirection); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue MoveDirection", sal_Int16(0), + aMoveDirection); + + aNewValue <<= sal_Int16(1); + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aMoveDirection); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue MoveDirection", sal_Int16(1), + aMoveDirection); + + propName = "EnterEdit"; + bool aEnterEdit = true; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aEnterEdit); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue EnterEdit", !aEnterEdit); + + aNewValue <<= true; + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aEnterEdit); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue EnterEdit", aEnterEdit); + + propName = "ExtendFormat"; + bool aExtendFormat = true; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aExtendFormat); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ExtendFormat", !aExtendFormat); + + aNewValue <<= true; + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aExtendFormat); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ExtendFormat", aExtendFormat); + + propName = "RangeFinder"; + bool aRangeFinder = false; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aRangeFinder); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue RangeFinder", aRangeFinder); + + aNewValue <<= false; + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aRangeFinder); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue RangeFinder", !aRangeFinder); + + propName = "ExpandReferences"; + bool aExpandReferences = true; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aExpandReferences); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ExpandReferences", !aExpandReferences); + + aNewValue <<= true; + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aExpandReferences); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ExpandReferences", aExpandReferences); + + propName = "MarkHeader"; + bool aMarkHeader = false; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aMarkHeader); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue MarkHeader", aMarkHeader); + + aNewValue <<= false; + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aMarkHeader); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue MarkHeader", !aMarkHeader); + + propName = "UseTabCol"; + bool aUseTabCol = true; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aUseTabCol); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue UseTabCol", !aUseTabCol); + + aNewValue <<= true; + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aUseTabCol); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue UseTabCol", aUseTabCol); + + propName = "Metric"; + sal_Int16 aMetric = 42; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aMetric); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue Metric", sal_Int16(8), aMetric); + + aNewValue <<= sal_Int16(1); + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aMetric); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue Metric", sal_Int16(1), aMetric); + + propName = "Scale"; + sal_Int16 aScale = 42; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aScale); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue Scale", sal_Int16(100), aScale); + + aNewValue <<= sal_Int16(-1); + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aScale); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue Scale", sal_Int16(-1), aScale); + + propName = "DoAutoComplete"; + bool aDoAutoComplete = false; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aDoAutoComplete); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue DoAutoComplete", aDoAutoComplete); + + aNewValue <<= false; + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aDoAutoComplete); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue DoAutoComplete", !aDoAutoComplete); + + propName = "StatusBarFunction"; + sal_Int16 aStatusBarFunction = 42; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aStatusBarFunction); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue StatusBarFunction", sal_Int16(514), + aStatusBarFunction); + + aNewValue <<= sal_Int16(1); + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aStatusBarFunction); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue StatusBarFunction", sal_Int16(1), + aStatusBarFunction); + + propName = "UserLists"; + uno::Sequence<OUString> aSeq(6); + aSeq[0] = "Sun,Mon,Tue,Wed,Thu,Fri,Sat"; + aSeq[1] = "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday"; + aSeq[2] = "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec"; + aSeq[3] + = "January,February,March,April,May,June,July,August,September,October,November,December"; + aSeq[4] = "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Shabbat"; + aSeq[5] = "Nissan,Iyar,Sivan,Tammuz,Av,Elul,Tishri,Heshvan,Kislev,Tevet,Shevat,Adar,Adar B"; + + uno::Sequence<OUString> aUserLists; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aUserLists); + for (auto i = 0; i < aUserLists.getLength(); i++) + { + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue UserLists[" + std::to_string(i) + + "]", + aSeq[i], aUserLists[i]); + } + + aNewValue <<= uno::Sequence<OUString>(); + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aUserLists); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue UserLists", !aUserLists.hasElements()); + + propName = "LinkUpdateMode"; + sal_Int16 aLinkUpdateMode = 42; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aLinkUpdateMode); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue LinkUpdateMode", sal_Int16(2), + aLinkUpdateMode); + + aNewValue <<= sal_Int16(1); + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aLinkUpdateMode); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue LinkUpdateMode", sal_Int16(1), + aLinkUpdateMode); + + propName = "PrintAllSheets"; + bool aPrintAllSheets = true; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aPrintAllSheets); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue PrintAllSheets", !aPrintAllSheets); + + aNewValue <<= true; + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aPrintAllSheets); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue PrintAllSheets", aPrintAllSheets); + + propName = "PrintEmptyPages"; + bool aPrintEmptyPages = true; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aPrintEmptyPages); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue PrintEmptyPages", !aPrintEmptyPages); + + aNewValue <<= true; + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aPrintEmptyPages); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue PrintEmptyPages", aPrintEmptyPages); + + propName = "UsePrinterMetrics"; + bool aUsePrinterMetrics = true; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aUsePrinterMetrics); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue UsePrinterMetrics", !aUsePrinterMetrics); + + aNewValue <<= true; + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aUsePrinterMetrics); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue UsePrinterMetrics", aUsePrinterMetrics); + + propName = "ReplaceCellsWarning"; + bool aReplaceCellsWarning = false; + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aReplaceCellsWarning); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ReplaceCellsWarning", aReplaceCellsWarning); + + aNewValue <<= false; + xGlobalSheetSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xGlobalSheetSettings->getPropertyValue(propName) >>= aReplaceCellsWarning); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ReplaceCellsWarning", + !aReplaceCellsWarning); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/scenario.cxx b/test/source/sheet/scenario.cxx new file mode 100644 index 000000000..dc96e3cc3 --- /dev/null +++ b/test/source/sheet/scenario.cxx @@ -0,0 +1,113 @@ +/* -*- 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/sheet/scenario.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void Scenario::testScenarioProperties() +{ + uno::Reference<beans::XPropertySet> xScenario(getScenarioSpreadsheet(), UNO_QUERY_THROW); + OUString propName; + uno::Any aNewValue; + + propName = "IsActive"; + bool aIsActive = false; + CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aIsActive); + CPPUNIT_ASSERT_MESSAGE("Unable to get property value IsActive", aIsActive); + + aNewValue <<= false; + xScenario->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aIsActive); + CPPUNIT_ASSERT_MESSAGE("Unable to set property value IsActive", !aIsActive); + + propName = "BorderColor"; + sal_Int32 aBorderColor = 0; + CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aBorderColor); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get property value BorderColor", sal_Int32(12632256), + aBorderColor); + + aNewValue <<= sal_Int32(42); + xScenario->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aBorderColor); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set property value BorderColor", sal_Int32(42), + aBorderColor); + + propName = "Protected"; + bool aProtected = false; + CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aProtected); + CPPUNIT_ASSERT_MESSAGE("Unable to get property value Protected", aProtected); + + aNewValue <<= false; + xScenario->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aProtected); + CPPUNIT_ASSERT_MESSAGE("Unable to set property value Protected", !aProtected); + + propName = "ShowBorder"; + bool aShowBorder = false; + CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aShowBorder); + CPPUNIT_ASSERT_MESSAGE("Unable to get property value ShowBorder", aShowBorder); + + aNewValue <<= false; + xScenario->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aShowBorder); + CPPUNIT_ASSERT_MESSAGE("Unable to set property value ShowBorder", !aShowBorder); + + propName = "PrintBorder"; + bool aPrintBorder = false; + CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aPrintBorder); + CPPUNIT_ASSERT_MESSAGE("Unable to get property value PrintBorder", aPrintBorder); + + aNewValue <<= false; + xScenario->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aPrintBorder); + CPPUNIT_ASSERT_MESSAGE("Unable to set property value PrintBorder", !aPrintBorder); + + propName = "CopyBack"; + bool aCopyBack = false; + CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyBack); + CPPUNIT_ASSERT_MESSAGE("Unable to get property value CopyBack", aCopyBack); + + aNewValue <<= false; + xScenario->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyBack); + CPPUNIT_ASSERT_MESSAGE("Unable to set property value CopyBack", !aCopyBack); + + propName = "CopyStyles"; + bool aCopyStyles = true; + CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyStyles); + CPPUNIT_ASSERT_MESSAGE("Unable to get property value CopyStyles", !aCopyStyles); + + aNewValue <<= true; + xScenario->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyStyles); + CPPUNIT_ASSERT_MESSAGE("Unable to set property value CopyStyles", aCopyStyles); + + propName = "CopyFormulas"; + bool aCopyFormulas = false; + CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyFormulas); + CPPUNIT_ASSERT_MESSAGE("Unable to get property value CopyFormulas", aCopyFormulas); + + aNewValue <<= false; + xScenario->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xScenario->getPropertyValue(propName) >>= aCopyFormulas); + CPPUNIT_ASSERT_MESSAGE("Unable to set property value CopyFormulas", !aCopyFormulas); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/shape.cxx b/test/source/sheet/shape.cxx new file mode 100644 index 000000000..ab2abec6e --- /dev/null +++ b/test/source/sheet/shape.cxx @@ -0,0 +1,115 @@ +/* -*- 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/sheet/shape.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/sheet/XSpreadsheets.hpp> +#include <com/sun/star/table/XCell.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void Shape::testShapePropertiesAnchor() +{ + uno::Reference<beans::XPropertySet> xShape(init(), UNO_QUERY_THROW); + uno::Any aNewValue; + + uno::Reference<sheet::XSpreadsheetDocument> xDoc(getXSheetDocument(), UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), UNO_SET_THROW); + uno::Sequence<OUString> sheetNames = xSheets->getElementNames(); + uno::Reference<sheet::XSpreadsheet> xSheet(xSheets->getByName(sheetNames[0]), UNO_QUERY_THROW); + uno::Reference<table::XCell> xCell(xSheet->getCellByPosition(0, 0), UNO_SET_THROW); + + // Shape should be anchored to sheet by default + uno::Reference<sheet::XSpreadsheet> xSheetGet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Anchor (XSpreadsheet)", + xShape->getPropertyValue("Anchor") >>= xSheetGet); + + // Anchor the shape to a cell + aNewValue <<= xCell; + xShape->setPropertyValue("Anchor", aNewValue); + uno::Reference<table::XCell> xCellGet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Anchor (XCell)", + xShape->getPropertyValue("Anchor") >>= xCellGet); + + // Shape should not resize with cell by default + bool bIsResizeWithCell = {}; + CPPUNIT_ASSERT(xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell); + CPPUNIT_ASSERT_MESSAGE("Shape should not resize with the cell", !bIsResizeWithCell); + + xShape->setPropertyValue("ResizeWithCell", uno::Any(true)); + CPPUNIT_ASSERT(xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell); + CPPUNIT_ASSERT_MESSAGE("Shape should resize with the cell", bIsResizeWithCell); + + // Anchoring to a different cell should keep the "ResizeWithCell" attribute + uno::Reference<table::XCell> xCell2(xSheet->getCellByPosition(1, 2), UNO_SET_THROW); + aNewValue <<= xCell2; + xShape->setPropertyValue("Anchor", aNewValue); + CPPUNIT_ASSERT(xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell); + CPPUNIT_ASSERT_MESSAGE("ResizeWithCell should still be set", bIsResizeWithCell); + + // Now anchor to sheet again + aNewValue <<= xSheet; + xShape->setPropertyValue("Anchor", aNewValue); + CPPUNIT_ASSERT(xShape->getPropertyValue("Anchor") >>= xSheetGet); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Anchor (XSpreadsheet)", + xShape->getPropertyValue("Anchor") >>= xSheetGet); + + // Setting ResizeWithCell while anchored to page should not have any effect + CPPUNIT_ASSERT(xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell); + CPPUNIT_ASSERT_MESSAGE("ResizeWithCell should be false for sheet anchored shapes", + !bIsResizeWithCell); + xShape->setPropertyValue("ResizeWithCell", uno::Any(true)); + CPPUNIT_ASSERT(xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell); + CPPUNIT_ASSERT_MESSAGE("ResizeWithCell should be unchangeable for sheet anchored shapes", + !bIsResizeWithCell); +} + +void Shape::testShapePropertiesPosition() +{ + uno::Reference<beans::XPropertySet> xShape(init(), UNO_QUERY_THROW); + uno::Any aNewValue; + + sal_Int32 nHoriOrientPositionGet = 0; + sal_Int32 nHoriOrientPositionSet = 0; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue HoriOrientPosition", + xShape->getPropertyValue("HoriOrientPosition") + >>= nHoriOrientPositionGet); + + aNewValue <<= nHoriOrientPositionGet + 42; + xShape->setPropertyValue("HoriOrientPosition", aNewValue); + CPPUNIT_ASSERT(xShape->getPropertyValue("HoriOrientPosition") >>= nHoriOrientPositionSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue HoriOrientPosition", + nHoriOrientPositionGet + 42, nHoriOrientPositionSet); + + sal_Int32 nVertOrientPositionGet = 0; + sal_Int32 nVertOrientPositionSet = 0; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue VertOrientPosition", + xShape->getPropertyValue("VertOrientPosition") + >>= nVertOrientPositionGet); + + aNewValue <<= nVertOrientPositionGet + 42; + xShape->setPropertyValue("VertOrientPosition", aNewValue); + CPPUNIT_ASSERT(xShape->getPropertyValue("VertOrientPosition") >>= nVertOrientPositionSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue VertOrientPosition", + nVertOrientPositionGet + 42, nVertOrientPositionSet); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/sheetcell.cxx b/test/source/sheet/sheetcell.cxx new file mode 100644 index 000000000..e30847367 --- /dev/null +++ b/test/source/sheet/sheetcell.cxx @@ -0,0 +1,215 @@ +/* -*- 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/cppunitasserthelper.hxx> +#include <test/sheet/sheetcell.hxx> + +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/sheet/ValidationType.hpp> +#include <com/sun/star/sheet/XSheetConditionalEntry.hpp> +#include <com/sun/star/sheet/XSheetConditionalEntries.hpp> +#include <com/sun/star/table/CellContentType.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void SheetCell::testSheetCellProperties() +{ + uno::Reference<beans::XPropertySet> xSheetCell(init(), UNO_QUERY_THROW); + OUString propName; + uno::Any aNewValue; + + propName = "Position"; + awt::Point aPositionGet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Position", + xSheetCell->getPropertyValue(propName) >>= aPositionGet); + + awt::Point aPositionSet(42, 42); + aNewValue <<= aPositionSet; + xSheetCell->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCell->getPropertyValue(propName) >>= aPositionSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue Position", aPositionGet, aPositionGet); + + propName = "Size"; + awt::Size aSizeGet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Size", + xSheetCell->getPropertyValue(propName) >>= aSizeGet); + + awt::Size aSizeSet(42, 42); + aNewValue <<= aSizeGet; + xSheetCell->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCell->getPropertyValue(propName) >>= aSizeSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue Size", aSizeGet, aSizeSet); + + propName = "FormulaLocal"; + OUString aFormulaLocal = ""; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue FormulaLocal", + xSheetCell->getPropertyValue(propName) >>= aFormulaLocal); + + aNewValue <<= OUString("FormulaLocal"); + xSheetCell->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCell->getPropertyValue(propName) >>= aFormulaLocal); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue FormulaLocal", + OUString("FormulaLocal"), aFormulaLocal); + + propName = "CellContentType"; + table::CellContentType aCellContentTypeGet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue CellContentType", + xSheetCell->getPropertyValue(propName) >>= aCellContentTypeGet); + + table::CellContentType aCellContentTypeSet = table::CellContentType_TEXT; + aNewValue <<= aCellContentTypeSet; + xSheetCell->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCell->getPropertyValue(propName) >>= aCellContentTypeSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue CellContentType", aCellContentTypeGet, + aCellContentTypeSet); + + // Special case, because the API returns the wrong type. + propName = "FormulaResultType"; + table::CellContentType aFormulaResultTypeGet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue FormulaResultType", + xSheetCell->getPropertyValue(propName) >>= aFormulaResultTypeGet); + + table::CellContentType aFormulaResultTypeSet = table::CellContentType_TEXT; + aNewValue <<= aFormulaResultTypeSet; + xSheetCell->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCell->getPropertyValue(propName) >>= aFormulaResultTypeSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue FormulaResultType", + aFormulaResultTypeGet, aFormulaResultTypeSet); + + propName = "FormulaResultType2"; + sal_Int32 aFormulaResultType2Get = 42; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue FormulaResultType2", + xSheetCell->getPropertyValue(propName) >>= aFormulaResultType2Get); + + sal_Int32 aFormulaResultType2Set = 42; + aNewValue <<= aFormulaResultType2Set; + xSheetCell->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCell->getPropertyValue(propName) >>= aFormulaResultType2Set); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue FormulaResultType2", + aFormulaResultType2Get, aFormulaResultType2Set); + + uno::Sequence<beans::PropertyValue> aPropValue(1); + aPropValue[0].Name = "StyleName"; + aPropValue[0].Value <<= OUString("Result2"); + + propName = "ConditionalFormat"; + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatGet; + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatSet; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ConditionalFormat", + xSheetCell->getPropertyValue(propName) >>= aConditionalFormatGet); + + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatNew(aConditionalFormatGet, + UNO_SET_THROW); + aConditionalFormatNew->addNew(aPropValue); + + aNewValue <<= aConditionalFormatNew; + xSheetCell->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCell->getPropertyValue(propName) >>= aConditionalFormatSet); + for (auto i = 0; i < aConditionalFormatSet->getCount(); i++) + { + uno::Reference<sheet::XSheetConditionalEntry> xSCENew(aConditionalFormatNew->getByIndex(i), + UNO_QUERY_THROW); + uno::Reference<sheet::XSheetConditionalEntry> xSCESet(aConditionalFormatSet->getByIndex(i), + UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ConditionalFormat[" + + std::to_string(i) + "]", + xSCENew->getStyleName(), xSCESet->getStyleName()); + } + + propName = "ConditionalFormatLocal"; + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatLocalGet; + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatLocalSet; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ConditionalFormatLocal", + xSheetCell->getPropertyValue(propName) >>= aConditionalFormatLocalGet); + + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatLocalNew( + aConditionalFormatLocalGet, UNO_SET_THROW); + aConditionalFormatLocalNew->addNew(aPropValue); + + aNewValue <<= aConditionalFormatLocalNew; + xSheetCell->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCell->getPropertyValue(propName) >>= aConditionalFormatLocalSet); + for (auto i = 0; i < aConditionalFormatLocalSet->getCount(); i++) + { + uno::Reference<sheet::XSheetConditionalEntry> xSCENew( + aConditionalFormatLocalNew->getByIndex(i), UNO_QUERY_THROW); + uno::Reference<sheet::XSheetConditionalEntry> xSCESet( + aConditionalFormatLocalSet->getByIndex(i), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ConditionalFormatLocal[" + + std::to_string(i) + "]", + xSCENew->getStyleName(), xSCESet->getStyleName()); + } + + propName = "Validation"; + uno::Reference<beans::XPropertySet> aValidationGet; + uno::Reference<beans::XPropertySet> aValidationSet; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Validation", + xSheetCell->getPropertyValue(propName) >>= aValidationGet); + + uno::Reference<beans::XPropertySet> aValidationNew(aValidationGet, UNO_SET_THROW); + uno::Any aValidationType; + aValidationType <<= sheet::ValidationType_WHOLE; + aValidationNew->setPropertyValue("Type", aValidationType); + + aNewValue <<= aValidationNew; + xSheetCell->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCell->getPropertyValue(propName) >>= aValidationSet); + sheet::ValidationType aType; + aValidationSet->getPropertyValue("Type") >>= aType; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue Validation", + sheet::ValidationType_WHOLE, aType); + + propName = "ValidationLocal"; + uno::Reference<beans::XPropertySet> aValidationLocalGet; + uno::Reference<beans::XPropertySet> aValidationLocalSet; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ValidationLocal", + xSheetCell->getPropertyValue(propName) >>= aValidationLocalGet); + + uno::Reference<beans::XPropertySet> aValidationLocalNew(aValidationLocalGet, UNO_SET_THROW); + aValidationType <<= sheet::ValidationType_WHOLE; + aValidationLocalNew->setPropertyValue("Type", aValidationType); + + aNewValue <<= aValidationLocalNew; + xSheetCell->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCell->getPropertyValue(propName) >>= aValidationLocalSet); + aValidationLocalSet->getPropertyValue("Type") >>= aType; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ValidationLocal", + sheet::ValidationType_WHOLE, aType); + + propName = "AbsoluteName"; + OUString aAbsoluteNameGet = ""; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue AbsoluteName", + xSheetCell->getPropertyValue(propName) >>= aAbsoluteNameGet); + + OUString aAbsoluteNameSet = "$Sheet1.$C$3"; + aNewValue <<= aAbsoluteNameSet; + xSheetCell->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCell->getPropertyValue(propName) >>= aAbsoluteNameSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue AbsoluteName", aAbsoluteNameGet, + aAbsoluteNameSet); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/sheetcellrange.cxx b/test/source/sheet/sheetcellrange.cxx new file mode 100644 index 000000000..93d121b3b --- /dev/null +++ b/test/source/sheet/sheetcellrange.cxx @@ -0,0 +1,167 @@ +/* -*- 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/cppunitasserthelper.hxx> +#include <test/sheet/sheetcellrange.hxx> + +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/sheet/ValidationType.hpp> +#include <com/sun/star/sheet/XSheetConditionalEntry.hpp> +#include <com/sun/star/sheet/XSheetConditionalEntries.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void SheetCellRange::testSheetCellRangeProperties() +{ + uno::Reference<beans::XPropertySet> xSheetCellRange(init(), UNO_QUERY_THROW); + OUString propName; + uno::Any aNewValue; + + propName = "Position"; + awt::Point aPositionGet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Position", + xSheetCellRange->getPropertyValue(propName) >>= aPositionGet); + + awt::Point aPositionSet(42, 42); + aNewValue <<= aPositionSet; + xSheetCellRange->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRange->getPropertyValue(propName) >>= aPositionSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue Position", aPositionGet, aPositionGet); + + propName = "Size"; + awt::Size aSizeGet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Size", + xSheetCellRange->getPropertyValue(propName) >>= aSizeGet); + + awt::Size aSizeSet(42, 42); + aNewValue <<= aSizeGet; + xSheetCellRange->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRange->getPropertyValue(propName) >>= aSizeSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue Size", aSizeGet, aSizeSet); + + uno::Sequence<beans::PropertyValue> aPropValue(1); + aPropValue[0].Name = "StyleName"; + aPropValue[0].Value <<= OUString("Result2"); + + propName = "ConditionalFormat"; + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatGet; + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatSet; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ConditionalFormat", + xSheetCellRange->getPropertyValue(propName) >>= aConditionalFormatGet); + + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatNew(aConditionalFormatGet, + UNO_SET_THROW); + aConditionalFormatNew->addNew(aPropValue); + + aNewValue <<= aConditionalFormatNew; + xSheetCellRange->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRange->getPropertyValue(propName) >>= aConditionalFormatSet); + for (auto i = 0; i < aConditionalFormatSet->getCount(); i++) + { + uno::Reference<sheet::XSheetConditionalEntry> xSCENew(aConditionalFormatNew->getByIndex(i), + UNO_QUERY_THROW); + uno::Reference<sheet::XSheetConditionalEntry> xSCESet(aConditionalFormatSet->getByIndex(i), + UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ConditionalFormat[" + + std::to_string(i) + "]", + xSCENew->getStyleName(), xSCESet->getStyleName()); + } + + propName = "ConditionalFormatLocal"; + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatLocalGet; + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatLocalSet; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ConditionalFormatLocal", + xSheetCellRange->getPropertyValue(propName) + >>= aConditionalFormatLocalGet); + + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatLocalNew( + aConditionalFormatLocalGet, UNO_SET_THROW); + aConditionalFormatLocalNew->addNew(aPropValue); + + aNewValue <<= aConditionalFormatLocalNew; + xSheetCellRange->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRange->getPropertyValue(propName) >>= aConditionalFormatLocalSet); + for (auto i = 0; i < aConditionalFormatLocalSet->getCount(); i++) + { + uno::Reference<sheet::XSheetConditionalEntry> xSCENew( + aConditionalFormatLocalNew->getByIndex(i), UNO_QUERY_THROW); + uno::Reference<sheet::XSheetConditionalEntry> xSCESet( + aConditionalFormatLocalSet->getByIndex(i), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ConditionalFormatLocal[" + + std::to_string(i) + "]", + xSCENew->getStyleName(), xSCESet->getStyleName()); + } + + propName = "Validation"; + uno::Reference<beans::XPropertySet> aValidationGet; + uno::Reference<beans::XPropertySet> aValidationSet; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Validation", + xSheetCellRange->getPropertyValue(propName) >>= aValidationGet); + + uno::Reference<beans::XPropertySet> aValidationNew(aValidationGet, UNO_SET_THROW); + uno::Any aValidationType; + aValidationType <<= sheet::ValidationType_WHOLE; + aValidationNew->setPropertyValue("Type", aValidationType); + + aNewValue <<= aValidationNew; + xSheetCellRange->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRange->getPropertyValue(propName) >>= aValidationSet); + sheet::ValidationType aType; + aValidationSet->getPropertyValue("Type") >>= aType; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue Validation", + sheet::ValidationType_WHOLE, aType); + + propName = "ValidationLocal"; + uno::Reference<beans::XPropertySet> aValidationLocalGet; + uno::Reference<beans::XPropertySet> aValidationLocalSet; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ValidationLocal", + xSheetCellRange->getPropertyValue(propName) >>= aValidationLocalGet); + + uno::Reference<beans::XPropertySet> aValidationLocalNew(aValidationLocalGet, UNO_SET_THROW); + aValidationType <<= sheet::ValidationType_WHOLE; + aValidationLocalNew->setPropertyValue("Type", aValidationType); + + aNewValue <<= aValidationLocalNew; + xSheetCellRange->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRange->getPropertyValue(propName) >>= aValidationLocalSet); + aValidationLocalSet->getPropertyValue("Type") >>= aType; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ValidationLocal", + sheet::ValidationType_WHOLE, aType); + + propName = "AbsoluteName"; + OUString aAbsoluteNameGet = ""; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue AbsoluteName", + xSheetCellRange->getPropertyValue(propName) >>= aAbsoluteNameGet); + + OUString aAbsoluteNameSet = "$Sheet1.$C$3"; + aNewValue <<= aAbsoluteNameSet; + xSheetCellRange->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRange->getPropertyValue(propName) >>= aAbsoluteNameSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue AbsoluteName", aAbsoluteNameGet, + aAbsoluteNameSet); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/sheetcellranges.cxx b/test/source/sheet/sheetcellranges.cxx new file mode 100644 index 000000000..d48d28e00 --- /dev/null +++ b/test/source/sheet/sheetcellranges.cxx @@ -0,0 +1,142 @@ +/* -*- 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/sheet/sheetcellranges.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/sheet/ValidationType.hpp> +#include <com/sun/star/sheet/XSheetConditionalEntry.hpp> +#include <com/sun/star/sheet/XSheetConditionalEntries.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void SheetCellRanges::testSheetCellRangesProperties() +{ + uno::Reference<beans::XPropertySet> xSheetCellRanges(init(), UNO_QUERY_THROW); + OUString propName; + uno::Any aNewValue; + + uno::Sequence<beans::PropertyValue> aPropValue(1); + aPropValue[0].Name = "StyleName"; + aPropValue[0].Value <<= OUString("Result2"); + + propName = "ConditionalFormat"; + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatGet; + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatSet; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ConditionalFormat", + xSheetCellRanges->getPropertyValue(propName) >>= aConditionalFormatGet); + + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatNew(aConditionalFormatGet, + UNO_SET_THROW); + aConditionalFormatNew->addNew(aPropValue); + + aNewValue <<= aConditionalFormatNew; + xSheetCellRanges->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRanges->getPropertyValue(propName) >>= aConditionalFormatSet); + for (auto i = 0; i < aConditionalFormatSet->getCount(); i++) + { + uno::Reference<sheet::XSheetConditionalEntry> xSCENew(aConditionalFormatNew->getByIndex(i), + UNO_QUERY_THROW); + uno::Reference<sheet::XSheetConditionalEntry> xSCESet(aConditionalFormatSet->getByIndex(i), + UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ConditionalFormat[" + + std::to_string(i) + "]", + xSCENew->getStyleName(), xSCESet->getStyleName()); + } + + propName = "ConditionalFormatLocal"; + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatLocalGet; + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatLocalSet; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ConditionalFormatLocal", + xSheetCellRanges->getPropertyValue(propName) + >>= aConditionalFormatLocalGet); + + uno::Reference<sheet::XSheetConditionalEntries> aConditionalFormatLocalNew( + aConditionalFormatLocalGet, UNO_SET_THROW); + aConditionalFormatLocalNew->addNew(aPropValue); + + aNewValue <<= aConditionalFormatLocalNew; + xSheetCellRanges->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRanges->getPropertyValue(propName) >>= aConditionalFormatLocalSet); + for (auto i = 0; i < aConditionalFormatLocalSet->getCount(); i++) + { + uno::Reference<sheet::XSheetConditionalEntry> xSCENew( + aConditionalFormatLocalNew->getByIndex(i), UNO_QUERY_THROW); + uno::Reference<sheet::XSheetConditionalEntry> xSCESet( + aConditionalFormatLocalSet->getByIndex(i), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ConditionalFormatLocal[" + + std::to_string(i) + "]", + xSCENew->getStyleName(), xSCESet->getStyleName()); + } + + propName = "Validation"; + uno::Reference<beans::XPropertySet> aValidationGet; + uno::Reference<beans::XPropertySet> aValidationSet; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Validation", + xSheetCellRanges->getPropertyValue(propName) >>= aValidationGet); + + uno::Reference<beans::XPropertySet> aValidationNew(aValidationGet, UNO_SET_THROW); + uno::Any aValidationType; + aValidationType <<= sheet::ValidationType_WHOLE; + aValidationNew->setPropertyValue("Type", aValidationType); + + aNewValue <<= aValidationNew; + xSheetCellRanges->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRanges->getPropertyValue(propName) >>= aValidationSet); + sheet::ValidationType aType; + aValidationSet->getPropertyValue("Type") >>= aType; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue Validation", + sheet::ValidationType_WHOLE, aType); + + propName = "ValidationLocal"; + uno::Reference<beans::XPropertySet> aValidationLocalGet; + uno::Reference<beans::XPropertySet> aValidationLocalSet; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ValidationLocal", + xSheetCellRanges->getPropertyValue(propName) >>= aValidationLocalGet); + + uno::Reference<beans::XPropertySet> aValidationLocalNew(aValidationLocalGet, UNO_SET_THROW); + aValidationType <<= sheet::ValidationType_WHOLE; + aValidationLocalNew->setPropertyValue("Type", aValidationType); + + aNewValue <<= aValidationLocalNew; + xSheetCellRanges->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRanges->getPropertyValue(propName) >>= aValidationLocalSet); + aValidationLocalSet->getPropertyValue("Type") >>= aType; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ValidationLocal", + sheet::ValidationType_WHOLE, aType); + + propName = "AbsoluteName"; + OUString aAbsoluteNameGet = ""; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue AbsoluteName", + xSheetCellRanges->getPropertyValue(propName) >>= aAbsoluteNameGet); + + OUString aAbsoluteNameSet = "$Sheet1.$C$3"; + aNewValue <<= aAbsoluteNameSet; + xSheetCellRanges->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetCellRanges->getPropertyValue(propName) >>= aAbsoluteNameSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue AbsoluteName", aAbsoluteNameGet, + aAbsoluteNameSet); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/sheetfilterdescriptor.cxx b/test/source/sheet/sheetfilterdescriptor.cxx new file mode 100644 index 000000000..3a0b1364d --- /dev/null +++ b/test/source/sheet/sheetfilterdescriptor.cxx @@ -0,0 +1,151 @@ +/* -*- 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/cppunitasserthelper.hxx> +#include <test/sheet/sheetfilterdescriptor.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/table/TableOrientation.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void SheetFilterDescriptor::testSheetFilterDescriptorProperties() +{ + uno::Reference<beans::XPropertySet> xSheetFilterDescriptor(init(), UNO_QUERY_THROW); + OUString propName; + uno::Any aNewValue; + + propName = "IsCaseSensitive"; + bool bIsCaseSensitiveGet = false; + bool bIsCaseSensitiveSet = false; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue IsCaseSensitive", + xSheetFilterDescriptor->getPropertyValue(propName) + >>= bIsCaseSensitiveGet); + + aNewValue <<= !bIsCaseSensitiveGet; + xSheetFilterDescriptor->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName) >>= bIsCaseSensitiveSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue IsCaseSensitive", + !bIsCaseSensitiveGet, bIsCaseSensitiveSet); + + propName = "SkipDuplicates"; + bool bSkipDuplicatesGet = false; + bool bSkipDuplicatesSet = false; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue SkipDuplicates", + xSheetFilterDescriptor->getPropertyValue(propName) + >>= bSkipDuplicatesGet); + + aNewValue <<= !bSkipDuplicatesGet; + xSheetFilterDescriptor->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName) >>= bSkipDuplicatesSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue SkipDuplicates", !bSkipDuplicatesGet, + bSkipDuplicatesSet); + + propName = "UseRegularExpressions"; + bool bUseRegularExpressionsGet = false; + bool bUseRegularExpressionsSet = false; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue UseRegularExpressions", + xSheetFilterDescriptor->getPropertyValue(propName) + >>= bUseRegularExpressionsGet); + + aNewValue <<= !bUseRegularExpressionsGet; + xSheetFilterDescriptor->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName) + >>= bUseRegularExpressionsSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue UseRegularExpressions", + !bUseRegularExpressionsGet, bUseRegularExpressionsSet); + + propName = "SaveOutputPosition"; + bool bSaveOutputPositionGet = false; + bool bSaveOutputPositionSet = false; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue SaveOutputPosition", + xSheetFilterDescriptor->getPropertyValue(propName) + >>= bSaveOutputPositionGet); + + aNewValue <<= !bSaveOutputPositionGet; + xSheetFilterDescriptor->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName) >>= bSaveOutputPositionSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue SaveOutputPosition", + !bSaveOutputPositionGet, bSaveOutputPositionSet); + + propName = "Orientation"; + table::TableOrientation aOrientationGet; + table::TableOrientation aOrientationSet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Orientation", + xSheetFilterDescriptor->getPropertyValue(propName) >>= aOrientationGet); + + aNewValue <<= table::TableOrientation_COLUMNS; + xSheetFilterDescriptor->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName) >>= aOrientationSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue Orientation", + table::TableOrientation_COLUMNS, aOrientationSet); + + propName = "ContainsHeader"; + bool bContainsHeaderGet = false; + bool bContainsHeaderSet = false; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ContainsHeader", + xSheetFilterDescriptor->getPropertyValue(propName) + >>= bContainsHeaderGet); + + aNewValue <<= !bContainsHeaderGet; + xSheetFilterDescriptor->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName) >>= bContainsHeaderSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ContainsHeader", !bContainsHeaderGet, + bContainsHeaderSet); + + propName = "CopyOutputData"; + bool bCopyOutputDataGet = false; + bool bCopyOutputDataSet = false; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue CopyOutputData", + xSheetFilterDescriptor->getPropertyValue(propName) + >>= bCopyOutputDataGet); + + aNewValue <<= !bCopyOutputDataGet; + xSheetFilterDescriptor->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName) >>= bCopyOutputDataSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue CopyOutputData", !bCopyOutputDataGet, + bCopyOutputDataSet); + + propName = "OutputPosition"; + table::CellAddress aCellAddressGet; + table::CellAddress aCellAddressSet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue OutputPosition", + xSheetFilterDescriptor->getPropertyValue(propName) >>= aCellAddressGet); + + aCellAddressGet = table::CellAddress(0, 42, 42); + aNewValue <<= aCellAddressGet; + xSheetFilterDescriptor->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName) >>= aCellAddressSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue OutputPosition", aCellAddressGet, + aCellAddressSet); + + propName = "MaxFieldCount"; + sal_Int32 nMaxFieldCountGet = 0; + sal_Int32 nMaxFieldCountSet = 0; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue MaxFieldCount", + xSheetFilterDescriptor->getPropertyValue(propName) + >>= nMaxFieldCountGet); + + aNewValue <<= nMaxFieldCountGet + 42; + xSheetFilterDescriptor->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetFilterDescriptor->getPropertyValue(propName) >>= nMaxFieldCountSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Able to set PropertyValue MaxFieldCount", nMaxFieldCountGet, + nMaxFieldCountSet); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/sheetlink.cxx b/test/source/sheet/sheetlink.cxx new file mode 100644 index 000000000..de6a2148e --- /dev/null +++ b/test/source/sheet/sheetlink.cxx @@ -0,0 +1,67 @@ +/* -*- 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/sheet/sheetlink.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void SheetLink::testSheetLinkProperties() +{ + uno::Reference<beans::XPropertySet> xSheetLink(init(), UNO_QUERY_THROW); + OUString propName; + uno::Any aNewValue; + + propName = "Url"; + OUString aUrlGet; + OUString aUrlSet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Url", + xSheetLink->getPropertyValue(propName) >>= aUrlGet); + + aNewValue <<= OUString("file:///tmp/ScSheetLinkObj.ods"); + xSheetLink->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetLink->getPropertyValue(propName) >>= aUrlSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue Url", + OUString("file:///tmp/ScSheetLinkObj.ods"), aUrlSet); + + propName = "Filter"; + OUString aFilterGet; + OUString aFilterSet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Filter", + xSheetLink->getPropertyValue(propName) >>= aFilterGet); + + aNewValue <<= OUString("Text - txt - csv (StarCalc)"); + xSheetLink->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetLink->getPropertyValue(propName) >>= aFilterSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue Filter", + OUString("Text - txt - csv (StarCalc)"), aFilterSet); + + propName = "FilterOptions"; + OUString aFilterOptionsGet; + OUString aFilterOptionsSet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue FilterOptions", + xSheetLink->getPropertyValue(propName) >>= aFilterOptionsGet); + + aNewValue <<= OUString("NewValue"); + xSheetLink->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSheetLink->getPropertyValue(propName) >>= aFilterOptionsSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue FilterOptions", OUString("NewValue"), + aFilterOptionsSet); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/sheetsortdescriptor2.cxx b/test/source/sheet/sheetsortdescriptor2.cxx new file mode 100644 index 000000000..3f84d9577 --- /dev/null +++ b/test/source/sheet/sheetsortdescriptor2.cxx @@ -0,0 +1,123 @@ +/* -*- 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/cppunitasserthelper.hxx> +#include <test/sheet/sheetsortdescriptor2.hxx> + +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/util/XSortable.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/table/TableSortField.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +#include <vector> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void SheetSortDescriptor2::testSheetSortDescriptor2Properties() +{ + uno::Reference<util::XSortable> xSortable(init(), UNO_QUERY_THROW); + const uno::Sequence<beans::PropertyValue> values = xSortable->createSortDescriptor(); + + std::vector<OUString> names; + // Only test the get/read operation of the values, because set/write operation doesn't + // make any sense. It doesn't trigger any changes. + // See discussion: nabble.documentfoundation.org/Testing-UNO-API-service-properties-td4236286.html. + for (const auto& value : values) + { + if (value.Name == "BindFormatsToContent") + { + names.push_back(value.Name); + bool bValue = false; + CPPUNIT_ASSERT(value.Value >>= bValue); + } + else if (value.Name == "IsUserListEnabled") + { + names.push_back(value.Name); + bool bValue = false; + CPPUNIT_ASSERT(value.Value >>= bValue); + } + else if (value.Name == "UserListIndex") + { + names.push_back(value.Name); + sal_Int32 nValue = 0; + CPPUNIT_ASSERT(value.Value >>= nValue); + } + else if (value.Name == "CopyOutputData") + { + names.push_back(value.Name); + bool bValue = false; + CPPUNIT_ASSERT(value.Value >>= bValue); + } + else if (value.Name == "OutputPosition") + { + names.push_back(value.Name); + table::CellAddress cellAddr; + CPPUNIT_ASSERT(value.Value >>= cellAddr); + } + else if (value.Name == "SortFields") + { + names.push_back(value.Name); + uno::Sequence<table::TableSortField> sSortFields; + CPPUNIT_ASSERT(value.Value >>= sSortFields); + } + else if (value.Name == "MaxFieldCount") + { + names.push_back(value.Name); + sal_Int32 nValue = 0; + CPPUNIT_ASSERT(value.Value >>= nValue); + } + else if (value.Name == "IsSortColumns") + { + names.push_back(value.Name); + bool bValue = false; + CPPUNIT_ASSERT(value.Value >>= bValue); + } + else if (value.Name == "ContainsHeader") + { + names.push_back(value.Name); + bool bValue = false; + CPPUNIT_ASSERT(value.Value >>= bValue); + } + else + { + OString sMsg = "Unsupported PropertyValue: " + + OUStringToOString(value.Name, RTL_TEXTENCODING_UTF8); + CPPUNIT_FAIL(sMsg.getStr()); + } + } + + CPPUNIT_ASSERT_MESSAGE("Property BindFormatsToContent not found", + std::count(std::begin(names), std::end(names), "BindFormatsToContent")); + CPPUNIT_ASSERT_MESSAGE("Property IsUserListEnabled not found", + std::count(std::begin(names), std::end(names), "IsUserListEnabled")); + CPPUNIT_ASSERT_MESSAGE("Property UserListIndex not found", + std::count(std::begin(names), std::end(names), "UserListIndex")); + CPPUNIT_ASSERT_MESSAGE("Property CopyOutputData not found", + std::count(std::begin(names), std::end(names), "CopyOutputData")); + CPPUNIT_ASSERT_MESSAGE("Property OutputPosition not found", + std::count(std::begin(names), std::end(names), "OutputPosition")); + CPPUNIT_ASSERT_MESSAGE("Property SortFields not found", + std::count(std::begin(names), std::end(names), "SortFields")); + CPPUNIT_ASSERT_MESSAGE("Property MaxFieldCount not found", + std::count(std::begin(names), std::end(names), "MaxFieldCount")); + CPPUNIT_ASSERT_MESSAGE("Property IsSortColumns not found", + std::count(std::begin(names), std::end(names), "IsSortColumns")); + CPPUNIT_ASSERT_MESSAGE("Property ContainsHeader not found", + std::count(std::begin(names), std::end(names), "ContainsHeader")); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/spreadsheet.cxx b/test/source/sheet/spreadsheet.cxx new file mode 100644 index 000000000..8e2ca12cf --- /dev/null +++ b/test/source/sheet/spreadsheet.cxx @@ -0,0 +1,90 @@ +/* -*- 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/sheet/spreadsheet.hxx> +#include <test/unoapi_property_testers.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/sheet/XConditionalFormats.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/text/WritingMode2.hpp> +#include <com/sun/star/util/Color.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void Spreadsheet::testSpreadsheetProperties() +{ + uno::Reference<beans::XPropertySet> xSpreadsheet(init(), UNO_QUERY_THROW); + OUString propName; + uno::Any aNewValue; + + propName = "IsVisible"; + testBooleanProperty(xSpreadsheet, propName); + + propName = "PageStyle"; + testStringProperty(xSpreadsheet, propName, "Report"); + + propName = "TableLayout"; + testShortProperty(xSpreadsheet, propName, text::WritingMode2::RL_TB); + + propName = "AutomaticPrintArea"; + testBooleanProperty(xSpreadsheet, propName); + + propName = "TabColor"; + util::Color aColorGet; + util::Color aColorSet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue: TabColor", + xSpreadsheet->getPropertyValue(propName) >>= aColorGet); + + aNewValue <<= util::Color(42); + xSpreadsheet->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheet->getPropertyValue(propName) >>= aColorSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue: TabColor", util::Color(42), + aColorSet); + + propName = "ConditionalFormats"; + uno::Reference<sheet::XConditionalFormats> xConditionalFormatsGet; + uno::Reference<sheet::XConditionalFormats> xConditionalFormatsSet; + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue: ConditionalFormats", + xSpreadsheet->getPropertyValue(propName) >>= xConditionalFormatsGet); + + uno::Reference<sheet::XSpreadsheetDocument> xDoc(getXSpreadsheetDocument(), UNO_QUERY_THROW); + uno::Reference<container::XIndexAccess> xIA(xDoc->getSheets(), UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet(xIA->getByIndex(0), UNO_QUERY_THROW); + + uno::Reference<lang::XMultiServiceFactory> xMSF(xDoc, UNO_QUERY_THROW); + uno::Reference<container::XNameContainer> xRanges( + xMSF->createInstance("com.sun.star.sheet.SheetCellRanges"), UNO_QUERY_THROW); + uno::Reference<sheet::XSheetCellRanges> xSheetCellRanges(xRanges, UNO_QUERY_THROW); + + uno::Any xCellRange; + xCellRange <<= xSheet->getCellRangeByName("C1:D4"); + xRanges->insertByName("Range1", xCellRange); + xConditionalFormatsGet->createByRange(xSheetCellRanges); + + aNewValue <<= xConditionalFormatsGet; + xSpreadsheet->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheet->getPropertyValue(propName) >>= xConditionalFormatsSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue: ConditionalFormats", sal_Int32(1), + xConditionalFormatsSet->getLength()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/spreadsheetdocumentsettings.cxx b/test/source/sheet/spreadsheetdocumentsettings.cxx new file mode 100644 index 000000000..a1eec4d0d --- /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 <test/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/TestAssert.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("Unable 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: */ diff --git a/test/source/sheet/spreadsheetviewsettings.cxx b/test/source/sheet/spreadsheetviewsettings.cxx new file mode 100644 index 000000000..b77bcb4c6 --- /dev/null +++ b/test/source/sheet/spreadsheetviewsettings.cxx @@ -0,0 +1,241 @@ +/* -*- 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/sheet/spreadsheetviewsettings.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/util/Color.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void SpreadsheetViewSettings::testSpreadsheetViewSettingsProperties() +{ + uno::Reference<beans::XPropertySet> xSpreadsheetViewSettings(init(), UNO_QUERY_THROW); + OUString propName; + uno::Any aNewValue; + + propName = "ShowFormulas"; + bool aShowFormulas = true; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowFormulas); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ShowFormulas", !aShowFormulas); + + aNewValue <<= true; + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowFormulas); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ShowFormulas", aShowFormulas); + + propName = "ShowZeroValues"; + bool aShowZeroValues = false; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowZeroValues); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ShowZeroValues", aShowZeroValues); + + aNewValue <<= false; + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowZeroValues); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ShowZeroValues", !aShowZeroValues); + + propName = "IsValueHighlightingEnabled"; + bool aIsValueHighlightingEnabled = true; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) + >>= aIsValueHighlightingEnabled); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue IsValueHighlightingEnabled", + !aIsValueHighlightingEnabled); + + aNewValue <<= true; + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) + >>= aIsValueHighlightingEnabled); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue IsValueHighlightingEnabled", + aIsValueHighlightingEnabled); + + propName = "ShowNotes"; + bool aShowNotes = false; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowNotes); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ShowNotes", aShowNotes); + + aNewValue <<= false; + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowNotes); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ShowNotes", !aShowNotes); + + propName = "HasVerticalScrollBar"; + bool aHasVerticalScrollBar = false; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aHasVerticalScrollBar); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue HasVerticalScrollBar", + aHasVerticalScrollBar); + + aNewValue <<= false; + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aHasVerticalScrollBar); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue HasVerticalScrollBar", + !aHasVerticalScrollBar); + + propName = "HasHorizontalScrollBar"; + bool aHasHorizontalScrollBar = false; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) + >>= aHasHorizontalScrollBar); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue HasHorizontalScrollBar", + aHasHorizontalScrollBar); + + aNewValue <<= false; + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) + >>= aHasHorizontalScrollBar); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue HasHorizontalScrollBar", + !aHasHorizontalScrollBar); + + propName = "HasSheetTabs"; + bool aHasSheetTabs = false; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aHasSheetTabs); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue HasSheetTabs", aHasSheetTabs); + + aNewValue <<= false; + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aHasSheetTabs); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue HasSheetTabs", !aHasSheetTabs); + + propName = "IsOutlineSymbolsSet"; + bool aIsOutlineSymbolsSet = false; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aIsOutlineSymbolsSet); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue IsOutlineSymbolsSet", aIsOutlineSymbolsSet); + + aNewValue <<= false; + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aIsOutlineSymbolsSet); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue IsOutlineSymbolsSet", + !aIsOutlineSymbolsSet); + + propName = "HasColumnRowHeaders"; + bool aHasColumnRowHeaders = false; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aHasColumnRowHeaders); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue HasColumnRowHeaders", aHasColumnRowHeaders); + + aNewValue <<= false; + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aHasColumnRowHeaders); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue HasColumnRowHeaders", + !aHasColumnRowHeaders); + + propName = "ShowGrid"; + bool aShowGrid = false; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowGrid); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ShowGrid", aShowGrid); + + aNewValue <<= false; + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowGrid); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ShowGrid", !aShowGrid); + + propName = "GridColor"; + util::Color aGridColor; + xSpreadsheetViewSettings->getPropertyValue(propName) >>= aGridColor; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue GridColor", sal_Int32(12632256), + aGridColor); + + aNewValue <<= sal_Int32(42); + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + xSpreadsheetViewSettings->getPropertyValue(propName) >>= aGridColor; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue GridColor", sal_Int32(42), + aGridColor); + + propName = "ShowHelpLines"; + bool aShowHelpLines = true; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowHelpLines); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ShowHelpLines", !aShowHelpLines); + + aNewValue <<= true; + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowHelpLines); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ShowHelpLines", aShowHelpLines); + + propName = "ShowAnchor"; + bool aShowAnchor = false; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowAnchor); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ShowAnchor", aShowAnchor); + + aNewValue <<= false; + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowAnchor); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ShowAnchor", !aShowAnchor); + + propName = "ShowPageBreaks"; + bool aShowPageBreaks = false; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowPageBreaks); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue ShowPageBreaks", aShowPageBreaks); + + aNewValue <<= false; + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowPageBreaks); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue ShowPageBreaks", !aShowPageBreaks); + + propName = "ShowObjects"; + sal_Int16 aShowObjects = 42; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowObjects); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue ShowObjects", sal_Int16(0), + aShowObjects); + + aNewValue <<= sal_Int16(1); + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowObjects); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ShowObjects", sal_Int16(1), + aShowObjects); + + propName = "ShowCharts"; + sal_Int16 aShowCharts = 42; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowCharts); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue ShowCharts", sal_Int16(0), + aShowCharts); + + aNewValue <<= sal_Int16(1); + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowCharts); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ShowCharts", sal_Int16(1), + aShowCharts); + + propName = "ShowDrawing"; + sal_Int16 aShowDrawing = 42; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowDrawing); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue ShowDrawing", sal_Int16(0), + aShowDrawing); + + aNewValue <<= sal_Int16(1); + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aShowDrawing); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ShowDrawing", sal_Int16(1), + aShowDrawing); + + propName = "ZoomType"; + sal_Int16 aZoomType = 42; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aZoomType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue ZoomType", sal_Int16(3), aZoomType); + + aNewValue <<= sal_Int16(1); + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aZoomType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ZoomType", sal_Int16(1), aZoomType); + + propName = "ZoomValue"; + sal_Int16 aZoomValue = 42; + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aZoomValue); + + aNewValue <<= sal_Int16(1); + xSpreadsheetViewSettings->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSpreadsheetViewSettings->getPropertyValue(propName) >>= aZoomValue); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue ZoomValue", sal_Int16(1), aZoomValue); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/subtotaldescriptor.cxx b/test/source/sheet/subtotaldescriptor.cxx new file mode 100644 index 000000000..e9dffdb75 --- /dev/null +++ b/test/source/sheet/subtotaldescriptor.cxx @@ -0,0 +1,116 @@ +/* -*- 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/sheet/subtotaldescriptor.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void SubTotalDescriptor::testSubTotalDescriptorProperties() +{ + uno::Reference<beans::XPropertySet> xSubTotalDescriptor(init(), UNO_QUERY_THROW); + OUString propName; + uno::Any aNewValue; + + propName = "InsertPageBreaks"; + bool aInsertPageBreaks = true; + CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aInsertPageBreaks); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue InsertPageBreaks", !aInsertPageBreaks); + + aNewValue <<= true; + xSubTotalDescriptor->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aInsertPageBreaks); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue InsertPageBreaks", aInsertPageBreaks); + + propName = "IsCaseSensitive"; + bool aIsCaseSensitive = true; + CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aIsCaseSensitive); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue IsCaseSensitive", !aIsCaseSensitive); + + aNewValue <<= true; + xSubTotalDescriptor->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aIsCaseSensitive); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue IsCaseSensitive", aIsCaseSensitive); + + propName = "EnableUserSortList"; + bool aEnableUserSortList = true; + CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aEnableUserSortList); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue EnableUserSortList", !aEnableUserSortList); + + aNewValue <<= true; + xSubTotalDescriptor->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aEnableUserSortList); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue EnableUserSortList", aEnableUserSortList); + + propName = "UserSortListIndex"; + sal_Int32 aUserSortListIndex = 42; + CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aUserSortListIndex); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue UserSortListIndex", sal_Int32(0), + aUserSortListIndex); + + aNewValue <<= sal_Int32(42); + xSubTotalDescriptor->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aUserSortListIndex); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue UserSortListIndex", sal_Int32(42), + aUserSortListIndex); + + propName = "BindFormatsToContent"; + bool aBindFormatsToContent = true; + CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aBindFormatsToContent); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue BindFormatsToContent", + !aBindFormatsToContent); + + aNewValue <<= true; + xSubTotalDescriptor->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aBindFormatsToContent); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue BindFormatsToContent", + aBindFormatsToContent); + + propName = "EnableSort"; + bool aEnableSort = false; + CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aEnableSort); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue EnableSort", aEnableSort); + + aNewValue <<= false; + xSubTotalDescriptor->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aEnableSort); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue EnableSort", !aEnableSort); + + propName = "SortAscending"; + bool aSortAscending = false; + CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aSortAscending); + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue SortAscending", aSortAscending); + + aNewValue <<= false; + xSubTotalDescriptor->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aSortAscending); + CPPUNIT_ASSERT_MESSAGE("Unable to set PropertyValue SortAscending", !aSortAscending); + + propName = "MaxFieldCount"; + sal_Int32 aMaxFieldCount = 42; + CPPUNIT_ASSERT(xSubTotalDescriptor->getPropertyValue(propName) >>= aMaxFieldCount); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get PropertyValue MaxFieldCount", sal_Int32(3), + aMaxFieldCount); + + aNewValue <<= sal_Int32(42); + CPPUNIT_ASSERT_THROW_MESSAGE("Able to change PropertyValue MaxFieldCount", + xSubTotalDescriptor->setPropertyValue(propName, aNewValue), + lang::IllegalArgumentException); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/tableautoformat.cxx b/test/source/sheet/tableautoformat.cxx new file mode 100644 index 000000000..2d5595f0a --- /dev/null +++ b/test/source/sheet/tableautoformat.cxx @@ -0,0 +1,94 @@ +/* -*- 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/sheet/tableautoformat.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void TableAutoFormat::testTableAutoFormatProperties() +{ + uno::Reference<beans::XPropertySet> xTableAutoFormat(init(), UNO_QUERY_THROW); + OUString propName; + uno::Any aNewValue; + + propName = "IncludeFont"; + bool aIncludeFont = false; + CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeFont", + xTableAutoFormat->getPropertyValue(propName) >>= aIncludeFont); + + aNewValue <<= false; + xTableAutoFormat->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeFont); + CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeFont", !aIncludeFont); + + propName = "IncludeJustify"; + bool aIncludeJustify = false; + CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeJustify", + xTableAutoFormat->getPropertyValue(propName) >>= aIncludeJustify); + + aNewValue <<= false; + xTableAutoFormat->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeJustify); + CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeJustify", !aIncludeJustify); + + propName = "IncludeBorder"; + bool aIncludeBorder = false; + CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeBorder", + xTableAutoFormat->getPropertyValue(propName) >>= aIncludeBorder); + + aNewValue <<= false; + xTableAutoFormat->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeBorder); + CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeBorder", !aIncludeBorder); + + propName = "IncludeBackground"; + bool aIncludeBackground = false; + CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeBackground", + xTableAutoFormat->getPropertyValue(propName) >>= aIncludeBackground); + + aNewValue <<= false; + xTableAutoFormat->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeBackground); + CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeBackground", !aIncludeBackground); + + propName = "IncludeNumberFormat"; + bool aIncludeNumberFormat = false; + CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeNumberFormat", + xTableAutoFormat->getPropertyValue(propName) >>= aIncludeNumberFormat); + + aNewValue <<= false; + xTableAutoFormat->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeNumberFormat); + CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeNumberFormat", + !aIncludeNumberFormat); + + propName = "IncludeWidthAndHeight"; + bool aIncludeWidthAndHeight = false; + CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeWidthAndHeight); + CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeWidthAndHeight", + aIncludeWidthAndHeight); + + aNewValue <<= false; + xTableAutoFormat->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeWidthAndHeight); + CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeWidthAndHeight", + !aIncludeWidthAndHeight); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/tablevalidation.cxx b/test/source/sheet/tablevalidation.cxx new file mode 100644 index 000000000..438301960 --- /dev/null +++ b/test/source/sheet/tablevalidation.cxx @@ -0,0 +1,153 @@ +/* -*- 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/sheet/tablevalidation.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/sheet/ValidationAlertStyle.hpp> +#include <com/sun/star/sheet/ValidationType.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void TableValidation::testTableValidationProperties() +{ + uno::Reference<beans::XPropertySet> xTableValidation(init(), UNO_QUERY_THROW); + OUString propName; + uno::Any aNewValue; + + propName = "Type"; + uno::Any aValue = xTableValidation->getPropertyValue(propName); + sheet::ValidationType aValidationType; + aValue >>= aValidationType; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get property value Type", sheet::ValidationType_ANY, + aValidationType); + + aNewValue <<= sheet::ValidationType_WHOLE; + xTableValidation->setPropertyValue(propName, aNewValue); + aValue = xTableValidation->getPropertyValue(propName); + aValue >>= aValidationType; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set property value Type", sheet::ValidationType_WHOLE, + aValidationType); + + propName = "ShowInputMessage"; + bool aShowInputMessage = true; + CPPUNIT_ASSERT(xTableValidation->getPropertyValue(propName) >>= aShowInputMessage); + CPPUNIT_ASSERT_MESSAGE("Unable to get property value ShowInputMessage", !aShowInputMessage); + + aNewValue <<= true; + xTableValidation->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xTableValidation->getPropertyValue(propName) >>= aShowInputMessage); + CPPUNIT_ASSERT_MESSAGE("Unable to set property value ShowInputMessage", aShowInputMessage); + + // only possible if ShowInputMessage is true + propName = "InputMessage"; + OUString aInputMessage; + CPPUNIT_ASSERT(xTableValidation->getPropertyValue(propName) >>= aInputMessage); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get property value InputMessage", OUString(""), + aInputMessage); + + aNewValue <<= OUString("UnitTest InputMessage"); + xTableValidation->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xTableValidation->getPropertyValue(propName) >>= aInputMessage); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get property value InputMessage", + OUString("UnitTest InputMessage"), aInputMessage); + + // only possible if ShowInputMessage is true + propName = "InputTitle"; + OUString aInputTitle; + CPPUNIT_ASSERT(xTableValidation->getPropertyValue(propName) >>= aInputTitle); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get property value InputTitle", OUString(""), + aInputTitle); + + aNewValue <<= OUString("UnitTest InputTitle"); + xTableValidation->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xTableValidation->getPropertyValue(propName) >>= aInputTitle); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get property value InputTitle", + OUString("UnitTest InputTitle"), aInputTitle); + + propName = "ShowErrorMessage"; + bool aShowErrorMessage = true; + CPPUNIT_ASSERT(xTableValidation->getPropertyValue(propName) >>= aShowErrorMessage); + CPPUNIT_ASSERT_MESSAGE("Unable to get property value ShowErrorMessage", !aShowErrorMessage); + + aNewValue <<= true; + xTableValidation->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xTableValidation->getPropertyValue(propName) >>= aShowErrorMessage); + CPPUNIT_ASSERT_MESSAGE("Unable to set property value ShowErrorMessage", aShowErrorMessage); + + // only possible if ShowErrorMessage is true + propName = "ErrorMessage"; + OUString aErrorMessage; + CPPUNIT_ASSERT(xTableValidation->getPropertyValue(propName) >>= aErrorMessage); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get property value ErrorMessage", OUString(""), + aErrorMessage); + + aNewValue <<= OUString("UnitTest ErrorMessage"); + xTableValidation->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xTableValidation->getPropertyValue(propName) >>= aErrorMessage); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get property value ErrorMessage", + OUString("UnitTest ErrorMessage"), aErrorMessage); + + // only possible if ShowErrorMessage is true + propName = "ErrorTitle"; + OUString aErrorTitle; + CPPUNIT_ASSERT(xTableValidation->getPropertyValue(propName) >>= aErrorTitle); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get property value ErrorTitle", OUString(""), + aErrorTitle); + + aNewValue <<= OUString("UnitTest ErrorTitle"); + xTableValidation->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xTableValidation->getPropertyValue(propName) >>= aErrorTitle); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get property value ErrorTitle", + OUString("UnitTest ErrorTitle"), aErrorTitle); + + propName = "IgnoreBlankCells"; + bool aIgnoreBlankCells = false; + CPPUNIT_ASSERT(xTableValidation->getPropertyValue(propName) >>= aIgnoreBlankCells); + CPPUNIT_ASSERT_MESSAGE("Unable to get property value IgnoreBlankCells", aIgnoreBlankCells); + + aNewValue <<= false; + xTableValidation->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xTableValidation->getPropertyValue(propName) >>= aIgnoreBlankCells); + CPPUNIT_ASSERT_MESSAGE("Unable to set property value IgnoreBlankCells", !aIgnoreBlankCells); + + propName = "ErrorAlertStyle"; + aValue = xTableValidation->getPropertyValue(propName); + sheet::ValidationAlertStyle aValidationAlertStyle; + aValue >>= aValidationAlertStyle; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get property value ValidationAlertStyle", + sheet::ValidationAlertStyle_STOP, aValidationAlertStyle); + + aNewValue <<= sheet::ValidationAlertStyle_WARNING; + xTableValidation->setPropertyValue(propName, aNewValue); + aValue = xTableValidation->getPropertyValue(propName); + aValue >>= aValidationAlertStyle; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set property value ValidationAlertStyle", + sheet::ValidationAlertStyle_WARNING, aValidationAlertStyle); + + propName = "ShowList"; + sal_Int16 aShowList = 0; + CPPUNIT_ASSERT(xTableValidation->getPropertyValue(propName) >>= aShowList); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get property value ShowList", sal_Int16(1), aShowList); + + aNewValue <<= sal_Int16(42); + xTableValidation->setPropertyValue(propName, aNewValue); + CPPUNIT_ASSERT(xTableValidation->getPropertyValue(propName) >>= aShowList); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set property value ShowList", sal_Int16(42), aShowList); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xactivationbroadcaster.cxx b/test/source/sheet/xactivationbroadcaster.cxx new file mode 100644 index 000000000..93fa5ab93 --- /dev/null +++ b/test/source/sheet/xactivationbroadcaster.cxx @@ -0,0 +1,72 @@ +/* -*- 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/sheet/xactivationbroadcaster.hxx> + +#include <com/sun/star/lang/EventObject.hpp> +#include <com/sun/star/sheet/ActivationEvent.hpp> +#include <com/sun/star/sheet/XActivationBroadcaster.hpp> +#include <com/sun/star/sheet/XActivationEventListener.hpp> +#include <com/sun/star/sheet/XSpreadsheetView.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppuhelper/implbase.hxx> +#include <rtl/ref.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +namespace +{ +class MockedActivationEventListener : public ::cppu::WeakImplHelper<sheet::XActivationEventListener> +{ +public: + MockedActivationEventListener() + : mbListenerCalled(false) + { + } + bool mbListenerCalled; + virtual void SAL_CALL + activeSpreadsheetChanged(const sheet::ActivationEvent& /* xEvent */) override + { + mbListenerCalled = true; + } + virtual void SAL_CALL disposing(const lang::EventObject& /* xEventObj */) override {} +}; +} + +void XActivationBroadcaster::testAddRemoveActivationEventListener() +{ + uno::Reference<sheet::XActivationBroadcaster> xAB(init(), UNO_QUERY_THROW); + xAB->addActivationEventListener(nullptr); + + rtl::Reference<MockedActivationEventListener> xListener = new MockedActivationEventListener(); + xAB->addActivationEventListener( + uno::Reference<sheet::XActivationEventListener>(xListener.get())); + + uno::Reference<sheet::XSpreadsheetView> xView(xAB, UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet1(xView->getActiveSheet(), UNO_SET_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet2(getXSpreadsheet(1), UNO_QUERY_THROW); + + xView->setActiveSheet(xSheet2); + + CPPUNIT_ASSERT_MESSAGE("Listener wasn't called", xListener->mbListenerCalled); + + xAB->removeActivationEventListener( + uno::Reference<sheet::XActivationEventListener>(xListener.get())); + xView->setActiveSheet(xSheet1); + CPPUNIT_ASSERT_MESSAGE("Listener still called after removal", xListener->mbListenerCalled); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xarealink.cxx b/test/source/sheet/xarealink.cxx new file mode 100644 index 000000000..77e9cb98b --- /dev/null +++ b/test/source/sheet/xarealink.cxx @@ -0,0 +1,65 @@ +/* -*- 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/sheet/xarealink.hxx> +#include <test/cppunitasserthelper.hxx> + +#include <com/sun/star/sheet/XAreaLink.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest { + +void XAreaLink::testSetDestArea() +{ + uno::Reference< sheet::XAreaLink > xAreaLink(init(), UNO_QUERY_THROW); + + xAreaLink->setDestArea(table::CellRangeAddress(1,3,4,5,8)); + // After setting the destination area, the link is refreshed and the area + // is adjusted to the size of the source data. + // Only test the 'Sheet', 'StartCol', and 'StartRow' + table::CellRangeAddress aDestArea = xAreaLink->getDestArea(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't set new DestArea (Sheet)", sal_Int16(1), aDestArea.Sheet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't set new DestArea (StartCol)", sal_Int32(3), aDestArea.StartColumn); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't set new DestArea (StartRow)", sal_Int32(4), aDestArea.StartRow); +} + +void XAreaLink::testSetSourceArea() +{ + uno::Reference< sheet::XAreaLink > xAreaLink(init(), UNO_QUERY_THROW); + + xAreaLink->setSourceArea("Sheet1.A1:B1"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't set new source area", + OUString("Sheet1.A1:B1"), xAreaLink->getSourceArea()); +} + +void XAreaLink::testGetDestArea() +{ + uno::Reference< sheet::XAreaLink > xAreaLink(init(), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't get dest area", + table::CellRangeAddress(1,2,3,3,6), xAreaLink->getDestArea()); +} + +void XAreaLink::testGetSourceArea() +{ + uno::Reference< sheet::XAreaLink > xAreaLink(init(), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Couldn't get source area", + OUString("a2:b5"), xAreaLink->getSourceArea()); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xarealinks.cxx b/test/source/sheet/xarealinks.cxx new file mode 100644 index 000000000..f52dcc35b --- /dev/null +++ b/test/source/sheet/xarealinks.cxx @@ -0,0 +1,50 @@ +/* -*- 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/sheet/xarealinks.hxx> + +#include <com/sun/star/sheet/XAreaLinks.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest { + +void XAreaLinks::testInsertAtPosition() +{ + uno::Reference< sheet::XAreaLinks > xAreaLinks(init(), UNO_QUERY_THROW); + + table::CellAddress aCellAddress(1, 2, 3); + xAreaLinks->insertAtPosition(aCellAddress, "", "a2:b5", "", ""); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to insert new CellAddress", + sal_Int32(1), xAreaLinks->getCount()); +} + +void XAreaLinks::testRemoveByIndex() +{ + uno::Reference< sheet::XAreaLinks > xAreaLinks(init(), UNO_QUERY_THROW); + + table::CellAddress aCellAddress(1, 2, 3); + xAreaLinks->insertAtPosition(aCellAddress, "", "a2:b5", "", ""); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to insert CellAddress for removal", + sal_Int32(1), xAreaLinks->getCount()); + + xAreaLinks->removeByIndex(0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to remove CellAddress", + sal_Int32(0), xAreaLinks->getCount()); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xarrayformularange.cxx b/test/source/sheet/xarrayformularange.cxx new file mode 100644 index 000000000..ab4ed7847 --- /dev/null +++ b/test/source/sheet/xarrayformularange.cxx @@ -0,0 +1,54 @@ +/* -*- 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/sheet/xarrayformularange.hxx> + +#include <com/sun/star/sheet/XArrayFormulaRange.hpp> +#include <com/sun/star/sheet/XCellRangeAddressable.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/table/XCell.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XArrayFormulaRange::testGetSetArrayFormula() +{ + uno::Reference<sheet::XArrayFormulaRange> xAFR(init(), UNO_QUERY_THROW); + + const OUString sFormula("=1 + 2 * 5"); + + xAFR->setArrayFormula(sFormula); + uno::Reference<sheet::XCellRangeAddressable> xCRA(xAFR, UNO_QUERY_THROW); + table::CellRangeAddress cellRangeAddress = xCRA->getRangeAddress(); + + uno::Reference<sheet::XSpreadsheet> xSheet(getXSpreadsheet(), UNO_QUERY_THROW); + + for (auto i = cellRangeAddress.StartColumn; i <= cellRangeAddress.EndColumn; i++) + { + for (auto j = cellRangeAddress.StartRow; j <= cellRangeAddress.EndRow; j++) + { + uno::Reference<table::XCell> xCell = xSheet->getCellByPosition(i, j); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Value of Cell " + std::to_string(i) + "," + + std::to_string(j), + 11.0, xCell->getValue(), 0.5); + } + } + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to test getArrayFormula()", OUString("{" + sFormula + "}"), + xAFR->getArrayFormula()); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xcalculatable.cxx b/test/source/sheet/xcalculatable.cxx new file mode 100644 index 000000000..44c201534 --- /dev/null +++ b/test/source/sheet/xcalculatable.cxx @@ -0,0 +1,74 @@ +/* -*- 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/sheet/xcalculatable.hxx> + +#include <com/sun/star/sheet/XCalculatable.hpp> +#include <com/sun/star/table/XCell.hpp> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XCalculatable::testEnableAutomaticCalculation() +{ + uno::Reference<sheet::XCalculatable> xCalculatable(init(), UNO_QUERY_THROW); + + bool bIsAutomaticCalculationEnabled = xCalculatable->isAutomaticCalculationEnabled(); + xCalculatable->enableAutomaticCalculation(!bIsAutomaticCalculationEnabled); + bool bIsAutomaticCalculationEnabledNew = xCalculatable->isAutomaticCalculationEnabled(); + CPPUNIT_ASSERT_MESSAGE("Unable to set enableAutomaticCalculation()", + bIsAutomaticCalculationEnabled != bIsAutomaticCalculationEnabledNew); +} + +void XCalculatable::testCalculate() +{ + uno::Reference<sheet::XCalculatable> xCalculatable(init(), UNO_QUERY_THROW); + xCalculatable->enableAutomaticCalculation(false); + + uno::Sequence<uno::Reference<table::XCell>> xCells = getXCells(); + + double dProduct = xCells[2]->getValue(); + double dFactor1 = xCells[0]->getValue(); + xCells[0]->setValue(dFactor1 + 1.0); + double dProduct2 = xCells[2]->getValue(); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Calculated products are equal", dProduct, dProduct2, 0.5); + + xCalculatable->calculate(); + dProduct2 = xCells[2]->getValue(); + CPPUNIT_ASSERT_MESSAGE("Calculated products are not equal", dProduct != dProduct2); +} + +void XCalculatable::testCalculateAll() +{ + uno::Reference<sheet::XCalculatable> xCalculatable(init(), UNO_QUERY_THROW); + xCalculatable->enableAutomaticCalculation(false); + + uno::Sequence<uno::Reference<table::XCell>> xCells = getXCells(); + + double dProduct = xCells[2]->getValue(); + double dFactor1 = xCells[0]->getValue(); + xCells[0]->setValue(dFactor1 + 1.0); + double dProduct2 = xCells[2]->getValue(); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Calculated products are equal", dProduct, dProduct2, 0.5); + + xCalculatable->calculateAll(); + dProduct2 = xCells[2]->getValue(); + CPPUNIT_ASSERT_MESSAGE("Calculated products are not equal", dProduct != dProduct2); + xCalculatable->calculateAll(); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xcelladdressable.cxx b/test/source/sheet/xcelladdressable.cxx new file mode 100644 index 000000000..fe70f8877 --- /dev/null +++ b/test/source/sheet/xcelladdressable.cxx @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xcelladdressable.hxx> +#include <test/cppunitasserthelper.hxx> + +#include <com/sun/star/sheet/XCellAddressable.hpp> +#include <com/sun/star/table/CellAddress.hpp> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest { + +void XCellAddressable::testGetCellAddress() +{ + uno::Reference< sheet::XCellAddressable > xCellAddressable(init(), UNO_QUERY_THROW); + table::CellAddress xCellAddress = xCellAddressable->getCellAddress(); + table::CellAddress defaultCellAddress(0, 2, 3); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("getCellAddress() didn't returned default cell address", + defaultCellAddress, xCellAddress); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xcellformatrangessupplier.cxx b/test/source/sheet/xcellformatrangessupplier.cxx new file mode 100644 index 000000000..d4390b538 --- /dev/null +++ b/test/source/sheet/xcellformatrangessupplier.cxx @@ -0,0 +1,39 @@ +/* -*- 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/sheet/xcellformatrangessupplier.hxx> + +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/sheet/XCellFormatRangesSupplier.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XCellFormatRangesSupplier::testGetCellFormatRanges() +{ + uno::Reference<sheet::XCellFormatRangesSupplier> xCFRS(init(), UNO_QUERY_THROW); + + uno::Reference<container::XIndexAccess> xIA(xCFRS->getCellFormatRanges(), UNO_SET_THROW); + + const sal_Int32 nCount = xIA->getCount(); + CPPUNIT_ASSERT_MESSAGE("No items found", sal_Int32(0) != nCount); + for (auto i = 0; i < nCount; i++) + { + CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to access element at position " + std::to_string(i), + xIA->getByIndex(i)); + } +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xcellrangeaddressable.cxx b/test/source/sheet/xcellrangeaddressable.cxx new file mode 100644 index 000000000..179a56fa1 --- /dev/null +++ b/test/source/sheet/xcellrangeaddressable.cxx @@ -0,0 +1,33 @@ +/* -*- 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/sheet/xcellrangeaddressable.hxx> + +#include <com/sun/star/sheet/XCellRangeAddressable.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XCellRangeAddressable::testGetRangeAddress() +{ + uno::Reference<sheet::XCellRangeAddressable> xCRA(init(), UNO_QUERY_THROW); + + table::CellRangeAddress aCellRangeAddr = xCRA->getRangeAddress(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get CellRangeAddress", sal_Int16(0), + aCellRangeAddr.Sheet); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xcellrangedata.cxx b/test/source/sheet/xcellrangedata.cxx new file mode 100644 index 000000000..6bd8f0f85 --- /dev/null +++ b/test/source/sheet/xcellrangedata.cxx @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xcellrangedata.hxx> + +#include <com/sun/star/sheet/XCellRangeData.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +namespace { + +void setValues(uno::Sequence< uno::Sequence < Any > >& rColRow, double nOffset) +{ + for (sal_Int32 i = 0; i < 4; ++i) + { + rColRow[i].realloc(4); + for (sal_Int32 j = 0; j < 4; ++j) + { + Any& aAny = rColRow[i][j]; + double nValue = i + j + nOffset; + aAny <<= nValue; + } + } +} + +} + +void XCellRangeData::testSetDataArray() +{ + uno::Reference< sheet::XCellRangeData > xCellRangeData( getXCellRangeData(), UNO_QUERY_THROW); + + uno::Sequence< uno::Sequence < Any > > aColRow; + aColRow.realloc(4); + setValues(aColRow, 1); + xCellRangeData->setDataArray(aColRow); + + for ( sal_Int32 i = 0; i < aColRow.getLength(); ++i) + { + for ( sal_Int32 j = 0; j < aColRow[i].getLength(); ++j) + { + Any& aAny = aColRow[i][j]; + double nValue = 0.0; + CPPUNIT_ASSERT( aAny >>= nValue); + CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<double>(i+j+1), nValue, 0.000001); + } + } + + // set old values + setValues(aColRow, 0); + xCellRangeData->setDataArray(aColRow); +} + +void XCellRangeData::testGetDataArray() +{ + uno::Reference< sheet::XCellRangeData > xCellRangeData( getXCellRangeData(), UNO_QUERY_THROW); + uno::Sequence< uno::Sequence < Any > > aColRow = xCellRangeData->getDataArray(); + CPPUNIT_ASSERT(aColRow.hasElements()); +} + +void XCellRangeData::testGetDataArrayOnTableSheet() +{ + uno::Reference< sheet::XCellRangeData > xCellRangeData( getXCellRangeData(), UNO_QUERY_THROW); + CPPUNIT_ASSERT_THROW_MESSAGE("No RuntimeException thrown", xCellRangeData->getDataArray(), + css::uno::RuntimeException); +} + +void XCellRangeData::testSetDataArrayOnTableSheet() +{ + uno::Reference< sheet::XCellRangeData > xCellRangeData( getXCellRangeData(), UNO_QUERY_THROW); + + uno::Sequence< uno::Sequence < Any > > aColRow; + aColRow.realloc(4); + setValues(aColRow, 1); + CPPUNIT_ASSERT_THROW_MESSAGE("No RuntimeException thrown", xCellRangeData->setDataArray(aColRow), + css::uno::RuntimeException); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xcellrangeformula.cxx b/test/source/sheet/xcellrangeformula.cxx new file mode 100644 index 000000000..6de601499 --- /dev/null +++ b/test/source/sheet/xcellrangeformula.cxx @@ -0,0 +1,41 @@ +/* -*- 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/sheet/xcellrangeformula.hxx> + +#include <com/sun/star/sheet/XCellRangeFormula.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XCellRangeFormula::testGetSetFormulaArray() +{ + uno::Reference<sheet::XCellRangeFormula> xCRF(init(), UNO_QUERY_THROW); + + uno::Sequence<uno::Sequence<OUString>> aFormulaArrayOrginal = xCRF->getFormulaArray(); + uno::Sequence<uno::Sequence<OUString>> aFormulaArrayNew = xCRF->getFormulaArray(); + aFormulaArrayNew[0][0] = "NewValue"; + + xCRF->setFormulaArray(aFormulaArrayNew); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get new FormulaArray", OUString("NewValue"), + xCRF->getFormulaArray()[0][0]); + + xCRF->setFormulaArray(aFormulaArrayOrginal); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set new FormulaArray", aFormulaArrayOrginal[0][0], + xCRF->getFormulaArray()[0][0]); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xcellrangemovement.cxx b/test/source/sheet/xcellrangemovement.cxx new file mode 100644 index 000000000..ac25a4603 --- /dev/null +++ b/test/source/sheet/xcellrangemovement.cxx @@ -0,0 +1,120 @@ +/* -*- 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/sheet/xcellrangemovement.hxx> + +#include <com/sun/star/sheet/CellDeleteMode.hpp> +#include <com/sun/star/sheet/CellInsertMode.hpp> +#include <com/sun/star/sheet/XCellRangeAddressable.hpp> +#include <com/sun/star/sheet/XCellRangeMovement.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XCellRangeMovement::testInsertCells() +{ + uno::Reference<sheet::XCellRangeMovement> xCRM(init(), UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet(xCRM, UNO_QUERY_THROW); + + uno::Reference<sheet::XCellRangeAddressable> xCRA(xCRM, UNO_QUERY_THROW); + const sal_Int16 nSheet = xCRA->getRangeAddress().Sheet; + + xSheet->getCellByPosition(0, 20)->setValue(100); + xSheet->getCellByPosition(1, 20)->setValue(100); + xSheet->getCellByPosition(2, 20)->setValue(100); + xSheet->getCellByPosition(3, 20)->setValue(100); + xSheet->getCellByPosition(0, 21)->setValue(200); + xSheet->getCellByPosition(1, 21)->setValue(200); + xSheet->getCellByPosition(2, 21)->setValue(200); + xSheet->getCellByPosition(3, 21)->setValue(200); + + table::CellRangeAddress aSrcCellRangeAddr(nSheet, 0, 21, 5, 21); + xCRM->insertCells(aSrcCellRangeAddr, sheet::CellInsertMode_DOWN); + + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Unable to insert cells", 0.0, + xSheet->getCellByPosition(1, 21)->getValue(), 0.0); +} + +void XCellRangeMovement::testCopyRange() +{ + uno::Reference<sheet::XCellRangeMovement> xCRM(init(), UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet(xCRM, UNO_QUERY_THROW); + + xSheet->getCellByPosition(1, 1)->setValue(100); + xSheet->getCellByPosition(1, 2)->setValue(200); + xSheet->getCellByPosition(2, 1)->setValue(300); + xSheet->getCellByPosition(2, 2)->setValue(400); + + uno::Reference<sheet::XCellRangeAddressable> xCRA(xCRM, UNO_QUERY_THROW); + const sal_Int16 nSheet = xCRA->getRangeAddress().Sheet; + + table::CellRangeAddress aSrcCellRangeAddr(nSheet, 1, 1, 2, 2); + table::CellAddress aDstCellAddr(nSheet, 1, 10); + + xCRM->copyRange(aDstCellAddr, aSrcCellRangeAddr); + + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Value was not copied from position 1,1 to 1,10", 100.0, + xSheet->getCellByPosition(1, 10)->getValue(), 0.1); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Value was not copied from position 1,2 to 1,11", 200.0, + xSheet->getCellByPosition(1, 11)->getValue(), 0.1); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Value was not copied from position 2,1 to 2,10", 300.0, + xSheet->getCellByPosition(2, 10)->getValue(), 0.1); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Value was not copied from position 2,2 to 2,11", 400.0, + xSheet->getCellByPosition(2, 11)->getValue(), 0.1); +} +void XCellRangeMovement::testMoveRange() +{ + uno::Reference<sheet::XCellRangeMovement> xCRM(init(), UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet(xCRM, UNO_QUERY_THROW); + + xSheet->getCellByPosition(4, 0)->setValue(111); + xSheet->getCellByPosition(4, 1)->setValue(222); + + uno::Reference<sheet::XCellRangeAddressable> xCRA(xCRM, UNO_QUERY_THROW); + const sal_Int16 nSheet = xCRA->getRangeAddress().Sheet; + + table::CellRangeAddress aSrcCellRangeAddr(nSheet, 4, 0, 4, 1); + table::CellAddress aDstCellAddr(nSheet, 4, 4); + + xCRM->moveRange(aDstCellAddr, aSrcCellRangeAddr); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Unable to move range", 333.0, + xSheet->getCellByPosition(4, 4)->getValue() + + xSheet->getCellByPosition(4, 5)->getValue(), + 0.0); +} +void XCellRangeMovement::testRemoveRange() +{ + uno::Reference<sheet::XCellRangeMovement> xCRM(init(), UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet(xCRM, UNO_QUERY_THROW); + + xSheet->getCellByPosition(5, 0)->setValue(333); + xSheet->getCellByPosition(5, 1)->setValue(444); + + uno::Reference<sheet::XCellRangeAddressable> xCRA(xCRM, UNO_QUERY_THROW); + const sal_Int16 nSheet = xCRA->getRangeAddress().Sheet; + + table::CellRangeAddress aSrcCellRangeAddr(nSheet, 5, 0, 5, 1); + + xCRM->removeRange(aSrcCellRangeAddr, sheet::CellDeleteMode_UP); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Unable to remove range", 0.0, + xSheet->getCellByPosition(5, 0)->getValue() + + xSheet->getCellByPosition(5, 1)->getValue(), + 0.0); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xcellrangereferrer.cxx b/test/source/sheet/xcellrangereferrer.cxx new file mode 100644 index 000000000..3d286d558 --- /dev/null +++ b/test/source/sheet/xcellrangereferrer.cxx @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/cppunitasserthelper.hxx> +#include <test/sheet/xcellrangereferrer.hxx> + +#include <com/sun/star/table/XCellRange.hpp> +#include <com/sun/star/sheet/XCellRangeAddressable.hpp> +#include <com/sun/star/sheet/XCellRangeReferrer.hpp> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void XCellRangeReferrer::testGetReferredCells() +{ + uno::Reference< sheet::XCellRangeReferrer > xReferrer(init(), UNO_QUERY_THROW); + uno::Reference< table::XCellRange > xReferredRange = xReferrer->getReferredCells(); + + uno::Reference< sheet::XCellRangeAddressable > xAdressable( xReferredRange, UNO_QUERY_THROW ); + table::CellRangeAddress aCellRange = xAdressable->getRangeAddress(); + + CPPUNIT_ASSERT_EQUAL(aCellRange, getCellRange()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xcellrangesquery.cxx b/test/source/sheet/xcellrangesquery.cxx new file mode 100644 index 000000000..e8e1b4724 --- /dev/null +++ b/test/source/sheet/xcellrangesquery.cxx @@ -0,0 +1,97 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xcellrangesquery.hxx> + +#include <com/sun/star/sheet/XCellRangesQuery.hpp> +#include <com/sun/star/sheet/XSheetCellRanges.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/sheet/CellFlags.hpp> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + + +namespace apitest { + +void XCellRangesQuery::testQueryColumnDifference() +{ + OUString const aExpected( "Sheet1.B1:C1,Sheet1.B3:C5" ); + uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW); + uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryColumnDifferences(table::CellAddress(0, 1, 1)); + OUString aResult = xRanges->getRangeAddressesAsString(); + std::cout << "testQueryColumnDifference: Result: " << aResult << std::endl; + CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryColumnDifference", aExpected, aResult); +} + +void XCellRangesQuery::testQueryContentDifference() +{ + OUString const aExpected( "Sheet1.B3,Sheet1.C2" ); + uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW); + uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryContentCells(sheet::CellFlags::VALUE); + OUString aResult = xRanges->getRangeAddressesAsString(); + std::cout << "testQueryContentDifference: Result: " << aResult << std::endl; + CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryContentDifference", aExpected, aResult); +} + +void XCellRangesQuery::testQueryEmptyCells() +{ + OUString const aExpected( "Sheet1.A1:A5,Sheet1.B1:C1,Sheet1.B5,Sheet1.C3:C5,Sheet1.D1:E5" ); + uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW); + uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryEmptyCells(); + OUString aResult = xRanges->getRangeAddressesAsString(); + std::cout << "testQueryEmptyCells: Result: " << aResult << std::endl; + CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryEmptyCells", aExpected, aResult); +} + +void XCellRangesQuery::testQueryFormulaCells() +{ + OUString const aExpected( "Sheet1.B2" ); + uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW); + uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryFormulaCells(sheet::CellFlags::FORMULA); + OUString aResult = xRanges->getRangeAddressesAsString(); + std::cout << "testQueryFormulaCells: Result: " << aResult << std::endl; + CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryFormulaCells", aExpected, aResult); +} + +void XCellRangesQuery::testQueryIntersection() +{ + OUString const aExpected( "Sheet1.D4:E5" ); + uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW); + uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryIntersection(table::CellRangeAddress(0,3,3,7,7)); + OUString aResult = xRanges->getRangeAddressesAsString(); + std::cout << "testQueryIntersection: Result: " << aResult << std::endl; + CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryIntersection", aExpected, aResult); +} + +void XCellRangesQuery::testQueryRowDifference() +{ + OUString const aExpected( "Sheet1.A2:A4,Sheet1.C2:E4" ); + uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW); + uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryRowDifferences(table::CellAddress(0,1,1)); + OUString aResult = xRanges->getRangeAddressesAsString(); + std::cout << "testQueryRowDifference: Result: " << aResult << std::endl; + CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryRowDifference", aExpected, aResult); +} + +void XCellRangesQuery::testQueryVisibleCells() +{ + OUString const aExpected( "Sheet1.A1:E5" ); + uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW); + uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryVisibleCells(); + OUString aResult = xRanges->getRangeAddressesAsString(); + std::cout << "testQueryVisibleCells: Result: " << aResult << std::endl; + CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryVisibleCells", aExpected, aResult); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xcellseries.cxx b/test/source/sheet/xcellseries.cxx new file mode 100644 index 000000000..3aff084f8 --- /dev/null +++ b/test/source/sheet/xcellseries.cxx @@ -0,0 +1,114 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xcellseries.hxx> + +#include <com/sun/star/sheet/XCellSeries.hpp> +#include <com/sun/star/table/XCellRange.hpp> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest { + +void XCellSeries::testFillAuto() +{ + uno::Reference<table::XCellRange> xCellRange(init(), UNO_QUERY_THROW); + sal_Int32 maValue = xCellRange->getCellByPosition(maStartX, maStartY)->getValue(); + + uno::Reference<table::XCellRange> xCellRangeH(xCellRange->getCellRangeByPosition(maStartX, maStartY, maStartX + 2, maStartY), UNO_SET_THROW); + uno::Reference<sheet::XCellSeries> xCellSeriesH(xCellRangeH, UNO_QUERY_THROW); + xCellSeriesH->fillAuto(sheet::FillDirection_TO_RIGHT, 1); + sal_Int32 sumH = 0; + for(sal_Int32 i = 0; i < 3; i++) { + uno::Reference<table::XCell> xCellResultH(xCellRange->getCellByPosition(maStartX + i, maStartY), UNO_SET_THROW); + sumH += xCellResultH->getValue(); + } + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong result for fillAuto with TO_RIGHT", maValue * 3 + 3, sumH); + + uno::Reference<table::XCellRange> xCellRangeV(xCellRange->getCellRangeByPosition(maStartX, maStartY, maStartX, maStartY + 2), UNO_SET_THROW); + uno::Reference<sheet::XCellSeries> xCellSeriesV(xCellRangeV, UNO_QUERY_THROW); + xCellSeriesV->fillAuto(sheet::FillDirection_TO_BOTTOM, 1); + sal_Int32 sumV = 0; + for(sal_Int32 i = 0; i < 3; i++) { + uno::Reference<table::XCell> xCellResultV(xCellRange->getCellByPosition(maStartX, maStartY + i), UNO_SET_THROW); + sumV += xCellResultV->getValue(); + } + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong result for fillAuto with TO_BOTTOM", maValue * 3 + 3, sumV); + + for(sal_Int32 i = 1; i < 3; i++) { + uno::Reference<table::XCell> xCellResultH(xCellRange->getCellByPosition(maStartX + i, maStartY), UNO_SET_THROW); + xCellResultH->setFormula(""); + uno::Reference<table::XCell> xCellResultV(xCellRange->getCellByPosition(maStartX, maStartY + i), UNO_SET_THROW); + xCellResultV->setFormula(""); + } +} + +void XCellSeries::testFillSeries() +{ + uno::Reference<table::XCellRange> xCellRange(init(), UNO_QUERY_THROW); + sal_Int32 maValue = xCellRange->getCellByPosition(maStartX, maStartY)->getValue(); + + uno::Reference<table::XCellRange> xCellRangeH(xCellRange->getCellRangeByPosition(maStartX, maStartY, maStartX + 2, maStartY), UNO_SET_THROW); + uno::Reference<sheet::XCellSeries> xCellSeriesH(xCellRangeH, UNO_QUERY_THROW); + xCellSeriesH->fillSeries(sheet::FillDirection_TO_RIGHT, + sheet::FillMode_LINEAR, + sheet::FillDateMode_FILL_DATE_DAY, 2, 1000); + sal_Int32 sumH = 0; + for(sal_Int32 i = 0; i < 3; i++) { + uno::Reference<table::XCell> xCellResultH(xCellRange->getCellByPosition(maStartX + i, maStartY), UNO_SET_THROW); + sumH += xCellResultH->getValue(); + } + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong result for fillSeries with TO_RIGHT and LINEAR", maValue * 3 + 6, sumH); + + xCellSeriesH->fillSeries(sheet::FillDirection_TO_RIGHT, + sheet::FillMode_GROWTH, + sheet::FillDateMode_FILL_DATE_DAY, 2, 1000); + sumH = 0; + for(sal_Int32 i = 0; i < 3; i++) { + uno::Reference<table::XCell> xCellResultH(xCellRange->getCellByPosition(maStartX + i, maStartY), UNO_SET_THROW); + sumH += xCellResultH->getValue(); + } + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong result for fillSeries with TO_RIGHT and GROWTH", maValue + maValue * 2 + maValue * 4, sumH); + + uno::Reference<table::XCellRange> xCellRangeV(xCellRange->getCellRangeByPosition(maStartX, maStartY, maStartX, maStartY + 2), UNO_SET_THROW); + uno::Reference<sheet::XCellSeries> xCellSeriesV(xCellRangeV, UNO_QUERY_THROW); + xCellSeriesV->fillSeries(sheet::FillDirection_TO_BOTTOM, + sheet::FillMode_LINEAR, + sheet::FillDateMode_FILL_DATE_DAY, 2, 1000); + sal_Int32 sumV = 0; + for(sal_Int32 i = 0; i < 3; i++) { + uno::Reference<table::XCell> xCellResultV(xCellRange->getCellByPosition(maStartX, maStartY + i), UNO_SET_THROW); + sumV += xCellResultV->getValue(); + } + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong result for fillSeries with TO_BOTTOM and LINEAR", maValue * 3 + 6, sumV); + + xCellSeriesV->fillSeries(sheet::FillDirection_TO_BOTTOM, + sheet::FillMode_GROWTH, + sheet::FillDateMode_FILL_DATE_DAY, 2, 1000); + sumV = 0; + for(sal_Int32 i = 0; i < 3; i++) { + uno::Reference<table::XCell> xCellResultV(xCellRange->getCellByPosition(maStartX, maStartY + i), UNO_SET_THROW); + sumV += xCellResultV->getValue(); + } + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong result for fillSeries with TO_BOTTOM and GROWTH", maValue + maValue * 2 + maValue * 4, sumV); + + for(sal_Int32 i = 1; i < 3; i++) { + uno::Reference<table::XCell> xCellResultH(xCellRange->getCellByPosition(maStartX + i, maStartY), UNO_SET_THROW); + xCellResultH->setFormula(""); + uno::Reference<table::XCell> xCellResultV(xCellRange->getCellByPosition(maStartX, maStartY + i), UNO_SET_THROW); + xCellResultV->setFormula(""); + } +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xconsolidatable.cxx b/test/source/sheet/xconsolidatable.cxx new file mode 100644 index 000000000..0efa16b69 --- /dev/null +++ b/test/source/sheet/xconsolidatable.cxx @@ -0,0 +1,43 @@ +/* -*- 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/sheet/xconsolidatable.hxx> + +#include <com/sun/star/sheet/XConsolidatable.hpp> +#include <com/sun/star/sheet/XConsolidationDescriptor.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XConsolidatable::testCreateConsolidationDescriptor() +{ + uno::Reference<sheet::XConsolidatable> xConsolidatable(init(), UNO_QUERY_THROW); + + uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor( + xConsolidatable->createConsolidationDescriptor(true), UNO_SET_THROW); +} + +void XConsolidatable::testConsolidate() +{ + uno::Reference<sheet::XConsolidatable> xConsolidatable(init(), UNO_QUERY_THROW); + + uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor( + xConsolidatable->createConsolidationDescriptor(true), UNO_SET_THROW); + + xConsolidatable->consolidate(xConsolidationDescriptor); + CPPUNIT_ASSERT_MESSAGE("consolidate()", true); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xconsolidationdescriptor.cxx b/test/source/sheet/xconsolidationdescriptor.cxx new file mode 100644 index 000000000..455533c23 --- /dev/null +++ b/test/source/sheet/xconsolidationdescriptor.cxx @@ -0,0 +1,144 @@ +/* -*- 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/sheet/xconsolidationdescriptor.hxx> +#include <test/cppunitasserthelper.hxx> + +#include <com/sun/star/sheet/GeneralFunction.hpp> +#include <com/sun/star/sheet/XConsolidationDescriptor.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XConsolidationDescriptor::testGetFunction() +{ + uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(), + UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get function", sheet::GeneralFunction_SUM, + xConsolidationDescriptor->getFunction()); +} + +void XConsolidationDescriptor::testSetFunction() +{ + uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(), + UNO_QUERY_THROW); + + xConsolidationDescriptor->setFunction(sheet::GeneralFunction_COUNT); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set function", sheet::GeneralFunction_COUNT, + xConsolidationDescriptor->getFunction()); +} + +void XConsolidationDescriptor::testGetSources() +{ + uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(), + UNO_QUERY_THROW); + + uno::Sequence<table::CellRangeAddress> aSources = xConsolidationDescriptor->getSources(); + CPPUNIT_ASSERT_MESSAGE("Unable to get sources", !aSources.hasElements()); +} + +void XConsolidationDescriptor::testSetSources() +{ + uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(), + UNO_QUERY_THROW); + + uno::Sequence<table::CellRangeAddress> aSources(1); + aSources[0] = table::CellRangeAddress(0, 1, 1, 5, 5); + xConsolidationDescriptor->setSources(aSources); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set sources", table::CellRangeAddress(0, 1, 1, 5, 5), + xConsolidationDescriptor->getSources()[0]); +} + +void XConsolidationDescriptor::testGetStartOutputPosition() +{ + uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(), + UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get start output position", table::CellAddress(0, 0, 0), + xConsolidationDescriptor->getStartOutputPosition()); +} + +void XConsolidationDescriptor::testSetStartOutputPosition() +{ + uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(), + UNO_QUERY_THROW); + + xConsolidationDescriptor->setStartOutputPosition(table::CellAddress(0, 1, 2)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set start output position", table::CellAddress(0, 1, 2), + xConsolidationDescriptor->getStartOutputPosition()); +} + +void XConsolidationDescriptor::testGetUseColumnHeaders() +{ + uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(), + UNO_QUERY_THROW); + + CPPUNIT_ASSERT_MESSAGE("Unable to get use column headers", + !xConsolidationDescriptor->getUseColumnHeaders()); +} + +void XConsolidationDescriptor::testSetUseColumnHeaders() +{ + uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(), + UNO_QUERY_THROW); + + xConsolidationDescriptor->setUseColumnHeaders(true); + CPPUNIT_ASSERT_MESSAGE("Unable to set use column headers", + xConsolidationDescriptor->getUseColumnHeaders()); +} + +void XConsolidationDescriptor::testGetUseRowHeaders() +{ + uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(), + UNO_QUERY_THROW); + + CPPUNIT_ASSERT_MESSAGE("Unable to get use row headers", + !xConsolidationDescriptor->getUseRowHeaders()); +} + +void XConsolidationDescriptor::testSetUseRowHeaders() +{ + uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(), + UNO_QUERY_THROW); + + xConsolidationDescriptor->setUseRowHeaders(true); + CPPUNIT_ASSERT_MESSAGE("Unable to set use row headers", + xConsolidationDescriptor->getUseRowHeaders()); +} + +void XConsolidationDescriptor::testGetInsertLinks() +{ + uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(), + UNO_QUERY_THROW); + + CPPUNIT_ASSERT_MESSAGE("Unable to get use insert links", + !xConsolidationDescriptor->getInsertLinks()); +} + +void XConsolidationDescriptor::testSetInsertLinks() +{ + uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor(init(), + UNO_QUERY_THROW); + + xConsolidationDescriptor->setInsertLinks(true); + CPPUNIT_ASSERT_MESSAGE("Unable to set use insert links", + xConsolidationDescriptor->getInsertLinks()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xdatabaserange.cxx b/test/source/sheet/xdatabaserange.cxx new file mode 100644 index 000000000..933425c04 --- /dev/null +++ b/test/source/sheet/xdatabaserange.cxx @@ -0,0 +1,181 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xdatabaserange.hxx> + +#include <com/sun/star/sheet/XSubTotalDescriptor.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/sheet/XDatabaseRange.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/sheet/XCellRangeReferrer.hpp> +#include <com/sun/star/table/XCell.hpp> +#include <com/sun/star/table/XTableRows.hpp> +#include <com/sun/star/table/XColumnRowRange.hpp> + +#include <rtl/ustring.hxx> +#include <cppunit/TestAssert.h> +#include <iostream> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +/** + * tests setDataArea and getDataArea + */ +void XDatabaseRange::testDataArea() +{ + uno::Reference< sheet::XDatabaseRange > xDBRange(init("DataArea"), UNO_QUERY_THROW); + + table::CellRangeAddress aCellAddress; + aCellAddress.Sheet = 0; + aCellAddress.StartColumn = 1; + aCellAddress.EndColumn = 4; + aCellAddress.StartRow = 2; + aCellAddress.EndRow = 5; + xDBRange->setDataArea(aCellAddress); + table::CellRangeAddress aValue = xDBRange->getDataArea(); + CPPUNIT_ASSERT_EQUAL( aCellAddress.Sheet, aValue.Sheet ); + CPPUNIT_ASSERT_EQUAL( aCellAddress.StartRow, aValue.StartRow ); + CPPUNIT_ASSERT_EQUAL( aCellAddress.EndRow, aValue.EndRow ); + CPPUNIT_ASSERT_EQUAL( aCellAddress.StartColumn, aValue.StartColumn ); + CPPUNIT_ASSERT_EQUAL( aCellAddress.EndColumn, aValue.EndColumn ); +} + +void XDatabaseRange::testGetSubtotalDescriptor() +{ + uno::Reference< sheet::XDatabaseRange > xDBRange(init("SubtotalDescriptor"), UNO_QUERY_THROW); + uno::Reference< sheet::XSubTotalDescriptor> xSubtotalDescr = xDBRange->getSubTotalDescriptor(); + CPPUNIT_ASSERT(xSubtotalDescr.is()); +} + +void XDatabaseRange::testGetSortDescriptor() +{ + uno::Reference< sheet::XDatabaseRange > xDBRange(init("SortDescriptor"), UNO_QUERY_THROW); + const uno::Sequence< beans::PropertyValue > xSortDescr = xDBRange->getSortDescriptor(); + for (const beans::PropertyValue& aProp : xSortDescr) + { + //std::cout << "Prop " << i << " Name: " << OUString(aProp.Name) << std::endl; + + if (aProp.Name == "IsSortColumns") + { + bool bIsSortColumns = true; + aProp.Value >>= bIsSortColumns; + CPPUNIT_ASSERT(bIsSortColumns); + } + else if (aProp.Name == "ContainsHeader") + { + bool bContainsHeader = true; + aProp.Value >>= bContainsHeader; + CPPUNIT_ASSERT(bContainsHeader); + } + else if (aProp.Name == "MaxFieldCount") + { + sal_Int32 nMaxFieldCount = 0; + aProp.Value >>= nMaxFieldCount; + std::cout << "Value: " << nMaxFieldCount << std::endl; + + } + else if (aProp.Name == "SortFields") + { + + } + else if (aProp.Name == "BindFormatsToContent") + { + bool bBindFormatsToContent = false; + aProp.Value >>= bBindFormatsToContent; + CPPUNIT_ASSERT(bBindFormatsToContent); + } + else if (aProp.Name == "CopyOutputData") + { + bool bCopyOutputData = true; + aProp.Value >>= bCopyOutputData; + CPPUNIT_ASSERT(!bCopyOutputData); + } + else if (aProp.Name == "OutputPosition") + { + + } + else if (aProp.Name == "IsUserListEnabled") + { + bool bIsUserListEnabled = true; + aProp.Value >>= bIsUserListEnabled; + CPPUNIT_ASSERT(!bIsUserListEnabled); + + } + else if (aProp.Name == "UserListIndex") + { + sal_Int32 nUserListIndex = 1; + aProp.Value >>= nUserListIndex; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nUserListIndex); + } + } +} + +void XDatabaseRange::testGetFilterDescriptor() +{ + uno::Reference< sheet::XDatabaseRange > xDBRange( init("FilterDescriptor"), UNO_QUERY_THROW); + uno::Reference< uno::XInterface > xFilterDescr( xDBRange->getFilterDescriptor(), UNO_QUERY_THROW); +} + +void XDatabaseRange::testGetImportDescriptor() +{ + uno::Reference< sheet::XDatabaseRange > xDBRange( init("ImportDescriptor"), UNO_QUERY_THROW); + uno::Sequence< beans::PropertyValue > xImportDescr = xDBRange->getImportDescriptor(); + (void) xImportDescr; +} + +void XDatabaseRange::testRefresh() +{ + uno::Reference< sheet::XDatabaseRange > xDBRange( init("Refresh"), UNO_QUERY_THROW); + + const sal_Int32 nCol = 0; + OUString aHidden("IsVisible"); + uno::Reference< sheet::XCellRangeReferrer > xCellRangeReferrer(xDBRange, UNO_QUERY_THROW); + uno::Reference< table::XCellRange > xCellRange = xCellRangeReferrer->getReferredCells(); + + for (sal_Int32 i = 1; i < 5; ++i) + { + uno::Reference< table::XCell > xCell = xCellRange->getCellByPosition(nCol, i); + xCell->setValue(0); + } + + for (sal_Int32 i = 2; i < 5; ++i) + { + uno::Reference< table::XColumnRowRange > xColRowRange(xCellRange, UNO_QUERY_THROW); + uno::Reference< table::XTableRows > xRows = xColRowRange->getRows(); + uno::Reference< table::XCellRange > xRow(xRows->getByIndex(i), UNO_QUERY_THROW); + uno::Reference< beans::XPropertySet > xPropRow(xRow, UNO_QUERY_THROW); + Any aAny = xPropRow->getPropertyValue( aHidden ); + + CPPUNIT_ASSERT(aAny.get<bool>()); + } + + xDBRange->refresh(); + std::cout << "after refresh" << std::endl; + + for (sal_Int32 i = 1; i < 5; ++i) + { + uno::Reference< table::XColumnRowRange > xColRowRange(xCellRange, UNO_QUERY_THROW); + uno::Reference< table::XTableRows > xRows = xColRowRange->getRows(); + uno::Reference< table::XCellRange > xRow(xRows->getByIndex(i), UNO_QUERY_THROW); + uno::Reference< beans::XPropertySet > xPropRow(xRow, UNO_QUERY_THROW); + Any aAny = xPropRow->getPropertyValue( aHidden ); + + CPPUNIT_ASSERT(!aAny.get<bool>()); + } + + +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xdatabaseranges.cxx b/test/source/sheet/xdatabaseranges.cxx new file mode 100644 index 000000000..650a0faa3 --- /dev/null +++ b/test/source/sheet/xdatabaseranges.cxx @@ -0,0 +1,45 @@ +/* -*- 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/sheet/xdatabaseranges.hxx> + +#include <com/sun/star/sheet/XDatabaseRanges.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XDatabaseRanges::testAddRemoveDbRanges() +{ + uno::Reference<sheet::XDatabaseRanges> xDbRanges(init(), UNO_QUERY_THROW); + + xDbRanges->addNewByName("addNewRange", table::CellRangeAddress(0, 1, 2, 3, 4)); + CPPUNIT_ASSERT_MESSAGE("Unable to add new db range", xDbRanges->hasByName("addNewRange")); + + CPPUNIT_ASSERT_THROW_MESSAGE( + "No exception thrown, when adding range with existing name", + xDbRanges->addNewByName("addNewRange", table::CellRangeAddress(0, 1, 2, 3, 4)), + css::uno::RuntimeException); + + xDbRanges->removeByName("addNewRange"); + CPPUNIT_ASSERT_MESSAGE("Unable to remove db range", !xDbRanges->hasByName("addNewRange")); + + CPPUNIT_ASSERT_THROW_MESSAGE("No exception, when removing none-existing range", + xDbRanges->removeByName("addNewRange"), + css::uno::RuntimeException); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xdatapilotdescriptor.cxx b/test/source/sheet/xdatapilotdescriptor.cxx new file mode 100644 index 000000000..a9cbcf5b1 --- /dev/null +++ b/test/source/sheet/xdatapilotdescriptor.cxx @@ -0,0 +1,192 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xdatapilotdescriptor.hxx> + +#include <com/sun/star/sheet/XDataPilotDescriptor.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +#include <cppunit/TestAssert.h> + +#include <o3tl/safeint.hxx> +#include <rtl/ustring.hxx> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +std::vector< OUString > XDataPilotDescriptor::maFieldNames; + +void XDataPilotDescriptor::testTag() +{ + OUString aTag("DataPilotDescriptor_Tag"); + uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(), UNO_QUERY_THROW); + xDescr->setTag(aTag); + OUString aNewTag = xDescr->getTag(); + CPPUNIT_ASSERT_EQUAL( aTag, aNewTag ); +} + +void XDataPilotDescriptor::testSourceRange() +{ + uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(), UNO_QUERY_THROW); + table::CellRangeAddress aOldAddress = xDescr->getSourceRange(); + + table::CellRangeAddress aAddress; + aAddress.Sheet = 1; + aAddress.StartColumn = 1; + aAddress.StartRow = 1; + aAddress.EndColumn = 5; + aAddress.EndRow = 5; + xDescr->setSourceRange(aAddress); + + table::CellRangeAddress aReturn = xDescr->getSourceRange(); + + CPPUNIT_ASSERT_EQUAL(aAddress.Sheet, aReturn.Sheet); + CPPUNIT_ASSERT_EQUAL(aAddress.StartColumn, aReturn.StartColumn); + CPPUNIT_ASSERT_EQUAL(aAddress.StartRow, aReturn.StartRow); + CPPUNIT_ASSERT_EQUAL(aAddress.EndColumn, aReturn.EndColumn); + CPPUNIT_ASSERT_EQUAL(aAddress.EndRow, aReturn.EndRow); + + //restore old settings + xDescr->setSourceRange(aOldAddress); +} + +void XDataPilotDescriptor::testGetFilterDescriptor() +{ + uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(), UNO_QUERY_THROW); + uno::Reference< sheet::XSheetFilterDescriptor > xSheetFilterDescr = xDescr->getFilterDescriptor(); + CPPUNIT_ASSERT(xSheetFilterDescr.is()); +} + +void XDataPilotDescriptor::testGetDataPilotFields_Impl( uno::Reference< sheet::XDataPilotDescriptor > const & xDescr) +{ + uno::Reference< container::XIndexAccess > xIndex(xDescr->getDataPilotFields(), UNO_SET_THROW); + + sal_Int32 nCount = xIndex->getCount(); + + OUString aOrientation("Orientation"); + for (sal_Int32 i = 0; i < nCount && i < 5; ++i) + { + uno::Reference< container::XNamed > xNamed( xIndex->getByIndex( i ), UNO_QUERY_THROW); + OUString aName = xNamed->getName(); + maFieldNames.push_back(aName); + CPPUNIT_ASSERT( aName != "Data" ); + + uno::Reference< beans::XPropertySet > xPropSet( xNamed, UNO_QUERY_THROW); + + switch ( i % 5 ) + { + case 0: + { + uno::Any aAny; + aAny<<= sheet::DataPilotFieldOrientation_COLUMN; + xPropSet->setPropertyValue(aOrientation, aAny); + } + break; + case 1: + { + uno::Any aAny; + aAny<<= sheet::DataPilotFieldOrientation_ROW; + xPropSet->setPropertyValue(aOrientation, aAny); + } + break; + case 2: + { + uno::Any aAny; + aAny<<= sheet::DataPilotFieldOrientation_DATA; + xPropSet->setPropertyValue(aOrientation, aAny); + } + break; + case 3: + { + uno::Any aAny; + aAny<<= sheet::DataPilotFieldOrientation_HIDDEN; + xPropSet->setPropertyValue(aOrientation, aAny); + } + break; + case 4: + { + uno::Any aAny; + aAny<<= sheet::DataPilotFieldOrientation_PAGE; + xPropSet->setPropertyValue(aOrientation, aAny); + } + break; + } + } +} + +void XDataPilotDescriptor::testGetDataPilotFields() +{ + uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(), UNO_QUERY_THROW); + testGetDataPilotFields_Impl( xDescr ); +} + +void XDataPilotDescriptor::testGetColumnFields() +{ + uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(),UNO_QUERY_THROW); + testGetDataPilotFields_Impl( xDescr ); + uno::Reference< container::XIndexAccess > xIndex(xDescr->getColumnFields(), UNO_SET_THROW); + + checkName( xIndex, 0 ); +} + +void XDataPilotDescriptor::testGetRowFields() +{ + uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(),UNO_QUERY_THROW); + testGetDataPilotFields_Impl( xDescr ); + uno::Reference< container::XIndexAccess > xIndex(xDescr->getRowFields(), UNO_SET_THROW); + + //checkName( xIndex, 1 ); +} + +void XDataPilotDescriptor::testGetPageFields() +{ + uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(), UNO_QUERY_THROW); + testGetDataPilotFields_Impl( xDescr ); + uno::Reference< container::XIndexAccess > xIndex(xDescr->getPageFields(), UNO_SET_THROW); + + checkName( xIndex, 4 ); +} + +void XDataPilotDescriptor::testGetDataFields() +{ + uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(),UNO_QUERY_THROW); + testGetDataPilotFields_Impl( xDescr ); + uno::Reference< container::XIndexAccess > xIndex(xDescr->getDataFields(), UNO_SET_THROW); + + checkName( xIndex, 2 ); +} + +void XDataPilotDescriptor::testGetHiddenFields() +{ + uno::Reference< sheet::XDataPilotDescriptor > xDescr(init(),UNO_QUERY_THROW); + testGetDataPilotFields_Impl( xDescr ); + uno::Reference< container::XIndexAccess > xIndex(xDescr->getHiddenFields(), UNO_SET_THROW); + + checkName( xIndex, 3 ); +} + +void XDataPilotDescriptor::checkName( uno::Reference< container::XIndexAccess > const & xIndex, sal_Int32 nIndex ) +{ + CPPUNIT_ASSERT(xIndex.is()); + CPPUNIT_ASSERT(maFieldNames.size() >= o3tl::make_unsigned(nIndex)); + + for (sal_Int32 i = 0; i < xIndex->getCount(); ++i) + { + uno::Reference< container::XNamed > xNamed( xIndex->getByIndex(i), UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(maFieldNames[nIndex], xNamed->getName()); + } +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xdatapilotfield.cxx b/test/source/sheet/xdatapilotfield.cxx new file mode 100644 index 000000000..9f14709e6 --- /dev/null +++ b/test/source/sheet/xdatapilotfield.cxx @@ -0,0 +1,40 @@ +/* -*- 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/sheet/xdatapilotfield.hxx> + +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/sheet/XDataPilotField.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XDataPilotField::testGetItems() +{ + uno::Reference<sheet::XDataPilotField> xDPF(init(), UNO_QUERY_THROW); + + uno::Reference<container::XIndexAccess> xIA(xDPF->getItems(), UNO_SET_THROW); + + const sal_Int32 nCount = xIA->getCount(); + CPPUNIT_ASSERT_MESSAGE("No items found", sal_Int32(0) != nCount); + + for (auto i = 0; i < nCount; i++) + { + CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to access element at position " + std::to_string(i), + xIA->getByIndex(i)); + } +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xdatapilotfieldgrouping.cxx b/test/source/sheet/xdatapilotfieldgrouping.cxx new file mode 100644 index 000000000..d3ca40d13 --- /dev/null +++ b/test/source/sheet/xdatapilotfieldgrouping.cxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xdatapilotfieldgrouping.hxx> + +#include <com/sun/star/sheet/XDataPilotFieldGrouping.hpp> +#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void XDataPilotFieldGrouping::testCreateNameGroup() +{ + uno::Reference< sheet::XDataPilotFieldGrouping > xDataPilotFieldGrouping(init(),UNO_QUERY_THROW); + uno::Reference< sheet::XDataPilotField > xDataPilotField( xDataPilotFieldGrouping, UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xNameAccess( xDataPilotField->getItems(), UNO_QUERY_THROW ); + CPPUNIT_ASSERT(xNameAccess->hasElements()); + + uno::Sequence< OUString > aElements = xNameAccess->getElementNames(); + xDataPilotFieldGrouping->createNameGroup( aElements ); +} + +void XDataPilotFieldGrouping::testCreateDateGroup() +{ + uno::Reference< sheet::XDataPilotFieldGrouping > xDataPilotFieldGrouping(init(),UNO_QUERY_THROW); + sheet::DataPilotFieldGroupInfo aGroupInfo; + aGroupInfo.GroupBy = sheet::DataPilotFieldGroupBy::MONTHS; + aGroupInfo.HasDateValues = true; + xDataPilotFieldGrouping->createDateGroup(aGroupInfo); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xdatapilottable.cxx b/test/source/sheet/xdatapilottable.cxx new file mode 100644 index 000000000..5934532dc --- /dev/null +++ b/test/source/sheet/xdatapilottable.cxx @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xdatapilottable.hxx> +#include <com/sun/star/sheet/XDataPilotTable.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ + +void XDataPilotTable::testGetOutputRange() +{ + uno::Reference< sheet::XDataPilotTable > xDPTable(init(),UNO_QUERY_THROW); + + table::CellRangeAddress aRange = xDPTable->getOutputRange(); + CPPUNIT_ASSERT_EQUAL( sal_Int16(0), aRange.Sheet ); + CPPUNIT_ASSERT_EQUAL( sal_Int32(7), aRange.StartColumn ); + CPPUNIT_ASSERT_EQUAL( sal_Int32(8), aRange.StartRow ); +} + +void XDataPilotTable::testRefresh() +{ + uno::Reference< sheet::XDataPilotTable > xDPTable(init(),UNO_QUERY_THROW); + std::cout << "xCellForChange: Old Value: " << xCellForChange->getValue() << std::endl; + std::cout << "xCellForCheck: Old Value: " << xCellForCheck->getValue() << std::endl; + double aOldData = xCellForCheck->getValue(); + xCellForChange->setValue( 5 ); + + xDPTable->refresh(); + xDPTable->refresh(); + std::cout << "xCellForChange: Old Value: " << xCellForChange->getValue() << std::endl; + std::cout << "xCellForCheck: Old Value: " << xCellForCheck->getValue() << std::endl; + double aNewData = xCellForCheck->getValue(); + CPPUNIT_ASSERT_MESSAGE("value needs to change", aOldData != aNewData); +} + +XDataPilotTable::~XDataPilotTable() +{ +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xdatapilottable2.cxx b/test/source/sheet/xdatapilottable2.cxx new file mode 100644 index 000000000..f894743dc --- /dev/null +++ b/test/source/sheet/xdatapilottable2.cxx @@ -0,0 +1,276 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xdatapilottable2.hxx> +#include <com/sun/star/sheet/XDataPilotTable2.hpp> +#include <com/sun/star/sheet/DataPilotTableResultData.hpp> +#include <com/sun/star/sheet/XDataPilotDescriptor.hpp> +#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp> +#include <com/sun/star/sheet/DataPilotTablePositionType.hpp> +#include <com/sun/star/sheet/DataPilotOutputRangeType.hpp> +#include <com/sun/star/sheet/XSpreadsheets.hpp> +#include <com/sun/star/sheet/XCellAddressable.hpp> +#include <com/sun/star/table/XCellCursor.hpp> +#include <com/sun/star/sheet/XCellRangeData.hpp> +#include <com/sun/star/sheet/DataResult.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <cppunit/TestAssert.h> +#include <numeric> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +XDataPilotTable2::~XDataPilotTable2() +{ +} + +void XDataPilotTable2::testGetPositionData() +{ + uno::Reference< sheet::XDataPilotTable2 > xDPTable(initDP2(), UNO_QUERY_THROW); + getOutputRanges(xDPTable); + table::CellAddress aAddr; + + aAddr.Sheet = maRangeTable.Sheet; + for (sal_Int32 x = maRangeTable.StartColumn; x <= maRangeTable.EndColumn; ++x) + { + for (sal_Int32 y = maRangeTable.StartRow; y <= maRangeTable.EndRow; ++y) + { + aAddr.Column = x; + aAddr.Row = y; + + sheet::DataPilotTablePositionData aPosData = xDPTable->getPositionData(aAddr); + if (aPosData.PositionType == sheet::DataPilotTablePositionType::NOT_IN_TABLE) + { + CPPUNIT_ASSERT(false); + } + } + } +} + +void XDataPilotTable2::testGetDrillDownData() +{ + uno::Reference< sheet::XDataPilotTable2 > xDPTable(initDP2(), UNO_QUERY_THROW); + + getOutputRanges(xDPTable); + buildDataFields(xDPTable); + buildResultCells(xDPTable); + + for (const auto& rResultCell : maResultCells) + { + sheet::DataPilotTablePositionData aPosData = xDPTable->getPositionData(rResultCell); + Any aTempAny = aPosData.PositionData; + sheet::DataPilotTableResultData aResData; + CPPUNIT_ASSERT(aTempAny >>= aResData); + sal_Int32 nDim = maDataFieldDims[aResData.DataFieldIndex]; + sheet::DataResult aRes = aResData.Result; + double nVal = aRes.Value; + + Sequence< Sequence<Any> > aData = xDPTable->getDrillDownData(rResultCell); + double sum = 0; + + if( aData.getLength() > 1 ) + { + sum = std::accumulate(std::next(aData.begin()), aData.end(), double(0), + [nDim](double res, const Sequence<Any>& rSeq) { + double nValue = 0; + if (rSeq[nDim] >>= nValue) + return res + nValue; + return res; + }); + } + + CPPUNIT_ASSERT_DOUBLES_EQUAL(nVal, sum, 1E-12); + } + + +} + +void XDataPilotTable2::testGetOutputRangeByType() +{ + uno::Reference< sheet::XDataPilotTable2 > xDPTable(initDP2(), UNO_QUERY_THROW); + getOutputRanges(xDPTable); + + // check for wrong arguments + bool bCaught = false; + try + { + xDPTable->getOutputRangeByType(-1); + } + catch ( const lang::IllegalArgumentException& ) + { + bCaught = true; + } + CPPUNIT_ASSERT(bCaught); + + bCaught = false; + try + { + xDPTable->getOutputRangeByType(100); + } + catch ( const lang::IllegalArgumentException& ) + { + bCaught = true; + } + CPPUNIT_ASSERT(bCaught); + + // make sure the whole range is not empty + CPPUNIT_ASSERT( maRangeWhole.EndColumn - maRangeWhole.StartColumn > 0); + CPPUNIT_ASSERT( maRangeWhole.EndRow - maRangeWhole.StartRow > 0); + + //table range must be of equal width with the whole range, and the same bottom + CPPUNIT_ASSERT_EQUAL( maRangeWhole.Sheet, maRangeTable.Sheet ); + CPPUNIT_ASSERT_EQUAL( maRangeWhole.EndRow, maRangeTable.EndRow ); + CPPUNIT_ASSERT_EQUAL( maRangeWhole.StartColumn, maRangeTable.StartColumn ); + CPPUNIT_ASSERT_EQUAL( maRangeWhole.EndColumn, maRangeTable.EndColumn ); + + //result range must be smaller than the table range, and must share the same lower-right corner + CPPUNIT_ASSERT_EQUAL( maRangeTable.Sheet, maRangeResult.Sheet ); + CPPUNIT_ASSERT( maRangeResult.StartColumn >= maRangeTable.StartColumn ); + CPPUNIT_ASSERT( maRangeResult.StartRow >= maRangeTable.StartRow ); + CPPUNIT_ASSERT_EQUAL( maRangeTable.EndRow, maRangeResult.EndRow ); + CPPUNIT_ASSERT_EQUAL( maRangeTable.EndColumn, maRangeResult.EndColumn ); + +} + +void XDataPilotTable2::testInsertDrillDownSheet() +{ + uno::Reference< sheet::XDataPilotTable2 > xDPTable(initDP2(), UNO_QUERY_THROW); + sal_Int32 nCellCount = maResultCells.size(); + + uno::Reference< sheet::XSpreadsheets > xSheets(getSheets(), UNO_QUERY_THROW); + uno::Reference< container::XIndexAccess > xIA(xSheets, UNO_QUERY_THROW); + sal_Int32 nSheetCount = xIA->getCount(); + + for (sal_Int32 i = 0; i < nCellCount; ++i) + { + table::CellAddress aAddr = maResultCells[i]; + uno::Sequence< uno::Sequence< Any > > aData = xDPTable->getDrillDownData(aAddr); + xDPTable->insertDrillDownSheet(aAddr); + + sal_Int32 nNewSheetCount= xIA->getCount(); + if (nNewSheetCount == nSheetCount + 1) + { + CPPUNIT_ASSERT(aData.getLength() >= 2); + uno::Reference< sheet::XSpreadsheet > xSheet(xIA->getByIndex(aAddr.Sheet),UNO_QUERY_THROW); + + checkDrillDownSheetContent(xSheet, aData); + + uno::Reference< container::XNamed > xNamed(xSheet, UNO_QUERY_THROW); + OUString aName = xNamed->getName(); + xSheets->removeByName(aName); + } + else if (nNewSheetCount == nSheetCount) + { + if (aData.getLength() > 1) + { + CPPUNIT_ASSERT(false); + } + } + else + { + CPPUNIT_ASSERT(false); + } + + } +} + +void XDataPilotTable2::buildResultCells( uno::Reference< sheet::XDataPilotTable2 > const & xDPTable) +{ + getOutputRanges(xDPTable); + maResultCells.clear(); + + for ( sal_Int32 x = maRangeResult.StartColumn; x < maRangeResult.EndColumn; ++x) + { + for( sal_Int32 y = maRangeResult.StartRow; y < maRangeResult.EndRow; ++y) + { + table::CellAddress aAddr; + aAddr.Sheet = maRangeResult.Sheet; + aAddr.Column = x; + aAddr.Row = y; + sheet::DataPilotTablePositionData aPosData = xDPTable->getPositionData(aAddr); + if (aPosData.PositionType != sheet::DataPilotTablePositionType::RESULT) + { + CPPUNIT_ASSERT(false); + } + maResultCells.push_back(aAddr); + } + } +} + +void XDataPilotTable2::getOutputRanges( uno::Reference< sheet::XDataPilotTable2 > const & xDPTable) +{ + maRangeWhole = xDPTable->getOutputRangeByType(sheet::DataPilotOutputRangeType::WHOLE); + maRangeTable = xDPTable->getOutputRangeByType(sheet::DataPilotOutputRangeType::TABLE); + maRangeResult = xDPTable->getOutputRangeByType(sheet::DataPilotOutputRangeType::RESULT); +} + +void XDataPilotTable2::buildDataFields( uno::Reference< sheet::XDataPilotTable2 > const & xDPTable ) +{ + uno::Reference< sheet::XDataPilotDescriptor > xDesc(xDPTable, UNO_QUERY_THROW); + uno::Reference< container::XIndexAccess > xIndex(xDesc->getDataPilotFields(), UNO_SET_THROW); + + sal_Int32 nFieldCount = xIndex->getCount(); + for( sal_Int32 i = 0; i < nFieldCount; ++i) + { + uno::Reference< beans::XPropertySet > xPropSet(xIndex->getByIndex(i), UNO_QUERY_THROW); + Any aAny = xPropSet->getPropertyValue("Orientation"); + sheet::DataPilotFieldOrientation aOrientation; + CPPUNIT_ASSERT( aAny >>= aOrientation ); + + if ( aOrientation == sheet::DataPilotFieldOrientation_DATA ) + { + maDataFieldDims.push_back( i ); + } + } +} + +namespace { + +table::CellAddress getLastUsedCellAddress( uno::Reference< sheet::XSpreadsheet > const & xSheet, sal_Int32 nCol, sal_Int32 nRow ) +{ + uno::Reference< sheet::XSheetCellRange > xSheetRange( xSheet->getCellRangeByPosition(nCol, nRow, nCol, nRow), UNO_QUERY_THROW); + uno::Reference< sheet::XSheetCellCursor > xCursor = xSheet->createCursorByRange(xSheetRange); + uno::Reference< table::XCellCursor > xCellCursor(xCursor, UNO_QUERY_THROW); + xCellCursor->gotoEnd(); + + uno::Reference< sheet::XCellAddressable > xCellAddr(xCursor->getCellByPosition(0, 0), UNO_QUERY_THROW); + return xCellAddr->getCellAddress(); +} + +} + +void XDataPilotTable2::checkDrillDownSheetContent(uno::Reference< sheet::XSpreadsheet > const & xSheet, const uno::Sequence< uno::Sequence< Any > >& aData) +{ + table::CellAddress aLastCell = getLastUsedCellAddress(xSheet, 0, 0); + CPPUNIT_ASSERT(aData.hasElements()); + CPPUNIT_ASSERT(aLastCell.Row); + CPPUNIT_ASSERT(aLastCell.Column); + + CPPUNIT_ASSERT_EQUAL(aData.getLength(), aLastCell.Row + 1); + CPPUNIT_ASSERT_EQUAL(aData[0].getLength(), aLastCell.Column + 1); + + uno::Reference< table::XCellRange > xCellRange = xSheet->getCellRangeByPosition(0, 0, aLastCell.Column, aLastCell.Row); + uno::Reference< sheet::XCellRangeData > xCellRangeData(xCellRange, UNO_QUERY_THROW); + + uno::Sequence< uno::Sequence< Any > > aSheetData = xCellRangeData->getDataArray(); + for (sal_Int32 x = 0; x < aSheetData.getLength(); ++x) + { + for(sal_Int32 y = 0; y < aSheetData[x].getLength(); ++y) + { + Any& aCell1 = aSheetData[x][y]; + const Any& aCell2 = aData[x][y]; + CPPUNIT_ASSERT_EQUAL(aCell2, aCell1); + } + } +} + +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xdatapilottables.cxx b/test/source/sheet/xdatapilottables.cxx new file mode 100644 index 000000000..b666650ea --- /dev/null +++ b/test/source/sheet/xdatapilottables.cxx @@ -0,0 +1,53 @@ +/* -*- 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/sheet/xdatapilottables.hxx> + +#include <com/sun/star/sheet/XDataPilotDescriptor.hpp> +#include <com/sun/star/sheet/XDataPilotTables.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XDataPilotTables::testXDataPilotTables() +{ + uno::Reference<sheet::XDataPilotTables> xDPT(init(), UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet(getXSpreadsheet(), UNO_QUERY_THROW); + + uno::Reference<sheet::XDataPilotDescriptor> xDPD(xDPT->createDataPilotDescriptor(), + UNO_SET_THROW); + + xDPT->insertNewByName("XDataPilotTables", table::CellAddress(0, 9, 8), xDPD); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to insert new DataPilotTable", OUString("Filter"), + xSheet->getCellByPosition(9, 8)->getFormula()); + + CPPUNIT_ASSERT_THROW_MESSAGE( + "No exception thrown, when inserting element with existing name", + xDPT->insertNewByName("XDataPilotTables", table::CellAddress(0, 7, 7), xDPD), + css::uno::RuntimeException); + + xDPT->removeByName("XDataPilotTables"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to remove DataPilotTable", OUString(""), + xSheet->getCellByPosition(9, 8)->getFormula()); + + CPPUNIT_ASSERT_THROW_MESSAGE("No exception, when removing no existing element", + xDPT->removeByName("XDataPilotTables"), + css::uno::RuntimeException); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xdatapilottablessupplier.cxx b/test/source/sheet/xdatapilottablessupplier.cxx new file mode 100644 index 000000000..66b8d44ca --- /dev/null +++ b/test/source/sheet/xdatapilottablessupplier.cxx @@ -0,0 +1,29 @@ +/* -*- 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/sheet/xdatapilottablessupplier.hxx> + +#include <com/sun/star/sheet/XDataPilotTables.hpp> +#include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp> +#include <com/sun/star/uno/Reference.hxx> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XDataPilotTablesSupplier::testGetDataPilotTables() +{ + uno::Reference<sheet::XDataPilotTablesSupplier> xDPTS(init(), UNO_QUERY_THROW); + + uno::Reference<sheet::XDataPilotTables> xDPT(xDPTS->getDataPilotTables(), UNO_SET_THROW); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xddelink.cxx b/test/source/sheet/xddelink.cxx new file mode 100644 index 000000000..cf56fe9cd --- /dev/null +++ b/test/source/sheet/xddelink.cxx @@ -0,0 +1,44 @@ +/* -*- 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/sheet/xddelink.hxx> + +#include <com/sun/star/sheet/XDDELink.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XDDELink::testGetApplication() +{ + uno::Reference<sheet::XDDELink> xLink(init(), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to execute getApplication()", OUString("soffice"), + xLink->getApplication()); +} +void XDDELink::testGetItem() +{ + uno::Reference<sheet::XDDELink> xLink(init(), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to execute getItem()", OUString("Sheet1.A1"), + xLink->getItem()); +} +void XDDELink::testGetTopic() +{ + uno::Reference<sheet::XDDELink> xLink(init(), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to execute getTopic()", m_URL, xLink->getTopic()); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xddelinks.cxx b/test/source/sheet/xddelinks.cxx new file mode 100644 index 000000000..fc18a16a1 --- /dev/null +++ b/test/source/sheet/xddelinks.cxx @@ -0,0 +1,41 @@ +/* -*- 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/sheet/xddelinks.hxx> + +#include <com/sun/star/sheet/DDELinkMode.hpp> +#include <com/sun/star/sheet/XDDELink.hpp> +#include <com/sun/star/sheet/XDDELinks.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XDDELinks::testAddDDELink() +{ + uno::Reference<sheet::XDDELinks> xLinks(init(), UNO_QUERY_THROW); + + uno::Reference<sheet::XDDELink> xLink + = xLinks->addDDELink("soffice", m_aTopic, "Sheet1.A1", sheet::DDELinkMode_DEFAULT); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to execute getApplication()", OUString("soffice"), + xLink->getApplication()); + CPPUNIT_ASSERT_MESSAGE("Unable to execute getTopic()", + xLink->getTopic().endsWith("ScDDELinksObj.ods")); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to execute getItem()", OUString("Sheet1.A1"), + xLink->getItem()); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xdocumentauditing.cxx b/test/source/sheet/xdocumentauditing.cxx new file mode 100644 index 000000000..acbab0968 --- /dev/null +++ b/test/source/sheet/xdocumentauditing.cxx @@ -0,0 +1,139 @@ +/* -*- 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/sheet/xdocumentauditing.hxx> + +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/drawing/XDrawPage.hpp> +#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/frame/DispatchHelper.hpp> +#include <com/sun/star/frame/XDispatchHelper.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/sheet/XDocumentAuditing.hpp> +#include <com/sun/star/sheet/XSheetAuditing.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/sheet/XSpreadsheets.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> + +#include <comphelper/processfactory.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XDocumentAuditing::dispatch(const uno::Reference<frame::XFrame>& xFrame, + const uno::Sequence<beans::PropertyValue>& rArguments) +{ + uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext(); + uno::Reference<frame::XDispatchHelper> xDispatchHelper(frame::DispatchHelper::create(xContext), + UNO_SET_THROW); + CPPUNIT_ASSERT(xDispatchHelper.is()); + + uno::Reference<frame::XDispatchProvider> xDispatchProvider(xFrame, UNO_QUERY_THROW); + CPPUNIT_ASSERT(xDispatchProvider.is()); + + xDispatchHelper->executeDispatch(xDispatchProvider, ".uno:AutoRefreshArrows", "", 0, + rArguments); +} + +bool XDocumentAuditing::hasRightAmountOfShapes(const uno::Reference<drawing::XDrawPage>& xDrawPage, + sal_Int32 nElementCount, sal_Int32 nShapes) +{ + const sal_Int32 nCount = xDrawPage->getCount(); + if (nCount != nElementCount + nShapes) + return false; + else + { + if (nShapes >= 0) + { + for (sal_Int32 i = nElementCount; i < nCount; i++) + { + uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(i), UNO_QUERY_THROW); + m_Position = xShape->getPosition(); + } + } + } + return true; +} + +void XDocumentAuditing::testRefreshArrows() +{ + uno::Reference<sheet::XDocumentAuditing> xDocumentAuditing(init(), UNO_QUERY_THROW); + + uno::Reference<sheet::XSpreadsheetDocument> xDoc(xDocumentAuditing, UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), UNO_SET_THROW); + uno::Reference<container::XIndexAccess> xIA(xSheets, UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet1(xIA->getByIndex(0), UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet2(xIA->getByIndex(1), UNO_QUERY_THROW); + + uno::Reference<drawing::XDrawPagesSupplier> xDPS(xDocumentAuditing, UNO_QUERY_THROW); + uno::Reference<drawing::XDrawPage> xDrawPage(xDPS->getDrawPages()->getByIndex(1), + UNO_QUERY_THROW); + + sal_Int32 nDrawPageElementCount = 0; + if (xDrawPage->hasElements()) + nDrawPageElementCount = xDrawPage->getCount(); + + uno::Sequence<beans::PropertyValue> aPropertyValue(1); + uno::Any aValue; + aValue <<= false; + aPropertyValue[0].Name = "AutoRefreshArrows"; + aPropertyValue[0].Value = aValue; + uno::Reference<frame::XModel> xModel(xDocumentAuditing, UNO_QUERY_THROW); + dispatch(xModel->getCurrentController()->getFrame(), aPropertyValue); + + xSheet1->getCellByPosition(6, 6)->setValue(9); + uno::Reference<container::XNamed> xNA1(xSheet1, UNO_QUERY_THROW); + OUString sSheet1Name = xNA1->getName(); + + xSheet2->getCellByPosition(6, 6)->setValue(16); + xSheet2->getCellByPosition(6, 7)->setFormula("= SQRT(G7)"); + + uno::Reference<sheet::XSheetAuditing> xSheetAuditing(xSheet2, UNO_QUERY_THROW); + xSheetAuditing->showPrecedents(table::CellAddress(1, 6, 7)); + bool bResult = hasRightAmountOfShapes(xDrawPage, nDrawPageElementCount, 1); + CPPUNIT_ASSERT_MESSAGE("Wrong amount of shapes on page", bResult); + awt::Point Position0 = m_Position; + + CPPUNIT_ASSERT_DOUBLES_EQUAL(4, xSheet2->getCellByPosition(6, 7)->getValue(), 0.1); + xSheet2->getCellByPosition(6, 7)->setFormula("= SQRT(" + sSheet1Name + ".G7)"); + CPPUNIT_ASSERT_DOUBLES_EQUAL(3, xSheet2->getCellByPosition(6, 7)->getValue(), 0.1); + + bResult = hasRightAmountOfShapes(xDrawPage, nDrawPageElementCount, 1); + CPPUNIT_ASSERT_MESSAGE("Wrong amount of shapes on page", bResult); + awt::Point Position1 = m_Position; + + CPPUNIT_ASSERT_MESSAGE("Arrow has been refreshed", + Position0.X == Position1.X && Position0.Y == Position1.Y); + + xDocumentAuditing->refreshArrows(); + + bResult = hasRightAmountOfShapes(xDrawPage, nDrawPageElementCount, 1); + CPPUNIT_ASSERT_MESSAGE("Wrong amount of shapes on page", bResult); + awt::Point Position2 = m_Position; + + CPPUNIT_ASSERT_MESSAGE("Arrow has not been refreshed", + Position1.X != Position2.X || Position1.Y != Position2.Y); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xformulaquery.cxx b/test/source/sheet/xformulaquery.cxx new file mode 100644 index 000000000..32540847e --- /dev/null +++ b/test/source/sheet/xformulaquery.cxx @@ -0,0 +1,66 @@ +/* -*- 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/cppunitasserthelper.hxx> +#include <test/sheet/xformulaquery.hxx> + +#include <com/sun/star/sheet/XFormulaQuery.hpp> +#include <com/sun/star/sheet/XSheetCellRanges.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/table/XCell.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XFormulaQuery::testQueryDependents() +{ + uno::Reference<sheet::XSpreadsheet> xSheet(getXSpreadsheet(), UNO_QUERY_THROW); + xSheet->getCellByPosition(0, 0)->setValue(1); + xSheet->getCellByPosition(1, 0)->setValue(1); + xSheet->getCellByPosition(2, 0)->setValue(1); + xSheet->getCellByPosition(3, 0)->setValue(1); + + uno::Reference<table::XCell> xCell = getXCell(); + xCell->setFormula("=SUM(A1:D1)"); + + uno::Reference<sheet::XFormulaQuery> xFormulaQuery(init(), UNO_QUERY_THROW); + uno::Reference<sheet::XSheetCellRanges> xSCR = xFormulaQuery->queryDependents(false); + uno::Sequence<table::CellRangeAddress> aCellRangeAddress = xSCR->getRangeAddresses(); + + CPPUNIT_ASSERT_EQUAL(aCellRangeAddress[m_nIdxDependents], m_aCellRangeAddressDependents); +} + +void XFormulaQuery::testQueryPrecedents() +{ + uno::Reference<sheet::XSpreadsheet> xSheet(getXSpreadsheet(), UNO_QUERY_THROW); + xSheet->getCellByPosition(0, 0)->setValue(1); + xSheet->getCellByPosition(1, 0)->setValue(1); + xSheet->getCellByPosition(2, 0)->setValue(1); + xSheet->getCellByPosition(3, 0)->setValue(1); + xSheet->getCellByPosition(1, 2)->setFormula("=A16 * 2"); + + uno::Reference<table::XCell> xCell = getXCell(); + xCell->setFormula("=SUM(A1:D1)"); + + uno::Reference<sheet::XFormulaQuery> xFormulaQuery(init(), UNO_QUERY_THROW); + uno::Reference<sheet::XSheetCellRanges> xSCR = xFormulaQuery->queryPrecedents(false); + uno::Sequence<table::CellRangeAddress> aCellRangeAddress = xSCR->getRangeAddresses(); + + CPPUNIT_ASSERT_EQUAL(aCellRangeAddress[m_nIdxPrecedents], m_aCellRangeAddressPrecedents); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xfunctiondescriptions.cxx b/test/source/sheet/xfunctiondescriptions.cxx new file mode 100644 index 000000000..1b4ef645e --- /dev/null +++ b/test/source/sheet/xfunctiondescriptions.cxx @@ -0,0 +1,73 @@ +/* -*- 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 <random> + +#include <test/sheet/xfunctiondescriptions.hxx> + +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/sheet/XFunctionDescriptions.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XFunctionDescriptions::testGetById() +{ + uno::Reference<sheet::XFunctionDescriptions> xFD(init(), UNO_QUERY_THROW); + + const sal_Int32 nCount = xFD->getCount(); + CPPUNIT_ASSERT_MESSAGE("No FunctionDescriptions available", 0 < nCount); + + // first grab a random function descriptions + std::random_device rd; + std::mt19937 gen(rd()); + std::uniform_int_distribution<> distr(0, nCount - 1); + int nNumber = distr(gen); + + sal_Int32 aId1 = 0; + OUString aName1; + uno::Sequence<beans::PropertyValue> aProps1; + CPPUNIT_ASSERT(xFD->getByIndex(nNumber) >>= aProps1); + for (const auto& aProp : std::as_const(aProps1)) + { + if (aProp.Name == "Id") + aId1 = aProp.Value.get<sal_Int32>(); + if (aProp.Name == "Name") + aName1 = aProp.Value.get<OUString>(); + } + + // fetch the same descriptions by its id + sal_Int32 aId2 = 0; + OUString aName2; + const uno::Sequence<beans::PropertyValue> aProps2 = xFD->getById(aId1); + CPPUNIT_ASSERT_MESSAGE("Received empty FunctionDescriptions from getById()", + aProps2.hasElements()); + for (const auto& aProp : aProps2) + { + if (aProp.Name == "Id") + aId2 = aProp.Value.get<sal_Int32>(); + if (aProp.Name == "Name") + aName2 = aProp.Value.get<OUString>(); + } + CPPUNIT_ASSERT_EQUAL_MESSAGE("Received wrong FunctionDescriptions (Id)", aId1, aId2); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Received wrong FunctionDescriptions (Name)", aName1, aName2); + + CPPUNIT_ASSERT_THROW_MESSAGE("No IllegalArgumentException thrown", xFD->getById(-1), + css::lang::IllegalArgumentException); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xgoalseek.cxx b/test/source/sheet/xgoalseek.cxx new file mode 100644 index 000000000..986af4056 --- /dev/null +++ b/test/source/sheet/xgoalseek.cxx @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xgoalseek.hxx> +#include <com/sun/star/sheet/XGoalSeek.hpp> +#include <com/sun/star/sheet/GoalResult.hpp> +#include <com/sun/star/table/CellAddress.hpp> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void XGoalSeek::testSeekGoal() +{ + uno::Reference< sheet::XGoalSeek > xGoalSeek(init(), UNO_QUERY_THROW); + + table::CellAddress aFormulaAddr(0,3,5); + table::CellAddress aVariableAddr(0,3,4); + sheet::GoalResult aResult = xGoalSeek->seekGoal(aFormulaAddr, aVariableAddr, "4"); + + double nDivergence = 0.01; + CPPUNIT_ASSERT( aResult.Divergence < nDivergence ); + CPPUNIT_ASSERT_DOUBLES_EQUAL(16, aResult.Result, nDivergence); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xheaderfootercontent.cxx b/test/source/sheet/xheaderfootercontent.cxx new file mode 100644 index 000000000..1683cc7e7 --- /dev/null +++ b/test/source/sheet/xheaderfootercontent.cxx @@ -0,0 +1,48 @@ +/* -*- 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/sheet/xheaderfootercontent.hxx> + +#include <com/sun/star/sheet/XHeaderFooterContent.hpp> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XHeaderFooterContent::testGetCenterText() +{ + uno::Reference<sheet::XHeaderFooterContent> xHFC(init(), UNO_QUERY_THROW); + + uno::Reference<text::XText> xText(xHFC->getCenterText(), UNO_SET_THROW); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get center text", OUString("CENTER"), + xText->getString()); +} + +void XHeaderFooterContent::testGetLeftText() +{ + uno::Reference<sheet::XHeaderFooterContent> xHFC(init(), UNO_QUERY_THROW); + + uno::Reference<text::XText> xText(xHFC->getLeftText(), UNO_SET_THROW); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get left text", OUString("LEFT"), xText->getString()); +} +void XHeaderFooterContent::testGetRightText() +{ + uno::Reference<sheet::XHeaderFooterContent> xHFC(init(), UNO_QUERY_THROW); + + uno::Reference<text::XText> xText(xHFC->getRightText(), UNO_SET_THROW); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get right text", OUString("RIGHT"), xText->getString()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xlabelrange.cxx b/test/source/sheet/xlabelrange.cxx new file mode 100644 index 000000000..ed7195123 --- /dev/null +++ b/test/source/sheet/xlabelrange.cxx @@ -0,0 +1,50 @@ +/* -*- 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/sheet/xlabelrange.hxx> +#include <test/cppunitasserthelper.hxx> + +#include <com/sun/star/sheet/XLabelRange.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XLabelRange::testGetSetDataArea() +{ + uno::Reference<sheet::XLabelRange> xLabelRange(init(), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get DataArea", table::CellRangeAddress(0, 0, 0, 0, 1), + xLabelRange->getDataArea()); + + table::CellRangeAddress aDataAddr(1, 0, 1, 0, 8); + xLabelRange->setDataArea(aDataAddr); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set DataArea", aDataAddr, xLabelRange->getDataArea()); +} + +void XLabelRange::testGetSetLabelArea() +{ + uno::Reference<sheet::XLabelRange> xLabelRange(init(), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get DataArea", table::CellRangeAddress(0, 0, 1, 0, 6), + xLabelRange->getLabelArea()); + + table::CellRangeAddress aLabelAddr(1, 0, 1, 0, 8); + xLabelRange->setLabelArea(aLabelAddr); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set LabelArea", aLabelAddr, + xLabelRange->getLabelArea()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xlabelranges.cxx b/test/source/sheet/xlabelranges.cxx new file mode 100644 index 000000000..36e2edb45 --- /dev/null +++ b/test/source/sheet/xlabelranges.cxx @@ -0,0 +1,44 @@ +/* -*- 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/sheet/xlabelranges.hxx> + +#include <com/sun/star/sheet/XLabelRanges.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XLabelRanges::testAddNew() +{ + uno::Reference<sheet::XLabelRanges> xLabelRanges(init(), UNO_QUERY_THROW); + + const sal_Int32 nCount = xLabelRanges->getCount(); + xLabelRanges->addNew(table::CellRangeAddress(0, 1, 0, 1, 0), + table::CellRangeAddress(0, 1, 1, 1, 6)); + + CPPUNIT_ASSERT_MESSAGE("Unable to add new range", nCount < xLabelRanges->getCount()); +} + +void XLabelRanges::testRemoveByIndex() +{ + uno::Reference<sheet::XLabelRanges> xLabelRanges(init(), UNO_QUERY_THROW); + + const sal_Int32 nCount = xLabelRanges->getCount(); + xLabelRanges->removeByIndex(nCount - 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to remove range", (nCount - 1), xLabelRanges->getCount()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xmultiformulatokens.cxx b/test/source/sheet/xmultiformulatokens.cxx new file mode 100644 index 000000000..54e8a4e88 --- /dev/null +++ b/test/source/sheet/xmultiformulatokens.cxx @@ -0,0 +1,44 @@ +/* -*- 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/sheet/xmultiformulatokens.hxx> + +#include <com/sun/star/sheet/FormulaToken.hpp> +#include <com/sun/star/sheet/XMultiFormulaTokens.hpp> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XMultiFormulaTokens::testGetCount() +{ + uno::Reference<sheet::XMultiFormulaTokens> xMFT(init(), uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xMFT->getCount()); +} + +void XMultiFormulaTokens::testGetSetTokens() +{ + uno::Reference<sheet::XMultiFormulaTokens> xMFT(init(), uno::UNO_QUERY_THROW); + + uno::Sequence<sheet::FormulaToken> aTokens(1); + aTokens[0].OpCode = 2; + xMFT->setTokens(0, aTokens); + + CPPUNIT_ASSERT_EQUAL(aTokens[0].OpCode, xMFT->getTokens(0)[0].OpCode); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xmultipleoperation.cxx b/test/source/sheet/xmultipleoperation.cxx new file mode 100644 index 000000000..d97f26934 --- /dev/null +++ b/test/source/sheet/xmultipleoperation.cxx @@ -0,0 +1,95 @@ +/* -*- 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/sheet/xmultipleoperation.hxx> + +#include <com/sun/star/sheet/TableOperationMode.hpp> +#include <com/sun/star/sheet/XCellAddressable.hpp> +#include <com/sun/star/sheet/XCellRangeAddressable.hpp> +#include <com/sun/star/sheet/XMultipleOperation.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/table/XCell.hpp> +#include <com/sun/star/table/XCellRange.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XMultipleOperation::testSetTableOperation() +{ + uno::Reference<sheet::XMultipleOperation> xMultipleOperation(init(), UNO_QUERY_THROW); + + uno::Reference<sheet::XSpreadsheet> xSheet(getXSpreadsheet(), UNO_QUERY_THROW); + uno::Reference<table::XCellRange> xCellRange(xSheet->getCellRangeByName("$A$20:$A$20"), + UNO_SET_THROW); + uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddr(xCellRange, UNO_QUERY_THROW); + + uno::Reference<table::XCell> xCell = xSheet->getCellByPosition(0, 19); + xCell->setFormula("=a18+a19"); + + uno::Reference<table::XCell> xCell1 = xSheet->getCellByPosition(0, 17); + uno::Reference<sheet::XCellAddressable> xCellAddr1(xCell1, UNO_QUERY_THROW); + + uno::Reference<table::XCell> xCell2 = xSheet->getCellByPosition(0, 18); + uno::Reference<sheet::XCellAddressable> xCellAddr2(xCell2, UNO_QUERY_THROW); + + fillCells(xSheet); + xMultipleOperation->setTableOperation( + xCellRangeAddr->getRangeAddress(), sheet::TableOperationMode_ROW, + xCellAddr1->getCellAddress(), xCellAddr2->getCellAddress()); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 1,1 (OpMode: ROW)", 5.0, + xSheet->getCellByPosition(1, 1)->getValue()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 2,1 (OpMode: ROW)", 10.0, + xSheet->getCellByPosition(2, 1)->getValue()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 3,1 (OpMode: ROW)", 15.0, + xSheet->getCellByPosition(3, 1)->getValue()); + + fillCells(xSheet); + xMultipleOperation->setTableOperation( + xCellRangeAddr->getRangeAddress(), sheet::TableOperationMode_COLUMN, + xCellAddr1->getCellAddress(), xCellAddr2->getCellAddress()); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 1,1 (OpMode: COLUMN)", 12.0, + xSheet->getCellByPosition(1, 1)->getValue()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 1,2 (OpMode: COLUMN)", 24.0, + xSheet->getCellByPosition(1, 2)->getValue()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 1,3 (OpMode: COLUMN)", 36.0, + xSheet->getCellByPosition(1, 3)->getValue()); + + fillCells(xSheet); + xMultipleOperation->setTableOperation( + xCellRangeAddr->getRangeAddress(), sheet::TableOperationMode_BOTH, + xCellAddr1->getCellAddress(), xCellAddr2->getCellAddress()); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 1,1 (OpMode: BOTH)", 17.0, + xSheet->getCellByPosition(1, 1)->getValue()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 2,2 (OpMode: BOTH)", 34.0, + xSheet->getCellByPosition(2, 2)->getValue()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 3,3 (OpMode: BOTH)", 51.0, + xSheet->getCellByPosition(3, 3)->getValue()); +} + +void XMultipleOperation::fillCells(uno::Reference<sheet::XSpreadsheet> const& xSheet) +{ + for (unsigned int i = 1; i < 5; i++) + { + uno::Reference<table::XCell> xCellFill = xSheet->getCellByPosition(0, i); + xCellFill->setValue(i * 12); + xCellFill = xSheet->getCellByPosition(i, 0); + xCellFill->setValue(i * 5); + } +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xnamedrange.cxx b/test/source/sheet/xnamedrange.cxx new file mode 100644 index 000000000..3647a859b --- /dev/null +++ b/test/source/sheet/xnamedrange.cxx @@ -0,0 +1,113 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xnamedrange.hxx> + +#include <com/sun/star/sheet/XNamedRange.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/sheet/NamedRangeFlag.hpp> + +#include <cppunit/TestAssert.h> +#include <rtl/ustring.hxx> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void XNamedRange::testGetContent() +{ + uno::Reference< sheet::XNamedRange > xNamedRange = getNamedRange("initial1"); + + OUString const aExpectedContent("$Sheet1.$B$1"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong expected content for initial1 on GetContent", xNamedRange->getContent(), aExpectedContent); +} + +void XNamedRange::testSetContent() +{ + uno::Reference< sheet::XNamedRange > xNamedRange = getNamedRange("initial1"); + + OUString aExpectedContent; + + // test a cell + aExpectedContent = "D1"; + xNamedRange->setContent(aExpectedContent); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong expected content for initial1 after SetContent a cell", xNamedRange->getContent(), aExpectedContent); + + // test a cellrange + aExpectedContent = "D1:D10"; + xNamedRange->setContent(aExpectedContent); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong expected content for initial1 after SetContent a cellrange", xNamedRange->getContent(), aExpectedContent); + + // test a formula + aExpectedContent = "=D10"; + xNamedRange->setContent(aExpectedContent); + aExpectedContent = "D10"; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong expected content for initial1 after SetContent a formula", xNamedRange->getContent(), aExpectedContent); +} + +void XNamedRange::testGetType() +{ + uno::Reference< sheet::XNamedRange > xNamedRange = getNamedRange("initial1"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong expected Type", sal_Int32(0), xNamedRange->getType()); +} + +void XNamedRange::testSetType() +{ + uno::Reference< sheet::XNamedRange > xNamedRange = getNamedRange("initial1"); + + sal_Int32 nType = ::sheet::NamedRangeFlag::ROW_HEADER; + xNamedRange->setType(nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong expected Type ROW_HEADER after setting it", nType, xNamedRange->getType()); + + nType = ::sheet::NamedRangeFlag::COLUMN_HEADER; + xNamedRange->setType(nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong expected Type COLUMN_HEADER after setting it", nType, xNamedRange->getType()); + + nType = ::sheet::NamedRangeFlag::FILTER_CRITERIA; + xNamedRange->setType(nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong expected Type FILTER_CRITERIA after setting it", nType, xNamedRange->getType()); + + nType = ::sheet::NamedRangeFlag::PRINT_AREA; + xNamedRange->setType(nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong expected Type PRINT_AREA after setting it", nType, xNamedRange->getType()); + + nType = 0; + xNamedRange->setType(nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong expected Type 0 after setting it", nType, xNamedRange->getType()); +} + +void XNamedRange::testGetReferencePosition() +{ + uno::Reference< sheet::XNamedRange > xNamedRange = getNamedRange("initial2"); + + table::CellAddress aCellAddress = xNamedRange->getReferencePosition(); + // the expected address is on B1, as it was the active cell when initial2 was created + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong SHEET reference position", sal_Int16(0), aCellAddress.Sheet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong COLUMN reference position", sal_Int32(1), aCellAddress.Column); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong ROW reference position", sal_Int32(0), aCellAddress.Row); +} + +void XNamedRange::testSetReferencePosition() +{ + uno::Reference< sheet::XNamedRange > xNamedRange = getNamedRange("initial1"); + + table::CellAddress aBaseAddress(1,2,3); + + xNamedRange->setReferencePosition(aBaseAddress); + + table::CellAddress aCellAddress = xNamedRange->getReferencePosition(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong SHEET reference position after setting it", sal_Int16(1), aCellAddress.Sheet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong COLUMN reference position after setting it", sal_Int32(2), aCellAddress.Column); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong ROW reference position after setting it", sal_Int32(3), aCellAddress.Row); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xnamedranges.cxx b/test/source/sheet/xnamedranges.cxx new file mode 100644 index 000000000..3faa61893 --- /dev/null +++ b/test/source/sheet/xnamedranges.cxx @@ -0,0 +1,194 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xnamedranges.hxx> +#include <rtl/ustring.hxx> + +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/sheet/Border.hpp> +#include <com/sun/star/sheet/NamedRangeFlag.hpp> +#include <com/sun/star/sheet/XCellRangeAddressable.hpp> +#include <com/sun/star/sheet/XCellRangeReferrer.hpp> +#include <com/sun/star/sheet/XNamedRange.hpp> +#include <com/sun/star/sheet/XNamedRanges.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/table/XCell.hpp> +#include <com/sun/star/text/XTextRange.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +#include <iostream> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XNamedRanges::testAddNewByName() +{ + uno::Reference<sheet::XNamedRanges> xNamedRanges(init(), UNO_QUERY_THROW); + uno::Reference<container::XNameAccess> xNamedRangesNameAccess(getXNamedRanges(1), + UNO_QUERY_THROW); + + table::CellAddress aBaseAddress(0, 0, 0); + + sal_Int32 nType = 0; + OUString const aContent1("D1"); + OUString aName1("type_0"); + xNamedRanges->addNewByName(aName1, aContent1, aBaseAddress, nType); + CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type 0 - Normal case", + xNamedRanges->hasByName(aName1)); + + nType = ::sheet::NamedRangeFlag::COLUMN_HEADER; + OUString const aContent2("D2"); + OUString aName2("type_COLUMN_HEADER"); + xNamedRanges->addNewByName(aName2, aContent2, aBaseAddress, nType); + CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type COLUMN_HEADER", + xNamedRanges->hasByName(aName2)); + + nType = ::sheet::NamedRangeFlag::FILTER_CRITERIA; + OUString const aContent3("D3"); + OUString aName3("type_FILTER_CRITERIA"); + xNamedRanges->addNewByName(aName3, aContent3, aBaseAddress, nType); + CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type FILTER_CRITERIA", + xNamedRanges->hasByName(aName3)); + + nType = ::sheet::NamedRangeFlag::PRINT_AREA; + OUString const aContent4("D4"); + OUString aName4("type_PRINT_AREA"); + xNamedRanges->addNewByName(aName4, aContent4, aBaseAddress, nType); + CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type PRINT_AREA", + xNamedRanges->hasByName(aName4)); + + nType = ::sheet::NamedRangeFlag::ROW_HEADER; + OUString const aContent5("D5"); + OUString aName5("type_ROW_HEADER"); + xNamedRanges->addNewByName(aName5, aContent5, aBaseAddress, nType); + CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type ROW_HEADER", + xNamedRanges->hasByName(aName5)); +} + +void XNamedRanges::testAddNewFromTitles() +{ + uno::Reference<sheet::XNamedRanges> xNamedRanges(getXNamedRanges(1), UNO_QUERY_THROW); + uno::Reference<container::XIndexAccess> xNamedRangesIndex(xNamedRanges, UNO_QUERY_THROW); + uno::Reference<container::XNameAccess> xNamedRangesNameAccess(xNamedRanges, UNO_QUERY_THROW); + + table::CellRangeAddress aCellRangeAddress(1, 0, 0, 3, 3); + + OUString aString; + uno::Reference<table::XCell> xCell; + + xNamedRanges->addNewFromTitles(aCellRangeAddress, sheet::Border_TOP); + + for (sal_Int32 i = 1; i < 4; i++) + { + // verify namedrange exists + xCell = xSheet->getCellByPosition(i, 0); + uno::Reference<text::XTextRange> xTextRange(xCell, UNO_QUERY_THROW); + aString = xTextRange->getString(); + std::cout << "addNewFromTitles: verify " << aString << std::endl; + CPPUNIT_ASSERT_MESSAGE("Non existing NamedRange", xNamedRanges->hasByName(aString)); + + // verify it points on the right cell + uno::Any aNr = xNamedRangesNameAccess->getByName(aString); + uno::Reference<sheet::XNamedRange> xNamedRange(aNr, UNO_QUERY_THROW); + + uno::Reference<sheet::XCellRangeReferrer> xCellRangeRef(xNamedRange, UNO_QUERY_THROW); + uno::Reference<sheet::XCellRangeAddressable> xCellRangeAdr( + xCellRangeRef->getReferredCells(), UNO_QUERY_THROW); + table::CellRangeAddress cellRangeAddress = xCellRangeAdr->getRangeAddress(); + + CPPUNIT_ASSERT_EQUAL(i, cellRangeAddress.EndColumn); + CPPUNIT_ASSERT_EQUAL(i, cellRangeAddress.StartColumn); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), cellRangeAddress.StartRow); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), cellRangeAddress.EndRow); + CPPUNIT_ASSERT_EQUAL(sal_Int16(1), cellRangeAddress.Sheet); + } + + xNamedRanges->addNewFromTitles(aCellRangeAddress, sheet::Border_LEFT); + + for (sal_Int32 i = 1; i < 4; i++) + { + // verify namedrange exists + xCell = xSheet->getCellByPosition(0, i); + uno::Reference<text::XTextRange> xTextRange(xCell, UNO_QUERY_THROW); + aString = xTextRange->getString(); + std::cout << "verify " << aString << std::endl; + CPPUNIT_ASSERT_MESSAGE("Non existing NamedRange", xNamedRanges->hasByName(aString)); + + // verify it points on the right cell + uno::Any aNr = xNamedRangesNameAccess->getByName(aString); + uno::Reference<sheet::XNamedRange> xNamedRange(aNr, UNO_QUERY_THROW); + + uno::Reference<sheet::XCellRangeReferrer> xCellRangeRef(xNamedRange, UNO_QUERY_THROW); + uno::Reference<sheet::XCellRangeAddressable> xCellRangeAdr( + xCellRangeRef->getReferredCells(), UNO_QUERY_THROW); + table::CellRangeAddress cellRangeAddress = xCellRangeAdr->getRangeAddress(); + + CPPUNIT_ASSERT_EQUAL(i, cellRangeAddress.EndRow); + CPPUNIT_ASSERT_EQUAL(i, cellRangeAddress.StartRow); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), cellRangeAddress.StartColumn); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), cellRangeAddress.EndColumn); + CPPUNIT_ASSERT_EQUAL(sal_Int16(1), cellRangeAddress.Sheet); + } +} + +void XNamedRanges::testRemoveByName() +{ + uno::Reference<sheet::XNamedRanges> xNamedRanges(init(), UNO_QUERY_THROW); + uno::Reference<container::XIndexAccess> xIndex(xNamedRanges, UNO_QUERY_THROW); + + bool bHasIt = xNamedRanges->hasByName(maNameToRemove); + CPPUNIT_ASSERT_MESSAGE("NamedRange initial1 does not exist, can't remove it", bHasIt); + + if (bHasIt) + { + // remove existing + sal_Int32 nInitialCount = xIndex->getCount(); + xNamedRanges->removeByName(maNameToRemove); + sal_Int32 nNewCount = xIndex->getCount(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("NamedRange initial1 not removed", nNewCount, + nInitialCount - 1); + CPPUNIT_ASSERT_MESSAGE("Wrong NamedRange removed, initial1 still present", + !xNamedRanges->hasByName(maNameToRemove)); + // try to remove non existing + xNamedRanges->removeByName( + "dummyNonExistingNamedRange"); // an exception should be raised here + } +} + +void XNamedRanges::testOutputList() +{ + table::CellAddress aCellAddress(0, 2, 0); + uno::Reference<sheet::XNamedRanges> xNamedRanges(init(), UNO_QUERY_THROW); + uno::Reference<container::XIndexAccess> xNamedRangesIndex(init(), UNO_QUERY_THROW); + sal_Int32 nElementsCount = xNamedRangesIndex->getCount(); + + xNamedRanges->outputList(aCellAddress); + + OUString aString; + uno::Reference<table::XCell> xCell; + + for (sal_Int32 i = 0; i < nElementsCount; i++) + { + xCell = xSheet->getCellByPosition(2, i); + uno::Reference<text::XTextRange> xTextRange(xCell, UNO_QUERY_THROW); + aString = xTextRange->getString(); + std::cout << "verify " << aString << std::endl; + CPPUNIT_ASSERT_MESSAGE("Non existing NamedRange", xNamedRanges->hasByName(aString)); + } +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xprintareas.cxx b/test/source/sheet/xprintareas.cxx new file mode 100644 index 000000000..8c5ffe3d0 --- /dev/null +++ b/test/source/sheet/xprintareas.cxx @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xprintareas.hxx> +#include <com/sun/star/sheet/XPrintAreas.hpp> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest { + + void XPrintAreas::testSetAndGetPrintTitleColumns() + { + uno::Reference< sheet::XPrintAreas > xPrintAreas(init(), UNO_QUERY_THROW); + xPrintAreas->setPrintTitleColumns(true); + + CPPUNIT_ASSERT_MESSAGE("Wrong attribution at PrintTitleColumns", xPrintAreas->getPrintTitleColumns()); + + } + + void XPrintAreas::testSetAndGetPrintTitleRows() + { + uno::Reference< sheet::XPrintAreas > xPrintAreas(init(), UNO_QUERY_THROW); + xPrintAreas->setPrintTitleRows(true); + + CPPUNIT_ASSERT_MESSAGE("Wrong attribution at PrintTitleRows", xPrintAreas->getPrintTitleRows()); + } + + // the rest is right now in progress... + + +} diff --git a/test/source/sheet/xrecentfunctions.cxx b/test/source/sheet/xrecentfunctions.cxx new file mode 100644 index 000000000..7dded7f35 --- /dev/null +++ b/test/source/sheet/xrecentfunctions.cxx @@ -0,0 +1,76 @@ +/* -*- 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 <random> + +#include <test/sheet/xrecentfunctions.hxx> + +#include <com/sun/star/sheet/XRecentFunctions.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XRecentFunctions::testGetRecentFunctionIds() +{ + uno::Reference<sheet::XRecentFunctions> xRecentFunctions(init(), UNO_QUERY_THROW); + + uno::Sequence<sal_Int32> aIds = xRecentFunctions->getRecentFunctionIds(); + const sal_Int32 nNumber = aIds.getLength(); + CPPUNIT_ASSERT_MESSAGE("Recent IDs greater the max number", + nNumber <= xRecentFunctions->getMaxRecentFunctions()); + for (int i = 0; i < nNumber - 1; i++) + for (int j = i + 1; j < nNumber; j++) + CPPUNIT_ASSERT_MESSAGE("Same IDs found", aIds[i] != aIds[j]); +} + +void XRecentFunctions::testSetRecentFunctionIds() +{ + uno::Reference<sheet::XRecentFunctions> xRecentFunctions(init(), UNO_QUERY_THROW); + + const sal_Int32 nMaxNumber = xRecentFunctions->getMaxRecentFunctions(); + + // empty list + uno::Sequence<sal_Int32> aIds; + xRecentFunctions->setRecentFunctionIds(aIds); + + aIds = xRecentFunctions->getRecentFunctionIds(); + CPPUNIT_ASSERT_MESSAGE("Unable to set Ids (empty list)", !aIds.hasElements()); + + // max. size list + aIds.realloc(nMaxNumber); + std::random_device rd; + std::mt19937 gen(rd()); + std::uniform_int_distribution<> distr(1, nMaxNumber + 1); + + int nStartIdx = distr(gen); + for (int i = nStartIdx; i < nStartIdx + nMaxNumber; i++) + aIds[i - nStartIdx] = 1; + + xRecentFunctions->setRecentFunctionIds(aIds); + + aIds = xRecentFunctions->getRecentFunctionIds(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set Ids (max. size list)", nMaxNumber, + aIds.getLength()); +} + +void XRecentFunctions::testGetMaxRecentFunctions() +{ + uno::Reference<sheet::XRecentFunctions> xRecentFunctions(init(), UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("Unable to execute getMaxRecentFunctions()", + sal_Int32(0) != xRecentFunctions->getMaxRecentFunctions()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xscenario.cxx b/test/source/sheet/xscenario.cxx new file mode 100644 index 000000000..9d874d951 --- /dev/null +++ b/test/source/sheet/xscenario.cxx @@ -0,0 +1,43 @@ +/* -*- 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/sheet/xscenario.hxx> + +#include <com/sun/star/sheet/XScenario.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XScenario::testScenario() +{ + uno::Reference<sheet::XScenario> xScenario(getScenarioSpreadsheet(), UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("Sheet is not a Scenario sheet", xScenario->getIsScenario()); + + uno::Sequence<table::CellRangeAddress> aCellRangeAddr(1); + xScenario->addRanges(aCellRangeAddr); + xScenario->apply(); + + CPPUNIT_ASSERT_MESSAGE("Unable add and apply ranges", xScenario->getIsScenario()); + CPPUNIT_ASSERT_MESSAGE("Unable execute getScenarioComment()", + !xScenario->getScenarioComment().isEmpty()); + + xScenario->setScenarioComment("Test"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable execute setScenarioComment()", OUString("Test"), + xScenario->getScenarioComment()); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xscenarioenhanced.cxx b/test/source/sheet/xscenarioenhanced.cxx new file mode 100644 index 000000000..ed4d934b6 --- /dev/null +++ b/test/source/sheet/xscenarioenhanced.cxx @@ -0,0 +1,38 @@ +/* -*- 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/sheet/xscenarioenhanced.hxx> +#include <test/cppunitasserthelper.hxx> + +#include <com/sun/star/sheet/XScenarioEnhanced.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XScenarioEnhanced::testGetRanges() +{ + uno::Reference<sheet::XScenarioEnhanced> xSE(getScenarioSpreadsheet(), UNO_QUERY_THROW); + + uno::Sequence<table::CellRangeAddress> aCellRangeAddr = xSE->getRanges(); + CPPUNIT_ASSERT_MESSAGE("No ranges found", aCellRangeAddr.hasElements()); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong CellRangeAddres", table::CellRangeAddress(1, 0, 0, 10, 10), + aCellRangeAddr[0]); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xscenarios.cxx b/test/source/sheet/xscenarios.cxx new file mode 100644 index 000000000..d2335dda7 --- /dev/null +++ b/test/source/sheet/xscenarios.cxx @@ -0,0 +1,44 @@ +/* -*- 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/sheet/xscenarios.hxx> + +#include <com/sun/star/sheet/XScenarios.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XScenarios::testAddNewByName() +{ + uno::Reference<sheet::XScenarios> xScenarios(init(), UNO_QUERY_THROW); + + uno::Sequence<table::CellRangeAddress> aCellRangeAddresses(1); + aCellRangeAddresses[0] = table::CellRangeAddress(0, 0, 0, 0, 0); + + xScenarios->addNewByName("XScenarios2", aCellRangeAddresses, "new"); + CPPUNIT_ASSERT_MESSAGE("Unable to add new XScenario", xScenarios->hasByName("XScenarios2")); +} + +void XScenarios::testRemoveByName() +{ + uno::Reference<sheet::XScenarios> xScenarios(init(), UNO_QUERY_THROW); + + xScenarios->removeByName("XScenarios"); + CPPUNIT_ASSERT_MESSAGE("Unable to remove XScenario", !xScenarios->hasByName("XScenario")); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xscenariossupplier.cxx b/test/source/sheet/xscenariossupplier.cxx new file mode 100644 index 000000000..3b9ff68d4 --- /dev/null +++ b/test/source/sheet/xscenariossupplier.cxx @@ -0,0 +1,28 @@ +/* -*- 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/sheet/xscenariossupplier.hxx> + +#include <com/sun/star/sheet/XScenarios.hpp> +#include <com/sun/star/sheet/XScenariosSupplier.hpp> +#include <com/sun/star/uno/Reference.hxx> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XScenariosSupplier::testGetScenarios() +{ + uno::Reference<sheet::XScenariosSupplier> xSupplier(init(), UNO_QUERY_THROW); + uno::Reference<sheet::XScenarios> xScenarios(xSupplier->getScenarios(), UNO_SET_THROW); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsheetannotation.cxx b/test/source/sheet/xsheetannotation.cxx new file mode 100644 index 000000000..1ce4e1a79 --- /dev/null +++ b/test/source/sheet/xsheetannotation.cxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xsheetannotation.hxx> + +#include <com/sun/star/table/CellAddress.hpp> + +#include <cppunit/TestAssert.h> +#include <rtl/ustring.hxx> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void XSheetAnnotation::testGetPosition() +{ + uno::Reference< sheet::XSheetAnnotation > aSheetAnnotation (init(), UNO_QUERY_THROW); + table::CellAddress aResultCellAddress = aSheetAnnotation->getPosition(); + + //expected result + table::CellAddress aExpectedCellAddress; + aExpectedCellAddress.Sheet = 0; + aExpectedCellAddress.Row = 1; + aExpectedCellAddress.Column = 2; + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong SHEET reference position", aExpectedCellAddress.Sheet, aResultCellAddress.Sheet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong COLUMN reference position", aExpectedCellAddress.Column, aResultCellAddress.Column); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong ROW reference position", aExpectedCellAddress.Row, aResultCellAddress.Row); +} + +void XSheetAnnotation::testGetAuthor() +{ + uno::Reference< sheet::XSheetAnnotation > aSheetAnnotation (init(), UNO_QUERY_THROW); + OUString aAuthor = aSheetAnnotation->getAuthor(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong author", OUString("LG"), aAuthor); +} +void XSheetAnnotation::testGetDate() +{ + uno::Reference< sheet::XSheetAnnotation > aSheetAnnotation (init(), UNO_QUERY_THROW); + OUString aDate = aSheetAnnotation->getDate(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong date", OUString("01/17/2013"), aDate); +} +void XSheetAnnotation::testGetIsVisible() +{ + uno::Reference< sheet::XSheetAnnotation > aSheetAnnotation (init(), UNO_QUERY_THROW); + bool isVisible = aSheetAnnotation->getIsVisible(); + + CPPUNIT_ASSERT_MESSAGE("Wrong visible state", isVisible); +} +void XSheetAnnotation::testSetIsVisible() +{ + uno::Reference< sheet::XSheetAnnotation > aSheetAnnotation (init(), UNO_QUERY_THROW); + aSheetAnnotation->setIsVisible(false); + bool isVisible = aSheetAnnotation->getIsVisible(); + + CPPUNIT_ASSERT_MESSAGE("Visible state not changed", !isVisible); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xsheetannotationanchor.cxx b/test/source/sheet/xsheetannotationanchor.cxx new file mode 100644 index 000000000..9fbf4b00d --- /dev/null +++ b/test/source/sheet/xsheetannotationanchor.cxx @@ -0,0 +1,44 @@ +/* -*- 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/sheet/xsheetannotationanchor.hxx> +#include <test/cppunitasserthelper.hxx> + +#include <com/sun/star/sheet/XSheetAnnotation.hpp> +#include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XSheetAnnotationAnchor::testGetAnnotation() +{ + uno::Reference<sheet::XSheetAnnotationAnchor> xAnchor(init(), UNO_QUERY_THROW); + uno::Reference<sheet::XSheetAnnotation> xAnnotation(xAnchor->getAnnotation(), UNO_SET_THROW); + CPPUNIT_ASSERT_MESSAGE("Unable to get XSheetAnnotation", xAnnotation.is()); + + CPPUNIT_ASSERT_MESSAGE("Unable to check: getAuthor()", xAnnotation->getAuthor().isEmpty()); + CPPUNIT_ASSERT_MESSAGE("Unable to check: getDate()", !xAnnotation->getDate().isEmpty()); + CPPUNIT_ASSERT_MESSAGE("Unable to check: getIsVisible()", !xAnnotation->getIsVisible()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to check: getPosition()", table::CellAddress(0, 2, 3), + xAnnotation->getPosition()); + + xAnnotation->setIsVisible(false); + CPPUNIT_ASSERT_MESSAGE("Unable to setIsVisible() to false", !xAnnotation->getIsVisible()); + xAnnotation->setIsVisible(true); + CPPUNIT_ASSERT_MESSAGE("Unable to setIsVisible() to true", xAnnotation->getIsVisible()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsheetannotations.cxx b/test/source/sheet/xsheetannotations.cxx new file mode 100644 index 000000000..9f082eeb9 --- /dev/null +++ b/test/source/sheet/xsheetannotations.cxx @@ -0,0 +1,212 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xsheetannotations.hxx> + +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/sheet/XSheetAnnotation.hpp> +#include <com/sun/star/text/XTextRange.hpp> + +#include <cppunit/TestAssert.h> +#include <rtl/ustring.hxx> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void XSheetAnnotations::testCount() +{ + uno::Reference< sheet::XSheetAnnotations > aSheetAnnotations (init(), UNO_QUERY_THROW); + + // count on sheet 1 before inserting + uno::Reference< container::XIndexAccess > xAnnotationsIndex (aSheetAnnotations, UNO_QUERY_THROW); + sal_Int32 nBefore = xAnnotationsIndex->getCount(); + + // get Sheet 2 annotations + uno::Reference< sheet::XSheetAnnotations > xSheet2Annotations( getAnnotations(1), UNO_SET_THROW); + + // insert a note on sheet 2 + table::CellAddress aTargetCellAddress (1,0,0); + xSheet2Annotations->insertNew(aTargetCellAddress, "an inserted annotation on sheet 2"); + + // count again on sheet 1 + sal_Int32 nAfter = xAnnotationsIndex->getCount(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Annotations count should not change on sheet 1", nBefore, nAfter); +} + +void XSheetAnnotations::testInsertNew() +{ + uno::Reference< sheet::XSheetAnnotations > aSheetAnnotations (init(), UNO_QUERY_THROW); + + // count before inserting + uno::Reference< container::XIndexAccess > xAnnotationsIndex (aSheetAnnotations, UNO_QUERY_THROW); + sal_Int32 nBefore = xAnnotationsIndex->getCount(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "There should already be one note", sal_Int32(1), nBefore ); + + // insert the annotation + table::CellAddress aTargetCellAddress (0,3,4); + aSheetAnnotations->insertNew(aTargetCellAddress, "an inserted annotation"); + + // count after inserting + //uno::Reference< container::XIndexAccess > xAnnotationsIndexAfter (aSheetAnnotations, UNO_QUERY_THROW); + sal_Int32 nAfter = xAnnotationsIndex->getCount(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Annotations index not updated", nBefore + 1, nAfter); + + // is the position ok ? + uno::Reference< sheet::XSheetAnnotation > aLastSheetAnnotation (xAnnotationsIndex->getByIndex(nAfter-1), UNO_QUERY_THROW); + table::CellAddress aResultCellAddress = aLastSheetAnnotation->getPosition(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Insert Annotation - Wrong SHEET reference position", + aTargetCellAddress.Sheet, aResultCellAddress.Sheet); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Insert Annotation - Wrong COLUMN reference position", + aTargetCellAddress.Column, aResultCellAddress.Column); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Insert Annotation - Wrong ROW reference position", + aTargetCellAddress.Row, aResultCellAddress.Row); + + // is the string ok ? + uno::Reference< text::XTextRange > aTextSheetAnnotation(aLastSheetAnnotation, UNO_QUERY_THROW); + OUString aString = aTextSheetAnnotation->getString(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Insert Annotation - Wrong string", OUString("an inserted annotation"), + aString); + +} + +void XSheetAnnotations::testRemoveByIndex() +{ + uno::Reference< sheet::XSheetAnnotations > aSheetAnnotations (init(), UNO_QUERY_THROW); + + // insert some annotations + table::CellAddress aTargetCellAddress (0,4,5); + aSheetAnnotations->insertNew(aTargetCellAddress, "an inserted annotation 1"); + table::CellAddress aToBeRemovedCellAddress (0,5,6); + aSheetAnnotations->insertNew(aToBeRemovedCellAddress, "an inserted annotation 2"); + table::CellAddress aOtherCellAddress (0,7,8); + aSheetAnnotations->insertNew(aOtherCellAddress, "an inserted annotation 3"); + + // count before removing + uno::Reference< container::XIndexAccess > xAnnotationsIndex (aSheetAnnotations, UNO_QUERY_THROW); + sal_Int32 nBefore = xAnnotationsIndex->getCount(); + + // remove the xToBeRemovedCellAddress + aSheetAnnotations->removeByIndex(nBefore-2); + + // count after removing + //uno::Reference< container::XIndexAccess > xAnnotationsIndex (aSheetAnnotations, UNO_QUERY_THROW); + sal_Int32 nAfter = xAnnotationsIndex->getCount(); + + // the last position should be xOtherCellAddress + uno::Reference< sheet::XSheetAnnotation > aLastSheetAnnotation (xAnnotationsIndex->getByIndex(nAfter-1), UNO_QUERY_THROW); + table::CellAddress aResultCellAddress = aLastSheetAnnotation->getPosition(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Remove Annotation - Wrong SHEET reference position", + aOtherCellAddress.Sheet, aResultCellAddress.Sheet); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Remove Annotation - Wrong COLUMN reference position", + aOtherCellAddress.Column, aResultCellAddress.Column); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Remove Annotation - Wrong ROW reference position", + aOtherCellAddress.Row, aResultCellAddress.Row); + + // is the string ok ? + uno::Reference< text::XTextRange > aLastTextSheetAnnotation(aLastSheetAnnotation, UNO_QUERY_THROW); + OUString aLastString = aLastTextSheetAnnotation->getString(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Remove Annotation - Wrong string", + OUString("an inserted annotation 3"), aLastString); + + // the previous should be xTargetCellAddress + uno::Reference< sheet::XSheetAnnotation > aPreviousSheetAnnotation (xAnnotationsIndex->getByIndex(nAfter-2), UNO_QUERY_THROW); + table::CellAddress aPreviousCellAddress = aPreviousSheetAnnotation->getPosition(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Remove Annotation - Wrong SHEET reference position", + aTargetCellAddress.Sheet, aPreviousCellAddress.Sheet); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Remove Annotation - Wrong COLUMN reference position", + aTargetCellAddress.Column, aPreviousCellAddress.Column); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Remove Annotation - Wrong ROW reference position", + aTargetCellAddress.Row, aPreviousCellAddress.Row); + + // is the string ok ? + uno::Reference< text::XTextRange > aPreviousTextSheetAnnotation(aPreviousSheetAnnotation, UNO_QUERY_THROW); + OUString aPreviousString = aPreviousTextSheetAnnotation->getString(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Remove Annotation - Wrong string", + OUString("an inserted annotation 1"), aPreviousString); +} + +void XSheetAnnotations::testIndex() +{ + + // testing #fdo80551 - getByIndex not on the first sheet + + // insert annotations in first sheet + uno::Reference< sheet::XSheetAnnotations > aSheet0Annotations (init(), UNO_QUERY_THROW); + table::CellAddress aTargetCellAddress0 (0,0,1); + aSheet0Annotations->insertNew(aTargetCellAddress0, "an inserted annotation 1 on sheet 1"); + table::CellAddress aSecondTargetCellAddress0 (0,0,2); + aSheet0Annotations->insertNew(aSecondTargetCellAddress0, "an inserted annotation 2 on sheet 1"); + table::CellAddress aThirdCellAddress0 (0,0,3); + aSheet0Annotations->insertNew(aThirdCellAddress0, "an inserted annotation 3 on sheet 1"); + + // insert annotations in third sheet + uno::Reference< sheet::XSheetAnnotations > aSheet2Annotations (getAnnotations(2), UNO_SET_THROW); + table::CellAddress aTargetCellAddress2 (2,4,5); + aSheet2Annotations->insertNew(aTargetCellAddress2, "an inserted annotation 1 on sheet 3"); + table::CellAddress aSecondTargetCellAddress2 (2,5,6); + aSheet2Annotations->insertNew(aSecondTargetCellAddress2, "an inserted annotation 2 on sheet 3"); + table::CellAddress aThirdCellAddress2 (2,7,8); + aSheet2Annotations->insertNew(aThirdCellAddress2, "an inserted annotation 3 on sheet 3"); + + // get second annotation for second sheet + uno::Reference< sheet::XSheetAnnotations > aSheetAnnotations (getAnnotations(2), UNO_SET_THROW); + uno::Reference< container::XIndexAccess > xAnnotationsIndex (aSheetAnnotations, UNO_QUERY_THROW); + uno::Reference< sheet::XSheetAnnotation > aAnnotation (xAnnotationsIndex->getByIndex(1), UNO_QUERY_THROW); + + table::CellAddress aToBeAnalyzedCellAddress = aAnnotation->getPosition(); + + // is the CellAddress ok ? + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "GetByIndex Annotation - Wrong SHEET reference position", + aSecondTargetCellAddress2.Sheet, aToBeAnalyzedCellAddress.Sheet); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "GetByIndex Annotation - Wrong COLUMN reference position", + aSecondTargetCellAddress2.Column, aToBeAnalyzedCellAddress.Column); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "GetByIndex Annotation - Wrong ROW reference position", + aSecondTargetCellAddress2.Row, aToBeAnalyzedCellAddress.Row); + + // is the string ok ? + uno::Reference< text::XTextRange > aTextSheetAnnotation(aAnnotation, UNO_QUERY_THROW); + OUString aString = aTextSheetAnnotation->getString(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "GetByIndex Annotation - Wrong string", + OUString("an inserted annotation 2 on sheet 3"), aString); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xsheetannotationshapesupplier.cxx b/test/source/sheet/xsheetannotationshapesupplier.cxx new file mode 100644 index 000000000..9b2cd6d77 --- /dev/null +++ b/test/source/sheet/xsheetannotationshapesupplier.cxx @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xsheetannotationshapesupplier.hxx> + +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/sheet/XSheetAnnotationShapeSupplier.hpp> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + + +namespace apitest { + +void XSheetAnnotationShapeSupplier::testGetAnnotationShape() +{ + uno::Reference< sheet::XSheetAnnotationShapeSupplier > xSheetAnnotationShapeSupplier(init(), UNO_QUERY_THROW); + uno::Reference< drawing::XShape > xShape = xSheetAnnotationShapeSupplier->getAnnotationShape(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("getAnnotationShape() wrong X position", + sal_Int32(7373), xShape->getPosition().X); + CPPUNIT_ASSERT_EQUAL_MESSAGE("getAnnotationShape() wrong Y position", + sal_Int32(426), xShape->getPosition().Y); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("getAnnotationShape() wrong width", + sal_Int32(11275), xShape->getSize().Width); + CPPUNIT_ASSERT_EQUAL_MESSAGE("getAnnotationShape() wrong height", + sal_Int32(1386), xShape->getSize().Height); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xsheetannotationssupplier.cxx b/test/source/sheet/xsheetannotationssupplier.cxx new file mode 100644 index 000000000..aa6f7fd1c --- /dev/null +++ b/test/source/sheet/xsheetannotationssupplier.cxx @@ -0,0 +1,30 @@ +/* -*- 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/sheet/xsheetannotationssupplier.hxx> + +#include <com/sun/star/sheet/XSheetAnnotations.hpp> +#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp> +#include <com/sun/star/uno/Reference.hxx> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XSheetAnnotationsSupplier::testGetAnnotations() +{ + uno::Reference<sheet::XSheetAnnotationsSupplier> xSupplier(init(), UNO_QUERY_THROW); + + uno::Reference<sheet::XSheetAnnotations> xAnnotations(xSupplier->getAnnotations(), + UNO_SET_THROW); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsheetauditing.cxx b/test/source/sheet/xsheetauditing.cxx new file mode 100644 index 000000000..992a7441c --- /dev/null +++ b/test/source/sheet/xsheetauditing.cxx @@ -0,0 +1,137 @@ +/* -*- 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/sheet/xsheetauditing.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/drawing/XDrawPage.hpp> +#include <com/sun/star/drawing/XDrawPageSupplier.hpp> +#include <com/sun/star/sheet/XSheetAuditing.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/sheet/ValidationType.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/table/XCell.hpp> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XSheetAuditing::testShowHideDependents() +{ + uno::Reference<sheet::XSheetAuditing> xAuditing(init(), UNO_QUERY_THROW); + + uno::Reference<drawing::XDrawPageSupplier> xDPS(xAuditing, UNO_QUERY_THROW); + uno::Reference<drawing::XDrawPage> xDrawPage = xDPS->getDrawPage(); + const sal_Int32 nElements = xDrawPage->getCount(); + + xAuditing->showDependents(table::CellAddress(0, 8, 6)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to showDependents()", nElements + 1, + xDrawPage->getCount()); + + xAuditing->hideDependents(table::CellAddress(0, 8, 6)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to hideDependents()", nElements, xDrawPage->getCount()); +} + +void XSheetAuditing::testShowHidePrecedents() +{ + uno::Reference<sheet::XSheetAuditing> xAuditing(init(), UNO_QUERY_THROW); + + uno::Reference<drawing::XDrawPageSupplier> xDPS(xAuditing, UNO_QUERY_THROW); + uno::Reference<drawing::XDrawPage> xDrawPage = xDPS->getDrawPage(); + const sal_Int32 nElements = xDrawPage->getCount(); + + xAuditing->showPrecedents(table::CellAddress(0, 8, 6)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to showPrecedents()", nElements + 2, + xDrawPage->getCount()); + + xAuditing->hidePrecedents(table::CellAddress(0, 8, 6)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to showPrecedents()", nElements, xDrawPage->getCount()); +} + +void XSheetAuditing::testClearArrows() +{ + uno::Reference<sheet::XSheetAuditing> xAuditing(init(), UNO_QUERY_THROW); + + uno::Reference<drawing::XDrawPageSupplier> xDPS(xAuditing, UNO_QUERY_THROW); + uno::Reference<drawing::XDrawPage> xDrawPage = xDPS->getDrawPage(); + const sal_Int32 nElements = xDrawPage->getCount(); + + xAuditing->showPrecedents(table::CellAddress(0, 8, 6)); + xAuditing->showDependents(table::CellAddress(0, 8, 6)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set arrows", nElements + 3, xDrawPage->getCount()); + + xAuditing->clearArrows(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to clear arrows", nElements, xDrawPage->getCount()); +} + +void XSheetAuditing::testShowErrors() +{ + uno::Reference<sheet::XSheetAuditing> xAuditing(init(), UNO_QUERY_THROW); + + uno::Reference<drawing::XDrawPageSupplier> xDPS(xAuditing, UNO_QUERY_THROW); + uno::Reference<drawing::XDrawPage> xDrawPage = xDPS->getDrawPage(); + const sal_Int32 nElements = xDrawPage->getCount(); + + uno::Reference<sheet::XSpreadsheet> xSheet(xAuditing, UNO_QUERY_THROW); + uno::Reference<table::XCell> xCell = xSheet->getCellByPosition(7, 6); + xCell->setValue(-9); + xCell->setFormula("=SQRT(" + OUStringChar(static_cast<char>('A' + 7)) + OUString::number(7) + + ")"); + + uno::Reference<text::XText> xText(xCell, UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL_MESSAGE("No error code", OUString("Err:522"), xText->getString()); + + xAuditing->showErrors(table::CellAddress(0, 7, 6)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to show errors", nElements + 1, xDrawPage->getCount()); +} + +void XSheetAuditing::testShowInvalid() +{ + uno::Reference<sheet::XSheetAuditing> xAuditing(init(), UNO_QUERY_THROW); + + uno::Reference<drawing::XDrawPageSupplier> xDPS(xAuditing, UNO_QUERY_THROW); + uno::Reference<drawing::XDrawPage> xDrawPage = xDPS->getDrawPage(); + const sal_Int32 nElements = xDrawPage->getCount(); + + uno::Reference<sheet::XSpreadsheet> xSheet(xAuditing, UNO_QUERY_THROW); + uno::Reference<table::XCell> xCell = xSheet->getCellByPosition(7, 6); + xCell->setValue(2.5); + + uno::Reference<beans::XPropertySet> xPropSet(xCell, UNO_QUERY_THROW); + uno::Any aValidation = xPropSet->getPropertyValue("Validation"); + uno::Reference<beans::XPropertySet> xValidation(aValidation, UNO_QUERY_THROW); + uno::Any aAny; + + aAny <<= sheet::ValidationType_WHOLE; + xValidation->setPropertyValue("Type", aAny); + aAny <<= xValidation; + xPropSet->setPropertyValue("Validation", aAny); + xAuditing->showInvalid(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to show invalid (WHOLE)", nElements + 1, + xDrawPage->getCount()); + + xAuditing->clearArrows(); + + aAny <<= sheet::ValidationType_ANY; + xValidation->setPropertyValue("Type", aAny); + aAny <<= xValidation; + xPropSet->setPropertyValue("Validation", aAny); + + xAuditing->showInvalid(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to show invalid (ANY)", nElements, xDrawPage->getCount()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsheetcellcursor.cxx b/test/source/sheet/xsheetcellcursor.cxx new file mode 100644 index 000000000..fcaeb7fe7 --- /dev/null +++ b/test/source/sheet/xsheetcellcursor.cxx @@ -0,0 +1,138 @@ +/* -*- 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/sheet/xsheetcellcursor.hxx> + +#include <com/sun/star/sheet/XArrayFormulaRange.hpp> +#include <com/sun/star/sheet/XCellRangeAddressable.hpp> +#include <com/sun/star/sheet/XSheetCellCursor.hpp> +#include <com/sun/star/sheet/XSheetOperation.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/table/XCellRange.hpp> +#include <com/sun/star/table/XColumnRowRange.hpp> +#include <com/sun/star/util/XMergeable.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XSheetCellCursor::testCollapseToCurrentArray() +{ + uno::Reference<sheet::XSheetCellCursor> xSheetCellCursor(init(), UNO_QUERY_THROW); + + uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddressable(xSheetCellCursor, + UNO_QUERY_THROW); + table::CellRangeAddress aCellRangeAddr = xCellRangeAddressable->getRangeAddress(); + const sal_Int32 nHeight = aCellRangeAddr.EndRow - aCellRangeAddr.StartRow + 1; + + uno::Reference<table::XCellRange> xCellRange + = xSheetCellCursor->getCellRangeByPosition(0, 0, 0, nHeight - 1); + uno::Reference<sheet::XArrayFormulaRange> xArrayFormulaRange(xCellRange, UNO_QUERY_THROW); + xArrayFormulaRange->setArrayFormula("A1:A" + OUString::number(nHeight)); + + xSheetCellCursor->collapseToSize(1, 1); + xSheetCellCursor->collapseToCurrentArray(); + + uno::Reference<table::XColumnRowRange> xColRowRange(xSheetCellCursor, UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to collapseToCurrentArray (cols)", sal_Int32(1), + xColRowRange->getColumns()->getCount()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to collapseToCurrentArray (rows)", nHeight, + xColRowRange->getRows()->getCount()); + xArrayFormulaRange->setArrayFormula(""); +} + +void XSheetCellCursor::testCollapseToCurrentRegion() +{ + uno::Reference<sheet::XSheetCellCursor> xSheetCellCursor(init(), UNO_QUERY_THROW); + + const sal_Int32 nWidth = 4, nHeight = 4; + uno::Reference<sheet::XSpreadsheet> xSheet = xSheetCellCursor->getSpreadsheet(); + uno::Reference<sheet::XSheetOperation> xSheetOp(xSheet, UNO_QUERY_THROW); + xSheetOp->clearContents(65535); + + xSheetCellCursor->collapseToCurrentRegion(); + uno::Reference<table::XColumnRowRange> xColRowRange(xSheetCellCursor, UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to collapseToCurrentRegion (cols)", nWidth, + xColRowRange->getColumns()->getCount()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to collapseToCurrentRegion (rows)", nHeight, + xColRowRange->getRows()->getCount()); +} + +void XSheetCellCursor::testCollapseToMergedArea() +{ + uno::Reference<sheet::XSheetCellCursor> xSheetCellCursor(init(), UNO_QUERY_THROW); + xSheetCellCursor->collapseToSize(1, 1); + + const sal_Int32 nLeftCol = 0, nTopRow = 0, nWidth = 8, nHeight = 8; + uno::Reference<sheet::XSpreadsheet> xSheet = xSheetCellCursor->getSpreadsheet(); + + uno::Reference<table::XCellRange> xCellRange = xSheet->getCellRangeByPosition( + nLeftCol + nWidth - 8, nTopRow + nHeight - 8, nLeftCol + nWidth, nTopRow + nHeight); + + uno::Reference<util::XMergeable> xMergeable(xCellRange, UNO_QUERY_THROW); + xMergeable->merge(true); + CPPUNIT_ASSERT_MESSAGE("Unable to merge area", xMergeable->getIsMerged()); + xSheetCellCursor->collapseToMergedArea(); + xMergeable->merge(false); + + uno::Reference<table::XColumnRowRange> xColRowRange(xSheetCellCursor, UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to collapseToMergedArea (cols)", nWidth + 1, + xColRowRange->getColumns()->getCount()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to collapseToMergedArea (rows)", nHeight + 1, + xColRowRange->getRows()->getCount()); +} + +void XSheetCellCursor::testCollapseToSize() +{ + uno::Reference<sheet::XSheetCellCursor> xSheetCellCursor(init(), UNO_QUERY_THROW); + + const sal_Int32 nWidth = 1, nHeight = 1; + xSheetCellCursor->collapseToSize(nWidth + 3, nHeight + 3); + + uno::Reference<table::XColumnRowRange> xColRowRange(xSheetCellCursor, UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to collapseToSize (cols)", nWidth + 3, + xColRowRange->getColumns()->getCount()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to collapseToSize (rows)", nHeight + 3, + xColRowRange->getRows()->getCount()); +} + +void XSheetCellCursor::testExpandToEntireColumns() +{ + uno::Reference<sheet::XSheetCellCursor> xSheetCellCursor(init(), UNO_QUERY_THROW); + + xSheetCellCursor->expandToEntireColumns(); + + uno::Reference<table::XColumnRowRange> xColRowRange(xSheetCellCursor, UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to expandToEntireColumns (cols)", sal_Int32(4), + xColRowRange->getColumns()->getCount()); + CPPUNIT_ASSERT_MESSAGE("Unable to expandToEntireColumns (rows)", + xColRowRange->getRows()->getCount() >= sal_Int32(32000)); +} + +void XSheetCellCursor::testExpandToEntireRows() +{ + uno::Reference<sheet::XSheetCellCursor> xSheetCellCursor(init(), UNO_QUERY_THROW); + + xSheetCellCursor->expandToEntireRows(); + + uno::Reference<table::XColumnRowRange> xColRowRange(xSheetCellCursor, UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("Unable to expandToEntireRows (cols)", + xColRowRange->getColumns()->getCount() >= sal_Int32(256)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to expandToEntireRows (rows)", sal_Int32(4), + xColRowRange->getRows()->getCount()); +} +} + +/* vim:set shiftnWidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsheetcellrange.cxx b/test/source/sheet/xsheetcellrange.cxx new file mode 100644 index 000000000..a5714e324 --- /dev/null +++ b/test/source/sheet/xsheetcellrange.cxx @@ -0,0 +1,33 @@ +/* -*- 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/sheet/xsheetcellrange.hxx> + +#include <com/sun/star/sheet/XSheetCellRange.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XSheetCellRange::testGetSpreadsheet() +{ + uno::Reference<sheet::XSheetCellRange> xSheetCellRange(init(), UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet = xSheetCellRange->getSpreadsheet(); + + CPPUNIT_ASSERT_MESSAGE("Unable to get spreadsheet", xSheet.is()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsheetcellrangecontainer.cxx b/test/source/sheet/xsheetcellrangecontainer.cxx new file mode 100644 index 000000000..3a4f356c7 --- /dev/null +++ b/test/source/sheet/xsheetcellrangecontainer.cxx @@ -0,0 +1,100 @@ +/* -*- 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/sheet/xsheetcellrangecontainer.hxx> +#include <test/cppunitasserthelper.hxx> + +#include <com/sun/star/sheet/XSheetCellRangeContainer.hpp> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XSheetCellRangeContainer::testAddRemoveRangeAddress() +{ + uno::Reference<sheet::XSheetCellRangeContainer> xSCRC(init(), UNO_QUERY_THROW); + xSCRC->removeRangeAddresses(xSCRC->getRangeAddresses()); // prepare a clean slate + uno::Sequence<table::CellRangeAddress> aAddr = createCellRangeAddresses(); + + sal_Int32 cnt = xSCRC->getCount(); + xSCRC->addRangeAddress(aAddr[0], false); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to add CellRangeAddress (count)", cnt + 1, + xSCRC->getCount()); + + uno::Sequence<table::CellRangeAddress> aAfterAddAddr = xSCRC->getRangeAddresses(); + cnt = xSCRC->getCount(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to add CellRangeAddress (entry)", aAddr[0], + aAfterAddAddr[cnt - 1]); + + xSCRC->removeRangeAddress(aAddr[0]); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to remove CellRangeAddress (count)", cnt - 1, + xSCRC->getCount()); + + const uno::Sequence<table::CellRangeAddress> aAfterRemoveAddr = xSCRC->getRangeAddresses(); + for (auto const& addr : aAfterRemoveAddr) + { + CPPUNIT_ASSERT_MESSAGE("Unable to remove CellRangeAddress (entry)", aAddr[0] != addr); + } +} + +void XSheetCellRangeContainer::testAddRemoveRangeAddresses() +{ + uno::Reference<sheet::XSheetCellRangeContainer> xSCRC(init(), UNO_QUERY_THROW); + xSCRC->removeRangeAddresses(xSCRC->getRangeAddresses()); // prepare a clean slate + uno::Sequence<table::CellRangeAddress> aAddr = createCellRangeAddresses(); + + sal_Int32 cnt = xSCRC->getCount(); + xSCRC->addRangeAddresses(aAddr, false); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to add CellRangeAddress (count)", cnt + 2, + xSCRC->getCount()); + + uno::Sequence<table::CellRangeAddress> aAfterAddAddr = xSCRC->getRangeAddresses(); + cnt = xSCRC->getCount(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to add CellRangeAddresses (entry: first)", aAddr[0], + aAfterAddAddr[cnt - 2]); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to add CellRangeAddresses (entry: second)", aAddr[1], + aAfterAddAddr[cnt - 1]); + + xSCRC->removeRangeAddresses(aAddr); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to remove CellRangeAddresses (count)", cnt - 2, + xSCRC->getCount()); + + const uno::Sequence<table::CellRangeAddress> aAfterRemoveAddr = xSCRC->getRangeAddresses(); + for (auto const& addr : aAfterRemoveAddr) + { + CPPUNIT_ASSERT_MESSAGE("Unable to remove CellRangeAddresses (entry: first)", + aAddr[0] != addr); + CPPUNIT_ASSERT_MESSAGE("Unable to remove CellRangeAddresses (entry: second)", + aAddr[1] != addr); + } +} + +uno::Sequence<table::CellRangeAddress> XSheetCellRangeContainer::createCellRangeAddresses() +{ + uno::Sequence<table::CellRangeAddress> aAddr(2); + for (unsigned int i = 0; i < 2; i++) + { + aAddr[i].Sheet = i; + aAddr[i].StartColumn = i; + aAddr[i].StartRow = i; + aAddr[i].EndColumn = i + 3; + aAddr[i].EndRow = i + 3; + } + + return aAddr; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsheetcellranges.cxx b/test/source/sheet/xsheetcellranges.cxx new file mode 100644 index 000000000..d40a47e03 --- /dev/null +++ b/test/source/sheet/xsheetcellranges.cxx @@ -0,0 +1,50 @@ +/* -*- 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/sheet/xsheetcellranges.hxx> + +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/sheet/XSheetCellRanges.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XSheetCellRanges::testGetCells() +{ + uno::Reference<sheet::XSheetCellRanges> xSheetCellRanges(init(), UNO_QUERY_THROW); + uno::Reference<container::XEnumerationAccess> xEA = xSheetCellRanges->getCells(); + + CPPUNIT_ASSERT_MESSAGE("Unable to get cells", xEA->hasElements()); +} + +void XSheetCellRanges::testGetRangeAddresses() +{ + uno::Reference<sheet::XSheetCellRanges> xSheetCellRanges(init(), UNO_QUERY_THROW); + uno::Sequence<table::CellRangeAddress> aCellRangeAddress + = xSheetCellRanges->getRangeAddresses(); + CPPUNIT_ASSERT_MESSAGE("Unable to get RangeAddresses", aCellRangeAddress.getLength() > 2); +} + +void XSheetCellRanges::testGetRangeAddressesAsString() +{ + uno::Reference<sheet::XSheetCellRanges> xSheetCellRanges(init(), UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("Unable to get RangeAddresses (string)", + xSheetCellRanges->getRangeAddressesAsString().indexOf("C1:D4") > 0); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsheetcondition.cxx b/test/source/sheet/xsheetcondition.cxx new file mode 100644 index 000000000..27068fec6 --- /dev/null +++ b/test/source/sheet/xsheetcondition.cxx @@ -0,0 +1,72 @@ +/* -*- 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/sheet/xsheetcondition.hxx> + +#include <com/sun/star/sheet/ConditionOperator.hpp> +#include <com/sun/star/sheet/XSheetCondition.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XSheetCondition::testGetSetFormula1() +{ + uno::Reference<sheet::XSheetCondition> xSheetCondition(init(), UNO_QUERY_THROW); + OUString aFormula1; + CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to get Formula1", + aFormula1 = xSheetCondition->getFormula1()); + + xSheetCondition->setFormula1("$Sheet1.$C$"); + CPPUNIT_ASSERT_MESSAGE("Unable to set Formula1", aFormula1 != xSheetCondition->getFormula1()); +} + +void XSheetCondition::testGetSetFormula2() +{ + uno::Reference<sheet::XSheetCondition> xSheetCondition(init(), UNO_QUERY_THROW); + OUString aFormula2; + CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to get Formula2", + aFormula2 = xSheetCondition->getFormula2()); + + xSheetCondition->setFormula2("$Sheet1.$A$"); + CPPUNIT_ASSERT_MESSAGE("Unable to set Formula2", aFormula2 != xSheetCondition->getFormula2()); +} + +void XSheetCondition::testGetSetOperator() +{ + uno::Reference<sheet::XSheetCondition> xSheetCondition(init(), UNO_QUERY_THROW); + sheet::ConditionOperator aOperator; + CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to get Operator", + aOperator = xSheetCondition->getOperator()); + + xSheetCondition->setOperator(sheet::ConditionOperator_BETWEEN); + sheet::ConditionOperator aOperatorNew = xSheetCondition->getOperator(); + CPPUNIT_ASSERT_MESSAGE("Unable to set Operator", aOperator != aOperatorNew); +} + +void XSheetCondition::testGetSetSourcePosition() +{ + uno::Reference<sheet::XSheetCondition> xSheetCondition(init(), UNO_QUERY_THROW); + table::CellAddress aSourcePosition(0, 0, 0); + CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to get SourcePosition", + aSourcePosition = xSheetCondition->getSourcePosition()); + + xSheetCondition->setSourcePosition(table::CellAddress(0, 1, 1)); + table::CellAddress aSourcePositionNew = xSheetCondition->getSourcePosition(); + CPPUNIT_ASSERT_MESSAGE("Unable to set SourcePosition", + aSourcePosition.Row != aSourcePositionNew.Row); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsheetconditionalentries.cxx b/test/source/sheet/xsheetconditionalentries.cxx new file mode 100644 index 000000000..8062d42f5 --- /dev/null +++ b/test/source/sheet/xsheetconditionalentries.cxx @@ -0,0 +1,57 @@ +/* -*- 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/sheet/xsheetconditionalentries.hxx> + +#include <com/sun/star/sheet/XSheetConditionalEntries.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XSheetConditionalEntries::testAddNew() +{ + uno::Reference<sheet::XSheetConditionalEntries> xSheetConditionalEntries(init(), + UNO_QUERY_THROW); + const sal_Int32 aCount = xSheetConditionalEntries->getCount(); + + xSheetConditionalEntries->addNew(createCondition(4)); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to add new condition", aCount + 1, + xSheetConditionalEntries->getCount()); +} + +void XSheetConditionalEntries::testClear() +{ + uno::Reference<sheet::XSheetConditionalEntries> xSheetConditionalEntries(init(), + UNO_QUERY_THROW); + xSheetConditionalEntries->clear(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to clear conditions", sal_Int32(0), + xSheetConditionalEntries->getCount()); +} + +void XSheetConditionalEntries::testRemoveByIndex() +{ + uno::Reference<sheet::XSheetConditionalEntries> xSheetConditionalEntries(init(), + UNO_QUERY_THROW); + const sal_Int32 aCount = xSheetConditionalEntries->getCount(); + + xSheetConditionalEntries->removeByIndex(0); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to remove condition", aCount - 1, + xSheetConditionalEntries->getCount()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsheetconditionalentry.cxx b/test/source/sheet/xsheetconditionalentry.cxx new file mode 100644 index 000000000..0523d9be6 --- /dev/null +++ b/test/source/sheet/xsheetconditionalentry.cxx @@ -0,0 +1,35 @@ +/* -*- 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/sheet/xsheetconditionalentry.hxx> + +#include <com/sun/star/sheet/XSheetConditionalEntry.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XSheetConditionalEntry::testGetSetStyleName() +{ + uno::Reference<sheet::XSheetConditionalEntry> xSheetConditionalEntry(init(), UNO_QUERY_THROW); + OUString aStyleName = xSheetConditionalEntry->getStyleName(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get StyleName", OUString("Result2"), aStyleName); + + xSheetConditionalEntry->setStyleName("Heading"); + CPPUNIT_ASSERT_MESSAGE("Unable to set StyleName", + aStyleName != xSheetConditionalEntry->getStyleName()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsheetfilterable.cxx b/test/source/sheet/xsheetfilterable.cxx new file mode 100644 index 000000000..a6c8b5901 --- /dev/null +++ b/test/source/sheet/xsheetfilterable.cxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xsheetfilterable.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/sheet/FilterOperator.hpp> +#include <com/sun/star/sheet/TableFilterField.hpp> +#include <com/sun/star/sheet/XSheetFilterable.hpp> +#include <com/sun/star/sheet/XSheetFilterDescriptor.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/table/XColumnRowRange.hpp> +#include <com/sun/star/table/XTableRows.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void XSheetFilterable::testCreateFilterDescriptor() +{ + uno::Reference< sheet::XSheetFilterable > xFA(init(), UNO_QUERY_THROW); + uno::Reference< sheet::XSheetFilterDescriptor > xSFD = xFA->createFilterDescriptor(true); + + uno::Sequence< sheet::TableFilterField > xTFF; + xTFF.realloc(2); + xTFF[0].IsNumeric = true; + xTFF[0].Field = 0; + xTFF[0].NumericValue = 2; + xTFF[0].Operator = sheet::FilterOperator_GREATER_EQUAL; + xTFF[1].IsNumeric = false; + xTFF[1].Field = 1; + xTFF[1].StringValue = "C"; + xTFF[1].Operator = sheet::FilterOperator_LESS; + + CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to create XSheetFilterDescriptor", xSFD->setFilterFields(xTFF)); +} + +void XSheetFilterable::testFilter() +{ + uno::Reference< sheet::XSpreadsheet > xSheet(getXSpreadsheet(), UNO_QUERY_THROW); + + uno::Reference< sheet::XSheetFilterable > xFA(xSheet, UNO_QUERY_THROW); + uno::Reference< sheet::XSheetFilterDescriptor > xSFD = xFA->createFilterDescriptor(true); + + uno::Sequence< sheet::TableFilterField > xTFF; + xTFF.realloc(2); + xTFF[0].IsNumeric = true; + xTFF[0].Field = 0; + xTFF[0].NumericValue = 2; + xTFF[0].Operator = sheet::FilterOperator_GREATER_EQUAL; + xTFF[1].IsNumeric = false; + xTFF[1].Field = 1; + xTFF[1].StringValue = "C"; + xTFF[1].Operator = sheet::FilterOperator_LESS; + xSFD->setFilterFields(xTFF); + + xSheet->getCellByPosition(0, 0)->setValue(1); + xSheet->getCellByPosition(0, 1)->setValue(2); + xSheet->getCellByPosition(0, 2)->setValue(3); + xSheet->getCellByPosition(1, 0)->setFormula("A"); + xSheet->getCellByPosition(1, 1)->setFormula("B"); + xSheet->getCellByPosition(1, 2)->setFormula("C"); + xFA->filter(xSFD); + + uno::Reference< table::XColumnRowRange > xColRowRange(xSheet, UNO_QUERY_THROW); + uno::Reference< table::XTableRows > xTableRows = xColRowRange->getRows(); + uno::Reference< beans::XPropertySet > xRowProps(xTableRows->getByIndex(0), UNO_QUERY_THROW); + bool bIsVisible = true; + CPPUNIT_ASSERT(xRowProps->getPropertyValue("IsVisible") >>= bIsVisible); + + CPPUNIT_ASSERT_MESSAGE("Row 1 should be invisible", !bIsVisible); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xsheetfilterableex.cxx b/test/source/sheet/xsheetfilterableex.cxx new file mode 100644 index 000000000..eeecf737d --- /dev/null +++ b/test/source/sheet/xsheetfilterableex.cxx @@ -0,0 +1,59 @@ +/* -*- 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/sheet/xsheetfilterableex.hxx> + +#include <com/sun/star/sheet/FilterConnection.hpp> +#include <com/sun/star/sheet/FilterOperator.hpp> +#include <com/sun/star/sheet/TableFilterField.hpp> +#include <com/sun/star/sheet/XSheetFilterDescriptor.hpp> +#include <com/sun/star/sheet/XSheetFilterable.hpp> +#include <com/sun/star/sheet/XSheetFilterableEx.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XSheetFilterableEx::testCreateFilterDescriptorByObject() +{ + uno::Reference<sheet::XSheetFilterableEx> xSFEx(init(), UNO_QUERY_THROW); + uno::Reference<sheet::XSheetFilterable> xSF(getXSpreadsheet(), UNO_QUERY_THROW); + + uno::Reference<sheet::XSheetFilterDescriptor> xSFD = xSFEx->createFilterDescriptorByObject(xSF); + CPPUNIT_ASSERT_MESSAGE("no XSheetFilterDescriptor", xSFD.is()); + + const uno::Sequence<sheet::TableFilterField> xTFF = xSFD->getFilterFields(); + CPPUNIT_ASSERT_MESSAGE("The gained XSheetFilterDescriptor is empty", xTFF.hasElements()); + + for (const auto& field : xTFF) + { + // we don't care about the actual value, just that we can access the fields + CPPUNIT_ASSERT_MESSAGE("Unable to retrieve field: StringValue", + !field.StringValue.isEmpty() || field.StringValue.isEmpty()); + CPPUNIT_ASSERT_MESSAGE("Unable to retrieve field: IsNumeric", + !field.IsNumeric || field.IsNumeric); + CPPUNIT_ASSERT_MESSAGE("Unable to retrieve field: NumericValue", + field.NumericValue != 0.0 || field.NumericValue == 0.0); + CPPUNIT_ASSERT_MESSAGE("Unable to retrieve field: Field", + field.Field != 0 || field.Field == 0); + CPPUNIT_ASSERT_MESSAGE("Unable to retrieve field: Connection", + field.Connection == sheet::FilterConnection_AND + || field.Connection == sheet::FilterConnection_OR); + CPPUNIT_ASSERT_MESSAGE("Unable to retrieve field: Operator", + field.Operator != sheet::FilterOperator_EMPTY); + } +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsheetfilterdescriptor.cxx b/test/source/sheet/xsheetfilterdescriptor.cxx new file mode 100644 index 000000000..503cc84f8 --- /dev/null +++ b/test/source/sheet/xsheetfilterdescriptor.cxx @@ -0,0 +1,42 @@ +/* -*- 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/sheet/xsheetfilterdescriptor.hxx> + +#include <com/sun/star/sheet/TableFilterField.hpp> +#include <com/sun/star/sheet/XSheetFilterDescriptor.hpp> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XSheetFilterDescriptor::testGetSetFilterFields() +{ + uno::Reference<sheet::XSheetFilterDescriptor> xSFD(init(), uno::UNO_QUERY_THROW); + uno::Sequence<sheet::TableFilterField> aDefaultTFF = xSFD->getFilterFields(); + + CPPUNIT_ASSERT_MESSAGE("Unable to get TableFilterField", !aDefaultTFF.hasElements()); + + uno::Sequence<sheet::TableFilterField> aTFF; + aTFF.realloc(1); + + xSFD->setFilterFields(aTFF); + uno::Sequence<sheet::TableFilterField> aNewTFF = xSFD->getFilterFields(); + CPPUNIT_ASSERT_MESSAGE("Unable to set TableFilterField", aNewTFF != aDefaultTFF); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsheetfilterdescriptor2.cxx b/test/source/sheet/xsheetfilterdescriptor2.cxx new file mode 100644 index 000000000..fc060f73c --- /dev/null +++ b/test/source/sheet/xsheetfilterdescriptor2.cxx @@ -0,0 +1,42 @@ +/* -*- 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/sheet/xsheetfilterdescriptor2.hxx> + +#include <com/sun/star/sheet/TableFilterField2.hpp> +#include <com/sun/star/sheet/XSheetFilterDescriptor2.hpp> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XSheetFilterDescriptor2::testGetSetFilterFields2() +{ + uno::Reference<sheet::XSheetFilterDescriptor2> xSFD(init(), uno::UNO_QUERY_THROW); + uno::Sequence<sheet::TableFilterField2> aDefaultTFF = xSFD->getFilterFields2(); + + CPPUNIT_ASSERT_MESSAGE("Unable to get TableFilterField", !aDefaultTFF.hasElements()); + + uno::Sequence<sheet::TableFilterField2> aTFF; + aTFF.realloc(1); + + xSFD->setFilterFields2(aTFF); + uno::Sequence<sheet::TableFilterField2> aNewTFF = xSFD->getFilterFields2(); + CPPUNIT_ASSERT_MESSAGE("Unable to set TableFilterField", aNewTFF != aDefaultTFF); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsheetfilterdescriptor3.cxx b/test/source/sheet/xsheetfilterdescriptor3.cxx new file mode 100644 index 000000000..e46a34552 --- /dev/null +++ b/test/source/sheet/xsheetfilterdescriptor3.cxx @@ -0,0 +1,42 @@ +/* -*- 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/sheet/xsheetfilterdescriptor3.hxx> + +#include <com/sun/star/sheet/TableFilterField3.hpp> +#include <com/sun/star/sheet/XSheetFilterDescriptor3.hpp> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XSheetFilterDescriptor3::testGetSetFilterFields3() +{ + uno::Reference<sheet::XSheetFilterDescriptor3> xSFD(init(), uno::UNO_QUERY_THROW); + uno::Sequence<sheet::TableFilterField3> aDefaultTFF = xSFD->getFilterFields3(); + + CPPUNIT_ASSERT_MESSAGE("Unable to get TableFilterField", !aDefaultTFF.hasElements()); + + uno::Sequence<sheet::TableFilterField3> aTFF; + aTFF.realloc(1); + + xSFD->setFilterFields3(aTFF); + uno::Sequence<sheet::TableFilterField3> aNewTFF = xSFD->getFilterFields3(); + CPPUNIT_ASSERT_MESSAGE("Unable to set TableFilterField", aNewTFF != aDefaultTFF); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsheetlinkable.cxx b/test/source/sheet/xsheetlinkable.cxx new file mode 100644 index 000000000..aa394a006 --- /dev/null +++ b/test/source/sheet/xsheetlinkable.cxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xsheetlinkable.hxx> + +#include <com/sun/star/sheet/SheetLinkMode.hpp> +#include <com/sun/star/sheet/XSheetLinkable.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void XSheetLinkable::testSheetLinkable() +{ + uno::Reference< sheet::XSheetLinkable > xSheetLinkable(init(), UNO_QUERY_THROW); + + xSheetLinkable->link(getFileURL(), "Sheet1", "", "", sheet::SheetLinkMode_VALUE); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get link mode", + sheet::SheetLinkMode_VALUE, xSheetLinkable->getLinkMode()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get link URL", + getFileURL(), xSheetLinkable->getLinkUrl()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to get sheet name", + OUString("Sheet1"), xSheetLinkable->getLinkSheetName()); + + xSheetLinkable->setLinkMode(sheet::SheetLinkMode_NONE); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set link mode", + sheet::SheetLinkMode_NONE, xSheetLinkable->getLinkMode()); + + xSheetLinkable->setLinkSheetName("Sheet2"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set sheet name", + OUString("Sheet2"), xSheetLinkable->getLinkSheetName()); + + xSheetLinkable->setLinkUrl(getFileURL()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set link URL", + getFileURL(), xSheetLinkable->getLinkUrl()); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xsheetoperation.cxx b/test/source/sheet/xsheetoperation.cxx new file mode 100644 index 000000000..22015a40d --- /dev/null +++ b/test/source/sheet/xsheetoperation.cxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xsheetoperation.hxx> + +#include <com/sun/star/sheet/CellFlags.hpp> +#include <com/sun/star/sheet/GeneralFunction.hpp> +#include <com/sun/star/sheet/XSheetOperation.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void XSheetOperation::testClearContents() +{ + uno::Reference< sheet::XSheetOperation > xSheetOperation(init(), UNO_QUERY_THROW); + + xSheetOperation->clearContents( sheet::CellFlags::VALUE | sheet::CellFlags::FORMULA ); + + double sum = xSheetOperation->computeFunction( sheet::GeneralFunction_SUM ); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to clean contents", 0.0, sum); +} + +void XSheetOperation::testComputeFunction() +{ + uno::Reference< sheet::XSheetOperation > xSheetOperation(init(), UNO_QUERY_THROW); + + double count = xSheetOperation->computeFunction( sheet::GeneralFunction_COUNT ); + CPPUNIT_ASSERT_MESSAGE("Unable to compute function", count >= 0.0); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xsheetoutline.cxx b/test/source/sheet/xsheetoutline.cxx new file mode 100644 index 000000000..4ee517b09 --- /dev/null +++ b/test/source/sheet/xsheetoutline.cxx @@ -0,0 +1,266 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xsheetoutline.hxx> + +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/table/XCellRange.hpp> + +#include <com/sun/star/sheet/XCellRangeAddressable.hpp> +#include <com/sun/star/table/TableOrientation.hpp> + +#include <com/sun/star/sheet/XSheetCellRanges.hpp> +#include <com/sun/star/sheet/XSheetOutline.hpp> +#include <com/sun/star/sheet/XCellRangesQuery.hpp> + +#include <cppunit/TestAssert.h> +#include <rtl/ustring.hxx> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +const OUString colLevel1 = "OutlineSheet.A1:Z1"; +const OUString colLevel2 = "OutlineSheet.C1:W1"; +const OUString colLevel3 = "OutlineSheet.E1:U1"; +const OUString colLevel4 = "OutlineSheet.G1:S1"; + +const OUString rowLevel1 = "OutlineSheet.A1:A30"; +const OUString rowLevel2 = "OutlineSheet.A3:A27"; +const OUString rowLevel3 = "OutlineSheet.A5:A24"; +const OUString rowLevel4 = "OutlineSheet.A7:A21"; + +static OUString getVisibleAdress( + uno::Reference<sheet::XSpreadsheet> const& xSheet, + const OUString& aLevelRangeString) +{ + + uno::Reference<table::XCellRange> aSheetRangeAccess(xSheet, UNO_QUERY_THROW); + uno::Reference<table::XCellRange> aLevelRange = aSheetRangeAccess->getCellRangeByName(aLevelRangeString); + + uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(aLevelRange,UNO_QUERY_THROW); + uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryVisibleCells(); + OUString aResult = xRanges->getRangeAddressesAsString(); + + return aResult; + +} + +static table::CellRangeAddress getAddressFromRangeString( + uno::Reference<sheet::XSpreadsheet> const& xSheet, + const OUString& aStringAddress) +{ + + uno::Reference< table::XCellRange > aSheetRangeAccess(xSheet, UNO_QUERY_THROW); + uno::Reference<table::XCellRange> aRange = aSheetRangeAccess->getCellRangeByName(aStringAddress); + + uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddressable(aRange, UNO_QUERY_THROW); + table::CellRangeAddress aLevelRangeAddress = xCellRangeAddressable->getRangeAddress(); + + return aLevelRangeAddress; + +} + +void XSheetOutline::testHideDetail() +{ + + uno::Reference< sheet::XSpreadsheet > aSheet(init(), UNO_QUERY_THROW); + uno::Reference< sheet::XSheetOutline > aSheetOutline(aSheet, UNO_QUERY_THROW); + + // Column level 2 + table::CellRangeAddress aLevelRangeAddress = getAddressFromRangeString(aSheet, colLevel2); + aSheetOutline->hideDetail(aLevelRangeAddress); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Column level 2 not hidden", + getVisibleAdress(aSheet, colLevel2), OUString()); + + // Row Level 2 + aLevelRangeAddress = getAddressFromRangeString(aSheet, rowLevel2); + aSheetOutline->hideDetail(aLevelRangeAddress); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Row level 2 not hidden", + getVisibleAdress(aSheet, rowLevel2), OUString()); + +} + +void XSheetOutline::testShowDetail() +{ + uno::Reference< sheet::XSpreadsheet > aSheet(init(), UNO_QUERY_THROW); + uno::Reference< sheet::XSheetOutline > aSheetOutline(aSheet, UNO_QUERY_THROW); + + aSheetOutline->showDetail(getAddressFromRangeString(aSheet, colLevel1)); + aSheetOutline->showDetail(getAddressFromRangeString(aSheet, rowLevel1)); + + // Row Level 2 + table::CellRangeAddress aLevelRangeAddress = getAddressFromRangeString(aSheet, rowLevel2); + aSheetOutline->showDetail(aLevelRangeAddress); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Row level 2 still hidden", + getVisibleAdress(aSheet, rowLevel2), rowLevel2); + + // Column Level 2 + aLevelRangeAddress = getAddressFromRangeString(aSheet, colLevel2); + aSheetOutline->showDetail(aLevelRangeAddress); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Column level 2 still hidden", + getVisibleAdress(aSheet, colLevel2), colLevel2); + +} + +void XSheetOutline::testShowLevel() +{ + + uno::Reference< sheet::XSpreadsheet > aSheet(init(), UNO_QUERY_THROW); + uno::Reference< sheet::XSheetOutline > aSheetOutline(aSheet, UNO_QUERY_THROW); + + // test columns + + table::CellRangeAddress aLevel1 = getAddressFromRangeString(aSheet, colLevel1); + table::CellRangeAddress aLevel2 = getAddressFromRangeString(aSheet, colLevel2); + table::CellRangeAddress aLevel3 = getAddressFromRangeString(aSheet, colLevel3); + table::CellRangeAddress aLevel4 = getAddressFromRangeString(aSheet, colLevel4); + + aSheetOutline->showDetail(getAddressFromRangeString(aSheet, colLevel1)); + aSheetOutline->showDetail(getAddressFromRangeString(aSheet, colLevel2)); + aSheetOutline->showDetail(getAddressFromRangeString(aSheet, rowLevel1)); + + aSheetOutline->hideDetail(aLevel1); + aSheetOutline->hideDetail(aLevel2); + aSheetOutline->hideDetail(aLevel3); + aSheetOutline->hideDetail(aLevel4); + + aSheetOutline->showLevel(2, table::TableOrientation_COLUMNS); + + std::cout << " verify showLevel col apres" << getVisibleAdress(aSheet, "OutlineSheet.A1:Z30") << std::endl; + + // verify that level 2 and level 1 are shown --> column 0..3 & column 22..26 + // level 3 & 4 are hidden --> column 4..19 + + CPPUNIT_ASSERT_EQUAL_MESSAGE("testShowLevel Column", OUString("OutlineSheet.A1:D1"), getVisibleAdress(aSheet, "OutlineSheet.A1:D1")); + CPPUNIT_ASSERT_EQUAL_MESSAGE("testShowLevel Column", OUString("OutlineSheet.V1:Z1"), getVisibleAdress(aSheet, "OutlineSheet.V1:Z1")); + CPPUNIT_ASSERT_EQUAL_MESSAGE("testShowLevel Column", OUString(), getVisibleAdress(aSheet, colLevel3)); + +/* FIXME !! + + // test Rows + + aLevel1 = getAddressFromRangeString(rowLevel1); + aLevel2 = getAddressFromRangeString(rowLevel2); + aLevel3 = getAddressFromRangeString(rowLevel3); + aLevel4 = getAddressFromRangeString(rowLevel4); + + aSheetOutline->showDetail(getAddressFromRangeString(colLevel1)); + aSheetOutline->showDetail(getAddressFromRangeString(rowLevel1)); + aSheetOutline->showDetail(getAddressFromRangeString(rowLevel2)); + + std::cout << " verify showLevel row before" << OUStringToOString(getVisibleAdress("OutlineSheet.A1:Z30"), RTL_TEXTENCODING_UTF8).getStr() << std::endl; + + aSheetOutline->hideDetail(aLevel1); + aSheetOutline->hideDetail(aLevel2); + aSheetOutline->hideDetail(aLevel3); + aSheetOutline->hideDetail(aLevel4); + + std::cout << " verify showLevel row just before" << OUStringToOString(getVisibleAdress("OutlineSheet.A1:Z30"), RTL_TEXTENCODING_UTF8).getStr() << std::endl; + + aSheetOutline->showLevel(2, table::TableOrientation_ROWS); + + std::cout << " verify showLevel row after" << OUStringToOString(getVisibleAdress("OutlineSheet.A1:Z30"), RTL_TEXTENCODING_UTF8).getStr() << std::endl; + + // verify rows visible 0..3 & 24..29 + // verify rows hidden 4..23 + + CPPUNIT_ASSERT_EQUAL_MESSAGE("testShowLevel Row", OUString("OutlineSheet.A1:A4"), getVisibleAdress("OutlineSheet.A1:A4")); + CPPUNIT_ASSERT_EQUAL_MESSAGE("testShowLevel Row", OUString("OutlineSheet.A25:A30"), getVisibleAdress("OutlineSheet.A25:A30")); + CPPUNIT_ASSERT_EQUAL_MESSAGE("testShowLevel Row", OUString(), getVisibleAdress(rowLevel3)); + +*/ + +} + +void XSheetOutline::testGroup() +{ + + uno::Reference< sheet::XSpreadsheet > aSheet(init(), UNO_QUERY_THROW); + uno::Reference< sheet::XSheetOutline > aSheetOutline(aSheet, UNO_QUERY_THROW); + + // Column level 2 + OUString aNewString = "OutlineSheet.AB1:AG1"; + table::CellRangeAddress aLevelRangeAddress = getAddressFromRangeString(aSheet, aNewString); + aSheetOutline->group(aLevelRangeAddress, table::TableOrientation_COLUMNS); + + aSheetOutline->hideDetail(aLevelRangeAddress); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("testGroup Column still visible", getVisibleAdress(aSheet, aNewString), OUString()); + + // Row Level 2 + aNewString = "OutlineSheet.A50:A60"; + aLevelRangeAddress = getAddressFromRangeString(aSheet, aNewString); + aSheetOutline->group(aLevelRangeAddress, table::TableOrientation_ROWS); + + aSheetOutline->hideDetail(aLevelRangeAddress); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("testGroup Row still visible", getVisibleAdress(aSheet, aNewString), OUString()); + +} + +void XSheetOutline::testUngroup() +{ + uno::Reference< sheet::XSpreadsheet > aSheet(init(), UNO_QUERY_THROW); + uno::Reference< sheet::XSheetOutline > aSheetOutline(aSheet, UNO_QUERY_THROW); + + // New Column level + OUString aNewString = "OutlineSheet.BB1:BG1"; + table::CellRangeAddress aLevelRangeAddress = getAddressFromRangeString(aSheet, aNewString); + aSheetOutline->group(aLevelRangeAddress, table::TableOrientation_COLUMNS); + aSheetOutline->hideDetail(aLevelRangeAddress); + + aSheetOutline->ungroup(aLevelRangeAddress, table::TableOrientation_COLUMNS); + + aSheetOutline->showDetail(aLevelRangeAddress); + // should remain hidden ? + + CPPUNIT_ASSERT_EQUAL_MESSAGE("testUnGroup Column becomes visible after ungroup", getVisibleAdress(aSheet, aNewString), OUString()); + + // New Row level + aNewString = "OutlineSheet.A70:A80"; + aLevelRangeAddress = getAddressFromRangeString(aSheet, aNewString); + aSheetOutline->group(aLevelRangeAddress, table::TableOrientation_ROWS); + aSheetOutline->hideDetail(aLevelRangeAddress); + + aSheetOutline->ungroup(aLevelRangeAddress, table::TableOrientation_ROWS); + + aSheetOutline->showDetail(aLevelRangeAddress); + // should remain hidden ? + + CPPUNIT_ASSERT_EQUAL_MESSAGE("testUnGroup Row becomes visible after ungroup", getVisibleAdress(aSheet, aNewString), OUString()); + +} + +void XSheetOutline::testClearOutline() +{ + uno::Reference< sheet::XSpreadsheet > aSheet(init(), UNO_QUERY_THROW); + uno::Reference< sheet::XSheetOutline > aSheetOutline(aSheet, UNO_QUERY_THROW); + + aSheetOutline->clearOutline(); + + table::CellRangeAddress aLevelRangeAddress = getAddressFromRangeString(aSheet, colLevel1); + aSheetOutline->hideDetail(aLevelRangeAddress); + aLevelRangeAddress = getAddressFromRangeString(aSheet, rowLevel1); + aSheetOutline->hideDetail(aLevelRangeAddress); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("testClearOutline Columns are hidden after clear", getVisibleAdress(aSheet, colLevel1), colLevel1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("testClearOutline Rows are hidden after clear", getVisibleAdress(aSheet, rowLevel1), rowLevel1); + +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xsheetpagebreak.cxx b/test/source/sheet/xsheetpagebreak.cxx new file mode 100644 index 000000000..a1fde311c --- /dev/null +++ b/test/source/sheet/xsheetpagebreak.cxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xsheetpagebreak.hxx> + +#include <com/sun/star/sheet/TablePageBreakData.hpp> +#include <com/sun/star/sheet/XSheetPageBreak.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void XSheetPageBreak::testGetColumnPageBreaks() +{ + uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(init(), UNO_QUERY_THROW); + + uno::Sequence< sheet::TablePageBreakData > xColPageBreak = xSheetPageBreak->getColumnPageBreaks(); + CPPUNIT_ASSERT_MESSAGE("Unable to get column page breaks", xColPageBreak.hasElements()); +} + +void XSheetPageBreak::testGetRowPageBreaks() +{ + uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(init(), UNO_QUERY_THROW); + + uno::Sequence< sheet::TablePageBreakData > xRowPageBreak = xSheetPageBreak->getRowPageBreaks(); + CPPUNIT_ASSERT_MESSAGE("Unable to get row page breaks", xRowPageBreak.hasElements()); +} + +void XSheetPageBreak::testRemoveAllManualPageBreaks() +{ + uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(init(), UNO_QUERY_THROW); + + xSheetPageBreak->removeAllManualPageBreaks(); + + const uno::Sequence< sheet::TablePageBreakData > xColPageBreak = xSheetPageBreak->getColumnPageBreaks(); + sal_Int32 manualColPageBreaks = 0; + for ( const auto & data : xColPageBreak ) + { + if (data.ManualBreak) + manualColPageBreaks++; + } + CPPUNIT_ASSERT_EQUAL_MESSAGE("Found manual column page break", + sal_Int32(0), manualColPageBreaks); + + const uno::Sequence< sheet::TablePageBreakData > xRowPageBreak = xSheetPageBreak->getRowPageBreaks(); + sal_Int32 manualRowPageBreaks = 0; + for ( const auto & data : xRowPageBreak ) + { + if (data.ManualBreak) + manualRowPageBreaks++; + } + CPPUNIT_ASSERT_EQUAL_MESSAGE("Found manual row page break", + sal_Int32(0), manualRowPageBreaks); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xspreadsheet.cxx b/test/source/sheet/xspreadsheet.cxx new file mode 100644 index 000000000..466f995fe --- /dev/null +++ b/test/source/sheet/xspreadsheet.cxx @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xspreadsheet.hxx> + +#include <com/sun/star/sheet/XSheetCellCursor.hpp> +#include <com/sun/star/sheet/XSheetCellRange.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/uno/Reference.hxx> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + + +namespace apitest { + +void XSpreadsheet::testCreateCursor() +{ + uno::Reference< sheet::XSpreadsheet > xSheet(init(), UNO_QUERY_THROW); + + uno::Reference< sheet::XSheetCellCursor > xCursor(xSheet->createCursor(), UNO_SET_THROW); +} + +void XSpreadsheet::testCreateCursorByRange() +{ + uno::Reference< sheet::XSpreadsheet > xSheet(init(), UNO_QUERY_THROW); + + uno::Reference< sheet::XSheetCellRange > xCellRange(xSheet->getCellRangeByPosition(1, 1, 2, 3), UNO_QUERY_THROW); + uno::Reference< sheet::XSheetCellCursor > xCursor(xSheet->createCursorByRange(xCellRange), UNO_SET_THROW); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xspreadsheetdocument.cxx b/test/source/sheet/xspreadsheetdocument.cxx new file mode 100644 index 000000000..fd8f66ab5 --- /dev/null +++ b/test/source/sheet/xspreadsheetdocument.cxx @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xspreadsheetdocument.hxx> +#include <com/sun/star/sheet/XSpreadsheets.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void XSpreadsheetDocument::testGetSheets() +{ + uno::Reference< sheet::XSpreadsheetDocument > xSpreadsheetDoc(init(), UNO_QUERY_THROW); + uno::Reference< sheet::XSpreadsheets > xSheets = xSpreadsheetDoc->getSheets(); + CPPUNIT_ASSERT(xSheets.is()); + + uno::Reference< container::XIndexAccess > xIA(xSheets, UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL( mnSheets, xIA->getCount() ); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xspreadsheets.cxx b/test/source/sheet/xspreadsheets.cxx new file mode 100644 index 000000000..14e2bf996 --- /dev/null +++ b/test/source/sheet/xspreadsheets.cxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xspreadsheets.hxx> + +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/sheet/XSpreadsheets.hpp> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + + +namespace apitest { + +void XSpreadsheets::testInsertNewByName() +{ + uno::Reference< sheet::XSpreadsheets > xSpreadsheets(init(), UNO_QUERY_THROW); + + OUString newSheetName( "SheetToInsert" ); + xSpreadsheets->insertNewByName(newSheetName, 0); + + uno::Reference< container::XNameAccess > xNameAccess(xSpreadsheets, UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("Sheet was not insert", + xNameAccess->hasByName(newSheetName)); +} + +void XSpreadsheets::testInsertNewByNameBadName() +{ + uno::Reference< sheet::XSpreadsheets > xSpreadsheets(init(), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_THROW_MESSAGE("No exception thrown", + xSpreadsheets->insertNewByName("$%#/?\\", 0), + uno::RuntimeException); +} + +void XSpreadsheets::testMoveByName() +{ + uno::Reference< sheet::XSpreadsheets > xSpreadsheets(init(), UNO_QUERY_THROW); + + // first insert one that should be moved + xSpreadsheets->insertNewByName("SheetToMove", 0); + uno::Reference< container::XNameAccess > xNameAccess(xSpreadsheets, UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("Sheet to move was not insert", + xNameAccess->hasByName("SheetToMove")); + + xSpreadsheets->moveByName("SheetToMove", 2); + + // get sheet from the new position + uno::Reference< container::XIndexAccess > oIndexAccess(xSpreadsheets, UNO_QUERY_THROW); + uno::Any aAny = oIndexAccess->getByIndex(1); + uno::Reference< container::XNamed > xNamed; + CPPUNIT_ASSERT(aAny >>= xNamed); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Sheet was not moved", + OUString("SheetToMove"), + xNamed->getName()); +} + +void XSpreadsheets::testCopyByName() +{ + uno::Reference< sheet::XSpreadsheets > xSpreadsheets(init(), UNO_QUERY_THROW); + + // insert new sheet to copy + xSpreadsheets->insertNewByName("SheetToCopySrc", 0); + uno::Reference< container::XNameAccess > xNameAccess(xSpreadsheets, UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("Sheet to copy was not insert", + xNameAccess->hasByName("SheetToCopySrc")); + + xSpreadsheets->copyByName("SheetToCopySrc", "SheetToCopyDst", 0); + CPPUNIT_ASSERT_MESSAGE("Sheet was not copied", + xNameAccess->hasByName("SheetToCopyDst")); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xspreadsheets2.cxx b/test/source/sheet/xspreadsheets2.cxx new file mode 100644 index 000000000..d67e871f0 --- /dev/null +++ b/test/source/sheet/xspreadsheets2.cxx @@ -0,0 +1,372 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xspreadsheets2.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/sheet/XSpreadsheets2.hpp> +#include <com/sun/star/sheet/XNamedRanges.hpp> +#include <com/sun/star/sheet/XNamedRange.hpp> +#include <com/sun/star/table/XCell.hpp> +#include <com/sun/star/text/XTextRange.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> + +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/table/CellVertJustify.hpp> +#include <com/sun/star/util/XCloseable.hpp> + +#include <rtl/ustring.hxx> +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +static constexpr OUStringLiteral gaSrcSheetName("SheetToCopy"); +static constexpr OUStringLiteral gaSrcFileName("rangenamessrc.ods"); +static constexpr OUStringLiteral gaDestFileBase("ScNamedRangeObj.ods"); + +static sal_Int32 nInsertedSheets(0); + + +XSpreadsheets2::XSpreadsheets2() +{ +} + +XSpreadsheets2::~XSpreadsheets2() +{ + if (xDestDoc.is()) + { + uno::Reference<util::XCloseable> xCloseable(xDestDoc, UNO_QUERY_THROW); + xCloseable->close(true); + } +} + +void XSpreadsheets2::testImportedSheetNameAndIndex() +{ +/** + Verify that the imported sheet has the correct name and is placed at the right requested index +*/ + + importSheetToCopy(); + + uno::Reference< container::XNameAccess > xDestSheetNameAccess(xDestDoc->getSheets(), UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("Wrong sheet name", xDestSheetNameAccess->hasByName(gaSrcSheetName)); + +} + +void XSpreadsheets2::testImportString() +{ +/** + tests the cell A1 containing a string correctly imported +*/ + importSheetToCopy(); + + uno::Reference< table::XCell > xSrcCell = xSrcSheet->getCellByPosition(0,0); + uno::Reference< text::XTextRange > xSrcTextRange(xSrcCell, UNO_QUERY_THROW); + OUString aSrcString = xSrcTextRange->getString(); + + uno::Reference< table::XCell > xDestCell = xDestSheet->getCellByPosition(0,0); + uno::Reference< text::XTextRange > xDestTextRange(xDestCell, UNO_QUERY_THROW); + OUString aDestString = xDestTextRange->getString(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong string imported", aSrcString, aDestString); +} + +void XSpreadsheets2::testImportValue() +{ +/** + tests the cell B1 containing a value correctly imported +*/ + importSheetToCopy(); + + uno::Reference< table::XCell > xSrcCell = xSrcSheet->getCellByPosition(1,0); + sal_Int32 aSrcValue = xSrcCell->getValue(); + + uno::Reference< table::XCell > xDestCell = xDestSheet->getCellByPosition(1,0); + sal_Int32 aDestValue = xDestCell->getValue(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong value imported", aSrcValue, aDestValue); +} + +void XSpreadsheets2::testImportFormulaBasicMath() +{ +/** + tests the cell C1 containing an arithmetic formula correctly imported +*/ + importSheetToCopy(); + + uno::Reference< table::XCell > xSrcCell = xSrcSheet->getCellByPosition(2,0); + OUString aSrcFormula = xSrcCell->getFormula(); + + uno::Reference< table::XCell > xDestCell = xDestSheet->getCellByPosition(2,0); + OUString aDestFormula = xDestCell->getFormula(); + + // potential problem later: formulas might be adjusted + // add some tests that the formulas are correctly adjusted + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula imported", aSrcFormula, aDestFormula); +} + +void XSpreadsheets2::testImportFormulaWithNamedRange() +{ +/** + tests the cell D1 containing a formula that uses a NamedRange expression +*/ + importSheetToCopy(); + + uno::Reference< table::XCell > xSrcCell = xSrcSheet->getCellByPosition(3,0); + OUString aSrcFormula = xSrcCell->getFormula(); + + uno::Reference< table::XCell > xDestCell = xDestSheet->getCellByPosition(3,0); + OUString aDestFormula = xDestCell->getFormula(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Namedrange formula imported", aSrcFormula, aDestFormula); +} + +void XSpreadsheets2::testImportOverExistingNamedRange() +{ +/** + Both Source and Target file define the named range initial1 + in Source, initial1 is defined outside the copied sheet + In Target, after import sheet, initial1 should point on its initial definition $Sheet1.$B$1 + + NEED MORE WORK +*/ + importSheetToCopy(); + + uno::Reference< container::XNameAccess > xDestNamedRangesNameAccess(getNamedRanges(xDestDoc), UNO_QUERY_THROW); + uno::Any aNr = xDestNamedRangesNameAccess->getByName("initial1"); + uno::Reference< sheet::XNamedRange > xDestNamedRange(aNr, UNO_QUERY_THROW); + OUString aNrDestContent = xDestNamedRange->getContent(); + + OUString const aExpectedContent("$Sheet1.$B$1"); + + std::cout << "testImportSheet : initial1 aNrDestContent " << aNrDestContent << std::endl; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong address for initial1", aExpectedContent, aNrDestContent); + +} + +void XSpreadsheets2::testImportNamedRangeDefinedInSource() +{ +/** + in Source file, InSheetRangeName named range is defined in the copied sheet + it does not exists in target file + test that the range named is created in target and that it points in the target copied sheet +*/ + importSheetToCopy(); + + // New range name defined in imported sheet $SheetToCopy.$A$7 + OUString aNewInSheetNamedRangeString("InSheetRangeName"); + uno::Reference< container::XNameAccess > xDestNamedRangesNameAccess(getNamedRanges(xDestDoc), UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("InSheetRangeName", xDestNamedRangesNameAccess->hasByName(aNewInSheetNamedRangeString)); + + uno::Any aNewInSheetNr = xDestNamedRangesNameAccess->getByName(aNewInSheetNamedRangeString); + uno::Reference< sheet::XNamedRange > xDestNewInSheetNamedRange(aNewInSheetNr, UNO_QUERY_THROW); + OUString aNewInSheetNrDestContent = xDestNewInSheetNamedRange->getContent(); + OUString aNewInSheetExpectedContent("$SheetToCopy.$A$7"); + + std::cout << "testImportSheet : InSheetRangeName content " << aNewInSheetNrDestContent << std::endl; + std::cout << "testImportSheet : InSheetRangeName expected " << aNewInSheetExpectedContent << std::endl; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong address for InSheetRangeName", aNewInSheetExpectedContent, aNewInSheetNrDestContent); +} + +void XSpreadsheets2::testImportNamedRangeRedefinedInSource() +{ +/** + in Source file, initial2 named range is defined in the copied sheet + it is defined in another sheet of target file + test that the range named points in the target copied sheet +*/ + importSheetToCopy(); + + // the source file redefines an existing named range in the imported sheet --> the target should not be changed + OUString aRedefinedInSheetNamedRangeString("initial2"); + uno::Reference< container::XNameAccess > xDestNamedRangesNameAccess(getNamedRanges(xDestDoc), UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("aRedefinedInSheetNamedRangeString", xDestNamedRangesNameAccess->hasByName(aRedefinedInSheetNamedRangeString)); + + uno::Any aRedefinedInSheetNr = xDestNamedRangesNameAccess->getByName(aRedefinedInSheetNamedRangeString); + uno::Reference< sheet::XNamedRange > xDestRedefinedInSheetNamedRange(aRedefinedInSheetNr, UNO_QUERY_THROW); + OUString aRedefinedInSheetNrDestContent = xDestRedefinedInSheetNamedRange->getContent(); + OUString const aRedefinedInSheetExpectedContent("$Sheet1.$B$2"); + std::cout << "testImportSheet : initial2 content " << aRedefinedInSheetNrDestContent << std::endl; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong address for Redefined InSheet named range", aRedefinedInSheetExpectedContent, aRedefinedInSheetNrDestContent); +} + +void XSpreadsheets2::testImportNewNamedRange() +{ +/** + in Source file, new_rangename range named is defined outside the copied sheet + it does not exists in target file test that new_rangename is created and its + content points to source file as an external reference +*/ + importSheetToCopy(); + + //formula with a non-existent named range in dest - new_rangename + OUString aNewNamedRangeString("new_rangename"); + uno::Reference< container::XNameAccess > xDestNamedRangesNameAccess(getNamedRanges(xDestDoc), UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("New NamedRange not created", xDestNamedRangesNameAccess->hasByName(aNewNamedRangeString)); + + // verify the content of this new namedrange, pointing on $Sheet1.$B$1 in source. This address is already defined in target as NR content + + uno::Any aNewNr = xDestNamedRangesNameAccess->getByName(aNewNamedRangeString); + uno::Reference< sheet::XNamedRange > xDestNewNamedRange(aNewNr, UNO_QUERY_THROW); + OUString aNewNrDestContent = xDestNewNamedRange->getContent(); + + OUString aNewExpectedContent("$Sheet1.$B$1"); + + std::cout << "testImportSheet : new_rangename aNewExpectedContent " << aNewExpectedContent << std::endl; + std::cout << "testImportSheet : new_rangename aNewNrDestContent " << aNewNrDestContent << std::endl; + CPPUNIT_ASSERT_MESSAGE("Wrong New NamedRange formula string value", isExternalReference(aNewNrDestContent, aNewExpectedContent)); +} + +void XSpreadsheets2::testImportCellStyle() +{ +/** + in source file, imported sheet uses a cellstyle that does not exists in target + test that + - an imported cell D1 uses the right cellStyle + - the cellStyle is created in CellStyles family + - a property of the cellStyle (VertJustify) is correctly set +*/ + importSheetToCopy(); + + uno::Reference< table::XCell > xSrcCell = xSrcSheet->getCellByPosition(3,0); + xDestSheet->getCellByPosition(3,0); + + //new style created in dest + uno::Reference< beans::XPropertySet > xSrcCellPropSet (xSrcCell, UNO_QUERY_THROW); + const OUString aCellProperty("CellStyle"); + OUString aSrcStyleName; + CPPUNIT_ASSERT(xSrcCellPropSet->getPropertyValue(aCellProperty) >>= aSrcStyleName); + + uno::Reference< beans::XPropertySet > xDestCellPropSet (xSrcCell, UNO_QUERY_THROW); + OUString aDestStyleName; + CPPUNIT_ASSERT(xDestCellPropSet->getPropertyValue(aCellProperty) >>= aDestStyleName); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong imported Cell Style", aSrcStyleName, aDestStyleName); + + uno::Reference< style::XStyleFamiliesSupplier > xFamiliesSupplier (xDestDoc, UNO_QUERY_THROW); + uno::Reference< container::XNameAccess > xFamiliesNameAccess (xFamiliesSupplier->getStyleFamilies(), UNO_SET_THROW); + uno::Any aCellStylesFamily = xFamiliesNameAccess->getByName("CellStyles"); + uno::Reference< container::XNameContainer > xCellStylesFamilyNameAccess (aCellStylesFamily, UNO_QUERY_THROW); + + CPPUNIT_ASSERT_MESSAGE("New cell style not present", xCellStylesFamilyNameAccess->hasByName(aDestStyleName)); + + uno::Any aCellStyle = xCellStylesFamilyNameAccess->getByName(aDestStyleName); + uno::Reference< beans::XPropertySet > xCellStyleProp (aCellStyle, UNO_QUERY_THROW); + sal_Int32 aVertJustify = 0; + CPPUNIT_ASSERT(xCellStyleProp->getPropertyValue("VertJustify") >>= aVertJustify); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("New style: VertJustify not set", table::CellVertJustify_CENTER, static_cast<table::CellVertJustify>(aVertJustify)); +} + +void XSpreadsheets2::testLastAfterInsertCopy() +{ + /** Test that results in row 1 of all inserted sheets are equal to the + source sheet. The loaded destination document is kept open so several + sheets are imported. + */ + + CPPUNIT_ASSERT(nInsertedSheets > 0); + constexpr sal_Int32 nCols = 7; + + uno::Reference< container::XNameAccess> xSrcNameAccess(init(),UNO_QUERY_THROW); + xSrcSheet.set( xSrcNameAccess->getByName(gaSrcSheetName), UNO_QUERY_THROW); + + OUString aSrcString[nCols]; + for (sal_Int32 nCol=0; nCol < nCols; ++nCol) + { + uno::Reference< table::XCell > xSrcCell = xSrcSheet->getCellByPosition(nCol, 0); + uno::Reference< text::XTextRange > xSrcTextRange(xSrcCell, UNO_QUERY_THROW); + aSrcString[nCol] = xSrcTextRange->getString(); + } + // The named range 'initial2' is already present in the destination + // document defined to $Sheet1.$B$2 and thus is not copied, pointing to + // "content2" instead. + aSrcString[6] = "content2"; + + xDestDoc = getDoc(gaDestFileBase); + CPPUNIT_ASSERT(xDestDoc.is()); + uno::Reference< container::XIndexAccess > xDestSheetIndexAccess (xDestDoc->getSheets(), UNO_QUERY_THROW); + CPPUNIT_ASSERT( nInsertedSheets < xDestSheetIndexAccess->getCount()); + for (sal_Int32 nSheet=0; nSheet < nInsertedSheets; ++nSheet) + { + xDestSheet.set( xDestSheetIndexAccess->getByIndex(nSheet), UNO_QUERY_THROW); + for (sal_Int32 nCol=0; nCol < nCols; ++nCol) + { + uno::Reference< table::XCell > xDestCell = xDestSheet->getCellByPosition(nCol, 0); + uno::Reference< text::XTextRange > xDestTextRange(xDestCell, UNO_QUERY_THROW); + OUString aDestString = xDestTextRange->getString(); + + if (nCol == 4 && aDestString == "Err:540") + // The created external reference to the source document not + // allowed may result in Err:540 + continue; + + OString aMessage("Imported result does not match, sheet " + OString::number(nSheet) + + " column " + OString::number(nCol)); + CPPUNIT_ASSERT_EQUAL_MESSAGE( aMessage.getStr(), aSrcString[nCol], aDestString); + } + } +} + +uno::Reference< sheet::XSpreadsheetDocument> XSpreadsheets2::getDoc(const OUString& aFileBase) +{ + OUString aFileURL; + createFileURL(aFileBase, aFileURL); + + uno::Reference< lang::XComponent > xComp = loadFromDesktop(aFileURL); + + CPPUNIT_ASSERT(xComp.is()); + + uno::Reference< sheet::XSpreadsheetDocument > xDoc(xComp, UNO_QUERY_THROW); + return xDoc; +} + +uno::Reference< sheet::XNamedRanges> XSpreadsheets2::getNamedRanges(uno::Reference< sheet::XSpreadsheetDocument> const & xDoc) +{ + uno::Reference< beans::XPropertySet > xPropSet (xDoc, UNO_QUERY_THROW); + uno::Reference< sheet::XNamedRanges > xNamedRanges(xPropSet->getPropertyValue("NamedRanges"), UNO_QUERY_THROW); + return xNamedRanges; +} + +void XSpreadsheets2::importSheetToCopy() +{ + uno::Reference< container::XNameAccess> xSrcNameAccess(init(),UNO_QUERY_THROW); + xSrcSheet.set( xSrcNameAccess->getByName(gaSrcSheetName), UNO_QUERY_THROW); + + xDestDoc = getDoc(gaDestFileBase); + CPPUNIT_ASSERT(xDestDoc.is()); + + // import sheet + uno::Reference< sheet::XSpreadsheets2 > xDestSheets (xDestDoc->getSheets(), UNO_QUERY_THROW); + sal_Int32 nDestPos = 0; + sal_Int32 nDestPosEffective = xDestSheets->importSheet(xDocument, gaSrcSheetName, nDestPos); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong sheet index", nDestPos, nDestPosEffective); + ++nInsertedSheets; + + uno::Reference< container::XIndexAccess > xDestSheetIndexAccess (xDestDoc->getSheets(), UNO_QUERY_THROW); + xDestSheet.set( xDestSheetIndexAccess->getByIndex(nDestPosEffective), UNO_QUERY_THROW); +} + +bool XSpreadsheets2::isExternalReference(const OUString& aDestContent, const OUString& aSrcContent ) +{ + CPPUNIT_ASSERT(aDestContent.startsWith("'file://")); + + return (aDestContent.endsWithIgnoreAsciiCase(aSrcContent) // same cell address + && aDestContent.indexOf(gaSrcFileName)>0); // contains source file name +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xspreadsheetview.cxx b/test/source/sheet/xspreadsheetview.cxx new file mode 100644 index 000000000..d8804cf5d --- /dev/null +++ b/test/source/sheet/xspreadsheetview.cxx @@ -0,0 +1,41 @@ +/* -*- 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/sheet/xspreadsheetview.hxx> + +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/sheet/XSpreadsheetView.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XSpreadsheetView::testGetSetActiveSheet() +{ + uno::Reference<sheet::XSpreadsheetView> xView(init(), UNO_QUERY_THROW); + + uno::Reference<sheet::XSpreadsheet> xActiveSheet = xView->getActiveSheet(); + CPPUNIT_ASSERT_MESSAGE("Unable to get default active sheet", xActiveSheet.is()); + + uno::Reference<sheet::XSpreadsheet> xNewSheet = xActiveSheet; + CPPUNIT_ASSERT_MESSAGE("no sheet", xNewSheet.is()); + xView->setActiveSheet(xNewSheet); + + uno::Reference<sheet::XSpreadsheet> xNewActiveSheet = xView->getActiveSheet(); + CPPUNIT_ASSERT_MESSAGE("Unable to get new active sheet", xNewActiveSheet.is()); + CPPUNIT_ASSERT_MESSAGE("Default and new active sheet are not different", + xActiveSheet.get() != xNewActiveSheet.get()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsubtotalcalculatable.cxx b/test/source/sheet/xsubtotalcalculatable.cxx new file mode 100644 index 000000000..3a85c923b --- /dev/null +++ b/test/source/sheet/xsubtotalcalculatable.cxx @@ -0,0 +1,74 @@ +/* -*- 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/sheet/xsubtotalcalculatable.hxx> + +#include <com/sun/star/sheet/GeneralFunction.hpp> +#include <com/sun/star/sheet/SubTotalColumn.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/sheet/XSubTotalCalculatable.hpp> +#include <com/sun/star/sheet/XSubTotalDescriptor.hpp> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest { + +void XSubTotalCalculatable::testCreateSubTotalDescriptor() +{ + uno::Reference< sheet::XSubTotalCalculatable > xSTC(init(), uno::UNO_QUERY_THROW); + uno::Reference< sheet::XSubTotalDescriptor > xSTD = xSTC->createSubTotalDescriptor(true); + + uno::Sequence< sheet::SubTotalColumn > xCols; + xCols.realloc(1); + xCols[0].Column = 5; + xCols[0].Function = sheet::GeneralFunction_SUM; + + CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to create XSubTotalDescriptor", xSTD->addNew(xCols, 1)); +} + +void XSubTotalCalculatable::testApplyRemoveSubTotals() +{ + uno::Reference< sheet::XSpreadsheet > xSheet(getXSpreadsheet(), UNO_QUERY_THROW); + uno::Reference< sheet::XSubTotalCalculatable > xSTC(xSheet, UNO_QUERY_THROW); + + uno::Reference< sheet::XSubTotalDescriptor > xSTD = xSTC->createSubTotalDescriptor(true); + uno::Sequence< sheet::SubTotalColumn > xCols; + xCols.realloc(1); + xCols[0].Column = 0; + xCols[0].Function = sheet::GeneralFunction_SUM; + xSTD->addNew(xCols, 1); + + xSheet->getCellByPosition(0, 0)->setFormula("first"); + xSheet->getCellByPosition(1, 0)->setFormula("second"); + xSheet->getCellByPosition(0, 3)->setFormula(""); + xSheet->getCellByPosition(0, 1)->setValue(5); + xSheet->getCellByPosition(0, 2)->setValue(5); + xSheet->getCellByPosition(1, 1)->setValue(17); + xSheet->getCellByPosition(1, 2)->setValue(17); + + xSTC->applySubTotals(xSTD, true); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to apply SubTotals", + OUString("=SUBTOTAL(9;$A$2:$A$3)"), + xSheet->getCellByPosition(0, 3)->getFormula()); + + xSTC->removeSubTotals(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to remove SubTotals", + OUString(""), + xSheet->getCellByPosition(0, 3)->getFormula()); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsubtotaldescriptor.cxx b/test/source/sheet/xsubtotaldescriptor.cxx new file mode 100644 index 000000000..fa5aca634 --- /dev/null +++ b/test/source/sheet/xsubtotaldescriptor.cxx @@ -0,0 +1,47 @@ +/* -*- 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/sheet/xsubtotaldescriptor.hxx> + +#include <com/sun/star/sheet/GeneralFunction.hpp> +#include <com/sun/star/sheet/SubTotalColumn.hpp> +#include <com/sun/star/sheet/XSubTotalDescriptor.hpp> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest { + +void XSubTotalDescriptor::testAddNew() +{ + uno::Reference< sheet::XSubTotalDescriptor > xSTD(init(), uno::UNO_QUERY_THROW); + + uno::Sequence< sheet::SubTotalColumn > xCols; + xCols.realloc(1); + xCols[0].Column = 5; + xCols[0].Function = sheet::GeneralFunction_SUM; + + CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to add column", xSTD->addNew(xCols, 1)); +} + +void XSubTotalDescriptor::testClear() +{ + uno::Reference< sheet::XSubTotalDescriptor > xSTD(init(), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to clear XSubTotalDescriptor", xSTD->clear()); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xsubtotalfield.cxx b/test/source/sheet/xsubtotalfield.cxx new file mode 100644 index 000000000..048d005dc --- /dev/null +++ b/test/source/sheet/xsubtotalfield.cxx @@ -0,0 +1,79 @@ +/* -*- 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/sheet/xsubtotalfield.hxx> + +#include <com/sun/star/sheet/GeneralFunction.hpp> +#include <com/sun/star/sheet/SubTotalColumn.hpp> +#include <com/sun/star/sheet/XSubTotalField.hpp> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +CPPUNIT_NS_BEGIN + +template<> struct assertion_traits<uno::Sequence< sheet::SubTotalColumn > > +{ + static bool equal(const uno::Sequence< sheet::SubTotalColumn >& x, + const uno::Sequence< sheet::SubTotalColumn >& y) + { + return x == y; + } + + static std::string toString(const uno::Sequence< sheet::SubTotalColumn >& x) + { + OStringStream ost; + ost << "Sequence: Length: " << x.getLength() << "\n"; + for (const auto& rElement : x) + ost << "Column: " << rElement.Column << " Function:\n"; + // FIXME: Find a way to print Function + //ost << "Column: " << element->Column << " Function: " << element->Function << "\n"; + return ost.str(); + } +}; + +CPPUNIT_NS_END + +namespace apitest { + +void XSubTotalField::testGetSetGroupColumn() +{ + uno::Reference< sheet::XSubTotalField > xSTF(init(), uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT_MESSAGE("Unable to get GroupColumn", xSTF->getGroupColumn() != 0); + + xSTF->setGroupColumn(2); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set GroupColumn to new value", + sal_Int32(2), xSTF->getGroupColumn()); +} + +void XSubTotalField::testGetSetTotalColumns() +{ + uno::Reference< sheet::XSubTotalField > xSTF(init(), UNO_QUERY_THROW); + + uno::Sequence< sheet::SubTotalColumn > sDefaultCols = xSTF->getSubTotalColumns(); + CPPUNIT_ASSERT_MESSAGE("Unable to get SubTotalColumns", sDefaultCols.hasElements()); + + uno::Sequence< sheet::SubTotalColumn > sNewCols; + sNewCols.realloc(1); + sNewCols[0].Column = 5; + sNewCols[0].Function = sheet::GeneralFunction_AVERAGE; + xSTF->setSubTotalColumns(sNewCols); + + CPPUNIT_ASSERT_MESSAGE("Unable to set SubTotalColumns", sDefaultCols != xSTF->getSubTotalColumns()); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xuniquecellformatrangessupplier.cxx b/test/source/sheet/xuniquecellformatrangessupplier.cxx new file mode 100644 index 000000000..18d81eb2f --- /dev/null +++ b/test/source/sheet/xuniquecellformatrangessupplier.cxx @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xuniquecellformatrangessupplier.hxx> + +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/sheet/XUniqueCellFormatRangesSupplier.hpp> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest { + +void XUniqueCellFormatRangesSupplier::testGetUniqueCellFormatRanges() +{ + uno::Reference< sheet::XUniqueCellFormatRangesSupplier > xSupplier(init(), UNO_QUERY_THROW); + uno::Reference< container::XIndexAccess > xIndexAccess = xSupplier->getUniqueCellFormatRanges(); + + auto count = xIndexAccess->getCount(); + CPPUNIT_ASSERT_MESSAGE("No elements found", count); + for (auto i = 0; i<count; i++) { + CPPUNIT_ASSERT_NO_THROW_MESSAGE(OUStringToOString("Unable to access element " + OUString::number(i), RTL_TEXTENCODING_UTF8).getStr(), + xIndexAccess->getByIndex(i)); + } +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xusedareacursor.cxx b/test/source/sheet/xusedareacursor.cxx new file mode 100644 index 000000000..dcee0cf57 --- /dev/null +++ b/test/source/sheet/xusedareacursor.cxx @@ -0,0 +1,97 @@ +/* -*- 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/sheet/xusedareacursor.hxx> + +#include <com/sun/star/sheet/XCellRangeAddressable.hpp> +#include <com/sun/star/sheet/XSheetCellCursor.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/sheet/XUsedAreaCursor.hpp> + +#include <com/sun/star/table/CellRangeAddress.hpp> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + + +namespace apitest { + +void XUsedAreaCursor::testGotoStartOfUsedArea() +{ + uno::Reference< sheet::XSpreadsheet > xSheet(getXSpreadsheet(), UNO_QUERY_THROW); + uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor(xSheet->createCursor(), UNO_SET_THROW); + uno::Reference< sheet::XCellRangeAddressable> xCellRangeAddressable(xSheetCellCursor, UNO_QUERY_THROW); + + uno::Reference< sheet::XUsedAreaCursor > xUsedAreaCursor(xSheetCellCursor, UNO_QUERY_THROW); + + xUsedAreaCursor->gotoStartOfUsedArea(false); + xUsedAreaCursor->gotoEndOfUsedArea(true); + table::CellRangeAddress cellRangeAddress = xCellRangeAddressable->getRangeAddress(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong start column", + sal_Int32(0), cellRangeAddress.StartColumn); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong end column", + sal_Int32(2), cellRangeAddress.EndColumn); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong start row", + sal_Int32(0), cellRangeAddress.StartRow); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong end column", + sal_Int32(0), cellRangeAddress.EndRow); + + xUsedAreaCursor->gotoEndOfUsedArea(false); + cellRangeAddress = xCellRangeAddressable->getRangeAddress(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong start column", + sal_Int32(2), cellRangeAddress.StartColumn); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong end column", + sal_Int32(2), cellRangeAddress.EndColumn); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong start row", + sal_Int32(0), cellRangeAddress.StartRow); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong end column", + sal_Int32(0), cellRangeAddress.EndRow); +} + +void XUsedAreaCursor::testGotoEndOfUsedArea() +{ + uno::Reference< sheet::XSpreadsheet > xSheet(getXSpreadsheet(), UNO_QUERY_THROW); + uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor(xSheet->createCursor(), UNO_SET_THROW); + uno::Reference< sheet::XCellRangeAddressable> xCellRangeAddressable(xSheetCellCursor, UNO_QUERY_THROW); + + uno::Reference< sheet::XUsedAreaCursor > xUsedAreaCursor(xSheetCellCursor, UNO_QUERY_THROW); + + xUsedAreaCursor->gotoEndOfUsedArea(false); + xUsedAreaCursor->gotoStartOfUsedArea(true); + table::CellRangeAddress cellRangeAddress = xCellRangeAddressable->getRangeAddress(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong start column", + sal_Int32(0), cellRangeAddress.StartColumn); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong end column", + sal_Int32(2), cellRangeAddress.EndColumn); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong start row", + sal_Int32(0), cellRangeAddress.StartRow); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong end column", + sal_Int32(0), cellRangeAddress.EndRow); + + xUsedAreaCursor->gotoStartOfUsedArea(false); + cellRangeAddress = xCellRangeAddressable->getRangeAddress(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong start column", + sal_Int32(0), cellRangeAddress.StartColumn); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong end column", + sal_Int32(0), cellRangeAddress.EndColumn); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong start row", + sal_Int32(0), cellRangeAddress.StartRow); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong end column", + sal_Int32(0), cellRangeAddress.EndRow); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xviewfreezable.cxx b/test/source/sheet/xviewfreezable.cxx new file mode 100644 index 000000000..4a478f1ef --- /dev/null +++ b/test/source/sheet/xviewfreezable.cxx @@ -0,0 +1,33 @@ +/* -*- 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/sheet/xviewfreezable.hxx> + +#include <com/sun/star/sheet/XViewFreezable.hpp> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest { + +void XViewFreezable::testFreeze() +{ + uno::Reference< sheet::XViewFreezable > xViewFreezable(init(), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_MESSAGE("View has already frozen panes", !xViewFreezable->hasFrozenPanes()); + + xViewFreezable->freezeAtPosition(1,1); + CPPUNIT_ASSERT_MESSAGE("Unable to freeze pane", xViewFreezable->hasFrozenPanes()); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/sheet/xviewpane.cxx b/test/source/sheet/xviewpane.cxx new file mode 100644 index 000000000..5ea508bf8 --- /dev/null +++ b/test/source/sheet/xviewpane.cxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/sheet/xviewpane.hxx> +#include <com/sun/star/sheet/XViewPane.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void XViewPane::testFirstVisibleColumn() +{ + sal_Int32 nCol = 5; + uno::Reference < sheet::XViewPane > xViewPane(init(),UNO_QUERY_THROW); + xViewPane->setFirstVisibleColumn(nCol); + CPPUNIT_ASSERT_EQUAL(xViewPane->getFirstVisibleColumn(), nCol); +} + +void XViewPane::testFirstVisibleRow() +{ + sal_Int32 nRow = 3; + uno::Reference < sheet::XViewPane > xViewPane(init(),UNO_QUERY_THROW); + xViewPane->setFirstVisibleRow(nRow); + CPPUNIT_ASSERT_EQUAL(xViewPane->getFirstVisibleRow(), nRow); +} + +void XViewPane::testVisibleRange() +{ + constexpr sal_Int32 nCol = 5; + constexpr sal_Int32 nRow = 3; + uno::Reference < sheet::XViewPane > xViewPane(init(),UNO_QUERY_THROW); + xViewPane->setFirstVisibleColumn(nCol); + xViewPane->setFirstVisibleRow(nRow); + + table::CellRangeAddress aCellRangeAddress = xViewPane->getVisibleRange(); + CPPUNIT_ASSERT_EQUAL(short(0), aCellRangeAddress.Sheet); + CPPUNIT_ASSERT_EQUAL(nRow, aCellRangeAddress.StartRow); + CPPUNIT_ASSERT_EQUAL(nCol, aCellRangeAddress.StartColumn); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/xviewsplitable.cxx b/test/source/sheet/xviewsplitable.cxx new file mode 100644 index 000000000..e9f8d62b8 --- /dev/null +++ b/test/source/sheet/xviewsplitable.cxx @@ -0,0 +1,42 @@ +/* -*- 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/sheet/xviewsplitable.hxx> + +#include <com/sun/star/sheet/XViewSplitable.hpp> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest { + +void XViewSplitable::testSplit() +{ + uno::Reference< sheet::XViewSplitable > xViewSplitable(init(), UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("View is already split", !xViewSplitable->getIsWindowSplit()); + + xViewSplitable->splitAtPosition(90, 51); + + CPPUNIT_ASSERT_MESSAGE("View wasn't split", xViewSplitable->getIsWindowSplit()); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong horizontal pixel position", + sal_Int32(90), xViewSplitable->getSplitHorizontal()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical pixel position", + sal_Int32(51), xViewSplitable->getSplitVertical()); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong column", + sal_Int32(1), xViewSplitable->getSplitColumn()); + CPPUNIT_ASSERT_MESSAGE("Wrong row", xViewSplitable->getSplitRow() != 0); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/style/xstyleloader.cxx b/test/source/style/xstyleloader.cxx new file mode 100644 index 000000000..fd3f8eec5 --- /dev/null +++ b/test/source/style/xstyleloader.cxx @@ -0,0 +1,123 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/style/xstyleloader.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/style/XStyle.hpp> +#include <com/sun/star/style/XStyleLoader2.hpp> + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <rtl/ustring.hxx> +#include <cppunit/TestAssert.h> +#include <comphelper/processfactory.hxx> +#include <comphelper/storagehelper.hxx> + +using namespace comphelper; +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XStyleLoader::testLoadStylesFromURL() +{ + uno::Reference<style::XStyleLoader2> xStyleLoader(init(), uno::UNO_QUERY_THROW); + + uno::Reference<sheet::XSpreadsheetDocument> xDoc(getTargetDoc(), uno::UNO_SET_THROW); + const OUString aFileURL = getTestURL(); + + uno::Sequence<beans::PropertyValue> aOptions = xStyleLoader->getStyleLoaderOptions(); + xStyleLoader->loadStylesFromURL(aFileURL, aOptions); + + uno::Reference<style::XStyleFamiliesSupplier> xFamilySupplier(xDoc, UNO_QUERY_THROW); + checkStyleProperties(xFamilySupplier); +} + +void XStyleLoader::testLoadStylesFromDocument() +{ + uno::Reference<style::XStyleLoader2> xStyleLoader(init(), uno::UNO_QUERY_THROW); + + uno::Reference<sheet::XSpreadsheetDocument> xDoc(getTargetDoc(), uno::UNO_SET_THROW); + uno::Reference<lang::XComponent> xSrcComponent(getSourceComponent(), UNO_SET_THROW); + + uno::Sequence<beans::PropertyValue> aOptions = xStyleLoader->getStyleLoaderOptions(); + xStyleLoader->loadStylesFromDocument(xSrcComponent, aOptions); + + uno::Reference<style::XStyleFamiliesSupplier> xFamilySupplier(xDoc, UNO_QUERY_THROW); + checkStyleProperties(xFamilySupplier); +} + +void XStyleLoader::testLoadStylesFromStream() +{ + uno::Reference<style::XStyleLoader2> xStyleLoader(init(), uno::UNO_QUERY_THROW); + + uno::Reference<sheet::XSpreadsheetDocument> xDoc(getTargetDoc(), uno::UNO_SET_THROW); + const OUString aFileURL = getTestURL(); + const uno::Reference<io::XInputStream> xInputStream + = OStorageHelper::GetInputStreamFromURL(aFileURL, getProcessComponentContext()); + + uno::Sequence<beans::PropertyValue> aOptions = xStyleLoader->getStyleLoaderOptions(); + auto nLength = aOptions.getLength(); + aOptions.realloc(nLength + 1); + beans::PropertyValue aInputStream; + aInputStream.Name = "InputStream"; + uno::Any aTmp; + aTmp <<= xInputStream; + aInputStream.Value = aTmp; + aOptions[nLength] = aInputStream; + + xStyleLoader->loadStylesFromURL("private:stream", aOptions); + + uno::Reference<style::XStyleFamiliesSupplier> xFamilySupplier(xDoc, UNO_QUERY_THROW); + checkStyleProperties(xFamilySupplier); +} + +void XStyleLoader::checkStyleProperties( + uno::Reference<style::XStyleFamiliesSupplier> const& xFamilySupplier) +{ + // check if targetDocument has myStyle + uno::Reference<container::XNameAccess> xFamilies(xFamilySupplier->getStyleFamilies(), + UNO_SET_THROW); + uno::Reference<container::XNameContainer> xCellStyles(xFamilies->getByName("CellStyles"), + UNO_QUERY_THROW); + + CPPUNIT_ASSERT_MESSAGE("Style not imported", xCellStyles->hasByName("myStyle")); + + // test the backgroundcolor is correctly imported + uno::Reference<style::XStyle> xMyStyle(xCellStyles->getByName("myStyle"), UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPropSet(xMyStyle, UNO_QUERY_THROW); + + uno::Any aBackColor = xPropSet->getPropertyValue("CellBackColor"); + uno::Any expectedBackColor(sal_Int32(16724787)); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong CellBackColor", expectedBackColor, aBackColor); + + // test default pageStyle + + uno::Reference<container::XNameContainer> xPageStyles(xFamilies->getByName("PageStyles"), + UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPagePropSet(xPageStyles->getByName("Default"), + UNO_QUERY_THROW); + + uno::Any aPageBackColor = xPagePropSet->getPropertyValue("BackColor"); + uno::Any expectedPageBackColor(sal_Int32(13434879)); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong page style BackColor", expectedPageBackColor, + aPageBackColor); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/table/tablecolumn.cxx b/test/source/table/tablecolumn.cxx new file mode 100644 index 000000000..9f25c3935 --- /dev/null +++ b/test/source/table/tablecolumn.cxx @@ -0,0 +1,53 @@ +/* -*- 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/table/tablecolumn.hxx> +#include <test/unoapi_property_testers.hxx> +#include <comphelper/types.hxx> +#include <rtl/ustring.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/table/XCellRange.hpp> + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void TableColumn::testTableColumnProperties() +{ + uno::Reference<beans::XPropertySet> xPS(init(), uno::UNO_QUERY_THROW); + + OUString aPropName = "Width"; + testLongProperty(xPS, aPropName); + + // currently changing the value to false has no effect + aPropName = "OptimalWidth"; + uno::Reference<table::XCellRange> xCR(m_xSheet, uno::UNO_QUERY_THROW); + xCR->getCellByPosition(0, 0)->setFormula("That's a pretty long text."); + const sal_Int64 nWidthBefore = ::comphelper::getINT64(xPS->getPropertyValue("Width")); + xPS->setPropertyValue(aPropName, uno::makeAny(true)); + CPPUNIT_ASSERT(::comphelper::getBOOL(xPS->getPropertyValue(aPropName))); + const sal_Int64 nWidthAfter = ::comphelper::getINT64(xPS->getPropertyValue("Width")); + CPPUNIT_ASSERT(nWidthBefore != nWidthAfter); + + aPropName = "IsVisible"; + testBooleanProperty(xPS, aPropName); + + aPropName = "IsStartOfNewPage"; + testBooleanProperty(xPS, aPropName); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/table/tablerow.cxx b/test/source/table/tablerow.cxx new file mode 100644 index 000000000..2d14c1625 --- /dev/null +++ b/test/source/table/tablerow.cxx @@ -0,0 +1,40 @@ +/* -*- 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/table/tablerow.hxx> +#include <test/unoapi_property_testers.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> + +using namespace css; + +namespace apitest +{ +void TableRow::testTableRowProperties() +{ + uno::Reference<beans::XPropertySet> xPS(init(), uno::UNO_QUERY_THROW); + + OUString aPropName; + + aPropName = "Height"; + testLongProperty(xPS, aPropName); + + aPropName = "OptimalHeight"; + testBooleanProperty(xPS, aPropName); + + aPropName = "IsVisible"; + testBooleanProperty(xPS, aPropName); + + aPropName = "IsStartOfNewPage"; + testBooleanProperty(xPS, aPropName); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/table/xcell.cxx b/test/source/table/xcell.cxx new file mode 100644 index 000000000..921ef78ba --- /dev/null +++ b/test/source/table/xcell.cxx @@ -0,0 +1,79 @@ +/* -*- 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/table/xcell.hxx> + +#include <com/sun/star/table/XCell.hpp> +#include <com/sun/star/table/CellContentType.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XCell::testGetError() +{ + uno::Reference<table::XCell> xCell(init(), UNO_QUERY_THROW); + const sal_Int32 nCorrectFormula = xCell->getError(); + xCell->setFormula("=sqrt(-2)"); + const sal_Int32 nIncorrectFormula = xCell->getError(); + + CPPUNIT_ASSERT_MESSAGE("Successfully able to get Error", + (nCorrectFormula == 0) && (nIncorrectFormula != 0)); +} + +void XCell::testGetType() +{ + uno::Reference<table::XCell> xCell(init(), UNO_QUERY_THROW); + bool aResult = true; + + if (xCell->getType() == table::CellContentType_EMPTY) + aResult &= true; + else if (xCell->getType() == table::CellContentType_VALUE) + aResult &= true; + else if (xCell->getType() == table::CellContentType_TEXT) + aResult &= true; + else if (xCell->getType() == table::CellContentType_FORMULA) + aResult &= true; + else + aResult = false; + + CPPUNIT_ASSERT_MESSAGE("Successfully able to get Type", aResult); +} + +void XCell::testSetGetFormula() +{ + uno::Reference<table::XCell> xCell(init(), UNO_QUERY_THROW); + OUString aFormula = "=2+2"; + + xCell->setFormula(aFormula); + + OUString aFormula2 = xCell->getFormula(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Successfully able to set and get Formula", aFormula, aFormula2); +} + +void XCell::testSetGetValue() +{ + uno::Reference<table::XCell> xCell(init(), UNO_QUERY_THROW); + double nInValue = 222.555; + + xCell->setValue(nInValue); + + double nCellValue = xCell->getValue(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Successfully able to set and get Value", nInValue, nCellValue); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/table/xcellcursor.cxx b/test/source/table/xcellcursor.cxx new file mode 100644 index 000000000..a8e7b2be5 --- /dev/null +++ b/test/source/table/xcellcursor.cxx @@ -0,0 +1,126 @@ +/* -*- 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/table/xcellcursor.hxx> + +#include <com/sun/star/sheet/XCellRangeAddressable.hpp> +#include <com/sun/star/sheet/XSheetCellCursor.hpp> +#include <com/sun/star/sheet/XSheetCellRange.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/table/XCellCursor.hpp> +#include <com/sun/star/table/XCellRange.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XCellCursor::testGoToNext() +{ + uno::Reference<table::XCellCursor> xCellCursor(init(), UNO_QUERY_THROW); + + uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddressable(xCellCursor, + UNO_QUERY_THROW); + table::CellRangeAddress aCellRangeAddr = xCellRangeAddressable->getRangeAddress(); + const sal_Int32 startCol = aCellRangeAddr.StartColumn; + + xCellCursor->gotoNext(); + + aCellRangeAddr = xCellRangeAddressable->getRangeAddress(); + const sal_Int32 startCol2 = aCellRangeAddr.StartColumn; + + CPPUNIT_ASSERT_MESSAGE("Successfully able to go to Next", startCol != startCol2); +} + +void XCellCursor::testGoToOffset() +{ + uno::Reference<table::XCellCursor> xCellCursor(init(), UNO_QUERY_THROW); + + uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddressable(xCellCursor, + UNO_QUERY_THROW); + table::CellRangeAddress aCellRangeAddr = xCellRangeAddressable->getRangeAddress(); + const sal_Int32 startRow = aCellRangeAddr.StartRow; + const sal_Int32 startCol = aCellRangeAddr.StartColumn; + + xCellCursor->gotoOffset(4, 4); + + aCellRangeAddr = xCellRangeAddressable->getRangeAddress(); + const sal_Int32 startRow2 = aCellRangeAddr.StartRow; + const sal_Int32 startCol2 = aCellRangeAddr.StartColumn; + + CPPUNIT_ASSERT_MESSAGE("Successfully able to go to Offset", + (startCol != startCol2) || (startRow == startRow2)); +} + +void XCellCursor::testGoToPrevious() +{ + uno::Reference<table::XCellCursor> xCellCursor(init(), UNO_QUERY_THROW); + + uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddressable(xCellCursor, + UNO_QUERY_THROW); + xCellCursor->gotoOffset(4, 4); + + table::CellRangeAddress aCellRangeAddr = xCellRangeAddressable->getRangeAddress(); + const sal_Int32 startCol = aCellRangeAddr.StartColumn; + + xCellCursor->gotoPrevious(); + + aCellRangeAddr = xCellRangeAddressable->getRangeAddress(); + const sal_Int32 startCol2 = aCellRangeAddr.StartColumn; + CPPUNIT_ASSERT_MESSAGE("Successfully able to go to Previous", startCol != startCol2); +} + +void XCellCursor::testGoToStart() +{ + uno::Reference<table::XCellCursor> xCellCursor(init(), UNO_QUERY_THROW); + + uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddressable(xCellCursor, + UNO_QUERY_THROW); + xCellCursor->gotoStart(); + + table::CellRangeAddress aCellRangeAddr = xCellRangeAddressable->getRangeAddress(); + + const sal_Int32 startRow = aCellRangeAddr.StartRow; + const sal_Int32 startCol = aCellRangeAddr.StartColumn; + const sal_Int32 endRow = aCellRangeAddr.EndRow; + const sal_Int32 endCol = aCellRangeAddr.EndColumn; + CPPUNIT_ASSERT_MESSAGE("Successfully able to got to Start", + (startCol == endCol) && (endRow == startRow)); +} + +void XCellCursor::testGoToEnd() +{ + uno::Reference<table::XCellCursor> xCellCursor(init(), UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSpreadsheet(getXSpreadsheet(), UNO_QUERY_THROW); + uno::Reference<table::XCellRange> xCellRange(xCellCursor, UNO_QUERY_THROW); + xCellRange = xSpreadsheet->getCellRangeByName("$A$1:$g$7"); + uno::Reference<sheet::XSheetCellRange> xSheetCellRange(xCellCursor, UNO_QUERY_THROW); + uno::Reference<sheet::XSheetCellCursor> xSheetCellCursor(xCellCursor, UNO_QUERY_THROW); + xSheetCellCursor = xSpreadsheet->createCursorByRange(xSheetCellRange); + uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddressable(xCellCursor, + UNO_QUERY_THROW); + + xCellCursor->gotoEnd(); + + table::CellRangeAddress aCellRangeAddr = xCellRangeAddressable->getRangeAddress(); + const sal_Int32 startRow = aCellRangeAddr.StartRow; + const sal_Int32 startCol = aCellRangeAddr.StartColumn; + const sal_Int32 endRow = aCellRangeAddr.EndRow; + const sal_Int32 endCol = aCellRangeAddr.EndColumn; + CPPUNIT_ASSERT_MESSAGE("Successfully able to go to End", + (startCol == endCol) && (endRow == startRow)); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/table/xcellrange.cxx b/test/source/table/xcellrange.cxx new file mode 100644 index 000000000..392904078 --- /dev/null +++ b/test/source/table/xcellrange.cxx @@ -0,0 +1,56 @@ +/* -*- 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/table/xcellrange.hxx> + +#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <com/sun/star/table/XCell.hpp> +#include <com/sun/star/table/XCellRange.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XCellRange::testGetCellByPosition() +{ + uno::Reference<table::XCellRange> xCR(init(), uno::UNO_QUERY_THROW); + + uno::Reference<table::XCell> xCell(xCR->getCellByPosition(0, 0), uno::UNO_SET_THROW); + CPPUNIT_ASSERT(xCell.is()); + + CPPUNIT_ASSERT_THROW(xCR->getCellByPosition(-1, 1), lang::IndexOutOfBoundsException); +} + +void XCellRange::testGetCellRangeByName() +{ + uno::Reference<table::XCellRange> xCR(init(), uno::UNO_QUERY_THROW); + + uno::Reference<table::XCellRange> xCellRange(xCR->getCellRangeByName(m_aRangeName), + uno::UNO_SET_THROW); + CPPUNIT_ASSERT(xCellRange.is()); +} + +void XCellRange::testGetCellRangeByPosition() +{ + uno::Reference<table::XCellRange> xCR(init(), uno::UNO_QUERY_THROW); + + uno::Reference<table::XCellRange> xCellRange(xCR->getCellRangeByPosition(0, 0, 0, 0), + uno::UNO_SET_THROW); + CPPUNIT_ASSERT(xCellRange.is()); + + CPPUNIT_ASSERT_THROW(xCR->getCellRangeByPosition(-1, 0, -1, 1), + lang::IndexOutOfBoundsException); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/table/xcolumnrowrange.cxx b/test/source/table/xcolumnrowrange.cxx new file mode 100644 index 000000000..748a4825d --- /dev/null +++ b/test/source/table/xcolumnrowrange.cxx @@ -0,0 +1,36 @@ +/* -*- 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/table/xcolumnrowrange.hxx> + +#include <com/sun/star/table/XColumnRowRange.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XColumnRowRange::testGetColumns() +{ + uno::Reference<table::XColumnRowRange> xColumnRowRange(init(), UNO_QUERY_THROW); + CPPUNIT_ASSERT(xColumnRowRange->getColumns()); +} + +void XColumnRowRange::testGetRows() +{ + uno::Reference<table::XColumnRowRange> xColumnRowRange(init(), UNO_QUERY_THROW); + CPPUNIT_ASSERT(xColumnRowRange->getRows()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/table/xtablechart.cxx b/test/source/table/xtablechart.cxx new file mode 100644 index 000000000..a1c33ceab --- /dev/null +++ b/test/source/table/xtablechart.cxx @@ -0,0 +1,60 @@ +/* -*- 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/table/xtablechart.hxx> +#include <test/cppunitasserthelper.hxx> + +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/table/XTableChart.hpp> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XTableChart::testGetSetHasColumnHeaders() +{ + uno::Reference<table::XTableChart> xTC(init(), uno::UNO_QUERY_THROW); + + xTC->setHasColumnHeaders(false); + CPPUNIT_ASSERT(!xTC->getHasColumnHeaders()); + + xTC->setHasColumnHeaders(true); + CPPUNIT_ASSERT(xTC->getHasColumnHeaders()); +} + +void XTableChart::testGetSetHasRowHeaders() +{ + uno::Reference<table::XTableChart> xTC(init(), uno::UNO_QUERY_THROW); + + xTC->setHasRowHeaders(false); + CPPUNIT_ASSERT(!xTC->getHasRowHeaders()); + + xTC->setHasRowHeaders(true); + CPPUNIT_ASSERT(xTC->getHasRowHeaders()); +} + +void XTableChart::testGetSetRanges() +{ + uno::Reference<table::XTableChart> xTC(init(), uno::UNO_QUERY_THROW); + + uno::Sequence<table::CellRangeAddress> aCRA = xTC->getRanges(); + aCRA[0].EndRow = 1; + + xTC->setRanges(aCRA); + + CPPUNIT_ASSERT_EQUAL(aCRA[0], xTC->getRanges()[0]); +} + +} // namespace apitest +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/table/xtablecharts.cxx b/test/source/table/xtablecharts.cxx new file mode 100644 index 000000000..2f11a0d29 --- /dev/null +++ b/test/source/table/xtablecharts.cxx @@ -0,0 +1,40 @@ +/* -*- 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/table/xtablecharts.hxx> + +#include <com/sun/star/awt/Rectangle.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/table/XTableCharts.hpp> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XTableCharts::testAddNewRemoveByName() +{ + uno::Reference<table::XTableCharts> xTC(init(), uno::UNO_QUERY_THROW); + + uno::Sequence<table::CellRangeAddress> aRanges(1); + aRanges[0] = table::CellRangeAddress(0, 1, 1, 14, 4); + xTC->addNewByName("XTableCharts", awt::Rectangle(500, 3000, 25000, 11000), aRanges, true, true); + CPPUNIT_ASSERT(xTC->hasByName("XTableCharts")); + + xTC->removeByName("XTableCharts"); + CPPUNIT_ASSERT(!xTC->hasByName("XTableCharts")); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/table/xtablechartssupplier.cxx b/test/source/table/xtablechartssupplier.cxx new file mode 100644 index 000000000..047695dfc --- /dev/null +++ b/test/source/table/xtablechartssupplier.cxx @@ -0,0 +1,31 @@ +/* -*- 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/table/xtablechartssupplier.hxx> + +#include <com/sun/star/table/XTableChartsSupplier.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XTableChartsSupplier::testGetCharts() +{ + uno::Reference<table::XTableChartsSupplier> xTableChartsSupplier(init(), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_MESSAGE("Successfully able to Get Charts", xTableChartsSupplier->getCharts()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/table/xtablecolumns.cxx b/test/source/table/xtablecolumns.cxx new file mode 100644 index 000000000..0d72a8dd1 --- /dev/null +++ b/test/source/table/xtablecolumns.cxx @@ -0,0 +1,173 @@ +/* -*- 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/table/xtablecolumns.hxx> + +#include <com/sun/star/table/XCellRange.hpp> +#include <com/sun/star/table/XTableColumns.hpp> +#include <com/sun/star/text/XSimpleText.hpp> +#include <com/sun/star/uno/RuntimeException.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XTableColumns::testInsertByIndex() +{ + uno::Reference<table::XTableColumns> xTC(init(), uno::UNO_QUERY_THROW); + uno::Reference<table::XCellRange> xCR(m_xSheet, uno::UNO_QUERY_THROW); + + // insert one column at position one + xTC->insertByIndex(1, 1); + CPPUNIT_ASSERT_EQUAL(OUString("0a"), getCellText(xCR->getCellByPosition(0, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("0b"), getCellText(xCR->getCellByPosition(0, 1))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(1, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(1, 1))); + CPPUNIT_ASSERT_EQUAL(OUString("1a"), getCellText(xCR->getCellByPosition(2, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("1b"), getCellText(xCR->getCellByPosition(2, 1))); + CPPUNIT_ASSERT_EQUAL(OUString("2a"), getCellText(xCR->getCellByPosition(3, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2b"), getCellText(xCR->getCellByPosition(3, 1))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(4, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(4, 1))); + + // insert one column at position zero + xTC->insertByIndex(0, 1); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(0, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(0, 1))); + CPPUNIT_ASSERT_EQUAL(OUString("0a"), getCellText(xCR->getCellByPosition(1, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("0b"), getCellText(xCR->getCellByPosition(1, 1))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(2, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(2, 1))); + CPPUNIT_ASSERT_EQUAL(OUString("1a"), getCellText(xCR->getCellByPosition(3, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("1b"), getCellText(xCR->getCellByPosition(3, 1))); + CPPUNIT_ASSERT_EQUAL(OUString("2a"), getCellText(xCR->getCellByPosition(4, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2b"), getCellText(xCR->getCellByPosition(4, 1))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(5, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(5, 1))); + + // insert two columns at position zero + xTC->insertByIndex(0, 2); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(0, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(0, 1))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(1, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(1, 1))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(2, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(2, 1))); + CPPUNIT_ASSERT_EQUAL(OUString("0a"), getCellText(xCR->getCellByPosition(3, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("0b"), getCellText(xCR->getCellByPosition(3, 1))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(4, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(4, 1))); + CPPUNIT_ASSERT_EQUAL(OUString("1a"), getCellText(xCR->getCellByPosition(5, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("1b"), getCellText(xCR->getCellByPosition(5, 1))); + CPPUNIT_ASSERT_EQUAL(OUString("2a"), getCellText(xCR->getCellByPosition(6, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2b"), getCellText(xCR->getCellByPosition(6, 1))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(7, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(7, 1))); +} + +void XTableColumns::testInsertByIndexWithNegativeIndex() +{ + uno::Reference<table::XTableColumns> xTC(init(), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_THROW(xTC->insertByIndex(-1, 1), uno::RuntimeException); +} + +void XTableColumns::testInsertByIndexWithNoColumn() +{ + uno::Reference<table::XTableColumns> xTC(init(), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_THROW(xTC->insertByIndex(0, 0), uno::RuntimeException); +} + +void XTableColumns::testInsertByIndexWithOutOfBoundIndex() +{ + uno::Reference<table::XTableColumns> xTC(init(), uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT_THROW(xTC->insertByIndex(xTC->getCount(), 1), uno::RuntimeException); +} + +void XTableColumns::testRemoveByIndex() +{ + uno::Reference<table::XTableColumns> xTC(init(), uno::UNO_QUERY_THROW); + uno::Reference<table::XCellRange> xCR(m_xSheet, uno::UNO_QUERY_THROW); + + xTC->insertByIndex(1, 1); // insert one column at position one + xTC->insertByIndex(0, 1); // insert one column at position zero + xTC->insertByIndex(0, 2); // insert two columns at position zero + + // remove two columns at position zero + xTC->removeByIndex(0, 2); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(0, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(0, 1))); + CPPUNIT_ASSERT_EQUAL(OUString("0a"), getCellText(xCR->getCellByPosition(1, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("0b"), getCellText(xCR->getCellByPosition(1, 1))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(2, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(2, 1))); + CPPUNIT_ASSERT_EQUAL(OUString("1a"), getCellText(xCR->getCellByPosition(3, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("1b"), getCellText(xCR->getCellByPosition(3, 1))); + CPPUNIT_ASSERT_EQUAL(OUString("2a"), getCellText(xCR->getCellByPosition(4, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2b"), getCellText(xCR->getCellByPosition(4, 1))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(5, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(5, 1))); + + // remove one column at position zero + xTC->removeByIndex(0, 1); + CPPUNIT_ASSERT_EQUAL(OUString("0a"), getCellText(xCR->getCellByPosition(0, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("0b"), getCellText(xCR->getCellByPosition(0, 1))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(1, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(1, 1))); + CPPUNIT_ASSERT_EQUAL(OUString("1a"), getCellText(xCR->getCellByPosition(2, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("1b"), getCellText(xCR->getCellByPosition(2, 1))); + CPPUNIT_ASSERT_EQUAL(OUString("2a"), getCellText(xCR->getCellByPosition(3, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2b"), getCellText(xCR->getCellByPosition(3, 1))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(4, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(4, 1))); + + // remove one column at position one + xTC->removeByIndex(1, 1); + CPPUNIT_ASSERT_EQUAL(OUString("0a"), getCellText(xCR->getCellByPosition(0, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("0b"), getCellText(xCR->getCellByPosition(0, 1))); + CPPUNIT_ASSERT_EQUAL(OUString("1a"), getCellText(xCR->getCellByPosition(1, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("1b"), getCellText(xCR->getCellByPosition(1, 1))); + CPPUNIT_ASSERT_EQUAL(OUString("2a"), getCellText(xCR->getCellByPosition(2, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("2b"), getCellText(xCR->getCellByPosition(2, 1))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(3, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), getCellText(xCR->getCellByPosition(3, 1))); +} + +void XTableColumns::testRemoveByIndexWithNegativeIndex() +{ + uno::Reference<table::XTableColumns> xTC(init(), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_THROW(xTC->removeByIndex(-1, 1), uno::RuntimeException); +} + +void XTableColumns::testRemoveByIndexWithNoColumn() +{ + uno::Reference<table::XTableColumns> xTC(init(), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_THROW(xTC->removeByIndex(0, 0), uno::RuntimeException); +} + +void XTableColumns::testRemoveByIndexWithOutOfBoundIndex() +{ + uno::Reference<table::XTableColumns> xTC(init(), uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT_THROW(xTC->removeByIndex(xTC->getCount(), 1), uno::RuntimeException); +} + +OUString XTableColumns::getCellText(const uno::Reference<table::XCell>& r_xCell) +{ + uno::Reference<text::XSimpleText> xST(r_xCell, uno::UNO_QUERY_THROW); + return xST->getString(); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/table/xtablerows.cxx b/test/source/table/xtablerows.cxx new file mode 100644 index 000000000..c241b2bb8 --- /dev/null +++ b/test/source/table/xtablerows.cxx @@ -0,0 +1,55 @@ +/* -*- 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/table/xtablerows.hxx> + +#include <com/sun/star/table/XCellRange.hpp> +#include <com/sun/star/table/XTableRows.hpp> +#include <com/sun/star/uno/RuntimeException.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XTableRows::testInsertByIndex() +{ + uno::Reference<table::XCellRange> xCellRange(getXCellRange(), uno::UNO_QUERY_THROW); + xCellRange->getCellByPosition(0, 0)->setValue(17); + xCellRange->getCellByPosition(0, 1)->setValue(15); + + uno::Reference<table::XTableRows> xTableRows(init(), uno::UNO_QUERY_THROW); + xTableRows->removeByIndex(0, 1); + + xTableRows->insertByIndex(0, 1); + CPPUNIT_ASSERT_DOUBLES_EQUAL(xCellRange->getCellByPosition(0, 1)->getValue(), 15.0, 0.1); + + CPPUNIT_ASSERT_THROW(xTableRows->insertByIndex(-1, 1), uno::RuntimeException); +} + +void XTableRows::testRemoveByIndex() +{ + uno::Reference<table::XCellRange> xCellRange(getXCellRange(), uno::UNO_QUERY_THROW); + xCellRange->getCellByPosition(0, 0)->setValue(17); + xCellRange->getCellByPosition(0, 1)->setValue(15); + + uno::Reference<table::XTableRows> xTableRows(init(), uno::UNO_QUERY_THROW); + xTableRows->removeByIndex(0, 1); + CPPUNIT_ASSERT_DOUBLES_EQUAL(xCellRange->getCellByPosition(0, 0)->getValue(), 15.0, 0.1); + + CPPUNIT_ASSERT_THROW(xTableRows->removeByIndex(-1, 1), uno::RuntimeException); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/text/baseindex.cxx b/test/source/text/baseindex.cxx new file mode 100644 index 000000000..79ec57270 --- /dev/null +++ b/test/source/text/baseindex.cxx @@ -0,0 +1,151 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 <cppunit/TestAssert.h> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/text/XTextColumns.hpp> +#include <com/sun/star/text/XTextSection.hpp> + +#include <vcl/BitmapTools.hxx> +#include <vcl/pngwrite.hxx> +#include <unotools/tempfile.hxx> +#include <tools/stream.hxx> + +#include <test/unoapi_property_testers.hxx> +#include <test/text/baseindex.hxx> + +namespace +{ +BitmapEx createExampleBitmap() +{ + vcl::bitmap::RawBitmap aRawBitmap(Size(4, 4), 24); + aRawBitmap.SetPixel(0, 0, COL_LIGHTBLUE); + aRawBitmap.SetPixel(0, 1, COL_LIGHTGREEN); + aRawBitmap.SetPixel(1, 0, COL_LIGHTRED); + aRawBitmap.SetPixel(1, 1, COL_LIGHTMAGENTA); + return vcl::bitmap::CreateFromData(std::move(aRawBitmap)); +} + +void writerFileWithBitmap(OUString const& rURL) +{ + BitmapEx aBitmapEx = createExampleBitmap(); + SvFileStream aFileStream(rURL, StreamMode::READ | StreamMode::WRITE); + vcl::PNGWriter aWriter(aBitmapEx); + aWriter.Write(aFileStream); + aFileStream.Seek(STREAM_SEEK_TO_BEGIN); + aFileStream.Close(); +} +} + +namespace apitest +{ +BaseIndex::~BaseIndex() {} + +void BaseIndex::testBaseIndexProperties() +{ + css::uno::Reference<css::beans::XPropertySet> xBaseIndex(init(), css::uno::UNO_QUERY_THROW); + testStringProperty(xBaseIndex, "Title", "Value"); + testBooleanProperty(xBaseIndex, "IsProtected"); + + testStringProperty(xBaseIndex, "ParaStyleHeading", "Value"); + testStringProperty(xBaseIndex, "ParaStyleLevel1", "Value"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel2"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel3"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel4"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel5"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel6"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel7"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel8"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel9"); + testStringOptionalProperty(xBaseIndex, "ParaStyleLevel10"); + testStringOptionalProperty(xBaseIndex, "ParaStyleSeparator"); + + // [property] XTextColumns TextColumns; + { + OUString name = "TextColumns"; + + css::uno::Reference<css::text::XTextColumns> xGetTextColumns; + CPPUNIT_ASSERT(xBaseIndex->getPropertyValue(name) >>= xGetTextColumns); + + xGetTextColumns->setColumnCount(xGetTextColumns->getColumnCount() + 1); + xBaseIndex->setPropertyValue(name, css::uno::makeAny(xGetTextColumns)); + + css::uno::Reference<css::text::XTextColumns> xSetTextColumns; + CPPUNIT_ASSERT(xBaseIndex->getPropertyValue(name) >>= xSetTextColumns); + + //CPPUNIT_ASSERT_EQUAL(xGetTextColumns->getColumnCount(), xSetTextColumns->getColumnCount()); + } + + // [property] com::sun::star::graphic::XGraphic BackGraphic; + // [property] string BackGraphicURL; + { + OUString name = "BackGraphicURL"; + bool bOK = false; + try + { + xBaseIndex->getPropertyValue(name); + } + catch (css::uno::RuntimeException const& /*ex*/) + { + bOK = true; + } + // BackGraphicURL is "set-only" attribute + CPPUNIT_ASSERT_MESSAGE("Expected RuntimeException wasn't thrown", bOK); + + utl::TempFile aTempFile; + aTempFile.EnableKillingFile(); + writerFileWithBitmap(aTempFile.GetURL()); + + css::uno::Reference<css::graphic::XGraphic> xGraphic; + CPPUNIT_ASSERT(xBaseIndex->getPropertyValue("BackGraphic") >>= xGraphic); + CPPUNIT_ASSERT(!xGraphic.is()); + + xBaseIndex->setPropertyValue(name, css::uno::makeAny(aTempFile.GetURL())); + + CPPUNIT_ASSERT(xBaseIndex->getPropertyValue("BackGraphic") >>= xGraphic); + CPPUNIT_ASSERT(xGraphic.is()); + } + + testStringProperty(xBaseIndex, "BackGraphicFilter", "Value"); + + // [property] com::sun::star::style::GraphicLocation BackGraphicLocation; + + testColorProperty(xBaseIndex, "BackColor"); + testBooleanProperty(xBaseIndex, "BackTransparent"); + + // [optional, property] com::sun::star::container::XIndexReplace LevelFormat; + + testBooleanOptionalProperty(xBaseIndex, "CreateFromChapter"); + + // [property] com::sun::star::text::XTextSection ContentSection; + { + OUString name = "ContentSection"; + + css::uno::Reference<css::text::XTextSection> xGetTextSection; + CPPUNIT_ASSERT_MESSAGE(name.toUtf8().getStr(), + xBaseIndex->getPropertyValue(name) >>= xGetTextSection); + CPPUNIT_ASSERT_EQUAL_MESSAGE(name.toUtf8().getStr(), OUString(""), + xGetTextSection->getAnchor()->getString()); + } + + // [property] com::sun::star::text::XTextSection HeaderSection; + { + OUString name = "HeaderSection"; + + css::uno::Reference<css::text::XTextSection> xGetTextSection; + if (xBaseIndex->getPropertyValue(name).hasValue()) + CPPUNIT_ASSERT_MESSAGE(name.toUtf8().getStr(), + xBaseIndex->getPropertyValue(name) >>= xGetTextSection); + } +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/text/textcontent.cxx b/test/source/text/textcontent.cxx new file mode 100644 index 000000000..132981b2a --- /dev/null +++ b/test/source/text/textcontent.cxx @@ -0,0 +1,68 @@ +/* -*- 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/text/textcontent.hxx> + +#include <com/sun/star/text/TextContentAnchorType.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void TextContent::testTextContentProperties() +{ + uno::Reference<beans::XPropertySet> xPS(init(), uno::UNO_QUERY_THROW); + + text::TextContentAnchorType aExpectedTCAT; + CPPUNIT_ASSERT(xPS->getPropertyValue("AnchorType") >>= aExpectedTCAT); + CPPUNIT_ASSERT_EQUAL(m_aExpectedTCAT, aExpectedTCAT); + + try + { + xPS->setPropertyValue("AnchorType", uno::makeAny(m_aNewTCAT)); + text::TextContentAnchorType aNewTCAT; + CPPUNIT_ASSERT(xPS->getPropertyValue("AnchorType") >>= aNewTCAT); + CPPUNIT_ASSERT_EQUAL(m_aNewTCAT, aNewTCAT); + } + catch (const beans::UnknownPropertyException& /* ex */) + { + // ignore if property is optional + } + + uno::Sequence<text::TextContentAnchorType> aAnchorTypes; + CPPUNIT_ASSERT(xPS->getPropertyValue("AnchorTypes") >>= aAnchorTypes); + CPPUNIT_ASSERT(aAnchorTypes.hasElements()); + + text::WrapTextMode aExpectedWTM; + CPPUNIT_ASSERT(xPS->getPropertyValue("TextWrap") >>= aExpectedWTM); + CPPUNIT_ASSERT_EQUAL(m_aExpectedWTM, aExpectedWTM); + + try + { + xPS->setPropertyValue("TextWrap", uno::makeAny(m_aNewWTM)); + text::WrapTextMode aNewWTM; + CPPUNIT_ASSERT(xPS->getPropertyValue("TextWrap") >>= aNewWTM); + CPPUNIT_ASSERT_EQUAL(m_aNewWTM, aNewWTM); + } + catch (const beans::UnknownPropertyException& /* ex */) + { + // ignore if property is optional + } +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/text/textdocumentindex.cxx b/test/source/text/textdocumentindex.cxx new file mode 100644 index 000000000..63873e2b4 --- /dev/null +++ b/test/source/text/textdocumentindex.cxx @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 <com/sun/star/beans/XPropertySet.hpp> + +#include <test/unoapi_property_testers.hxx> +#include <test/text/textdocumentindex.hxx> + +namespace apitest +{ +TextDocumentIndex::~TextDocumentIndex() {} + +void TextDocumentIndex::testDocumentIndexProperties() +{ + css::uno::Reference<css::beans::XPropertySet> xDocumnetIndex(init(), css::uno::UNO_QUERY_THROW); + + testBooleanProperty(xDocumnetIndex, "UseAlphabeticalSeparators"); + testBooleanProperty(xDocumnetIndex, "UseKeyAsEntry"); + testBooleanProperty(xDocumnetIndex, "UseCombinedEntries"); + testBooleanProperty(xDocumnetIndex, "IsCaseSensitive"); + testBooleanProperty(xDocumnetIndex, "UsePP"); + testBooleanProperty(xDocumnetIndex, "UseDash"); + testBooleanProperty(xDocumnetIndex, "UseUpperCase"); + testStringOptionalProperty(xDocumnetIndex, "MainEntryCharacterStyleName"); + // [readonly, property] sequence <com::sun::star::text::XDocumentIndexMark> DocumentIndexMarks; + // [property] com::sun::star::lang::Locale Locale; + testStringProperty(xDocumnetIndex, "SortAlgorithm", "Value"); +} +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/text/textdocumentsettings.cxx b/test/source/text/textdocumentsettings.cxx new file mode 100644 index 000000000..9ef0518b0 --- /dev/null +++ b/test/source/text/textdocumentsettings.cxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/text/textdocumentsettings.hxx> +#include <test/unoapi_property_testers.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/uno/Reference.hxx> + +using namespace css::uno; + +namespace apitest +{ +TextDocumentSettings::~TextDocumentSettings() {} + +void TextDocumentSettings::testDocumentSettingsProperties() +{ + css::uno::Reference<css::beans::XPropertySet> xDocumentSettings(init(), + css::uno::UNO_QUERY_THROW); + + testBooleanOptionalProperty(xDocumentSettings, "ChartAutoUpdate"); + testBooleanOptionalProperty(xDocumentSettings, "AddParaTableSpacing"); + testBooleanOptionalProperty(xDocumentSettings, "AddParaTableSpacingAtStart"); + testBooleanOptionalProperty(xDocumentSettings, "AlignTabStopPosition"); + testBooleanOptionalProperty(xDocumentSettings, "SaveGlobalDocumentLinks"); + testBooleanOptionalProperty(xDocumentSettings, "IsLabelDocument"); + testBooleanOptionalProperty(xDocumentSettings, "UseFormerLineSpacing"); + testBooleanOptionalProperty(xDocumentSettings, "AddParaSpacingToTableCells"); + testBooleanOptionalProperty(xDocumentSettings, "UseFormerObjectPositioning"); + testBooleanOptionalProperty(xDocumentSettings, "ConsiderTextWrapOnObjPos"); + testBooleanOptionalProperty(xDocumentSettings, "MathBaselineAlignment"); +} + +} // end namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/text/textprintersettings.cxx b/test/source/text/textprintersettings.cxx new file mode 100644 index 000000000..b28c65241 --- /dev/null +++ b/test/source/text/textprintersettings.cxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 <com/sun/star/beans/XPropertySet.hpp> + +#include <test/unoapi_property_testers.hxx> +#include <test/text/textprintersettings.hxx> + +namespace apitest +{ +TextPrinterSettings::~TextPrinterSettings() {} +void TextPrinterSettings::testPrinterSettingsProperties() +{ + css::uno::Reference<css::beans::XPropertySet> xPrinterSettings(init(), + css::uno::UNO_QUERY_THROW); + + testBooleanProperty(xPrinterSettings, "PrintGraphics"); + testBooleanProperty(xPrinterSettings, "PrintTables"); + testBooleanProperty(xPrinterSettings, "PrintDrawings"); + testBooleanProperty(xPrinterSettings, "PrintLeftPages"); + testBooleanProperty(xPrinterSettings, "PrintRightPages"); + testBooleanProperty(xPrinterSettings, "PrintControls"); + testBooleanProperty(xPrinterSettings, "PrintReversed"); + testBooleanProperty(xPrinterSettings, "PrintControls"); + testStringProperty(xPrinterSettings, "PrintFaxName", "FaxName"); + testBooleanProperty(xPrinterSettings, "PrintProspect"); + testBooleanProperty(xPrinterSettings, "PrintPageBackground"); + testBooleanProperty(xPrinterSettings, "PrintBlackFonts"); + testBooleanOptionalProperty(xPrinterSettings, "PrintEmptyPages"); +} +} // end namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/text/textsettings.cxx b/test/source/text/textsettings.cxx new file mode 100644 index 000000000..880206e09 --- /dev/null +++ b/test/source/text/textsettings.cxx @@ -0,0 +1,153 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 <cppunit/TestAssert.h> + +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/i18n/XForbiddenCharacters.hpp> + +#include <test/unoapi_property_testers.hxx> +#include <test/text/textsettings.hxx> + +namespace +{ +bool extstsProperty(css::uno::Reference<css::beans::XPropertySet> const& rxPropertySet, + OUString const& rPropertyName) +{ + css::uno::Reference<css::beans::XPropertySetInfo> xPropertySetInfo( + rxPropertySet->getPropertySetInfo()); + return xPropertySetInfo->hasPropertyByName(rPropertyName); +} + +bool isPropertyReadOnly(css::uno::Reference<css::beans::XPropertySet> const& rxPropertySet, + OUString const& rPropertyName) +{ + css::uno::Reference<css::beans::XPropertySetInfo> xPropertySetInfo( + rxPropertySet->getPropertySetInfo()); + const css::uno::Sequence<css::beans::Property> xProperties = xPropertySetInfo->getProperties(); + + for (auto const& rProperty : xProperties) + { + if (rProperty.Name == rPropertyName) + return (rProperty.Attributes & com::sun::star::beans::PropertyAttribute::READONLY) != 0; + } + + return false; +} +// [property] string PrinterName; +void testPrinterName(css::uno::Reference<css::beans::XPropertySet> const& rxSettings) +{ + const OUString rPropertyName("PrinterName"); + + if (!extstsProperty(rxSettings, rPropertyName)) + return; // Property is sometimes not set - bug? it is not defined as optional + + OUString aPrinterName_Get; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", + rxSettings->getPropertyValue(rPropertyName) >>= aPrinterName_Get); + + OUString aPrinterName_Set; + css::uno::Any aNewValue; + aNewValue <<= aPrinterName_Get; + rxSettings->setPropertyValue(rPropertyName, aNewValue); + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", + rxSettings->getPropertyValue(rPropertyName) >>= aPrinterName_Set); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue", aPrinterName_Get, aPrinterName_Set); +} + +// [optional, property] short PrinterIndependentLayout; +void testPrinterIndependentLayout(css::uno::Reference<css::beans::XPropertySet> const& rxSettings) +{ + const OUString rPropertyName("PrinterIndependentLayout"); + + if (!extstsProperty(rxSettings, rPropertyName)) + return; // Property is optional + + sal_Int16 aValue_Get = {}; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", + rxSettings->getPropertyValue(rPropertyName) >>= aValue_Get); + + sal_Int16 aValue_New; + aValue_New = (aValue_Get == 1 ? 3 : 1); + rxSettings->setPropertyValue(rPropertyName, css::uno::Any(aValue_New)); + + sal_Int16 aValue_Set; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", + rxSettings->getPropertyValue(rPropertyName) >>= aValue_Set); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to set PropertyValue", aValue_New, aValue_Set); +} + +// [optional, property] com::sun::star::i18n::XForbiddenCharacters ForbiddenCharacters; +void testForbiddenCharacters(css::uno::Reference<css::beans::XPropertySet> const& rxSettings) +{ + const OUString rPropertyName("ForbiddenCharacters"); + + if (!extstsProperty(rxSettings, rPropertyName)) + return; // Property is optional + + CPPUNIT_ASSERT_MESSAGE("Property is read-only but shouldn't be", + !isPropertyReadOnly(rxSettings, rPropertyName)); + + css::uno::Reference<css::i18n::XForbiddenCharacters> aValue_Get; + + CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", + rxSettings->getPropertyValue(rPropertyName) >>= aValue_Get); + CPPUNIT_ASSERT_MESSAGE("Empty reference to XForbiddenCharacters", aValue_Get.is()); +} +} + +namespace apitest +{ +TextSettings::~TextSettings() {} +void TextSettings::testSettingsProperties() +{ + css::uno::Reference<css::beans::XPropertySet> xSettings(init(), css::uno::UNO_QUERY_THROW); + + testForbiddenCharacters(xSettings); + //testShortOptionalProperty(xSettings, "LinkUpdateMode"); + testPrinterName(xSettings); + // [property] sequence< byte > PrinterSetup; + testBooleanOptionalProperty(xSettings, "IsKernAsianPunctuation"); + //testShortOptionalProperty(xSettings, "CharacterCompressionType"); + testBooleanOptionalProperty(xSettings, "ApplyUserData"); + testBooleanOptionalProperty(xSettings, "SaveVersionOnClose"); + testBooleanOptionalProperty(xSettings, "UpdateFromTemplate"); + testBooleanOptionalProperty(xSettings, "FieldAutoUpdate"); + testStringOptionalProperty(xSettings, "CurrentDatabaseDataSource"); + testStringOptionalProperty(xSettings, "CurrentDatabaseCommand"); + testLongOptionalProperty(xSettings, "CurrentDatabaseCommandType"); + testLongOptionalProperty(xSettings, "DefaultTabStop"); + testBooleanOptionalProperty(xSettings, "IsPrintBooklet"); + testBooleanOptionalProperty(xSettings, "IsPrintBookletFront"); + testBooleanOptionalProperty(xSettings, "IsPrintBookletBack"); + testLongOptionalProperty(xSettings, "PrintQuality"); + testStringOptionalProperty(xSettings, "ColorTableURL"); + testStringOptionalProperty(xSettings, "DashTableURL"); + testStringOptionalProperty(xSettings, "LineEndTableURL"); + testStringOptionalProperty(xSettings, "HatchTableURL"); + testStringOptionalProperty(xSettings, "GradientTableURL"); + testStringOptionalProperty(xSettings, "BitmapTableURL"); + testBooleanOptionalProperty(xSettings, "AutoCalculate"); + testPrinterIndependentLayout(xSettings); + testBooleanOptionalProperty(xSettings, "AddExternalLeading"); + testBooleanOptionalProperty(xSettings, "EmbedFonts"); + testBooleanOptionalProperty(xSettings, "EmbedSystemFonts"); + testBooleanOptionalProperty(xSettings, "EmbedOnlyUsedFonts"); + testBooleanOptionalProperty(xSettings, "EmbedLatinScriptFonts"); + testBooleanOptionalProperty(xSettings, "EmbedAsianScriptFonts"); + testBooleanOptionalProperty(xSettings, "EmbedComplexScriptFonts"); +} +} // end namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/text/xdocumentindex.cxx b/test/source/text/xdocumentindex.cxx new file mode 100644 index 000000000..9f9ad73c8 --- /dev/null +++ b/test/source/text/xdocumentindex.cxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 <cppunit/TestAssert.h> + +#include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/text/XTextContent.hpp> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/text/XDocumentIndex.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include <test/text/xdocumentindex.hxx> + +namespace apitest +{ +XDocumentIndex::~XDocumentIndex() {} +/** + * Gets the document from relation and insert a new index mark. + * Then it stores the text content of document index before + * update and after.<p> + * + * Has <b> OK </b> status if index content is changed and + * new index contains index mark inserted. <p> + */ +void XDocumentIndex::testUpdate() +{ + css::uno::Reference<css::text::XDocumentIndex> xDocumentIndex(init(), + css::uno::UNO_QUERY_THROW); + + bool bOK = true; + try + { + auto xText = getTextDocument()->getText(); + auto xTextRange = xText->getEnd(); + xTextRange->setString("IndexMark"); + css::uno::Reference<css::lang::XMultiServiceFactory> xFactory(getTextDocument(), + css::uno::UNO_QUERY_THROW); + css::uno::Reference<css::text::XTextContent> xTextContentMark( + xFactory->createInstance("com.sun.star.text.DocumentIndexMark"), + css::uno::UNO_QUERY_THROW); + xText->insertTextContent(xTextRange, xTextContentMark, true); + } + catch (css::uno::Exception /*exception*/) + { + bOK = false; + } + + CPPUNIT_ASSERT_MESSAGE("Couldn't create the document index mark", bOK); + + OUString sContentBefore = xDocumentIndex->getAnchor()->getString(); + xDocumentIndex->update(); + OUString sContentAfter = xDocumentIndex->getAnchor()->getString(); + + CPPUNIT_ASSERT_MESSAGE("Before and after shouldn't be equal", sContentBefore != sContentAfter); + CPPUNIT_ASSERT_MESSAGE("Content after should contain string 'IndexMark'", + sContentAfter.indexOf("IndexMark") >= 0); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/text/xsimpletext.cxx b/test/source/text/xsimpletext.cxx new file mode 100644 index 000000000..23ea6c785 --- /dev/null +++ b/test/source/text/xsimpletext.cxx @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/text/xsimpletext.hxx> +#include <com/sun/star/text/XTextCursor.hpp> +#include <com/sun/star/text/ControlCharacter.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest +{ +void XSimpleText::testCreateTextCursor() +{ + uno::Reference<text::XSimpleText> xSimpleText(init(), UNO_QUERY_THROW); + + CPPUNIT_ASSERT(xSimpleText->createTextCursor()); +} + +void XSimpleText::testCreateTextCursorByRange() +{ + uno::Reference<text::XSimpleText> xSimpleText(init(), UNO_QUERY_THROW); + uno::Reference<text::XTextCursor> xCursor(xSimpleText->createTextCursor(), UNO_SET_THROW); + + xCursor->gotoStart(false); + + CPPUNIT_ASSERT(xSimpleText->createTextCursorByRange(xCursor)); +} + +void XSimpleText::testInsertString() +{ + uno::Reference<text::XSimpleText> xSimpleText(init(), UNO_QUERY_THROW); + uno::Reference<text::XTextRange> xCursor(xSimpleText->createTextCursor(), UNO_QUERY_THROW); + ::rtl::OUString sString = "TestString"; + + xSimpleText->insertString(xCursor, sString, false); + ::rtl::OUString gString = xSimpleText->getText()->getString(); + + CPPUNIT_ASSERT(!gString.isEmpty()); + CPPUNIT_ASSERT(gString.indexOf(sString) >= 0); +} + +void XSimpleText::testInsertControlCharacter() +{ + bool bOK = true; + + uno::Reference<text::XSimpleText> xSimpleText(init(), UNO_QUERY_THROW); + uno::Reference<text::XTextRange> xCursor(xSimpleText->createTextCursor(), UNO_QUERY_THROW); + + try + { + xSimpleText->insertControlCharacter(xCursor, text::ControlCharacter::PARAGRAPH_BREAK, + false); + xSimpleText->insertControlCharacter(xCursor, text::ControlCharacter::LINE_BREAK, false); + xSimpleText->insertString(xSimpleText->createTextCursor(), "newLine", false); + } + catch (const lang::IllegalArgumentException&) + { + bOK = false; + } + + OUString gString = xSimpleText->getString(); + CPPUNIT_ASSERT(bOK); + CPPUNIT_ASSERT(gString.indexOf("\n") > -1); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/text/xtext.cxx b/test/source/text/xtext.cxx new file mode 100644 index 000000000..6ab646d0a --- /dev/null +++ b/test/source/text/xtext.cxx @@ -0,0 +1,30 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/text/xtext.hxx> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +XText::~XText() {} + +void XText::testInsertRemoveTextContent() +{ + uno::Reference<text::XText> xText(init(), UNO_QUERY_THROW); + uno::Reference<text::XTextRange> xCursor(xText->createTextCursor(), UNO_QUERY_THROW); + + xText->insertTextContent(xCursor, getTextContent(), false); + xText->removeTextContent(getTextContent()); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/text/xtextcontent.cxx b/test/source/text/xtextcontent.cxx new file mode 100644 index 000000000..b4b60aaea --- /dev/null +++ b/test/source/text/xtextcontent.cxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/text/xtextcontent.hxx> +#include <com/sun/star/text/XTextContent.hpp> +#include <com/sun/star/text/XTextRange.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <cppunit/TestAssert.h> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void XTextContent::testGetAnchor() +{ + uno::Reference< text::XTextContent > xTextContent(init(), UNO_QUERY_THROW); + uno::Reference< uno::XInterface > xAnchor(xTextContent->getAnchor()); + CPPUNIT_ASSERT(xAnchor.is()); +} + +void XTextContent::testAttach() +{ + uno::Reference< text::XTextContent > xTextContent(init(), UNO_QUERY_THROW); + + uno::Reference< text::XTextContent > xContent(getTextContent(), UNO_SET_THROW); + uno::Reference< text::XTextRange > xRange(getTextRange(), UNO_SET_THROW); + + try + { + if (xContent.is()) + xContent->attach(xRange); + else + xTextContent->attach(xRange); + } + catch (const lang::IllegalArgumentException&) + { + bool bAttachSupported = isAttachSupported(); + if (bAttachSupported) + CPPUNIT_ASSERT(false); + } + catch (const RuntimeException&) + { + bool bAttachSupported = isAttachSupported(); + if (bAttachSupported) + CPPUNIT_ASSERT(false); + } +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/text/xtextfield.cxx b/test/source/text/xtextfield.cxx new file mode 100644 index 000000000..ceefcceed --- /dev/null +++ b/test/source/text/xtextfield.cxx @@ -0,0 +1,43 @@ +/* -*- 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/text/xtextfield.hxx> + +#include <com/sun/star/text/XTextField.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XTextField::testGetPresentation() +{ + uno::Reference<text::XTextField> xTextField(init(), uno::UNO_QUERY_THROW); + + OUString aString = xTextField->getPresentation(true); + CPPUNIT_ASSERT(!aString.isEmpty()); + aString = xTextField->getPresentation(false); + CPPUNIT_ASSERT(!aString.isEmpty()); +} + +void XTextField::testGetPresentationEmptyString() +{ + uno::Reference<text::XTextField> xTextField(init(), uno::UNO_QUERY_THROW); + + OUString aString = xTextField->getPresentation(true); + CPPUNIT_ASSERT(aString.isEmpty()); + aString = xTextField->getPresentation(false); + CPPUNIT_ASSERT(aString.isEmpty()); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/text/xtextrange.cxx b/test/source/text/xtextrange.cxx new file mode 100644 index 000000000..64428b476 --- /dev/null +++ b/test/source/text/xtextrange.cxx @@ -0,0 +1,61 @@ +/* -*- 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/text/xtextrange.hxx> + +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/text/XTextRange.hpp> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XTextRange::testGetEnd() +{ + uno::Reference<text::XTextRange> xTextRange(init(), uno::UNO_QUERY_THROW); + + xTextRange->setString("UnitTest"); + uno::Reference<text::XTextRange> xTR_end(xTextRange->getEnd(), uno::UNO_SET_THROW); + xTR_end->setString("End"); + + CPPUNIT_ASSERT(xTextRange->getText()->getString().endsWith("End")); +} + +void XTextRange::testGetSetString() +{ + uno::Reference<text::XTextRange> xTextRange(init(), uno::UNO_QUERY_THROW); + + xTextRange->setString("UnitTest"); + CPPUNIT_ASSERT_EQUAL(OUString("UnitTest"), xTextRange->getString()); +} + +void XTextRange::testGetStart() +{ + uno::Reference<text::XTextRange> xTextRange(init(), uno::UNO_QUERY_THROW); + + xTextRange->setString("UnitTest"); + uno::Reference<text::XTextRange> xTR_start(xTextRange->getStart(), uno::UNO_SET_THROW); + xTR_start->setString("Start"); + + CPPUNIT_ASSERT(xTextRange->getText()->getString().startsWith("Start")); +} + +void XTextRange::testGetText() +{ + uno::Reference<text::XTextRange> xTextRange(init(), uno::UNO_QUERY_THROW); + + xTextRange->setString("UnitTest"); + uno::Reference<text::XText> xText(xTextRange->getText(), uno::UNO_SET_THROW); + CPPUNIT_ASSERT_EQUAL(OUString("UnitTest"), xTextRange->getString()); +} +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/unoapi_property_testers.cxx b/test/source/unoapi_property_testers.cxx new file mode 100644 index 000000000..f261c4ce3 --- /dev/null +++ b/test/source/unoapi_property_testers.cxx @@ -0,0 +1,288 @@ +/* -*- 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/unoapi_property_testers.hxx> + +#include <com/sun/star/uno/Any.hxx> +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void testBooleanProperty(uno::Reference<beans::XPropertySet> const& xPropertySet, + const OUString& name) +{ + uno::Any aNewValue; + + bool bPropertyGet = false; + bool bPropertySet = false; + + OString msgGet + = "Unable to get PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_MESSAGE(msgGet.getStr(), xPropertySet->getPropertyValue(name) >>= bPropertyGet); + + aNewValue <<= !bPropertyGet; + xPropertySet->setPropertyValue(name, aNewValue); + CPPUNIT_ASSERT(xPropertySet->getPropertyValue(name) >>= bPropertySet); + OString msgSet + = "Unable to set PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_EQUAL_MESSAGE(msgSet.getStr(), !bPropertyGet, bPropertySet); +} + +void testBooleanOptionalProperty(uno::Reference<beans::XPropertySet> const& xPropertySet, + const OUString& rName) +{ + try + { + testBooleanProperty(xPropertySet, rName); + } + catch (const css::beans::UnknownPropertyException& /*ex*/) + { + // ignore if the property is unknown as it is optional + } +} + +void testBooleanReadonlyProperty(uno::Reference<beans::XPropertySet> const& xPropertySet, + const OUString& name) +{ + uno::Any aNewValue; + + bool bPropertyGet = false; + bool bPropertySet = false; + + OString msgGet + = "Unable to get PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_MESSAGE(msgGet.getStr(), xPropertySet->getPropertyValue(name) >>= bPropertyGet); + + aNewValue <<= !bPropertyGet; + xPropertySet->setPropertyValue(name, aNewValue); + CPPUNIT_ASSERT(xPropertySet->getPropertyValue(name) >>= bPropertySet); + OString msgSet = "Able to set PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_EQUAL_MESSAGE(msgSet.getStr(), bPropertyGet, bPropertySet); +} + +void testDoubleProperty(uno::Reference<beans::XPropertySet> const& xPropertySet, + const OUString& name, const double& dValue) +{ + uno::Any aNewValue; + + double dPropertyGet; + double dPropertySet; + + OString msgGet + = "Unable to get PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_MESSAGE(msgGet.getStr(), xPropertySet->getPropertyValue(name) >>= dPropertyGet); + + aNewValue <<= dValue; + xPropertySet->setPropertyValue(name, aNewValue); + CPPUNIT_ASSERT(xPropertySet->getPropertyValue(name) >>= dPropertySet); + OString msgSet + = "Unable to set PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(msgSet.getStr(), dValue, dPropertySet, 0.5); +} + +void testDoubleReadonlyProperty(uno::Reference<beans::XPropertySet> const& xPropertySet, + const OUString& name, const double& dValue) +{ + uno::Any aNewValue; + + double dPropertyGet; + double dPropertySet; + + OString msgGet + = "Unable to get PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_MESSAGE(msgGet.getStr(), xPropertySet->getPropertyValue(name) >>= dPropertyGet); + + aNewValue <<= dValue; + xPropertySet->setPropertyValue(name, aNewValue); + CPPUNIT_ASSERT(xPropertySet->getPropertyValue(name) >>= dPropertySet); + OString msgSet = "Able to set PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(msgSet.getStr(), dPropertyGet, dPropertySet, 0.5); +} + +void testLongProperty(uno::Reference<beans::XPropertySet> const& xPropertySet, const OUString& name, + const sal_Int32& nValue) +{ + uno::Any aNewValue; + + sal_Int32 nPropertyGet; + sal_Int32 nPropertySet; + + OString msgGet + = "Unable to get PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_MESSAGE(msgGet.getStr(), xPropertySet->getPropertyValue(name) >>= nPropertyGet); + + aNewValue <<= nValue; + xPropertySet->setPropertyValue(name, aNewValue); + CPPUNIT_ASSERT(xPropertySet->getPropertyValue(name) >>= nPropertySet); + OString msgSet + = "Unable to set PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_EQUAL_MESSAGE(msgSet.getStr(), nValue, nPropertySet); +} + +void testLongOptionalProperty(uno::Reference<beans::XPropertySet> const& xPropertySet, + const OUString& rName, const sal_Int32& rValue) +{ + try + { + testLongProperty(xPropertySet, rName, rValue); + } + catch (const css::beans::UnknownPropertyException& /*ex*/) + { + // ignore if the property is unknown as it is optional + } +} + +void testLongReadonlyProperty(uno::Reference<beans::XPropertySet> const& xPropertySet, + const OUString& name, const sal_Int32& nValue) +{ + uno::Any aNewValue; + + sal_Int32 nPropertyGet; + sal_Int32 nPropertySet; + + OString msgGet + = "Unable to get PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_MESSAGE(msgGet.getStr(), xPropertySet->getPropertyValue(name) >>= nPropertyGet); + + aNewValue <<= nValue; + xPropertySet->setPropertyValue(name, aNewValue); + CPPUNIT_ASSERT(xPropertySet->getPropertyValue(name) >>= nPropertySet); + OString msgSet = "Able to set PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_EQUAL_MESSAGE(msgSet.getStr(), nPropertyGet, nPropertySet); +} + +void testShortProperty(uno::Reference<beans::XPropertySet> const& xPropertySet, + const OUString& name, const sal_Int16& nValue) +{ + uno::Any aNewValue; + + sal_Int16 nPropertyGet; + sal_Int16 nPropertySet; + + OString msgGet + = "Unable to get PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_MESSAGE(msgGet.getStr(), xPropertySet->getPropertyValue(name) >>= nPropertyGet); + + aNewValue <<= nValue; + xPropertySet->setPropertyValue(name, aNewValue); + CPPUNIT_ASSERT(xPropertySet->getPropertyValue(name) >>= nPropertySet); + OString msgSet + = "Unable to set PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_EQUAL_MESSAGE(msgSet.getStr(), nValue, nPropertySet); +} + +void testShortOptionalProperty(uno::Reference<beans::XPropertySet> const& xPropertySet, + const OUString& rName, const sal_Int16& rValue) +{ + try + { + testShortProperty(xPropertySet, rName, rValue); + } + catch (const css::beans::UnknownPropertyException& /*ex*/) + { + // ignore if the property is unknown as it is optional + } +} + +void testShortReadonlyProperty(uno::Reference<beans::XPropertySet> const& xPropertySet, + const OUString& name, const sal_Int16& nValue) +{ + uno::Any aNewValue; + + sal_Int16 nPropertyGet; + sal_Int16 nPropertySet; + + OString msgGet + = "Unable to get PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_MESSAGE(msgGet.getStr(), xPropertySet->getPropertyValue(name) >>= nPropertyGet); + + aNewValue <<= nValue; + xPropertySet->setPropertyValue(name, aNewValue); + CPPUNIT_ASSERT(xPropertySet->getPropertyValue(name) >>= nPropertySet); + OString msgSet = "Able to set PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_EQUAL_MESSAGE(msgSet.getStr(), nPropertyGet, nPropertySet); +} + +void testStringOptionalProperty(uno::Reference<beans::XPropertySet> const& xPropertySet, + const OUString& rName, const OUString& rValue) +{ + try + { + testStringProperty(xPropertySet, rName, rValue); + } + catch (const css::beans::UnknownPropertyException& /*ex*/) + { + // ignore if the property is unknown as it is optional + } +} + +void testStringProperty(uno::Reference<beans::XPropertySet> const& xPropertySet, + const OUString& name, const OUString& rValue) +{ + uno::Any aNewValue; + + OUString sPropertyGet; + OUString sPropertySet; + + OString msgGet + = "Unable to get PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_MESSAGE(msgGet.getStr(), xPropertySet->getPropertyValue(name) >>= sPropertyGet); + + aNewValue <<= rValue; + xPropertySet->setPropertyValue(name, aNewValue); + CPPUNIT_ASSERT(xPropertySet->getPropertyValue(name) >>= sPropertySet); + OString msgSet + = "Unable to set PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_EQUAL_MESSAGE(msgSet.getStr(), rValue, sPropertySet); +} + +void testStringReadonlyProperty(uno::Reference<beans::XPropertySet> const& xPropertySet, + const OUString& name, const OUString& rValue) +{ + uno::Any aNewValue; + + OUString sPropertyGet; + OUString sPropertySet; + + OString msgGet + = "Unable to get PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_MESSAGE(msgGet.getStr(), xPropertySet->getPropertyValue(name) >>= sPropertyGet); + + aNewValue <<= rValue; + xPropertySet->setPropertyValue(name, aNewValue); + CPPUNIT_ASSERT(xPropertySet->getPropertyValue(name) >>= sPropertySet); + OString msgSet = "Able to set PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_EQUAL_MESSAGE(msgSet.getStr(), sPropertyGet, sPropertySet); +} + +void testColorProperty(uno::Reference<beans::XPropertySet> const& xPropertySet, + const OUString& name, const util::Color& rValue) +{ + uno::Any aNewValue; + + util::Color sPropertyGet; + util::Color sPropertySet; + + OString msgGet + = "Unable to get PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_MESSAGE(msgGet.getStr(), xPropertySet->getPropertyValue(name) >>= sPropertyGet); + + aNewValue <<= rValue; + xPropertySet->setPropertyValue(name, aNewValue); + CPPUNIT_ASSERT(xPropertySet->getPropertyValue(name) >>= sPropertySet); + OString msgSet + = "Unable to set PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8); + CPPUNIT_ASSERT_EQUAL_MESSAGE(msgSet.getStr(), rValue, sPropertySet); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/unoapi_test.cxx b/test/source/unoapi_test.cxx new file mode 100644 index 000000000..8921b6d01 --- /dev/null +++ b/test/source/unoapi_test.cxx @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/unoapi_test.hxx> + +#include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/frame/Desktop.hpp> +#include <comphelper/processfactory.hxx> + +using namespace css; +using namespace css::uno; + +UnoApiTest::UnoApiTest(const OUString& path) + : m_aBaseString(path) +{ +} + +void UnoApiTest::setUp() +{ + test::BootstrapFixture::setUp(); + + mxDesktop = css::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) ); + CPPUNIT_ASSERT_MESSAGE("no desktop!", mxDesktop.is()); +} + +void UnoApiTest::createFileURL(const OUString& aFileBase, OUString& rFilePath) +{ + rFilePath = m_directories.getSrcRootURL() + m_aBaseString + "/" + aFileBase; +} + +void UnoApiTest::closeDocument( uno::Reference< lang::XComponent > const & xDocument ) +{ + uno::Reference< util::XCloseable > xCloseable(xDocument, UNO_QUERY_THROW); + xCloseable->close(false); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/util/searchdescriptor.cxx b/test/source/util/searchdescriptor.cxx new file mode 100644 index 000000000..d82994558 --- /dev/null +++ b/test/source/util/searchdescriptor.cxx @@ -0,0 +1,63 @@ +/* -*- 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/util/searchdescriptor.hxx> +#include <test/unoapi_property_testers.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +using namespace css; + +namespace apitest +{ +void SearchDescriptor::testSearchDescriptorProperties() +{ + uno::Reference<beans::XPropertySet> xPS(init(), uno::UNO_QUERY_THROW); + + OUString aPropName; + + aPropName = "SearchBackwards"; + testBooleanProperty(xPS, aPropName); + + aPropName = "SearchCaseSensitive"; + testBooleanProperty(xPS, aPropName); + + aPropName = "SearchWords"; + testBooleanProperty(xPS, aPropName); + + aPropName = "SearchRegularExpression"; + testBooleanProperty(xPS, aPropName); + + aPropName = "SearchStyles"; + testBooleanProperty(xPS, aPropName); + + aPropName = "SearchSimilarity"; + testBooleanProperty(xPS, aPropName); + + aPropName = "SearchSimilarityRelax"; + testBooleanProperty(xPS, aPropName); + + aPropName = "SearchSimilarityRemove"; + testShortProperty(xPS, aPropName); + + aPropName = "SearchSimilarityAdd"; + testShortProperty(xPS, aPropName); + + aPropName = "SearchSimilarityExchange"; + testShortProperty(xPS, aPropName); + + aPropName = "SearchWildcard"; + testBooleanOptionalProperty(xPS, aPropName); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/util/xindent.cxx b/test/source/util/xindent.cxx new file mode 100644 index 000000000..6b15407f9 --- /dev/null +++ b/test/source/util/xindent.cxx @@ -0,0 +1,54 @@ +/* -*- 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/util/xindent.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/util/XIndent.hpp> + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XIndent::testIncrementIndent() +{ + uno::Reference<util::XIndent> xIndent(init(), UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPropertySet(xIndent, UNO_QUERY_THROW); + uno::Any aAny = xPropertySet->getPropertyValue("ParaIndent"); + sal_Int32 nOldValue = aAny.get<sal_Int32>(); + + xIndent->incrementIndent(); + + uno::Any aAny2 = xPropertySet->getPropertyValue("ParaIndent"); + sal_Int32 nNewValue = aAny2.get<sal_Int32>(); + CPPUNIT_ASSERT_MESSAGE("Successfully able to Increment Indent", nOldValue < nNewValue); +} +void XIndent::testDecrementIndent() +{ + uno::Reference<util::XIndent> xIndent(init(), UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPropertySet(xIndent, UNO_QUERY_THROW); + xIndent->incrementIndent(); + uno::Any aAny = xPropertySet->getPropertyValue("ParaIndent"); + sal_Int32 nOldValue = aAny.get<sal_Int32>(); + + xIndent->decrementIndent(); + + uno::Any aAny2 = xPropertySet->getPropertyValue("ParaIndent"); + sal_Int32 nNewValue = aAny2.get<sal_Int32>(); + CPPUNIT_ASSERT_MESSAGE("Successfully able to Decrement Indent", nOldValue > nNewValue); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/util/xmergeable.cxx b/test/source/util/xmergeable.cxx new file mode 100644 index 000000000..211b2b67f --- /dev/null +++ b/test/source/util/xmergeable.cxx @@ -0,0 +1,33 @@ +/* -*- 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/util/xmergeable.hxx> + +#include <com/sun/star/util/XMergeable.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +void XMergeable::testGetIsMergedMerge() +{ + uno::Reference<util::XMergeable> xMergeable(init(), UNO_QUERY_THROW); + bool aIsMerged = xMergeable->getIsMerged(); + xMergeable->merge(!aIsMerged); + bool aIsMerged2 = xMergeable->getIsMerged(); + CPPUNIT_ASSERT_MESSAGE("Successfully able to Get is Merged and Merge", aIsMerged != aIsMerged2); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/util/xrefreshable.cxx b/test/source/util/xrefreshable.cxx new file mode 100644 index 000000000..f448d93e5 --- /dev/null +++ b/test/source/util/xrefreshable.cxx @@ -0,0 +1,64 @@ +/* -*- 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/util/xrefreshable.hxx> + +#include <com/sun/star/lang/EventObject.hpp> +#include <com/sun/star/util/XRefreshListener.hpp> +#include <com/sun/star/util/XRefreshable.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppuhelper/implbase.hxx> +#include <rtl/ref.hxx> + +#include <cppunit/TestAssert.h> + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace apitest +{ +namespace +{ +class MockedRefreshListener : public ::cppu::WeakImplHelper<util::XRefreshListener> +{ +public: + MockedRefreshListener() + : m_bListenerCalled(false) + { + } + + bool m_bListenerCalled; + virtual void SAL_CALL refreshed(const lang::EventObject& /* xEvent */) override + { + m_bListenerCalled = true; + } + virtual void SAL_CALL disposing(const lang::EventObject& /* xEventObj */) override {} +}; +} + +void XRefreshable::testRefreshListener() +{ + uno::Reference<util::XRefreshable> xRefreshable(init(), uno::UNO_QUERY_THROW); + + rtl::Reference<MockedRefreshListener> xListener = new MockedRefreshListener(); + xRefreshable->addRefreshListener(uno::Reference<util::XRefreshListener>(xListener.get())); + + xRefreshable->refresh(); + CPPUNIT_ASSERT(xListener->m_bListenerCalled); + + xListener->m_bListenerCalled = false; + xRefreshable->removeRefreshListener(uno::Reference<util::XRefreshListener>(xListener.get())); + xRefreshable->refresh(); + CPPUNIT_ASSERT(!xListener->m_bListenerCalled); +} + +} // namespace apitest +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/util/xreplaceable.cxx b/test/source/util/xreplaceable.cxx new file mode 100644 index 000000000..ac9d1a4dc --- /dev/null +++ b/test/source/util/xreplaceable.cxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/util/xreplaceable.hxx> + +#include <com/sun/star/util/XReplaceable.hpp> +#include <com/sun/star/util/XReplaceDescriptor.hpp> +#include <com/sun/star/util/XSearchDescriptor.hpp> +#include <cppunit/TestAssert.h> + +#include <iostream> + +#include <test/callgrind.hxx> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void XReplaceable::testCreateReplaceDescriptor() +{ + uno::Reference< util::XReplaceable > xReplaceable(init(), UNO_QUERY_THROW); + uno::Reference< util::XReplaceDescriptor> xReplaceDescr = xReplaceable->createReplaceDescriptor(); + CPPUNIT_ASSERT(xReplaceDescr.is()); +} + +void XReplaceable::testReplaceAll() +{ + std::cout << "testReplaceAll" << std::endl; + uno::Reference< util::XReplaceable > xReplaceable(init(), UNO_QUERY_THROW); + uno::Reference< util::XReplaceDescriptor> xReplaceDescr = xReplaceable->createReplaceDescriptor(); + CPPUNIT_ASSERT(xReplaceDescr.is()); + + uno::Reference< util::XSearchDescriptor > xSearchDescr = xReplaceable->createSearchDescriptor(); + xSearchDescr->setSearchString(maSearchString); + + //check that at least one object is there that will be replaced + uno::Reference< uno::XInterface > xElement = xReplaceable->findFirst(xSearchDescr); + CPPUNIT_ASSERT(xElement.is()); + + //check that there is none object with the replace string + xSearchDescr->setSearchString(maReplaceString); + xElement = xReplaceable->findFirst(xSearchDescr); + CPPUNIT_ASSERT(!xElement.is()); + + xReplaceDescr->setSearchString(maSearchString); + xReplaceDescr->setReplaceString(maReplaceString); + + callgrindStart(); + xReplaceable->replaceAll(uno::Reference< util::XSearchDescriptor >(xReplaceDescr, UNO_QUERY_THROW)); + callgrindDump("test:replace_all"); + + //check that now at least one element is found + xElement = xReplaceable->findFirst(xSearchDescr); + CPPUNIT_ASSERT(xElement.is()); + + xSearchDescr->setSearchString(maSearchString); + xElement = xReplaceable->findFirst(xSearchDescr); + CPPUNIT_ASSERT(!xElement.is()); + + //redo the whole thing + xReplaceDescr->setSearchString(maReplaceString); + xReplaceDescr->setReplaceString(maSearchString); + + xReplaceable->replaceAll(uno::Reference< util::XSearchDescriptor >(xReplaceDescr, UNO_QUERY_THROW)); + + //check that it works + xElement = xReplaceable->findFirst(xSearchDescr); + CPPUNIT_ASSERT(xElement.is()); + + //check that there is none object with the replace string + xSearchDescr->setSearchString(maReplaceString); + xElement = xReplaceable->findFirst(xSearchDescr); + CPPUNIT_ASSERT(!xElement.is()); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/util/xreplacedescriptor.cxx b/test/source/util/xreplacedescriptor.cxx new file mode 100644 index 000000000..b3b042a2d --- /dev/null +++ b/test/source/util/xreplacedescriptor.cxx @@ -0,0 +1,37 @@ +/* -*- 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/util/xreplacedescriptor.hxx> +#include <rtl/ustring.hxx> + +#include <com/sun/star/util/XReplaceDescriptor.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XReplaceDescriptor::testGetSetReplaceString() +{ + uno::Reference<util::XReplaceDescriptor> xRD(init(), uno::UNO_QUERY_THROW); + const OUString aReplaceStringOld = xRD->getReplaceString(); + CPPUNIT_ASSERT(aReplaceStringOld.isEmpty()); + + xRD->setReplaceString("_XReplaceDescriptor"); + const OUString aReplaceStringNew = xRD->getReplaceString(); + CPPUNIT_ASSERT_EQUAL(OUString("_XReplaceDescriptor"), aReplaceStringNew); + CPPUNIT_ASSERT(aReplaceStringOld != aReplaceStringNew); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/util/xsearchable.cxx b/test/source/util/xsearchable.cxx new file mode 100644 index 000000000..b636377d8 --- /dev/null +++ b/test/source/util/xsearchable.cxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 <com/sun/star/util/XSearchable.hpp> +#include <com/sun/star/util/XSearchDescriptor.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <cppunit/TestAssert.h> + +#include <test/util/xsearchable.hxx> + +using namespace css; +using namespace css::uno; + +namespace apitest { + +void XSearchable::testFindAll() +{ + uno::Reference< util::XSearchable > xSearchable(init(), UNO_QUERY_THROW); + uno::Reference< util::XSearchDescriptor> xSearchDescr = xSearchable->createSearchDescriptor(); + xSearchDescr->setSearchString(maSearchString); + + uno::Reference< container::XIndexAccess > xIndex = xSearchable->findAll(xSearchDescr); + CPPUNIT_ASSERT(xIndex.is()); + CPPUNIT_ASSERT_EQUAL(mnCount, xIndex->getCount()); +} + +void XSearchable::testFindFirst() +{ + uno::Reference< util::XSearchable > xSearchable(init(), UNO_QUERY_THROW); + uno::Reference< util::XSearchDescriptor> xSearchDescr = xSearchable->createSearchDescriptor(); + xSearchDescr->setSearchString(maSearchString); + + uno::Reference< uno::XInterface > xElement = xSearchable->findFirst(xSearchDescr); + CPPUNIT_ASSERT(xElement.is()); +} + +void XSearchable::testFindNext() +{ + uno::Reference< util::XSearchable > xSearchable(init(), UNO_QUERY_THROW); + uno::Reference< util::XSearchDescriptor> xSearchDescr = xSearchable->createSearchDescriptor(); + xSearchDescr->setSearchString(maSearchString); + + uno::Reference< uno::XInterface > xElement = xSearchable->findFirst(xSearchDescr); + CPPUNIT_ASSERT(xElement.is()); + + if (mnCount > 1) + { + uno::Reference< uno::XInterface > xElement2 = xSearchable->findNext(xElement, xSearchDescr); + CPPUNIT_ASSERT(xElement2.is()); + } +} + +XSearchable::~XSearchable() +{ +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/util/xsearchdescriptor.cxx b/test/source/util/xsearchdescriptor.cxx new file mode 100644 index 000000000..2740b2e26 --- /dev/null +++ b/test/source/util/xsearchdescriptor.cxx @@ -0,0 +1,36 @@ +/* -*- 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/util/xsearchdescriptor.hxx> + +#include <com/sun/star/util/XSearchDescriptor.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XSearchDescriptor::testGetSetSearchString() +{ + uno::Reference<util::XSearchDescriptor> xDS(init(), uno::UNO_QUERY_THROW); + const OUString aSearchStringOld = xDS->getSearchString(); + CPPUNIT_ASSERT(aSearchStringOld.isEmpty()); + + xDS->setSearchString("_XSearchDescriptor"); + const OUString aSearchStringNew = xDS->getSearchString(); + CPPUNIT_ASSERT_EQUAL(OUString("_XSearchDescriptor"), aSearchStringNew); + CPPUNIT_ASSERT(aSearchStringOld != aSearchStringNew); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/vclbootstrapprotector.cxx b/test/source/vclbootstrapprotector.cxx new file mode 100644 index 000000000..f6d1b9762 --- /dev/null +++ b/test/source/vclbootstrapprotector.cxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 <sal/config.h> + +#include <cppunit/Protector.h> +#include <sal/types.h> +#include <sal/log.hxx> +#include <vcl/svapp.hxx> +#include <comphelper/threadpool.hxx> +#include "setupvcl.hxx" + +namespace { + +class Protector: public CppUnit::Protector { +public: + Protector() { test::setUpVcl(); } + Protector(const Protector&) = delete; + Protector& operator=(const Protector&) = delete; + +private: + virtual ~Protector() override { +#if defined(__COVERITY__) + try { +#endif + DeInitVCL(); + // for the 6 tests that use it + comphelper::ThreadPool::getSharedOptimalPool().shutdown(); +#if defined(__COVERITY__) + } catch (const std::exception& e) { + SAL_WARN("vcl.app", "Fatal exception: " << e.what()); + std::terminate(); + } +#endif + } + + virtual bool protect( + CppUnit::Functor const & functor, CppUnit::ProtectorContext const &) + override + { return functor(); } +}; + +} + +extern "C" SAL_DLLPUBLIC_EXPORT CppUnit::Protector * +vclbootstrapprotector() { + return new Protector; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/view/xcontrolaccess.cxx b/test/source/view/xcontrolaccess.cxx new file mode 100644 index 000000000..1e7583f2b --- /dev/null +++ b/test/source/view/xcontrolaccess.cxx @@ -0,0 +1,56 @@ +/* -*- 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/view/xcontrolaccess.hxx> +#include <test/helper/form.hxx> + +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/awt/XControlModel.hpp> +#include <com/sun/star/drawing/XControlShape.hpp> +#include <com/sun/star/drawing/XDrawPage.hpp> +#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/view/XControlAccess.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XControlAccess::testGetControl() +{ + uno::Reference<view::XControlAccess> xCA(init(), uno::UNO_QUERY_THROW); + + uno::Reference<lang::XComponent> xComponent(getXComponent(), uno::UNO_QUERY_THROW); + uno::Reference<drawing::XDrawPagesSupplier> xDPS(xComponent, uno::UNO_QUERY_THROW); + uno::Reference<drawing::XDrawPage> xDP(xDPS->getDrawPages()->getByIndex(0), + uno::UNO_QUERY_THROW); + + uno::Reference<drawing::XShapes> xShapes(xDP, uno::UNO_QUERY_THROW); + uno::Reference<drawing::XShape> xShape( + helper::form::createControlShape(xComponent, "CommandButton", 10000, 50000, 100, 100), + uno::UNO_QUERY_THROW); + + xShapes->add(xShape); + + uno::Reference<drawing::XControlShape> xCS(xShape, uno::UNO_QUERY_THROW); + uno::Reference<awt::XControlModel> xCM(xCS->getControl(), uno::UNO_SET_THROW); + uno::Reference<awt::XControl> xControl(xCA->getControl(xCM), uno::UNO_SET_THROW); + + CPPUNIT_ASSERT(xControl.is()); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/view/xformlayeraccess.cxx b/test/source/view/xformlayeraccess.cxx new file mode 100644 index 000000000..68903fcc0 --- /dev/null +++ b/test/source/view/xformlayeraccess.cxx @@ -0,0 +1,56 @@ +/* -*- 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/view/xformlayeraccess.hxx> + +#include <com/sun/star/form/runtime/XFormController.hpp> +#include <com/sun/star/view/XFormLayerAccess.hpp> + +#include <com/sun/star/uno/Reference.hxx> + +#include <cppunit/TestAssert.h> + +using namespace css; + +namespace apitest +{ +void XFormLayerAccess::testGetFormController() +{ + uno::Reference<view::XFormLayerAccess> xFLA(init(), uno::UNO_QUERY_THROW); + + const bool bCurrentMode = xFLA->isFormDesignMode(); + + // deliberately don't use UNO_QUERY_THROW, so we can use + // uno::XInterface::is() in CPPUNIT_ASSERT() + xFLA->setFormDesignMode(false); + uno::Reference<form::runtime::XFormController> xFC = xFLA->getFormController(m_xForm); + CPPUNIT_ASSERT(xFC.is()); + + xFLA->setFormDesignMode(bCurrentMode); +} + +void XFormLayerAccess::testIsFormDesignMode() { testSetFormDesignMode(); } + +void XFormLayerAccess::testSetFormDesignMode() +{ + uno::Reference<view::XFormLayerAccess> xFLA(init(), uno::UNO_QUERY_THROW); + + const bool bCurrentMode = xFLA->isFormDesignMode(); + xFLA->setFormDesignMode(!bCurrentMode); + + const bool bNewMode = xFLA->isFormDesignMode(); + CPPUNIT_ASSERT_EQUAL(!bCurrentMode, bNewMode); + + xFLA->setFormDesignMode(bCurrentMode); + CPPUNIT_ASSERT_EQUAL(bCurrentMode, static_cast<bool>(xFLA->isFormDesignMode())); +} + +} // namespace apitest + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx new file mode 100644 index 000000000..27833af1e --- /dev/null +++ b/test/source/xmltesttools.cxx @@ -0,0 +1,281 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/xmltesttools.hxx> + +#include <memory> + +#include <vcl/mtfxmldump.hxx> +#include <sal/log.hxx> + +namespace { + +OUString convert(xmlChar const * string) { + OUString s; + CPPUNIT_ASSERT_MESSAGE( + "xmlChar string is not UTF-8", + rtl_convertStringToUString( + &s.pData, reinterpret_cast<char const *>(string), xmlStrlen(string), + RTL_TEXTENCODING_UTF8, + (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR + | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR + | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))); + return s; +} + +OString oconvert(xmlChar const * string) +{ + return reinterpret_cast<char const *>(string); +} + +} + +XmlTestTools::XmlTestTools() +{} + +XmlTestTools::~XmlTestTools() +{} + +xmlDocUniquePtr XmlTestTools::parseXml(utl::TempFile const & aTempFile) +{ + SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ); + return parseXmlStream(&aFileStream); +} + +xmlDocUniquePtr XmlTestTools::parseXmlStream(SvStream* pStream) +{ + std::size_t nSize = pStream->remainingSize(); + std::unique_ptr<sal_uInt8[]> pBuffer(new sal_uInt8[nSize + 1]); + pStream->ReadBytes(pBuffer.get(), nSize); + pBuffer[nSize] = 0; + auto pCharBuffer = reinterpret_cast<xmlChar*>(pBuffer.get()); + SAL_INFO("test", "XmlTestTools::parseXmlStream: pBuffer is '" << pCharBuffer << "'"); + return xmlDocUniquePtr(xmlParseDoc(pCharBuffer)); +} + +xmlDocUniquePtr XmlTestTools::dumpAndParse(MetafileXmlDump& rDumper, const GDIMetaFile& rGDIMetaFile) +{ + SvMemoryStream aStream; + rDumper.dump(rGDIMetaFile, aStream); + aStream.Seek(STREAM_SEEK_TO_BEGIN); + return XmlTestTools::parseXmlStream(&aStream); +} + +xmlXPathObjectPtr XmlTestTools::getXPathNode(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath) +{ + xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc.get()); + registerNamespaces(pXmlXpathCtx); + xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST(rXPath.getStr()), pXmlXpathCtx); + xmlXPathFreeContext(pXmlXpathCtx); + return pXmlXpathObj; +} + +void XmlTestTools::registerNamespaces(xmlXPathContextPtr& /*pXmlXpathCtx*/) +{ +} + +OUString XmlTestTools::getXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OString& rAttribute) +{ + CPPUNIT_ASSERT(pXmlDoc); + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath); + xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; + CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OStringLiteral("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' number of nodes is incorrect").getStr(), + 1, xmlXPathNodeSetGetLength(pXmlNodes)); + if (rAttribute.isEmpty()) + { + xmlXPathFreeObject(pXmlObj); + return OUString(); + } + xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; + xmlChar * prop = xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr())); + OString sAttAbsent = OStringLiteral("In <") + pXmlDoc->name + ">, XPath '" + rXPath + + "' no attribute '" + rAttribute + "' exist"; + CPPUNIT_ASSERT_MESSAGE(sAttAbsent.getStr(), prop); + OUString s(convert(prop)); + xmlFree(prop); + xmlXPathFreeObject(pXmlObj); + return s; +} + +OUString XmlTestTools::getXPathContent(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath) +{ + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath); + switch (pXmlObj->type) + { + case XPATH_UNDEFINED: + CPPUNIT_FAIL("Undefined XPath type"); + case XPATH_NODESET: + { + xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; + + CPPUNIT_ASSERT_MESSAGE( + OString(OStringLiteral("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' not found") + .getStr(), + xmlXPathNodeSetGetLength(pXmlNodes) > 0); + + xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; + xmlNodePtr pXmlChild = pXmlNode->children; + OUString s; + while (pXmlChild && pXmlChild->type != XML_TEXT_NODE) + pXmlChild = pXmlChild->next; + if (pXmlChild && pXmlChild->type == XML_TEXT_NODE) + s = convert(pXmlChild->content); + xmlXPathFreeObject(pXmlObj); + return s; + } + case XPATH_BOOLEAN: + { + auto boolVal = pXmlObj->boolval; + xmlXPathFreeObject(pXmlObj); + return boolVal ? OUString("true") : OUString("false"); + } + case XPATH_NUMBER: + { + auto floatVal = pXmlObj->floatval; + xmlXPathFreeObject(pXmlObj); + return OUString::number(floatVal); + } + case XPATH_STRING: + { + auto convertedVal = convert(pXmlObj->stringval); + xmlXPathFreeObject(pXmlObj); + return convertedVal; + } + case XPATH_POINT: + case XPATH_RANGE: + case XPATH_LOCATIONSET: + case XPATH_USERS: + case XPATH_XSLT_TREE: + xmlXPathFreeObject(pXmlObj); + CPPUNIT_FAIL("Unsupported XPath type"); + } + + CPPUNIT_FAIL("Invalid XPath type"); +} + +void XmlTestTools::assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath) +{ + getXPath(pXmlDoc, rXPath, ""); // it asserts that rXPath exists, and returns exactly one node +} + +void XmlTestTools::assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OString& rAttribute, const OUString& rExpectedValue) +{ + OUString aValue = getXPath(pXmlDoc, rXPath, rAttribute); + CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OStringLiteral("In <") + pXmlDoc->name + ">, attribute '" + rAttribute + "' of '" + rXPath + "' incorrect value.").getStr(), + rExpectedValue, aValue); +} + +void XmlTestTools::assertXPathAttrs(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, + const std::vector<std::pair<OString, OUString>>& aPairVector) +{ + for (auto& rPair : aPairVector) + { + assertXPath(pXmlDoc, rXPath, rPair.first, rPair.second); + } +} + +void XmlTestTools::assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, int nNumberOfNodes) +{ + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath); + xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; + CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OStringLiteral("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' number of nodes is incorrect").getStr(), + nNumberOfNodes, xmlXPathNodeSetGetLength(pXmlNodes)); + xmlXPathFreeObject(pXmlObj); +} + +void XmlTestTools::assertXPathContent(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OUString& rContent) +{ + CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OStringLiteral("In <") + pXmlDoc->name + ">, XPath contents of child does not match").getStr(), rContent, getXPathContent(pXmlDoc, rXPath)); +} + +void XmlTestTools::assertXPathNSDef(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, + const OUString& rNSPrefix, const OUString& rNSHref) +{ + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath); + xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; + CPPUNIT_ASSERT_MESSAGE( + OString(OStringLiteral("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' not found").getStr(), + xmlXPathNodeSetGetLength(pXmlNodes) > 0); + + xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; + bool bFound = false; + for (xmlNsPtr pNamespace = pXmlNode->nsDef; pNamespace; pNamespace = pNamespace->next) + { + if (!pNamespace->prefix) + continue; + + CPPUNIT_ASSERT(pNamespace->href); + if (rNSPrefix == convert(pNamespace->prefix) && rNSHref == convert(pNamespace->href)) + { + bFound = true; + break; + } + } + xmlXPathFreeObject(pXmlObj); + CPPUNIT_ASSERT(bFound); +} + +void XmlTestTools::assertXPathChildren(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, int nNumberOfChildNodes) +{ +#if LIBXML_VERSION >= 20703 /* xmlChildElementCount is only available in libxml2 >= 2.7.3 */ + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath); + xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; + CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OStringLiteral("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' number of nodes is incorrect").getStr(), + 1, xmlXPathNodeSetGetLength(pXmlNodes)); + xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; + CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OStringLiteral("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' number of child-nodes is incorrect").getStr(), + nNumberOfChildNodes, static_cast<int>(xmlChildElementCount(pXmlNode))); + xmlXPathFreeObject(pXmlObj); +#else + (void)pXmlDoc; + (void)rXPath; + (void)nNumberOfChildNodes; +#endif +} + +void XmlTestTools::assertXPathNoAttribute(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OString& rAttribute) +{ + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath); + xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; + CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OStringLiteral("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' number of nodes is incorrect").getStr(), + 1, xmlXPathNodeSetGetLength(pXmlNodes)); + xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; + CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OStringLiteral("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' unexpected '" + rAttribute + "' attribute").getStr(), + static_cast<xmlChar*>(nullptr), xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr()))); + xmlXPathFreeObject(pXmlObj); +} + +int XmlTestTools::getXPathPosition(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OString& rChildName) +{ + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath); + xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; + CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OStringLiteral("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' number of nodes is incorrect").getStr(), + 1, + xmlXPathNodeSetGetLength(pXmlNodes)); + xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; + int nRet = 0; + bool bFound = false; + for (xmlNodePtr pChild = pXmlNode->children; pChild; pChild = pChild->next) + { + if (oconvert(pChild->name) == rChildName) + { + bFound = true; + break; + } + ++nRet; + } + xmlXPathFreeObject(pXmlObj); + CPPUNIT_ASSERT_MESSAGE(OString(OStringLiteral("In <") + pXmlDoc->name + ">, XPath '" + rXPath + + "' child '" + rChildName + "' not found") + .getStr(), + bFound); + return nRet; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/user-template/empty-directory-dummy b/test/user-template/empty-directory-dummy new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/test/user-template/empty-directory-dummy diff --git a/test/user-template/registry/modifications.xcd b/test/user-template/registry/modifications.xcd new file mode 100644 index 000000000..1aea26ec2 --- /dev/null +++ b/test/user-template/registry/modifications.xcd @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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/. + * +--> +<oor:data xmlns:oor="http://openoffice.org/2001/registry"> + <oor:component-data oor:name="Common" oor:package="org.openoffice.Office"> + <node oor:name="Misc"> + <prop oor:name="UseDocumentSystemFileLocking"> + <value>false</value> + </prop> + <prop oor:name="UseDocumentOOoLockFile"> + <value>false</value> + </prop> + <prop oor:name="UseLocking"> + <value>false</value> + </prop> + <prop oor:name="ShowTipOfTheDay"> + <value>false</value> + </prop> + <prop oor:name="LastTipOfTheDayShown"> + <value>"32767"</value> <!-- some arbitrary high value (sal_Int32) --> + </prop> + </node> + <node oor:name="Filter"> + <node oor:name="Graphic"> + <node oor:name="Export"> + <node oor:name="SVG"> + <prop oor:name="EmbedFonts"> + <value>false</value> + </prop> + </node> + </node> + </node> + </node> + </oor:component-data> + <oor:component-data oor:name="Paths" oor:package="org.openoffice.Office"> + <node oor:name="Paths"> + <node oor:name="UIConfig" oor:op="replace"> + <node oor:name="InternalPaths"> + <node oor:name="$(userurl)/config" oor:op="fuse"/> + </node> + </node> + </node> + </oor:component-data> + <oor:component-data oor:name="Setup" oor:package="org.openoffice"> + <node oor:name="L10N"> + <prop oor:name="ooLocale"> + <value>en-US</value> + </prop> + <prop oor:name="ooSetupSystemLocale"> + <value>en-US</value> + </prop> + </node> + </oor:component-data> +</oor:data> diff --git a/test/user-template/user/autocorr/acor_fr.dat b/test/user-template/user/autocorr/acor_fr.dat Binary files differnew file mode 100644 index 000000000..d4ef5567f --- /dev/null +++ b/test/user-template/user/autocorr/acor_fr.dat diff --git a/test/user-template/user/autotext/en-US/crdbus50.bau b/test/user-template/user/autotext/en-US/crdbus50.bau Binary files differnew file mode 100644 index 000000000..3c140c744 --- /dev/null +++ b/test/user-template/user/autotext/en-US/crdbus50.bau diff --git a/test/user-template/user/autotext/en-US/standard.bau b/test/user-template/user/autotext/en-US/standard.bau Binary files differnew file mode 100644 index 000000000..40cec77a7 --- /dev/null +++ b/test/user-template/user/autotext/en-US/standard.bau diff --git a/test/user-template/user/autotext/en-US/template.bau b/test/user-template/user/autotext/en-US/template.bau Binary files differnew file mode 100644 index 000000000..33bb534e2 --- /dev/null +++ b/test/user-template/user/autotext/en-US/template.bau diff --git a/test/user-template/user/config/javasettingsunopkginstall.xml b/test/user-template/user/config/javasettingsunopkginstall.xml new file mode 100644 index 000000000..3efc8e87f --- /dev/null +++ b/test/user-template/user/config/javasettingsunopkginstall.xml @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="UTF-8"?> +<java xmlns="http://openoffice.org/2004/java/framework/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +</java> diff --git a/test/user-template/user/config/psetup.xpm b/test/user-template/user/config/psetup.xpm new file mode 100644 index 000000000..f51297579 --- /dev/null +++ b/test/user-template/user/config/psetup.xpm @@ -0,0 +1,31 @@ +/* XPM */ +static char * L3PSetup_t_pm[] = { +/* width height ncolors cpp [x_hot y_hot] */ +"16 16 9 1 0 0", +/* colors */ +" s none m none c none", +". c #861782078617", +"X s iconColor1 m black c black", +"o c #000000008617", +"O s iconColor2 m white c white", +"+ c #C71BC30BC71B", +"@ s iconColor6 m white c yellow", +"# c #00000000FFFF", +"$ c #861700000000", +/* pixels */ +" ", +" .. XXXXX o", +" ..OO+XO.OO@Xo", +" ..OOOOX@.@.OOOo", +"XXOOOOXOXO.O.@Oo", +" XOOX@XOX@.OXXo", +" XOOXOO+XXX o", +" XX+XOO..+++O+. ", +"X.++X..+++##++O.", +"X...++++$$++OOO.", +"X.....++++OO++O.", +"X.......OO++++..", +"XX......+++++.X.", +" XX....+++.XX ", +" XX..+.XX ", +" XXXX "}; diff --git a/test/user-template/user/config/psetupl.xpm b/test/user-template/user/config/psetupl.xpm new file mode 100644 index 000000000..f9cca89f1 --- /dev/null +++ b/test/user-template/user/config/psetupl.xpm @@ -0,0 +1,49 @@ +/* XPM */ +static char * L3PSetup_m_pm[] = { +/* width height ncolors cpp [x_hot y_hot] */ +"32 32 11 1 0 0", +/* colors */ +" s none m none c none", +". s iconColor1 m black c black", +"X c #000000008617", +"o c #861782078617", +"O s iconColor2 m white c white", +"+ c #C71BC30BC71B", +"@ s iconColor6 m white c yellow", +"# c #00000000FFFF", +"$ c #861782070000", +"% c #000082078617", +"& c #861700000000", +/* pixels */ +" ", +" ........ XXXX", +" .o..oo.OOOOOOO+..X+OX", +" .+ooOO.@OO@OOOO@OOXOOX", +" .+oo+O.OO.OOOOOOOOOXXXX", +" .+oo+O.O@.OOO@OOOO@OXXXX", +" .+oo+O.@O.O@O.OO@OOOOXXXX", +" .+oo+O.OO.+.O.OOOOOOOOXXXX", +" .+oo+O.O@.+O+.O@O.OOO..X.X.", +" .+oo+O+...+O++o.O.OO@. .X. ", +" .+oo+O+O+O+O++++o.@O..o ... ", +" .ooo+O+O+O+O++++ooo.. ", +" .ooo+O+O+O+O++++o..+Oo ", +" .oo+O+O+O+O++++o....OO. ", +" ..+O+O+O+O++++o......OO. ", +" .o+OO+O+O++#+o....$o..OO. ", +" .oo+OO+O++%+o....$$$...Oo. ", +" .ooo+OO++&+o...$$$+$+...o. ", +" .oooo+O+++o...$$$+$+++..o. ", +" .oooooOO+o.o.$$++$+OoOO..o ", +" .ooooo+Oo..O.$++$OOoOO$O.o ", +"o.ooooooO.o.OO.+$OOoOOoOOO. ", +"oo.ooooo.O.O.OO.OOoOO$OOoOO. ", +" oo.oooo+O.OO.OO.OOOoOOoOO.o ", +" oo.ooo+O.oOo.Oo.O$OO$OO.o ", +" oo.oo+O.o+o.+o.OOOoOO.o ", +" oo.o+O.o+o.+o.OOoOO.o ", +" oo.+..o+o.+o..OOO.o ", +" oo.oo.+..+o.o.O.o ", +" ooooo.o.o.ooo.o ", +" oooo.o oo ", +" oo "}; diff --git a/test/user-template/user/config/soffice.cfg/modules/scalc/popupmenu/anchor.xml b/test/user-template/user/config/soffice.cfg/modules/scalc/popupmenu/anchor.xml new file mode 100644 index 000000000..c269bef3a --- /dev/null +++ b/test/user-template/user/config/soffice.cfg/modules/scalc/popupmenu/anchor.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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/. + * +--> +<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu"> + <menu:menuitem menu:id=".uno:SetAnchorToPage" menu:style="radio"/> + <menu:menuitem menu:id=".uno:SetAnchorToCell" menu:style="radio"/> +</menu:menupopup> diff --git a/test/user-template/user/config/soffice.cfg/modules/scalc/popupmenu/draw.xml b/test/user-template/user/config/soffice.cfg/modules/scalc/popupmenu/draw.xml new file mode 100644 index 000000000..daeb44d65 --- /dev/null +++ b/test/user-template/user/config/soffice.cfg/modules/scalc/popupmenu/draw.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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/. + * +--> +<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu"> + <menu:menuitem menu:id=".uno:Cut"/> + <menu:menuitem menu:id=".uno:Copy"/> + <menu:menuitem menu:id=".uno:Paste"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:FormatLine"/> + <menu:menuitem menu:id=".uno:FormatArea"/> + <menu:menuitem menu:id=".uno:TextAttributes"/> + <menu:menuitem menu:id=".uno:TransformDialog"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:ObjectTitleDescription"/> + <menu:menuitem menu:id=".uno:RenameObject"/> + <menu:menuseparator/> + <menu:menu menu:id=".uno:FlipMenu"> + <menu:menupopup> + <menu:menuitem menu:id=".uno:ObjectMirrorVertical"/> + <menu:menuitem menu:id=".uno:ObjectMirrorHorizontal"/> + </menu:menupopup> + </menu:menu> + <menu:menu menu:id=".uno:ArrangeMenu"> + <menu:menupopup> + <menu:menuitem menu:id=".uno:BringToFront"/> + <menu:menuitem menu:id=".uno:ObjectForwardOne"/> + <menu:menuitem menu:id=".uno:ObjectBackOne"/> + <menu:menuitem menu:id=".uno:SendToBack"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:SetObjectToForeground"/> + <menu:menuitem menu:id=".uno:SetObjectToBackground"/> + </menu:menupopup> + </menu:menu> + <menu:menu menu:id=".uno:ObjectAlign"> + <menu:menupopup> + <menu:menuitem menu:id=".uno:ObjectAlignLeft"/> + <menu:menuitem menu:id=".uno:AlignCenter"/> + <menu:menuitem menu:id=".uno:ObjectAlignRight"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:AlignUp"/> + <menu:menuitem menu:id=".uno:AlignMiddle"/> + <menu:menuitem menu:id=".uno:AlignDown"/> + </menu:menupopup> + </menu:menu> + <menu:menuitem menu:id=".uno:AnchorMenu"/> + <menu:menuitem menu:id=".uno:AssignMacro"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:ToggleObjectBezierMode"/> + <menu:menuitem menu:id=".uno:FontWork"/> + <menu:menuseparator/> + <menu:menu menu:id=".uno:GroupMenu"> + <menu:menupopup> + <menu:menuitem menu:id=".uno:FormatGroup"/> + <menu:menuitem menu:id=".uno:FormatUngroup"/> + <menu:menuitem menu:id=".uno:EnterGroup"/> + <menu:menuitem menu:id=".uno:LeaveGroup"/> + </menu:menupopup> + </menu:menu> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:EditShapeHyperlink"/> + <menu:menuitem menu:id=".uno:DeleteShapeHyperlink"/> + <menu:menuitem menu:id=".uno:OpenHyperlinkOnCursor"/> +</menu:menupopup> diff --git a/test/user-template/user/config/soffice.cfg/modules/simpress/popupmenu/page.xml b/test/user-template/user/config/soffice.cfg/modules/simpress/popupmenu/page.xml new file mode 100644 index 000000000..02ff49793 --- /dev/null +++ b/test/user-template/user/config/soffice.cfg/modules/simpress/popupmenu/page.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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/. + * +--> +<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu"> + <menu:menuitem menu:id=".uno:Cut"/> + <menu:menuitem menu:id=".uno:Copy"/> + <menu:menuitem menu:id=".uno:Paste"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:SlideSetup"/> + <menu:menuitem menu:id=".uno:SelectBackground"/> + <menu:menuitem menu:id=".uno:SaveBackground"/> + <menu:menu menu:id=".uno:SlideFeaturesMenu"> + <menu:menupopup> + <menu:menuitem menu:id=".uno:HideSlide"/> + <menu:menuitem menu:id=".uno:ShowSlide"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:DisplayMasterBackground"/> + <menu:menuitem menu:id=".uno:DisplayMasterObjects"/> + <menu:menuitem menu:id=".uno:MasterLayouts"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:PresentationLayout"/> + </menu:menupopup> + </menu:menu> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:ShowRuler"/> + <menu:menu menu:id=".uno:GridMenu"> + <menu:menupopup> + <menu:menuitem menu:id=".uno:GridVisible"/> + <menu:menuitem menu:id=".uno:GridUse"/> + <menu:menuitem menu:id=".uno:GridFront"/> + </menu:menupopup> + </menu:menu> + <menu:menu menu:id=".uno:SnapLinesMenu"> + <menu:menupopup> + <menu:menuitem menu:id=".uno:HelplinesVisible"/> + <menu:menuitem menu:id=".uno:HelplinesUse"/> + <menu:menuitem menu:id=".uno:HelplinesFront"/> + </menu:menupopup> + </menu:menu> + <menu:menuitem menu:id=".uno:CapturePoint"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:LeaveGroup"/> +</menu:menupopup> diff --git a/test/user-template/user/config/soffice.cfg/modules/swriter/popupmenu/text.xml b/test/user-template/user/config/soffice.cfg/modules/swriter/popupmenu/text.xml new file mode 100644 index 000000000..a6a60215a --- /dev/null +++ b/test/user-template/user/config/soffice.cfg/modules/swriter/popupmenu/text.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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/. + * +--> +<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu"> + <menu:menuitem menu:id=".uno:Cut"/> + <menu:menuitem menu:id=".uno:Copy"/> + <menu:menuitem menu:id=".uno:Paste"/> + <menu:menu menu:id=".uno:PasteSpecialMenu"> + <menu:menupopup> + <menu:menuitem menu:id=".uno:PasteUnformatted"/> + <menu:menuitem menu:id=".uno:PasteSpecial"/> + </menu:menupopup> + </menu:menu> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:NumberingStart"/> + <menu:menuitem menu:id=".uno:ContinueNumbering"/> + <menu:menuitem menu:id=".uno:IncrementLevel"/> + <menu:menuitem menu:id=".uno:DecrementLevel"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:FontDialog"/> + <menu:menuitem menu:id=".uno:ParagraphDialog"/> + <menu:menuitem menu:id=".uno:OutlineBullet"/> + <menu:menuitem menu:id=".uno:PageDialog"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:UpdateCurIndex"/> + <menu:menuitem menu:id=".uno:EditCurIndex"/> + <menu:menuitem menu:id=".uno:RemoveTableOf"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:FieldDialog"/> + <menu:menuitem menu:id=".uno:EditFootnote"/> + <menu:menuitem menu:id=".uno:IndexEntryDialog"/> + <menu:menuitem menu:id=".uno:AuthoritiesEntryDialog"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:AcceptTrackedChange"/> + <menu:menuitem menu:id=".uno:RejectTrackedChange"/> + <menu:menuitem menu:id=".uno:NextTrackedChange"/> + <menu:menuitem menu:id=".uno:PreviousTrackedChange"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:EditStyle"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:OpenHyperlinkOnCursor"/> + <menu:menuitem menu:id=".uno:EditHyperlink"/> + <menu:menuitem menu:id=".uno:CopyHyperlinkLocation"/> + <menu:menuitem menu:id=".uno:RemoveHyperlink"/> + <menu:menuitem menu:id=".uno:OpenSmartTagMenuOnCursor"/> + <menu:menuitem menu:id=".uno:ThesaurusFromContext"/> +</menu:menupopup> diff --git a/test/user-template/user/config/soffice.cfg/simpress/effects.xml b/test/user-template/user/config/soffice.cfg/simpress/effects.xml new file mode 100644 index 000000000..be341ef5e --- /dev/null +++ b/test/user-template/user/config/soffice.cfg/simpress/effects.xml @@ -0,0 +1,2630 @@ +<?xml version="1.0"?> +<anim:seq xmlns:office="urn:oasis:names:tc:openoffice:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:openoffice:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:openoffice:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:openoffice:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:openoffice:xmlns:drawing:1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:openoffice:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:openoffice:xmlns:datastyle:1.0" xmlns:pres="urn:oasis:names:tc:openoffice:xmlns:presentation:1.0" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="urn:oasis:names:tc:openoffice:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:openoffice:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:openoffice:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:openoffice:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:smil="http://www.w3.org/2001/SMIL20" xmlns:anim="urn:oasis:names:tc:openoffice:xmlns:animation:1.0" pres:node-type="main-sequence"> + + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-appear"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-venetian-blinds" pres:preset-sub-type="vertical"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="blindsWipe" smil:subtype="horizontal"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-venetian-blinds" pres:preset-sub-type="horizontal"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="blindsWipe" smil:subtype="vertical"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-box" pres:preset-sub-type="in"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="irisWipe" smil:subtype="rectangle" smil:direction="reverse"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-box" pres:preset-sub-type="out"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="irisWipe" smil:subtype="rectangle"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-checkerboard" pres:preset-sub-type="across"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="checkerBoardWipe" smil:subtype="across"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-checkerboard" pres:preset-sub-type="downward"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="checkerBoardWipe" smil:subtype="down"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-circle" pres:preset-sub-type="in"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="2" smil:type="ellipseWipe" smil:subtype="horizontal" smil:direction="reverse"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-circle" pres:preset-sub-type="out"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="2" smil:type="ellipseWipe" smil:subtype="horizontal"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in-slow" pres:preset-sub-type="from-bottom"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="y" smil:values="1+height/2;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in-slow" pres:preset-sub-type="from-left"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="x" smil:values="0-width/2;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in-slow" pres:preset-sub-type="from-right"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="x" smil:values="1+width/2;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in-slow" pres:preset-sub-type="from-top"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="y" smil:values="0-height/2;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-diamond" pres:preset-sub-type="in"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="2" smil:type="irisWipe" smil:subtype="diamond" smil:direction="reverse"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-diamond" pres:preset-sub-type="out"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="2" smil:type="irisWipe" smil:subtype="diamond"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-dissolve-in"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="dissolve"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-flash-once"> + <anim:set smil:begin="0" smil:dur="1" smil:attributeName="visibility" smil:to="visible"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in" pres:preset-sub-type="from-bottom"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="1+height/2;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in" pres:preset-sub-type="from-left"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="0-width/2;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in" pres:preset-sub-type="from-right"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="1+width/2;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in" pres:preset-sub-type="from-top"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="0-height/2;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in" pres:preset-sub-type="from-bottom-left"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="0-width/2;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="1+height/2;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in" pres:preset-sub-type="from-bottom-right"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="1+width/2;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="1+height/2;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in" pres:preset-sub-type="from-top-left"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="0-width/2;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="0-height/2;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fly-in" pres:preset-sub-type="from-top-right"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="1+width/2;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="0-height/2;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-peek-in" pres:preset-sub-type="from-bottom"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="slideWipe" smil:subtype="fromBottom"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-peek-in" pres:preset-sub-type="from-left"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="slideWipe" smil:subtype="fromLeft"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-peek-in" pres:preset-sub-type="from-right"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="slideWipe" smil:subtype="fromRight"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-peek-in" pres:preset-sub-type="from-top"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="slideWipe" smil:subtype="fromTop"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-plus" pres:preset-sub-type="in"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="2" smil:type="fourBoxWipe" smil:subtype="cornersIn"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-plus" pres:preset-sub-type="out"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="2" smil:type="fourBoxWipe" smil:subtype="cornersIn" smil:direction="reverse"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-random-bars" pres:preset-sub-type="vertical"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="randomBarWipe" smil:subtype="horizontal"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-random-bars" pres:preset-sub-type="horizontal"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="randomBarWipe" smil:subtype="vertical"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-random"/> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-split" pres:preset-sub-type="horizontal-in"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="barnDoorWipe" smil:subtype="horizontal" smil:direction="reverse"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-split" pres:preset-sub-type="horizontal-out"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="barnDoorWipe" smil:subtype="horizontal"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-split" pres:preset-sub-type="vertical-in"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="barnDoorWipe" smil:subtype="vertical" smil:direction="reverse"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-split" pres:preset-sub-type="vertical-out"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="barnDoorWipe" smil:subtype="vertical"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-diagonal-squares" pres:preset-sub-type="left-to-bottom"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="waterfallWipe" smil:subtype="horizontalRight"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-diagonal-squares" pres:preset-sub-type="left-to-top"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="waterfallWipe" smil:subtype="horizontalLeft" smil:direction="reverse"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-diagonal-squares" pres:preset-sub-type="right-to-bottom"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="waterfallWipe" smil:subtype="horizontalLeft"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-diagonal-squares" pres:preset-sub-type="right-to-top"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="waterfallWipe" smil:subtype="horizontalRight" smil:direction="reverse"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wedge"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="2" smil:type="fanWipe" smil:subtype="centerTop"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-clock-wipe" pres:preset-sub-type="clockwise"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="2" smil:type="clockWipe" smil:subtype="clockwiseTwelve"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-clock-wipe" pres:preset-sub-type="counter-clockwise"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="2" smil:type="clockWipe" smil:subtype="clockwiseTwelve" smil:direction="reverse"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wheel" pres:preset-sub-type="1"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="oneBlade"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wheel" pres:preset-sub-type="2"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="twoBladeVertical"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wheel" pres:preset-sub-type="3"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="threeBlade"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wheel" pres:preset-sub-type="4"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="fourBlade"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wheel" pres:preset-sub-type="8"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="eightBlade"/> + </anim:par> + </anim:par> + </anim:par> + +<!-- ooo-entrance-snake-wipe --> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-snake-wipe" pres:preset-sub-type="from-top-left-horizontal"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="snakeWipe" smil:subtype="topLeftHorizontal"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-snake-wipe" pres:preset-sub-type="from-top-left-vertical"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="snakeWipe" smil:subtype="topLeftVertical"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-snake-wipe" pres:preset-sub-type="from-bottom-right-vertical"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="snakeWipe" smil:subtype="topLeftVertical" smil:direction="reverse"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-snake-wipe" pres:preset-sub-type="from-bottom-right-horizontal"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="snakeWipe" smil:subtype="topLeftHorizontal" smil:direction="reverse"/> + </anim:par> + </anim:par> + </anim:par> + +<!-- ooo-entrance-spiral-wipe --> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-spiral-wipe" pres:preset-sub-type="from-top-left-clockwise"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="spiralWipe" smil:subtype="topLeftClockwise"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-spiral-wipe" pres:preset-sub-type="from-top-right-counter-clockwise"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="spiralWipe" smil:subtype="topRightCounterClockwise"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-spiral-wipe" pres:preset-sub-type="from-center-clockwise"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="spiralWipe" smil:subtype="topLeftClockwise" smil:direction="reverse"/>/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-spiral-wipe" pres:preset-sub-type="from-center-counter-clockwise"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="spiralWipe" smil:subtype="topRightCounterClockwise" smil:direction="reverse"/>/> + </anim:par> + </anim:par> + </anim:par> + +<!-- ooo-entrance-wipe --> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wipe" pres:preset-sub-type="from-bottom"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="barWipe" smil:subtype="topToBottom" smil:direction="reverse"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wipe" pres:preset-sub-type="from-left"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="barWipe" smil:subtype="leftToRight"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wipe" pres:preset-sub-type="from-right"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="barWipe" smil:subtype="leftToRight" smil:direction="reverse"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-wipe" pres:preset-sub-type="from-top"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.5" smil:type="barWipe" smil:subtype="topToBottom"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-expand"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="width" smil:values="width*0.70;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fade-in"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="2" smil:type="fade" smil:subtype="crossfade"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fade-in-and-swivel" anim:iterate-type="by-letter" anim:iterate-interval="0.2s"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="2" smil:type="fade" smil:subtype="crossfade"/> + <anim:animate smil:dur="2" smil:fill="hold" smil:attributeName="width" smil:values="0;1" smil:keyTimes="0;1" anim:formula="width*sin(2.5*pi*$)"/> + <anim:animate smil:dur="2" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fade-in-and-zoom"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="0.5" smil:type="fade" smil:subtype="crossfade"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-ascend"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="y" smil:values="y+.1;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-center-revolve"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.1" smil:type="fade" smil:subtype="crossfade"/> + <anim:animate smil:dur="0.4" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.4" smil:fill="hold" smil:attributeName="y" smil:values="y+0.31;y+0.31" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.4" smil:dur="0.6" smil:fill="hold" smil:decelerate="0.5" smil:attributeName="x" smil:values="x;x+0.0242;x+0.0479;x+0.0704;x+0.0911;x+0.1096;x+0.1254;x+0.1381;x+0.1474;x+0.1531;x+0.1550;x+0.1531;x+0.1474;x+0.1381;x+0.1254;x+0.1096;x+0.0911;x+0.0704;x+0.0479;x+0.0242;x" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"/> + <anim:animate smil:begin="0.4" smil:dur="0.6" smil:fill="hold" smil:decelerate="0.5" smil:attributeName="y" smil:values="y+0.31;y+0.308;y+0.3024;y+0.2931;y+0.2804;y+0.2646;y+0.2461;y+0.2253;y+0.2029;y+0.1792;y+0.155;y+0.1307;y+0.1071;y+0.0846;y+0.0639;y+0.0454;y+0.0296;y+0.0169;y+0.0076;y+0.0019;y" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:preset-property="Color1;Color2" pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-colored-lettering" anim:iterate-type="by-letter" anim:iterate-interval="0.04s"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.08" smil:attributeName="color" smil:values="#333399;#009999" smil:keyTimes="0;0.5" smil:calcMode="discrete"/> + <anim:animate smil:dur="0.08" smil:attributeName="fill-color" smil:values="#333399;#009999" smil:keyTimes="0;0.5" smil:calcMode="discrete"/> + <anim:set smil:dur="0.08" smil:attributeName="fill" smil:to="solid"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:decelerate="1" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-compress"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="width" smil:values="width+.3;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-descend"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="y" smil:values="y-.1;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-ease-in"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="x" smil:values="x-.2;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="1" smil:type="barWipe" smil:subtype="leftToRight" smil:direction="reverse"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-turn-and-grow" anim:iterate-type="by-letter" anim:iterate-interval="0.05s"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="rotate" smil:values="90;0" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-rise-up"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.9" smil:fill="hold" smil:decelerate="1" smil:attributeName="y" smil:values="y+1;y-.03" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.9" smil:dur="0.1" smil:fill="hold" smil:accelerate="1" smil:attributeName="y" smil:values="y-.03;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:decelerate="1" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-spin-in"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="rotate" smil:values="360;0" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="0.5" smil:type="fade" smil:subtype="crossfade"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="across"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="downward"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="width;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="from-bottom"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y+height/2;y" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="width;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="from-left"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x-width/2;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="from-right"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x+width/2;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="from-top"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y-height/2;y" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="width;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="from-top-right"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x+width/2;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y-height/2;y" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="from-bottom-right"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x+width/2;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y+height/2;y" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="from-top-left"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x-width/2;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y-height/2;y" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-stretchy" pres:preset-sub-type="from-bottom-left"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x-width/2;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y+height/2;y" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-unfold" anim:iterate-type="by-letter" anim:iterate-interval="0.1s"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="x" smil:values="x-.1;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-zoom" pres:preset-sub-type="in"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-zoom" pres:preset-sub-type="in-from-screen-center"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="0.5;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="0.5;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-zoom" pres:preset-sub-type="in-slightly"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="2/3*width;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="2/3*height;height" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-zoom" pres:preset-sub-type="out"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="4*width;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="4*height;height" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-zoom" pres:preset-sub-type="out-from-screen-center"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="(6*min(max(width*height,.3),1)-7.4)/-.7*width;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="(6*min(max(width*height,.3),1)-7.4)/-.7*height;height" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="0.5;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="1+(6*min(max(width*height,.3),1)-7.4)/-.7*height/2;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-zoom" pres:preset-sub-type="out-slightly"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="4/3*width;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="4/3*height;height" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-boomerang"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:begin="0" smil:dur="0.5" smil:fill="hold" smil:decelerate="0.5" smil:attributeName="rotate" smil:values="-90;0" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0" smil:dur="0.5" smil:fill="hold" smil:decelerate="0.5" smil:attributeName="width" smil:values="width;width*.05" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.5" smil:dur="0.5" smil:fill="hold" smil:accelerate="0.5" smil:attributeName="width" smil:values="width*.05;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0" smil:dur="0.5" smil:fill="hold" smil:decelerate="0.5" smil:attributeName="x" smil:values="x+.4;x" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0" smil:dur="0.5" smil:fill="hold" smil:decelerate="0.5" smil:attributeName="y" smil:values="y-.2;y+.1" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.5" smil:dur="0.5" smil:fill="hold" smil:accelerate="0.5" smil:attributeName="y" smil:values="y+.1;y" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:begin="0" smil:dur="1" smil:decelerate="0.5" smil:type="fade" smil:subtype="crossfade"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-bounce"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:begin="0" smil:dur="0.58" smil:type="barWipe" smil:subtype="topToBottom"/> + <anim:animate smil:begin="0" smil:dur="1.822" smil:attributeName="x" smil:values="x-0.25;x" smil:keyTimes="0;1" smil:keySplines="0,0;0.14,0.36;0.43,0.73;0.71,0.91;1,1"/> + <anim:animate smil:begin="0" smil:dur="0.664" smil:attributeName="y" smil:values="0.5;1" smil:keyTimes="0;1" anim:formula="y-sin(pi*$)/3" smil:keySplines="0,0;0.25,0.07;0.5,0.2;0.75,0.467;1,1"/> + <anim:animate smil:begin="0.664" smil:dur="0.664" smil:attributeName="y" smil:values="0;1" smil:keyTimes="0;1" anim:formula="y-sin(pi*$)/9" smil:keySplines="0,0;0.125,0.2665;0.25,0.4;0.375,0.465;0.5,0.5;0.625,0.535;0.75,0.6;0.875,0.7335;1,1"/> + <anim:animate smil:begin="1.324" smil:dur="0.332" smil:attributeName="y" smil:values="0;1" smil:keyTimes="0;1" anim:formula="y-sin(pi*$)/27" smil:keySplines="0,0;0.125,0.2665;0.25,0.4;0.375,0.465;0.5,0.5;0.625,0.535;0.75,0.6;0.875,0.7335;1,1"/> + <anim:animate smil:begin="1.656" smil:dur="0.164" smil:attributeName="y" smil:values="0;1" smil:keyTimes="0;1" anim:formula="y-sin(pi*$)/81" smil:keySplines="0,0;0.125,0.2665;0.25,0.4;0.375,0.465;0.5,0.5;0.625,0.535;0.75,0.6;0.875,0.7335;1,1"/> + <anim:animateTransform smil:begin="0.65" smil:dur="0.026" smil:to="1,0.6" svg:type="scale"/> + <anim:animateTransform smil:begin="0.676" smil:dur="0.166" smil:decelerate="0.5" smil:to="1,1" svg:type="scale"/> + <anim:animateTransform smil:begin="1.312" smil:dur="0.026" smil:to="1,0.8" svg:type="scale"/> + <anim:animateTransform smil:begin="1.338" smil:dur="0.166" smil:decelerate="0.5" smil:to="1,1" svg:type="scale"/> + <anim:animateTransform smil:begin="1.642" smil:dur="0.026" smil:to="1,0.9" svg:type="scale"/> + <anim:animateTransform smil:begin="1.668" smil:dur="0.166" smil:decelerate="0.5" smil:to="1,1" svg:type="scale"/> + <anim:animateTransform smil:begin="1.808" smil:dur="0.026" smil:to="1,0.95" svg:type="scale"/> + <anim:animateTransform smil:begin="1.834" smil:dur="0.166" smil:decelerate="0.5" smil:to="1,1" svg:type="scale"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-movie-credits"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="15" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="15" smil:fill="hold" smil:attributeName="y" smil:values="y+1;y-1" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-curve-up"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animateTransform smil:begin="0" smil:dur="1" smil:fill="hold" smil:decelerate="0.5" smil:from="2.5,2.5" smil:to="1,1" svg:type="scale"/> + <anim:animateMotion smil:begin="0" smil:dur="1" smil:fill="hold" smil:decelerate="0.5" svg:path="M -0.46736 0.92887 C -0.37517 0.88508 -0.02552 0.75279 0.0908 0.66613 C 0.20747 0.57948 0.21649 0.50394 0.23177 0.40825 C 0.24705 0.31256 0.22118 0.15964 0.18264 0.09152 C 0.1441 0.02341 0.03802 0.0 0.0 0.0"/> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-flip" anim:iterate-type="by-letter" anim:iterate-interval="0.1s"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:begin="0" smil:dur="0.5" smil:fill="hold" smil:autoReverse="true" smil:attributeName="width" smil:by="(-width*2)"/> + <anim:animate smil:begin="0" smil:dur="0.5" smil:fill="hold" smil:decelerate="0.5" smil:autoReverse="true" smil:attributeName="x" smil:by="(width*0.50)"/> + <anim:animate smil:begin="0" smil:dur="1" smil:fill="hold" smil:attributeName="y" smil:from="(-height/2)" smil:to="(y)"/> + <anim:animateTransform smil:begin="0" smil:dur="1" smil:fill="hold" smil:by="360" svg:type="rotate"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-float"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.8" smil:decelerate="1" smil:type="fade" smil:subtype="crossfade"/> + <anim:animate smil:dur="0.8" smil:fill="hold" smil:decelerate="1" smil:attributeName="rotate" smil:values="-90;0" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.8" smil:fill="hold" smil:decelerate="1" smil:attributeName="x" smil:values="x+0.4;x-0.05" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.8" smil:fill="hold" smil:decelerate="1" smil:attributeName="y" smil:values="y-0.4;y+0.1" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.8" smil:dur="0.2" smil:fill="hold" smil:accelerate="1" smil:attributeName="x" smil:values="x-0.05;x" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.8" smil:dur="0.2" smil:fill="hold" smil:accelerate="1" smil:attributeName="y" smil:values="y+0.1;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:text-only="true" smil:begin="0" smil:fill="hold" smil:accelerate="1" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-fold"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="width*2.5;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="height*0.01;height" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="height+1;y" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="0.5" smil:type="fade" smil:subtype="crossfade"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="1" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-glide"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="width*0.05;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x-.2;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="0.5" smil:type="fade" smil:subtype="crossfade"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-breaks"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:begin="0" smil:dur="0.6" smil:fill="hold" smil:attributeName="x" smil:from="(-width/2)" smil:to="(x)"/> + <anim:animate smil:begin="0.6" smil:dur="0.2" smil:fill="hold" smil:decelerate="0.5" smil:autoReverse="true" smil:attributeName="skewX" smil:from="0" smil:to="-1"/> + <anim:animateTransform smil:begin="0.6" smil:dur="0.2" smil:fill="hold" smil:decelerate="1" smil:autoReverse="true" smil:from="1,1" smil:to="0.8,1" svg:type="scale"/> + <anim:animate smil:begin="0.6" smil:dur="0.2" smil:fill="hold" smil:decelerate="1" smil:autoReverse="true" smil:attributeName="x" smil:by="(height/3+width*0.1)" smil:additive="sum"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-magnify"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="0.77" smil:decelerate="1" smil:type="fade" smil:subtype="crossfade"/> + <anim:animateTransform smil:dur="0.77" smil:decelerate="1" smil:from="0.1,0.1" smil:to="2,4.5" svg:type="scale"/> + <anim:animateTransform smil:begin="0.77" smil:dur="1.23" smil:fill="hold" smil:accelerate="1" smil:from="2,4.5" smil:to="1,1" svg:type="scale"/> + <anim:set smil:dur="0.77" smil:fill="hold" smil:attributeName="x" smil:to="(0.5)"/> + <anim:animate smil:begin="0.77" smil:dur="1.23" smil:fill="hold" smil:accelerate="1" smil:attributeName="x" smil:from="(0.5)" smil:to="(x)"/> + <anim:set smil:dur="0.77" smil:fill="hold" smil:attributeName="y" smil:to="(y+0.4)"/> + <anim:animate smil:begin="0.77" smil:dur="1.23" smil:fill="hold" smil:accelerate="1" smil:attributeName="y" smil:from="(y+0.4)" smil:to="(y)"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-pinwheel"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:transitionFilter smil:dur="2" smil:type="fade" smil:subtype="crossfade"/> + <anim:animate smil:dur="2" smil:fill="hold" smil:attributeName="rotate" smil:values="720;0" smil:keyTimes="0;1"/> + <anim:animate smil:dur="2" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/> + <anim:animate smil:dur="2" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-sling"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="rotate" smil:values="90;90;90;0" smil:keyTimes="0;0.8;0.8;1"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="x" smil:values="-1;0.949999988079071;x" smil:keyTimes="0;0.5;1"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-spiral-in"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="x" smil:values="0;1" smil:keyTimes="0;1" anim:formula="x+(cos(-2*pi*(1-$))*-x-sin(-2*pi*(1-$))*(1-y))*(1-$)"/> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="y" smil:values="0;1" smil:keyTimes="0;1" anim:formula="y+(sin(-2*pi*(1-$))*-x+cos(-2*pi*(1-$))*(1-y))*(1-$)"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" smil:accelerate="0.5" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-falling-in" anim:iterate-type="by-letter" anim:iterate-interval="0.5s"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:set smil:begin="0" smil:dur="0.455" smil:fill="hold" smil:attributeName="rotate" smil:to="-45"/> + <anim:animate smil:begin="0.455" smil:dur="0.455" smil:fill="hold" smil:attributeName="rotate" smil:values="-45;45;0" smil:keyTimes="0;0.699;1"/> + <anim:animate smil:begin="0" smil:dur="0.455" smil:fill="hold" smil:attributeName="y" smil:values="y-1;y-(0.354*width-0.172*height)" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.455" smil:dur="0.156" smil:fill="hold" smil:decelerate="0.5" smil:autoReverse="true" smil:attributeName="y" smil:values="y-(0.354*width-0.172*height);y-(0.354*width-0.172*height)-height/2" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.864" smil:dur="0.136" smil:fill="hold" smil:attributeName="y" smil:values="y-(0.354*width-0.172*height);y" smil:keyTimes="0;1"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-swivel" pres:preset-sub-type="vertical"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="width" smil:values="0;1" smil:keyTimes="0;1" anim:formula="width*sin(2.5*pi*$)"/> + <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-swivel" pres:preset-sub-type="horizontal"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="width" smil:values="width;width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="5" smil:fill="hold" smil:attributeName="height" smil:values="0;1" smil:keyTimes="0;1" anim:formula="height*sin(2.5*pi*$)"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="1" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-thread"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="height/20;height/20;height" smil:keyTimes="0;0.5;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="width+.3;width+.3;width" smil:keyTimes="0;0.5;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x-.3;x;x" smil:keyTimes="0;0.5;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-entrance-whip" anim:iterate-type="by-letter" anim:iterate-interval="0.05s"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="visible"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="x" smil:values="x;x+.1;x" smil:keyTimes="0;0.5;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="height" smil:values="height/10;height+.01;height" smil:keyTimes="0;0.5;1"/> + <anim:animate smil:dur="0.5" smil:fill="hold" smil:attributeName="width" smil:values="width/10;width+.01;width" smil:keyTimes="0;0.5;1"/> + <anim:transitionFilter smil:dur="0.5" smil:keySplines="0,0;0.5,1;1,1" smil:type="fade" smil:subtype="crossfade"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="FillColor;ColorStyle;Accelerate;Decelerate;AutoReverse" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-fill-color" pres:preset-sub-type="2"> + <anim:animateColor smil:dur="2" smil:fill="hold" smil:attributeName="fill-color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/> + <anim:set smil:dur="2" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="FontStyle" pres:text-only="true" smil:begin="0" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-font"> + <anim:set smil:dur="indefinite" anim:sub-item="text" smil:attributeName="font-family" smil:to="Times New Roman"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="CharColor;ColorStyle;Accelerate;Decelerate;AutoReverse" pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-font-color" pres:preset-sub-type="2"> + <anim:animateColor smil:dur="2" smil:fill="hold" anim:sub-item="text" smil:attributeName="color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="CharHeight" pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-font-size" pres:preset-sub-type="2"> + <anim:animate smil:dur="2" smil:fill="hold" anim:sub-item="text" smil:attributeName="font-size" smil:to="1.5pt"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="CharDecoration" pres:text-only="true" smil:begin="0" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-font-style" pres:preset-sub-type="1"> + <anim:set smil:dur="indefinite" anim:sub-item="text" smil:attributeName="font-style" smil:to="normal"/> + <anim:set smil:dur="indefinite" anim:sub-item="text" smil:attributeName="font-weight" smil:to="bold"/> + <anim:set smil:dur="indefinite" anim:sub-item="text" smil:attributeName="text-underline" smil:to="none"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="LineColor;ColorStyle;Accelerate;Decelerate;AutoReverse" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-line-color" pres:preset-sub-type="2"> + <anim:animateColor smil:dur="2" smil:fill="hold" smil:attributeName="stroke-color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/> + <anim:set smil:dur="2" smil:fill="hold" smil:attributeName="stroke" smil:to="solid"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Scale;Accelerate;Decelerate;AutoReverse" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-grow-and-shrink"> + <anim:animateTransform smil:dur="2" smil:fill="hold" smil:by="1.5,1.5" svg:type="scale"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Rotate;Accelerate;Decelerate;AutoReverse" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-spin"> + <anim:animateTransform smil:dur="2" smil:fill="hold" smil:by="360" svg:type="rotate"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Transparency" smil:begin="0" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-transparency"> + <anim:set smil:dur="indefinite" smil:attributeName="opacity" smil:to="0.5"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-bold-flash"> + <anim:animate smil:dur="2" smil:fill="hold" anim:sub-item="text" smil:attributeName="font-weight" smil:values="normal;bold;normal;normal" smil:keyTimes="0;0.5;0.6;1" smil:calcMode="discrete"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:preset-property="Color" pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-color-over-by-word" anim:iterate-type="by-letter" anim:iterate-interval="0.2s"> + <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="color" smil:to="#333399"/> + <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill-color" smil:to="#333399"/> + <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-reveal-underline" anim:iterate-type="by-letter" anim:iterate-interval="0.2s"> + <anim:set smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="text-underline" smil:to="solid"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Color" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-color-blend"> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="fill-color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/> + <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:preset-property="Color" pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-color-over-by-letter" anim:iterate-type="by-letter" anim:iterate-interval="0.05s"> + <anim:set smil:dur="0.5" smil:fill="hold" smil:autoReverse="true" smil:attributeName="color" smil:to="#333399"/> + <anim:set smil:dur="0.5" smil:fill="hold" smil:autoReverse="true" smil:attributeName="fill-color" smil:to="#333399"/> + <anim:set smil:dur="0.5" smil:fill="hold" smil:autoReverse="true" smil:attributeName="fill" smil:to="solid"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-complementary-color"> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="color" smil:by="hsl(120,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="fill-color" smil:by="hsl(120,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="stroke-color" smil:by="hsl(120,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-complementary-color-2"> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="color" smil:by="hsl(-120,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="fill-color" smil:by="hsl(-120,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="stroke-color" smil:by="hsl(-120,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-contrasting-color"> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="color" smil:by="hsl(180,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="fill-color" smil:by="hsl(180,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="stroke-color" smil:by="hsl(180,0%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-darken"> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="color" smil:by="hsl(0,-12%,-25%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="fill-color" smil:by="hsl(0,-12%,-25%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="stroke-color" smil:by="hsl(0,-12%,-25%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-desaturate"> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="color" smil:by="hsl(0,-70%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="fill-color" smil:by="hsl(0,-70%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="stroke-color" smil:by="hsl(0,-70%,0%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-flash-bulb"> + <anim:transitionFilter smil:dur="0.5" smil:keySplines="0,0;0.2,0.5;0.8,0.5;1,0" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:animateTransform smil:dur="0.25" smil:fill="hold" smil:autoReverse="true" smil:by="1.05,1.05" svg:type="scale"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-lighten"> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="color" smil:by="hsl(0,12%,25%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="fill-color" smil:by="hsl(0,12%,25%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:dur="0.5" smil:fill="hold" smil:attributeName="stroke-color" smil:by="hsl(0,12%,25%)" anim:color-interpolation="hsl" anim:color-interpolation-direction="clockwise"/> + <anim:set smil:dur="0.5" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Color" smil:begin="0" smil:fill="remove" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-vertical-highlight"> + <anim:animateColor smil:begin="0" smil:dur="1.5" smil:fill="hold" smil:accelerate="0.5" smil:autoReverse="true" smil:attributeName="color" smil:to="#333399" smil:keySplines="0,0;0.33333,1;1,1" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:begin="0" smil:dur="1.5" smil:fill="hold" smil:accelerate="0.5" smil:autoReverse="true" smil:attributeName="fill-color" smil:to="#333399" smil:keySplines="0,0;0.33333,1;1,1" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/> + <anim:set smil:dur="3" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/> + <anim:animateTransform smil:begin="0" smil:dur="1.5" smil:fill="hold" smil:accelerate="0.5" smil:autoReverse="true" smil:from="1,1" smil:to="1,1.4" smil:keySplines="0,0;0.33333,1;1,1" svg:type="scale"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Color" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-flicker"> + <anim:animateColor smil:dur="0.25" smil:fill="hold" smil:autoReverse="true" smil:attributeName="color" smil:to="#ffffff" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:dur="0.25" smil:fill="hold" smil:autoReverse="true" smil:attributeName="fill-color" smil:to="#ffffff" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/> + <anim:set smil:dur="0.25" smil:fill="hold" smil:autoReverse="true" smil:attributeName="fill" smil:to="solid"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:preset-property="Color" pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-grow-with-color" anim:iterate-type="by-letter" anim:iterate-interval="0.05s"> + <anim:animateColor smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="fill-color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/> + <anim:set smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="fill" smil:to="solid"/> + <anim:animate smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="font-size" smil:to="1.5pt"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-shimmer" anim:iterate-type="by-letter" anim:iterate-interval="0.025s"> + <anim:animateTransform smil:begin="0" smil:dur="0.25" smil:fill="hold" smil:autoReverse="true" smil:to="0.8,1" svg:type="scale"/> + <anim:animate smil:begin="0" smil:dur="0.25" smil:fill="hold" smil:autoReverse="true" smil:attributeName="x" smil:by="(width*0.10)"/> + <anim:animate smil:begin="0" smil:dur="0.25" smil:fill="hold" smil:autoReverse="true" smil:attributeName="y" smil:by="(-width*0.10)"/> + <anim:animateTransform smil:begin="0" smil:dur="0.25" smil:fill="hold" smil:autoReverse="true" smil:by="-8" svg:type="rotate"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Color" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-teeter"> + <anim:animateColor smil:dur="0.1" smil:fill="hold" smil:attributeName="color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:dur="0.1" smil:fill="hold" smil:attributeName="fill-color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/> + <anim:set smil:dur="0.1" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/> + <anim:animateTransform smil:begin="0" smil:dur="0.1" smil:fill="hold" smil:by="2" svg:type="rotate"/> + <anim:animateTransform smil:begin="0.2" smil:dur="0.2" smil:fill="hold" smil:by="-4" svg:type="rotate"/> + <anim:animateTransform smil:begin="0.4" smil:dur="0.2" smil:fill="hold" smil:by="4" svg:type="rotate"/> + <anim:animateTransform smil:begin="0.6" smil:dur="0.2" smil:fill="hold" smil:by="-4" svg:type="rotate"/> + <anim:animateTransform smil:begin="0.8" smil:dur="0.2" smil:fill="hold" smil:by="2" svg:type="rotate"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Color" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-blast"> + <anim:animateColor smil:begin="0.1" smil:dur="1.9" smil:fill="hold" smil:attributeName="color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/> + <anim:animateColor smil:begin="0.1" smil:dur="1.9" smil:fill="hold" smil:attributeName="fill-color" smil:to="#333399" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise"/> + <anim:set smil:begin="0.1" smil:dur="1.9" smil:fill="hold" smil:attributeName="fill" smil:to="solid"/> + <anim:animateTransform smil:begin="0" smil:dur="0.2" smil:fill="hold" smil:from="1,1" smil:to="1,0.05" svg:type="scale"/> + <anim:animateTransform smil:begin="0.2" smil:dur="0.2" smil:fill="hold" smil:from="1,0.05" smil:to="1.2,1.5" svg:type="scale"/> + <anim:animateTransform smil:begin="1.4" smil:dur="0.6" smil:fill="hold" smil:to="1.2,1.5" svg:type="scale"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-blink"> + <anim:animate smil:dur="1" smil:fill="hold" smil:attributeName="visibility" smil:values="hidden;visible" smil:keyTimes="0;0.5" smil:calcMode="discrete"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:text-only="true" smil:begin="0" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-bold-reveal" anim:iterate-type="by-letter" anim:iterate-interval="0.025s"> + <anim:set smil:dur="indefinite" anim:sub-item="text" smil:attributeName="font-weight" smil:to="bold"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Color" pres:text-only="true" smil:begin="0" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-style-emphasis"> + <anim:set smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="color" smil:to="#333399"/> + <anim:set smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="font-style" smil:to="italic"/> + <anim:set smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="font-weight" smil:to="bold"/> + <anim:set smil:dur="0.5" smil:fill="hold" anim:sub-item="text" smil:attributeName="text-underline" smil:to="solid"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="ooo-emphasis-wave" anim:iterate-type="by-letter" anim:iterate-interval="0.05s"> + <anim:animateMotion smil:begin="0" smil:dur="0.25" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" smil:autoReverse="true" svg:path="M 0.0 0.0 L 0.0 -0.07213"/> + <anim:animateTransform smil:begin="0" smil:dur="0.125" smil:fill="hold" smil:by="25" svg:type="rotate"/> + <anim:animateTransform smil:begin="0.125" smil:dur="0.125" smil:fill="hold" smil:by="-25" svg:type="rotate"/> + <anim:animateTransform smil:begin="0.25" smil:dur="0.125" smil:fill="hold" smil:by="-25" svg:type="rotate"/> + <anim:animateTransform smil:begin="0.375" smil:dur="0.125" smil:fill="hold" smil:by="25" svg:type="rotate"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-venetian-blinds" pres:preset-sub-type="vertical"> + <anim:transitionFilter smil:dur="0.5" smil:type="blindsWipe" smil:subtype="horizontal" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-venetian-blinds" pres:preset-sub-type="horizontal"> + <anim:transitionFilter smil:dur="0.5" smil:type="blindsWipe" smil:subtype="vertical" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-box" pres:preset-sub-type="in"> + <anim:transitionFilter smil:dur="0.5" smil:type="irisWipe" smil:subtype="rectangle" smil:mode="out" smil:direction="reverse"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-box" pres:preset-sub-type="out"> + <anim:transitionFilter smil:dur="0.5" smil:type="irisWipe" smil:subtype="rectangle" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-checkerboard" pres:preset-sub-type="across"> + <anim:transitionFilter smil:dur="0.5" smil:type="checkerBoardWipe" smil:subtype="across" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-checkerboard" pres:preset-sub-type="downward"> + <anim:transitionFilter smil:dur="0.5" smil:type="checkerBoardWipe" smil:subtype="down" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-circle" pres:preset-sub-type="in"> + <anim:transitionFilter smil:dur="2" smil:type="ellipseWipe" smil:subtype="horizontal" smil:mode="out" smil:direction="reverse"/> + <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-circle" pres:preset-sub-type="out"> + <anim:transitionFilter smil:dur="2" smil:type="ellipseWipe" smil:subtype="horizontal" smil:mode="out"/> + <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-crawl-out" pres:preset-sub-type="from-bottom"> + <anim:animate smil:dur="5" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="5" smil:attributeName="y" smil:values="y;1+height/2" smil:keyTimes="0;1"/> + <anim:set smil:begin="4.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-crawl-out" pres:preset-sub-type="from-left"> + <anim:animate smil:dur="5" smil:attributeName="x" smil:values="x;0-width/2" smil:keyTimes="0;1"/> + <anim:animate smil:dur="5" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + <anim:set smil:begin="4.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-crawl-out" pres:preset-sub-type="from-right"> + <anim:animate smil:dur="5" smil:attributeName="x" smil:values="x;1+width/2" smil:keyTimes="0;1"/> + <anim:animate smil:dur="5" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + <anim:set smil:begin="4.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-crawl-out" pres:preset-sub-type="from-top"> + <anim:animate smil:dur="5" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="5" smil:attributeName="y" smil:values="y;0-height/2" smil:keyTimes="0;1"/> + <anim:set smil:begin="4.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-diamond" pres:preset-sub-type="in"> + <anim:transitionFilter smil:dur="2" smil:type="irisWipe" smil:subtype="diamond" smil:mode="out" smil:direction="reverse"/> + <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-diamond" pres:preset-sub-type="out"> + <anim:transitionFilter smil:dur="2" smil:type="irisWipe" smil:subtype="diamond" smil:mode="out"/> + <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-disappear"> + <anim:set smil:begin="0" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-dissolve"> + <anim:transitionFilter smil:dur="0.5" smil:type="dissolve" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-flash-once"> + <anim:animate smil:dur="1" smil:attributeName="visibility" smil:values="hidden;visible" smil:keyTimes="0;0.5" smil:calcMode="discrete"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fly-out" pres:preset-sub-type="from-bottom"> + <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;1+height/2" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fly-out" pres:preset-sub-type="from-left"> + <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;0-width/2" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fly-out" pres:preset-sub-type="from-right"> + <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;1+width/2" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fly-out" pres:preset-sub-type="from-top"> + <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;0-height/2" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fly-out" pres:preset-sub-type="from-bottom-left"> + <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;0-width/2" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;1+height/2" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fly-out" pres:preset-sub-type="from-bottom-right"> + <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;1+width/2" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;1+height/2" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fly-out" pres:preset-sub-type="from-top-left"> + <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;0-width/2" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;0-height/2" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction;Accelerate;Decelerate" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fly-out" pres:preset-sub-type="from-top-right"> + <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;1+width/2" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;0-height/2" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-peek-out" pres:preset-sub-type="from-bottom"> + <anim:transitionFilter smil:dur="0.5" smil:type="slideWipe" smil:subtype="fromBottom" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-peek-out" pres:preset-sub-type="from-left"> + <anim:transitionFilter smil:dur="0.5" smil:type="slideWipe" smil:subtype="fromLeft" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-peek-out" pres:preset-sub-type="from-right"> + <anim:transitionFilter smil:dur="0.5" smil:type="slideWipe" smil:subtype="fromRight" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-peek-out" pres:preset-sub-type="from-top"> + <anim:transitionFilter smil:dur="0.5" smil:type="slideWipe" smil:subtype="fromTop" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-plus" pres:preset-sub-type="in"> + <anim:transitionFilter smil:dur="2" smil:type="fourBoxWipe" smil:subtype="cornersIn" smil:mode="out"/> + <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-plus" pres:preset-sub-type="out"> + <anim:transitionFilter smil:dur="2" smil:type="fourBoxWipe" smil:subtype="cornersIn" smil:mode="out" smil:direction="reverse"/> + <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-random-bars" pres:preset-sub-type="vertical"> + <anim:transitionFilter smil:dur="0.5" smil:type="randomBarWipe" smil:subtype="horizontal" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-random-bars" pres:preset-sub-type="horizontal"> + <anim:transitionFilter smil:dur="0.5" smil:type="randomBarWipe" smil:subtype="vertical" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-random"/> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-split" pres:preset-sub-type="horizontal-in"> + <anim:transitionFilter smil:dur="0.5" smil:type="barnDoorWipe" smil:subtype="horizontal" smil:mode="out" smil:direction="reverse"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-split" pres:preset-sub-type="horizontal-out"> + <anim:transitionFilter smil:dur="0.5" smil:type="barnDoorWipe" smil:subtype="horizontal" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-split" pres:preset-sub-type="vertical-in"> + <anim:transitionFilter smil:dur="0.5" smil:type="barnDoorWipe" smil:subtype="vertical" smil:mode="out" smil:direction="reverse"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-split" pres:preset-sub-type="vertical-out"> + <anim:transitionFilter smil:dur="0.5" smil:type="barnDoorWipe" smil:subtype="vertical" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-diagonal-squares" pres:preset-sub-type="left-to-bottom"> + <anim:transitionFilter smil:dur="0.5" smil:type="waterfallWipe" smil:subtype="horizontalRight" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-diagonal-squares" pres:preset-sub-type="left-to-top"> + <anim:transitionFilter smil:dur="0.5" smil:type="waterfallWipe" smil:subtype="horizontalRight" smil:mode="out" smil:direction="reverse"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-diagonal-squares" pres:preset-sub-type="right-to-bottom"> + <anim:transitionFilter smil:dur="0.5" smil:type="waterfallWipe" smil:subtype="horizontalLeft" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-diagonal-squares" pres:preset-sub-type="right-to-top"> + <anim:transitionFilter smil:dur="0.5" smil:type="waterfallWipe" smil:subtype="horizontalLeft" smil:mode="out" smil:direction="reverse"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wedge"> + <anim:transitionFilter smil:dur="2" smil:type="fanWipe" smil:subtype="centerTop" smil:mode="out"/> + <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wheel" pres:preset-sub-type="1"> + <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="oneBlade" smil:mode="out"/> + <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wheel" pres:preset-sub-type="2"> + <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="twoBladeVertical" smil:mode="out"/> + <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wheel" pres:preset-sub-type="3"> + <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="threeBlade" smil:mode="out"/> + <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wheel" pres:preset-sub-type="4"> + <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="fourBlade" smil:mode="out"/> + <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Spokes" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wheel" pres:preset-sub-type="8"> + <anim:transitionFilter smil:dur="2" smil:type="pinWheelWipe" smil:subtype="eightBlade" smil:mode="out"/> + <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wipe" pres:preset-sub-type="from-bottom"> + <anim:transitionFilter smil:dur="0.5" smil:type="barWipe" smil:subtype="topToBottom" smil:mode="out" smil:direction="reverse"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wipe" pres:preset-sub-type="from-left"> + <anim:transitionFilter smil:dur="0.5" smil:type="barWipe" smil:subtype="leftToRight" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wipe" pres:preset-sub-type="from-right"> + <anim:transitionFilter smil:dur="0.5" smil:type="barWipe" smil:subtype="leftToRight" smil:mode="out" smil:direction="reverse"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-wipe" pres:preset-sub-type="from-top"> + <anim:transitionFilter smil:dur="0.5" smil:type="barWipe" smil:subtype="topToBottom" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-contract"> + <anim:animate smil:dur="1" smil:attributeName="width" smil:values="width;width*0.70" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fade-out"> + <anim:transitionFilter smil:dur="2" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fade-out-and-swivel" anim:iterate-type="by-letter" anim:iterate-interval="0.2s"> + <anim:transitionFilter smil:dur="2" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:animate smil:dur="2" smil:attributeName="width" smil:values="width;0.92*width;0.71*width;0.38*width;0;-0.38*width;-0.71*width;-0.92*width;-width;-0.92*width;-0.71*width;-0.38*width;0;0.38*width;0.71*width;0.92*width;width;0.92*width;0.71*width;0.38*width;0" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"/> + <anim:animate smil:dur="2" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/> + <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fade-out-and-zoom"> + <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;0" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;0" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="0.5" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-ascend"> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:animate smil:dur="1" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:attributeName="y" smil:values="y;y-.1" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-center-revolve"> + <anim:animate smil:begin="0" smil:dur="0.6" smil:decelerate="0.5" smil:attributeName="x" smil:values="x;x+0.0242;x+0.0479;x+0.0704;x+0.0911;x+0.1096;x+0.1254;x+0.1381;x+0.1474;x+0.1531;x+0.155;x+0.1531;x+0.1474;x+0.1381;x+0.1254;x+0.1096;x+0.0911;x+0.0704;x+0.0479;x+0.0242;x" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"/> + <anim:animate smil:begin="0.6" smil:dur="0.4" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0" smil:dur="0.6" smil:decelerate="0.5" smil:attributeName="y" smil:values="y;y+0.0019;y+0.0076;y+0.0169;y+0.0296;y+0.0454;y+0.0639;y+0.0846;y+0.1071;y+0.1307;y+0.155;y+0.1792;y+0.2029;y+0.2253;y+0.2461;y+0.2646;y+0.2804;y+0.2931;y+0.3024;y+0.308;y+0.31" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"/> + <anim:animate smil:begin="0.6" smil:dur="0.4" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:begin="0.9" smil:dur="0.1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-collapse" pres:preset-sub-type="across"> + <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;0" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:preset-property="Color1;Color2" pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-colored-lettering" anim:iterate-type="by-letter" anim:iterate-interval="0.04s"> + <anim:animate smil:dur="0.08" smil:attributeName="color" smil:values="#009999;#333399" smil:keyTimes="0;0.5" smil:calcMode="discrete"/> + <anim:animate smil:dur="0.08" smil:attributeName="fill-color" smil:values="#009999;#333399" smil:keyTimes="0;0.5" smil:calcMode="discrete"/> + <anim:set smil:dur="0.08" smil:attributeName="fill" smil:to="solid"/> + <anim:set smil:begin="0.079" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-descend"> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:animate smil:dur="1" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:attributeName="y" smil:values="y;y+.1" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-ease-out"> + <anim:animate smil:dur="1" smil:attributeName="x" smil:values="x;x-.2" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-turn-and-grow" anim:iterate-type="by-letter" anim:iterate-interval="0.05s"> + <anim:animate smil:dur="1" smil:attributeName="width" smil:values="width;0" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:attributeName="height" smil:values="height;0" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:attributeName="rotate" smil:values="0;90" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-sink-down"> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:animate smil:dur="1" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.1" smil:decelerate="1" smil:attributeName="y" smil:values="y;y-.03" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.1" smil:dur="0.9" smil:accelerate="1" smil:attributeName="y" smil:values="y;y+1" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="1" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-spin-out"> + <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;0" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;0" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="rotate" smil:values="0;360" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="0.5" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="1" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-stretchy"> + <anim:animate smil:dur="1" smil:attributeName="width" smil:values="width;width+.3" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-unfold" anim:iterate-type="by-letter" anim:iterate-interval="0.1s"> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:animate smil:dur="1" smil:attributeName="x" smil:values="x;x-.1" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-zoom" pres:preset-sub-type="out"> + <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;0" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;0" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-zoom" pres:preset-sub-type="544"> + <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;0" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;0" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;0.5" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;0.5" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-zoom" pres:preset-sub-type="out-slightly"> + <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;2/3*width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;2/3*height" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-zoom" pres:preset-sub-type="in"> + <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;4*width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;4*height" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-zoom" pres:preset-sub-type="20"> + <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;(6*min(max(width*height,.3),1)-7.4)/-.7*width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;(6*min(max(width*height,.3),1)-7.4)/-.7*height" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;1+(6*min(max(width*height,.3),1)-7.4)/-.7*height/2" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Zoom" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-zoom" pres:preset-sub-type="in-slightly"> + <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;4/3*width" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;4/3*height" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-boomerang"> + <anim:transitionFilter smil:begin="0" smil:dur="1" smil:accelerate="0.5" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:animate smil:begin="0" smil:dur="0.5" smil:accelerate="0.5" smil:attributeName="y" smil:values="y;y+.1" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.5" smil:dur="0.5" smil:decelerate="0.5" smil:attributeName="y" smil:values="y;y-.1" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.5" smil:dur="0.5" smil:accelerate="0.5" smil:attributeName="x" smil:values="x;x+.4" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0" smil:dur="0.5" smil:accelerate="0.5" smil:attributeName="width" smil:values="width;width*.05" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.5" smil:dur="0.5" smil:decelerate="0.5" smil:attributeName="width" smil:values="width;width/.05" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.5" smil:dur="0.5" smil:accelerate="0.5" smil:attributeName="rotate" smil:values="0;-90" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-boomerang"> + <anim:transitionFilter smil:begin="0" smil:dur="1" smil:accelerate="0.5" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:animate smil:begin="0" smil:dur="0.5" smil:accelerate="0.5" smil:attributeName="y" smil:values="y;y+.1" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.5" smil:dur="0.5" smil:decelerate="0.5" smil:attributeName="y" smil:values="y;y-.1" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.5" smil:dur="0.5" smil:accelerate="0.5" smil:attributeName="x" smil:values="x;x+.4" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0" smil:dur="0.5" smil:accelerate="0.5" smil:attributeName="width" smil:values="width;width*.05" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.5" smil:dur="0.5" smil:decelerate="0.5" smil:attributeName="width" smil:values="width;width/.05" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.5" smil:dur="0.5" smil:accelerate="0.5" smil:attributeName="rotate" smil:values="0;-90" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-bounce"> + <anim:transitionFilter smil:begin="1.82" smil:dur="0.18" smil:accelerate="0.5" smil:type="barWipe" smil:subtype="topToBottom" smil:mode="out"/> + <anim:animate smil:begin="0" smil:dur="1.822" smil:attributeName="x" smil:values="x;x+0.25" smil:keyTimes="0;1" smil:keySplines="0,0;0.14,0.31;0.43,0.73;0.71,0.91;1,1"/> + <anim:animate smil:begin="1.822" smil:dur="0.178" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0" smil:dur="0.664" smil:attributeName="y" smil:values="y;y+0.026;y+0.052;y+0.078;y+0.103;y+0.151;y+0.196;y+0.236;y+0.270;y+0.297;y+0.317;y+0.329;y+0.333" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.3;0.4;0.5;0.6;0.7;0.8;0.9;1" smil:keySplines="0,0;0.25,0.07;0.5,0.2;0.75,0.467;1,1"/> + <anim:animate smil:begin="0.664" smil:dur="0.664" smil:attributeName="y" smil:values="y;y-0.034;y-0.065;y-0.090;y-0.106;y-0.111;y-0.106;y-0.090;y-0.065;y-0.034;y" smil:keyTimes="0;0.1;0.2;0.3;0.4;0.5;0.6;0.7;0.8;0.9;1" smil:keySplines="0,0;0.125,0.2665;0.25,0.4;0.375,0.465;0.5,0.5;0.625,0.535;0.75,0.6;0.875,0.7335;1,1"/> + <anim:animate smil:begin="1.324" smil:dur="0.332" smil:attributeName="y" smil:values="y;y-0.011;y-0.022;y-0.030;y-0.035;y-0.037;y-0.035;y-0.030;y-0.022;y-0.011;y" smil:keyTimes="0;0.1;0.2;0.3;0.4;0.5;0.6;0.7;0.8;0.9;1" smil:keySplines="0,0;0.125,0.2665;0.25,0.4;0.375,0.465;0.5,0.5;0.625,0.535;0.75,0.6;0.875,0.7335;1,1"/> + <anim:animate smil:begin="1.656" smil:dur="0.164" smil:attributeName="y" smil:values="y;y-0.004;y-0.007;y-0.010;y-0.012;y-0.0123;y-0.012;y-0.010;y-0.007;y-0.004;y" smil:keyTimes="0;0.1;0.2;0.3;0.4;0.5;0.6;0.7;0.8;0.9;1" smil:keySplines="0,0;0.125,0.2665;0.25,0.4;0.375,0.465;0.5,0.5;0.625,0.535;0.75,0.6;0.875,0.7335;1,1"/> + <anim:animate smil:begin="1.82" smil:dur="0.18" smil:accelerate="0.5" smil:attributeName="y" smil:values="y;y+height" smil:keyTimes="0;1"/> + <anim:animateTransform smil:begin="0.62" smil:dur="0.026" smil:to="1,0.6" svg:type="scale"/> + <anim:animateTransform smil:begin="0.646" smil:dur="0.166" smil:decelerate="0.5" smil:to="1,1" svg:type="scale"/> + <anim:animateTransform smil:begin="1.312" smil:dur="0.026" smil:to="1,0.8" svg:type="scale"/> + <anim:animateTransform smil:begin="1.338" smil:dur="0.166" smil:decelerate="0.5" smil:to="1,1" svg:type="scale"/> + <anim:animateTransform smil:begin="1.642" smil:dur="0.026" smil:to="1,0.9" svg:type="scale"/> + <anim:animateTransform smil:begin="1.668" smil:dur="0.166" smil:decelerate="0.5" smil:to="1,1" svg:type="scale"/> + <anim:animateTransform smil:begin="1.808" smil:dur="0.026" smil:to="1,0.95" svg:type="scale"/> + <anim:animateTransform smil:begin="1.834" smil:dur="0.166" smil:decelerate="0.5" smil:to="1,1" svg:type="scale"/> + <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-movie-credits"> + <anim:animate smil:dur="15" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="15" smil:attributeName="y" smil:values="y-1;y+1" smil:keyTimes="0;1"/> + <anim:set smil:begin="14.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-curve-down"> + <anim:animateTransform smil:begin="0" smil:dur="1" smil:accelerate="0.5" smil:from="1,1" smil:to="2.5,2.5" svg:type="scale"/> + <anim:animateMotion smil:begin="0" smil:dur="1" smil:accelerate="0.5" svg:path="M 0.0000 0.0000 C 0.03802 0.0 0.1441 0.02341 0.1826 0.0915 C 0.22118 0.15964 0.24705 0.31256 0.2318 0.4083 C 0.21649 0.50394 0.20747 0.57948 0.0908 0.6661 C -0.02552 0.75279 -0.37517 0.88508 -0.4674 0.9289"/> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-flip" anim:iterate-type="by-letter" anim:iterate-interval="0.1s"> + <anim:animate smil:begin="0" smil:dur="0.5" smil:autoReverse="true" smil:attributeName="width" smil:from="(width)" smil:to="(-width*2)"/> + <anim:animate smil:begin="0" smil:dur="0.5" smil:decelerate="0.5" smil:autoReverse="true" smil:attributeName="x" smil:by="(width*0.50)"/> + <anim:animate smil:begin="0" smil:dur="1" smil:attributeName="y" smil:from="(y)" smil:to="(1+height/2)"/> + <anim:animateTransform smil:begin="0" smil:dur="1" smil:by="360" svg:type="rotate"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-float"> + <anim:transitionFilter smil:begin="0.2" smil:dur="0.8" smil:accelerate="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:animate smil:begin="0.2" smil:dur="0.8" smil:accelerate="1" smil:attributeName="rotate" smil:values="0;-90" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.2" smil:decelerate="1" smil:attributeName="x" smil:values="x;x-0.05" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.2" smil:decelerate="1" smil:attributeName="y" smil:values="y;y+0.1" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.2" smil:dur="0.8" smil:accelerate="1" smil:attributeName="x" smil:values="x;x+0.4+0.05" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0.2" smil:dur="0.8" smil:accelerate="1" smil:attributeName="y" smil:values="y;y-0.4-0.1" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:text-only="true" smil:begin="0" smil:fill="hold" smil:decelerate="1" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-fold"> + <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;width*2.5" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;height*0.01" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;height+1" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="0.5" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:decelerate="1" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-glide"> + <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;width*0.05" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;x-.2" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="0.5" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-breaks"> + <anim:animate smil:begin="0" smil:dur="1" smil:attributeName="x" smil:from="(x)" smil:to="(x+1)"/> + <anim:animate smil:begin="0" smil:dur="0.2" smil:accelerate="0.5" smil:attributeName="skewX" smil:from="0" smil:to="-1"/> + <anim:set smil:begin="0.2" smil:dur="0.8" smil:attributeName="skewX" smil:to="-1"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-magnify"> + <anim:transitionFilter smil:begin="1.23" smil:dur="0.77" smil:accelerate="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:animateTransform smil:begin="1.23" smil:dur="0.77" smil:accelerate="1" smil:from="2,4.5" smil:to="0.1,0.1" svg:type="scale"/> + <anim:animateTransform smil:dur="1.23" smil:decelerate="1" smil:from="1,1" smil:to="2,4.5" svg:type="scale"/> + <anim:animate smil:dur="1.23" smil:decelerate="1" smil:attributeName="x" smil:from="(x)" smil:to="(0.5)"/> + <anim:animate smil:begin="1.23" smil:dur="0.77" smil:attributeName="x" smil:from="(0.5)" smil:to="(0.5)"/> + <anim:animate smil:dur="1.23" smil:decelerate="1" smil:attributeName="y" smil:from="(y)" smil:to="(y+0.4)"/> + <anim:animate smil:begin="1.23" smil:dur="0.77" smil:attributeName="y" smil:from="(y)" smil:to="(y)"/> + <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-pinwheel"> + <anim:transitionFilter smil:dur="2" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:animate smil:dur="2" smil:attributeName="rotate" smil:values="0;720" smil:keyTimes="0;1"/> + <anim:animate smil:dur="2" smil:attributeName="height" smil:values="height;0" smil:keyTimes="0;1"/> + <anim:animate smil:dur="2" smil:attributeName="width" smil:values="width;0" smil:keyTimes="0;1"/> + <anim:set smil:begin="1.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-sling"> + <anim:animate smil:dur="1" smil:attributeName="rotate" smil:values="0;90;90;90" smil:keyTimes="0;0.2;0.2;1"/> + <anim:animate smil:dur="1" smil:attributeName="x" smil:values="x;0.949999988079071;-1" smil:keyTimes="0;0.5;1"/> + <anim:animate smil:dur="1" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + <anim:transitionFilter smil:dur="1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-spiral-out"> + <anim:animate smil:dur="1" smil:attributeName="width" smil:values="width;0" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:attributeName="height" smil:values="height;0" smil:keyTimes="0;1"/> + <anim:animate smil:dur="1" smil:attributeName="x" smil:values="x;x+-0.0500*(x*0.9511+(1-y)*0.3090);x+-0.1000*(x*0.8090+(1-y)*0.5878);x+-0.1500*(x*0.5878+(1-y)*0.8090);x+-0.2000*(x*0.3090+(1-y)*0.9511);x+-0.2500*(x*-0.0000+(1-y)*1.0000);x+-0.3000*(x*-0.3090+(1-y)*0.9511);x+-0.3500*(x*-0.5878+(1-y)*0.8090);x+-0.4000*(x*-0.8090+(1-y)*0.5878);x+-0.4500*(x*-0.9511+(1-y)*0.3090);x+-0.5000*(x*-1.0000+(1-y)*-0.0000);x+-0.5500*(x*-0.9511+(1-y)*-0.3090);x+-0.6000*(x*-0.8090+(1-y)*-0.5878);x+-0.6500*(x*-0.5878+(1-y)*-0.8090);x+-0.7000*(x*-0.3090+(1-y)*-0.9511);x+-0.7500*(x*0.0000+(1-y)*-1.0000);x+-0.8000*(x*0.3090+(1-y)*-0.9511);x+-0.8500*(x*0.5878+(1-y)*-0.8090);x+-0.9000*(x*0.8090+(1-y)*-0.5878);x+-0.9500*(x*0.9511+(1-y)*-0.3090);x+-1.0000*(x*1.0000+(1-y)*0.0000)" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"/> + <anim:animate smil:dur="1" smil:attributeName="y" smil:values="y;y+-0.0500*(x*0.3090-(1-y)*0.9511);y+-0.1000*(x*0.5878-(1-y)*0.8090);y+-0.1500*(x*0.8090-(1-y)*0.5878);y+-0.2000*(x*0.9511-(1-y)*0.3090);y+-0.2500*(x*1.0000-(1-y)*-0.0000);y+-0.3000*(x*0.9511-(1-y)*-0.3090);y+-0.3500*(x*0.8090-(1-y)*-0.5878);y+-0.4000*(x*0.5878-(1-y)*-0.8090);y+-0.4500*(x*0.3090-(1-y)*-0.9511);y+-0.5000*(x*-0.0000-(1-y)*-1.0000);y+-0.5500*(x*-0.3090-(1-y)*-0.9511);y+-0.6000*(x*-0.5878-(1-y)*-0.8090);y+-0.6500*(x*-0.8090-(1-y)*-0.5878);y+-0.7000*(x*-0.9511-(1-y)*-0.3090);y+-0.7500*(x*-1.0000-(1-y)*0.0000);y+-0.8000*(x*-0.9511-(1-y)*0.3090);y+-0.8500*(x*-0.8090-(1-y)*0.5878);y+-0.9000*(x*-0.5878-(1-y)*0.8090);y+-0.9500*(x*-0.3090-(1-y)*0.9511);y+-1.0000*(x*0.0000-(1-y)*1.0000)" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" smil:accelerate="0.5" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-swish" anim:iterate-type="by-letter" anim:iterate-interval="0.5s"> + <anim:animate smil:begin="0" smil:dur="1" smil:attributeName="rotate" smil:values="0;45" smil:keyTimes="0;1"/> + <anim:animate smil:begin="0" smil:dur="1" smil:attributeName="y" smil:values="y;y+1" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par pres:preset-property="Direction" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-swivel" pres:preset-sub-type="vertical"> + <anim:animate smil:dur="5" smil:attributeName="height" smil:values="height;height" smil:keyTimes="0;1"/> + <anim:animate smil:dur="5" smil:attributeName="width" smil:values="width;0.92*width;0.71*width;0.38*width;0;-0.38*width;-0.71*width;-0.92*width;-width;-0.92*width;-0.71*width;-0.38*width;0;0.38*width;0.71*width;0.92*width;width;0.92*width;0.71*width;0.38*width;0" smil:keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"/> + <anim:set smil:begin="4.999" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:decelerate="1" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-thread"> + <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;height/20;height/20" smil:keyTimes="0;0.5;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;width+.3;width+.3" smil:keyTimes="0;0.5;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;x;x-.3" smil:keyTimes="0;0.5;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:iterate pres:text-only="true" smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="exit" pres:preset-id="ooo-exit-whip" anim:iterate-type="by-letter" anim:iterate-interval="0.05s"> + <anim:animate smil:dur="0.5" smil:attributeName="x" smil:values="x;x+.1;x" smil:keyTimes="0;0.5;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="y" smil:values="y;y" smil:keyTimes="0;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="height" smil:values="height;height+.01;height/10" smil:keyTimes="0;0.5;1"/> + <anim:animate smil:dur="0.5" smil:attributeName="width" smil:values="width;width+.01;width/10" smil:keyTimes="0;0.5;1"/> + <anim:transitionFilter smil:dur="0.5" smil:keySplines="0,0;0.5,0;1,1" smil:type="fade" smil:subtype="crossfade" smil:mode="out"/> + <anim:set smil:begin="0.499" smil:dur="0.001" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden"/> + </anim:iterate> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-4-point-star"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.091 -0.0453 L 0.125 -0.16655 L 0.158 -0.0453 L 0.249 0 L 0.158 0.0453 L 0.125 0.16655 L 0.091 0.0453 L 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-5-point-star"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.029 0.12125 L 0.125 0.12125 L 0.048 0.19586 L 0.077 0.31711 L 0 0.2425 L -0.077 0.31711 L -0.048 0.19586 L -0.125 0.12125 L -0.029 0.12125 L 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-6-point-star"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.036 0.08261 L 0.108 0.08261 L 0.072 0.16655 L 0.108 0.24916 L 0.036 0.24916 L 0 0.3331 L -0.036 0.24916 L -0.108 0.24916 L -0.072 0.16655 L -0.108 0.08261 L -0.036 0.08261 L 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-8-point-star"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.052 0 L 0.089 -0.0493 L 0.125 0 L 0.177 0 L 0.177 0.06929 L 0.213 0.11858 L 0.177 0.16655 L 0.177 0.23584 L 0.125 0.23584 L 0.089 0.2838 L 0.052 0.23584 L 0 0.23584 L 0 0.16655 L -0.037 0.11858 L 0 0.06929 L 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-circle"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.069 0 0.125 0.07461 0.125 0.16655 C 0.125 0.25849 0.069 0.3331 0 0.3331 C -0.069 0.3331 -0.125 0.25849 -0.125 0.16655 C -0.125 0.07461 -0.069 0 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-crescent-moon"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C -0.014 -0.00666 -0.029 -0.01199 -0.044 -0.01199 C -0.114 -0.01199 -0.169 0.06396 -0.169 0.15589 C -0.169 0.2465 -0.114 0.32111 -0.044 0.32111 C -0.029 0.32111 -0.014 0.31711 0 0.31045 C -0.047 0.28647 -0.08 0.22651 -0.08 0.15589 C -0.08 0.08394 -0.047 0.02398 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-diamond"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.125 -0.11192 L 0.25 0 L 0.125 0.11192 L 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-equal-triangle"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.125 0.2878 L -0.125 0.2878 L 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-oval"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.03 -0.05063 0.075 -0.08261 0.125 -0.08261 C 0.175 -0.08261 0.22 -0.05063 0.25 0 C 0.22 0.05063 0.175 0.08261 0.125 0.08261 C 0.075 0.08261 0.03 0.05063 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-heart"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.012 -0.02398 0.033 -0.05863 0.058 -0.05863 C 0.095 -0.05863 0.125 -0.02265 0.125 0.02265 C 0.125 0.03731 0.122 0.05063 0.116 0.06262 C 0.117 0.06262 0 0.2425 0 0.24383 C 0 0.2425 -0.117 0.06262 -0.116 0.06262 C -0.122 0.05063 -0.125 0.03731 -0.125 0.02265 C -0.125 -0.02265 -0.095 -0.05863 -0.057 -0.05863 C -0.033 -0.05863 -0.012 -0.02398 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-hexagon"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.125 0 L 0.188 0.14523 L 0.125 0.28913 L 0 0.28913 L -0.063 0.14523 L 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-octagon"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.073 -0.09727 L 0.177 -0.09727 L 0.25 0 L 0.25 0.13857 L 0.177 0.23584 L 0.073 0.23584 L 0 0.13857 L 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-parallelogram"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.178 0 L 0.25 0.16122 L 0.072 0.16122 L 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-pentagon"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.125 0.12125 L 0.077 0.31711 L -0.077 0.31711 L -0.125 0.12125 L 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-right-triangle"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0 -0.19586 L 0.25 0 L 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-square"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.25 0 L 0.25 0.3331 L 0 0.3331 L 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-teardrop"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.001 0.0453 0.011 0.08661 0.028 0.11325 C 0.028 0.11459 0.055 0.15056 0.055 0.14923 C 0.07 0.16922 0.079 0.1972 0.079 0.22651 C 0.079 0.28514 0.044 0.33177 0 0.3331 C -0.044 0.33177 -0.079 0.28514 -0.079 0.22651 C -0.079 0.1972 -0.07 0.16922 -0.055 0.14923 C -0.055 0.15056 -0.028 0.11459 -0.028 0.11325 C -0.011 0.08661 -0.001 0.0453 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-trapezoid"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.167 0 L 0.21 0.22251 L -0.04 0.22251 L 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-arc-down"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.067 0.0533 C 0.081 0.06529 0.102 0.07195 0.124 0.07195 C 0.149 0.07195 0.169 0.06529 0.183 0.0533 L 0.25 0"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-arc-left"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L -0.04 0.08927 C -0.049 0.10793 -0.054 0.13591 -0.054 0.16522 C -0.054 0.19853 -0.049 0.22518 -0.04 0.24383 L 0 0.3331"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-arc-right"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.04 0.08927 C 0.049 0.10793 0.054 0.13591 0.054 0.16522 C 0.054 0.19853 0.049 0.22518 0.04 0.24383 L 0 0.3331"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-arc-up"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.067 -0.0533 C 0.081 -0.06529 0.102 -0.07195 0.124 -0.07195 C 0.149 -0.07195 0.169 -0.06529 0.183 -0.0533 L 0.25 0"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-bounce-left"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 c -0.004 -0.01066 -0.018 -0.02132 -0.023 -0.02132 c -0.031 0 -0.063 0.16655 -0.063 0.3331 c 0 -0.08394 -0.016 -0.16655 -0.031 -0.16655 c -0.016 0 -0.031 0.08394 -0.031 0.16655 c 0 -0.0413 -0.008 -0.08394 -0.016 -0.08394 c -0.008 0 -0.016 0.0413 -0.016 0.08394 c 0 -0.02132 -0.004 -0.0413 -0.008 -0.0413 c -0.004 0 -0.008 0.02132 -0.008 0.0413 c 0 -0.01066 -0.002 -0.02132 -0.004 -0.02132 c -0.001 0 -0.004 0.01066 -0.004 0.02132 c 0 -0.00533 -0.001 -0.01066 -0.002 -0.01066 c 0 -0.00133 -0.002 0.00533 -0.002 0.01066 c 0 -0.00266 0 -0.00533 -0.001 -0.00533 c 0 0.00133 -0.001 0.00266 -0.001 0.00533 c 0 -0.00133 0 -0.00266 0 -0.004 c -0.001 0 -0.001 0.00133 -0.001 0.00266 c -0.001 0 -0.001 -0.00133 -0.001 -0.00266 c -0.001 0 -0.001 0.00133 -0.001 0.00266"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-bounce-right"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 c 0.004 -0.01066 0.018 -0.02132 0.023 -0.02132 c 0.031 0 0.063 0.16655 0.063 0.3331 c 0 -0.08394 0.016 -0.16655 0.031 -0.16655 c 0.016 0 0.031 0.08394 0.031 0.16655 c 0 -0.0413 0.008 -0.08394 0.016 -0.08394 c 0.008 0 0.016 0.0413 0.016 0.08394 c 0 -0.02132 0.004 -0.0413 0.008 -0.0413 c 0.004 0 0.008 0.02132 0.008 0.0413 c 0 -0.01066 0.002 -0.02132 0.004 -0.02132 c 0.001 0 0.004 0.01066 0.004 0.02132 c 0 -0.00533 0.001 -0.01066 0.002 -0.01066 c 0 0.00133 0.002 0.00533 0.002 0.01066 c 0 -0.00266 0 -0.00533 0.001 -0.00533 c 0 0.00133 0.001 0.00266 0.001 0.00533 c 0 -0.00133 0 -0.00266 0 -0.004 c 0.001 0 0.001 0.00133 0.001 0.00266 c 0.001 0 0.001 -0.00133 0.001 -0.00266 c 0.001 0 0.001 0.00133 0.001 0.00266"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-curvy-left"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.008 0.01066 0.017 0.02132 0.021 0.03464 C 0.025 0.0493 0.027 0.06662 0.029 0.08394 C 0.031 0.10126 0.029 0.11592 0.027 0.13191 C 0.025 0.14656 0.022 0.16255 0.015 0.17588 C 0.009 0.1892 -0.001 0.19986 -0.012 0.20786 C -0.022 0.21585 -0.034 0.22118 -0.046 0.22384 C -0.058 0.22651 -0.07 0.22651 -0.081 0.22384 C -0.093 0.22118 -0.104 0.21452 -0.113 0.20386 C -0.122 0.19453 -0.13 0.18254 -0.134 0.16788 C -0.139 0.15456 -0.141 0.13591 -0.141 0.12125 C -0.142 0.10659 -0.141 0.08927 -0.136 0.07461 C -0.131 0.06129 -0.122 0.05063 -0.11 0.0453 C -0.098 0.0413 -0.086 0.04663 -0.078 0.05596 C -0.071 0.06529 -0.066 0.07994 -0.065 0.09727 C -0.065 0.11459 -0.066 0.13058 -0.071 0.1439 C -0.076 0.15722 -0.075 0.15989 -0.095 0.17721 C -0.113 0.19586 -0.131 0.19053 -0.142 0.19187 C -0.153 0.19187 -0.162 0.18654 -0.173 0.18121 C -0.185 0.17455 -0.195 0.16255 -0.202 0.15189 C -0.209 0.14124 -0.212 0.12791 -0.216 0.10659 C -0.219 0.08527 -0.219 0.07461 -0.219 0.05863 C -0.219 0.04264 -0.219 0.02665 -0.219 0.01066"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-curvy-right"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C -0.008 0.01066 -0.017 0.02132 -0.021 0.03464 C -0.025 0.0493 -0.027 0.06662 -0.029 0.08394 C -0.031 0.10126 -0.029 0.11592 -0.027 0.13191 C -0.025 0.14656 -0.022 0.16255 -0.015 0.17588 C -0.009 0.1892 0.001 0.19986 0.012 0.20786 C 0.022 0.21585 0.034 0.22118 0.046 0.22384 C 0.058 0.22651 0.07 0.22651 0.081 0.22384 C 0.093 0.22118 0.104 0.21452 0.113 0.20386 C 0.122 0.19453 0.13 0.18254 0.134 0.16788 C 0.139 0.15456 0.141 0.13591 0.141 0.12125 C 0.142 0.10659 0.141 0.08927 0.136 0.07461 C 0.131 0.06129 0.122 0.05063 0.11 0.0453 C 0.098 0.0413 0.086 0.04663 0.078 0.05596 C 0.071 0.06529 0.066 0.07994 0.065 0.09727 C 0.065 0.11459 0.066 0.13058 0.071 0.1439 C 0.076 0.15722 0.075 0.15989 0.095 0.17721 C 0.113 0.19586 0.131 0.19053 0.142 0.19187 C 0.153 0.19187 0.162 0.18654 0.173 0.18121 C 0.185 0.17455 0.195 0.16255 0.202 0.15189 C 0.209 0.14124 0.212 0.12791 0.216 0.10659 C 0.219 0.08527 0.219 0.07461 0.219 0.05863 C 0.219 0.04264 0.219 0.02665 0.219 0.01066"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-decaying-wave"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.002 0.07062 0.007 0.16922 0.025 0.16788 C 0.051 0.16788 0.053 -0.16255 0.084 -0.16389 C 0.112 -0.16389 0.097 0.12525 0.124 0.12391 C 0.152 0.12391 0.137 -0.08527 0.167 -0.08527 C 0.194 -0.08527 0.179 0.05596 0.203 0.05596 C 0.226 0.05596 0.214 -0.05196 0.235 -0.05196 C 0.247 -0.05196 0.248 -0.02265 0.249 0"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-diagonal-down-right"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.25 0.3331"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-diagonal-up-right"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.25 -0.3331"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-down"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0 0.3331"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-funnel"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C -0.001 0.03331 0.06 0.06262 0.137 0.06396 C 0.198 0.06662 0.248 0.05063 0.249 0.03065 C 0.249 0.01066 0.2 -0.00799 0.138 -0.00933 C 0.107 -0.00933 0.079 -0.00666 0.059 0 C 0.03 0.00933 0.013 0.02398 0.013 0.0413 C 0.013 0.05063 0.018 0.05996 0.027 0.06795 C 0.048 0.08527 0.089 0.09727 0.136 0.0986 C 0.191 0.10126 0.236 0.08661 0.236 0.06929 C 0.237 0.05063 0.192 0.03464 0.137 0.03198 C 0.109 0.03198 0.084 0.03464 0.065 0.03997 C 0.04 0.0493 0.024 0.06396 0.024 0.07861 C 0.024 0.08661 0.029 0.0946 0.037 0.1026 C 0.056 0.11725 0.092 0.12924 0.135 0.13058 C 0.185 0.13191 0.225 0.11858 0.225 0.1026 C 0.226 0.08661 0.186 0.07195 0.136 0.07062 C 0.111 0.06929 0.088 0.07195 0.071 0.07728 C 0.048 0.08527 0.035 0.09727 0.035 0.11192 C 0.035 0.11858 0.039 0.12658 0.046 0.13324 C 0.063 0.14656 0.096 0.15722 0.134 0.15856 C 0.179 0.15856 0.215 0.1479 0.215 0.13324 C 0.215 0.11858 0.18 0.10526 0.135 0.10393 C 0.113 0.10393 0.092 0.10659 0.077 0.11059 C 0.056 0.11725 0.044 0.12924 0.043 0.14124 C 0.043 0.1479 0.048 0.15456 0.054 0.15989 C 0.069 0.17321 0.099 0.18254 0.133 0.18254 C 0.173 0.18387 0.206 0.17455 0.206 0.16122 C 0.207 0.1479 0.174 0.13591 0.134 0.13457 C 0.114 0.13457 0.095 0.13591 0.082 0.14124 C 0.063 0.14656 0.052 0.15722 0.052 0.16788 C 0.052 0.17455 0.055 0.17988 0.061 0.1852 C 0.075 0.1972 0.101 0.20519 0.132 0.20652 C 0.169 0.20652 0.198 0.19853 0.198 0.18654 C 0.199 0.17455 0.17 0.16389 0.133 0.16255 C 0.115 0.16255 0.099 0.16389 0.087 0.16788 C 0.07 0.17321 0.06 0.18254 0.06 0.1932 C 0.06 0.19853 0.063 0.20253 0.068 0.20786 C 0.08 0.21851 0.104 0.22518 0.132 0.22651 C 0.165 0.22784 0.191 0.21985 0.191 0.20786 C 0.191 0.19853 0.166 0.18787 0.133 0.18787 C 0.116 0.18654 0.101 0.1892 0.09 0.19187 C 0.075 0.1972 0.066 0.20519 0.066 0.21452 C 0.066 0.21985 0.069 0.22384 0.074 0.22784 C 0.085 0.23717 0.107 0.24383 0.131 0.24516 C 0.161 0.2465 0.185 0.2385 0.185 0.22917 C 0.185 0.21851 0.161 0.21052 0.132 0.20919 C 0.118 0.20919 0.104 0.21052 0.094 0.21452 C 0.08 0.21851 0.072 0.22518 0.072 0.2345 C 0.072 0.2385 0.075 0.2425 0.079 0.2465 C 0.089 0.25449 0.108 0.26115 0.131 0.26115 C 0.157 0.26248 0.179 0.25582 0.179 0.2465 C 0.179 0.2385 0.158 0.23051 0.131 0.23051 C 0.119 0.22917 0.106 0.23051 0.097 0.23317 C 0.085 0.2385 0.078 0.24516 0.078 0.25183 C 0.078 0.25582 0.08 0.25982 0.084 0.26248 C 0.093 0.27048 0.11 0.27581 0.131 0.27714 C 0.155 0.27714 0.174 0.27048 0.174 0.26382 C 0.174 0.25582 0.155 0.24783 0.131 0.24783 C 0.119 0.24783 0.108 0.24916 0.101 0.25183 C 0.089 0.25449 0.083 0.26115 0.083 0.26781 C 0.083 0.27048 0.085 0.27448 0.088 0.27714 C 0.096 0.28514 0.112 0.28913 0.13 0.29046 C 0.152 0.29046 0.169 0.28514 0.169 0.27847 C 0.169 0.27048 0.152 0.26515 0.131 0.26382 C 0.12 0.26382 0.11 0.26515 0.103 0.26781 C 0.093 0.27048 0.087 0.27581 0.087 0.28247 C 0.087 0.28514 0.089 0.2878 0.092 0.29046"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-heartbeat"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.017 0 C 0.025 0 0.034 -0.01865 0.042 -0.02132 C 0.048 -0.02132 0.059 -0.004 0.064 -0.004 C 0.071 -0.004 0.078 -0.00933 0.091 -0.00933 L 0.1 -0.21585 L 0.11 0.03331 L 0.122 0 L 0.132 -0.00933 L 0.156 -0.00133 C 0.167 -0.00533 0.176 -0.02265 0.187 -0.02931 C 0.191 -0.03065 0.2 -0.03198 0.206 -0.02931 C 0.212 -0.02665 0.217 -0.00799 0.219 -0.00666 C 0.222 -0.00133 0.229 -0.00666 0.233 -0.004 L 0.239 0 L 0.25 0"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-left"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L -0.25 0"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-right"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.25 0"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-s-curve-1"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0 -0.04663 0.028 -0.08261 0.062 -0.08261 C 0.097 -0.08261 0.125 -0.04663 0.125 0 C 0.125 0.04663 0.153 0.08261 0.188 0.08261 C 0.222 0.08261 0.25 0.04663 0.25 0"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-s-curve-2"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0 0.04663 0.028 0.08261 0.062 0.08261 C 0.097 0.08261 0.125 0.04663 0.125 0 C 0.125 -0.04663 0.153 -0.08261 0.188 -0.08261 C 0.222 -0.08261 0.25 -0.04663 0.25 0"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-sine-wave"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.003 -0.02532 0.007 -0.0493 0.015 -0.0493 C 0.024 -0.0493 0.027 -0.02532 0.03 0 C 0.034 0.02798 0.037 0.05596 0.047 0.05596 C 0.056 0.05596 0.059 0.02798 0.063 0 C 0.065 -0.02532 0.069 -0.0493 0.078 -0.0493 C 0.086 -0.0493 0.09 -0.02532 0.093 0 C 0.096 0.02798 0.1 0.05596 0.109 0.05596 C 0.118 0.05596 0.125 0 0.125 0 C 0.128 -0.02532 0.131 -0.0493 0.14 -0.0493 C 0.149 -0.0493 0.152 -0.02532 0.155 0 C 0.159 0.02798 0.162 0.05596 0.172 0.05596 C 0.181 0.05596 0.184 0.02798 0.187 0 C 0.191 -0.02532 0.194 -0.0493 0.203 -0.0493 C 0.211 -0.0493 0.215 -0.02532 0.218 0 C 0.221 0.02798 0.225 0.05596 0.234 0.05596 C 0.243 0.05596 0.246 0.02798 0.25 0"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-spiral-left"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.004 -0.08927 -0.046 -0.16655 -0.113 -0.17188 C -0.177 -0.17854 -0.237 -0.11858 -0.241 -0.03198 C -0.246 0.04797 -0.204 0.12258 -0.144 0.12791 C -0.089 0.13191 -0.037 0.08261 -0.033 0.00799 C -0.029 -0.05996 -0.064 -0.12391 -0.115 -0.12924 C -0.162 -0.13324 -0.206 -0.09194 -0.209 -0.02931 C -0.212 0.02665 -0.184 0.08128 -0.142 0.08394 C -0.104 0.08794 -0.068 0.05596 -0.065 0.00533 C -0.063 -0.03997 -0.084 -0.08394 -0.117 -0.08661 C -0.146 -0.08927 -0.175 -0.06529 -0.177 -0.02665 C -0.179 0.00666 -0.164 0.03864 -0.14 0.0413 C -0.12 0.04397 -0.099 0.02931 -0.098 0.00266 C -0.096 -0.01865 -0.104 -0.0413 -0.119 -0.04397 C -0.131 -0.04397 -0.143 -0.03864 -0.145 -0.02398 C -0.146 -0.01466 -0.144 -0.00533 -0.138 -0.00133 C -0.135 0 -0.133 0 -0.13 -0.00133"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-spiral-right"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C -0.004 -0.08927 0.046 -0.16655 0.113 -0.17188 C 0.177 -0.17854 0.237 -0.11858 0.241 -0.03198 C 0.246 0.04797 0.204 0.12258 0.144 0.12791 C 0.089 0.13191 0.037 0.08261 0.033 0.00799 C 0.029 -0.05996 0.064 -0.12391 0.115 -0.12924 C 0.162 -0.13324 0.206 -0.09194 0.209 -0.02931 C 0.212 0.02665 0.184 0.08128 0.142 0.08394 C 0.104 0.08794 0.068 0.05596 0.065 0.00533 C 0.063 -0.03997 0.084 -0.08394 0.117 -0.08661 C 0.146 -0.08927 0.175 -0.06529 0.177 -0.02665 C 0.179 0.00666 0.164 0.03864 0.14 0.0413 C 0.12 0.04397 0.099 0.02931 0.098 0.00266 C 0.096 -0.01865 0.104 -0.0413 0.119 -0.04397 C 0.131 -0.04397 0.143 -0.03864 0.145 -0.02398 C 0.146 -0.01466 0.144 -0.00533 0.138 -0.00133 C 0.135 0 0.133 0 0.13 -0.00133"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-spring"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C -0.066 0.00799 -0.115 0.02798 -0.115 0.04397 C -0.115 0.05863 -0.067 0.06929 -0.003 0.06929 C 0.061 0.06929 0.115 0.05863 0.115 0.04397 C 0.115 0.02798 0.059 0.02398 -0.005 0.03464 C -0.068 0.04663 -0.115 0.06662 -0.115 0.08128 C -0.115 0.09593 -0.066 0.10793 -0.003 0.10793 C 0.061 0.10793 0.115 0.09593 0.115 0.08128 C 0.115 0.06662 0.059 0.06262 -0.004 0.07328 C -0.068 0.08394 -0.115 0.10393 -0.115 0.11858 C -0.115 0.13457 -0.066 0.14656 -0.002 0.14656 C 0.061 0.14656 0.115 0.13457 0.115 0.11858 C 0.115 0.10526 0.059 0.10126 -0.004 0.11059 C -0.067 0.12125 -0.115 0.14257 -0.115 0.15722 C -0.115 0.17188 -0.065 0.18387 -0.002 0.18387 C 0.063 0.18387 0.115 0.17188 0.115 0.15722 C 0.115 0.14257 0.06 0.13857 -0.003 0.14923 C -0.066 0.15989 -0.115 0.17988 -0.115 0.19453 C -0.115 0.21052 -0.065 0.22118 -0.001 0.22118 C 0.063 0.22118 0.115 0.20919 0.115 0.19453 C 0.115 0.17988 0.06 0.17588 -0.003 0.18654 C -0.066 0.1972 -0.115 0.21851 -0.115 0.23184 C -0.115 0.2465 -0.064 0.25849 -0.001 0.25849 C 0.063 0.25849 0.115 0.2465 0.115 0.23184 C 0.115 0.21851 0.061 0.21452 -0.003 0.22384 C -0.066 0.2345 -0.115 0.25582 -0.115 0.27048 C -0.115 0.2838 -0.064 0.29713 0 0.29713 C 0.064 0.29713 0.115 0.28514 0.115 0.27048 C 0.115 0.25582 0.061 0.25183 -0.002 0.26248 C -0.065 0.27314 -0.116 0.29313 -0.115 0.30779 C -0.114 0.32244 -0.064 0.3331 0 0.3331 C 0.064 0.3331 0.115 0.32111 0.115 0.30645 C 0.115 0.29313 0.063 0.28913 0 0.30112"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-stairs-down"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 l 0.036 0 l 0 0.04797 l 0.036 0 l 0 0.04797 l 0.036 0 l 0 0.04797 l 0.036 0 l 0 0.04797 l 0.036 0 l 0 0.04797 l 0.036 0 l 0 0.04797 l 0.036 0 l 0 0.04797"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-turn-down"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.125 0 C 0.181 0 0.25 0.09194 0.25 0.16655 L 0.25 0.3331"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-turn-down-right"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0 0.16655 C 0 0.24117 0.069 0.3331 0.125 0.3331 L 0.25 0.3331"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-turn-up"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.125 0 C 0.181 0 0.25 -0.09194 0.25 -0.16655 L 0.25 -0.3331"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-turn-up-right"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0 -0.16655 C 0 -0.24117 0.069 -0.3331 0.125 -0.3331 L 0.25 -0.3331"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-up"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0 -0.3331"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-wave"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.002 0.08394 0.009 0.1439 0.016 0.1439 C 0.023 0.1439 0.029 0.08394 0.031 0 C 0.034 0.08394 0.04 0.1439 0.047 0.1439 C 0.054 0.1439 0.06 0.08394 0.062 0 C 0.065 0.08394 0.071 0.1439 0.078 0.1439 C 0.085 0.1439 0.092 0.08394 0.094 0 C 0.096 0.08394 0.102 0.1439 0.11 0.1439 C 0.116 0.1439 0.123 0.08394 0.125 0 C 0.127 0.08394 0.134 0.1439 0.141 0.1439 C 0.148 0.1439 0.154 0.08394 0.156 0 C 0.159 0.08394 0.165 0.1439 0.172 0.1439 C 0.179 0.1439 0.185 0.08394 0.188 0 C 0.19 0.08394 0.196 0.1439 0.203 0.1439 C 0.21 0.1439 0.217 0.08394 0.219 0 C 0.221 0.08394 0.227 0.1439 0.235 0.1439 C 0.242 0.1439 0.248 0.08394 0.25 0"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-zigzag"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 L 0.016 0.13191 L 0.031 0 L 0.047 0.13191 L 0.063 0 L 0.078 0.13191 L 0.094 0 L 0.109 0.13191 L 0.125 0 L 0.141 0.13191 L 0.156 0 L 0.172 0.13191 L 0.187 0 L 0.203 0.13191 L 0.219 0 L 0.234 0.13191 L 0.25 0"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-bean"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.002 -0.004 0.012 -0.0453 0.037 -0.04264 C 0.075 -0.03864 0.09 -0.00933 0.125 -0.03864 C 0.147 -0.05596 0.173 -0.09993 0.192 -0.0986 C 0.235 -0.09727 0.244 -0.05196 0.244 -0.01066 C 0.245 0.04797 0.189 0.09727 0.121 0.1026 C 0.052 0.10659 -0.005 0.04397 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-buzz-saw"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C -0.022 -0.02265 -0.033 -0.06129 -0.027 -0.09993 C -0.024 -0.11325 -0.02 -0.12658 -0.014 -0.13724 C -0.01 -0.10659 0.004 -0.07861 0.025 -0.06129 C 0.025 -0.0986 0.041 -0.13457 0.068 -0.15056 C 0.077 -0.15722 0.087 -0.15989 0.097 -0.16122 C 0.082 -0.13857 0.074 -0.10659 0.077 -0.07328 C 0.099 -0.09727 0.13 -0.1026 0.157 -0.08527 C 0.166 -0.07994 0.175 -0.07062 0.181 -0.06129 C 0.158 -0.06396 0.134 -0.05196 0.117 -0.02798 C 0.144 -0.01999 0.167 0.00799 0.174 0.04663 C 0.176 0.05996 0.176 0.07328 0.174 0.08661 C 0.161 0.06129 0.139 0.04397 0.115 0.0413 C 0.127 0.07461 0.124 0.11592 0.106 0.14656 C 0.099 0.15722 0.091 0.16655 0.082 0.17188 C 0.089 0.14257 0.085 0.10926 0.072 0.08261 C 0.06 0.11592 0.034 0.13857 0.004 0.13857 C -0.007 0.13857 -0.017 0.13591 -0.026 0.13058 C -0.004 0.11992 0.013 0.0946 0.021 0.06396 C -0.007 0.07195 -0.036 0.05996 -0.055 0.02931 C -0.062 0.01732 -0.066 0.00533 -0.069 -0.00799 C -0.049 0.00933 -0.023 0.01199 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-curved-square"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0 -0.04264 0.026 -0.07728 0.058 -0.07728 L 0.192 -0.07728 C 0.224 -0.07728 0.25 -0.04264 0.25 0 L 0.25 0.17588 C 0.25 0.21851 0.224 0.25449 0.192 0.25449 L 0.058 0.25449 C 0.026 0.25449 0 0.21851 0 0.17588 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-curved-x"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.006 0.00799 0.011 0.01466 0.015 0.02265 C 0.02 0.01466 0.024 0.00799 0.03 0 C 0.065 -0.04663 0.107 -0.06662 0.124 -0.0453 C 0.14 -0.02265 0.125 0.03331 0.09 0.07994 C 0.084 0.08661 0.079 0.09327 0.073 0.09993 C 0.079 0.10526 0.084 0.11192 0.09 0.11992 C 0.125 0.16655 0.14 0.22251 0.124 0.24383 C 0.107 0.26648 0.065 0.2465 0.03 0.19986 C 0.024 0.19187 0.02 0.1852 0.015 0.17721 C 0.011 0.1852 0.006 0.19187 0 0.19986 C -0.035 0.2465 -0.077 0.26648 -0.094 0.24383 C -0.11 0.22251 -0.095 0.16655 -0.06 0.11992 C -0.054 0.11192 -0.049 0.10526 -0.043 0.09993 C -0.049 0.09327 -0.054 0.08661 -0.06 0.07994 C -0.095 0.03331 -0.11 -0.02265 -0.094 -0.0453 C -0.077 -0.06662 -0.035 -0.04663 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-curvy-star"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.072 0.07728 0.1 0.20253 0.077 0.31711 C -0.015 0.31045 -0.093 0.23051 -0.125 0.12125 C -0.047 0.0533 0.051 0.05729 0.125 0.12125 C 0.092 0.23717 0.011 0.31045 -0.077 0.31711 C -0.101 0.1972 -0.068 0.07461 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-figure-8-four"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.017 0 0.031 0.01865 0.031 0.0413 C 0.031 0.06529 0.017 0.08394 0 0.08394 C -0.017 0.08394 -0.031 0.1026 -0.031 0.12525 C -0.031 0.1479 -0.017 0.16655 0 0.16655 C 0.017 0.16655 0.031 0.1852 0.031 0.20786 C 0.031 0.23051 0.017 0.24916 0 0.24916 C -0.017 0.24916 -0.031 0.26781 -0.031 0.2918 C -0.031 0.31445 -0.017 0.3331 0 0.3331 C 0.017 0.3331 0.031 0.31445 0.031 0.2918 C 0.031 0.26781 0.017 0.24916 0 0.24916 C -0.017 0.24916 -0.031 0.23051 -0.031 0.20786 C -0.031 0.1852 -0.017 0.16655 0 0.16655 C 0.017 0.16655 0.031 0.1479 0.031 0.12525 C 0.031 0.1026 0.017 0.08394 0 0.08394 C -0.017 0.08394 -0.031 0.06529 -0.031 0.0413 C -0.031 0.01865 -0.017 0 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-horizontal-figure-8"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0 0.04397 0.027 0.07994 0.06 0.07994 C 0.099 0.07994 0.113 0.03997 0.119 0.01599 L 0.125 -0.01599 C 0.131 -0.03997 0.146 -0.07994 0.19 -0.07994 C 0.218 -0.07994 0.25 -0.04397 0.25 0 C 0.25 0.04397 0.218 0.07994 0.19 0.07994 C 0.146 0.07994 0.131 0.03997 0.125 0.01599 L 0.119 -0.01599 C 0.113 -0.03997 0.099 -0.07994 0.06 -0.07994 C 0.027 -0.07994 0 -0.04397 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-inverted-square"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.004 -0.00533 0.01 -0.00799 0.015 -0.00799 C 0.022 -0.00799 0.029 -0.004 0.033 0.00266 C 0.05 0.02931 0.063 0.08794 0.063 0.15722 C 0.063 0.15722 0.063 0.15856 0.063 0.15856 C 0.063 0.15856 0.063 0.15989 0.063 0.15989 C 0.063 0.22917 0.05 0.28913 0.033 0.31578 C 0.029 0.32111 0.022 0.32511 0.015 0.32511 C 0.01 0.32511 0.004 0.32244 0 0.31711 C -0.004 0.31178 -0.006 0.30512 -0.006 0.29713 C -0.006 0.2878 -0.003 0.27981 0.002 0.27448 C 0.022 0.25049 0.066 0.23317 0.118 0.23317 C 0.118 0.23317 0.119 0.23317 0.119 0.23317 C 0.119 0.23317 0.12 0.23317 0.12 0.23317 C 0.172 0.23317 0.217 0.25049 0.237 0.27448 C 0.241 0.27981 0.244 0.2878 0.244 0.29713 C 0.244 0.30512 0.242 0.31178 0.238 0.31711 C 0.234 0.32244 0.229 0.32511 0.223 0.32511 C 0.216 0.32511 0.21 0.32111 0.206 0.31578 C 0.188 0.28913 0.175 0.22917 0.175 0.15989 C 0.175 0.15989 0.175 0.15856 0.175 0.15856 C 0.175 0.15856 0.175 0.15722 0.175 0.15722 C 0.175 0.08794 0.188 0.02931 0.206 0.00133 C 0.21 -0.004 0.216 -0.00799 0.223 -0.00799 C 0.229 -0.00799 0.234 -0.00533 0.238 0 C 0.242 0.00533 0.244 0.01332 0.244 0.01999 C 0.244 0.02931 0.241 0.03731 0.237 0.04397 C 0.217 0.06662 0.172 0.08394 0.12 0.08394 C 0.12 0.08394 0.12 0.08394 0.119 0.08394 C 0.119 0.08394 0.118 0.08394 0.118 0.08394 C 0.066 0.08394 0.022 0.06662 0.002 0.04397 C -0.003 0.03731 -0.006 0.02931 -0.006 0.01999 C -0.006 0.01332 -0.004 0.00533 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-inverted-triangle"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.015 0.03198 0.037 0.06529 0.055 0.07861 C 0.082 0.09993 0.108 0.10793 0.113 0.09727 C 0.117 0.08661 0.099 0.05996 0.072 0.03864 C 0.054 0.02532 0.021 0.01599 -0.008 0.01466 C -0.036 0.01599 -0.07 0.02532 -0.088 0.03864 C -0.115 0.05996 -0.133 0.08661 -0.128 0.09727 C -0.123 0.10793 -0.097 0.09993 -0.071 0.07861 C -0.053 0.06529 -0.03 0.03198 -0.016 0 C -0.001 -0.03331 0.009 -0.07728 0.009 -0.10526 C 0.009 -0.1479 0.002 -0.18121 -0.008 -0.18121 C -0.017 -0.18121 -0.025 -0.1479 -0.025 -0.10526 C -0.025 -0.07728 -0.014 -0.03331 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-loop-de-loop"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.023 0.00133 0.042 0.01199 0.052 0.02798 L 0.075 0.06529 C 0.08 0.07328 0.088 0.07728 0.098 0.07728 C 0.112 0.07728 0.124 0.06662 0.125 0.05063 C 0.124 0.03731 0.112 0.02532 0.098 0.02532 C 0.088 0.02532 0.08 0.03065 0.075 0.03731 L 0.052 0.07461 C 0.042 0.0906 0.023 0.10126 0 0.1026 C -0.023 0.10126 -0.042 0.0906 -0.052 0.07461 L -0.075 0.03731 C -0.08 0.03065 -0.088 0.02532 -0.098 0.02532 C -0.112 0.02532 -0.124 0.03731 -0.125 0.05063 C -0.124 0.06662 -0.112 0.07728 -0.098 0.07728 C -0.088 0.07728 -0.08 0.07328 -0.075 0.06529 L -0.052 0.02798 C -0.042 0.01199 -0.023 0.00133 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-neutron"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.007 -0.01332 0.014 -0.02798 0.021 -0.04663 C 0.04 -0.09993 0.045 -0.15189 0.031 -0.15989 C 0.017 -0.16922 -0.01 -0.13191 -0.029 -0.07861 C -0.039 -0.05063 -0.045 -0.02398 -0.047 -0.004 C -0.05 0.01199 -0.051 0.02798 -0.051 0.04663 C -0.051 0.10659 -0.038 0.15589 -0.023 0.15589 C -0.008 0.15589 0.005 0.10659 0.005 0.04663 C 0.005 0.01865 0.002 -0.00799 -0.003 -0.02665 C -0.005 -0.04264 -0.01 -0.05996 -0.016 -0.07728 C -0.036 -0.13191 -0.063 -0.16922 -0.077 -0.15989 C -0.091 -0.15056 -0.086 -0.09993 -0.066 -0.0453 C -0.058 -0.01999 -0.047 0.00133 -0.036 0.01599 C -0.028 0.02931 -0.019 0.0413 -0.007 0.0533 C 0.029 0.09194 0.065 0.10926 0.075 0.09327 C 0.084 0.07728 0.064 0.03331 0.028 -0.004 C 0.013 -0.01999 -0.003 -0.03198 -0.016 -0.03997 C -0.028 -0.04797 -0.043 -0.05463 -0.059 -0.05863 C -0.103 -0.07195 -0.141 -0.06795 -0.144 -0.04663 C -0.148 -0.02665 -0.115 0 -0.071 0.01332 C -0.051 0.01865 -0.032 0.02132 -0.017 0.01999 C -0.004 0.01999 0.01 0.01732 0.025 0.01332 C 0.069 0 0.102 -0.02798 0.098 -0.04797 C 0.095 -0.06795 0.057 -0.07328 0.013 -0.05996 C -0.008 -0.0533 -0.027 -0.04397 -0.04 -0.03331 C -0.051 -0.02532 -0.062 -0.01599 -0.074 -0.004 C -0.109 0.03464 -0.13 0.07728 -0.12 0.09327 C -0.111 0.10926 -0.074 0.09194 -0.039 0.05463 C -0.022 0.03598 -0.008 0.01732 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-peanut"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.038 0 0.069 0.0413 0.069 0.09194 C 0.069 0.12525 0.056 0.15456 0.037 0.17188 C 0.037 0.17188 0.036 0.17188 0.036 0.17188 C 0.029 0.17854 0.025 0.1892 0.025 0.20119 C 0.025 0.21185 0.029 0.22118 0.034 0.22784 C 0.042 0.2385 0.047 0.25449 0.047 0.27048 C 0.047 0.30512 0.026 0.3331 0 0.3331 C -0.026 0.3331 -0.047 0.30512 -0.047 0.27048 C -0.047 0.25449 -0.042 0.2385 -0.034 0.22784 C -0.029 0.22118 -0.026 0.21185 -0.026 0.20119 C -0.026 0.1892 -0.03 0.17854 -0.036 0.17188 C -0.036 0.17188 -0.037 0.17188 -0.037 0.17188 C -0.057 0.15456 -0.07 0.12525 -0.07 0.09194 C -0.07 0.0413 -0.039 0 0 0 C 0 0 0 0 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-clover"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C -0.118 -0.15722 0.132 -0.15722 0.011 0 C 0.132 -0.15722 0.132 0.17588 0.011 0.01466 C 0.132 0.17588 -0.118 0.17588 0 0.01466 C -0.118 0.17588 -0.118 -0.15722 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-pointy-star"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.069 0 0.124 -0.07461 0.124 -0.16655 C 0.124 -0.07461 0.179 -0.00133 0.248 -0.00133 C 0.179 -0.00133 0.125 0.07461 0.125 0.16655 C 0.125 0.07461 0.069 0 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-swoosh"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0 0 0.017 -0.08661 0.017 -0.08661 C 0.034 -0.15722 0.061 -0.1852 0.1 -0.1852 C 0.12 -0.1852 0.138 -0.17455 0.152 -0.15722 C 0.162 -0.14523 0.174 -0.13857 0.187 -0.13857 C 0.212 -0.13857 0.233 -0.16255 0.241 -0.1972 C 0.241 -0.1972 0.25 -0.2385 0.25 -0.2385 C 0.25 -0.2385 0.232 -0.15056 0.232 -0.15056 C 0.215 -0.08128 0.188 -0.0533 0.15 -0.0533 C 0.13 -0.0533 0.111 -0.06396 0.096 -0.08261 C 0.087 -0.09327 0.075 -0.09993 0.063 -0.09993 C 0.038 -0.09993 0.017 -0.07595 0.009 -0.0413 C 0.009 -0.0413 0 0 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" smil:accelerate="0.5" smil:decelerate="0.5" pres:node-type="on-click" pres:preset-class="motion-path" pres:preset-id="ooo-motionpath-vertical-figure-8"> + <anim:animateMotion smil:dur="2" smil:fill="hold" svg:path="M 0 0 C 0.033 0 0.06 0.03598 0.06 0.07994 C 0.06 0.13191 0.03 0.15056 0.012 0.15856 L -0.012 0.16655 C -0.03 0.17455 -0.06 0.19453 -0.06 0.25316 C -0.06 0.29046 -0.033 0.3331 0 0.3331 C 0.033 0.3331 0.06 0.29046 0.06 0.25316 C 0.06 0.19453 0.03 0.17455 0.012 0.16655 L -0.012 0.15856 C -0.03 0.15056 -0.06 0.13191 -0.06 0.07994 C -0.06 0.03598 -0.033 0 0 0 Z"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-media-start"> + <anim:command smil:begin="0" smil:dur="0.001" smil:fill="hold" anim:command="play"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-media-stop"> + <anim:command smil:begin="0" smil:dur="0.001" smil:fill="hold" anim:command="stop"/> + </anim:par> + </anim:par> + </anim:par> + <anim:par smil:begin="indefinite" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold"> + <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-media-toggle-pause"> + <anim:command smil:begin="0" smil:dur="0.001" smil:fill="hold" anim:command="toggle-pause"/> + </anim:par> + </anim:par> + </anim:par> +</anim:seq> diff --git a/test/user-template/user/config/soffice.cfg/simpress/layoutlist.xml b/test/user-template/user/config/soffice.cfg/simpress/layoutlist.xml new file mode 100644 index 000000000..c458b1150 --- /dev/null +++ b/test/user-template/user/config/soffice.cfg/simpress/layoutlist.xml @@ -0,0 +1,86 @@ +<?xml version="1.0"?> +<!-- Configurable definitions of Impress slide layouts. + + Currently the layout type name needs to match a set of predefined strings. + Per entry, you can declare up to one Title object, and up to four + Outline objects. All values are relative to Impress' 'layout + rect', which is roughly 90% of the available slide area. +--> +<layout-list> + <layout type="AUTOLAYOUT_TITLE_CONTENT"> + <presobj kind="PRESOBJ_TITLE" relative-height="1" relative-width="1" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE1" relative-height="1" relative-width="1" relative-posX="0" relative-posY="0"/> + </layout> + <layout type="AUTOLAYOUT_TITLE_2CONTENT"> + <presobj kind="PRESOBJ_TITLE" relative-height="1" relative-width="1" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE1" relative-height="1" relative-width="0.488" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE2" relative-height="1" relative-width="0.488" relative-posX="1.05" relative-posY="0"/> + </layout> + <layout type="AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT"> + <presobj kind="PRESOBJ_TITLE" relative-height="1" relative-width="1" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE1" relative-height="0.477" relative-width="1" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE2" relative-height="0.477" relative-width="1" relative-posX="0" relative-posY="1.095"/> + </layout> + <layout type="AUTOLAYOUT_TITLE_CONTENT_2CONTENT"> + <presobj kind="PRESOBJ_TITLE" relative-height="1" relative-width="1" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE1" relative-height="1" relative-width="0.488" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE2" relative-height="0.477" relative-width="0.488" relative-posX="1.05" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE3" relative-height="0.477" relative-width="0.488" relative-posX="1.05" relative-posY="1.095"/> + </layout> + <layout type="AUTOLAYOUT_TITLE_4CONTENT"> + <presobj kind="PRESOBJ_TITLE" relative-height="1" relative-width="1" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE1" relative-height="0.477" relative-width="0.488" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE2" relative-height="0.477" relative-width="0.488" relative-posX="1.05" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE3" relative-height="0.477" relative-width="0.488" relative-posX="1.05" relative-posY="1.095"/> + <presobj kind="PRESOBJ_OUTLINE4" relative-height="0.477" relative-width="0.488" relative-posX="0" relative-posY="1.095"/> + </layout> + <layout type="AUTOLAYOUT_ONLY_TEXT"> + <presobj kind="PRESOBJ_OUTLINE1" relative-height="4.6354" relative-width="1" relative-posX="0" relative-posY="0"/> + </layout> + <layout type="AUTOLAYOUT_TITLE_ONLY"> + <presobj kind="PRESOBJ_TITLE" relative-height="1" relative-width="1" relative-posX="0" relative-posY="0"/> + </layout> + <layout type="AUTOLAYOUT_TITLE_6CONTENT"> + <presobj kind="PRESOBJ_TITLE" relative-height="1" relative-width="1" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE1" relative-height="0.477" relative-width="0.322" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE2" relative-height="0.477" relative-width="0.322" relative-posX="1.05" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE3" relative-height="0.477" relative-width="0.322" relative-posX="2.10" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE4" relative-height="0.477" relative-width="0.322" relative-posX="2.10" relative-posY="1.095"/> + <presobj kind="PRESOBJ_OUTLINE5" relative-height="0.477" relative-width="0.322" relative-posX="1.05" relative-posY="1.095"/> + <presobj kind="PRESOBJ_OUTLINE6" relative-height="0.477" relative-width="0.322" relative-posX="0" relative-posY="1.095"/> + </layout> + <layout type="AUTOLAYOUT_START"> + <presobj kind="PRESOBJ_TITLE" relative-height="1" relative-width="1" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE1" relative-height="1" relative-width="1" relative-posX="0" relative-posY="0"/> + </layout> + <layout type="AUTOLAYOUT_TITLE_2CONTENT_CONTENT"> + <presobj kind="PRESOBJ_TITLE" relative-height="1" relative-width="1" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE1" relative-height="0.477" relative-width="0.488" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE2" relative-height="0.477" relative-width="0.488" relative-posX="0" relative-posY="1.095"/> + <presobj kind="PRESOBJ_OUTLINE3" relative-height="1" relative-width="0.488" relative-posX="1.05" relative-posY="0"/> + </layout> + <layout type="AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT"> + <presobj kind="PRESOBJ_TITLE" relative-height="1" relative-width="1" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE1" relative-height="0.477" relative-width="0.488" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE2" relative-height="0.477" relative-width="0.488" relative-posX="1.05" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE3" relative-height="0.477" relative-width="1" relative-posX="0" relative-posY="1.095"/> + </layout> + <layout type="AUTOLAYOUT_VTITLE_VCONTENT"> + <presobj kind="PRESOBJ_TITLE" relative-height="4.6354" relative-width="0.139167" relative-posX="6.1856" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE1" relative-height="1.3347" relative-width="0.777778" relative-posX="0" relative-posY="-0.25078974"/> + </layout> + <layout type="AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT"> + <presobj kind="PRESOBJ_TITLE" relative-height="4.6354" relative-width="0.139167" relative-posX="6.1856" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE1" relative-height="0.6272578" relative-width="0.777778" relative-posX="0" relative-posY="-0.53363874"/> + <presobj kind="PRESOBJ_OUTLINE2" relative-height="0.6272578" relative-width="0.777778" relative-posX="0" relative-posY="0.5939791"/> + </layout> + <layout type="AUTOLAYOUT_TITLE_VCONTENT"> + <presobj kind="PRESOBJ_TITLE" relative-height="1" relative-width="1" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE1" relative-height="1" relative-width="1" relative-posX="0" relative-posY="0"/> + </layout> + <layout type="AUTOLAYOUT_TITLE_2VTEXT"> + <presobj kind="PRESOBJ_TITLE" relative-height="1" relative-width="1" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE1" relative-height="1" relative-width="0.488" relative-posX="0" relative-posY="0"/> + <presobj kind="PRESOBJ_OUTLINE2" relative-height="1" relative-width="0.488" relative-posX="1.05" relative-posY="0"/> + </layout> +</layout-list> diff --git a/test/user-template/user/config/soffice.cfg/simpress/objectlist.xml b/test/user-template/user/config/soffice.cfg/simpress/objectlist.xml new file mode 100644 index 000000000..40ecec350 --- /dev/null +++ b/test/user-template/user/config/soffice.cfg/simpress/objectlist.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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/. + * +--> +<object-list> + <object type="PRESOBJ_DATETIME"> + <object-prop pagekind="PK_STANDARD" relative-height="0.069" relative-width="0.233" relative-posX="0.05" relative-posY="0.911"/> + <object-prop pagekind="PK_HANDOUT" relative-height="0.05" relative-width="0.434" relative-posX="0.434" relative-posY="0"/> + <object-prop pagekind="PK_NOTES" relative-height="0.05" relative-width="0.434" relative-posX="0.434" relative-posY="0"/> + </object> + <object type="PRESOBJ_FOOTER"> + <object-prop pagekind="PK_STANDARD" relative-height="0.069" relative-width="0.317" relative-posX="0.342" relative-posY="0.911"/> + <object-prop pagekind="PK_HANDOUT" relative-height="0.05" relative-width="0.434" relative-posX="0" relative-posY="0.05"/> + <object-prop pagekind="PK_NOTES" relative-height="0.05" relative-width="0.434" relative-posX="0" relative-posY="0.05"/> + </object> + <object type="PRESOBJ_SLIDENUMBER"> + <object-prop pagekind="PK_STANDARD" relative-height="0.069" relative-width="0.233" relative-posX="0.717" relative-posY="0.911"/> + <object-prop pagekind="PK_HANDOUT" relative-height="0.05" relative-width="0.434" relative-posX="0.434" relative-posY="0.05"/> + <object-prop pagekind="PK_NOTES" relative-height="0.05" relative-width="0.434" relative-posX="0.434" relative-posY="0.05"/> + </object> + <object type="PRESOBJ_HEADER"> + <object-prop pagekind="PK_STANDARD" relative-height="0.069" relative-width="0.317" relative-posX="0.717" relative-posY="0.911"/> + <object-prop pagekind="PK_HANDOUT" relative-height="0.05" relative-width="0.434" relative-posX="0" relative-posY="0"/> + <object-prop pagekind="PK_NOTES" relative-height="0.05" relative-width="0.434" relative-posX="0" relative-posY="0"/> + </object> + <object type="PRESOBJ_TITLE"> + <object-prop pagekind="PK_STANDARD" relative-height="0.167" relative-width="0.9" relative-posX="0.05" relative-posY="0.0399"/> + <object-prop pagekind="PK_NOTES" relative-height="0.375" relative-width="1" relative-posX="0" relative-posY="0.076"/> + </object> + <object type="PRESOBJ_OUTLINE"> + <object-prop pagekind="PK_STANDARD" relative-height="0.58" relative-width="0.9" relative-posX="0.05" relative-posY="0.234"/> + </object> + <object type="PRESOBJ_NOTES"> + <object-prop pagekind="PK_NOTES" relative-height="0.45" relative-width="0.8" relative-posX="0.1" relative-posY="0.475"/> + </object> +</object-list>
\ No newline at end of file diff --git a/test/user-template/user/config/soffice.cfg/simpress/transitions-ogl.xml b/test/user-template/user/config/soffice.cfg/simpress/transitions-ogl.xml new file mode 100644 index 000000000..ca1e3661c --- /dev/null +++ b/test/user-template/user/config/soffice.cfg/simpress/transitions-ogl.xml @@ -0,0 +1,48 @@ +<?xml version="1.0"?> +<anim:seq xmlns:office="urn:oasis:names:tc:openoffice:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:openoffice:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:openoffice:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:openoffice:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:openoffice:xmlns:drawing:1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:openoffice:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:openoffice:xmlns:datastyle:1.0" xmlns:pres="urn:oasis:names:tc:openoffice:xmlns:presentation:1.0" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="urn:oasis:names:tc:openoffice:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:openoffice:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:openoffice:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:openoffice:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:smil="http://www.w3.org/2001/SMIL20" xmlns:anim="urn:oasis:names:tc:openoffice:xmlns:animation:1.0" pres:node-type="main-sequence"> + <anim:par pres:preset-id="tile-flip"> + <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="across"/> + </anim:par> + <anim:par pres:preset-id="outside-cube"> + <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="cornersOut"/> + </anim:par> + <anim:par pres:preset-id="revolving-circles"> + <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="circle"/> + </anim:par> + <anim:par pres:preset-id="turning-helix"> + <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="fanOutHorizontal"/> + </anim:par> + <anim:par pres:preset-id="inside-cube"> + <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="cornersIn"/> + </anim:par> + <anim:par pres:preset-id="fall"> + <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="leftToRight"/> + </anim:par> + <anim:par pres:preset-id="turn-around"> + <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="topToBottom"/> + </anim:par> + <anim:par pres:preset-id="iris"> + <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="topLeft"/> + </anim:par> + <anim:par pres:preset-id="turn-down"> + <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="topRight"/> + </anim:par> + <anim:par pres:preset-id="rochade"> + <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="bottomRight"/> + </anim:par> + <anim:par pres:preset-id="venetian3dv"> + <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="bottomLeft"/> + </anim:par> + <anim:par pres:preset-id="venetian3dh"> + <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="topCenter"/> + </anim:par> + <anim:par pres:preset-id="static"> + <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="rightCenter"/> + </anim:par> + <anim:par pres:preset-id="finedissolve"> + <anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="bottomCenter"/> + </anim:par> + <anim:par pres:preset-id="zoom-rotate-in"> + <anim:transitionFilter smil:type="zoom" smil:subtype="rotateIn"/> + </anim:par> + </anim:seq> diff --git a/test/user-template/user/config/soffice.cfg/simpress/transitions.xml b/test/user-template/user/config/soffice.cfg/simpress/transitions.xml new file mode 100644 index 000000000..556eb6f50 --- /dev/null +++ b/test/user-template/user/config/soffice.cfg/simpress/transitions.xml @@ -0,0 +1,225 @@ +<?xml version="1.0"?> +<anim:seq xmlns:office="urn:oasis:names:tc:openoffice:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:openoffice:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:openoffice:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:openoffice:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:openoffice:xmlns:drawing:1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:openoffice:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:openoffice:xmlns:datastyle:1.0" xmlns:pres="urn:oasis:names:tc:openoffice:xmlns:presentation:1.0" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="urn:oasis:names:tc:openoffice:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:openoffice:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:openoffice:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:openoffice:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:smil="http://www.w3.org/2001/SMIL20" xmlns:anim="urn:oasis:names:tc:openoffice:xmlns:animation:1.0" pres:node-type="main-sequence"> + <anim:par pres:preset-id="wipe-up"> + <anim:transitionFilter smil:type="barWipe" smil:subtype="topToBottom" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="wipe-right"> + <anim:transitionFilter smil:type="barWipe" smil:subtype="leftToRight"/> + </anim:par> + <anim:par pres:preset-id="wipe-left"> + <anim:transitionFilter smil:type="barWipe" smil:subtype="leftToRight" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="wipe-down"> + <anim:transitionFilter smil:type="barWipe" smil:subtype="topToBottom"/> + </anim:par> + <anim:par pres:preset-id="wheel-clockwise-1-spoke"> + <anim:transitionFilter smil:type="pinWheelWipe" smil:subtype="oneBlade"/> + </anim:par> + <anim:par pres:preset-id="wheel-clockwise-2-spokes"> + <anim:transitionFilter smil:type="pinWheelWipe" smil:subtype="twoBladeVertical"/> + </anim:par> + <anim:par pres:preset-id="wheel-clockwise-3-spokes"> + <anim:transitionFilter smil:type="pinWheelWipe" smil:subtype="threeBlade"/> + </anim:par> + <anim:par pres:preset-id="wheel-clockwise-4-spokes"> + <anim:transitionFilter smil:type="pinWheelWipe" smil:subtype="fourBlade"/> + </anim:par> + <anim:par pres:preset-id="wheel-clockwise-8-spokes"> + <anim:transitionFilter smil:type="pinWheelWipe" smil:subtype="eightBlade"/> + </anim:par> + <anim:par pres:preset-id="uncover-down"> + <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromTop" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="uncover-left"> + <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromRight" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="uncover-right"> + <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromLeft" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="uncover-up"> + <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromBottom" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="uncover-left-down"> + <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromTopRight" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="uncover-left-up"> + <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromBottomRight" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="uncover-right-down"> + <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromTopLeft" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="uncover-right-up"> + <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromBottomLeft" smil:direction="reverse"/> + </anim:par> +<!-- <anim:par pres:preset-id="barn-inVertical"> --> +<!-- <anim:transitionFilter smil:type="barnDoorWipe" smil:subtype="vertical"/> --> +<!-- </anim:par> --> +<!-- <anim:par pres:preset-id="barn-outVertical"> --> +<!-- <anim:transitionFilter smil:type="barnDoorWipe" smil:subtype="vertical" smil:direction="reverse"/> --> +<!-- </anim:par> --> +<!-- <anim:par pres:preset-id="barn-inHorizontal"> --> +<!-- <anim:transitionFilter smil:type="barnDoorWipe" smil:subtype="horizontal"/> --> +<!-- </anim:par> --> +<!-- <anim:par pres:preset-id="barn-outHorizontal"> --> +<!-- <anim:transitionFilter smil:type="barnDoorWipe" smil:subtype="horizontal" smil:direction="reverse"/> --> +<!-- </anim:par> --> + <anim:par pres:preset-id="random-bars-vertical"> + <anim:transitionFilter smil:type="randomBarWipe" smil:subtype="vertical"/>}, + </anim:par> + <anim:par pres:preset-id="random-bars-horizontal"> + <anim:transitionFilter smil:type="randomBarWipe" smil:subtype="horizontal"/> + </anim:par> + <anim:par pres:preset-id="checkerboard-down"> + <anim:transitionFilter smil:type="checkerBoardWipe" smil:subtype="down"/>}, + </anim:par> + <anim:par pres:preset-id="checkerboard-across"> + <anim:transitionFilter smil:type="checkerBoardWipe" smil:subtype="across"/> + </anim:par> + <anim:par pres:preset-id="shape-plus"> + <anim:transitionFilter smil:type="fourBoxWipe" smil:subtype="cornersOut"/> + </anim:par> +<!-- <anim:par pres:preset-id="plus-in"> --> +<!-- <anim:transitionFilter smil:type="fourBoxWipe" smil:subtype="cornersIn"/> --> +<!-- </anim:par> --> + <anim:par pres:preset-id="shape-diamond"> + <anim:transitionFilter smil:type="irisWipe" smil:subtype="diamond"/> + </anim:par> +<!-- <anim:par pres:preset-id="diamond-in"> --> +<!-- <anim:transitionFilter smil:type="irisWipe" smil:subtype="diamond" smil:direction="reverse"/> --> +<!-- </anim:par> --> + <anim:par pres:preset-id="shape-circle"> + <anim:transitionFilter smil:type="ellipseWipe" smil:subtype="circle"/> + </anim:par> +<!-- <anim:par pres:preset-id="circle-in"> --> +<!-- <anim:transitionFilter smil:type="ellipseWipe" smil:subtype="circle" smil:direction="reverse"/> --> +<!-- </anim:par> --> + <anim:par pres:preset-id="box-out"> + <anim:transitionFilter smil:type="irisWipe" smil:subtype="rectangle"/> + </anim:par> + <anim:par pres:preset-id="box-in"> + <anim:transitionFilter smil:type="irisWipe" smil:subtype="rectangle" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="wedge"> + <anim:transitionFilter smil:type="fanWipe" smil:subtype="centerTop"/> + </anim:par> + <anim:par pres:preset-id="venetian-blinds-vertical"> + <anim:transitionFilter smil:type="blindsWipe" smil:subtype="vertical"/> + </anim:par> + <anim:par pres:preset-id="venetian-blinds-horizontal"> + <anim:transitionFilter smil:type="blindsWipe" smil:subtype="horizontal"/> + </anim:par> + <anim:par pres:preset-id="fade-through-black"> + <anim:transitionFilter smil:type="fade" smil:subtype="fadeOverColor" smil:fadeColor="#000000"/> + </anim:par> + <anim:par pres:preset-id="cut-through-black"> + <anim:transitionFilter smil:type="barWipe" smil:subtype="fadeOverColor" smil:fadeColor="#000000"/> + </anim:par> + <anim:par pres:preset-id="cover-down"> + <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromTop"/> + </anim:par> + <anim:par pres:preset-id="cover-left"> + <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromRight"/> + </anim:par> + <anim:par pres:preset-id="cover-right"> + <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromLeft"/> + </anim:par> + <anim:par pres:preset-id="cover-up"> + <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromBottom"/> + </anim:par> + <anim:par pres:preset-id="cover-left-down"> + <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromTopRight"/> + </anim:par> + <anim:par pres:preset-id="cover-left-up"> + <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromBottomRight"/> + </anim:par> + <anim:par pres:preset-id="cover-right-down"> + <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromTopLeft"/> + </anim:par> + <anim:par pres:preset-id="cover-right-up"> + <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromBottomLeft"/> + </anim:par> + <anim:par pres:preset-id="dissolve"> + <anim:transitionFilter smil:type="dissolve" smil:subtype="default"/> + </anim:par> + <anim:par pres:preset-id="random-transition"> + <anim:transitionFilter smil:type="random"/> + </anim:par> + <!--anim:par pres:preset-id="zoom-rotate-in"> + <anim:transitionFilter smil:type="zoom" smil:subtype="rotateIn"/> + </anim:par--> + <anim:par pres:preset-id="clock-wipe-twelve"> + <anim:transitionFilter smil:type="clockWipe" smil:subtype="clockwiseTwelve"/> + </anim:par> + <anim:par pres:preset-id="reverse-clock-wipe-twelve"> + <anim:transitionFilter smil:type="clockWipe" smil:subtype="clockwiseTwelve" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="spiral-wipe-top-left-clockwise"> + <anim:transitionFilter smil:type="spiralWipe" smil:subtype="topLeftClockwise"/> + </anim:par> + <anim:par pres:preset-id="spiral-wipe-top-right-counter-clockwise"> + <anim:transitionFilter smil:type="spiralWipe" smil:subtype="topRightCounterClockwise"/> + </anim:par> + <anim:par pres:preset-id="spiral-wipe-out-to-bottom-right-clockwise"> + <anim:transitionFilter smil:type="spiralWipe" smil:subtype="bottomRightCounterClockwise" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="spiral-wipe-out-to-bottom-left-counter-clockwise"> + <anim:transitionFilter smil:type="spiralWipe" smil:subtype="bottomLeftClockwise" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="snake-wipe-top-left-vertical"> + <anim:transitionFilter smil:type="snakeWipe" smil:subtype="topLeftVertical"/> + </anim:par> + <anim:par pres:preset-id="snake-wipe-top-left-horizontal"> + <anim:transitionFilter smil:type="snakeWipe" smil:subtype="topLeftHorizontal"/> + </anim:par> + <anim:par pres:preset-id="snake-wipe-bottom-right-vertical"> + <anim:transitionFilter smil:type="snakeWipe" smil:subtype="topLeftVertical" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="snake-wipe-bottom-right-horizontal"> + <anim:transitionFilter smil:type="snakeWipe" smil:subtype="topLeftHorizontal" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="comb-horizontal"> + <anim:transitionFilter smil:type="pushWipe" smil:subtype="combHorizontal"/> + </anim:par> + <anim:par pres:preset-id="comb-vertical"> + <anim:transitionFilter smil:type="pushWipe" smil:subtype="combVertical"/> + </anim:par> + <anim:par pres:preset-id="fade-smoothly"> + <anim:transitionFilter smil:type="fade" smil:subtype="crossfade"/> + </anim:par> + <anim:par pres:preset-id="push-down"> + <anim:transitionFilter smil:type="pushWipe" smil:subtype="fromTop"/> + </anim:par> + <anim:par pres:preset-id="push-left"> + <anim:transitionFilter smil:type="pushWipe" smil:subtype="fromRight"/> + </anim:par> + <anim:par pres:preset-id="push-right"> + <anim:transitionFilter smil:type="pushWipe" smil:subtype="fromLeft"/> + </anim:par> + <anim:par pres:preset-id="push-up"> + <anim:transitionFilter smil:type="pushWipe" smil:subtype="fromBottom"/> + </anim:par> + <anim:par pres:preset-id="split-horizontal-in"> + <anim:transitionFilter smil:type="barnDoorWipe" smil:subtype="horizontal" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="split-horizontal-out"> + <anim:transitionFilter smil:type="barnDoorWipe" smil:subtype="horizontal"/> + </anim:par> + <anim:par pres:preset-id="split-vertical-in"> + <anim:transitionFilter smil:type="barnDoorWipe" smil:subtype="vertical" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="split-vertical-out"> + <anim:transitionFilter smil:type="barnDoorWipe" smil:subtype="vertical"/> + </anim:par> + <anim:par pres:preset-id="diagonal-squares-left-down"> + <anim:transitionFilter smil:type="waterfallWipe" smil:subtype="horizontalRight"/> + </anim:par> + <anim:par pres:preset-id="diagonal-squares-left-up"> + <anim:transitionFilter smil:type="waterfallWipe" smil:subtype="horizontalLeft" smil:direction="reverse"/> + </anim:par> + <anim:par pres:preset-id="diagonal-squares-right-down"> + <anim:transitionFilter smil:type="waterfallWipe" smil:subtype="horizontalLeft"/> + </anim:par> + <anim:par pres:preset-id="diagonal-squares-right-up"> + <anim:transitionFilter smil:type="waterfallWipe" smil:subtype="horizontalRight" smil:direction="reverse"/> + </anim:par> + </anim:seq> diff --git a/test/user-template/user/database/biblio.odb b/test/user-template/user/database/biblio.odb Binary files differnew file mode 100644 index 000000000..199fd6f5f --- /dev/null +++ b/test/user-template/user/database/biblio.odb diff --git a/test/user-template/user/database/biblio/biblio.dbf b/test/user-template/user/database/biblio/biblio.dbf Binary files differnew file mode 100644 index 000000000..4161cea25 --- /dev/null +++ b/test/user-template/user/database/biblio/biblio.dbf diff --git a/test/user-template/user/database/biblio/biblio.dbt b/test/user-template/user/database/biblio/biblio.dbt Binary files differnew file mode 100644 index 000000000..e17daea26 --- /dev/null +++ b/test/user-template/user/database/biblio/biblio.dbt diff --git a/test/user-template/user/wordbook/en-GB.dic b/test/user-template/user/wordbook/en-GB.dic new file mode 100644 index 000000000..6f5945371 --- /dev/null +++ b/test/user-template/user/wordbook/en-GB.dic @@ -0,0 +1,46 @@ +OOoUserDict1 +lang: en-GB +type: positive +--- +Applet +Applets +AutoAbstract +AutoComplete +AutoFill +AutoMail +AutoPilots +AutoSpell +AutoUpdate +Bitmap +Clientsided +ClipArt +ClipArts +Combobox +Euro +FontManager +Fontwork +Frameset +Framesets +GIFs +HelpAgent +HighEnd +Homepage +Http +Hyperlink +Hyperlinks +ImageMaps +Imagemap +Intranet +PlugIns +Plugin +PreFinal +Serversided +ServicePack +TabPage +deinstall +deinstalled +deinstalling +deinstalls +userspace +endian +endianness diff --git a/test/user-template/user/wordbook/en-US.dic b/test/user-template/user/wordbook/en-US.dic new file mode 100644 index 000000000..4aa77f9c9 --- /dev/null +++ b/test/user-template/user/wordbook/en-US.dic @@ -0,0 +1,46 @@ +OOoUserDict1 +lang: en-US +type: positive +--- +Applet +Applets +AutoAbstract +AutoComplete +AutoFill +AutoMail +AutoPilots +AutoSpell +AutoUpdate +Bitmap +Clientsided +ClipArt +ClipArts +Combobox +Euro +FontManager +Fontwork +Frameset +Framesets +GIFs +HelpAgent +HighEnd +Homepage +Http +Hyperlink +Hyperlinks +ImageMaps +Imagemap +Intranet +PlugIns +Plugin +PreFinal +Serversided +ServicePack +TabPage +deinstall +deinstalled +deinstalling +deinstalls +userspace +endian +endianness diff --git a/test/user-template/user/wordbook/sl.dic b/test/user-template/user/wordbook/sl.dic new file mode 100644 index 000000000..4c2100a99 --- /dev/null +++ b/test/user-template/user/wordbook/sl.dic @@ -0,0 +1,24 @@ +OOoUserDict1 +lang: sl +type: positive +--- +avtopiloti +hiperpovezav +hiperpovezava +hiperpovezavam +hiperpovezavama +hiperpovezavami +hiperpovezave +hiperpovezavi +hiperpovezavo +intranet +samooblikovanj +samooblikovanja +samooblikovanje +samooblikovanju +samopopravka +samopopravki +samopopravkom +samopopravkoma +samopopravkov +samopopravku diff --git a/test/user-template/user/wordbook/technical.dic b/test/user-template/user/wordbook/technical.dic new file mode 100644 index 000000000..383c6689c --- /dev/null +++ b/test/user-template/user/wordbook/technical.dic @@ -0,0 +1,230 @@ +OOoUserDict1 +lang: <none> +type: positive +--- +Accenture +Acer +Acrobat +Add-in +Adobe +Advanced +AMD +Android +AppArmor +AppConnect= +Apple +AppWizard= +AppXaminer= +AppXNavigator= +AppXRay= +Argus= +Asus +AutoVue= +Badger +Base= +Base24= +Bing +BorderManager +Breezy +CADView= +Calc= +Canon +Canonical +Capgemini +Carefx +Chrome +Cisco= +Clickstream= +Cognos= +Connect2OracleSelf= +ConsoleOne +ConText= +COREid= +Corporation +Dapper +dBase +Debian +debootstrap +Dell +Devices +DocLink +Docuflex= +Documaker= +Document +dpkg +Drake +Draw= +Edgy +eDirectory +Edubuntu +Eft +eGuide +Electronics +Etch +Ethernet +Evolution +Exadata= +Facebook +Fawn +Feisty +Firebird +Firefox +FLAC +Flash +Foundation +Foxconn +FreeBSD +Fujitsu +gcc +gcj +Gibbon +GIF +gij +GNOME +GNU +Google +GPS +GroupWise +Gutsy +Hardy +Hedgehog +Heron +Hewlett-Packard +Hi-Fi +Hitachi +Hoary +HP +HTML +Ibex +IBM +iChain +Identi.ca +iFolder +iManager +Impress= +Intel +Intrepid +iPrint +Jackalope +Jaunty +JavaScript +JPEG +Karmic +KDE +Kerberos +Koala +Kubuntu +Launchpad +LDAP +Lenny +Lenovo +LibreOffice= +Linux +Lucid +Lynx +Malone +ManageWise +MasterCard +Math= +Maverick +Meerkat +Micro +Microsoft= +MicroStrategy= +Mono +Motorola +Mozilla +MySQL +NCSA +NEC +NetBSD +NetIdentity +NetMail +NetStorage +NetWare +NNTP +Nokia +Novell +NRadius +ODBC +Ogg +OnDemand +OpenBSD +OpenDocument= +OpenOffice.org= +openSUSE +OpenText= +OpenWorld= +OpenZorg= +Opera +Optronics +Oracle= +Panasonic +PayPal +PeopleSoft= +Plug-in +PNG +PolyServe +POP3 +PostgreSQL +PPPoE +Quanta +Rosetta +RosettaNet= +rpm +Samba +Samsung +SAP +Sarge +Satmetrix= +SecretStore +SecureLogin +Sharp +Shockwave +Sid +Skype +SLED +SLES +SMTP +Sony +Soyuz +Spamassassin +SPI +Squeeze +StarOffice +StorageTek= +Sun= +SunHSI= +SunSAI= +SUSE +TeliaSonera +The +Thunderbird +Toshiba +TrueType +Twitter +Ubuntu +uname +URL +Visa +VoIP= +Vorbis +VRML +Warthog +Warty +Wheezy +Wi-Fi +WiMAX +Windows +Woody +WorkPlace +Writer= +WYSIWYG +Xen +Ximian +Xtensible +XTier +Xubuntu +Yahoo +YouTube +ZENworks diff --git a/testtools/CustomTarget_bridgetest.mk b/testtools/CustomTarget_bridgetest.mk new file mode 100644 index 000000000..9329281d7 --- /dev/null +++ b/testtools/CustomTarget_bridgetest.mk @@ -0,0 +1,92 @@ +# -*- 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_CustomTarget_CustomTarget,testtools/bridgetest)) + +testtools_BRIDGEDIR := $(call gb_CustomTarget_get_workdir,testtools/bridgetest) + +ifeq ($(OS),WNT) +testtools_BATCHSUFFIX := .bat +else +testtools_BATCHSUFFIX := +endif + +$(call gb_CustomTarget_get_target,testtools/bridgetest) : \ + $(testtools_BRIDGEDIR)/bridgetest_server$(testtools_BATCHSUFFIX) \ + $(testtools_BRIDGEDIR)/bridgetest_client$(testtools_BATCHSUFFIX) \ + $(if $(ENABLE_JAVA),\ + $(testtools_BRIDGEDIR)/bridgetest_javaserver$(testtools_BATCHSUFFIX) \ + $(testtools_BRIDGEDIR)/bridgetest_inprocess_java$(testtools_BATCHSUFFIX)) + +$(testtools_BRIDGEDIR)/bridgetest_server$(testtools_BATCHSUFFIX) :| $(testtools_BRIDGEDIR)/.dir + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ECH,1) + $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),ECH) + $(call gb_Helper_abbreviate_dirs,\ + echo \ + "$(call gb_Executable_get_target_for_build,uno)" \ + "-s com.sun.star.test.bridge.CppTestObject" \ + "-u 'uno:socket$(COMMA)host=127.0.0.1$(COMMA)port=2002;urp;test'" \ + "--singleaccept" \ + "-env:LO_BUILD_LIB_DIR=$(call gb_Helper_make_url,$(gb_Library_WORKDIR_FOR_BUILD))" \ + "-env:URE_MORE_SERVICES=$(call gb_Helper_make_url,$(call gb_Rdb_get_target,uno_services))" \ + "-env:URE_MORE_TYPES=$(call gb_Helper_make_url,$(WORKDIR)/UnoApiTarget/bridgetest.rdb)" \ + > $@) + $(if $(filter-out WNT,$(OS)),chmod +x $@) + $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),ECH) + + +testtools_MY_CLASSPATH := $(call gb_Jar_get_target,ridl)$(gb_CLASSPATHSEP)$(call gb_Jar_get_target,java_uno)$(gb_CLASSPATHSEP)$(call gb_Jar_get_target,juh) + +$(testtools_BRIDGEDIR)/bridgetest_javaserver$(testtools_BATCHSUFFIX) :| $(testtools_BRIDGEDIR)/.dir + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ECH,1) + $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),ECH) + $(call gb_Helper_abbreviate_dirs,\ + echo \ + "URE_MORE_SERVICES=$(call gb_Helper_make_url,$(call gb_Rdb_get_target,uno_services))" \ + "URE_MORE_TYPES=$(call gb_Helper_make_url,$(WORKDIR)/UnoApiTarget/bridgetest.rdb)" \ + "java" \ + "-classpath $(testtools_MY_CLASSPATH)$(gb_CLASSPATHSEP)$(call gb_Jar_get_target,testComponent)" \ + "com.sun.star.comp.bridge.TestComponentMain" \ + \""uno:socket$(COMMA)host=127.0.0.1$(COMMA)port=2002;urp;test"\" \ + "singleaccept" \ + > $@) + $(if $(filter-out WNT,$(OS)),chmod +x $@) + $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),ECH) + +$(testtools_BRIDGEDIR)/bridgetest_inprocess_java$(testtools_BATCHSUFFIX) :| $(testtools_BRIDGEDIR)/.dir + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ECH,1) + $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),ECH) + $(call gb_Helper_abbreviate_dirs,\ + echo "JAVA_HOME=$(JAVA_HOME)" \ + "$(call gb_Executable_get_target_for_build,uno)" \ + "-s com.sun.star.test.bridge.BridgeTest" \ + "-env:LO_BUILD_LIB_DIR=$(call gb_Helper_make_url,$(gb_Library_WORKDIR_FOR_BUILD))" \ + "-env:URE_MORE_SERVICES=$(call gb_Helper_make_url,$(call gb_Rdb_get_target,uno_services))" \ + "-env:URE_MORE_TYPES=$(call gb_Helper_make_url,$(WORKDIR)/UnoApiTarget/bridgetest.rdb)" \ + "-- com.sun.star.test.bridge.JavaTestObject noCurrentContext" \ + > $@) + $(if $(filter-out WNT,$(OS)),chmod +x $@) + $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),ECH) + +$(testtools_BRIDGEDIR)/bridgetest_client$(testtools_BATCHSUFFIX) :| $(testtools_BRIDGEDIR)/.dir + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ECH,1) + $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),ECH) + $(call gb_Helper_abbreviate_dirs,\ + echo \ + "$(call gb_Executable_get_target_for_build,uno)" \ + "-s com.sun.star.test.bridge.BridgeTest --" \ + "-u 'uno:socket$(COMMA)host=127.0.0.1$(COMMA)port=2002;urp;test'" \ + "-env:LO_BUILD_LIB_DIR=$(call gb_Helper_make_url,$(gb_Library_WORKDIR_FOR_BUILD))" \ + "-env:URE_MORE_SERVICES=$(call gb_Helper_make_url,$(call gb_Rdb_get_target,uno_services))" \ + "-env:URE_MORE_TYPES=$(call gb_Helper_make_url,$(WORKDIR)/UnoApiTarget/bridgetest.rdb)" \ + > $@) + $(if $(filter-out WNT,$(OS)),chmod +x $@) + $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),ECH) + +# vim: set noet sw=4 ts=4: diff --git a/testtools/CustomTarget_bridgetest_climaker.mk b/testtools/CustomTarget_bridgetest_climaker.mk new file mode 100644 index 000000000..aa1336e24 --- /dev/null +++ b/testtools/CustomTarget_bridgetest_climaker.mk @@ -0,0 +1,33 @@ +# -*- 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_CustomTarget_CustomTarget,testtools/bridgetest_climaker)) + +testtools_CLIDIR := $(call gb_CustomTarget_get_workdir,testtools/bridgetest_climaker) + +$(call gb_CustomTarget_get_target,testtools/bridgetest_climaker) : \ + $(testtools_CLIDIR)/cli_types_bridgetest.dll + +$(testtools_CLIDIR)/cli_types_bridgetest.dll : \ + $(call gb_UnoApiTarget_get_target,bridgetest) \ + $(call gb_UnoApiTarget_get_target,udkapi) \ + $(call gb_CliUnoApi_get_target,cli_uretypes) \ + $(call gb_Executable_get_runtime_dependencies,climaker) \ + | $(testtools_CLIDIR)/.dir + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CLM,1) + $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),CLM) + $(call gb_Helper_abbreviate_dirs, \ + $(call gb_Helper_execute,climaker) \ + $(if $(filter -s,$(MAKEFLAGS)),,--verbose) \ + --out $@ -r $(call gb_CliUnoApi_get_target,cli_uretypes) \ + -X $(call gb_UnoApiTarget_get_target,udkapi) \ + $(call gb_UnoApiTarget_get_target,bridgetest) > /dev/null) + $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),CLM) + +# vim:set shiftwidth=4 tabstop=4 noexpandtab: diff --git a/testtools/CustomTarget_bridgetest_javamaker.mk b/testtools/CustomTarget_bridgetest_javamaker.mk new file mode 100644 index 000000000..0ab401551 --- /dev/null +++ b/testtools/CustomTarget_bridgetest_javamaker.mk @@ -0,0 +1,29 @@ +# -*- 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_CustomTarget_CustomTarget,testtools/bridgetest_javamaker)) + +testtools_JAVADIR := $(call gb_CustomTarget_get_workdir,testtools/bridgetest_javamaker) + +$(call gb_CustomTarget_get_target,testtools/bridgetest_javamaker) : $(testtools_JAVADIR)/done + +$(testtools_JAVADIR)/done : \ + $(call gb_UnoApiTarget_get_target,bridgetest) \ + $(call gb_UnoApiTarget_get_target,performance) \ + $(call gb_UnoApiTarget_get_target,udkapi) \ + $(call gb_Executable_get_runtime_dependencies,javamaker) \ + | $(testtools_JAVADIR)/.dir + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),JVM,1) + $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),JVM) + $(call gb_Helper_abbreviate_dirs, \ + rm -r $(testtools_JAVADIR) && \ + $(call gb_Helper_execute,javamaker -nD -O$(testtools_JAVADIR) -X$(call gb_UnoApiTarget_get_target,udkapi) $(call gb_UnoApiTarget_get_target,bridgetest) $(call gb_UnoApiTarget_get_target,performance)) && touch $@) + $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),JVM) + +# vim:set shiftwidth=4 tabstop=4 noexpandtab: diff --git a/testtools/CustomTarget_uno_test.mk b/testtools/CustomTarget_uno_test.mk new file mode 100644 index 000000000..4850e5ca6 --- /dev/null +++ b/testtools/CustomTarget_uno_test.mk @@ -0,0 +1,34 @@ +# -*- 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_CustomTarget_CustomTarget,testtools/uno_test)) + +# this target is phony to run it every time +.PHONY : $(call gb_CustomTarget_get_target,testtools/uno_test) + +$(call gb_CustomTarget_get_target,testtools/uno_test) : \ + $(call gb_Executable_get_runtime_dependencies,uno) \ + $(call gb_InternalUnoApi_get_target,bridgetest) \ + $(call gb_Package_get_target,instsetoo_native_setup_ure) \ + $(call gb_Rdb_get_target,uno_services) \ + $(call gb_Rdb_get_target,ure/services) \ + $(call gb_UnoApi_get_target,udkapi) +ifneq ($(gb_SUPPRESS_TESTS),) + @true +else + $(call gb_Helper_abbreviate_dirs,\ + $(call gb_Executable_get_command,uno) \ + -s com.sun.star.test.bridge.BridgeTest \ + -- com.sun.star.test.bridge.CppTestObject \ + -env:LO_BUILD_LIB_DIR=$(call gb_Helper_make_url,$(gb_Library_WORKDIR_FOR_BUILD)) \ + -env:URE_MORE_SERVICES=$(call gb_Helper_make_url,$(call gb_Rdb_get_target,uno_services)) \ + -env:URE_MORE_TYPES=$(call gb_Helper_make_url,$(WORKDIR)/UnoApiTarget/bridgetest.rdb)) +endif + +# vim:set shiftwidth=4 tabstop=4 noexpandtab: diff --git a/testtools/InternalUnoApi_bridgetest.mk b/testtools/InternalUnoApi_bridgetest.mk new file mode 100644 index 000000000..355f81f9a --- /dev/null +++ b/testtools/InternalUnoApi_bridgetest.mk @@ -0,0 +1,16 @@ +# -*- 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_InternalUnoApi_InternalUnoApi,bridgetest,testtools/source/bridgetest/idl/bridgetest.idl)) + +$(eval $(call gb_InternalUnoApi_use_api,bridgetest,\ + udkapi \ +)) + +# vim:set noet sw=4 ts=4: diff --git a/testtools/InternalUnoApi_performance.mk b/testtools/InternalUnoApi_performance.mk new file mode 100644 index 000000000..865972c55 --- /dev/null +++ b/testtools/InternalUnoApi_performance.mk @@ -0,0 +1,16 @@ +# -*- 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_InternalUnoApi_InternalUnoApi,performance,testtools/source/bridgetest/idl/com/sun/star/test/performance/XPerformanceTest.idl)) + +$(eval $(call gb_InternalUnoApi_use_api,performance,\ + udkapi \ +)) + +# vim:set noet sw=4 ts=4: diff --git a/testtools/Jar_testComponent.mk b/testtools/Jar_testComponent.mk new file mode 100644 index 000000000..f3969a422 --- /dev/null +++ b/testtools/Jar_testComponent.mk @@ -0,0 +1,38 @@ +# -*- 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_Jar_Jar,testComponent)) + +$(eval $(call gb_Jar_use_jars,testComponent,\ + libreoffice \ +)) + +$(eval $(call gb_Jar_use_api,testComponent,\ + udkapi \ +)) + +$(eval $(call gb_Jar_use_customtargets,testComponent,\ + testtools/bridgetest_javamaker \ +)) + +$(eval $(call gb_Jar_set_packageroot,testComponent,com)) + +$(eval $(call gb_Jar_set_manifest,testComponent,$(SRCDIR)/testtools/com/sun/star/comp/bridge/manifest)) + +$(eval $(call gb_Jar_set_componentfile,testComponent,testtools/source/bridgetest/testComponent,NONE)) + +$(eval $(call gb_Jar_add_packagedirs,testComponent,\ + $(call gb_CustomTarget_get_workdir,testtools/bridgetest_javamaker)/test \ +)) + +$(eval $(call gb_Jar_add_sourcefiles,testComponent,\ + testtools/com/sun/star/comp/bridge/TestComponent \ + testtools/com/sun/star/comp/bridge/CurrentContextChecker \ + testtools/com/sun/star/comp/bridge/TestComponentMain \ +)) diff --git a/testtools/Library_bridgetest-common.mk b/testtools/Library_bridgetest-common.mk new file mode 100644 index 000000000..1ca38bca6 --- /dev/null +++ b/testtools/Library_bridgetest-common.mk @@ -0,0 +1,38 @@ +# -*- 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_Library_Library,testtools_bridgetest-common)) + +$(eval $(call gb_Library_add_defs,testtools_bridgetest-common, \ + -DLO_DLLIMPLEMENTATION_TESTTOOLS \ +)) + +$(eval $(call gb_Library_use_external,testtools_bridgetest-common,boost_headers)) + +$(eval $(call gb_Library_use_internal_api,testtools_bridgetest-common,\ + bridgetest \ +)) + +$(eval $(call gb_Library_use_libraries,testtools_bridgetest-common, \ + cppu \ + cppuhelper \ + sal \ +)) + +$(eval $(call gb_Library_use_api,testtools_bridgetest-common,\ + udkapi \ +)) + +$(eval $(call gb_Library_add_exception_objects,testtools_bridgetest-common,\ + testtools/source/bridgetest/currentcontextchecker \ + testtools/source/bridgetest/multi \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/testtools/Library_bridgetest.mk b/testtools/Library_bridgetest.mk new file mode 100644 index 000000000..52f335761 --- /dev/null +++ b/testtools/Library_bridgetest.mk @@ -0,0 +1,35 @@ +# -*- 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_Library_Library,testtools_bridgetest)) + +$(eval $(call gb_Library_set_componentfile,testtools_bridgetest,testtools/source/bridgetest/bridgetest)) + +$(eval $(call gb_Library_use_internal_api,testtools_bridgetest,\ + bridgetest \ +)) + +$(eval $(call gb_Library_use_api,testtools_bridgetest,\ + udkapi \ +)) + +$(eval $(call gb_Library_use_external,testtools_bridgetest,boost_headers)) + +$(eval $(call gb_Library_use_libraries,testtools_bridgetest,\ + cppu \ + cppuhelper \ + sal \ + testtools_bridgetest-common \ +)) + +$(eval $(call gb_Library_add_exception_objects,testtools_bridgetest,\ + testtools/source/bridgetest/bridgetest \ +)) + +# vim:set noet sw=4 ts=4: diff --git a/testtools/Library_constructors.mk b/testtools/Library_constructors.mk new file mode 100644 index 000000000..516c05d62 --- /dev/null +++ b/testtools/Library_constructors.mk @@ -0,0 +1,39 @@ +# -*- 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_Library_Library,testtools_constructors)) + +$(eval $(call gb_Library_set_componentfile,testtools_constructors,testtools/source/bridgetest/constructors)) + +$(eval $(call gb_Executable_set_include,testtools_constructors,\ + -I$(SRCDIR)/testtools/source/bridgetest \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_Library_use_external,testtools_constructors,boost_headers)) + +$(eval $(call gb_Library_use_internal_api,testtools_constructors,\ + bridgetest \ +)) + +$(eval $(call gb_Library_use_api,testtools_constructors,\ + udkapi \ +)) + +$(eval $(call gb_Library_use_libraries,testtools_constructors,\ + cppu \ + cppuhelper \ + sal \ +)) + +$(eval $(call gb_Library_add_exception_objects,testtools_constructors,\ + testtools/source/bridgetest/constructors \ +)) + +# vim:set noet sw=4 ts=4: diff --git a/testtools/Library_cppobj.mk b/testtools/Library_cppobj.mk new file mode 100644 index 000000000..086b1fa0b --- /dev/null +++ b/testtools/Library_cppobj.mk @@ -0,0 +1,40 @@ +# -*- 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_Library_Library,testtools_cppobj)) + +$(eval $(call gb_Library_set_componentfile,testtools_cppobj,testtools/source/bridgetest/cppobj)) + +$(eval $(call gb_Executable_set_include,testtools_cppobj,\ + -I$(SRCDIR)/testtools/source/bridgetest \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_Library_use_internal_api,testtools_cppobj,\ + bridgetest \ +)) + +$(eval $(call gb_Library_use_api,testtools_cppobj,\ + udkapi \ +)) + +$(eval $(call gb_Library_use_external,testtools_cppobj,boost_headers)) + +$(eval $(call gb_Library_use_libraries,testtools_cppobj,\ + cppu \ + cppuhelper \ + sal \ + testtools_bridgetest-common \ +)) + +$(eval $(call gb_Library_add_exception_objects,testtools_cppobj,\ + testtools/source/bridgetest/cppobj \ +)) + +# vim:set noet sw=4 ts=4: diff --git a/testtools/Makefile b/testtools/Makefile new file mode 100644 index 000000000..ccb1c85a0 --- /dev/null +++ b/testtools/Makefile @@ -0,0 +1,7 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/testtools/Module_testtools.mk b/testtools/Module_testtools.mk new file mode 100644 index 000000000..a1b84e175 --- /dev/null +++ b/testtools/Module_testtools.mk @@ -0,0 +1,44 @@ +# -*- 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_Module_Module,testtools)) + +ifeq ($(CROSS_COMPILING),) + +$(eval $(call gb_Module_add_targets,testtools,\ + CustomTarget_bridgetest \ + InternalUnoApi_bridgetest \ + InternalUnoApi_performance \ + Library_cppobj \ + Library_bridgetest \ + Library_bridgetest-common \ + Library_constructors \ + Rdb_uno_services \ +)) + +ifneq ($(ENABLE_JAVA),) +$(eval $(call gb_Module_add_targets,testtools,\ + Jar_testComponent \ + CustomTarget_bridgetest_javamaker \ +)) +endif + +ifeq ($(COM),MSC) +$(eval $(call gb_Module_add_targets,testtools,\ + CustomTarget_bridgetest_climaker \ +)) +endif + +$(eval $(call gb_Module_add_check_targets,testtools,\ + CustomTarget_uno_test \ +)) + +endif + +# vim:set noet sw=4 ts=4: diff --git a/testtools/README b/testtools/README new file mode 100644 index 000000000..c71e4c8b6 --- /dev/null +++ b/testtools/README @@ -0,0 +1,34 @@ +Testing tools + +== How to check compatibility between compilers == + +Since the interfaces used in the cpp bridgetest are not changed often +one can just build the cppobj.uno.dll and the constructors.uno.dll +(testtools/source/bridgetest) in an +old environment and then use them in the new environment. That is the files +are copied into the testtools/wntmsciXX.pro folder which corresponds to the +new environment. + +On Windows this test will typically fail because the tests use the +cppu::getCaughtException function, which only works when all libs are build +using the same runtime. + +This part of the test can switched off. To do this go into the +testtools/source/bridgetest folder and call +dmake compcheck=1 + +This will add a new compiler define (-DCOMPCHECK) and will be used in the +bridgetest.cxx to switch off the code which uses the getCaughtException function. +However, there is still a test which causes the test component to throw +and IllegalArgumentException. This still works. + + +== Using source/bridgetest for stress testing == + +Start a modified bridgetest_server (with the final "--singleaccept" argument +removed from the uno executable call) or a modified bridgetest_javaserver (with +the final "singleaccept" argument replaced with "multi" in the java executable +call), then start a modified bridgetest_client (with a final "stress" argument +added to the uno executable call). The client will continuously establish +connections to the server which are immediately destroyed again. The test will +run forever, unless an error occurs. diff --git a/testtools/Rdb_uno_services.mk b/testtools/Rdb_uno_services.mk new file mode 100644 index 000000000..b2ff7d9c7 --- /dev/null +++ b/testtools/Rdb_uno_services.mk @@ -0,0 +1,24 @@ +# -*- 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_Rdb_Rdb,uno_services)) + +$(eval $(call gb_Rdb_add_components,uno_services,\ + testtools/source/bridgetest/cppobj \ + testtools/source/bridgetest/constructors \ + testtools/source/bridgetest/bridgetest \ +)) + +ifneq ($(ENABLE_JAVA),) +$(eval $(call gb_Rdb_add_components,uno_services,\ + testtools/source/bridgetest/testComponent \ +)) +endif + +# vim:set noet sw=4 ts=4: diff --git a/testtools/com/sun/star/comp/bridge/CurrentContextChecker.java b/testtools/com/sun/star/comp/bridge/CurrentContextChecker.java new file mode 100644 index 000000000..6841f77b1 --- /dev/null +++ b/testtools/com/sun/star/comp/bridge/CurrentContextChecker.java @@ -0,0 +1,72 @@ +/* + * 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 com.sun.star.comp.bridge; + +import com.sun.star.uno.Any; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XCurrentContext; +import test.testtools.bridgetest.XCurrentContextChecker; + +final class CurrentContextChecker implements XCurrentContextChecker { + + + public boolean perform( + XCurrentContextChecker other, int setSteps, int checkSteps) + { + if (setSteps == 0) { + XCurrentContext old = UnoRuntime.getCurrentContext(); + UnoRuntime.setCurrentContext( + new XCurrentContext() { + public Object getValueByName(String Name) { + return Name.equals(KEY) + ? (Object) VALUE : (Object) Any.VOID; + } + }); + try { + return performCheck(other, setSteps, checkSteps); + } finally { + UnoRuntime.setCurrentContext(old); + } + } else { + return performCheck(other, setSteps, checkSteps); + } + } + + private boolean performCheck( + XCurrentContextChecker other, int setSteps, int checkSteps) + { + // assert other != null && checkSteps >= 0; + if (checkSteps == 0) { + XCurrentContext context = UnoRuntime.getCurrentContext(); + if (context == null) { + return false; + } + Any a = Any.complete(context.getValueByName(KEY)); + return + a.getType().equals(Type.STRING) && a.getObject().equals(VALUE); + } else { + return other.perform( + this, setSteps >= 0 ? setSteps - 1 : -1, checkSteps - 1); + } + } + + private static final String KEY = "testtools.bridgetest.Key"; + private static final String VALUE = "good"; +} diff --git a/testtools/com/sun/star/comp/bridge/TestComponent.java b/testtools/com/sun/star/comp/bridge/TestComponent.java new file mode 100644 index 000000000..7d59de570 --- /dev/null +++ b/testtools/com/sun/star/comp/bridge/TestComponent.java @@ -0,0 +1,1342 @@ +/* + * 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 com.sun.star.comp.bridge; + +import com.sun.star.comp.loader.FactoryHelper; + +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lang.XTypeProvider; + +import com.sun.star.test.performance.ComplexTypes; +import com.sun.star.test.performance.XPerformanceTest; + +import test.testtools.bridgetest.BadConstructorArguments; +import test.testtools.bridgetest.Constructors; +import test.testtools.bridgetest.Constructors2; +import test.testtools.bridgetest.TestDataElements; +import test.testtools.bridgetest.TestElement; +import test.testtools.bridgetest.TestEnum; +import test.testtools.bridgetest.TestPolyStruct; +import test.testtools.bridgetest.TestPolyStruct2; +import test.testtools.bridgetest.TestStruct; +import test.testtools.bridgetest.SmallStruct; +import test.testtools.bridgetest.MediumStruct; +import test.testtools.bridgetest.BigStruct; +import test.testtools.bridgetest.TwoFloats; +import test.testtools.bridgetest.FourFloats; +import test.testtools.bridgetest.MixedFloatAndInteger; +import test.testtools.bridgetest.ThreeByteStruct; +import test.testtools.bridgetest.XBridgeTest; +import test.testtools.bridgetest.XBridgeTest2; +import test.testtools.bridgetest.XCurrentContextChecker; +import test.testtools.bridgetest.XMulti; +import test.testtools.bridgetest.XRecursiveCall; + + +import com.sun.star.lang.IllegalArgumentException; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XSingleServiceFactory; + +import com.sun.star.registry.XRegistryKey; + +import com.sun.star.uno.Any; +import com.sun.star.uno.Type; +import com.sun.star.uno.XComponentContext; +import com.sun.star.uno.XInterface; + +@SuppressWarnings("unchecked") +public class TestComponent { + public static final boolean DEBUG = false; + + public static class _PerformancTestObject implements XPerformanceTest, XServiceInfo, XTypeProvider { + private static final String __serviceName = "com.sun.star.comp.benchmark.JavaTestObject"; + + private int _long; + private long _hyper; + private float _float; + private double _double; + private String _string = ""; + private Object _xInterface; + private Object _any; + private Object _interface_sequence[] = new Object[0]; + private ComplexTypes _complexTypes = new ComplexTypes(); + + // Attributes + public int getLong_attr() throws com.sun.star.uno.RuntimeException { + return _long; + } + + public void setLong_attr( int _long_attr ) throws com.sun.star.uno.RuntimeException { + _long = _long_attr; + } + + public long getHyper_attr() throws com.sun.star.uno.RuntimeException { + return _hyper; + } + + public void setHyper_attr( long _hyper_attr ) throws com.sun.star.uno.RuntimeException { + _hyper = _hyper_attr; + } + + public float getFloat_attr() throws com.sun.star.uno.RuntimeException { + return _float; + } + + public void setFloat_attr( float _float_attr ) throws com.sun.star.uno.RuntimeException { + _float = _float_attr; + } + + public double getDouble_attr() throws com.sun.star.uno.RuntimeException { + return _double; + } + + public void setDouble_attr( double _double_attr ) throws com.sun.star.uno.RuntimeException { + _double = _double_attr; + } + + public String getString_attr() throws com.sun.star.uno.RuntimeException { + return _string; + } + + public void setString_attr( String _string_attr ) throws com.sun.star.uno.RuntimeException { + _string = _string_attr; + } + + public Object getInterface_attr() throws com.sun.star.uno.RuntimeException { + return _xInterface; + } + + public void setInterface_attr( java.lang.Object _interface_attr ) throws com.sun.star.uno.RuntimeException { + _xInterface = _interface_attr; + } + + public Object getAny_attr() throws com.sun.star.uno.RuntimeException { + return _any; + } + + public void setAny_attr(Object _any_attr ) throws com.sun.star.uno.RuntimeException { + _any = _any_attr; + } + + public Object[] getSequence_attr() throws com.sun.star.uno.RuntimeException { + return _interface_sequence; + } + + public void setSequence_attr(Object[] _sequence_attr ) throws com.sun.star.uno.RuntimeException { + _interface_sequence = _sequence_attr; + } + + public ComplexTypes getStruct_attr() throws com.sun.star.uno.RuntimeException { + return _complexTypes; + } + + public void setStruct_attr( ComplexTypes _struct_attr ) throws com.sun.star.uno.RuntimeException { + _complexTypes = _struct_attr; + } + + + // Methods + public void async() throws com.sun.star.uno.RuntimeException { + } + + public void sync( ) throws com.sun.star.uno.RuntimeException { + } + + public ComplexTypes complex_in( /*IN*/ComplexTypes aVal ) throws com.sun.star.uno.RuntimeException { + return aVal; + } + + public ComplexTypes complex_inout( /*INOUT*/ComplexTypes[] aVal ) throws com.sun.star.uno.RuntimeException { + return aVal[0]; + } + + public void complex_oneway( /*IN*/ComplexTypes aVal ) throws com.sun.star.uno.RuntimeException { + } + + public void complex_noreturn( /*IN*/ComplexTypes aVal ) throws com.sun.star.uno.RuntimeException { + } + + public XPerformanceTest createObject( ) throws com.sun.star.uno.RuntimeException { + return new _PerformancTestObject(); + } + + public int getLong() throws com.sun.star.uno.RuntimeException { + return _long; + } + + public void setLong(/*IN*/int n) throws com.sun.star.uno.RuntimeException { + _long = n; + } + + public long getHyper() throws com.sun.star.uno.RuntimeException { + return _hyper; + } + + public void setHyper(/*IN*/long n) throws com.sun.star.uno.RuntimeException { + _hyper = n; + } + + public float getFloat() throws com.sun.star.uno.RuntimeException { + return _float; + } + + public void setFloat( /*IN*/float f ) throws com.sun.star.uno.RuntimeException { + _float = f; + } + + public double getDouble( ) throws com.sun.star.uno.RuntimeException { + return _double; + } + + public void setDouble( /*IN*/double f ) throws com.sun.star.uno.RuntimeException { + _double = f; + } + + public String getString( ) throws com.sun.star.uno.RuntimeException { + return _string; + } + + public void setString( /*IN*/String s ) throws com.sun.star.uno.RuntimeException { + _string = s; + } + + public Object getInterface( ) throws com.sun.star.uno.RuntimeException { + return _xInterface; + } + + public void setInterface( /*IN*/Object x ) throws com.sun.star.uno.RuntimeException { + _xInterface = x; + } + + public Object getAny( ) throws com.sun.star.uno.RuntimeException { + return _any; + } + + public void setAny( /*IN*/java.lang.Object a ) throws com.sun.star.uno.RuntimeException { + _any = a; + } + + public Object[] getSequence( ) throws com.sun.star.uno.RuntimeException { + return _interface_sequence; + } + + public void setSequence( /*IN*/Object[] seq ) throws com.sun.star.uno.RuntimeException { + if(DEBUG) System.err.println("#### " + getClass().getName() + ".setSequence:" + seq); + + _interface_sequence = seq; + } + + public ComplexTypes getStruct( ) throws com.sun.star.uno.RuntimeException { + return _complexTypes; + } + + public void setStruct( /*IN*/ComplexTypes c ) throws com.sun.star.uno.RuntimeException { + _complexTypes = c; + } + + public void raiseRuntimeException( ) throws com.sun.star.uno.RuntimeException { + throw new com.sun.star.uno.RuntimeException(); + } + + // XServiceInfo + public String getImplementationName() throws com.sun.star.uno.RuntimeException { + return __serviceName; + } + + public boolean supportsService(String rServiceName) throws com.sun.star.uno.RuntimeException { + String rSNL[] = getSupportedServiceNames(); + + for(int nPos = rSNL.length; (nPos--) != 0;) { + if (rSNL[nPos].equals(rServiceName)) + return true; + } + + return false; + } + + public String [] getSupportedServiceNames() throws com.sun.star.uno.RuntimeException { + return new String[]{__serviceName}; + } + + // XTypeProvider + public Type[] getTypes() throws com.sun.star.uno.RuntimeException { + try { + return new Type[]{new Type(XPerformanceTest.class), new Type(XServiceInfo.class), new Type(XTypeProvider.class)}; + } + catch(Exception exception) { + throw new com.sun.star.uno.RuntimeException(exception); + } + } + + public byte[] getImplementationId() throws com.sun.star.uno.RuntimeException { + return new byte[0]; + } + } + + public static class _TestObject implements XBridgeTest2, XRecursiveCall, XServiceInfo, XTypeProvider { + private static final String __serviceName = "com.sun.star.test.bridge.JavaTestObject"; + + private boolean _bool; + private char _char; + private byte _byte; + private short _short; + private short _ushort; + private int _long; + private int _ulong; + private long _hyper; + private long _uhyper; + private float _float; + private double _double; + private String _string; + private byte _byte2; + private short _short2; + private Object _xInterface; + private Object _any; + private TestEnum _testEnum = TestEnum.TEST; + private TestElement _testElements[] = new TestElement[0]; + private TestDataElements _testDataElements = new TestDataElements(); + + private int _nLastCallId; + private boolean _bFirstCall; + private boolean _bSequenceOfCallTestPassed; + + private boolean[] arBool; + private char[] arChar; + private byte[] arByte; + private short[] arShort; + private short[] arUShort; + private int[] arLong; + private int[] arULong; + private long[] arHyper; + private long[] arUHyper; + private float[] arFloat; + private double[] arDouble; + private String[] arString; + private Object[] arObject; + private Object[] arAny; + private TestEnum[] arEnum; + private int[][] arLong2; + private int[][][] arLong3; + public _TestObject(XMultiServiceFactory xMultiServiceFactory) { + if(DEBUG) System.err.println("##### " + getClass().getName() + ".<init> " + xMultiServiceFactory); + + _nLastCallId = 0; + _bFirstCall = true; + _bSequenceOfCallTestPassed = true; + } + + + public void setValues(boolean bBool, + char cChar, + byte nByte, + short nShort, + short nUShort, + int nLong, + int nULong, + long nHyper, + long nUHyper, + float fFloat, + double fDouble, + TestEnum testEnum, + String string, + byte nByte2, + short nShort2, + Object xInterface, + Object any, + TestElement testElements[], + TestDataElements testDataElements) throws com.sun.star.uno.RuntimeException + { + if(DEBUG) System.err.println("##### " + getClass().getName() + ".setValues:" + any); + + _bool = bBool; + _char = cChar; + _byte = nByte; + _short = nShort; + _ushort = nUShort; + _long = nLong; + _ulong = nULong; + _hyper = nHyper; + _uhyper = nUHyper; + _float = fFloat; + _double = fDouble; + _testEnum = testEnum; + _string = string; + _byte2 = nByte2; + _short2 = nShort2; + _xInterface = xInterface; + _any = any; + _testElements = testElements; + _testDataElements = testDataElements; + } + + + + public TestDataElements setValues2(/*INOUT*/boolean[] io_bool, + /*INOUT*/char[] io_char, + /*INOUT*/byte[] io_byte, + /*INOUT*/short[] io_short, + /*INOUT*/short[] io_ushort, + /*INOUT*/int[] io_long, + /*INOUT*/int[] io_ulong, + /*INOUT*/long[] io_hyper, + /*INOUT*/long[] io_uhyper, + /*INOUT*/float[] io_float, + /*INOUT*/double[] io_double, + /*INOUT*/TestEnum[] io_testEnum, + /*INOUT*/String[] io_string, + /*INOUT*/byte[] io_byte2, + /*INOUT*/short[] io_short2, + /*INOUT*/Object[] io_xInterface, + /*INOUT*/Object[] io_any, + /*INOUT*/TestElement[][] io_testElements, + /*INOUT*/TestDataElements[] io_testDataElements) throws com.sun.star.uno.RuntimeException + { + if(DEBUG) System.err.println("##### " + getClass().getName() + ".setValues2:" + io_any[0]); + + _bool = io_bool[0]; + _char = io_char[0]; + _byte = io_byte[0]; + _short = io_short[0]; + _ushort = io_ushort[0]; + _long = io_long[0]; + _ulong = io_ulong[0]; + _hyper = io_hyper[0]; + _uhyper = io_uhyper[0]; + _float = io_float[0]; + _double = io_double[0]; + _testEnum = io_testEnum[0]; + _string = io_string[0]; + _byte2 = io_byte2[0]; + _short2 = io_short2[0]; + _xInterface = io_xInterface[0]; + _any = io_any[0]; + _testElements = io_testElements[0]; + _testDataElements = io_testDataElements[0]; + + io_testElements[ 0 ] = + new TestElement [] { io_testElements[ 0 ][ 1 ], io_testElements[ 0 ][ 0 ] }; + + return _testDataElements; + } + + public TestDataElements getValues(/*OUT*/boolean[] o_bool, + /*OUT*/char[] o_char, + /*OUT*/byte[] o_byte, + /*OUT*/short[] o_short, + /*OUT*/short[] o_ushort, + /*OUT*/int[] o_long, + /*OUT*/int[] o_ulong, + /*OUT*/long[] o_hyper, + /*OUT*/long[] o_uhyper, + /*OUT*/float[] o_float, + /*OUT*/double[] o_double, + /*OUT*/TestEnum[] o_testEnum, + /*OUT*/String[] o_string, + /*OUT*/byte[] o_byte2, + /*OUT*/short[] o_short2, + /*OUT*/Object[] o_xInterface, + /*OUT*/Object[] o_any, + /*OUT*/TestElement[][] o_testElements, + /*OUT*/TestDataElements[] o_testDataElements) throws com.sun.star.uno.RuntimeException + { + if(DEBUG) System.err.println("##### " + getClass().getName() + ".getValues:" + _any); + + o_bool[0] = _bool; + o_char[0] = _char; + o_byte[0] = _byte; + o_short[0] = _short; + o_ushort[0] = _ushort; + o_long[0] = _long; + o_ulong[0] = _ulong; + o_hyper[0] = _hyper; + o_uhyper[0] = _uhyper; + o_float[0] = _float; + o_double[0] = _double; + o_testEnum[0] = _testEnum; + o_string[0] = _string; + o_byte2[0] = _byte2; + o_short2[0] = _short2; + o_xInterface[0] = _xInterface; + o_any[0] = _any; + o_testElements[0] = _testElements; + o_testDataElements[0] = _testDataElements; + + return _testDataElements; + } + + public SmallStruct echoSmallStruct( SmallStruct i_Struct) throws com.sun.star.uno.RuntimeException { + return i_Struct; + } + + public MediumStruct echoMediumStruct( MediumStruct i_Struct) throws com.sun.star.uno.RuntimeException { + return i_Struct; + } + + public BigStruct echoBigStruct( BigStruct i_Struct) throws com.sun.star.uno.RuntimeException { + return i_Struct; + } + + public TwoFloats echoTwoFloats( TwoFloats i_Struct) throws com.sun.star.uno.RuntimeException { + return i_Struct; + } + + public FourFloats echoFourFloats( FourFloats i_Struct) throws com.sun.star.uno.RuntimeException { + return i_Struct; + } + + public MixedFloatAndInteger echoMixedFloatAndInteger( MixedFloatAndInteger i_Struct) throws com.sun.star.uno.RuntimeException { + return i_Struct; + } + + public ThreeByteStruct echoThreeByteStruct( ThreeByteStruct i_Struct) throws com.sun.star.uno.RuntimeException { + return i_Struct; + } + + public int testPPCAlignment( long l1, long l2, int i1, long l3, int i2 ) throws com.sun.star.uno.RuntimeException { + return i2; + } + + public int testPPC64Alignment( double d1, double d2, double d3, int i1 ) throws com.sun.star.uno.RuntimeException { + return i1; + } + + public double testTenDoubles( double d1, double d2, double d3, double d4, double d5, double d6, double d7, double d8, double d9, double d10 ) { + return d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10; + } + + // Attributes + public boolean getBool() throws com.sun.star.uno.RuntimeException { + return _bool; + } + + public void setBool(boolean bool) throws com.sun.star.uno.RuntimeException { + _bool = bool; + } + + public byte getByte() throws com.sun.star.uno.RuntimeException { + return _byte; + } + + public void setByte(byte zbyte) throws com.sun.star.uno.RuntimeException { + _byte = zbyte; + } + + public char getChar() throws com.sun.star.uno.RuntimeException { + return _char; + } + + public void setChar(char zchar) throws com.sun.star.uno.RuntimeException { + _char = zchar; + } + + public short getShort() throws com.sun.star.uno.RuntimeException { + return _short; + } + + public void setShort(short zshort) throws com.sun.star.uno.RuntimeException { + _short = zshort; + } + + public short getUShort() throws com.sun.star.uno.RuntimeException { + return _ushort; + } + + public void setUShort(short ushort) throws com.sun.star.uno.RuntimeException { + _ushort = ushort; + } + + public int getLong() throws com.sun.star.uno.RuntimeException { + return _long; + } + + public void setLong(int zint) throws com.sun.star.uno.RuntimeException { + _long = zint; + } + + public int getULong() throws com.sun.star.uno.RuntimeException { + return _ulong; + } + + public void setULong(int uint) throws com.sun.star.uno.RuntimeException { + _ulong = uint; + } + + public long getHyper() throws com.sun.star.uno.RuntimeException { + return _hyper; + } + + public void setHyper(long hyper) throws com.sun.star.uno.RuntimeException { + _hyper = hyper; + } + + public long getUHyper() throws com.sun.star.uno.RuntimeException { + return _uhyper; + } + + public void setUHyper(long uhyper) throws com.sun.star.uno.RuntimeException { + _uhyper = uhyper; + } + + public float getFloat() throws com.sun.star.uno.RuntimeException { + return _float; + } + + public void setFloat(float zfloat) throws com.sun.star.uno.RuntimeException { + _float = zfloat; + } + + public double getDouble() throws com.sun.star.uno.RuntimeException { + return _double; + } + + public void setDouble(double zdouble) throws com.sun.star.uno.RuntimeException { + _double = zdouble; + } + + public TestEnum getEnum() throws com.sun.star.uno.RuntimeException { + return _testEnum; + } + + public void setEnum(TestEnum testEnum) throws com.sun.star.uno.RuntimeException { + _testEnum = testEnum; + } + + public String getString() throws com.sun.star.uno.RuntimeException { + return _string; + } + + public void setString(String string) throws com.sun.star.uno.RuntimeException { + _string = string; + } + + public byte getByte2() throws com.sun.star.uno.RuntimeException { + return _byte2; + } + + public void setByte2(byte zbyte) throws com.sun.star.uno.RuntimeException { + _byte2 = zbyte; + } + + public short getShort2() throws com.sun.star.uno.RuntimeException { + return _short2; + } + + public void setShort2(short zshort) throws com.sun.star.uno.RuntimeException { + _short2 = zshort; + } + + public Object getInterface() throws com.sun.star.uno.RuntimeException { + return _xInterface; + } + + public void setInterface(Object zinterface) throws com.sun.star.uno.RuntimeException { + _xInterface = zinterface; + } + + public Object getAny() throws com.sun.star.uno.RuntimeException { + if(DEBUG) System.err.println("##### " + getClass().getName() + ".setAny:" + _any); + + return _any; + } + + public void setAny(Object any) throws com.sun.star.uno.RuntimeException { + if(DEBUG) System.err.println("##### " + getClass().getName() + ".setAny:" + any); + + _any = any; + } + + public TestElement[] getSequence() throws com.sun.star.uno.RuntimeException { + return _testElements; + } + + public void setSequence(TestElement testElements[]) throws com.sun.star.uno.RuntimeException { + _testElements = testElements; + } + + public TestDataElements getStruct() throws com.sun.star.uno.RuntimeException { + return _testDataElements; + } + + public void setStruct(TestDataElements testDataElements) throws com.sun.star.uno.RuntimeException { + _testDataElements = testDataElements; + } + + public int getRaiseAttr1() { + throw new com.sun.star.uno.RuntimeException(); + } + + public void setRaiseAttr1(int n) throws IllegalArgumentException { + throw new IllegalArgumentException(); + } + + public int getRaiseAttr2() throws IllegalArgumentException { + throw new IllegalArgumentException(); + } + + public TestPolyStruct transportPolyBoolean(TestPolyStruct arg) { + Boolean dummy = (Boolean) arg.member; + return arg; + } + + public void transportPolyHyper(TestPolyStruct[] arg) { + Long dummy = (Long) arg[0].member; + } + + public void transportPolySequence( + TestPolyStruct arg1, TestPolyStruct[] arg2) + { + Object[] dummy = (Object[]) arg1.member; + arg2[0] = arg1; + } + + public TestPolyStruct getNullPolyLong() { + return new TestPolyStruct(); + } + + public TestPolyStruct getNullPolyString() { + return new TestPolyStruct(); + } + + public TestPolyStruct getNullPolyType() { + return new TestPolyStruct(); + } + + public TestPolyStruct getNullPolyAny() { + return new TestPolyStruct(); + } + + public TestPolyStruct getNullPolySequence() { + return new TestPolyStruct(); + } + + public TestPolyStruct getNullPolyEnum() { + return new TestPolyStruct(); + } + + public TestPolyStruct getNullPolyBadEnum() { + return new TestPolyStruct(); + } + + public TestPolyStruct getNullPolyStruct() { + return new TestPolyStruct(); + } + + public TestPolyStruct getNullPolyInterface() { + return new TestPolyStruct(); + } + + public Object transportAny(Object value) throws com.sun.star.uno.RuntimeException { + return value; + } + + public void call(int nCallId , int nWaitMUSEC) throws com.sun.star.uno.RuntimeException { + try { + Thread.sleep(nWaitMUSEC / 10000); + } + catch(InterruptedException interruptedException) { + throw new com.sun.star.uno.RuntimeException(interruptedException); + } + + if(_bFirstCall) + _bFirstCall = false; + + else + _bSequenceOfCallTestPassed = _bSequenceOfCallTestPassed && (nCallId > _nLastCallId); + + _nLastCallId = nCallId; + } + + public void callOneway( int nCallId , int nWaitMUSEC ) throws com.sun.star.uno.RuntimeException { + try { + Thread.sleep(nWaitMUSEC / 10000); + } + catch(InterruptedException interruptedException) { + throw new com.sun.star.uno.RuntimeException(interruptedException); + } + + _bSequenceOfCallTestPassed = _bSequenceOfCallTestPassed && (nCallId > _nLastCallId); + _nLastCallId = nCallId; + } + + public boolean sequenceOfCallTestPassed() throws com.sun.star.uno.RuntimeException { + return _bSequenceOfCallTestPassed; + } + + public synchronized void callRecursivly(XRecursiveCall xCall, int nToCall) throws com.sun.star.uno.RuntimeException { + if(nToCall != 0) + { + nToCall --; + xCall.callRecursivly(this , nToCall); + } + } + + public synchronized void startRecursiveCall(XRecursiveCall xCall, int nToCall) throws com.sun.star.uno.RuntimeException { + if(nToCall != 0) + { + nToCall --; + xCall.callRecursivly( this , nToCall ); + } + } + + public XMulti getMulti() { + return new XMulti() { + public double getatt1() { + return attribute1; + } + + public void setatt1(double value) { + attribute1 = value; + } + + public int fn11(int arg) { + return 11 * arg; + } + + public String fn12(String arg) { + return "12" + arg; + } + + public int fn21(int arg) { + return 21 * arg; + } + + public String fn22(String arg) { + return "22" + arg; + } + + public double getatt3() { + return attribute3; + } + + public void setatt3(double value) { + attribute3 = value; + } + + public int fn31(int arg) { + return 31 * arg; + } + + public String fn32(String arg) { + return "32" + arg; + } + + public int fn33() { + return 33; + } + + public int fn41(int arg) { + return 41 * arg; + } + + public int fn61(int arg) { + return 61 * arg; + } + + public String fn62(String arg) { + return "62" + arg; + } + + public int fn71(int arg) { + return 71 * arg; + } + + public String fn72(String arg) { + return "72" + arg; + } + + public int fn73() { + return 73; + } + + private double attribute1 = 0.0; + private double attribute3 = 0.0; + }; + } + + private static final class CheckFailed extends Exception { + CheckFailed(String message) { + super(message); + } + } + + private static void checkEqual(int value, int argument) + throws CheckFailed + { + if (argument != value) { + throw new CheckFailed(value + " != " + argument); + } + } + + private static void checkEqual(double value, double argument) + throws CheckFailed + { + if (argument != value) { + throw new CheckFailed(value + " != " + argument); + } + } + + private static void checkEqual(String value, String argument) + throws CheckFailed + { + if (!argument.equals(value)) { + throw new CheckFailed(value + " != " + argument); + } + } + + public String testMulti(XMulti multi) { + try { + checkEqual(0.0, multi.getatt1()); + multi.setatt1(0.1); + checkEqual(0.1, multi.getatt1()); + checkEqual(11 * 1, multi.fn11(1)); + checkEqual("12" + "abc", multi.fn12("abc")); + checkEqual(21 * 2, multi.fn21(2)); + checkEqual("22" + "de", multi.fn22("de")); + checkEqual(0.0, multi.getatt3()); + multi.setatt3(0.3); + checkEqual(0.3, multi.getatt3()); + checkEqual(31 * 3, multi.fn31(3)); + checkEqual("32" + "f", multi.fn32("f")); + checkEqual(33, multi.fn33()); + checkEqual(41 * 4, multi.fn41(4)); + checkEqual(61 * 6, multi.fn61(6)); + checkEqual("62", multi.fn62("")); + checkEqual(71 * 7, multi.fn71(7)); + checkEqual("72" + "g", multi.fn72("g")); + checkEqual(73, multi.fn73()); + } catch (CheckFailed f) { + return f.getMessage(); + } + return ""; + } + + // XBridgeTest + public TestDataElements raiseException(short nArgumentPos, String rMsg, Object xContext) + throws com.sun.star.lang.IllegalArgumentException, + com.sun.star.uno.RuntimeException + { + throw new com.sun.star.lang.IllegalArgumentException(rMsg, xContext, nArgumentPos); + } + + public void raiseRuntimeExceptionOneway(String rMsg, Object xContext) throws com.sun.star.uno.RuntimeException { + throw new com.sun.star.uno.RuntimeException(rMsg, xContext); + } + + private void dothrow( com.sun.star.uno.RuntimeException t ) + throws com.sun.star.uno.RuntimeException + { + throw t; + } + public int getRuntimeException() + throws com.sun.star.uno.RuntimeException + { + dothrow( new com.sun.star.uno.RuntimeException( + _string, _xInterface ) ); + return 0; // dummy + } + + public void setRuntimeException(int _runtimeexception) throws com.sun.star.uno.RuntimeException { + throw new com.sun.star.uno.RuntimeException(_string, _xInterface); + } + + + + // XServiceInfo + public String getImplementationName() throws com.sun.star.uno.RuntimeException { + return __serviceName; + } + + public boolean supportsService(String rServiceName) throws com.sun.star.uno.RuntimeException { + String rSNL[] = getSupportedServiceNames(); + + for(int nPos = rSNL.length; (nPos--) != 0;) { + if (rSNL[nPos].equals(rServiceName)) + return true; + } + + return false; + } + + public String [] getSupportedServiceNames() throws com.sun.star.uno.RuntimeException { + return new String[]{__serviceName}; + } + + // XTypeProvider + public Type[] getTypes() throws com.sun.star.uno.RuntimeException { + try { + return new Type[]{new Type(XBridgeTest.class), new Type(XRecursiveCall.class), new Type(XServiceInfo.class), new Type(XTypeProvider.class)}; + } + catch(Exception exception) { + throw new com.sun.star.uno.RuntimeException(exception); + } + } + + public byte[] getImplementationId() throws com.sun.star.uno.RuntimeException { + return new byte[0]; + } + + //XBridgeTest2 + public boolean[] setSequenceBool( /*IN*/boolean[] aSeq ) + { + arBool = aSeq; + return aSeq; + } + public char[] setSequenceChar( /*IN*/char[] aSeq ) + { + arChar = aSeq; + return aSeq; + } + public byte[] setSequenceByte( /*IN*/byte[] aSeq ) + { + arByte = aSeq; + return aSeq; + } + public short[] setSequenceShort( /*IN*/short[] aSeq ) + { + arShort = aSeq; + return aSeq; + } + public short[] setSequenceUShort( /*IN*/short[] aSeq ) + { + arUShort = aSeq; + return aSeq; + } + public int[] setSequenceLong( /*IN*/int[] aSeq ) + { + arLong = aSeq; + return aSeq; + } + public int[] setSequenceULong( /*IN*/int[] aSeq ) + { + arULong = aSeq; + return aSeq; + } + public long[] setSequenceHyper( /*IN*/long[] aSeq ) + { + arHyper = aSeq; + return aSeq; + } + public long[] setSequenceUHyper( /*IN*/long[] aSeq ) + { + arUHyper = aSeq; + return aSeq; + } + public float[] setSequenceFloat( /*IN*/float[] aSeq ) + { + arFloat = aSeq; + return aSeq; + } + public double[] setSequenceDouble( /*IN*/double[] aSeq ) + { + arDouble = aSeq; + return aSeq; + } + public TestEnum[] setSequenceEnum( /*IN*/TestEnum[] aSeq ) + { + arEnum = aSeq; + return aSeq; + } + public String[] setSequenceString( /*IN*/String[] aSeq ) + { + arString = aSeq; + return aSeq; + } + public java.lang.Object[] setSequenceXInterface( /*IN*/java.lang.Object[] aSeq ) + { + arObject = aSeq; + return aSeq; + } + public java.lang.Object[] setSequenceAny( /*IN*/java.lang.Object[] aSeq ) + { + arAny = aSeq; + return aSeq; + } + public TestElement[] setSequenceStruct( /*IN*/TestElement[] aSeq ) + { + _testElements = aSeq; + return aSeq; + } + public int[][] setDim2( /*IN*/int[][] aSeq ) + { + arLong2 = aSeq; + return aSeq; + } + public int[][][] setDim3( /*IN*/int[][][] aSeq ) + { + arLong3 = aSeq; + return aSeq; + } + public void setSequencesInOut( /*INOUT*/boolean[][] aSeqBoolean, + /*INOUT*/char[][] aSeqChar, /*INOUT*/byte[][] aSeqByte, + /*INOUT*/short[][] aSeqShort, /*INOUT*/short[][] aSeqUShort, + /*INOUT*/int[][] aSeqLong, /*INOUT*/int[][] aSeqULong, + /*INOUT*/long[][] aSeqHyper, /*INOUT*/long[][] aSeqUHyper, + /*INOUT*/float[][] aSeqFloat, /*INOUT*/double[][] aSeqDouble, + /*INOUT*/TestEnum[][] aSeqEnum, /*INOUT*/String[][] aSeqString, + /*INOUT*/java.lang.Object[][] aSeqXInterface, + /*INOUT*/java.lang.Object[][] aSeqAny, + /*INOUT*/int[][][] aSeqDim2, /*INOUT*/int[][][][] aSeqDim3 ) + { + arBool = aSeqBoolean[0]; + arChar = aSeqChar[0]; + arByte = aSeqByte[0]; + arShort = aSeqShort[0]; + arUShort = aSeqUShort[0]; + arLong = aSeqLong[0]; + arULong = aSeqULong[0]; + arFloat = aSeqFloat[0]; + arDouble = aSeqDouble[0]; + arEnum = aSeqEnum[0]; + arString = aSeqString[0]; + arObject = aSeqXInterface[0]; + arAny = aSeqAny[0]; + arLong2 = aSeqDim2[0]; + arLong3 = aSeqDim3[0]; + } + public void setSequencesOut( /*OUT*/boolean[][] aSeqBoolean, /*OUT*/char[][] aSeqChar, + /*OUT*/byte[][] aSeqByte, /*OUT*/short[][] aSeqShort, + /*OUT*/short[][] aSeqUShort, /*OUT*/int[][] aSeqLong, + /*OUT*/int[][] aSeqULong, /*OUT*/long[][] aSeqHyper, + /*OUT*/long[][] aSeqUHyper, /*OUT*/float[][] aSeqFloat, + /*OUT*/double[][] aSeqDouble, /*OUT*/TestEnum[][] aSeqEnum, + /*OUT*/String[][] aSeqString, + /*OUT*/java.lang.Object[][] aSeqXInterface, + /*OUT*/java.lang.Object[][] aSeqAny, /*OUT*/int[][][] aSeqDim2, + /*OUT*/int[][][][] aSeqDim3 ) + { + aSeqBoolean[0] = arBool; + aSeqChar[0] = arChar; + aSeqByte[0] = arByte; + aSeqShort[0] = arShort; + aSeqUShort[0] = arUShort; + aSeqLong[0] = arLong; + aSeqULong[0] = arULong; + aSeqHyper[0] = arHyper; + aSeqUHyper[0] = arUHyper; + aSeqFloat[0] = arFloat; + aSeqDouble[0] = arDouble; + aSeqEnum[0] = arEnum; + aSeqString[0] = arString; + aSeqXInterface[0] = arObject; + aSeqAny[0] = arAny; + aSeqDim2[0] = arLong2; + aSeqDim3[0] = arLong3; + } + + public void testConstructorsService(XComponentContext context) + throws BadConstructorArguments + { + Constructors.create1(context, + true, + Byte.MIN_VALUE, + Short.MIN_VALUE, + (short) -1, + Integer.MIN_VALUE, + -1, + Long.MIN_VALUE, + -1L, + 0.123f, + 0.456, + 'X', + "test", + Type.ANY, + new Any(Type.BOOLEAN, Boolean.TRUE), + new boolean[] { true }, + new byte[] { Byte.MIN_VALUE }, + new short[] { Short.MIN_VALUE }, + new short[] { (short) -1 }, + new int[] { Integer.MIN_VALUE }, + new int[] { -1 }, + new long[] { Long.MIN_VALUE }, + new long[] { -1L }, + new float[] { 0.123f }, + new double[] { 0.456 }, + new char[] { 'X' }, + new String[] { "test" }, + new Type[] { Type.ANY }, + new Boolean[] { Boolean.TRUE }, + new boolean[][] { new boolean[] { true } }, + new Object[][] { + new Object[] { new Any(Type.BOOLEAN, Boolean.TRUE) } }, + new TestEnum[] { TestEnum.TWO }, + new TestStruct[] { new TestStruct(10) }, + new TestPolyStruct[] { new TestPolyStruct(Boolean.TRUE) }, + new TestPolyStruct[] { + new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE)) }, + new Object[] { null }, + TestEnum.TWO, + new TestStruct(10), + new TestPolyStruct(Boolean.TRUE), + new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE)), + null); + Constructors.create2(context, new Object[] { + Boolean.TRUE, + Byte.valueOf(Byte.MIN_VALUE), + Short.valueOf(Short.MIN_VALUE), + new Any(Type.UNSIGNED_SHORT, Short.valueOf((short) -1)), + Integer.valueOf(Integer.MIN_VALUE), + new Any(Type.UNSIGNED_LONG, Integer.valueOf(-1)), + Long.valueOf(Long.MIN_VALUE), + new Any(Type.UNSIGNED_HYPER, Long.valueOf(-1L)), + new Float(0.123f), + new Double(0.456), + new Character('X'), + "test", + Type.ANY, + new Any(Type.BOOLEAN, Boolean.TRUE), + new boolean[] { true }, + new byte[] { Byte.MIN_VALUE }, + new short[] { Short.MIN_VALUE }, + new Any( + new Type("[]unsigned short"), new short[] { (short) -1 }), + new int[] { Integer.MIN_VALUE }, + new Any(new Type("[]unsigned long"), new int[] { -1 }), + new long[] { Long.MIN_VALUE }, + new Any(new Type("[]unsigned hyper"), new long[] { -1L }), + new float[] { 0.123f }, + new double[] { 0.456 }, + new char[] { 'X' }, + new String[] { "test" }, + new Type[] { Type.ANY }, + new Any(new Type("[]any"), new Boolean[] { Boolean.TRUE }), + new boolean[][] { new boolean[] { true } }, + new Object[][] { + new Object[] { new Any(Type.BOOLEAN, Boolean.TRUE) } }, + new TestEnum[] { TestEnum.TWO }, + new TestStruct[] { new TestStruct(10) }, + new Any( + new Type( + "[]test.testtools.bridgetest.TestPolyStruct<boolean>"), + new TestPolyStruct[] { new TestPolyStruct(Boolean.TRUE) }), + new Any( + new Type("[]test.testtools.bridgetest.TestPolyStruct<any>"), + new TestPolyStruct[] { + new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE)) + }), + new XInterface[] { null }, + TestEnum.TWO, + new TestStruct(10), + new Any( + new Type( + "test.testtools.bridgetest.TestPolyStruct<boolean>"), + new TestPolyStruct(Boolean.TRUE)), + new Any( + new Type("test.testtools.bridgetest.TestPolyStruct<any>"), + new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE))), + null }); + Constructors2.create1( + context, + new TestPolyStruct(Type.LONG), + new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE)), + new TestPolyStruct(Boolean.TRUE), + new TestPolyStruct(Byte.valueOf(Byte.MIN_VALUE)), + new TestPolyStruct(Short.valueOf(Short.MIN_VALUE)), + new TestPolyStruct(Integer.valueOf(Integer.MIN_VALUE)), + new TestPolyStruct(Long.valueOf(Long.MIN_VALUE)), + new TestPolyStruct(new Character('X')), + new TestPolyStruct("test"), + new TestPolyStruct(new Float(0.123f)), + new TestPolyStruct(new Double(0.456)), + new TestPolyStruct(new com.sun.star.lib.uno.helper.ComponentBase()), + new TestPolyStruct(new com.sun.star.lib.uno.helper.ComponentBase()), + new TestPolyStruct(TestEnum.TWO), + new TestPolyStruct(new TestPolyStruct2(new Character('X'), + new Any(Type.BOOLEAN, Boolean.TRUE))), + new TestPolyStruct(new TestPolyStruct2(new TestPolyStruct2( + new Character('X'), new Any(Type.BOOLEAN, Boolean.TRUE)), "test")), + new TestPolyStruct2("test", new TestPolyStruct2(new Character('X'), + new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE)))), + new TestPolyStruct2( new TestPolyStruct2(new Character('X'), + new Any(Type.BOOLEAN, Boolean.TRUE)), new TestPolyStruct(new Character('X'))), + new TestPolyStruct(new Type[] { Type.LONG}), + new TestPolyStruct(new Any[] { new Any(Type.BOOLEAN, Boolean.TRUE) }), + new TestPolyStruct(new boolean[] {true}), + new TestPolyStruct(new byte[] {Byte.MIN_VALUE}), + new TestPolyStruct(new short[] {Short.MIN_VALUE}), + new TestPolyStruct(new int[] {Integer.MIN_VALUE}), + new TestPolyStruct(new long[] {Long.MIN_VALUE}), + new TestPolyStruct(new char[] {'X'}), + new TestPolyStruct(new String[] {"test"}), + new TestPolyStruct(new float[] {0.123f}), + new TestPolyStruct(new double[] {0.456d}), + new TestPolyStruct(new Object[] {new com.sun.star.lib.uno.helper.ComponentBase()}), + new TestPolyStruct(new com.sun.star.lang.XComponent[] {new com.sun.star.lib.uno.helper.ComponentBase()}), + new TestPolyStruct(new TestEnum[] {TestEnum.TWO}), + new TestPolyStruct(new TestPolyStruct2[] {new TestPolyStruct2( + new Character('X'), new Any[] {new Any(Type.BOOLEAN, Boolean.TRUE)})}), + new TestPolyStruct(new TestPolyStruct2[] {new TestPolyStruct2( + new TestPolyStruct(new Character('X')), new Any[] {new Any(Type.BOOLEAN, Boolean.TRUE)})}), + new TestPolyStruct(new int[][] { new int[] {Integer.MIN_VALUE} }), + new TestPolyStruct[]{ new TestPolyStruct(Integer.valueOf(Integer.MIN_VALUE))}, + new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2( + new Character('X'), new Any(Type.BOOLEAN, Boolean.TRUE)))}, + new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2( + new TestPolyStruct2(new Character('X'), new Any(Type.BOOLEAN, Boolean.TRUE)), "test"))}, + new TestPolyStruct2[]{new TestPolyStruct2("test", new TestPolyStruct2( + new Character('X'), new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE))))}, + new TestPolyStruct2[]{new TestPolyStruct2(new TestPolyStruct2(new Character('X'), new Any( + Type.BOOLEAN, Boolean.TRUE)),new TestPolyStruct(new Character('X')))}, + new TestPolyStruct[][]{new TestPolyStruct[]{new TestPolyStruct(new Character('X'))}}, + new TestPolyStruct[][]{new TestPolyStruct[]{ + new TestPolyStruct(new TestPolyStruct2(new Character('X'), new Any(Type.BOOLEAN, Boolean.TRUE)))}}, + new TestPolyStruct[][]{new TestPolyStruct[] {new TestPolyStruct(new TestPolyStruct2( + new TestPolyStruct2(new Character('X'),new Any(Type.BOOLEAN, Boolean.TRUE)), "test"))}}, + new TestPolyStruct2[][]{new TestPolyStruct2[]{new TestPolyStruct2( + "test", new TestPolyStruct2(new Character('X'),new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE))))}}, + new TestPolyStruct2[][]{new TestPolyStruct2[]{new TestPolyStruct2( + new TestPolyStruct2(new Character('X'),new Any(Type.BOOLEAN, Boolean.TRUE)), + new TestPolyStruct(new Character('X')))}}); + } + + public XCurrentContextChecker getCurrentContextChecker() { + return new CurrentContextChecker(); + } + } + + /** + * Gives a factory for creating the service. + * This method is called by the <code>JavaLoader</code> + * <p> + * @return returns a <code>XSingleServiceFactory</code> for creating the component + * @param implName the name of the implementation for which a service is desired + * @param multiFactory the service manager to be uses if needed + * @param regKey the registryKey + * @see com.sun.star.comp.loader.JavaLoader + */ + public static XSingleServiceFactory __getServiceFactory(String implName, + XMultiServiceFactory multiFactory, + XRegistryKey regKey) + { + XSingleServiceFactory xSingleServiceFactory = null; + + if(implName.equals(_TestObject.class.getName())) + xSingleServiceFactory = FactoryHelper.getServiceFactory(_TestObject.class, + _TestObject.__serviceName, + multiFactory, + regKey); + + else if(implName.equals(_PerformancTestObject.class.getName())) + xSingleServiceFactory = FactoryHelper.getServiceFactory(_PerformancTestObject.class, + _PerformancTestObject.__serviceName, + multiFactory, + regKey); + + return xSingleServiceFactory; + } +} diff --git a/testtools/com/sun/star/comp/bridge/TestComponentMain.java b/testtools/com/sun/star/comp/bridge/TestComponentMain.java new file mode 100644 index 000000000..2c83161b3 --- /dev/null +++ b/testtools/com/sun/star/comp/bridge/TestComponentMain.java @@ -0,0 +1,146 @@ +/* + * 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 com.sun.star.comp.bridge; + +import com.sun.star.bridge.XBridge; +import com.sun.star.bridge.XBridgeFactory; +import com.sun.star.bridge.XInstanceProvider; + +import com.sun.star.uno.XComponentContext; +import com.sun.star.lang.EventObject; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XEventListener; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.container.XSet; + +import com.sun.star.connection.Acceptor; +import com.sun.star.connection.XAcceptor; +import com.sun.star.connection.XConnection; + +import com.sun.star.uno.UnoRuntime; + +public class TestComponentMain +{ + + private static class InstanceProvider implements XInstanceProvider { + private XComponentContext ctx; + + public InstanceProvider( XComponentContext ctx ) + { + this.ctx = ctx; + } + + public Object getInstance( /*IN*/String sInstanceName ) + throws com.sun.star.container.NoSuchElementException, com.sun.star.uno.RuntimeException + { + Object o =null; + try + { + o = ctx.getServiceManager().createInstanceWithContext( + "com.sun.star.comp.bridge.TestComponent$_TestObject" , ctx ); + } + catch( com.sun.star.uno.Exception e ) + { + System.out.println( "error during instantiation" + e ); + } + return o; + } + } + + public static void main(String args[]) throws Exception, com.sun.star.uno.Exception { + if(args.length != 2) { + System.err.println("usage : com.sun.star.comp.bridge.TestComponentMain uno:connection;protocol;objectName singleaccept"); + System.exit(-1); + } + + String conDcp = null; + String protDcp = null; + + String dcp = args[0]; + boolean singleaccept = args[1].equals("singleaccept"); + + int index = dcp.indexOf(':'); + dcp = dcp.substring(index + 1).trim(); + + index = dcp.indexOf(';'); + conDcp = dcp.substring(0, index).trim(); + dcp = dcp.substring(index + 1).trim(); + + index = dcp.indexOf(';'); + protDcp = dcp.substring(0, index).trim(); + dcp = dcp.substring(index + 1).trim(); + + XComponentContext ctx = com.sun.star.comp.helper.Bootstrap.createInitialComponentContext( null ); + XMultiComponentFactory smgr = ctx.getServiceManager(); + XMultiServiceFactory oldsmgr = + UnoRuntime.queryInterface( XMultiServiceFactory.class, smgr ); + + // prepare servicemanager + XSet set = UnoRuntime.queryInterface(XSet.class, smgr); + Object o = com.sun.star.comp.bridge.TestComponent.__getServiceFactory( + "com.sun.star.comp.bridge.TestComponent$_TestObject", oldsmgr,null ); + set.insert(o); + + XAcceptor xAcceptor = Acceptor.create(ctx); + + // coverity[loop_top] - deliberate 'infinite' loop. + while( true ) + { + System.err.println("waiting for connect..."); + + XConnection xConnection = xAcceptor.accept(conDcp); + + XBridgeFactory xBridgeFactory = UnoRuntime.queryInterface( + XBridgeFactory.class, + smgr.createInstanceWithContext("com.sun.star.bridge.BridgeFactory",ctx)); + + XBridge xBridge = xBridgeFactory.createBridge( + "", protDcp, xConnection, new InstanceProvider(ctx)); + + if (singleaccept) { + Listener listener = new Listener(); + UnoRuntime.queryInterface(XComponent.class, xBridge). + addEventListener(listener); + listener.await(); + break; + } + } + + } + + private static final class Listener implements XEventListener { + public synchronized void disposing(EventObject source) { + done = true; + notifyAll(); + } + + public synchronized void await() { + while (!done) { + try { + wait(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new RuntimeException(e); + } + } + } + + private boolean done = false; + } +} diff --git a/testtools/com/sun/star/comp/bridge/manifest b/testtools/com/sun/star/comp/bridge/manifest new file mode 100644 index 000000000..15c109825 --- /dev/null +++ b/testtools/com/sun/star/comp/bridge/manifest @@ -0,0 +1,2 @@ +RegistrationClassName: com.sun.star.comp.bridge.TestComponent + diff --git a/testtools/qa/cli/CLITest.java b/testtools/qa/cli/CLITest.java new file mode 100644 index 000000000..c3d6f8919 --- /dev/null +++ b/testtools/qa/cli/CLITest.java @@ -0,0 +1,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/. + * + * 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 cli; + + +import complexlib.ComplexTestCase; +import java.io.*; + +public class CLITest extends ComplexTestCase +{ + @Override + public String[] getTestMethodNames() + { + // TODO think about trigger of sub-tests from outside + return new String[] + { + "runCLITests" + }; + } + + public void runCLITests() + { + try + { + String testProgram = System.getProperty("cli_test", ""); + if (testProgram.length() == 0) + failed("Check the make file. Java must be called with -Dcli_test=pathtoexe"); + + String arg1 = System.getProperty("cli_test_arg", ""); + if (arg1.length() == 0) + failed("Check the make file. Java must be called with " + + "-Dcli_test_arg=path_to_bootstrap_ini"); + String[] cmdarray = new String[] {testProgram, arg1}; + + Process proc = null; + try{ + + proc = Runtime.getRuntime().exec(cmdarray); + new Reader(proc.getInputStream()); + new Reader(proc.getErrorStream()); + + + } + catch(Exception e) + { + System.out.println("\n ###" + e.getMessage() + "\n"); + + } + proc.waitFor(); + int retVal = proc.exitValue(); + if (retVal != 0) + failed("CLI test failed."); + } catch( java.lang.Exception e) + { + failed("Unexpected exception."); + } + + } +} + + +/* This reads from an InputStream and discards the data. + */ +class Reader extends Thread +{ + private InputStream is; + public Reader(InputStream stream) + { + is = stream; + start(); + } + + @Override + public void run() + { + try + { + byte[] buf = new byte[1024]; + while (-1 != is.read(buf)) {} + } + catch (java.io.IOException exc) + { + } + } +} diff --git a/testtools/qa/cli/makefile.mk b/testtools/qa/cli/makefile.mk new file mode 100644 index 000000000..13ee0bb96 --- /dev/null +++ b/testtools/qa/cli/makefile.mk @@ -0,0 +1,73 @@ +# +# 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 . +# + +PRJ := ..$/.. +PRJNAME := testtools +TARGET := test_cli +PACKAGE = cli + +.INCLUDE: settings.mk + +#----- compile .java files ----------------------------------------- + +JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar +JAVAFILES = CLITest.java +JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) + +#----- make a jar from compiled files ------------------------------ + +MAXLINELENGTH = 100000 + +JARCLASSDIRS = $(PACKAGE) +JARTARGET = $(TARGET).jar +JARCOMPRESS = TRUE + +ALLTAR: + +EXETARGET = $(BIN)$/cli_bridgetest_inprocess.exe +EXEARG_WIN= $(BIN)$/cli_bridgetest_inprocess.ini + +EXEARG= $(strip $(subst,$/,/ $(EXEARG_WIN))) + +.IF "$(depend)" == "" +ALL: ALLTAR +.ELSE +ALL: ALLDEP +.ENDIF + +.INCLUDE: target.mk + +# --- Parameters for the test -------------------------------------- + +# test base is java complex +CT_TESTBASE = -TestBase java_complex + +# test looks something like the.full.package.TestName +CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) + +# start the runner application +CT_APP = org.openoffice.Runner + +CT_NOOFFICE = -NoOffice +# --- Targets ------------------------------------------------------ + +RUN: +.IF "$(OS)"=="WNT" + java -cp $(CLASSPATH) -Dcli_test=$(EXETARGET) -Dcli_test_arg=$(EXEARG) $(CT_APP) $(CT_NOOFFICE) $(CT_TESTBASE) $(CT_TEST) +.ENDIF +run: RUN diff --git a/testtools/qa/cli/readme.txt b/testtools/qa/cli/readme.txt new file mode 100644 index 000000000..34531936a --- /dev/null +++ b/testtools/qa/cli/readme.txt @@ -0,0 +1,26 @@ +This test is for Windows only! + +The cli test uses .NET assemblies: +cli_types.dll, +cli_basetypes.dll, +cli_ure.dll, +cli_cppuhelper.dll. + + +When an office is properly installed then these assemblies can be found in the +global assembly cache (GAC), for example in c:\windows\assembly. + +When the test is run then the assemblies are used from the GAC. That is +one has to make sure that one has the respective office installed. + +The test can also be run without an installed office. Then the assemblies are used +which reside next to the executable. The testtools project copies the assemblies from +the build environment into the wntmscixx\bin folder. + +However, if for some reason an assembly remains in the GAC than it is used no matter +what. + + +The qa test simply executes the cli_bridgetest_inprocess.exe. All console output is discarded. +When the test fails one should directly run that executable. Then one may see the cause +of the failure in the console. diff --git a/testtools/qa/cliversioning/VersionTestCase.java b/testtools/qa/cliversioning/VersionTestCase.java new file mode 100644 index 000000000..d32faaa64 --- /dev/null +++ b/testtools/qa/cliversioning/VersionTestCase.java @@ -0,0 +1,98 @@ +/* + * 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 cliversioning; + + +import complexlib.ComplexTestCase; + + +public class VersionTestCase extends ComplexTestCase +{ + @Override + public String[] getTestMethodNames() + { + return new String[] + { + "checkVersion" + }; + } + + public void checkVersion() + { + int retVal = 0; + try + { + String testProgram = System.getProperty("cli_test_program"); + if (testProgram == null || testProgram.length() == 0) + failed("Check the make file. Java must be called with -Dcli_ure_test=pathtoexe"); + String unoPath = System.getProperty("path"); + if (unoPath == null || unoPath.length() == 0) + failed("Check the make file. Java must be called with -Duno_path=path_to_ure_bin_folder"); + String sSystemRoot = System.getProperty("SystemRoot"); + if (sSystemRoot == null || sSystemRoot.length() == 0) + failed("Check the make file. Java must be called with -DSystemRoot=%SystemRoot%."); + + //We need to set the PATH because otherwise it appears that runtests inherits the PATH + //from build environment. Then the bootstrapping fails because the libraries + //are not used from the office. + //.NET 2 requires SystemRoot being set. + String[] arEnv = new String[] { + "PATH=" + unoPath, "SystemRoot=" + sSystemRoot}; + Process proc = null; + + proc = Runtime.getRuntime().exec(testProgram, arEnv); + new Reader(proc.getInputStream()); + new Reader(proc.getErrorStream()); + proc.waitFor(); + retVal = proc.exitValue(); + } catch(Exception e) + { + e.printStackTrace(); + System.out.println(e.getMessage()); + failed("Unexpected exception."); + } + if (retVal != 0) + failed("Tests for library versioning failed."); + } +} + + +/* This reads from an InputStream and discards the data. + */ +class Reader extends Thread +{ + private java.io.InputStream is; + public Reader(java.io.InputStream stream) + { + is = stream; + start(); + } + + @Override + public void run() + { + try + { + byte[] buf = new byte[1024]; + while (-1 != is.read(buf)) {} + } + catch (java.io.IOException exc) + { + } + } +} diff --git a/testtools/qa/cliversioning/makefile.mk b/testtools/qa/cliversioning/makefile.mk new file mode 100644 index 000000000..dd3880bd1 --- /dev/null +++ b/testtools/qa/cliversioning/makefile.mk @@ -0,0 +1,84 @@ +# +# 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 . +# + + +# Builds the SpreadSheet examples of the Developers Guide. + +PRJ = ..$/.. +PRJNAME = cli_ure +TARGET := qa_test_climaker +PACKAGE = cliversioning + +.INCLUDE: settings.mk + +#----- compile .java files ----------------------------------------- + +JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar +JAVAFILES = VersionTestCase.java +JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) + +#----- make a jar from compiled files ------------------------------ + +MAXLINELENGTH = 100000 + +JARCLASSDIRS = $(PACKAGE) +JARTARGET = $(TARGET).jar +JARCOMPRESS = TRUE + + +.INCLUDE: target.mk + +ALLTAR : \ + echo + +echo : + @echo . + @echo ########################### N O T E ###################################### + @echo . + @echo To run the test you have to provide the path to the office location. It must + @echo contain the ure (d:\myOffice\LibreOffice\URE). + @echo Also an office must be installed with full system integration. + @echo Example: + @echo dmake run office="d:\myOffice" + @echo . + @echo To build a test library with a particular name run. The names must start with "version". + @echo For example: + @echo "dmake name=version_10_10_10.dll" + @echo ########################### N O T E ###################################### + @echo . + @echo . + +# --- Parameters for the test -------------------------------------- + +# test base is java complex +CT_TESTBASE = -TestBase java_complex + +# test looks something like the.full.package.TestName +CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) + +# start the runner application +CT_APP = org.openoffice.Runner + +CT_NOOFFICE = -NoOffice +# --- Targets ------------------------------------------------------ + +RUN: $(MISC)$/copyassemblies.done + java -cp $(CLASSPATH) -DSystemRoot=$(SystemRoot) -Dcli_test_program=$(BIN)$/runtests.exe -Dpath="$(office)"\LibreOffice\URE\bin $(CT_APP) $(CT_NOOFFICE) $(CT_TESTBASE) $(CT_TEST) + +run: RUN + diff --git a/testtools/source/bridgetest/bridgetest.component b/testtools/source/bridgetest/bridgetest.component new file mode 100644 index 000000000..ecbd2e333 --- /dev/null +++ b/testtools/source/bridgetest/bridgetest.component @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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 . + --> + +<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.bridge.BridgeTest"> + <service name="com.sun.star.test.bridge.BridgeTest"/> + </implementation> +</component> diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx new file mode 100644 index 000000000..160c95998 --- /dev/null +++ b/testtools/source/bridgetest/bridgetest.cxx @@ -0,0 +1,1316 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + + +#include <stdio.h> +#include <string.h> +#include <o3tl/any.hxx> +#include <osl/diagnose.h> +#include <osl/diagnose.hxx> +#include <osl/time.h> +#include <sal/types.h> +#include <typelib/typedescription.hxx> +#include <uno/dispatcher.hxx> +#include <uno/lbnames.h> +#include <uno/mapping.hxx> +#include <uno/data.h> +#include <uno/environment.hxx> + +#include <cppuhelper/factory.hxx> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/supportsservice.hxx> + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMain.hpp> +#include <com/sun/star/lang/XSingleComponentFactory.hpp> +#include <com/sun/star/bridge/UnoUrlResolver.hpp> +#include <com/sun/star/bridge/XUnoUrlResolver.hpp> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/uno/Type.hxx> + +#include <test/testtools/bridgetest/BadConstructorArguments.hpp> +#include <test/testtools/bridgetest/TestPolyStruct.hpp> +#include <test/testtools/bridgetest/XBridgeTest.hpp> +#include <test/testtools/bridgetest/XBridgeTest2.hpp> +#include <test/testtools/bridgetest/XMulti.hpp> + +#include "currentcontextchecker.hxx" +#include "multi.hxx" +#include <memory> + +using namespace osl; +using namespace cppu; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::registry; +using namespace com::sun::star::bridge; +using namespace test::testtools::bridgetest; + + +#define SERVICENAME "com.sun.star.test.bridge.BridgeTest" +#define IMPLNAME "com.sun.star.comp.bridge.BridgeTest" + +#define STRING_TEST_CONSTANT "\" paco\' chorizo\\\' \"\'" + +namespace bridge_test +{ +template<typename T, typename U = T> +static Sequence<T> cloneSequence(const Sequence<T>& val); + + +static Sequence< OUString > getSupportedServiceNames() +{ + return { SERVICENAME }; +} + +static bool check( bool b , char const * message ) +{ + if ( ! b ) + fprintf( stderr, "%s failed\n" , message ); + return b; +} + +namespace { + +bool checkEmpty(OUString const & string, char const * message) { + bool ok = string.isEmpty(); + if (!ok) { + fprintf( + stderr, "%s failed: %s\n", message, + OUStringToOString(string, RTL_TEXTENCODING_UTF8).getStr()); + } + return ok; +} + +class TestBridgeImpl : public osl::DebugBase<TestBridgeImpl>, + public WeakImplHelper< XMain, XServiceInfo > +{ + Reference< XComponentContext > m_xContext; + +public: + explicit TestBridgeImpl( const Reference< XComponentContext > & xContext ) + : m_xContext( xContext ) + {} + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) override; + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XMain + virtual sal_Int32 SAL_CALL run( const Sequence< OUString > & rArgs ) override; +}; + +} + +static bool equals( const TestElement & rData1, const TestElement & rData2 ) +{ + check( rData1.Bool == rData2.Bool, "### bool does not match!" ); + check( rData1.Char == rData2.Char, "### char does not match!" ); + check( rData1.Byte == rData2.Byte, "### byte does not match!" ); + check( rData1.Short == rData2.Short, "### short does not match!" ); + check( rData1.UShort == rData2.UShort, "### unsigned short does not match!" ); + check( rData1.Long == rData2.Long, "### long does not match!" ); + check( rData1.ULong == rData2.ULong, "### unsigned long does not match!" ); + check( rData1.Hyper == rData2.Hyper, "### hyper does not match!" ); + check( rData1.UHyper == rData2.UHyper, "### unsigned hyper does not match!" ); + check( rData1.Float == rData2.Float, "### float does not match!" ); + check( rData1.Double == rData2.Double, "### double does not match!" ); + check( rData1.Enum == rData2.Enum, "### enum does not match!" ); + check( rData1.String == rData2.String, "### string does not match!" ); + check( rData1.Byte2 == rData2.Byte2, "### byte2 does not match!" ); + check( rData1.Short2 == rData2.Short2, "### short2 does not match!" ); + check( rData1.Interface == rData2.Interface, "### interface does not match!" ); + check( rData1.Any == rData2.Any, "### any does not match!" ); + + return (rData1.Bool == rData2.Bool && + rData1.Char == rData2.Char && + rData1.Byte == rData2.Byte && + rData1.Short == rData2.Short && + rData1.UShort == rData2.UShort && + rData1.Long == rData2.Long && + rData1.ULong == rData2.ULong && + rData1.Hyper == rData2.Hyper && + rData1.UHyper == rData2.UHyper && + rData1.Float == rData2.Float && + rData1.Double == rData2.Double && + rData1.Enum == rData2.Enum && + rData1.String == rData2.String && + rData1.Byte2 == rData2.Byte2 && + rData1.Short2 == rData2.Short2 && + rData1.Interface == rData2.Interface && + rData1.Any == rData2.Any); +} + +static bool equals( const TestData & rData1, const TestData & rData2 ) +{ + sal_Int32 nLen; + + if (rData1.Sequence != rData2.Sequence) + return false; + if (!equals( static_cast<const TestElement &>(rData1), static_cast<const TestElement &>(rData2) )) + return false; + nLen = rData1.Sequence.getLength(); + if (nLen == rData2.Sequence.getLength()) + { + // once again by hand sequence == + const TestElement * pElements1 = rData1.Sequence.getConstArray(); + const TestElement * pElements2 = rData2.Sequence.getConstArray(); + for ( ; nLen--; ) + { + if (! equals( pElements1[nLen], pElements2[nLen] )) + { + check( false, "### sequence element did not match!" ); + return false; + } + } + return true; + } + return false; +} + +static void assign( TestElement & rData, + bool bBool, sal_Unicode cChar, sal_Int8 nByte, + sal_Int16 nShort, sal_uInt16 nUShort, + sal_Int32 nLong, sal_uInt32 nULong, + sal_Int64 nHyper, sal_uInt64 nUHyper, + float fFloat, double fDouble, + TestEnum eEnum, const OUString& rStr, + sal_Int8 nByte2, sal_Int16 nShort2, + const css::uno::Reference< css::uno::XInterface >& xTest, + const css::uno::Any& rAny ) +{ + rData.Bool = bBool; + rData.Char = cChar; + rData.Byte = nByte; + rData.Short = nShort; + rData.UShort = nUShort; + rData.Long = nLong; + rData.ULong = nULong; + rData.Hyper = nHyper; + rData.UHyper = nUHyper; + rData.Float = fFloat; + rData.Double = fDouble; + rData.Enum = eEnum; + rData.String = rStr; + rData.Byte2 = nByte2; + rData.Short2 = nShort2; + rData.Interface = xTest; + rData.Any = rAny; +} + +namespace { + +template < typename T > +bool testAny( + T const & value, Reference< XBridgeTest > const & xLBT, + char const * typeName = nullptr) +{ + Any any; + any <<= value; + Any any2 = xLBT->transportAny(any); + bool success = true; + if (any != any2) { + fprintf( + stderr, "any is different after roundtrip: in %s, out %s\n", + OUStringToOString( + any.getValueType().getTypeName(), + RTL_TEXTENCODING_ASCII_US).getStr(), + OUStringToOString( + any2.getValueType().getTypeName(), + RTL_TEXTENCODING_ASCII_US).getStr()); + success = false; + } + if (typeName != nullptr + && !any2.getValueType().getTypeName().equalsAscii(typeName)) + { + fprintf( + stderr, "any has wrong type after roundtrip: %s instead of %s\n", + OUStringToOString( + any2.getValueType().getTypeName(), + RTL_TEXTENCODING_ASCII_US).getStr(), + typeName); + success = false; + } + return success; +} + +} + +static bool performAnyTest( const Reference< XBridgeTest > &xLBT, const TestData &data) +{ + bool bReturn = true; + bReturn = testAny( data.Byte ,xLBT ) && bReturn; + bReturn = testAny( data.Short,xLBT ) && bReturn; + bReturn = testAny( data.UShort,xLBT ) && bReturn; + bReturn = testAny( data.Long,xLBT ) && bReturn; + bReturn = testAny( data.ULong,xLBT ) && bReturn; + bReturn = testAny( data.Hyper,xLBT ) && bReturn; + bReturn = testAny( data.UHyper,xLBT ) && bReturn; + bReturn = testAny( data.Float,xLBT ) && bReturn; + bReturn = testAny( data.Double,xLBT ) && bReturn; + bReturn = testAny( data.Enum,xLBT ) && bReturn; + bReturn = testAny( data.String,xLBT ) && bReturn; + bReturn = testAny( data.Byte2 ,xLBT ) && bReturn; + bReturn = testAny( data.Short2,xLBT ) && bReturn; + bReturn = testAny( data.Interface,xLBT ) && bReturn; + bReturn = testAny( data, xLBT ) && bReturn; + bReturn &= testAny( + TestPolyStruct< sal_Unicode >(' '), xLBT, + "test.testtools.bridgetest.TestPolyStruct<char>"); + + Any a; + { + a <<= data.Bool; + OSL_ASSERT( xLBT->transportAny( a ) == a ); + } + + { + a <<= data.Char; + OSL_ASSERT( xLBT->transportAny( a ) == a ); + } + + return bReturn; +} + + +static bool performSequenceOfCallTest( const Reference < XBridgeTest > &xLBT ) +{ + sal_Int32 i,nRounds; + sal_Int32 nGlobalIndex = 0; + const sal_Int32 nWaitTimeSpanMUSec = 10000; + for( nRounds = 0 ; nRounds < 10 ; nRounds ++ ) + { + for( i = 0 ; i < nRounds ; i ++ ) + { + // fire oneways + xLBT->callOneway( nGlobalIndex , nWaitTimeSpanMUSec ); + nGlobalIndex ++; + } + + // call synchron + xLBT->call( nGlobalIndex , nWaitTimeSpanMUSec ); + nGlobalIndex ++; + } + + return xLBT->sequenceOfCallTestPassed(); +} + +namespace { + +class ORecursiveCall : public WeakImplHelper< XRecursiveCall > +{ +private: + Mutex m_mutex; + +public: + void SAL_CALL callRecursivly( + const css::uno::Reference< XRecursiveCall >& xCall, + sal_Int32 nToCall ) override + { + MutexGuard guard( m_mutex ); + if( nToCall ) + { + nToCall --; + xCall->callRecursivly( this , nToCall ); + } + + } +}; + +} + +static bool performRecursiveCallTest( const Reference < XBridgeTest > & xLBT ) +{ + xLBT->startRecursiveCall( new ORecursiveCall , 50 ); + // on failure, the test would lock up or crash + return true; +} + +namespace { + +class MyClass : public osl::DebugBase<MyClass>, public OWeakObject +{ +public: + MyClass(); +}; + +} + +MyClass::MyClass() +{ +} + +static bool performTest( + const Reference<XComponentContext> & xContext, + const Reference<XBridgeTest > & xLBT, + bool noCurrentContext ) +{ + check(xLBT.is(), "### no test interface!"); + bool bRet = true; + if (xLBT.is()) { + // this data is never ever granted access to by calls other than + // equals(), assign()! + TestData aData; // test against this data + Reference< XInterface > xI(new MyClass); + assign( + static_cast<TestElement &>(aData), true, '@', 17, 0x1234, 0xFEDC, + 0x12345678, 0xFEDCBA98, SAL_CONST_INT64(0x123456789ABCDEF0), + SAL_CONST_UINT64(0xFEDCBA9876543210), 17.0815f, 3.1415926359, + TestEnum_LOLA, STRING_TEST_CONSTANT, 18, 0x5678, xI, + Any(&xI, cppu::UnoType<XInterface>::get())); + bRet &= check(aData.Any == xI, "### unexpected any!"); + bRet &= check(!(aData.Any != xI), "### unexpected any!"); + aData.Sequence.realloc(2); + aData.Sequence[0] = *static_cast<TestElement const *>(&aData); + // aData.Sequence[1] is empty + // aSetData is a manually copy of aData for first setting: + TestData aSetData; + assign( + static_cast<TestElement &>(aSetData), aData.Bool, aData.Char, + aData.Byte, aData.Short, aData.UShort, aData.Long, aData.ULong, + aData.Hyper, aData.UHyper, aData.Float, aData.Double, aData.Enum, + aData.String, aData.Byte2, aData.Short2, xI, Any(&xI, cppu::UnoType<XInterface>::get())); + aSetData.Sequence.realloc(2); + aSetData.Sequence[0] = *static_cast<TestElement const *>(&aSetData); + // aSetData.Sequence[1] is empty + xLBT->setValues( + aSetData.Bool, + aSetData.Char, + aSetData.Byte, + aSetData.Short, + aSetData.UShort, + aSetData.Long, + aSetData.ULong, + aSetData.Hyper, + aSetData.UHyper, + aSetData.Float, + aSetData.Double, + aSetData.Enum, + aSetData.String, + aSetData.Byte2, + aSetData.Short2, + aSetData.Interface, + aSetData.Any, + aSetData.Sequence, + aSetData); + { + TestData aRet; + TestData aRet2; + xLBT->getValues( + aRet.Bool, + aRet.Char, + aRet.Byte, + aRet.Short, + aRet.UShort, + aRet.Long, + aRet.ULong, + aRet.Hyper, + aRet.UHyper, + aRet.Float, + aRet.Double, + aRet.Enum, + aRet.String, + aRet.Byte2, + aRet.Short2, + aRet.Interface, + aRet.Any, + aRet.Sequence, + aRet2); + bRet &= check( + equals(aData, aRet) && equals(aData, aRet2), "getValues test"); + // Set last retrieved values: + TestData aSV2ret( + xLBT->setValues2( + aRet.Bool, + aRet.Char, + aRet.Byte, + aRet.Short, + aRet.UShort, + aRet.Long, + aRet.ULong, + aRet.Hyper, + aRet.UHyper, + aRet.Float, + aRet.Double, + aRet.Enum, + aRet.String, + aRet.Byte2, + aRet.Short2, + aRet.Interface, + aRet.Any, + aRet.Sequence, + aRet2)); + // Check inout sequence order (=> inout sequence parameter was + // switched by test objects): + TestElement temp(aRet.Sequence[0]); + aRet.Sequence[0] = aRet.Sequence[1]; + aRet.Sequence[1] = temp; + bRet &= check( + equals(aData, aSV2ret) && equals(aData, aRet2), + "getValues2 test"); + } + { + TwoFloats aIn(1.1f, 2.2f); + TwoFloats aOut = xLBT->echoTwoFloats(aIn); + bRet = check( memcmp(&aIn, &aOut, sizeof(TwoFloats)) == 0, "two floats struct test" ) && bRet; + } + { + FourFloats aIn(3.3f, 4.4f, 5.5f, 6.6f); + FourFloats aOut = xLBT->echoFourFloats(aIn); + bRet = check( memcmp(&aIn, &aOut, sizeof(FourFloats)) == 0, "four floats struct test" ) && bRet; + } + { + MixedFloatAndInteger aIn(7.7f, 8); + MixedFloatAndInteger aOut = xLBT->echoMixedFloatAndInteger(aIn); + bRet = check( memcmp(&aIn, &aOut, sizeof(MixedFloatAndInteger)) == 0, "mixed float and integer struct test" ) && bRet; + } + { + ThreeByteStruct aIn(9, 10, 11); + ThreeByteStruct aOut = xLBT->echoThreeByteStruct(aIn); + bRet = check( memcmp(&aIn, &aOut, sizeof(ThreeByteStruct)) == 0, "three byte struct test" ) && bRet; + } + { + TestData aRet; + TestData aRet2; + TestData aGVret( + xLBT->getValues( + aRet.Bool, + aRet.Char, + aRet.Byte, + aRet.Short, + aRet.UShort, + aRet.Long, + aRet.ULong, + aRet.Hyper, + aRet.UHyper, + aRet.Float, + aRet.Double, + aRet.Enum, + aRet.String, + aRet.Byte2, + aRet.Short2, + aRet.Interface, + aRet.Any, + aRet.Sequence, + aRet2)); + bRet &= check( + (equals(aData, aRet) && equals(aData, aRet2) && + equals(aData, aGVret)), + "getValues test"); + // Set last retrieved values: + xLBT->setBool(aRet.Bool); + xLBT->setChar(aRet.Char); + xLBT->setByte(aRet.Byte); + xLBT->setShort(aRet.Short); + xLBT->setUShort(aRet.UShort); + xLBT->setLong(aRet.Long); + xLBT->setULong(aRet.ULong); + xLBT->setHyper(aRet.Hyper); + xLBT->setUHyper(aRet.UHyper); + xLBT->setFloat(aRet.Float); + xLBT->setDouble(aRet.Double); + xLBT->setEnum(aRet.Enum); + xLBT->setString(aRet.String); + xLBT->setByte2(aRet.Byte2); + xLBT->setShort2(aRet.Short2); + xLBT->setInterface(aRet.Interface); + xLBT->setAny(aRet.Any); + xLBT->setSequence(aRet.Sequence); + xLBT->setStruct(aRet2); + } + { + TestData aRet; + aRet.Hyper = xLBT->getHyper(); + aRet.UHyper = xLBT->getUHyper(); + aRet.Float = xLBT->getFloat(); + aRet.Double = xLBT->getDouble(); + aRet.Byte = xLBT->getByte(); + aRet.Char = xLBT->getChar(); + aRet.Bool = xLBT->getBool(); + aRet.Short = xLBT->getShort(); + aRet.UShort = xLBT->getUShort(); + aRet.Long = xLBT->getLong(); + aRet.ULong = xLBT->getULong(); + aRet.Enum = xLBT->getEnum(); + aRet.String = xLBT->getString(); + aRet.Byte2 = xLBT->getByte2(); + aRet.Short2 = xLBT->getShort2(); + aRet.Interface = xLBT->getInterface(); + aRet.Any = xLBT->getAny(); + aRet.Sequence = xLBT->getSequence(); + TestData aRet2(xLBT->getStruct()); + bRet &= check( + equals(aData, aRet) && equals(aData, aRet2), + "struct comparison test"); + { + SmallStruct aIn(1, 2); + SmallStruct aOut(xLBT->echoSmallStruct(aIn)); + bRet &= check( + memcmp(&aIn, &aOut, sizeof(SmallStruct)) == 0, + "small struct test"); + } + { + MediumStruct aIn(1, 2, 3, 4); + MediumStruct aOut(xLBT->echoMediumStruct(aIn)); + bRet &= check( + memcmp(&aIn, &aOut, sizeof(MediumStruct)) == 0, + "medium struct test"); + } + { + BigStruct aIn(1, 2, 3, 4, 5, 6, 7, 8); + BigStruct aOut(xLBT->echoBigStruct(aIn)); + bRet &= check( + memcmp(&aIn, &aOut, sizeof(BigStruct)) == 0, + "big struct test"); + } + { + sal_Int32 i2 = xLBT->testPPCAlignment(0, 0, 0, 0, 0xBEAF); + bRet &= check(i2 == 0xBEAF, "ppc-style alignment test"); + } + { + sal_Int32 i1 = xLBT->testPPC64Alignment(1.0, 2.0, 3.0, 0xBEAF); + bRet &= check(i1 == 0xBEAF, "ppc64-style alignment test"); + } + { + double d1 = xLBT->testTenDoubles(0.1, 0.2, 0.3, 0.4, 0.5, + 0.6, 0.7, 0.8, 0.9, 1.0); + bRet &= check(d1 == 5.5, "armhf doubles test"); + } + // Test extended attributes that raise exceptions: + try { + xLBT->getRaiseAttr1(); + bRet &= check(false, "getRaiseAttr1 did not throw"); + } catch (const RuntimeException &) { + } catch (...) { + bRet &= check(false, "getRaiseAttr1 threw wrong type"); + } + try { + xLBT->setRaiseAttr1(0); + bRet &= check(false, "setRaiseAttr1 did not throw"); + } catch (const IllegalArgumentException &) { + } catch (...) { + bRet &= check(false, "setRaiseAttr1 threw wrong type"); + } + try { + xLBT->getRaiseAttr2(); + bRet &= check(false, "getRaiseAttr2 did not throw"); + } catch (const IllegalArgumentException &) { + } catch (...) { + bRet &= check(false, "getRaiseAttr2 threw wrong type"); + } + // Test instantiated polymorphic struct types: + { + bRet &= check( + (xLBT->transportPolyBoolean( + TestPolyStruct< sal_Bool >(true)). + member), + "transportPolyBoolean"); + TestPolyStruct< sal_Int64 > tps1(12345); + xLBT->transportPolyHyper(tps1); + bRet &= check(tps1.member == 12345, "transportPolyHyper"); + Sequence< Any > seq(2); + seq[0] <<= static_cast< sal_uInt32 >(33); + seq[1] <<= OUString("ABC"); + TestPolyStruct< Sequence< Any > > tps2(seq); + TestPolyStruct< Sequence< Any > > tps3; + xLBT->transportPolySequence(tps2, tps3); + bRet &= check( + tps3.member.getLength() == 2, + "transportPolySequence, length"); + sal_uInt32 v0 = sal_uInt32(); + tps3.member[0] >>= v0; + bRet &= check(v0 == 33, "transportPolySequence, element 0"); + OUString v1; + tps3.member[1] >>= v1; + bRet &= check( v1 == "ABC", "transportPolySequence, element 1" ); + bRet &= check( + xLBT->getNullPolyLong().member == 0, "getNullPolyLong"); + bRet &= check( + xLBT->getNullPolyString().member.isEmpty(), + "getNullPolyString"); + bRet &= check( + xLBT->getNullPolyType().member == Type(), + "getNullPolyType"); + Any nullAny(xLBT->getNullPolyAny().member); + auto ifc = o3tl::tryAccess<Reference<XInterface>>(nullAny); + bRet &= check( + !nullAny.hasValue() || (ifc && !ifc->is()), + "getNullPolyAny"); + bRet &= check( + !xLBT->getNullPolySequence().member.hasElements(), + "getNullPolySequence"); + bRet &= check( + xLBT->getNullPolyEnum().member == TestEnum_TEST, + "getNullPolyEnum"); + bRet &= check( + xLBT->getNullPolyBadEnum().member == TestBadEnum_M, + "getNullPolyBadEnum"); + bRet &= check( + xLBT->getNullPolyStruct().member.member == 0, + "getNullPolyStruct"); + bRet &= check( + !xLBT->getNullPolyInterface().member.is(), + "getNullPolyInterface"); + } + // Any test: + bRet &= check(performAnyTest(xLBT , aData), "any test"); + // Sequence of call test: + bRet &= check( + performSequenceOfCallTest(xLBT), "sequence of call test"); + // Recursive call test: + bRet &= check(performRecursiveCallTest(xLBT), "recursive test"); + bRet &= check( + equals(aData, aRet) && equals(aData, aRet2), + "recursive test results"); + // Multiple inheritance test: + bRet &= checkEmpty( + testtools::bridgetest::testMulti(xLBT->getMulti()), + "remote multi"); + bRet &= checkEmpty( + xLBT->testMulti(new testtools::bridgetest::Multi), + "local multi"); + } + } + { + Reference< XBridgeTest2 > xBT2(xLBT, UNO_QUERY); + if (!xBT2.is()) { + return bRet; + } + // Perform sequence tests (XBridgeTest2); create the sequence which is + // compared with the results: + sal_Int32 _arLong[] = { + static_cast< sal_Int32 >(0x80000000), 1, 0x7FFFFFFF }; + sal_Int32 _aInt = 0xBABEBABE; + float _aFloat = 3.14f; + Any _any1(true); + Any _any2(&_aInt, cppu::UnoType<sal_Int32>::get()); + Any _any3(&_aFloat, cppu::UnoType<float>::get()); + Any _arAny[] = { _any1, _any2, _any3 }; + Reference< XInterface > _arObj[3]; + _arObj[0] = new OWeakObject(); + _arObj[1] = new OWeakObject(); + _arObj[2] = new OWeakObject(); + TestElement _arStruct[3]; + assign( + _arStruct[0], true, '@', 17, 0x1234, 0xFEDC, 0x12345678, 0xFEDCBA98, + SAL_CONST_INT64(0x123456789ABCDEF0), + SAL_CONST_UINT64(0xFEDCBA9876543210), 17.0815f, 3.1415926359, + TestEnum_LOLA, STRING_TEST_CONSTANT, 18, 0x5678, _arObj[0], + Any(&_arObj[0], cppu::UnoType<XInterface>::get())); + assign( + _arStruct[1], true, 'A', 17, 0x1234, 0xFEDC, 0x12345678, 0xFEDCBA98, + SAL_CONST_INT64(0x123456789ABCDEF0), + SAL_CONST_UINT64(0xFEDCBA9876543210), 17.0815f, 3.1415926359, + TestEnum_TWO, STRING_TEST_CONSTANT, 18, 0x5678, _arObj[1], + Any(&_arObj[1], cppu::UnoType<XInterface>::get())); + assign( + _arStruct[2], true, 'B', 17, 0x1234, 0xFEDC, 0x12345678, 0xFEDCBA98, + SAL_CONST_INT64(0x123456789ABCDEF0), + SAL_CONST_UINT64(0xFEDCBA9876543210), 17.0815f, 3.1415926359, + TestEnum_CHECK, STRING_TEST_CONSTANT, 18, 0x5678, _arObj[2], + Any(&_arObj[2], cppu::UnoType<XInterface>::get())); + { + Sequence<sal_Bool> arBool({true, false, true}); + Sequence<sal_Unicode> arChar({0x0065, 0x0066, 0x0067}); + Sequence<sal_Int8> arByte({1, 2, -1}); + Sequence<sal_Int16> arShort({-0x8000, 1, 0x7FFF}); + Sequence<sal_uInt16> arUShort({0 , 1, 0xFFFF}); + Sequence<sal_Int32> arLong(_arLong, 3); + Sequence<sal_uInt32> arULong({0, 1, 0xFFFFFFFF}); + Sequence<sal_Int64> arHyper({ + static_cast<sal_Int64>(SAL_CONST_INT64(0x8000000000000000)), 1, + SAL_CONST_INT64(0x7FFFFFFFFFFFFFFF)}); + Sequence<sal_uInt64> arUHyper({ + 0, 1, SAL_CONST_UINT64(0xFFFFFFFFFFFFFFFF)}); + Sequence<float> arFloat({1.1f, 2.2f, 3.3f}); + Sequence<double> arDouble({1.11, 2.22, 3.33}); + Sequence<OUString> arString({ + OUString("String 1"), OUString("String 2"), + OUString("String 3")}); + Sequence<Any> arAny(_arAny, 3); + Sequence<Reference<XInterface> > arObject(_arObj, 3); + Sequence<TestEnum> arEnum({ + TestEnum_ONE, TestEnum_TWO, TestEnum_CHECK}); + Sequence<TestElement> arStruct(_arStruct, 3); + Sequence<Sequence<sal_Int32> > _arSeqLong2[3]; + for (int j = 0; j != 3; ++j) { + Sequence< sal_Int32 > _arSeqLong[3]; + for (int i = 0; i != 3; ++i) { + _arSeqLong[i] = Sequence< sal_Int32 >(_arLong, 3); + } + _arSeqLong2[j] = Sequence< Sequence< sal_Int32 > >( + _arSeqLong, 3); + } + Sequence< Sequence< Sequence< sal_Int32> > > arLong3( + _arSeqLong2, 3); + Sequence< Sequence< sal_Int32 > > seqSeqRet( + xBT2->setDim2(arLong3[0])); + bRet &= check(seqSeqRet == arLong3[0], "sequence test"); + Sequence< Sequence< Sequence< sal_Int32 > > > seqSeqRet2( + xBT2->setDim3(arLong3)); + bRet &= check(seqSeqRet2 == arLong3, "sequence test"); + Sequence< Any > seqAnyRet(xBT2->setSequenceAny(arAny)); + bRet &= check(seqAnyRet == arAny, "sequence test"); + Sequence< sal_Bool > seqBoolRet(xBT2->setSequenceBool(arBool)); + bRet &= check(seqBoolRet == arBool, "sequence test"); + Sequence< sal_Int8 > seqByteRet(xBT2->setSequenceByte(arByte)); + bRet &= check(seqByteRet == arByte, "sequence test"); + Sequence< sal_Unicode > seqCharRet(xBT2->setSequenceChar(arChar)); + bRet &= check(seqCharRet == arChar, "sequence test"); + Sequence< sal_Int16 > seqShortRet(xBT2->setSequenceShort(arShort)); + bRet &= check(seqShortRet == arShort, "sequence test"); + Sequence< sal_Int32 > seqLongRet(xBT2->setSequenceLong(arLong)); + bRet &= check(seqLongRet == arLong, "sequence test"); + Sequence< sal_Int64 > seqHyperRet(xBT2->setSequenceHyper(arHyper)); + bRet &= check(seqHyperRet == arHyper, "sequence test"); + Sequence< float > seqFloatRet(xBT2->setSequenceFloat(arFloat)); + bRet &= check(seqFloatRet == arFloat, "sequence test"); + Sequence< double > seqDoubleRet(xBT2->setSequenceDouble(arDouble)); + bRet &= check(seqDoubleRet == arDouble, "sequence test"); + Sequence< TestEnum > seqEnumRet(xBT2->setSequenceEnum(arEnum)); + bRet &= check(seqEnumRet == arEnum, "sequence test"); + Sequence< sal_uInt16 > seqUShortRet( + xBT2->setSequenceUShort(arUShort)); + bRet &= check(seqUShortRet == arUShort, "sequence test"); + Sequence< sal_uInt32 > seqULongRet(xBT2->setSequenceULong(arULong)); + bRet &= check(seqULongRet == arULong, "sequence test"); + Sequence< sal_uInt64 > seqUHyperRet( + xBT2->setSequenceUHyper(arUHyper)); + bRet &= check(seqUHyperRet == arUHyper, "sequence test"); + Sequence< Reference< XInterface > > seqObjectRet( + xBT2->setSequenceXInterface(arObject)); + bRet &= check(seqObjectRet == arObject, "sequence test"); + Sequence< OUString > seqStringRet( + xBT2->setSequenceString(arString)); + bRet &= check(seqStringRet == arString, "sequence test"); + Sequence< TestElement > seqStructRet( + xBT2->setSequenceStruct(arStruct)); + bRet &= check(seqStructRet == arStruct, "sequence test"); + Sequence< sal_Bool > arBoolTemp(cloneSequence(arBool)); + Sequence< sal_Unicode > arCharTemp(cloneSequence<sal_Unicode, cppu::UnoCharType>(arChar)); + Sequence< sal_Int8 > arByteTemp(cloneSequence(arByte)); + Sequence< sal_Int16 > arShortTemp(cloneSequence(arShort)); + Sequence< sal_uInt16 > arUShortTemp(cloneSequence<sal_uInt16, cppu::UnoUnsignedShortType>(arUShort)); + Sequence< sal_Int32 > arLongTemp(cloneSequence(arLong)); + Sequence< sal_uInt32 > arULongTemp(cloneSequence(arULong)); + Sequence< sal_Int64 > arHyperTemp(cloneSequence(arHyper)); + Sequence< sal_uInt64 > arUHyperTemp(cloneSequence(arUHyper)); + Sequence< float > arFloatTemp(cloneSequence(arFloat)); + Sequence< double > arDoubleTemp(cloneSequence(arDouble)); + Sequence< TestEnum > arEnumTemp(cloneSequence(arEnum)); + Sequence< OUString > arStringTemp(cloneSequence(arString)); + Sequence< Reference< XInterface > > arObjectTemp( + cloneSequence(arObject)); + Sequence< Any > arAnyTemp(cloneSequence(arAny)); + Sequence< Sequence< sal_Int32 > > arLong2Temp(arLong3[0]); + Sequence< Sequence< Sequence< sal_Int32 > > > arLong3Temp(arLong3); + xBT2->setSequencesInOut( + arBoolTemp, arCharTemp, arByteTemp, arShortTemp, arUShortTemp, + arLongTemp,arULongTemp, arHyperTemp, arUHyperTemp, arFloatTemp, + arDoubleTemp, arEnumTemp, arStringTemp, arObjectTemp, arAnyTemp, + arLong2Temp, arLong3Temp); + bRet &= check( + (arBoolTemp == arBool && arCharTemp == arChar && + arByteTemp == arByte && arShortTemp == arShort && + arUShortTemp == arUShort && arLongTemp == arLong && + arULongTemp == arULong && arHyperTemp == arHyper && + arUHyperTemp == arUHyper && arFloatTemp == arFloat && + arDoubleTemp == arDouble && arEnumTemp == arEnum && + arStringTemp == arString && arObjectTemp == arObject && + arAnyTemp == arAny && arLong2Temp == arLong3[0] && + arLong3Temp == arLong3), + "sequence test"); + Sequence< sal_Bool > arBoolOut; + Sequence< sal_Unicode > arCharOut; + Sequence< sal_Int8 > arByteOut; + Sequence< sal_Int16 > arShortOut; + Sequence< sal_uInt16 > arUShortOut; + Sequence< sal_Int32 > arLongOut; + Sequence< sal_uInt32 > arULongOut; + Sequence< sal_Int64 > arHyperOut; + Sequence< sal_uInt64 > arUHyperOut; + Sequence< float > arFloatOut; + Sequence< double > arDoubleOut; + Sequence< TestEnum > arEnumOut; + Sequence< OUString > arStringOut; + Sequence< Reference< XInterface > > arObjectOut; + Sequence< Any > arAnyOut; + Sequence< Sequence< sal_Int32 > > arLong2Out; + Sequence< Sequence< Sequence< sal_Int32 > > > arLong3Out; + xBT2->setSequencesOut( + arBoolOut, arCharOut, arByteOut, arShortOut, arUShortOut, + arLongOut,arULongOut, arHyperOut, arUHyperOut, arFloatOut, + arDoubleOut, arEnumOut, arStringOut, arObjectOut, arAnyOut, + arLong2Out, arLong3Out); + bRet &= check( + (arBoolOut == arBool && arCharOut == arChar && + arByteOut == arByte && arShortOut == arShort && + arUShortOut == arUShort && arLongOut == arLong && + arULongOut == arULong && arHyperOut == arHyper && + arUHyperOut == arUHyper && arFloatOut == arFloat && + arDoubleOut == arDouble && arEnumOut == arEnum && + arStringOut == arString && arObjectOut == arObject && + arAnyOut == arAny && arLong2Out == arLong3[0] && + arLong3Out == arLong3), + "sequence test"); + } + { + // Test with empty sequences: + Sequence< Sequence< sal_Int32 > > arLong2; + Sequence< Sequence< sal_Int32 > > seqSeqRet(xBT2->setDim2(arLong2)); + bRet &= check(seqSeqRet == arLong2, "sequence test"); + Sequence< Sequence< Sequence< sal_Int32 > > > arLong3; + Sequence< Sequence< Sequence< sal_Int32 > > > seqSeqRet2( + xBT2->setDim3(arLong3)); + bRet &= check(seqSeqRet2 == arLong3, "sequence test"); + Sequence< Any > arAny; + Sequence< Any > seqAnyRet(xBT2->setSequenceAny(arAny)); + bRet &= check(seqAnyRet == arAny, "sequence test"); + Sequence< sal_Bool > arBool; + Sequence< sal_Bool > seqBoolRet(xBT2->setSequenceBool(arBool)); + bRet &= check(seqBoolRet == arBool, "sequence test"); + Sequence< sal_Int8 > arByte; + Sequence< sal_Int8 > seqByteRet(xBT2->setSequenceByte(arByte)); + bRet &= check(seqByteRet == arByte, "sequence test"); + Sequence< sal_Unicode > arChar; + Sequence< sal_Unicode > seqCharRet(xBT2->setSequenceChar(arChar)); + bRet &= check(seqCharRet == arChar, "sequence test"); + Sequence< sal_Int16 > arShort; + Sequence< sal_Int16 > seqShortRet(xBT2->setSequenceShort(arShort)); + bRet &= check(seqShortRet == arShort, "sequence test"); + Sequence< sal_Int32 > arLong; + Sequence< sal_Int32 > seqLongRet(xBT2->setSequenceLong(arLong)); + bRet &= check(seqLongRet == arLong, "sequence test"); + Sequence< sal_Int64 > arHyper; + Sequence< sal_Int64 > seqHyperRet(xBT2->setSequenceHyper(arHyper)); + bRet &= check(seqHyperRet == arHyper, "sequence test"); + Sequence< float > arFloat; + Sequence< float > seqFloatRet(xBT2->setSequenceFloat(arFloat)); + bRet &= check(seqFloatRet == arFloat, "sequence test"); + Sequence< double > arDouble; + Sequence< double > seqDoubleRet(xBT2->setSequenceDouble(arDouble)); + bRet &= check(seqDoubleRet == arDouble, "sequence test"); + Sequence< TestEnum > arEnum; + Sequence< TestEnum > seqEnumRet(xBT2->setSequenceEnum(arEnum)); + bRet &= check(seqEnumRet == arEnum, "sequence test"); + Sequence< sal_uInt16 > arUShort; + Sequence< sal_uInt16 > seqUShortRet( + xBT2->setSequenceUShort(arUShort)); + bRet &= check(seqUShortRet == arUShort, "sequence test"); + Sequence< sal_uInt32 > arULong; + Sequence< sal_uInt32 > seqULongRet(xBT2->setSequenceULong(arULong)); + bRet &= check(seqULongRet == arULong, "sequence test"); + Sequence< sal_uInt64 > arUHyper; + Sequence< sal_uInt64 > seqUHyperRet( + xBT2->setSequenceUHyper(arUHyper)); + bRet &= check(seqUHyperRet == arUHyper, "sequence test"); + Sequence< Reference< XInterface > > arObject; + Sequence< Reference< XInterface > > seqObjectRet( + xBT2->setSequenceXInterface(arObject)); + bRet &= check(seqObjectRet == arObject, "sequence test"); + Sequence< OUString > arString; + Sequence< OUString > seqStringRet( + xBT2->setSequenceString(arString)); + bRet &= check(seqStringRet == arString, "sequence test"); + Sequence< TestElement > arStruct; + Sequence< TestElement > seqStructRet( + xBT2->setSequenceStruct(arStruct)); + bRet &= check(seqStructRet == arStruct, "sequence test"); + } + // Issue #i60341# shows that the most interesting case is were Java + // calls the constructors; however, since this client is currently not + // available in Java, while the server is, the logic is reversed here: + try { + xBT2->testConstructorsService(xContext); + } catch (const BadConstructorArguments &) { + bRet = false; + } + if (!noCurrentContext) { + if (!(new testtools::bridgetest::CurrentContextChecker)->perform( + xBT2->getCurrentContextChecker(), 0, 1)) + { + bRet = false; + } + if (!(new testtools::bridgetest::CurrentContextChecker)->perform( + xBT2->getCurrentContextChecker(), 0, 2)) + { + bRet = false; + } + if (!(new testtools::bridgetest::CurrentContextChecker)->perform( + xBT2->getCurrentContextChecker(), 1, 2)) + { + bRet = false; + } + if (!(new testtools::bridgetest::CurrentContextChecker)->perform( + xBT2->getCurrentContextChecker(), 1, 3)) + { + bRet = false; + } + } + } + return bRet; +} + +static bool raiseOnewayException( const Reference < XBridgeTest > & xLBT ) +{ + bool bReturn = true; + OUString sCompare = STRING_TEST_CONSTANT; + Reference<XInterface> const x(xLBT->getInterface()); + try + { + // Note : the exception may fly or not (e.g. remote scenario). + // When it flies, it must contain the correct elements. + xLBT->raiseRuntimeExceptionOneway( sCompare, x ); + } + catch( const RuntimeException & e ) + { + bReturn = ( +#if OSL_DEBUG_LEVEL == 0 + // java stack traces trash Message + e.Message == sCompare && +#endif + xLBT->getInterface() == e.Context && + x == e.Context ); + } + return bReturn; +} + + +static bool raiseException( const Reference< XBridgeTest > & xLBT ) +{ + sal_Int32 nCount = 0; + try + { + try + { + try + { + xLBT->raiseException( + 5, STRING_TEST_CONSTANT, + xLBT->getInterface() ); + } + catch (const IllegalArgumentException &rExc) + { + if (rExc.ArgumentPosition == 5 && +#if OSL_DEBUG_LEVEL == 0 + // java stack traces trash Message + rExc.Message.startsWith(STRING_TEST_CONSTANT) && +#endif + rExc.Context == xLBT->getInterface()) + { +#ifdef COMPCHECK + //When we check if a new compiler still works then we must not call + //getRuntimeException because it uses cppu::getCaughtException which + //does only work if all libs are build with the same runtime. + return true; +#else + ++nCount; +#endif + } + else + { + check( false, "### unexpected exception content!" ); + } + + /** it is certain, that the RuntimeException testing will fail, if no */ + xLBT->getRuntimeException(); + } + } + catch (const RuntimeException & rExc) + { + if (rExc.Context == xLBT->getInterface() +#if OSL_DEBUG_LEVEL == 0 + // java stack traces trash Message + && rExc.Message.startsWith(STRING_TEST_CONSTANT) +#endif + ) + { + ++nCount; + } + else + { + check( false, "### unexpected exception content!" ); + } + + /** it is certain, that the RuntimeException testing will fail, if no */ + xLBT->setRuntimeException( 0xcafebabe ); + } + } + catch (const Exception & rExc) + { + if (rExc.Context == xLBT->getInterface() +#if OSL_DEBUG_LEVEL == 0 + // java stack traces trash Message + && rExc.Message.startsWith(STRING_TEST_CONSTANT) +#endif + ) + { + ++nCount; + } + else + { + check( false, "### unexpected exception content!" ); + } + return (nCount == 3); + } + return false; +} + +/* Returns an acquired sequence + */ +static uno_Sequence* cloneSequence(const uno_Sequence* val, const Type& type) +{ + TypeDescription td(type); + td.makeComplete(); + typelib_TypeDescription* pTdRaw = td.get(); + typelib_IndirectTypeDescription* pIndirectTd = + reinterpret_cast<typelib_IndirectTypeDescription*>(pTdRaw); + + typelib_TypeDescription* pTdElem = pIndirectTd->pType->pType; + std::unique_ptr<sal_Int8[]> buf(new sal_Int8[pTdElem->nSize * val->nElements]); + sal_Int8* pBufCur = buf.get(); + + uno_Sequence* retSeq = nullptr; + switch (static_cast<TypeClass>(pTdElem->eTypeClass)) + { + case TypeClass_SEQUENCE: + { + Type _tElem(pTdElem->pWeakRef); + for (int i = 0; i < val->nElements; i++) + { + sal_Int8 const *pValBuf = reinterpret_cast<sal_Int8 const *>(&val->elements + i * pTdElem->nSize); + + uno_Sequence* seq = cloneSequence( + reinterpret_cast<uno_Sequence const *>(pValBuf), + _tElem); + *reinterpret_cast<uno_Sequence**>(pBufCur) = seq; + pBufCur += pTdElem->nSize; + } + break; + } + default: + uno_type_sequence_construct( + &retSeq, type.getTypeLibType(), const_cast<char *>(val->elements), + val->nElements, reinterpret_cast< uno_AcquireFunc >(cpp_acquire)); + break; + } + return retSeq; +} + +template<typename T, typename U> +Sequence<T> cloneSequence(const Sequence<T>& val) +{ + Sequence<T> seq( cloneSequence(val.get(), cppu::UnoType<cppu::UnoSequenceType<U>>::get()), SAL_NO_ACQUIRE); + return seq; +} + +template< class T > +static bool makeSurrogate( + Reference< T > & rOut, Reference< T > const & rOriginal ) +{ + rOut.clear(); + if (! rOriginal.is()) + return false; + + Environment aCppEnv_official; + Environment aUnoEnv_ano; + Environment aCppEnv_ano; + + OUString aCppEnvTypeName( + CPPU_CURRENT_LANGUAGE_BINDING_NAME ); + OUString aUnoEnvTypeName( + UNO_LB_UNO ); + // official: + uno_getEnvironment( + reinterpret_cast< uno_Environment ** >( &aCppEnv_official ), + aCppEnvTypeName.pData, nullptr ); + // anonymous: + uno_createEnvironment( + reinterpret_cast< uno_Environment ** >( &aCppEnv_ano ), + aCppEnvTypeName.pData, nullptr ); + uno_createEnvironment( + reinterpret_cast< uno_Environment ** >( &aUnoEnv_ano ), + aUnoEnvTypeName.pData, nullptr ); + + UnoInterfaceReference unoI; + Mapping cpp2uno( aCppEnv_official.get(), aUnoEnv_ano.get() ); + Mapping uno2cpp( aUnoEnv_ano.get(), aCppEnv_ano.get() ); + if (!cpp2uno.is() || !uno2cpp.is()) + { + throw RuntimeException("cannot get C++-UNO mappings!" ); + } + cpp2uno.mapInterface( + reinterpret_cast< void ** >( &unoI.m_pUnoI ), + rOriginal.get(), cppu::UnoType<decltype(rOriginal)>::get() ); + if (! unoI.is()) + { + throw RuntimeException( + "mapping C++ to binary UNO failed!" ); + } + uno2cpp.mapInterface( + reinterpret_cast< void ** >( &rOut ), + unoI.get(), cppu::UnoType<decltype(rOriginal)>::get() ); + if (! rOut.is()) + { + throw RuntimeException( + "mapping binary UNO to C++ failed!" ); + } + + return rOut.is(); +} + + +sal_Int32 TestBridgeImpl::run( const Sequence< OUString > & rArgs ) +{ + bool bRet = false; + try + { + if (! rArgs.hasElements()) + { + throw RuntimeException( "no test object specified!\n" + "usage : ServiceName of test object | -u unourl of test object" ); + } + + Reference< XInterface > xOriginal; + bool remote; + sal_Int32 i; + if( rArgs.getLength() > 1 && rArgs[0] == "-u" ) + { + remote = true; + i = 2; + } + else + { + remote = false; + i = 1; + } + bool noCurrentContext = false; + if ( i < rArgs.getLength() && rArgs[i] == "noCurrentContext" ) + { + noCurrentContext = true; + ++i; + } + bool stress = false; + if ( i < rArgs.getLength() && rArgs[i] == "stress" ) + { + stress = true; + ++i; + } + + for (;;) { + Reference< XInterface > o; + if (remote) { + o = UnoUrlResolver::create(m_xContext)->resolve(rArgs[1]); + } else { + o = m_xContext->getServiceManager()->createInstanceWithContext( + rArgs[0], m_xContext); + } + if (!stress) { + xOriginal = o; + break; + } + } + + if (! xOriginal.is()) + { + throw RuntimeException( "cannot get test object!" ); + } + Reference< XBridgeTest > xTest( xOriginal, UNO_QUERY_THROW ); + + Reference<XBridgeTest > xLBT; + bRet = check( makeSurrogate( xLBT, xTest ), "makeSurrogate" ); + bRet = check( + performTest( m_xContext, xLBT, noCurrentContext ), "standard test" ) + && bRet; + bRet = check( raiseException( xLBT ) , "exception test" )&& bRet; + bRet = check( raiseOnewayException( xLBT ), + "oneway exception test" ) && bRet; + if (! bRet) + { + throw RuntimeException( "error: test failed!" ); + } + } + catch (const Exception & exc) + { + OString cstr( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) ); + fprintf( stderr, "exception occurred: %s\n", cstr.getStr() ); + throw; + } + + return bRet ? 0 : 1; +} + +// XServiceInfo + +OUString TestBridgeImpl::getImplementationName() +{ + return IMPLNAME; +} + +sal_Bool TestBridgeImpl::supportsService( const OUString & rServiceName ) +{ + return cppu::supportsService(this, rServiceName); +} + +Sequence< OUString > TestBridgeImpl::getSupportedServiceNames() +{ + return bridge_test::getSupportedServiceNames(); +} + + +static Reference< XInterface > TestBridgeImpl_create( + const Reference< XComponentContext > & xContext ) +{ + return Reference< XInterface >( + static_cast< OWeakObject * >( new TestBridgeImpl( xContext ) ) ); +} + +} + +extern "C" +{ + +SAL_DLLPUBLIC_EXPORT void * component_getFactory( + const char * pImplName, void * pServiceManager, + SAL_UNUSED_PARAMETER void * ) +{ + void * pRet = nullptr; + + if (pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0) + { + Reference< XInterface > xFactory( + createSingleComponentFactory( + bridge_test::TestBridgeImpl_create, + IMPLNAME, + bridge_test::getSupportedServiceNames() ) ); + + if (xFactory.is()) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + } + + return pRet; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/bridgetest/cli/cli_bridgetest_inprocess.cs b/testtools/source/bridgetest/cli/cli_bridgetest_inprocess.cs new file mode 100644 index 000000000..7518e569d --- /dev/null +++ b/testtools/source/bridgetest/cli/cli_bridgetest_inprocess.cs @@ -0,0 +1,251 @@ +/* + * 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 . + */ + +using System; +using System.Collections; +using uno; +using uno.util; +using unoidl.com.sun.star.uno; +using unoidl.com.sun.star.lang; +using unoidl.com.sun.star.container; + + + +internal class Factory : + WeakComponentBase, XSingleComponentFactory, XServiceInfo +{ + private String m_service; + private Type m_type; + private System.Reflection.ConstructorInfo m_ctor; + + public Factory( Type type, String service ) + { + m_service = service; + m_type = type; + m_ctor = type.GetConstructor( + new Type [] { typeof (XComponentContext) } ); + } + + public Object createInstanceWithContext( XComponentContext xContext ) + { + return m_ctor.Invoke( new Object [] { xContext } ); + } + + public Object createInstanceWithArgumentsAndContext( + uno.Any [] args, XComponentContext xContext ) + { + return m_ctor.Invoke( new Object [] { xContext } ); + } + + public bool supportsService( String name ) + { + return m_service.Equals( name ); + } + + public String [] getSupportedServiceNames() + { + return new String [] { m_service }; + } + + public String getImplementationName() + { + return m_type.ToString(); + } +} + + +/** This executable does the same as the batch file starting via uno.exe, + but via bootstrapping native UNO. +*/ +public class BridgeTest +{ + public static int Main( String [] args ) + { +// System.Diagnostics.Debugger.Launch(); + try + { + string bootstrap_ini = "cli_bridgetest_inprocess.ini"; + if (args.Length > 0) + { + if (args[0] == "/?") + { + Console.WriteLine( + "\n\ncli_bridgetest_inprocess [bootstrap file] \n\n" + + "bootstrap file \n" + + "\t contains the entries UNO_TYPES and UNO_SERVICES.\n" + + "\t If a file is not provided then it is assumed that a\n" + + "\t cli_bridgetest_inprocess.ini file can be found in the\n " + + "\t current working directory.\n" + ); + return 0; + } + else + { + bootstrap_ini = args[0]; + } + } + + // bootstrap native UNO + XComponentContext xContext = + Bootstrap.defaultBootstrap_InitialComponentContext( + bootstrap_ini, null ); + + using (new uno.util.DisposeGuard( (XComponent) xContext )) + { + XSet xSet = (XSet) xContext.getServiceManager(); + xSet.insert( + new uno.Any( + typeof (XSingleComponentFactory), + new Factory( + typeof (cs_testobj.BridgeTestObject), + "com.sun.star.test.bridge.cli_uno.CsTestObject" ) ) ); + xSet.insert( + new uno.Any( + typeof (XSingleComponentFactory), + new Factory( + typeof (vb_testobj.VBBridgeTestObject), + "com.sun.star.test.bridge.cli_uno.VbTestObject" ) ) ); + xSet.insert( + new uno.Any( + typeof (XSingleComponentFactory), + new Factory( + typeof (cpp_bridgetest.BridgeTest), + "com.sun.star.test.bridge.cli_uno.CppBridgeTest" ) ) ); + xSet.insert( + new uno.Any( + typeof (XSingleComponentFactory), + new Factory( + typeof (cs_testobj.BridgeTest), + "com.sun.star.test.bridge.cli_uno.CsBridgeTest" ) ) ); + xSet.insert( + new uno.Any( + typeof (XSingleComponentFactory), + new Factory( + typeof (vb_bridetest.BridgeTest), + "com.sun.star.test.bridge.cli_uno.VbBridgeTest" ) ) ); + + // I. + // direct unbridged test + // get client object via singleton entry + Object test_client; + XMain xClient; + test_client = new cs_testobj.BridgeTest( xContext ); + xClient = (XMain) test_client; + Console.WriteLine( + "\n[cli bridgetest] 1. C# client calls C# object"); + // run with CLI target object + xClient.run( + new String [] { + "com.sun.star.test.bridge.cli_uno.CsTestObject" } ); + + // II: + // uno -ro uno_services.rdb -ro uno_types.rdb + // -s com.sun.star.test.bridge.BridgeTest + // -- com.sun.star.test.bridge.cli_uno.TestObject + + // get native client + test_client = + xContext.getServiceManager().createInstanceWithContext( + "com.sun.star.test.bridge.BridgeTest", xContext ); + xClient = (XMain) test_client; + Console.WriteLine( + "\n[cli bridgetest] 2. C++ client (native) calls C# object"); + // run with CLI target object + xClient.run( + new String [] { + "com.sun.star.test.bridge.cli_uno.CsTestObject", + "noCurrentContext"} ); + + // III: + // uno -ro uno_services.rdb -ro uno_types.rdb + // -s com.sun.star.test.bridge.cli_uno.BridgeTest + // -- com.sun.star.test.bridge.CppTestObject + + // get CLI client + test_client = + xContext.getServiceManager().createInstanceWithContext( + "com.sun.star.test.bridge.cli_uno.CsBridgeTest", + xContext ); + xClient = (XMain) test_client; + Console.WriteLine( + "\n[cli bridgetest] 3. C# client calls C++ object (native)"); + // run with native target object + xClient.run( + new String [] { "com.sun.star.test.bridge.CppTestObject" } ); + + // IV: + // uno -ro uno_services.rdb -ro uno_types.rdb + // -s com.sun.star.test.bridge.cli_uno.VbBridgeTest + // -- com.sun.star.test.bridge.CppTestObject + // get CLI client + test_client = + xContext.getServiceManager().createInstanceWithContext( + "com.sun.star.test.bridge.cli_uno.VbBridgeTest", + xContext ); + xClient = (XMain) test_client; + Console.WriteLine( + "\n[cli bridgetest] 4. Visual Basic client calls C++ (native) object" ); + // run with native target object + xClient.run( + new String [] { "com.sun.star.test.bridge.CppTestObject" } ); + + // V: + // uno -ro uno_services.rdb -ro uno_types.rdb + // -s com.sun.star.test.bridge.BridgeTest + // -- com.sun.star.test.bridge.cli_uno.VbTestObject + // get CLI client +// test_client = +// xContext.getServiceManager().createInstanceWithContext( +// "com.sun.star.test.bridge.BridgeTest", xContext ); +// xClient = (XMain) test_client; +// Console.WriteLine( +// "[cli bridgetest] Visual Basic client: {0}", +// xClient.ToString() ); +// // run with native target object +// xClient.run( +// new String [] { +// "com.sun.star.test.bridge.cli_uno.VbTestObject" } ); + + // VI: + // uno -ro uno_services.rdb -ro uno_types.rdb + // -s com.sun.star.test.bridge.cli_uno.CppBridgeTest + // -- com.sun.star.test.bridge.CppTestObject + test_client = + xContext.getServiceManager().createInstanceWithContext( + "com.sun.star.test.bridge.cli_uno.CppBridgeTest", + xContext ); + xClient = (XMain) test_client; + Console.WriteLine( + "\n[cli bridgetest] 6. CLI C++ client calls C++ object (native)"); + // run with native target object + xClient.run( + new String [] { "com.sun.star.test.bridge.CppTestObject" } ); + } + } + catch (System.Exception exc) + { + GC.WaitForPendingFinalizers(); + System.Console.WriteLine( exc ); + return -1; + } + + GC.WaitForPendingFinalizers(); + System.Console.WriteLine( "====> all tests ok." ); + return 0; + } +} diff --git a/testtools/source/bridgetest/cli/cli_bridgetest_inprocess.ini b/testtools/source/bridgetest/cli/cli_bridgetest_inprocess.ini new file mode 100644 index 000000000..bb7c56fcf --- /dev/null +++ b/testtools/source/bridgetest/cli/cli_bridgetest_inprocess.ini @@ -0,0 +1,3 @@ +[Bootstrap] +UNO_TYPES=$SYSBINDIR/uno_types.rdb +UNO_SERVICES=$SYSBINDIR/uno_services.rdb diff --git a/testtools/source/bridgetest/cli/cli_cpp_bridgetest.cxx b/testtools/source/bridgetest/cli/cli_cpp_bridgetest.cxx new file mode 100644 index 000000000..00ed43a0f --- /dev/null +++ b/testtools/source/bridgetest/cli/cli_cpp_bridgetest.cxx @@ -0,0 +1,927 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + + +#using <mscorlib.dll> +#using <System.dll> +#using <cli_basetypes.dll> +#using <cli_uretypes.dll> +#using <cli_ure.dll> +#using <cli_types_bridgetest.dll> + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Reflection; +using namespace System::Threading; +using namespace uno; +using namespace uno::util; +using namespace unoidl::com::sun::star::uno; +using namespace unoidl::com::sun::star::lang; +using namespace unoidl::test::testtools::bridgetest; +namespace foo +{ + public __gc __interface MyInterface + { + }; +} + +namespace cpp_bridgetest +{ + __gc class ORecursiveCall: public WeakBase, public XRecursiveCall + { + public: + void callRecursivly(XRecursiveCall * xCall, int nToCall) + { + Monitor::Enter(this); + try + { + { + if (nToCall > 0) + { + nToCall --; + xCall->callRecursivly(this, nToCall); + } + } + } + __finally + { + Monitor::Exit(this); + } + + } + }; + +public __gc class Constants +{ +public: + static String* STRING_TEST_CONSTANT = new String(S"\" paco\' chorizo\\\' \"\'"); +}; + +public __gc class BridgeTest : public WeakBase, public XMain +{ + static bool compareData(Object* val1, Object* val2) + { + if (val1 == 0 && val2 == 0 || val1 == val2) + return true; + if ((val1 == 0 && val2 != 0) || + (val1 != 0 && val2 == 0) || val1->GetType() != val2->GetType()) + return false; + + bool ret = false; + Type* t1 = val1->GetType(); + //Sequence + if (t1->IsArray) + { + ret = compareSequence(static_cast<Array*>(val1), + static_cast<Array*>(val2)); + } + //String + else if (t1 == __typeof(String)) + { + ret = val1->Equals(val2); + } + // Interface implementation + else if (t1->GetInterfaces()->Length > 0 && ! t1->IsValueType) + { + ret = val1 == val2; + } + // Struct + else if ( ! t1->IsValueType) + { + ret = compareStruct(val1, val2); + } + else if (t1 == __typeof(Any)) + { + Any a1 = (Any) val1; + Any a2 = (Any) val2; + ret = a1.Type == a2.Type && compareData(a1.Value, a2.Value); + } + else + { + //Any, enum, int, bool char, float, double etc. + ret = val1->Equals(val2); + } + return ret; + } + + // Arrays have only one dimension + static bool compareSequence(Array* ar1, Array* ar2) + { + Debug::Assert(ar1 != 0 && ar2 != 0); + Type* t1 = ar1->GetType(); + Type* t2 = ar2->GetType(); + + if (!(ar1->Rank == 1 && ar2->Rank == 1 + && ar1->Length == ar2->Length && t1->GetElementType() == t2->GetElementType())) + return false; + + //arrays have same rank and size and element type. + int len = ar1->Length; + bool ret = true; + for (int i = 0; i < len; i++) + { + if (compareData(ar1->GetValue(i), ar2->GetValue(i)) == false) + { + ret = false; + break; + } + } + return ret; + } + + static bool compareStruct(Object* val1, Object* val2) + { + Debug::Assert(val1 != 0 && val2 != 0); + Type* t1 = val1->GetType(); + Type* t2 = val2->GetType(); + if (t1 != t2) + return false; + FieldInfo* fields[] = t1->GetFields(); + int cFields = fields->Length; + bool ret = true; + for (int i = 0; i < cFields; i++) + { + Object* fieldVal1 = fields[i]->GetValue(val1); + Object* fieldVal2 = fields[i]->GetValue(val2); + if ( ! compareData(fieldVal1, fieldVal2)) + { + ret = false; + break; + } + } + return ret; + } + + static bool check( bool b , String* message ) + { + if ( ! b) + Console::WriteLine("{0} failed\n" , message); + return b; + } + + static bool equals(TestElement* rData1, TestElement* rData2) + { + check( rData1->Bool == rData2->Bool, "### bool does not match!" ); + check( rData1->Char == rData2->Char, "### char does not match!" ); + check( rData1->Byte == rData2->Byte, "### byte does not match!" ); + check( rData1->Short == rData2->Short, "### short does not match!" ); + check( rData1->UShort == rData2->UShort, "### unsigned short does not match!" ); + check( rData1->Long == rData2->Long, "### long does not match!" ); + check( rData1->ULong == rData2->ULong, "### unsigned long does not match!" ); + check( rData1->Hyper == rData2->Hyper, "### hyper does not match!" ); + check( rData1->UHyper == rData2->UHyper, "### unsigned hyper does not match!" ); + check( rData1->Float == rData2->Float, "### float does not match!" ); + check( rData1->Double == rData2->Double, "### double does not match!" ); + check( rData1->Enum == rData2->Enum, "### enum does not match!" ); + check( rData1->String == rData2->String, "### string does not match!" ); + check( rData1->Byte2 == rData2->Byte2, "### byte2 does not match!" ); + check( rData1->Short2 == rData2->Short2, "### short2 does not match!" ); + check( rData1->Interface == rData2->Interface, "### interface does not match!" ); + check( compareData(__box(rData1->Any), __box(rData2->Any)), "### any does not match!" ); + + return (rData1->Bool == rData2->Bool && + rData1->Char == rData2->Char && + rData1->Byte == rData2->Byte && + rData1->Short == rData2->Short && + rData1->UShort == rData2->UShort && + rData1->Long == rData2->Long && + rData1->ULong == rData2->ULong && + rData1->Hyper == rData2->Hyper && + rData1->UHyper == rData2->UHyper && + rData1->Float == rData2->Float && + rData1->Double == rData2->Double && + rData1->Enum == rData2->Enum && + rData1->String == rData2->String && + rData1->Byte2 == rData2->Byte2 && + rData1->Short2 == rData2->Short2 && + rData1->Interface == rData2->Interface && + compareData(__box(rData1->Any), __box(rData2->Any))); + } + +static void assign( TestElement* rData, + bool bBool, Char cChar, Byte nByte, + Int16 nShort, UInt16 nUShort, + Int32 nLong, UInt32 nULong, + Int64 nHyper, UInt64 nUHyper, + float fFloat, double fDouble, + TestEnum eEnum, String* rStr, + Byte nByte2, Int16 nShort2, + Object* xTest, + uno::Any rAny ) +{ + rData->Bool = bBool; + rData->Char = cChar; + rData->Byte = nByte; + rData->Short = nShort; + rData->UShort = nUShort; + rData->Long = nLong; + rData->ULong = nULong; + rData->Hyper = nHyper; + rData->UHyper = nUHyper; + rData->Float = fFloat; + rData->Double = fDouble; + rData->Enum = eEnum; + rData->String = rStr; + rData->Byte2 = nByte2; + rData->Short2 = nShort2; + rData->Interface = xTest; + rData->Any = rAny; +} + +static void assign( TestDataElements* rData, + bool bBool, Char cChar, Byte nByte, + Int16 nShort, UInt16 nUShort, + Int32 nLong, UInt32 nULong, + Int64 nHyper, UInt64 nUHyper, + float fFloat, double fDouble, + TestEnum eEnum, String* rStr, + Byte nByte2, Int16 nShort2, + Object* xTest, + Any rAny, + TestElement* rSequence[]) +{ + assign( static_cast<TestElement*>(rData), + bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble, + eEnum, rStr, nByte2, nShort2, xTest, rAny ); + rData->Sequence = rSequence; +} + +static bool testAny(Type* typ, Object* value, XBridgeTest* xLBT ) +{ + Any any; + if (typ == 0) + any = Any(value->GetType(), value); + else + any = Any(typ, value); + + Any any2 = xLBT->transportAny(any); + bool ret = compareData(__box(any), __box(any2)); + if (!ret) + { + Console::WriteLine("any is different after roundtrip: in {0}, out {1}\n", + any.Type->FullName, any2.Type->FullName); + } + return ret; +} + + +static bool performAnyTest(XBridgeTest* xLBT, TestDataElements* data) +{ + bool bReturn = true; + bReturn = testAny( 0, __box(data->Byte), xLBT ) && bReturn; + bReturn = testAny( 0, __box(data->Short), xLBT ) && bReturn; + bReturn = testAny( 0, __box(data->UShort), xLBT ) && bReturn; + bReturn = testAny( 0, __box(data->Long), xLBT ) && bReturn; + bReturn = testAny( 0, __box(data->ULong), xLBT ) && bReturn; + bReturn = testAny( 0, __box(data->Hyper), xLBT ) && bReturn; + bReturn = testAny( 0, __box(data->UHyper), xLBT ) && bReturn; + bReturn = testAny( 0, __box(data->Float), xLBT ) && bReturn; + bReturn = testAny( 0, __box(data->Double),xLBT ) && bReturn; + bReturn = testAny( 0, __box(data->Enum), xLBT ) && bReturn; + bReturn = testAny( 0, data->String,xLBT ) && bReturn; + bReturn = testAny( 0, data->Byte2,xLBT ) && bReturn; + bReturn = testAny( 0, data->Short2,xLBT ) && bReturn; + bReturn = testAny(__typeof(XWeak), data->Interface,xLBT ) && bReturn; + bReturn = testAny(0, data, xLBT ) && bReturn; + + { + Any a1(true); + Any a2 = xLBT->transportAny( a1 ); + bReturn = compareData(__box(a2), __box(a1)) && bReturn; + } + + { + Any a1('A'); + Any a2 = xLBT->transportAny(a1); + bReturn = compareData( __box(a2), __box(a1)) && bReturn; + } + return bReturn; +} + +static bool performSequenceOfCallTest(XBridgeTest* xLBT) +{ + int i,nRounds; + int nGlobalIndex = 0; + const int nWaitTimeSpanMUSec = 10000; + for( nRounds = 0 ; nRounds < 10 ; nRounds ++ ) + { + for( i = 0 ; i < nRounds ; i ++ ) + { + // fire oneways + xLBT->callOneway(nGlobalIndex, nWaitTimeSpanMUSec); + nGlobalIndex++; + } + + // call synchron + xLBT->call(nGlobalIndex, nWaitTimeSpanMUSec); + nGlobalIndex++; + } + return xLBT->sequenceOfCallTestPassed(); +} + + +static bool performRecursiveCallTest(XBridgeTest* xLBT) +{ + xLBT->startRecursiveCall(new ORecursiveCall(), 50); + // on failure, the test would lock up or crash + return true; +} + +static bool performQueryForUnknownType(XBridgeTest* xLBT) +{ + bool bRet = false; + // test queryInterface for an unknown type + try + { + __try_cast<foo::MyInterface*>(xLBT); + } + catch( System::InvalidCastException*) + { + bRet = true; + } + + return bRet; +} + + +static bool performTest(XBridgeTest* xLBT) +{ + check( xLBT != 0, "### no test interface!" ); + bool bRet = true; + if (xLBT != 0) + { + // this data is never ever granted access to by calls other than equals(), assign()! + TestDataElements* aData = new TestDataElements(); // test against this data + + Object* xI= new WeakBase(); + + Any aAny( __typeof(Object), xI); + assign( static_cast<TestElement*>(aData), + true, '@', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, + 0x123456789abcdef0, 0xfedcba9876543210, + 17.0815f, 3.1415926359, TestEnum::LOLA, + Constants::STRING_TEST_CONSTANT, xI, + aAny); + + bRet = check( aData->Any.Value == xI, "### unexpected any!" ) && bRet; + bRet = check( !(aData->Any.Value != xI), "### unexpected any!" ) && bRet; + + aData->Sequence = new TestElement*[2]; + aData->Sequence[0] = new TestElement( + aData->Bool, aData->Char, aData->Byte, aData->Short, + aData->UShort, aData->Long, aData->ULong, + aData->Hyper, aData->UHyper, aData->Float, + aData->Double, aData->Enum, aData->String, + aData->Byte2, aData->Short2, + aData->Interface, aData->Any); //(TestElement) aData; + aData->Sequence[1] = new TestElement(); //is empty + + // aData complete + + // this is a manually copy of aData for first setting... + TestDataElements* aSetData = new TestDataElements; + Any aAnySet(__typeof(Object), xI); + assign( static_cast<TestElement*>(aSetData), + aData->Bool, + aData->Char, + aData->Byte, + aData->Short, + aData->UShort, + aData->Long, aData->ULong, aData->Hyper, aData->UHyper, aData->Float, aData->Double, + aData->Enum, + aData->String, + aData->Byte2, + aData->Short2, + xI, + aAnySet); + + aSetData->Sequence = new TestElement*[2]; + aSetData->Sequence[0] = new TestElement( + aSetData->Bool, aSetData->Char, aSetData->Byte, aSetData->Short, + aSetData->UShort, aSetData->Long, aSetData->ULong, + aSetData->Hyper, aSetData->UHyper, aSetData->Float, + aSetData->Double, aSetData->Enum, aSetData->String, + aSetData->Byte2, aSetData->Short2, + aSetData->Interface, aSetData->Any); //TestElement) aSetData; + aSetData->Sequence[1] = new TestElement(); // empty struct + + xLBT->setValues( + aSetData->Bool, + aSetData->Char, + aSetData->Byte, + aSetData->Short, + aSetData->UShort, + aSetData->Long, + aSetData->ULong, + aSetData->Hyper, + aSetData->UHyper, + aSetData->Float, + aSetData->Double, + aSetData->Enum, + aSetData->String, + aSetData->Byte2, + aSetData->Short2, + aSetData->Interface, + aSetData->Any, + aSetData->Sequence, + aSetData ); + + { + TestDataElements* aRet = new TestDataElements(); + TestDataElements* aRet2 = new TestDataElements(); + xLBT->getValues( + & aRet->Bool, + & aRet->Char, + & aRet->Byte, + & aRet->Short, + & aRet->UShort, + & aRet->Long, + & aRet->ULong, + & aRet->Hyper, + & aRet->UHyper, + & aRet->Float, + & aRet->Double, + & aRet->Enum, + & aRet->String, + & aRet->Byte2, + & aRet->Short2, + & aRet->Interface, + & aRet->Any, + & aRet->Sequence, + & aRet2 ); + + bRet = check( compareData( aData, aRet ) && compareData( aData, aRet2 ) , "getValues test") && bRet; + + // set last retrieved values + TestDataElements* aSV2ret = xLBT->setValues2( + & aRet->Bool, + & aRet->Char, + & aRet->Byte, + & aRet->Short, + & aRet->UShort, + & aRet->Long, + & aRet->ULong, + & aRet->Hyper, + & aRet->UHyper, + & aRet->Float, + & aRet->Double, + & aRet->Enum, + & aRet->String, + & aRet->Byte2, + & aRet->Short2, + & aRet->Interface, + & aRet->Any, + & aRet->Sequence, + & aRet2 ); + + // check inout sequence order + // => inout sequence parameter was switched by test objects + TestElement* temp = aRet->Sequence[ 0 ]; + aRet->Sequence[ 0 ] = aRet->Sequence[ 1 ]; + aRet->Sequence[ 1 ] = temp; + + bRet = check( + compareData( aData, aSV2ret ) && compareData( aData, aRet2 ), + "getValues2 test") && bRet; + } + { + TestDataElements* aRet = new TestDataElements(); + TestDataElements* aRet2 = new TestDataElements(); + TestDataElements* aGVret = xLBT->getValues( + & aRet->Bool, + & aRet->Char, + & aRet->Byte, + & aRet->Short, + & aRet->UShort, + & aRet->Long, + & aRet->ULong, + & aRet->Hyper, + & aRet->UHyper, + & aRet->Float, + & aRet->Double, + & aRet->Enum, + & aRet->String, + & aRet->Byte2, + & aRet->Short2, + & aRet->Interface, + & aRet->Any, + & aRet->Sequence, + & aRet2 ); + + bRet = check( compareData( aData, aRet ) && compareData( aData, aRet2 ) && compareData( aData, aGVret ), "getValues test" ) && bRet; + + // set last retrieved values + xLBT->Bool = aRet->Bool; + xLBT->Char = aRet->Char; + xLBT->Byte = aRet->Byte; + xLBT->Short = aRet->Short; + xLBT->UShort = aRet->UShort; + xLBT->Long = aRet->Long; + xLBT->ULong = aRet->ULong; + xLBT->Hyper = aRet->Hyper; + xLBT->UHyper = aRet->UHyper; + xLBT->Float = aRet->Float; + xLBT->Double = aRet->Double; + xLBT->Enum = aRet->Enum; + xLBT->String = aRet->String; + xLBT->Byte2 = aRet->Byte2; + xLBT->Short2 = aRet->Short2; + xLBT->Interface = aRet->Interface; + xLBT->Any = aRet->Any; + xLBT->Sequence = aRet->Sequence; + xLBT->Struct = aRet2; + } + { + TestDataElements* aRet = new TestDataElements(); + TestDataElements* aRet2 = new TestDataElements(); + aRet->Hyper = xLBT->Hyper; + aRet->UHyper = xLBT->UHyper; + aRet->Float = xLBT->Float; + aRet->Double = xLBT->Double; + aRet->Byte = xLBT->Byte; + aRet->Char = xLBT->Char; + aRet->Bool = xLBT->Bool; + aRet->Short = xLBT->Short; + aRet->UShort = xLBT->UShort; + aRet->Long = xLBT->Long; + aRet->ULong = xLBT->ULong; + aRet->Enum = xLBT->Enum; + aRet->String = xLBT->String; + aRet->Byte2 = xLBT->Byte2; + aRet->Short2 = xLBT->Short2; + aRet->Interface = xLBT->Interface; + aRet->Any = xLBT->Any; + aRet->Sequence = xLBT->Sequence; + aRet2 = xLBT->Struct; + + bRet = check( compareData( aData, aRet ) && compareData( aData, aRet2 ) , "struct comparison test") && bRet; + + bRet = check(performSequenceTest(xLBT), "sequence test") && bRet; + + // any test + bRet = check( performAnyTest( xLBT , aData ) , "any test" ) && bRet; + + // sequence of call test + bRet = check( performSequenceOfCallTest( xLBT ) , "sequence of call test" ) && bRet; + + // recursive call test + bRet = check( performRecursiveCallTest( xLBT ) , "recursive test" ) && bRet; + + bRet = (compareData( aData, aRet ) && compareData( aData, aRet2 )) && bRet ; + + // check setting of null reference + xLBT->Interface = 0; + aRet->Interface = xLBT->Interface; + bRet = (aRet->Interface == 0) && bRet; + + } + + + } + return bRet; + } +static bool performSequenceTest(XBridgeTest* xBT) +{ + bool bRet = true; + XBridgeTest2* xBT2 = dynamic_cast<XBridgeTest2*>(xBT); + if ( xBT2 == 0) + return false; + + // perform sequence tests (XBridgeTest2) + // create the sequence which are compared with the results + bool arBool __gc[] = new bool __gc [3]; + arBool[0] = true; arBool[1] = false; arBool[2] = true; + Char arChar[] = new Char[3]; + arChar[0] = 'A'; arChar[1] = 'B'; arChar[2] = 'C'; + Byte arByte[] = new Byte[3]; + arByte[0] = 1; arByte[1] = 2; arByte[2] = 0xff; + Int16 arShort[] = new Int16[3]; + arShort[0] = Int16::MinValue; arShort[1] = 1; arShort[2] = Int16::MaxValue; + UInt16 arUShort[] = new UInt16[3]; + arUShort[0] = UInt16::MinValue; arUShort[1] = 1; arUShort[2] = UInt16::MaxValue; + Int32 arLong[] = new Int32[3]; + arLong[0] = Int32::MinValue; arLong[1] = 1; arLong[2] = Int32::MaxValue; + UInt32 arULong[] = new UInt32[3]; + arULong[0] = UInt32::MinValue; arULong[1] = 1; arULong[2] = UInt32::MaxValue; + Int64 arHyper[] = new Int64[3]; + arHyper[0] = Int64::MinValue; arHyper[1] = 1; arHyper[2] = Int64::MaxValue; + UInt64 arUHyper[] = new UInt64[3]; + arUHyper[0] = UInt64::MinValue; arUHyper[1] = 1; + arUHyper[2] = UInt64::MaxValue; + Single arFloat[] = new Single[3]; + arFloat[0] = 1.1f; arFloat[1] = 2.2f; arFloat[2] = 3.3f; + Double arDouble[] = new Double[3]; + arDouble[0] = 1.11; arDouble[1] = 2.22; arDouble[2] = 3.33; + String* arString[] = new String*[3]; + arString[0] = new String("String 1"); + arString[1] = new String("String 2"); + arString[2] = new String("String 3"); + + Any arAny[] = new Any[3]; + arAny[0] = Any(true); arAny[1] = Any(11111); arAny[2] = Any(3.14); + Object* arObject[] = new Object*[3]; + arObject[0] = new WeakBase(); arObject[1] = new WeakBase(); + arObject[1] = new WeakBase(); + + Console::WriteLine(new String("cli_cpp_bridgetest: Workaround for C++ compiler bug:" + " using Array of Int32 instead of Array of enums w")); + Int32 arEnum[] = new Int32[3]; + arEnum[0] = static_cast<Int32>(TestEnum::ONE); + arEnum[1] = static_cast<Int32>(TestEnum::TWO); + arEnum[2] = static_cast<Int32>(TestEnum::CHECK); + + TestElement* arStruct[] = new TestElement*[3]; + arStruct[0] = new TestElement(); arStruct[1] = new TestElement(); + arStruct[2] = new TestElement(); + assign( arStruct[0], true, '@', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, + 0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, 3.1415926359, + TestEnum::LOLA, Constants::STRING_TEST_CONSTANT, 18, 0x5678, arObject[0], + Any( __typeof(Object), arObject[0]) ); + assign( arStruct[1], true, 'A', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, + 0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, 3.1415926359, + TestEnum::TWO, Constants::STRING_TEST_CONSTANT, 18, 0x5678, arObject[1], + Any( __typeof(Object), arObject[1]) ); + assign( arStruct[2], true, 'B', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, + 0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, 3.1415926359, + TestEnum::CHECK, Constants::STRING_TEST_CONSTANT, 18, 0x5678, arObject[2], + Any( __typeof(Object), arObject[2] ) ); + { + Any seqAnyRet[] = xBT2->setSequenceAny(arAny); + bRet = check( compareData(seqAnyRet, arAny), "sequence test") && bRet; + Boolean seqBoolRet[] = xBT2->setSequenceBool(arBool); + bRet = check( compareData(seqBoolRet, arBool), "sequence test") && bRet; + Byte seqByteRet[] = xBT2->setSequenceByte(arByte); + bRet = check( compareData(seqByteRet, arByte), "sequence test") && bRet; + Char seqCharRet[] = xBT2->setSequenceChar(arChar); + bRet = check( compareData(seqCharRet, arChar), "sequence test") && bRet; + Int16 seqShortRet[] = xBT2->setSequenceShort(arShort); + bRet = check( compareData(seqShortRet, arShort), "sequence test") && bRet; + Int32 seqLongRet[] = xBT2->setSequenceLong(arLong); + bRet = check( compareData(seqLongRet, arLong), "sequence test") && bRet; + Int64 seqHyperRet[] = xBT2->setSequenceHyper(arHyper); + bRet = check( compareData(seqHyperRet,arHyper), "sequence test") && bRet; + Single seqFloatRet[] = xBT2->setSequenceFloat(arFloat); + bRet = check( compareData(seqFloatRet, arFloat), "sequence test") && bRet; + Double seqDoubleRet[] = xBT2->setSequenceDouble(arDouble); + bRet = check( compareData(seqDoubleRet, arDouble), "sequence test") && bRet; + xBT2->setSequenceEnum(arEnum); + //comparing seqEnumRet with arEnum will fail since they are of different + //types because of workaround. arEnum is Int32[]. + Console::WriteLine(new String("cli_cpp_bridgetest: Test omitted because " + "of C++ compiler bug. XBridgeTest2::setSequenceEnum(sequence<TestEnum>)")); + UInt16 seqUShortRet[] = xBT2->setSequenceUShort(arUShort); + bRet = check( compareData(seqUShortRet, arUShort), "sequence test") && bRet; + UInt32 seqULongRet[] = xBT2->setSequenceULong(arULong); + bRet = check( compareData(seqULongRet, arULong), "sequence test") && bRet; + UInt64 seqUHyperRet[] = xBT2->setSequenceUHyper(arUHyper); + bRet = check( compareData(seqUHyperRet, arUHyper), "sequence test") && bRet; + Object* seqObjectRet[] = xBT2->setSequenceXInterface(arObject); + bRet = check( compareData(seqObjectRet, arObject), "sequence test") && bRet; + String* seqStringRet[] = xBT2->setSequenceString(arString); + bRet = check( compareData(seqStringRet, arString), "sequence test") && bRet; + TestElement* seqStructRet[] = xBT2->setSequenceStruct(arStruct); + bRet = check( compareData(seqStructRet, arStruct), "sequence test") && bRet; + } + { + Console::WriteLine(new String("cli_cpp_bridgetest: no test of " + "XBridgeTest2::setSequencesInOut and XBridgeTest2.setSequencesOut " + "because jagged arrays are not supported by C++ compiler")); + } + { + Any _arAny[] = new Any[0]; + Any seqAnyRet[] = xBT2->setSequenceAny(_arAny); + bRet = check( compareData(seqAnyRet, _arAny), "sequence test") && bRet; + Boolean _arBool[] = new Boolean[0]; + Boolean seqBoolRet[] = xBT2->setSequenceBool(_arBool); + bRet = check( compareData(seqBoolRet, _arBool), "sequence test") && bRet; + Byte _arByte[] = new Byte[0]; + Byte seqByteRet[] = xBT2->setSequenceByte(_arByte); + bRet = check( compareData(seqByteRet, _arByte), "sequence test") && bRet; + Char _arChar[] = new Char[0]; + Char seqCharRet[] = xBT2->setSequenceChar(_arChar); + bRet = check( compareData(seqCharRet, _arChar), "sequence test") && bRet; + Int16 _arShort[] = new Int16[0]; + Int16 seqShortRet[] = xBT2->setSequenceShort(_arShort); + bRet = check( compareData(seqShortRet, _arShort), "sequence test") && bRet; + Int32 _arLong[] = new Int32[0]; + Int32 seqLongRet[] = xBT2->setSequenceLong(_arLong); + bRet = check( compareData(seqLongRet, _arLong), "sequence test") && bRet; + Int64 _arHyper[] = new Int64[0]; + Int64 seqHyperRet[] = xBT2->setSequenceHyper(_arHyper); + bRet = check( compareData(seqHyperRet, _arHyper), "sequence test") && bRet; + Single _arFloat[] = new Single[0]; + Single seqFloatRet[] = xBT2->setSequenceFloat(_arFloat); + bRet = check( compareData(seqFloatRet, _arFloat), "sequence test") && bRet; + Double _arDouble[] = new Double[0]; + Double seqDoubleRet[] = xBT2->setSequenceDouble(_arDouble); + bRet = check( compareData(seqDoubleRet, _arDouble), "sequence test") && bRet; + TestEnum _arEnum[] = new TestEnum[0]; + xBT2->setSequenceEnum(_arEnum); + UInt16 _arUShort[] = new UInt16[0]; + UInt16 seqUShortRet[] = xBT2->setSequenceUShort(_arUShort); + bRet = check( compareData(seqUShortRet, _arUShort), "sequence test") && bRet; + UInt32 _arULong[] = new UInt32[0]; + UInt32 seqULongRet[] = xBT2->setSequenceULong(_arULong); + bRet = check( compareData(seqULongRet, _arULong), "sequence test") && bRet; + UInt64 _arUHyper[] = new UInt64[0]; + UInt64 seqUHyperRet[] = xBT2->setSequenceUHyper(_arUHyper); + bRet = check( compareData(seqUHyperRet, _arUHyper), "sequence test") && bRet; + Object* _arObject[] = new Object*[0]; + Object* seqObjectRet[] = xBT2->setSequenceXInterface(_arObject); + bRet = check( compareData(seqObjectRet, _arObject), "sequence test") && bRet; + String* _arString[] = new String*[0]; + String* seqStringRet[] = xBT2->setSequenceString(_arString); + bRet = check( compareData(seqStringRet, _arString), "sequence test") && bRet; + TestElement* _arStruct[] = new TestElement*[0]; + TestElement* seqStructRet[] = xBT2->setSequenceStruct(_arStruct); + bRet = check( compareData(seqStructRet, _arStruct), "sequence test") && bRet; + + } + return bRet; +} +/** Test the System::Object method on the proxy object + */ +static bool testObjectMethodsImplemention(XBridgeTest* xLBT) +{ + bool ret = false; + Object* obj = new Object(); + XBridgeTestBase* xBase = dynamic_cast<XBridgeTestBase*>(xLBT); + if (xBase == 0) + return false; + // Object.Equals + ret = xLBT->Equals(obj) == false; + ret = xLBT->Equals(xLBT) && ret; + ret = Object::Equals(obj, obj) && ret; + ret = Object::Equals(xLBT, xBase) && ret; + //Object.GetHashCode + // Don't know how to verify this. Currently it is not possible to get the object id from a proxy + int nHash = xLBT->GetHashCode(); + ret = nHash == xBase->GetHashCode() && ret; + + //Object.ToString + // Don't know how to verify this automatically. + String* s = xLBT->ToString(); + ret = (s->Length > 0) && ret; + return ret; +} + + +static bool raiseOnewayException(XBridgeTest* xLBT) +{ + bool bReturn = true; + String* sCompare = Constants::STRING_TEST_CONSTANT; + try + { + // Note : the exception may fly or not (e.g. remote scenario). + // When it flies, it must contain the correct elements. + xLBT->raiseRuntimeExceptionOneway(sCompare, xLBT->Interface ); + } + catch (RuntimeException* e ) + { + bReturn = ( xLBT->Interface == e->Context ); + } + return bReturn; +} + + +static bool raiseException(XBridgeTest* xLBT ) +{ + int nCount = 0; + try + { + try + { + try + { + xLBT->raiseException( + 5, Constants::STRING_TEST_CONSTANT, xLBT->Interface ); + } + catch (unoidl::com::sun::star::lang::IllegalArgumentException* aExc) + { + if (aExc->ArgumentPosition == 5 && + aExc->Context == xLBT->Interface) + { + ++nCount; + } + else + { + check( false, "### unexpected exception content!" ); + } + + /** it is certain, that the RuntimeException testing will fail, + if no */ + xLBT->RuntimeException = 0; + } + } + catch (unoidl::com::sun::star::uno::RuntimeException* rExc) + { + if (rExc->Context == xLBT->Interface ) + { + ++nCount; + } + else + { + check( false, "### unexpected exception content!" ); + } + + /** it is certain, that the RuntimeException testing will fail, if no */ + xLBT->RuntimeException = (int) 0xcafebabe; + } + } + catch (unoidl::com::sun::star::uno::Exception* rExc) + { + if (rExc->Context == xLBT->Interface) + { + ++nCount; + } + else + + { + check( false, "### unexpected exception content!" ); + } + return (nCount == 3); + } + return false; +} + + static private void perform_test( XBridgeTest* xLBT ) + { + bool bRet= true; + bRet = check( performTest( xLBT ), "standard test" ) && bRet; + bRet = check( raiseException( xLBT ) , "exception test" )&& bRet; + bRet = check( raiseOnewayException( xLBT ), "oneway exception test" ) && bRet; + bRet = check( testObjectMethodsImplemention(xLBT), "object methods test") && bRet; + bRet = performQueryForUnknownType( xLBT ) && bRet; + if (! bRet) + { + throw new unoidl::com::sun::star::uno::RuntimeException( + new String("error: test failed!"), 0); + } + } + XComponentContext* m_xContext; + + public: + explicit BridgeTest( XComponentContext* xContext ) + { + m_xContext = xContext; + } + + + int run( String* args[] ) + { + try + { + if (args->Length < 1) + { + throw new RuntimeException( + "missing argument for bridgetest!", this ); + } + Object* test_obj = + m_xContext->getServiceManager()->createInstanceWithContext( + args[ 0 ], m_xContext ); + if (test_obj == 0) + test_obj = m_xContext->getValueByName( args[ 0 ] ).Value; + + Console::WriteLine( + "cli target bridgetest obj: {0}", test_obj->ToString() ); + XBridgeTest* xTest = __try_cast<XBridgeTest*>(test_obj) ; + perform_test( xTest ); + Console::WriteLine( "\n### cli_uno C++ bridgetest succeeded." ); + return 0; + } + catch (unoidl::com::sun::star::uno::RuntimeException* ) + { + throw; + } + catch (System::Exception* exc) + { + System::Text::StringBuilder* s = new System::Text::StringBuilder(); + s->Append(S"cli_cpp_bridgetest: unexpected exception occurred in XMain::run. Original exception: "); + s->Append(exc->GetType()->Name); + s->Append(S"\n Message: "); + s->Append(exc->Message); + throw new unoidl::com::sun::star::uno::RuntimeException( + s->ToString(), 0); + } + } +}; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/bridgetest/cli/cli_cs_bridgetest.cs b/testtools/source/bridgetest/cli/cli_cs_bridgetest.cs new file mode 100644 index 000000000..9d629e062 --- /dev/null +++ b/testtools/source/bridgetest/cli/cli_cs_bridgetest.cs @@ -0,0 +1,1024 @@ +/* + * 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 . + */ + +using System; +using System.Diagnostics; +using System.Reflection; +using uno; +using uno.util; +using unoidl.com.sun.star.uno; +using unoidl.com.sun.star.lang; +//using unoidl.com.sun.star.test.bridge; +using unoidl.test.testtools.bridgetest; + +namespace foo +{ + public interface MyInterface + { + } +} + +namespace cs_testobj +{ + class ORecursiveCall: WeakBase, XRecursiveCall + { + public void callRecursivly(XRecursiveCall xCall, int nToCall) + { + lock (this) + { + if (nToCall > 0) + { + nToCall --; + xCall.callRecursivly(this, nToCall); + } + } + } + }; + +class Constants +{ + public const string STRING_TEST_CONSTANT = "\" paco\' chorizo\\\' \"\'"; +} + +public class BridgeTest : WeakBase, XMain +{ + static bool compareData(Object val1, Object val2) + { + if (val1 == null && val2 == null || val1 == val2) + return true; + if ((val1 == null && val2 != null) || + (val1 != null && val2 == null) || val1.GetType() != val2.GetType()) + return false; + + bool ret = false; + Type t1 = val1.GetType(); + //Sequence + if (t1.IsArray) + { + ret = compareSequence((Array) val1, (Array) val2); + } + //String + else if (t1 == typeof(string)) + { + ret = (string) val1 == (string) val2; + } + // Interface implementation + else if (t1.GetInterfaces().Length > 0 && ! t1.IsValueType) + { + ret = val1 == val2; + } + // Struct + else if ( ! t1.IsValueType) + { + ret = compareStruct(val1, val2); + } + else if (t1 == typeof(Any)) + { + Any a1 = (Any) val1; + Any a2 = (Any) val2; + ret = a1.Type == a2.Type && compareData(a1.Value, a2.Value); + } + else if (t1.IsValueType) + { + //Any, enum, int, bool char, float, double etc. + ret = val1.Equals(val2); + } + else + { + Debug.Assert(false); + } + return ret; + } + + // Arrays have only one dimension + static bool compareSequence(Array ar1, Array ar2) + { + Debug.Assert(ar1 != null && ar2 != null); + Type t1 = ar1.GetType(); + Type t2 = ar2.GetType(); + + if (!(ar1.Rank == 1 && ar2.Rank == 1 + && ar1.Length == ar2.Length && t1.GetElementType() == t2.GetElementType())) + return false; + + //arrays have same rank and size and element type. + int len = ar1.Length; + Type elemType = t1.GetElementType(); + bool ret = true; + for (int i = 0; i < len; i++) + { + if (compareData(ar1.GetValue(i), ar2.GetValue(i)) == false) + { + ret = false; + break; + } + } + return ret; + } + + static bool compareStruct(Object val1, Object val2) + { + Debug.Assert(val1 != null && val2 != null); + Type t1 = val1.GetType(); + Type t2 = val2.GetType(); + if (t1 != t2) + return false; + FieldInfo[] fields = t1.GetFields(); + int cFields = fields.Length; + bool ret = true; + for (int i = 0; i < cFields; i++) + { + Object fieldVal1 = fields[i].GetValue(val1); + Object fieldVal2 = fields[i].GetValue(val2); + if ( ! compareData(fieldVal1, fieldVal2)) + { + ret = false; + break; + } + } + return ret; + } + + static bool check( bool b , string message ) + { + if ( ! b) + Console.WriteLine("{0} failed\n" , message); + return b; + } + + static bool equals(TestElement rData1, TestElement rData2) + { + check( rData1.Bool == rData2.Bool, "### bool does not match!" ); + check( rData1.Char == rData2.Char, "### char does not match!" ); + check( rData1.Byte == rData2.Byte, "### byte does not match!" ); + check( rData1.Short == rData2.Short, "### short does not match!" ); + check( rData1.UShort == rData2.UShort, "### unsigned short does not match!" ); + check( rData1.Long == rData2.Long, "### long does not match!" ); + check( rData1.ULong == rData2.ULong, "### unsigned long does not match!" ); + check( rData1.Hyper == rData2.Hyper, "### hyper does not match!" ); + check( rData1.UHyper == rData2.UHyper, "### unsigned hyper does not match!" ); + check( rData1.Float == rData2.Float, "### float does not match!" ); + check( rData1.Double == rData2.Double, "### double does not match!" ); + check( rData1.Enum == rData2.Enum, "### enum does not match!" ); + check( rData1.String == rData2.String, "### string does not match!" ); + check( rData1.Interface == rData2.Interface, "### interface does not match!" ); + check( compareData(rData1.Any, rData2.Any), "### any does not match!" ); + + return (rData1.Bool == rData2.Bool && + rData1.Char == rData2.Char && + rData1.Byte == rData2.Byte && + rData1.Short == rData2.Short && + rData1.UShort == rData2.UShort && + rData1.Long == rData2.Long && + rData1.ULong == rData2.ULong && + rData1.Hyper == rData2.Hyper && + rData1.UHyper == rData2.UHyper && + rData1.Float == rData2.Float && + rData1.Double == rData2.Double && + rData1.Enum == rData2.Enum && + rData1.String == rData2.String && + rData1.Interface == rData2.Interface && + compareData(rData1.Any, rData2.Any)); + } + +static void assign( TestElement rData, + bool bBool, char cChar, byte nByte, + short nShort, ushort nUShort, + int nLong, uint nULong, + long nHyper, ulong nUHyper, + float fFloat, double fDouble, + TestEnum eEnum, string rStr, + Object xTest, + Any rAny ) +{ + rData.Bool = bBool; + rData.Char = cChar; + rData.Byte = nByte; + rData.Short = nShort; + rData.UShort = nUShort; + rData.Long = nLong; + rData.ULong = nULong; + rData.Hyper = nHyper; + rData.UHyper = nUHyper; + rData.Float = fFloat; + rData.Double = fDouble; + rData.Enum = eEnum; + rData.String = rStr; + rData.Interface = xTest; + rData.Any = rAny; +} + +static void assign( TestDataElements rData, + bool bBool, char cChar, byte nByte, + short nShort, ushort nUShort, + int nLong, uint nULong, + long nHyper, ulong nUHyper, + float fFloat, double fDouble, + TestEnum eEnum, string rStr, + Object xTest, + Any rAny, + TestElement[] rSequence) +{ + assign( (TestElement) rData, + bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble, + eEnum, rStr, xTest, rAny ); + rData.Sequence = rSequence; +} + +// template < class type > +static bool testAny(Type typ, Object value, XBridgeTest xLBT ) +{ + Any any; + if (typ == null) + any = new Any(value.GetType(), value); + else + any = new Any(typ, value); + + Any any2 = xLBT.transportAny(any); + bool ret; + if( ! (ret= compareData(any, any2))) + { + Console.WriteLine("any is different after roundtrip: in {0}, out {1}\n", + any.Type.FullName, any2.Type.FullName); + } + return ret; +} + + + +static bool performAnyTest(XBridgeTest xLBT, TestDataElements data) +{ + bool bReturn = true; + bReturn = testAny( null, data.Byte ,xLBT ) && bReturn; + bReturn = testAny( null, data.Short,xLBT ) && bReturn; + bReturn = testAny( null, data.UShort,xLBT ) && bReturn; + bReturn = testAny( null, data.Long,xLBT ) && bReturn; + bReturn = testAny( null, data.ULong,xLBT ) && bReturn; + bReturn = testAny( null, data.Hyper,xLBT ) && bReturn; + bReturn = testAny( null,data.UHyper,xLBT ) && bReturn; + bReturn = testAny( null, data.Float,xLBT ) && bReturn; + bReturn = testAny( null, data.Double,xLBT ) && bReturn; + bReturn = testAny( null, data.Enum,xLBT ) && bReturn; + bReturn = testAny( null, data.String,xLBT ) && bReturn; + bReturn = testAny(typeof(XWeak), data.Interface,xLBT ) && bReturn; + bReturn = testAny(null, data, xLBT ) && bReturn; + + { + Any a1= new Any(true); + Any a2 = xLBT.transportAny( a1 ); + bReturn = compareData(a2, a1) && bReturn; + } + + { + Any a1= new Any('A'); + Any a2 = xLBT.transportAny(a1); + bReturn = compareData(a2, a1) && bReturn; + } + return bReturn; +} + +static bool performSequenceOfCallTest(XBridgeTest xLBT) +{ + int i,nRounds; + int nGlobalIndex = 0; + const int nWaitTimeSpanMUSec = 10000; + for( nRounds = 0 ; nRounds < 10 ; nRounds ++ ) + { + for( i = 0 ; i < nRounds ; i ++ ) + { + // fire oneways + xLBT.callOneway(nGlobalIndex, nWaitTimeSpanMUSec); + nGlobalIndex++; + } + + // call synchron + xLBT.call(nGlobalIndex, nWaitTimeSpanMUSec); + nGlobalIndex++; + } + return xLBT.sequenceOfCallTestPassed(); +} + + + + +static bool performRecursiveCallTest(XBridgeTest xLBT) +{ + xLBT.startRecursiveCall(new ORecursiveCall(), 50); + // on failure, the test would lock up or crash + return true; +} + +static bool performQueryForUnknownType(XBridgeTest xLBT) +{ + bool bRet = false; + // test queryInterface for an unknown type + try + { + foo.MyInterface a = (foo.MyInterface) xLBT; + } + catch( System.InvalidCastException) + { + bRet = true; + } + + return bRet; +} + + +bool performTest(XBridgeTest xLBT) +{ + check( xLBT != null, "### no test interface!" ); + bool bRet = true; + if (xLBT == null) + return false; + + // this data is never ever granted access to by calls other than equals(), assign()! + TestDataElements aData = new TestDataElements(); // test against this data + + Object xI= new WeakBase(); + + Any aAny = new Any( typeof(Object), xI); + assign( (TestElement)aData, + true, '@', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, + 0x123456789abcdef0, 0xfedcba9876543210, + 17.0815f, 3.1415926359, TestEnum.LOLA, + Constants.STRING_TEST_CONSTANT, xI, + aAny); + + bRet = check( aData.Any.Value == xI, "### unexpected any!" ) && bRet; + bRet = check( !(aData.Any.Value != xI), "### unexpected any!" ) && bRet; + + aData.Sequence = new TestElement[2]; + aData.Sequence[0] = new TestElement( + aData.Bool, aData.Char, aData.Byte, aData.Short, + aData.UShort, aData.Long, aData.ULong, + aData.Hyper, aData.UHyper, aData.Float, + aData.Double, aData.Enum, aData.String, + aData.Interface, aData.Any); //(TestElement) aData; + aData.Sequence[1] = new TestElement(); //is empty + + // aData complete + + // this is a manually copy of aData for first setting... + TestDataElements aSetData = new TestDataElements(); + Any aAnySet= new Any(typeof(Object), xI); + assign( (TestElement)aSetData, + aData.Bool, aData.Char, aData.Byte, aData.Short, aData.UShort, + aData.Long, aData.ULong, aData.Hyper, aData.UHyper, aData.Float, aData.Double, + aData.Enum, aData.String, xI, + aAnySet); + + aSetData.Sequence = new TestElement[2]; + aSetData.Sequence[0] = new TestElement( + aSetData.Bool, aSetData.Char, aSetData.Byte, aSetData.Short, + aSetData.UShort, aSetData.Long, aSetData.ULong, + aSetData.Hyper, aSetData.UHyper, aSetData.Float, + aSetData.Double, aSetData.Enum, aSetData.String, + aSetData.Interface, aSetData.Any); //TestElement) aSetData; + aSetData.Sequence[1] = new TestElement(); // empty struct + + xLBT.setValues( + aSetData.Bool, aSetData.Char, aSetData.Byte, aSetData.Short, aSetData.UShort, + aSetData.Long, aSetData.ULong, aSetData.Hyper, aSetData.UHyper, aSetData.Float, aSetData.Double, + aSetData.Enum, aSetData.String, aSetData.Interface, aSetData.Any, aSetData.Sequence, aSetData ); + + { + TestDataElements aRet = new TestDataElements(); + TestDataElements aRet2 = new TestDataElements(); + xLBT.getValues( + out aRet.Bool, out aRet.Char, out aRet.Byte, out aRet.Short, out aRet.UShort, + out aRet.Long, out aRet.ULong, out aRet.Hyper, out aRet.UHyper, + out aRet.Float, out aRet.Double, out aRet.Enum, out aRet.String, + out aRet.Interface, out aRet.Any, out aRet.Sequence, out aRet2 ); + + bRet = check( compareData( aData, aRet ) && compareData( aData, aRet2 ) , "getValues test") && bRet; + + // set last retrieved values + TestDataElements aSV2ret = xLBT.setValues2( + ref aRet.Bool, ref aRet.Char, ref aRet.Byte, ref aRet.Short, ref aRet.UShort, + ref aRet.Long, ref aRet.ULong, ref aRet.Hyper, ref aRet.UHyper, ref aRet.Float, + ref aRet.Double, ref aRet.Enum, ref aRet.String, ref aRet.Interface, ref aRet.Any, + ref aRet.Sequence, ref aRet2 ); + + // check inout sequence order + // => inout sequence parameter was switched by test objects + TestElement temp = aRet.Sequence[ 0 ]; + aRet.Sequence[ 0 ] = aRet.Sequence[ 1 ]; + aRet.Sequence[ 1 ] = temp; + + bRet = check( + compareData( aData, aSV2ret ) && compareData( aData, aRet2 ), + "getValues2 test") && bRet; + } + { + TestDataElements aRet = new TestDataElements(); + TestDataElements aRet2 = new TestDataElements(); + TestDataElements aGVret = xLBT.getValues( + out aRet.Bool, out aRet.Char, out aRet.Byte, out aRet.Short, + out aRet.UShort, out aRet.Long, out aRet.ULong, out aRet.Hyper, + out aRet.UHyper, out aRet.Float, out aRet.Double, out aRet.Enum, + out aRet.String, out aRet.Interface, out aRet.Any, out aRet.Sequence, + out aRet2 ); + + bRet = check( compareData( aData, aRet ) && compareData( aData, aRet2 ) && compareData( aData, aGVret ), "getValues test" ) && bRet; + + // set last retrieved values + xLBT.Bool = aRet.Bool; + xLBT.Char = aRet.Char; + xLBT.Byte = aRet.Byte; + xLBT.Short = aRet.Short; + xLBT.UShort = aRet.UShort; + xLBT.Long = aRet.Long; + xLBT.ULong = aRet.ULong; + xLBT.Hyper = aRet.Hyper; + xLBT.UHyper = aRet.UHyper; + xLBT.Float = aRet.Float; + xLBT.Double = aRet.Double; + xLBT.Enum = aRet.Enum; + xLBT.String = aRet.String; + xLBT.Interface = aRet.Interface; + xLBT.Any = aRet.Any; + xLBT.Sequence = aRet.Sequence; + xLBT.Struct = aRet2; + } + { + TestDataElements aRet = new TestDataElements(); + TestDataElements aRet2 = new TestDataElements(); + aRet.Hyper = xLBT.Hyper; + aRet.UHyper = xLBT.UHyper; + aRet.Float = xLBT.Float; + aRet.Double = xLBT.Double; + aRet.Byte = xLBT.Byte; + aRet.Char = xLBT.Char; + aRet.Bool = xLBT.Bool; + aRet.Short = xLBT.Short; + aRet.UShort = xLBT.UShort; + aRet.Long = xLBT.Long; + aRet.ULong = xLBT.ULong; + aRet.Enum = xLBT.Enum; + aRet.String = xLBT.String; + aRet.Interface = xLBT.Interface; + aRet.Any = xLBT.Any; + aRet.Sequence = xLBT.Sequence; + aRet2 = xLBT.Struct; + + bRet = check( compareData( aData, aRet ) && compareData( aData, aRet2 ) , "struct comparison test") && bRet; + + bRet = check(performSequenceTest(xLBT), "sequence test") && bRet; + + // any test + bRet = check( performAnyTest( xLBT , aData ) , "any test" ) && bRet; + + // sequence of call test + bRet = check( performSequenceOfCallTest( xLBT ) , "sequence of call test" ) && bRet; + + // recursive call test + bRet = check( performRecursiveCallTest( xLBT ) , "recursive test" ) && bRet; + + bRet = (compareData( aData, aRet ) && compareData( aData, aRet2 )) && bRet ; + + // check setting of null reference + xLBT.Interface = null; + aRet.Interface = xLBT.Interface; + bRet = (aRet.Interface == null) && bRet; + + } + // Test extended attributes that raise exceptions: + try { + int i = xLBT.RaiseAttr1; + bRet &= check(false, "getRaiseAttr1 did not throw"); + } catch (RuntimeException ) + { + } + catch (System.Exception) { + bRet &= check(false, "getRaiseAttr1 threw wrong type"); + } + try { + xLBT.RaiseAttr1 = 0; + bRet &= check(false, "setRaiseAttr1 did not throw"); + } catch (IllegalArgumentException) { + } catch (System.Exception) { + bRet &= check(false, "setRaiseAttr1 threw wrong type"); + } + try { + int i = xLBT.RaiseAttr2; + bRet &= check(false, "getRaiseAttr2 did not throw"); + } catch (IllegalArgumentException ) { + } catch (System.Exception) { + bRet &= check(false, "getRaiseAttr2 threw wrong type"); + } + + // Test instantiated polymorphic struct types: + { + TestPolyStruct poly = new TestPolyStruct(true); + bRet &= check( + (bool) xLBT.transportPolyBoolean(poly).member, + "transportPolyBoolean"); + poly = new TestPolyStruct(12345L); + xLBT.transportPolyHyper(ref poly); + bRet &= check((long)poly.member == 12345L, "transportPolyUnsignedHyper"); + + Any[] seq = { new Any(33), new Any("ABC")}; + poly = new TestPolyStruct(seq); + TestPolyStruct poly2; + xLBT.transportPolySequence(poly, out poly2); + try { + Any[] ar = (Any[]) poly2.member; + bRet &= check( + ar.Length == 2, "transportPolySequence, length"); + + int v0; + v0 = (int) ar[0].Value; + bRet &= check(v0 == 33, "transportPolySequence, element 0"); + + string v1 = (string) ar[1].Value; + bRet &= check( + v1.Equals("ABC"), + "transportPolySequence, element 1"); + } catch (InvalidCastException ) + { + bRet &= check(false, "transportPolySequence"); + } + + try { + //When the test object is a cli object then them member is null + //otherwise the bridge has provided a default value. + TestPolyStruct s = xLBT.getNullPolyLong(); + if (s.member != null) + bRet &= check(((int) s.member) == 0, "getNullPolyLong"); + + s = xLBT.getNullPolyString(); + if (s.member != null) + bRet &= check(((string) s.member).Length == 0, + "getNullPolyString"); + s = xLBT.getNullPolyType(); + if (s.member != null) + bRet &= check(((Type) s.member) == typeof(void), + "getNullPolyType"); + s = xLBT.getNullPolyAny(); + if (s.member != null) + { + Any nullAny = (Any) s.member; + //??? + bRet &= check(nullAny.Type == typeof(void), + "getNullPolyAny"); + } + s = xLBT.getNullPolySequence(); + if (s.member != null) + bRet &= check(((bool[]) s.member).Length == 0, + "getNullPolySequence"); + s = xLBT.getNullPolyEnum(); + if (s.member != null) + bRet &= check(((TestEnum) s.member) == TestEnum.TEST, + "getNullPolyEnum"); + s = xLBT.getNullPolyStruct(); + if (s.member != null) + bRet &= check(((TestStruct) s.member).member == 0, + "getNullPolyStruct"); + s = xLBT.getNullPolyInterface(); + bRet &= check(s.member == null, "getNullPolyInterface"); + + s = xLBT.getNullPolyBadEnum(); + bRet &= check(((TestBadEnum)s.member) == TestBadEnum.M, "getNullPolyBadEnum"); + + } catch(InvalidCastException) + { + bRet &= check(false, "getNullPolyXXX, InvalidCastException"); + } + + } + + XBridgeTest2 xBT2 = xLBT as XBridgeTest2; + if (xBT2 != null) { + try { + xBT2.testConstructorsService(m_xContext); + } catch (BadConstructorArguments) { + bRet = false; + } + } + + return bRet; +} +static bool performSequenceTest(XBridgeTest xBT) +{ + bool bRet = true; + XBridgeTest2 xBT2 = xBT as XBridgeTest2; + if ( xBT2 == null) + return false; + + // perform sequence tests (XBridgeTest2) + // create the sequence which are compared with the results + bool[] arBool = {true, false, true}; + char[] arChar = {'A','B','C'}; + byte[] arByte = { 1, 2, 0xff}; + short[] arShort = {Int16.MinValue, 1, Int16.MaxValue}; + UInt16[] arUShort = {UInt16.MinValue , 1, UInt16.MaxValue}; + int[] arLong = {Int32.MinValue, 1, Int32.MaxValue}; + UInt32[] arULong = {UInt32.MinValue, 1, UInt32.MaxValue}; + long[] arHyper = {Int64.MinValue, 1, Int64.MaxValue}; + UInt64[] arUHyper = {UInt64.MinValue, 1, UInt64.MaxValue}; + float[] arFloat = {1.1f, 2.2f, 3.3f}; + double[] arDouble = {1.11, 2.22, 3.33}; + string[] arString = {"String 1", "String 2", "String 3"}; + + Any[] arAny = {new Any(true), new Any(11111), new Any(3.14)}; + Object[] arObject = {new WeakBase(), new WeakBase(), new WeakBase()}; + TestEnum[] arEnum = {TestEnum.ONE, TestEnum.TWO, TestEnum.CHECK}; + + TestElement[] arStruct = {new TestElement(), new TestElement(), + new TestElement()}; + assign( arStruct[0], true, '@', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, + 0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, 3.1415926359, + TestEnum.LOLA, Constants.STRING_TEST_CONSTANT, arObject[0], + new Any( typeof(Object), arObject[0]) ); + assign( arStruct[1], true, 'A', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, + 0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, 3.1415926359, + TestEnum.TWO, Constants.STRING_TEST_CONSTANT, arObject[1], + new Any( typeof(Object), arObject[1]) ); + assign( arStruct[2], true, 'B', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, + 0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, 3.1415926359, + TestEnum.CHECK, Constants.STRING_TEST_CONSTANT, arObject[2], + new Any( typeof(Object), arObject[2] ) ); + + + int[][][] arLong3 = new int[][][]{ + new int[][]{new int[]{1,2,3},new int[]{4,5,6}, new int[]{7,8,9} }, + new int [][]{new int[]{1,2,3},new int[]{4,5,6}, new int[]{7,8,9}}, + new int[][]{new int[]{1,2,3},new int[]{4,5,6}, new int[]{7,8,9}}}; + + { + int[][] seqSeqRet = xBT2.setDim2(arLong3[0]); + bRet = check( compareData(seqSeqRet, arLong3[0]), "sequence test") && bRet; + int[][][] seqSeqRet2 = xBT2.setDim3(arLong3); + bRet = check( compareData(seqSeqRet2, arLong3), "sequence test") && bRet; + Any[] seqAnyRet = xBT2.setSequenceAny(arAny); + bRet = check( compareData(seqAnyRet, arAny), "sequence test") && bRet; + bool[] seqBoolRet = xBT2.setSequenceBool(arBool); + bRet = check( compareData(seqBoolRet, arBool), "sequence test") && bRet; + byte[] seqByteRet = xBT2.setSequenceByte(arByte); + bRet = check( compareData(seqByteRet, arByte), "sequence test") && bRet; + char[] seqCharRet = xBT2.setSequenceChar(arChar); + bRet = check( compareData(seqCharRet, arChar), "sequence test") && bRet; + short[] seqShortRet = xBT2.setSequenceShort(arShort); + bRet = check( compareData(seqShortRet, arShort), "sequence test") && bRet; + int[] seqLongRet = xBT2.setSequenceLong(arLong); + bRet = check( compareData(seqLongRet, arLong), "sequence test") && bRet; + long[] seqHyperRet = xBT2.setSequenceHyper(arHyper); + bRet = check( compareData(seqHyperRet,arHyper), "sequence test") && bRet; + float[] seqFloatRet = xBT2.setSequenceFloat(arFloat); + bRet = check( compareData(seqFloatRet, arFloat), "sequence test") && bRet; + double[] seqDoubleRet = xBT2.setSequenceDouble(arDouble); + bRet = check( compareData(seqDoubleRet, arDouble), "sequence test") && bRet; + TestEnum[] seqEnumRet = xBT2.setSequenceEnum(arEnum); + bRet = check( compareData(seqEnumRet, arEnum), "sequence test") && bRet; + UInt16[] seqUShortRet = xBT2.setSequenceUShort(arUShort); + bRet = check( compareData(seqUShortRet, arUShort), "sequence test") && bRet; + UInt32[] seqULongRet = xBT2.setSequenceULong(arULong); + bRet = check( compareData(seqULongRet, arULong), "sequence test") && bRet; + UInt64[] seqUHyperRet = xBT2.setSequenceUHyper(arUHyper); + bRet = check( compareData(seqUHyperRet, arUHyper), "sequence test") && bRet; + Object[] seqObjectRet = xBT2.setSequenceXInterface(arObject); + bRet = check( compareData(seqObjectRet, arObject), "sequence test") && bRet; + string[] seqStringRet = xBT2.setSequenceString(arString); + bRet = check( compareData(seqStringRet, arString), "sequence test") && bRet; + TestElement[] seqStructRet = xBT2.setSequenceStruct(arStruct); + bRet = check( compareData(seqStructRet, arStruct), "sequence test") && bRet; + } + { + bool[] arBoolTemp = (bool[]) arBool.Clone(); + char[] arCharTemp = (char[]) arChar.Clone(); + byte[] arByteTemp = (byte[]) arByte.Clone(); + short[] arShortTemp = (short[]) arShort.Clone(); + UInt16[] arUShortTemp = (UInt16[]) arUShort.Clone(); + int[] arLongTemp = (int[]) arLong.Clone(); + UInt32[] arULongTemp = (UInt32[]) arULong.Clone(); + long[] arHyperTemp = (long[]) arHyper.Clone(); + UInt64[] arUHyperTemp = (UInt64[]) arUHyper.Clone(); + float[] arFloatTemp = (float[]) arFloat.Clone(); + double[] arDoubleTemp = (double[]) arDouble.Clone(); + TestEnum[] arEnumTemp = (TestEnum[]) arEnum.Clone(); + string[] arStringTemp = (string[]) arString.Clone(); + Object[] arObjectTemp = (Object[]) arObject.Clone(); + Any[] arAnyTemp = (Any[]) arAny.Clone(); + // make sure this are has the same contents as arLong3[0] + int[][] arLong2Temp = new int[][]{new int[]{1,2,3},new int[]{4,5,6}, new int[]{7,8,9} }; + // make sure this are has the same contents as arLong3 + int[][][] arLong3Temp = new int[][][]{ + new int[][]{new int[]{1,2,3},new int[]{4,5,6}, new int[]{7,8,9} }, + new int [][]{new int[]{1,2,3},new int[]{4,5,6}, new int[]{7,8,9}}, + new int[][]{new int[]{1,2,3},new int[]{4,5,6}, new int[]{7,8,9}}}; + + xBT2.setSequencesInOut(ref arBoolTemp, ref arCharTemp, ref arByteTemp, + ref arShortTemp, ref arUShortTemp, ref arLongTemp, + ref arULongTemp,ref arHyperTemp, ref arUHyperTemp, + ref arFloatTemp,ref arDoubleTemp, ref arEnumTemp, + ref arStringTemp, ref arObjectTemp, + ref arAnyTemp, ref arLong2Temp, ref arLong3Temp); + bRet = check( + compareData(arBoolTemp, arBool) && + compareData(arCharTemp , arChar) && + compareData(arByteTemp , arByte) && + compareData(arShortTemp , arShort) && + compareData(arUShortTemp , arUShort) && + compareData(arLongTemp , arLong) && + compareData(arULongTemp , arULong) && + compareData(arHyperTemp , arHyper) && + compareData(arUHyperTemp , arUHyper) && + compareData(arFloatTemp , arFloat) && + compareData(arDoubleTemp , arDouble) && + compareData(arEnumTemp , arEnum) && + compareData(arStringTemp , arString) && + compareData(arObjectTemp , arObject) && + compareData(arAnyTemp , arAny) && + compareData(arLong2Temp , arLong3[0]) && + compareData(arLong3Temp , arLong3), "sequence test") && bRet; + + bool[] arBoolOut; + char[] arCharOut; + byte[] arByteOut; + short[] arShortOut; + UInt16[] arUShortOut; + int[] arLongOut; + UInt32[] arULongOut; + long[] arHyperOut; + UInt64[] arUHyperOut; + float[] arFloatOut; + double[] arDoubleOut; + TestEnum[] arEnumOut; + string[] arStringOut; + Object[] arObjectOut; + Any[] arAnyOut; + int[][] arLong2Out; + int[][][] arLong3Out; + + xBT2.setSequencesOut(out arBoolOut, out arCharOut, out arByteOut, + out arShortOut, out arUShortOut, out arLongOut, + out arULongOut, out arHyperOut, out arUHyperOut, + out arFloatOut, out arDoubleOut, out arEnumOut, + out arStringOut, out arObjectOut, out arAnyOut, + out arLong2Out, out arLong3Out); + bRet = check( + compareData(arBoolOut, arBool) && + compareData(arCharOut, arChar) && + compareData(arByteOut, arByte) && + compareData(arShortOut, arShort) && + compareData(arUShortOut, arUShort) && + compareData(arLongOut, arLong) && + compareData(arULongOut, arULong) && + compareData(arHyperOut, arHyper) && + compareData(arUHyperOut, arUHyper) && + compareData(arFloatOut, arFloat) && + compareData(arDoubleOut, arDouble) && + compareData(arEnumOut, arEnum) && + compareData(arStringOut, arString) && + compareData(arObjectOut, arObject) && + compareData(arAnyOut, arAny) && + compareData(arLong2Out, arLong3[0]) && + compareData(arLong3Out, arLong3), "sequence test") && bRet; + } + { + //test with empty sequences + int[][] _arLong2 = new int[0][]; + int[][] seqSeqRet = xBT2.setDim2(_arLong2); + bRet = check( compareData(seqSeqRet, _arLong2), "sequence test") && bRet; + int[][][] _arLong3 = new int[0][][]; + int[][][] seqSeqRet2 = xBT2.setDim3(_arLong3); + bRet = check( compareData(seqSeqRet2, _arLong3), "sequence test") && bRet; + Any[] _arAny = new Any[0]; + Any[] seqAnyRet = xBT2.setSequenceAny(_arAny); + bRet = check( compareData(seqAnyRet, _arAny), "sequence test") && bRet; + bool[] _arBool = new bool[0]; + bool[] seqBoolRet = xBT2.setSequenceBool(_arBool); + bRet = check( compareData(seqBoolRet, _arBool), "sequence test") && bRet; + byte[] _arByte = new byte[0]; + byte[] seqByteRet = xBT2.setSequenceByte(_arByte); + bRet = check( compareData(seqByteRet, _arByte), "sequence test") && bRet; + char[] _arChar = new char[0]; + char[] seqCharRet = xBT2.setSequenceChar(_arChar); + bRet = check( compareData(seqCharRet, _arChar), "sequence test") && bRet; + short[] _arShort = new short[0]; + short[] seqShortRet = xBT2.setSequenceShort(_arShort); + bRet = check( compareData(seqShortRet, _arShort), "sequence test") && bRet; + int[] _arLong = new int[0]; + int[] seqLongRet = xBT2.setSequenceLong(_arLong); + bRet = check( compareData(seqLongRet, _arLong), "sequence test") && bRet; + long[] _arHyper = new long[0]; + long[] seqHyperRet = xBT2.setSequenceHyper(_arHyper); + bRet = check( compareData(seqHyperRet, _arHyper), "sequence test") && bRet; + float[] _arFloat = new float[0]; + float[] seqFloatRet = xBT2.setSequenceFloat(_arFloat); + bRet = check( compareData(seqFloatRet, _arFloat), "sequence test") && bRet; + double[] _arDouble = new double[0]; + double[] seqDoubleRet = xBT2.setSequenceDouble(_arDouble); + bRet = check( compareData(seqDoubleRet, _arDouble), "sequence test") && bRet; + TestEnum[] _arEnum = new TestEnum[0]; + TestEnum[] seqEnumRet = xBT2.setSequenceEnum(_arEnum); + bRet = check( compareData(seqEnumRet, _arEnum), "sequence test") && bRet; + UInt16[] _arUShort = new UInt16[0]; + UInt16[] seqUShortRet = xBT2.setSequenceUShort(_arUShort); + bRet = check( compareData(seqUShortRet, _arUShort), "sequence test") && bRet; + UInt32[] _arULong = new UInt32[0]; + UInt32[] seqULongRet = xBT2.setSequenceULong(_arULong); + bRet = check( compareData(seqULongRet, _arULong), "sequence test") && bRet; + UInt64[] _arUHyper = new UInt64[0]; + UInt64[] seqUHyperRet = xBT2.setSequenceUHyper(_arUHyper); + bRet = check( compareData(seqUHyperRet, _arUHyper), "sequence test") && bRet; + Object[] _arObject = new Object[0]; + Object[] seqObjectRet = xBT2.setSequenceXInterface(_arObject); + bRet = check( compareData(seqObjectRet, _arObject), "sequence test") && bRet; + string[] _arString = new string[0]; + string[] seqStringRet = xBT2.setSequenceString(_arString); + bRet = check( compareData(seqStringRet, _arString), "sequence test") && bRet; + TestElement[] _arStruct = new TestElement[0]; + TestElement[] seqStructRet = xBT2.setSequenceStruct(_arStruct); + bRet = check( compareData(seqStructRet, _arStruct), "sequence test") && bRet; + + } + + + return bRet; +} +/** Test the System::Object method on the proxy object + */ +static bool testObjectMethodsImplemention(XBridgeTest xLBT) +{ + bool ret = false; + Object obj = new Object(); + Object xInt = (Object) xLBT; + XBridgeTestBase xBase = xLBT as XBridgeTestBase; + if (xBase == null) + return false; + // Object.Equals + ret = xLBT.Equals(obj) == false; + ret = xLBT.Equals(xLBT) && ret; + ret = Object.Equals(obj, obj) && ret; + ret = Object.Equals(xLBT, xBase) && ret; + //Object.GetHashCode + // Don't know how to verify this. Currently it is not possible to get the object id from a proxy + int nHash = xLBT.GetHashCode(); + ret = nHash == xBase.GetHashCode() && ret; + + //Object.ToString + // Don't know how to verify this automatically. + string s = xLBT.ToString(); + ret = (s.Length > 0) && ret; + return ret; +} + + +static bool raiseOnewayException(XBridgeTest xLBT) +{ + bool bReturn = true; + string sCompare = Constants.STRING_TEST_CONSTANT; + try + { + // Note : the exception may fly or not (e.g. remote scenario). + // When it flies, it must contain the correct elements. + xLBT.raiseRuntimeExceptionOneway(sCompare, xLBT.Interface ); + } + catch (RuntimeException e ) + { + bReturn = ( xLBT.Interface == e.Context ); + } + return bReturn; +} + + +static bool raiseException(XBridgeTest xLBT ) +{ + int nCount = 0; + try + { + try + { + try + { + TestDataElements aRet = new TestDataElements(); + TestDataElements aRet2 = new TestDataElements(); + xLBT.raiseException( + 5, Constants.STRING_TEST_CONSTANT, xLBT.Interface ); + } + catch (unoidl.com.sun.star.lang.IllegalArgumentException aExc) + { + if (aExc.ArgumentPosition == 5 && + aExc.Context == xLBT.Interface) + { + ++nCount; + } + else + { + check( false, "### unexpected exception content!" ); + } + + /** it is certain, that the RuntimeException testing will fail, + if no */ + xLBT.RuntimeException = 0; + } + } + catch (unoidl.com.sun.star.uno.RuntimeException rExc) + { + if (rExc.Context == xLBT.Interface ) + { + ++nCount; + } + else + { + check( false, "### unexpected exception content!" ); + } + + /** it is certain, that the RuntimeException testing will fail, if no */ + unchecked + { + xLBT.RuntimeException = (int) 0xcafebabe; + } + } + } + catch (unoidl.com.sun.star.uno.Exception rExc) + { + if (rExc.Context == xLBT.Interface) + { + ++nCount; + } + else + + { + check( false, "### unexpected exception content!" ); + } + return (nCount == 3); + } + return false; +} + + private void perform_test( XBridgeTest xLBT ) + { + bool bRet= true; + bRet = check( performTest( xLBT ), "standard test" ) && bRet; + bRet = check( raiseException( xLBT ) , "exception test" )&& bRet; + bRet = check( raiseOnewayException( xLBT ), "oneway exception test" ) && bRet; + bRet = check( testObjectMethodsImplemention(xLBT), "object methods test") && bRet; + bRet = performQueryForUnknownType( xLBT ) && bRet; + if ( ! bRet) + { + throw new unoidl.com.sun.star.uno.RuntimeException( "error (cli_cs_bridgetest.cs): test failed!", null); + } + } + + public BridgeTest( XComponentContext xContext ) + { + m_xContext = xContext; + } + + private XComponentContext m_xContext; + + public int run( String [] args ) + { + Debug.AutoFlush = true; +// System.Diagnostics.Debugger.Launch(); + try + { + if (args.Length < 1) + { + throw new RuntimeException( + "missing argument for bridgetest!", this ); + } + Object test_obj = + m_xContext.getServiceManager().createInstanceWithContext( + args[ 0 ], m_xContext ); + + Debug.WriteLine( + "Calling object: {0}", test_obj.ToString() ); + + XBridgeTest xTest = (XBridgeTest) test_obj ; + perform_test( xTest ); + Console.WriteLine( "\n### cli_uno C# bridgetest succeeded." ); + return 0; + } + catch (unoidl.com.sun.star.uno.RuntimeException) + { + throw; + } + catch (System.Exception exc) + { + throw new unoidl.com.sun.star.uno.RuntimeException( + "cli_cs_bridgetest.cs: unexpected exception occurred in XMain::run. Original exception: " + + exc.GetType().Name + "\n Message: " + exc.Message , null); + } + } +} + +} diff --git a/testtools/source/bridgetest/cli/cli_cs_multi.cs b/testtools/source/bridgetest/cli/cli_cs_multi.cs new file mode 100644 index 000000000..3fd5a4975 --- /dev/null +++ b/testtools/source/bridgetest/cli/cli_cs_multi.cs @@ -0,0 +1,110 @@ +/* + * 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 . + */ + +namespace testtools::bridgetest::cli_cs { + +public class Multi: unoidl.test.testtools.bridgetest.XMulti +{ + public Multi() + { + } + + public double att1 + { + get { return _att1; } + set { _att1 = value; } + } + + public int fn11(int arg) + { + return 11 * arg; + } + + public string fn12(string arg) + { + return "12" + arg; + } + + public int fn21(int arg) + { + return 21 * arg; + } + + public string fn22(string arg) + { + return "22" + arg; + } + + public double att3 + { + get { return _att3; } + set { _att3 = value; } + } + + public int fn31(int arg) + { + return 31 * arg; + } + + public string fn32(string arg) + { + return "32" + arg; + } + + public int fn33() + { + return 33; + } + + public int fn41(int arg) + { + return 41 * arg; + } + + public int fn61(int arg) + { + return 61 * arg; + } + + public string fn62(string arg) + { + return "62" + arg; + } + + public int fn71(int arg) + { + return 71 * arg; + } + + public string fn72(string arg) + { + return "72" + arg; + } + + public int fn73() + { + return 73; + } + + private double _att1; + private double _att3; +}; + +} } } + + diff --git a/testtools/source/bridgetest/cli/cli_cs_testobj.cs b/testtools/source/bridgetest/cli/cli_cs_testobj.cs new file mode 100644 index 000000000..8f396c924 --- /dev/null +++ b/testtools/source/bridgetest/cli/cli_cs_testobj.cs @@ -0,0 +1,925 @@ +/* + * 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 . + */ + +using System; +using System.Diagnostics; +using System.Threading; +using System.Runtime.CompilerServices; +using uno; +using uno.util; +using unoidl.com.sun.star.uno; +using unoidl.com.sun.star.lang; +using unoidl.test.testtools.bridgetest; + +namespace cs_testobj +{ + +class CheckFailed: System.Exception { + public CheckFailed(string message): base(message) {} +} + +public class BridgeTestObject : WeakBase, XRecursiveCall, XBridgeTest2 +{ + private XComponentContext m_xContext; + + public BridgeTestObject( XComponentContext xContext ) + { + m_xContext = xContext; + } + public BridgeTestObject() + { + } + + private bool _bool; + private char _char; + private byte _byte; + private short _short; + private ushort _ushort; + private int _long; + private uint _ulong; + private long _hyper; + private ulong _uhyper; + private float _float; + private double _double; + private String _string; + private Object _xInterface; + private Any _any; + private TestEnum _testEnum = TestEnum.TEST; + private TestElement[] _testElements = new TestElement[0]; + private TestDataElements _testDataElements = new TestDataElements(); + private int _nLastCallId = 0; + private bool _bFirstCall = true; + private bool _bSequenceOfCallTestPassed = true; + + private bool[] _arBool; + private char[] _arChar; + private byte[] _arByte; + private short[]_arShort; + private int[] _arLong; + private long[] _arHyper; + private UInt16[] _arUShort; + private UInt32[] _arULong; + private UInt64[] _arUHyper; + private string[] _arString; + private float[] _arFloat; + private double[] _arDouble; + private TestEnum[] _arEnum; + private Object[] _arObject; + private int[][] _arLong2; + private int[][][] _arLong3; + private Any[] _arAny; + +// private int _raiseAttr1; + + + public void setValues( + bool bBool, + char cChar, + byte nByte, + short nShort, + ushort nUShort, + int nLong, + uint nULong, + long nHyper, + ulong nUHyper, + float fFloat, + double fDouble, + TestEnum testEnum, + String str, + Object xInterface, + Any any, + TestElement [] testElements, + TestDataElements testDataElements ) + { + Debug.WriteLine( "##### " + GetType().FullName + ".setValues:" + any ); + + _bool = bBool; + _char = cChar; + _byte = nByte; + _short = nShort; + _ushort = nUShort; + _long = nLong; + _ulong = nULong; + _hyper = nHyper; + _uhyper = nUHyper; + _float = fFloat; + _double = fDouble; + _testEnum = testEnum; + _string = str; + _xInterface = xInterface; + _any = any; + _testElements = testElements; + _testDataElements = testDataElements; + } + + public TestDataElements setValues2( + /*INOUT*/ref bool io_bool, + /*INOUT*/ref char io_char, + /*INOUT*/ref byte io_byte, + /*INOUT*/ref short io_short, + /*INOUT*/ref ushort io_ushort, + /*INOUT*/ref int io_long, + /*INOUT*/ref uint io_ulong, + /*INOUT*/ref long io_hyper, + /*INOUT*/ref ulong io_uhyper, + /*INOUT*/ref float io_float, + /*INOUT*/ref double io_double, + /*INOUT*/ref TestEnum io_testEnum, + /*INOUT*/ref String io_string, + /*INOUT*/ref Object io_xInterface, + /*INOUT*/ref Any io_any, + /*INOUT*/ref TestElement[] io_testElements, + /*INOUT*/ref TestDataElements io_testDataElements ) + { + Debug.WriteLine( "##### " + GetType().FullName + ".setValues2:" + io_any ); + + _bool = io_bool; + _char = io_char; + _byte = io_byte; + _short = io_short; + _ushort = io_ushort; + _long = io_long; + _ulong = io_ulong; + _hyper = io_hyper; + _uhyper = io_uhyper; + _float = io_float; + _double = io_double; + _testEnum = io_testEnum; + _string = io_string; + _xInterface = io_xInterface; + _any = io_any; + _testElements = (TestElement[]) io_testElements.Clone(); + _testDataElements = io_testDataElements; + + TestElement temp = io_testElements[ 0 ]; + io_testElements[ 0 ] = io_testElements[ 1 ]; + io_testElements[ 1 ] = temp; + + return _testDataElements; + } + + public TestDataElements getValues( + /*OUT*/out bool o_bool, + /*OUT*/out char o_char, + /*OUT*/out byte o_byte, + /*OUT*/out short o_short, + /*OUT*/out ushort o_ushort, + /*OUT*/out int o_long, + /*OUT*/out uint o_ulong, + /*OUT*/out long o_hyper, + /*OUT*/out ulong o_uhyper, + /*OUT*/out float o_float, + /*OUT*/out double o_double, + /*OUT*/out TestEnum o_testEnum, + /*OUT*/out String o_string, + /*OUT*/out Object o_xInterface, + /*OUT*/out Any o_any, + /*OUT*/out TestElement[] o_testElements, + /*OUT*/out TestDataElements o_testDataElements ) + { + Debug.WriteLine( "##### " + GetType().FullName + ".getValues" ); + + o_bool = _bool; + o_char = _char; + o_byte = _byte; + o_short = _short; + o_ushort = _ushort; + o_long = _long; + o_ulong = _ulong; + o_hyper = _hyper; + o_uhyper = _uhyper; + o_float = _float; + o_double = _double; + o_testEnum = _testEnum; + o_string = _string; + o_xInterface = _xInterface; + o_any = _any; + o_testElements = _testElements; + o_testDataElements = _testDataElements; + + return _testDataElements; + } + + public SmallStruct echoSmallStruct(/*[in]*/SmallStruct arg) + { + return arg; + } + + public MediumStruct echoMediumStruct(/*[in]*/MediumStruct arg) + { + return arg; + } + + public BigStruct echoBigStruct(/*[in]*/BigStruct arg) + { + return arg; + } + + public TwoFloats echoTwoFloats(/*[in]*/TwoFloats arg) + { + return arg; + } + + public FourFloats echoFourFloats(/*[in]*/FourFloats arg) + { + return arg; + } + + public MixedFloatAndInteger echoMixedFloatAndInteger(/*[in]*/MixedFloatAndInteger arg) + { + return arg; + } + + public ThreeByteStruct echoThreeByteStruct(/*[in]*/ThreeByteStruct arg) + { + return arg; + } + + public int testPPCAlignment( long l1, long l2, int i1, long l3, int i2 ) + { + return i2; + } + + public int testPPC64Alignment( double d1, double d2, double d3, int i1 ) + { + return i1; + } + + public double testTenDoubles( double d1, double d2, double d3, double d4, double d5, double d6, double d7, double d8, double d9, double d10 ) + { + return d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10; + } + + // Attributes + public bool Bool + { + get { return _bool; } + set { _bool = value; } + } + public byte Byte + { + get { return _byte; } + set { _byte = value; } + } + public char Char + { + get { return _char; } + set { _char = value; } + } + public short Short + { + get { return _short; } + set { _short = value; } + } + public ushort UShort + { + get { return _ushort; } + set { _ushort = value; } + } + public int Long + { + get { return _long; } + set { _long = value; } + } + public uint ULong + { + get { return _ulong; } + set { _ulong = value; } + } + public long Hyper + { + get { return _hyper; } + set { _hyper = value; } + } + public ulong UHyper + { + get { return _uhyper; } + set { _uhyper = value; } + } + public float Float + { + get { return _float; } + set { _float = value; } + } + public double Double + { + get { return _double; } + set { _double = value; } + } + public TestEnum Enum + { + get { return _testEnum; } + set { _testEnum = value; } + } + public String String + { + get { return _string; } + set { _string = value; } + } + public Object Interface + { + get { return _xInterface; } + set { _xInterface = value; } + } + public uno.Any Any + { + get { + + Debug.WriteLine( "##### " + GetType().FullName + ".Any" ); + return _any; + } + set { + Debug.WriteLine( "##### " + GetType().FullName + ".Any:" + value ); + _any = value; + } + } + public TestElement [] Sequence + { + get { return _testElements; } + set { _testElements = value; } + } + public TestDataElements Struct + { + get { return _testDataElements; } + set { _testDataElements = value; } + } + public Any transportAny(Any value) + { + return value; + } + public void call(int nCallId , int nWaitMUSEC) + { + Thread.Sleep(nWaitMUSEC / 10000); + + if(_bFirstCall) + _bFirstCall = false; + + else + _bSequenceOfCallTestPassed = _bSequenceOfCallTestPassed && (nCallId > _nLastCallId); + + _nLastCallId = nCallId; + } + public void callOneway( int nCallId , int nWaitMUSEC ) + { + Thread.Sleep(nWaitMUSEC / 10000); + + _bSequenceOfCallTestPassed = _bSequenceOfCallTestPassed && (nCallId > _nLastCallId); + _nLastCallId = nCallId; + } + public bool sequenceOfCallTestPassed() + { + return _bSequenceOfCallTestPassed; + } + [MethodImpl( MethodImplOptions.Synchronized )] + public void callRecursivly( XRecursiveCall xCall, int nToCall ) + { + lock (this) + { + if(nToCall != 0) + { + nToCall --; + xCall.callRecursivly(this , nToCall); + } + } + } + [MethodImpl( MethodImplOptions.Synchronized )] + public void startRecursiveCall( XRecursiveCall xCall, int nToCall ) + { + lock (this) + { + if(nToCall != 0) + { + nToCall --; + xCall.callRecursivly( this , nToCall ); + } + } + } + + // XBridgeTest + public TestDataElements raiseException( + short nArgumentPos, String rMsg, Object xContext ) + { + throw new IllegalArgumentException(rMsg, xContext, nArgumentPos); + } + public void raiseRuntimeExceptionOneway( String rMsg, Object xContext ) + { + throw new RuntimeException(rMsg, xContext); + } + + private void dothrow( System.Exception e ) + { + throw e; + } + public int RuntimeException + { + get { + try + { + dothrow( new RuntimeException(_string, _xInterface) ); + return 0; // dummy + } + catch (System.Exception exc) + { + throw exc; + } + } + set { throw new RuntimeException(_string, _xInterface); } + } + + // XBridgeTest2 + public int[][] setDim2(int[][] val) + { + _arLong2 = val; + return val; + } + + public int[][][] setDim3(int[][][] val) + { + _arLong3 = val; + return val; + } + + public Any[] setSequenceAny(Any[] val) + { + _arAny = val; + return val; + } + + public bool[] setSequenceBool(bool[] val) + { + _arBool = val; + return val; + } + + public byte[] setSequenceByte(byte[] val) + { + _arByte = val; + return val; + } + + public char[] setSequenceChar(char[] val) + { + _arChar = val; + return val; + } + + public short[] setSequenceShort(short[] val) + { + _arShort = val; + return val; + } + + public int[] setSequenceLong(int[] val) + { + _arLong = val; + return val; + } + + public long[] setSequenceHyper(long[] val) + { + _arHyper = val; + return val; + } + + public float[] setSequenceFloat(float[] val) + { + _arFloat = val; + return val; + } + + public double[] setSequenceDouble(double[] val) + { + _arDouble = val; + return val; + } + + public TestEnum[] setSequenceEnum(TestEnum[] val) + { + _arEnum = val; + return val; + } + + public UInt16[] setSequenceUShort(UInt16[] val) + { + _arUShort = val; + return val; + } + + public UInt32[] setSequenceULong(UInt32[] val) + { + _arULong = val; + return val; + } + + public UInt64[] setSequenceUHyper(UInt64[] val) + { + _arUHyper = val; + return val; + } + + public Object[] setSequenceXInterface(Object[] val) + { + _arObject = val; + return val; + } + + public string[] setSequenceString(string[] val) + { + _arString = val; + return val; + } + + public TestElement[] setSequenceStruct(TestElement[] val) + { + _testElements = val; + return val; + } + + public void setSequencesInOut(ref bool[] aSeqBoolean, + ref char[] aSeqChar, + ref byte[] aSeqByte, + ref short[] aSeqShort, + ref UInt16[] aSeqUShort, + ref int[] aSeqLong, + ref UInt32[] aSeqULong, + ref long[] aSeqHyper, + ref UInt64[] aSeqUHyper, + ref float[] aSeqFloat, + ref double[] aSeqDouble, + ref TestEnum[] aSeqTestEnum, + ref string[] aSeqString, + ref object[] aSeqXInterface, + ref Any[] aSeqAny, + ref int[][] aSeqDim2, + ref int[][][] aSeqDim3) + { + _arBool = aSeqBoolean; + _arChar = aSeqChar; + _arByte = aSeqByte; + _arShort = aSeqShort; + _arUShort = aSeqUShort; + _arLong = aSeqLong; + _arULong = aSeqULong; + _arHyper = aSeqHyper; + _arUHyper = aSeqUHyper; + _arFloat = aSeqFloat; + _arDouble = aSeqDouble; + _arEnum = aSeqTestEnum; + _arString = aSeqString; + _arObject = aSeqXInterface; + _arAny = aSeqAny; + _arLong2 = aSeqDim2; + _arLong3 = aSeqDim3; + } + + public void setSequencesOut(out bool[] aSeqBoolean, + out char[] aSeqChar, + out byte[] aSeqByte, + out short[] aSeqShort, + out UInt16[] aSeqUShort, + out int[] aSeqLong, + out UInt32[] aSeqULong, + out long[] aSeqHyper, + out UInt64[] aSeqUHyper, + out float[] aSeqFloat, + out double[] aSeqDouble, + out TestEnum[] aSeqTestEnum, + out string[] aSeqString, + out object[] aSeqXInterface, + out Any[] aSeqAny, + out int[][] aSeqDim2, + out int[][][] aSeqDim3) + { + aSeqBoolean = _arBool; + aSeqChar = _arChar; + aSeqByte = _arByte; + aSeqShort = _arShort; + aSeqUShort = _arUShort; + aSeqLong = _arLong; + aSeqULong = _arULong; + aSeqHyper = _arHyper; + aSeqUHyper = _arUHyper; + aSeqFloat = _arFloat; + aSeqDouble = _arDouble; + aSeqTestEnum = _arEnum; + aSeqString = _arString; + aSeqXInterface = _arObject; + aSeqAny = _arAny; + aSeqDim2 = _arLong2; + aSeqDim3 = _arLong3; + + } + + /* Attention: Debugging this code (probably in mixed mode) may lead to exceptions + * which do not occur when running normally (Visual Studio 2003) + */ + public void testConstructorsService(XComponentContext context) + { + Constructors.create1(context, + true, + 0x80, // -128 in C++, + Int16.MinValue, + UInt16.MaxValue, + Int32.MinValue, + UInt32.MaxValue, + Int64.MinValue, + UInt64.MaxValue, + 0.123f, + 0.456, + 'X', + "test", + typeof(Any), + new Any(true), + new bool[] { true }, + new byte[] { 0x80}, // in C++ the value is compared with SAL_MIN_INT8 which is -128 + new short[] { Int16.MinValue }, + new UInt16[] { UInt16.MaxValue }, + new Int32[] {Int32.MinValue}, + new UInt32[] { UInt32.MaxValue }, + new long[] { Int64.MinValue }, + new UInt64[] { UInt64.MaxValue }, + new float[] { 0.123f }, + new double[] { 0.456 }, + new char[] { 'X' }, + new string[] { "test" }, + new Type[] { typeof(Any) }, + new Any[] { new Any(true) }, + new bool[][] { new bool[] { true } }, + new Any[][] { new Any[] { new Any(true) } }, + new TestEnum[] { TestEnum.TWO }, + new TestStruct[] { new TestStruct(10) }, + new TestPolyStruct[] { new TestPolyStruct(true) }, + new TestPolyStruct[] { new TestPolyStruct(new Any(true)) }, + new object[] { null }, + TestEnum.TWO, + new TestStruct(10), + new TestPolyStruct(true), + new TestPolyStruct(new Any(true)), + null + ); + + Constructors.create2(context, + new Any(true), + new Any((System.Byte) 0x80), + new Any(Int16.MinValue), + new Any(UInt16.MaxValue), + new Any(Int32.MinValue), + new Any(UInt32.MaxValue), + new Any(Int64.MinValue), + new Any(UInt64.MaxValue), + new Any(0.123f), + new Any(0.456), + new Any('X'), + new Any("test"), + new Any(typeof(Any)), + new Any(true), + new Any(typeof(bool[]), new bool[] { true }), + new Any(typeof(byte[]), new byte[] { (System.Byte) 0x80}), + new Any(typeof(short[]), new short[] { Int16.MinValue }), + new Any(typeof(UInt16[]), new UInt16[] { UInt16.MaxValue }), + new Any(typeof(int[]), new int[] { Int32.MinValue }), + new Any(typeof(UInt32[]), new UInt32[] { UInt32.MaxValue }), + new Any(typeof(long[]), new long[] { Int64.MinValue }), + new Any(typeof(UInt64[]), new UInt64[] { UInt64.MaxValue }), + new Any(typeof(float[]), new float[] { 0.123f }), + new Any(typeof(double[]), new double[] { 0.456 }), + new Any(typeof(char[]), new char[] { 'X' }), + new Any(typeof(string[]), new string[] { "test" }), + new Any(typeof(Type[]), new Type[] { typeof(Any) }), + new Any(typeof(Any[]), new Any[] { new Any(true) }), + new Any(typeof(bool[][]), new bool[][] { new bool[] { true } }), + new Any( + typeof(Any[][]), new Any[][] { new Any[] { new Any(true) } }), + new Any(typeof(TestEnum[]), new TestEnum[] { TestEnum.TWO }), + new Any( + typeof(TestStruct[]), new TestStruct[] { new TestStruct(10) }), + new Any( + PolymorphicType.GetType( + typeof(TestPolyStruct[]), + "unoidl.test.testtools.bridgetest.TestPolyStruct<System.Boolean>[]"), + new TestPolyStruct[] { new TestPolyStruct(true) }) , + new Any( + PolymorphicType.GetType( + typeof(TestPolyStruct[]), + "unoidl.test.testtools.bridgetest.TestPolyStruct<uno.Any>[]"), + new TestPolyStruct[] { new TestPolyStruct(new Any(true)) }), + new Any(typeof(object[])/*TODO*/, new object[] { null }), + new Any(typeof(TestEnum), TestEnum.TWO), + new Any(typeof(TestStruct), new TestStruct(10)), + new Any( + PolymorphicType.GetType( + typeof(TestPolyStruct), + "unoidl.test.testtools.bridgetest.TestPolyStruct<System.Boolean>"), + new TestPolyStruct(true)), + new Any( + PolymorphicType.GetType( + typeof(TestPolyStruct), + "unoidl.test.testtools.bridgetest.TestPolyStruct<uno.Any>"), + new TestPolyStruct(new Any(true))), + new Any(typeof(object), null) + ); + + + XMultiBase1 xMulti = Constructors2.create1( + context, + new TestPolyStruct(typeof(int)), + new TestPolyStruct(new Any(true)), + new TestPolyStruct(true), + new TestPolyStruct((Byte) 0x80), + new TestPolyStruct(Int16.MinValue), + new TestPolyStruct(Int32.MinValue), + new TestPolyStruct(Int64.MinValue), + new TestPolyStruct('X'), + new TestPolyStruct("test"), + new TestPolyStruct(0.123f), + new TestPolyStruct(0.456d), + new TestPolyStruct(new object()), + new TestPolyStruct(new uno.util.WeakComponentBase()), + new TestPolyStruct(TestEnum.TWO), + new TestPolyStruct(new TestPolyStruct2('X', new Any(true))), + new TestPolyStruct(new TestPolyStruct2(new TestPolyStruct2('X', new Any(true)), "test")), + new TestPolyStruct2("test", new TestPolyStruct2('X', new TestPolyStruct(new Any(true)))), + new TestPolyStruct2( new TestPolyStruct2('X', new Any(true)), new TestPolyStruct('X')), + new TestPolyStruct(new Type[] { typeof(int)}), + new TestPolyStruct(new Any[] { new Any(true) }), + new TestPolyStruct(new bool[] {true}), + new TestPolyStruct(new byte[] {0x80}), + new TestPolyStruct(new short[] {Int16.MinValue}), + new TestPolyStruct(new int[] {Int32.MinValue}), + new TestPolyStruct(new long[] {Int64.MinValue}), + new TestPolyStruct(new char[] {'X'}), + new TestPolyStruct(new string[] {"test"}), + new TestPolyStruct(new float[] {0.123f}), + new TestPolyStruct(new double[] {0.456d}), + new TestPolyStruct(new object[] {new object()}), + new TestPolyStruct(new unoidl.com.sun.star.lang.XComponent[] {new uno.util.WeakComponentBase()}), + new TestPolyStruct(new TestEnum[] {TestEnum.TWO}), + new TestPolyStruct(new TestPolyStruct2[] {new TestPolyStruct2('X', new Any[] {new Any(true)})}), + new TestPolyStruct(new TestPolyStruct2[] { + new TestPolyStruct2(new TestPolyStruct('X'), new Any[] {new Any(true)})}), + new TestPolyStruct(new int[][] { new int[] {Int32.MinValue} }), + new TestPolyStruct[]{ new TestPolyStruct(Int32.MinValue)}, + new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2('X', new Any(true)))}, + new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2(new TestPolyStruct2('X', new Any(true)), "test"))}, + new TestPolyStruct2[]{new TestPolyStruct2("test", new TestPolyStruct2('X', new TestPolyStruct(new Any(true))))}, + new TestPolyStruct2[]{new TestPolyStruct2(new TestPolyStruct2('X', new Any(true)),new TestPolyStruct('X'))}, + new TestPolyStruct[][]{new TestPolyStruct[]{new TestPolyStruct('X')}}, + new TestPolyStruct[][]{new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2('X', new Any(true)))}}, + new TestPolyStruct[][]{new TestPolyStruct[] {new TestPolyStruct(new TestPolyStruct2(new TestPolyStruct2('X',new Any(true)), "test"))}}, + new TestPolyStruct2[][]{new TestPolyStruct2[]{new TestPolyStruct2("test", new TestPolyStruct2('X',new TestPolyStruct(new Any(true))))}}, + new TestPolyStruct2[][]{new TestPolyStruct2[]{new TestPolyStruct2(new TestPolyStruct2('X',new Any(true)),new TestPolyStruct('X'))}} + ); + + //test the returned interface + xMulti.fn11(1); + + + } + + public XCurrentContextChecker getCurrentContextChecker() + { + return null; //TODO: not yet tested in CLI UNO + } + + public TestPolyStruct transportPolyBoolean(/*[in]*/TestPolyStruct arg) + { + return arg; + } + + public void transportPolyHyper(/*[in][out]*/ ref TestPolyStruct arg) + { + } + + public void transportPolySequence(TestPolyStruct arg1, + out TestPolyStruct arg2) + { + arg2 = arg1; + } + + public TestPolyStruct getNullPolyBadEnum() + { + return new TestPolyStruct(unoidl.test.testtools.bridgetest.TestBadEnum.M); + } + + public TestPolyStruct getNullPolyLong() + { + return new TestPolyStruct(); + } + + public TestPolyStruct getNullPolyString() + { + return new TestPolyStruct(); + } + + public TestPolyStruct getNullPolyType() + { + return new TestPolyStruct(); + } + + public TestPolyStruct getNullPolyAny() + { + return new TestPolyStruct(); + } + + public TestPolyStruct getNullPolySequence() + { + return new TestPolyStruct(); + } + + public TestPolyStruct getNullPolyEnum() + { + return new TestPolyStruct(); + } + + public TestPolyStruct getNullPolyStruct() + { + return new TestPolyStruct(); + } + + public TestPolyStruct getNullPolyInterface() + { + return new TestPolyStruct(); + } + + public XMulti getMulti() + { + return new testtools.bridgetest.cli_cs.Multi(); + } + + private static void checkEqual(int value, int argument) { + if (argument != value) { + throw new CheckFailed(value + " != " + argument); + } + } + + private static void checkEqual(double value, double argument) { + if (argument != value) { + throw new CheckFailed(value + " != " + argument); + } + } + + private static void checkEqual(string value, string argument) { + if (argument != value) { + throw new CheckFailed(value + " != " + argument); + } + } + + public string testMulti(XMulti multi) + { + try { + checkEqual(0.0, multi.att1); + multi.att1 = 0.1; + checkEqual(0.1, multi.att1); + checkEqual(11 * 1, multi.fn11(1)); + checkEqual("12" + "abc", multi.fn12("abc")); + checkEqual(21 * 2, multi.fn21(2)); + checkEqual("22" + "de", multi.fn22("de")); + checkEqual(0.0, multi.att3); + multi.att3 = 0.3; + checkEqual(0.3, multi.att3); + checkEqual(31 * 3, multi.fn31(3)); + checkEqual("32" + "f", multi.fn32("f")); + checkEqual(33, multi.fn33()); + checkEqual(41 * 4, multi.fn41(4)); + checkEqual(61 * 6, multi.fn61(6)); + checkEqual("62" + "", multi.fn62("")); + checkEqual(71 * 7, multi.fn71(7)); + checkEqual("72" + "g", multi.fn72("g")); + checkEqual(73, multi.fn73()); + } catch (CheckFailed f) { + return f.Message; + } + return ""; + } + + public int RaiseAttr1 + { + get { throw new RuntimeException(); } + set { throw new IllegalArgumentException(); } + } + + public int RaiseAttr2 + { + get { throw new IllegalArgumentException(); } + set { throw new IllegalArgumentException(); } + } + + +} + +} diff --git a/testtools/source/bridgetest/cli/cli_vb_bridgetest.vb b/testtools/source/bridgetest/cli/cli_vb_bridgetest.vb new file mode 100644 index 000000000..9b55cad6e --- /dev/null +++ b/testtools/source/bridgetest/cli/cli_vb_bridgetest.vb @@ -0,0 +1,851 @@ +' +' 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 . +' + +Option Explicit On +Option Strict On + +imports System +imports uno +imports uno.util +imports unoidl.com.sun.star.lang +imports unoidl.com.sun.star.uno +'imports unoidl.com.sun.star.test.bridge +imports unoidl.test.testtools.bridgetest +imports System.Windows.Forms +imports System.Diagnostics +imports System.Reflection + +Class CONSTANTS +Friend Shared STRING_TEST_CONSTANT As String = """ paco\' chorizo\\\' ""\'" +End Class + +Namespace foo + + Public Interface MyInterface + End Interface +End Namespace + +Namespace vb_bridetest +Class ORecursiveCall + Inherits WeakBase + Implements XRecursiveCall + + Overridable Sub callRecursivly(xCall As XRecursiveCall, nToCall As Integer) _ + Implements XRecursiveCall.callRecursivly + SyncLock Me + If nToCall > 0 + nToCall = nToCall - 1 + xCall.callRecursivly(Me, nToCall) + End If + End SyncLock + End Sub +End Class + + + + +Public Class BridgeTest + Inherits uno.util.WeakBase + Implements XMain + + Private m_xContext As XComponentContext + + Public Sub New( xContext As unoidl.com.sun.star.uno.XComponentContext ) + mybase.New() + m_xContext = xContext + End Sub + + Private Shared Function check( b As Boolean , message As String ) As Boolean + If Not b + Console.WriteLine("{0} failed\n" , message) + End If + Return b + End Function + + Private Shared Sub assign( rData As TestElement, bBool As Boolean, _ + aChar As Char, nByte As Byte, nShort As Short, nUShort As UInt16, _ + nLong As Integer, nULong As UInt32, nHyper As Long, _ + nUHyper As UInt64, fFloat As Single, fDouble As Double, _ + eEnum As TestEnum, rStr As String, xTest As Object, _ + rAny As Any) + + rData.Bool = bBool + rData.Char = aChar + rData.Byte = nByte + rData.Short = nShort + rData.UShort = nUShort + rData.Long = nLong + rData.ULong = nULong + rData.Hyper = nHyper + rData.UHyper = nUHyper + rData.Float = fFloat + rData.Double = fDouble + rData.Enum = eEnum + rData.String = rStr + rData.Interface = xTest + rData.Any = rAny + End Sub + + Private Shared Sub assign( rData As TestDataElements, bBool As Boolean, _ + aChar As Char, nByte As Byte, nShort As Short, nUShort As UInt16, _ + nLong As Integer, nULong As UInt32, nHyper As Long, _ + nUHyper As UInt64, fFloat As Single, fDouble As Double, _ + eEnum As TestEnum, rStr As String, xTest As Object, _ + rAny As Any, rSequence() As TestElement) + + assign( DirectCast( rData,TestElement), _ + bBool, aChar, nByte, nShort, nUShort, nLong, nULong, nHyper, _ + nUHyper, fFloat, fDouble, eEnum, rStr, xTest, rAny ) + rData.Sequence = rSequence + End Sub + + Private Shared Function compareData(val1 As Object, val2 As Object) As Boolean + If val1 Is Nothing And val2 Is Nothing OrElse _ + val1 Is val2 + Return True + End If + If val1 Is Nothing And Not(val2 Is Nothing) OrElse _ + Not (val1 Is Nothing) And val2 Is Nothing OrElse _ + Not val1.GetType().Equals( val2.GetType()) + Return False + End If + + Dim ret As Boolean = False + Dim t1 As Type = val1.GetType() + 'Sequence + If t1.IsArray() + ret = compareSequence(DirectCast( val1, Array), _ + DirectCast( val2, Array)) + 'String + ElseIf TypeOf val1 Is String + ret = DirectCast( val1, string) = DirectCast( val2, string) + ' Interface implementation + ElseIf t1.GetInterfaces().Length > 0 And Not t1.IsValueType + ret = val1 Is val2 + ' Struct + ElseIf Not t1.IsValueType + ret = compareStruct(val1, val2) + ElseIf TypeOf val1 Is Any + Dim a1 As Any = DirectCast( val1, Any) + Dim a2 As Any = DirectCast( val2, Any) + ret = a1.Type.Equals( a2.Type ) And compareData( a1.Value, a2.Value ) + ElseIf t1.IsValueType + 'Any, enum, int, bool char, float, double etc. + ret = val1.Equals(val2) + Else + Debug.Assert(False) + End If + Return ret + End Function + + ' Arrays have only one dimension + Private Shared Function compareSequence( ar1 As Array, ar2 As Array) As Boolean + Debug.Assert( Not (ar1 Is Nothing) And Not (ar2 Is Nothing) ) + Dim t1 As Type = ar1.GetType() + Dim t2 As Type = ar2.GetType() + + if ( Not(ar1.Rank = 1 And ar2.Rank = 1 _ + And ar1.Length = ar2.Length And t1.GetElementType().Equals(t2.GetElementType()))) + return False + End If + 'arrays have same rank and size and element type. + Dim len As Integer = ar1.Length + Dim elemType As Type = t1.GetElementType() + Dim ret As Boolean = True + Dim i As Integer + For i = 0 To len - 1 + If (compareData(ar1.GetValue(i), ar2.GetValue(i)) = False) + ret = False + Exit For + End If + Next i + + Return ret + End Function + + Private Shared Function compareStruct( val1 As Object, val2 As Object) As Boolean + Debug.Assert( Not(val1 Is Nothing) And Not(val2 Is Nothing)) + Dim t1 As Type = val1.GetType() + Dim t2 As Type = val2.GetType() + If Not t1.Equals(t2) + Return False + End If + Dim fields() As FieldInfo = t1.GetFields() + Dim cFields As Integer = fields.Length + Dim ret As Boolean = True + Dim i As Integer + For i = 0 To cFields - 1 + Dim fieldVal1 As Object = fields(i).GetValue(val1) + Dim fieldVal2 As Object = fields(i).GetValue(val2) + If Not compareData(fieldVal1, fieldVal2) + ret = False + Exit For + End If + Next i + Return ret + End Function + + + Private Shared Function performSequenceTest(xBT As XBridgeTest) As Boolean + Dim bRet As Boolean = True + 'Automati cast ?? like with COM objects + Dim xBT2 As XBridgeTest2 + Try + xBT2 = DirectCast(xBT,XBridgeTest2) + Catch e As InvalidCastException + Return False + End Try + + ' perform sequence tests (XBridgeTest2) + 'create the sequence which are compared with the results + Dim arBool() As Boolean = {True, False, True} + Dim arChar() As Char = {"A"C,"B"C,"C"C} + Dim arByte() As Byte = { 1, 2, &Hff} + Dim arShort() As Short = {Int16.MinValue, 1, Int16.MaxValue} + Dim arUShort() As UInt16 = {Convert.ToUInt16(0), Convert.ToUInt16(1), _ + Convert.ToUInt16(&Hffff)} + Dim arLong() As Integer = {Int32.MinValue, 1, Int32.MaxValue} + Dim arULong() As UInt32 = {Convert.ToUInt32(0), Convert.ToUInt32(1), _ + Convert.ToUInt32(&HffffffffL)} + Dim arHyper() As Long = {Int64.MinValue, 1, Int64.MaxValue} + Dim arUHyper() As UInt64 = {Convert.ToUInt64(0), Convert.ToUInt64(1), _ + Convert.ToUInt64(&Hffffffff5L)} + Dim arFloat() As Single = {1.1f, 2.2f, 3.3f} + Dim arDouble() As Double = {1.11, 2.22, 3.33} + Dim arString() As String = {"String 1", "String 2", "String 3"} + + Dim arAny() As Any = {New Any(True), New Any(11111), New Any(3.14)} + Dim arObject() As Object = {New WeakBase(), New WeakBase(), New WeakBase()} + Dim arEnum() As TestEnum = {TestEnum.ONE, TestEnum.TWO, TestEnum.CHECK} + + Dim arStruct() As TestElement = {New TestElement(), New TestElement(), _ + New TestElement()} + assign( arStruct(0), True, "@"C, 17, &H1234, Convert.ToUInt16(&Hfedc), _ + &H12345678, Convert.ToUInt32(&H123456), &H123456789abcdef0, _ + Convert.ToUInt64(123456788), 17.0815F, 3.1415926359, _ + TestEnum.LOLA, CONSTANTS.STRING_TEST_CONSTANT, arObject(0), _ + New Any(GetType(System.Object), arObject(0))) + assign( arStruct(1), True, "A"C, 17, &H1234, Convert.ToUInt16(&Hfedc), _ + &H12345678, Convert.ToUInt32(&H123456), &H123456789abcdef0, _ + Convert.ToUInt64(12345678), 17.0815F, 3.1415926359, _ + TestEnum.TWO, CONSTANTS.STRING_TEST_CONSTANT, arObject(1), _ + New Any(GetType(System.Object), arObject(1)) ) + assign( arStruct(2), True, "B"C, 17, &H1234, Convert.ToUInt16(&Hfedc), _ + &H12345678, Convert.ToUInt32(654321), &H123456789abcdef0, _ + Convert.ToUInt64(87654321), 17.0815F, 3.1415926359, _ + TestEnum.CHECK, Constants.STRING_TEST_CONSTANT, arObject(2), _ + New Any(GetType(System.Object), arObject(2))) + + + Dim arLong3()()() As Integer = New Integer()()() { _ + New Integer()(){New Integer(){1,2,3},New Integer(){4,5,6}, New Integer(){7,8,9} }, _ + New Integer ()(){New Integer(){1,2,3},New Integer(){4,5,6}, New Integer(){7,8,9}}, _ + New Integer()(){New Integer(){1,2,3},New Integer(){4,5,6}, New Integer(){7,8,9}}} + + Dim seqSeqRet()() As Integer = xBT2.setDim2(arLong3(0)) + bRet = check( compareData(seqSeqRet, arLong3(0)), "sequence test") _ + And bRet + Dim seqSeqRet2()()() As Integer = xBT2.setDim3(arLong3) + bRet = check( compareData(seqSeqRet2, arLong3), "sequence test") _ + And bRet + Dim seqAnyRet() As Any = xBT2.setSequenceAny(arAny) + bRet = check( compareData(seqAnyRet, arAny), "sequence test") And bRet + Dim seqBoolRet() As Boolean = xBT2.setSequenceBool(arBool) + bRet = check( compareData(seqBoolRet, arBool), "sequence test") _ + And bRet + Dim seqByteRet() As Byte = xBT2.setSequenceByte(arByte) + bRet = check( compareData(seqByteRet, arByte), "sequence test") _ + And bRet + Dim seqCharRet() As Char = xBT2.setSequenceChar(arChar) + bRet = check( compareData(seqCharRet, arChar), "sequence test") _ + And bRet + Dim seqShortRet() As Short = xBT2.setSequenceShort(arShort) + bRet = check( compareData(seqShortRet, arShort), "sequence test") _ + And bRet + Dim seqLongRet() As Integer = xBT2.setSequenceLong(arLong) + bRet = check( compareData(seqLongRet, arLong), "sequence test") _ + And bRet + Dim seqHyperRet() As Long = xBT2.setSequenceHyper(arHyper) + bRet = check( compareData(seqHyperRet,arHyper), "sequence test") _ + And bRet + Dim seqFloatRet() As Single = xBT2.setSequenceFloat(arFloat) + bRet = check( compareData(seqFloatRet, arFloat), "sequence test") _ + And bRet + Dim seqDoubleRet() As Double= xBT2.setSequenceDouble(arDouble) + bRet = check( compareData(seqDoubleRet, arDouble), "sequence test") _ + And bRet + Dim seqEnumRet() As TestEnum = xBT2.setSequenceEnum(arEnum) + bRet = check( compareData(seqEnumRet, arEnum), "sequence test") _ + And bRet + Dim seqUShortRet() As UInt16 = xBT2.setSequenceUShort(arUShort) + bRet = check( compareData(seqUShortRet, arUShort), "sequence test") _ + And bRet + Dim seqULongRet() As UInt32 = xBT2.setSequenceULong(arULong) + bRet = check( compareData(seqULongRet, arULong), "sequence test") _ + And bRet + Dim seqUHyperRet() As UInt64 = xBT2.setSequenceUHyper(arUHyper) + bRet = check( compareData(seqUHyperRet, arUHyper), "sequence test") _ + And bRet + Dim seqObjectRet() As Object = xBT2.setSequenceXInterface(arObject) + bRet = check( compareData(seqObjectRet, arObject), "sequence test") _ + And bRet + Dim seqStringRet() As String = xBT2.setSequenceString(arString) + bRet = check( compareData(seqStringRet, arString), "sequence test") _ + And bRet + Dim seqStructRet() As TestElement = xBT2.setSequenceStruct(arStruct) + bRet = check( compareData(seqStructRet, arStruct), "sequence test") _ + And bRet + + + Dim arBoolTemp() As Boolean = DirectCast(arBool.Clone(), Boolean()) + Dim arCharTemp() As Char = DirectCast(arChar.Clone(), Char()) + Dim arByteTemp() As Byte = DirectCast(arByte.Clone(), Byte()) + Dim arShortTemp() As Short = DirectCast(arShort.Clone(), Short()) + Dim arUShortTemp() As UInt16 = DirectCast(arUShort.Clone(), UInt16()) + Dim arLongTemp() As Integer= DirectCast(arLong.Clone(), Integer()) + Dim arULongTemp() As UInt32 = DirectCast(arULong.Clone(), UInt32()) + Dim arHyperTemp() As Long = DirectCast(arHyper.Clone(), Long()) + Dim arUHyperTemp() As UInt64 = DirectCast(arUHyper.Clone(), UInt64()) + Dim arFloatTemp() As Single = DirectCast(arFloat.Clone(), Single()) + Dim arDoubleTemp() As Double = DirectCast(arDouble.Clone(), Double()) + Dim arEnumTemp() As TestEnum = DirectCast(arEnum.Clone(), TestEnum()) + Dim arStringTemp() As String = DirectCast(arString.Clone(), String()) + Dim arObjectTemp() As Object = DirectCast(arObject.Clone(), Object()) + Dim arAnyTemp() As Any = DirectCast(arAny.Clone(), Any()) + ' make sure this are has the same contents as arLong3(0) + Dim arLong2Temp()() As Integer = New Integer()(){New Integer(){1,2,3}, _ + New Integer(){4,5,6}, New Integer(){7,8,9} } + ' make sure this are has the same contents as arLong3 + Dim arLong3Temp()()() As Integer = New Integer()()(){ _ + New Integer()(){New Integer(){1,2,3},New Integer(){4,5,6}, New Integer(){7,8,9} }, _ + New Integer ()(){New Integer(){1,2,3},New Integer(){4,5,6}, New Integer(){7,8,9}}, _ + New Integer()(){New Integer(){1,2,3},New Integer(){4,5,6}, New Integer(){7,8,9}}} + + xBT2.setSequencesInOut( arBoolTemp, arCharTemp, arByteTemp, _ + arShortTemp, arUShortTemp, arLongTemp, _ + arULongTemp, arHyperTemp, arUHyperTemp, _ + arFloatTemp, arDoubleTemp, arEnumTemp, _ + arStringTemp, arObjectTemp, _ + arAnyTemp, arLong2Temp, arLong3Temp) + bRet = check( _ + compareData(arBoolTemp, arBool) And _ + compareData(arCharTemp , arChar) And _ + compareData(arByteTemp , arByte) And _ + compareData(arShortTemp , arShort) And _ + compareData(arUShortTemp , arUShort) And _ + compareData(arLongTemp , arLong) And _ + compareData(arULongTemp , arULong) And _ + compareData(arHyperTemp , arHyper) And _ + compareData(arUHyperTemp , arUHyper) And _ + compareData(arFloatTemp , arFloat) And _ + compareData(arDoubleTemp , arDouble) And _ + compareData(arEnumTemp , arEnum) And _ + compareData(arStringTemp , arString) And _ + compareData(arObjectTemp , arObject) And _ + compareData(arAnyTemp , arAny) And _ + compareData(arLong2Temp , arLong3(0)) And _ + compareData(arLong3Temp , arLong3), "sequence test") And bRet + + Dim arBoolOut() As Boolean + Dim arCharOut() As Char + Dim arByteOut() As Byte + Dim arShortOut() As Short + Dim arUShortOut() As UInt16 + Dim arLongOut() As Integer + Dim arULongOut() As UInt32 + Dim arHyperOut() As Long + Dim arUHyperOut() As UInt64 + Dim arFloatOut() As Single + Dim arDoubleOut() As Double + Dim arEnumOut() As TestEnum + Dim arStringOut() As String + Dim arObjectOut() As Object + Dim arAnyOut() As Any + Dim arLong2Out()() As Integer + Dim arLong3Out()()() As Integer + + xBT2.setSequencesOut( arBoolOut, arCharOut, arByteOut, _ + arShortOut, arUShortOut, arLongOut, _ + arULongOut, arHyperOut, arUHyperOut, _ + arFloatOut, arDoubleOut, arEnumOut, _ + arStringOut, arObjectOut, arAnyOut, _ + arLong2Out, arLong3Out) + bRet = check( _ + compareData(arBoolOut, arBool) And _ + compareData(arCharOut, arChar) And _ + compareData(arByteOut, arByte) And _ + compareData(arShortOut, arShort) And _ + compareData(arUShortOut, arUShort) And _ + compareData(arLongOut, arLong) And _ + compareData(arULongOut, arULong) And _ + compareData(arHyperOut, arHyper) And _ + compareData(arUHyperOut, arUHyper) And _ + compareData(arFloatOut, arFloat) And _ + compareData(arDoubleOut, arDouble) And _ + compareData(arEnumOut, arEnum) And _ + compareData(arStringOut, arString) And _ + compareData(arObjectOut, arObject) And _ + compareData(arAnyOut, arAny) And _ + compareData(arLong2Out, arLong3(0)) And _ + compareData(arLong3Out, arLong3), "sequence test") And bRet + + + 'test with empty sequences + Dim _arLong2()() As Integer = New Integer()(){} + seqSeqRet = xBT2.setDim2(_arLong2) + bRet = check( compareData(seqSeqRet, _arLong2), "sequence test") And bRet + Dim _arLong3()()() As Integer = New Integer()()(){} + seqSeqRet2 = xBT2.setDim3(_arLong3) + bRet = check( compareData(seqSeqRet2, _arLong3), "sequence test") And bRet + Dim _arAny() As Any = New Any(){} + seqAnyRet = xBT2.setSequenceAny(_arAny) + bRet = check( compareData(seqAnyRet, _arAny), "sequence test") And bRet + Dim _arBool() As Boolean = New Boolean() {} + seqBoolRet = xBT2.setSequenceBool(_arBool) + bRet = check( compareData(seqBoolRet, _arBool), "sequence test") And bRet + Dim _arByte() As Byte = New Byte() {} + seqByteRet = xBT2.setSequenceByte(_arByte) + bRet = check( compareData(seqByteRet, _arByte), "sequence test") And bRet + Dim _arChar() As Char = New Char() {} + seqCharRet = xBT2.setSequenceChar(_arChar) + bRet = check( compareData(seqCharRet, _arChar), "sequence test") And bRet + Dim _arShort() As Short = New Short() {} + seqShortRet = xBT2.setSequenceShort(_arShort) + bRet = check( compareData(seqShortRet, _arShort), "sequence test") And bRet + Dim _arLong() As Integer = New Integer() {} + seqLongRet = xBT2.setSequenceLong(_arLong) + bRet = check( compareData(seqLongRet, _arLong), "sequence test") And bRet + Dim _arHyper() As Long = New Long(){} + seqHyperRet = xBT2.setSequenceHyper(_arHyper) + bRet = check( compareData(seqHyperRet, _arHyper), "sequence test") And bRet + Dim _arFloat() As Single = New Single(){} + seqFloatRet = xBT2.setSequenceFloat(_arFloat) + bRet = check( compareData(seqFloatRet, _arFloat), "sequence test") And bRet + Dim _arDouble() As Double = New Double(){} + seqDoubleRet = xBT2.setSequenceDouble(_arDouble) + bRet = check( compareData(seqDoubleRet, _arDouble), "sequence test") And bRet + Dim _arEnum() As TestEnum = New TestEnum(){} + seqEnumRet = xBT2.setSequenceEnum(_arEnum) + bRet = check( compareData(seqEnumRet, _arEnum), "sequence test") And bRet + Dim _arUShort() As UInt16 = New UInt16(){} + seqUShortRet = xBT2.setSequenceUShort(_arUShort) + bRet = check( compareData(seqUShortRet, _arUShort), "sequence test") And bRet + Dim _arULong() As UInt32 = New UInt32(){} + seqULongRet = xBT2.setSequenceULong(_arULong) + bRet = check( compareData(seqULongRet, _arULong), "sequence test") And bRet + Dim _arUHyper() As UInt64 = New UInt64(){} + seqUHyperRet = xBT2.setSequenceUHyper(_arUHyper) + bRet = check( compareData(seqUHyperRet, _arUHyper), "sequence test") And bRet + Dim _arObject() As Object = New Object(){} + seqObjectRet = xBT2.setSequenceXInterface(_arObject) + bRet = check( compareData(seqObjectRet, _arObject), "sequence test") And bRet + Dim _arString() As String = New String(){} + seqStringRet = xBT2.setSequenceString(_arString) + bRet = check( compareData(seqStringRet, _arString), "sequence test") And bRet + Dim _arStruct() As TestElement = New TestElement(){} + seqStructRet = xBT2.setSequenceStruct(_arStruct) + bRet = check( compareData(seqStructRet, _arStruct), "sequence test") And bRet + Return bRet + End Function + + Private Shared Function testAny(typ As Type, value As Object, _ + xLBT As XBridgeTest ) As Boolean + + Dim any As Any + If (typ Is Nothing) + any = New Any(value.GetType(), value) + Else + any = New Any(typ, value) + End If + + Dim any2 As Any = xLBT.transportAny(any) + Dim ret As Boolean = compareData(any, any2) + If ret = False + Console.WriteLine("any is different after roundtrip: in {0}, " _ + & "out {1}\n", _ + any.Type.FullName, any2.Type.FullName) + End If + Return ret + End Function + + Private Shared Function performAnyTest(xLBT As XBridgeTest, _ + data As TestDataElements) As Boolean + Dim bReturn As Boolean = True + bReturn = testAny( Nothing, data.Byte ,xLBT ) And bReturn + bReturn = testAny( Nothing, data.Short,xLBT ) And bReturn + bReturn = testAny( Nothing, data.UShort,xLBT ) And bReturn + bReturn = testAny( Nothing, data.Long,xLBT ) And bReturn + bReturn = testAny( Nothing, data.ULong,xLBT ) And bReturn + bReturn = testAny( Nothing, data.Hyper,xLBT ) And bReturn + bReturn = testAny( Nothing,data.UHyper,xLBT ) And bReturn + bReturn = testAny( Nothing, data.Float,xLBT ) And bReturn + bReturn = testAny( Nothing, data.Double,xLBT ) And bReturn + bReturn = testAny( Nothing, data.Enum,xLBT ) And bReturn + bReturn = testAny( Nothing, data.String,xLBT ) And bReturn + bReturn = testAny(GetType(unoidl.com.sun.star.uno.XWeak), _ + data.Interface,xLBT ) And bReturn + bReturn = testAny(Nothing, data, xLBT ) And bReturn + + Dim a1 As Any = New Any(True) + Dim a2 As Any = xLBT.transportAny( a1 ) + bReturn = compareData(a2, a1) And bReturn + + Dim a3 As Any = New Any("A"C) + Dim a4 As Any = xLBT.transportAny(a3) + bReturn = compareData(a4, a3) And bReturn + + Return bReturn + End Function + + Private Shared Function performSequenceOfCallTest(xLBT As XBridgeTest) As Boolean + + Dim i, nRounds As Integer + Dim nGlobalIndex As Integer = 0 + const nWaitTimeSpanMUSec As Integer = 10000 + For nRounds = 0 To 9 + For i = 0 To nRounds - 1 + ' fire oneways + xLBT.callOneway(nGlobalIndex, nWaitTimeSpanMUSec) + nGlobalIndex = nGlobalIndex + 1 + Next + + ' call synchron + xLBT.call(nGlobalIndex, nWaitTimeSpanMUSec) + nGlobalIndex = nGlobalIndex + 1 + Next + Return xLBT.sequenceOfCallTestPassed() + End Function + + Private Shared Function performRecursiveCallTest(xLBT As XBridgeTest) As Boolean + xLBT.startRecursiveCall(new ORecursiveCall(), 50) + ' on failure, the test would lock up or crash + Return True + End Function + + + Private Shared Function performTest(xLBT As XBridgeTest) As Boolean + check( Not xLBT Is Nothing, "### no test interface!" ) + Dim bRet As Boolean = True + If xLBT Is Nothing + Return False + End If + 'this data is never ever granted access to by calls other than equals(), assign()! + Dim aData As New TestDataElements' test against this data + Dim xI As New WeakBase + + Dim aAny As New Any(GetType(System.Object), xI) + assign( DirectCast(aData, TestElement), _ + True, "@"C, 17, &H1234, Convert.ToUInt16(&HdcS), &H12345678, _ + Convert.ToUInt32(4294967294), _ + &H123456789abcdef0, Convert.ToUInt64(14294967294), _ + 17.0815f, 3.1415926359, TestEnum.LOLA, _ + CONSTANTS.STRING_TEST_CONSTANT, xI, _ + aAny) + + bRet = check( aData.Any.Value Is xI, "### unexpected any!" ) And bRet + + aData.Sequence = New TestElement(1){} + aData.Sequence(0) = New TestElement( _ + aData.Bool, aData.Char, aData.Byte, aData.Short, _ + aData.UShort, aData.Long, aData.ULong, _ + aData.Hyper, aData.UHyper, aData.Float, _ + aData.Double, aData.Enum, aData.String, _ + aData.Interface, aData.Any) + aData.Sequence(1) = New TestElement 'is empty + + ' aData complete + ' + ' this is a manually copy of aData for first setting... + Dim aSetData As New TestDataElements + Dim aAnySet As New Any(GetType(System.Object), xI) + assign( DirectCast(aSetData, TestElement), _ + aData.Bool, aData.Char, aData.Byte, aData.Short, aData.UShort, _ + aData.Long, aData.ULong, aData.Hyper, aData.UHyper, aData.Float, _ + aData.Double, aData.Enum, aData.String, xI, aAnySet) + + aSetData.Sequence = New TestElement(1){} + aSetData.Sequence(0) = New TestElement( _ + aSetData.Bool, aSetData.Char, aSetData.Byte, aSetData.Short, _ + aSetData.UShort, aSetData.Long, aSetData.ULong, _ + aSetData.Hyper, aSetData.UHyper, aSetData.Float, _ + aSetData.Double, aSetData.Enum, aSetData.String, _ + aSetData.Interface, aSetData.Any) + aSetData.Sequence(1) = New TestElement ' empty struct + + xLBT.setValues( _ + aSetData.Bool, aSetData.Char, aSetData.Byte, aSetData.Short, _ + aSetData.UShort, aSetData.Long, aSetData.ULong, _ + aSetData.Hyper, aSetData.UHyper, aSetData.Float, _ + aSetData.Double, aSetData.Enum, aSetData.String, _ + aSetData.Interface, aSetData.Any, aSetData.Sequence, _ + aSetData ) + + + Dim aRet As New TestDataElements + Dim aRet2 As New TestDataElements + xLBT.getValues( _ + aRet.Bool, aRet.Char, aRet.Byte, aRet.Short, _ + aRet.UShort, aRet.Long, aRet.ULong, _ + aRet.Hyper, aRet.UHyper, aRet.Float, _ + aRet.Double, aRet.Enum, aRet.String, _ + aRet.Interface, aRet.Any, aRet.Sequence, _ + aRet2 ) + + bRet = check( compareData( aData, aRet ) And _ + compareData( aData, aRet2 ) , "getValues test") And bRet + + ' set last retrieved values + Dim aSV2ret As TestDataElements= xLBT.setValues2( _ + aRet.Bool, aRet.Char, aRet.Byte, _ + aRet.Short, aRet.UShort, aRet.Long, _ + aRet.ULong, aRet.Hyper, aRet.UHyper, _ + aRet.Float, aRet.Double, aRet.Enum, _ + aRet.String, aRet.Interface, aRet.Any, _ + aRet.Sequence, aRet2 ) + + ' check inout sequence order + ' => inout sequence parameter was switched by test objects + Dim temp As TestElement = aRet.Sequence( 0 ) + aRet.Sequence( 0 ) = aRet.Sequence( 1 ) + aRet.Sequence( 1 ) = temp + + bRet = check( _ + compareData( aData, aSV2ret ) And compareData( aData, aRet2 ), _ + "getValues2 test") And bRet + + + aRet = New TestDataElements + aRet2 = New TestDataElements + Dim aGVret As TestDataElements= xLBT.getValues( _ + aRet.Bool, aRet.Char, aRet.Byte, _ + aRet.Short, aRet.UShort, aRet.Long, _ + aRet.ULong, aRet.Hyper, aRet.UHyper, _ + aRet.Float, aRet.Double, aRet.Enum, _ + aRet.String, aRet.Interface, aRet.Any, _ + aRet.Sequence, aRet2 ) + + bRet = check( compareData( aData, aRet ) And _ + compareData( aData, aRet2 ) And _ + compareData( aData, aGVret ), "getValues test" ) And bRet + + ' set last retrieved values + xLBT.Bool = aRet.Bool + xLBT.Char = aRet.Char + xLBT.Byte = aRet.Byte + xLBT.Short = aRet.Short + xLBT.UShort = aRet.UShort + xLBT.Long = aRet.Long + xLBT.ULong = aRet.ULong + xLBT.Hyper = aRet.Hyper + xLBT.UHyper = aRet.UHyper + xLBT.Float = aRet.Float + xLBT.Double = aRet.Double + xLBT.Enum = aRet.Enum + xLBT.String = aRet.String + xLBT.Interface = aRet.Interface + xLBT.Any = aRet.Any + xLBT.Sequence = aRet.Sequence + xLBT.Struct = aRet2 + + + aRet = New TestDataElements + aRet2 = New TestDataElements + aRet.Hyper = xLBT.Hyper + aRet.UHyper = xLBT.UHyper + aRet.Float = xLBT.Float + aRet.Double = xLBT.Double + aRet.Byte = xLBT.Byte + aRet.Char = xLBT.Char + aRet.Bool = xLBT.Bool + aRet.Short = xLBT.Short + aRet.UShort = xLBT.UShort + aRet.Long = xLBT.Long + aRet.ULong = xLBT.ULong + aRet.Enum = xLBT.Enum + aRet.String = xLBT.String + aRet.Interface = xLBT.Interface + aRet.Any = xLBT.Any + aRet.Sequence = xLBT.Sequence + aRet2 = xLBT.Struct + + bRet = check( compareData( aData, aRet ) And _ + compareData( aData, aRet2 ) , "struct comparison test") _ + And bRet + + bRet = check(performSequenceTest(xLBT), "sequence test") And bRet + + ' any test + bRet = check( performAnyTest( xLBT , aData ) , "any test" ) And bRet + + 'sequence of call test + bRet = check( performSequenceOfCallTest( xLBT ) , _ + "sequence of call test" ) And bRet + + ' recursive call test + bRet = check( performRecursiveCallTest( xLBT ) , "recursive test" ) _ + And bRet + + bRet = (compareData( aData, aRet ) And compareData( aData, aRet2 )) _ + And bRet + + ' check setting of null reference + xLBT.Interface = Nothing + aRet.Interface = xLBT.Interface + bRet = (aRet.Interface Is Nothing) And bRet + + Return bRet + End Function + + Private Shared Function raiseException(xLBT As XBridgeTest) As Boolean + Dim nCount As Integer = 0 + Try + Try + Try + Dim aRet As TestDataElements = New TestDataElements + Dim aRet2 As TestDataElements = New TestDataElements + xLBT.raiseException( _ + 5, CONSTANTS.STRING_TEST_CONSTANT, xLBT.Interface ) + Catch rExc As unoidl.com.sun.star.lang.IllegalArgumentException + If rExc.ArgumentPosition = 5 And _ + rExc.Context Is xLBT.Interface + nCount = nCount + 1 + Else + check( False, "### unexpected exception content!" ) + End If + + 'it is certain, that the RuntimeException testing will fail, + ' if no + xLBT.RuntimeException = 0 + End Try + Catch rExc As unoidl.com.sun.star.uno.RuntimeException + If rExc.Context Is xLBT.Interface + nCount = nCount + 1 + Else + check( False, "### unexpected exception content!" ) + End If + xLBT.RuntimeException = CType(&Hcafebabe, Integer) + End Try + Catch rExc As unoidl.com.sun.star.uno.Exception + If rExc.Context Is xLBT.Interface + nCount = nCount + 1 + Else + check( False, "### unexpected exception content!" ) + End If + Return nCount = 3 + End Try + Return False + End Function + + Private Shared Function raiseOnewayException(xLBT As XBridgeTest) As Boolean + Dim bReturn As Boolean= True + Dim sCompare As String = CONSTANTS.STRING_TEST_CONSTANT + Try + ' Note : the exception may fly or not (e.g. remote scenario). + ' When it flies, it must contain the correct elements. + xLBT.raiseRuntimeExceptionOneway(sCompare, xLBT.Interface ) + Catch e As RuntimeException + bReturn = xLBT.Interface Is e.Context + End Try + Return bReturn + End Function + + 'Test the System::Object method on the proxy object + ' + Private Shared Function testObjectMethodsImplemention(xLBT As XBridgeTest) As Boolean + Dim ret As Boolean = False + Dim obj As Object = New Object + Dim xInt As Object = DirectCast(xLBT, Object) + Dim xBase As XBridgeTestBase = DirectCast(xLBT, XBridgeTestBase) + ' Object.Equals + ret = DirectCast(xLBT, Object).Equals(obj) = False + ret = DirectCast(xLBT, Object).Equals(xLBT) And ret + ret = Object.Equals(obj, obj) And ret + ret = Object.Equals(xLBT, xBase) And ret + 'Object.GetHashCode + ' Don't know how to verify this. Currently it is not possible to get the object id from a proxy + Dim nHash As Integer = DirectCast(xLBT, Object).GetHashCode() + ret = nHash = DirectCast(xBase, Object).GetHashCode() And ret + + 'Object.ToString + ' Don't know how to verify this automatically. + Dim s As String = DirectCast(xLBT, Object).ToString() + ret = (s.Length > 0) And ret + Return ret + End Function + + Private Shared Function performQueryForUnknownType(xLBT As XBridgeTest) As Boolean + Dim bRet As Boolean = False + ' test queryInterface for an unknown type + Try + Dim a As foo.MyInterface = DirectCast(xLBT, foo.MyInterface) + Catch e As System.InvalidCastException + bRet = True + End Try + + Return bRet + End Function + + + Private Shared Sub perform_test( xLBT As XBridgeTest) + Dim bRet As Boolean = True + bRet = check( performTest( xLBT ), "standard test" ) And bRet + bRet = check( raiseException( xLBT ) , "exception test" ) And bRet + bRet = check( raiseOnewayException( xLBT ), "oneway exception test" ) _ + And bRet + bRet = check( testObjectMethodsImplemention(xLBT), _ + "object methods test") And bRet + bRet = performQueryForUnknownType( xLBT ) And bRet + If Not bRet + Throw New unoidl.com.sun.star.uno.RuntimeException( "error: test failed!", Nothing) + End If + End Sub + + + + Public Overridable Function run(args() As String) As Integer _ + Implements XMain.run + Try + If (args.Length < 1) + Throw New RuntimeException( _ + "missing argument for bridgetest!", Me ) + End If + + Dim test_obj As Object = _ + m_xContext.getServiceManager().createInstanceWithContext( _ + args( 0 ), m_xContext ) + + Debug.WriteLine( _ + "cli target bridgetest obj: {0}", test_obj.ToString() ) + Dim xTest As XBridgeTest = DirectCast(test_obj, XBridgeTest) + perform_test( xTest ) + Console.WriteLine("### cli_uno VB bridgetest succeeded.") + return 0 + Catch e as unoidl.com.sun.star.uno.RuntimeException + Throw + Catch e as System.Exception + Throw New unoidl.com.sun.star.uno.RuntimeException( _ + "cli_vb_bridgetest.vb: unexpected exception occurred in XMain::run. " _ + & "Original exception: " + e.GetType().Name + "\n Message: " _ + & e.Message , Nothing) + + End Try + End Function + +End Class + +End Namespace diff --git a/testtools/source/bridgetest/cli/cli_vb_testobj.vb b/testtools/source/bridgetest/cli/cli_vb_testobj.vb new file mode 100644 index 000000000..d90b94e4a --- /dev/null +++ b/testtools/source/bridgetest/cli/cli_vb_testobj.vb @@ -0,0 +1,615 @@ +' +' 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 . +' + +Option Explicit On +Option Strict On + +imports System +imports uno +imports uno.util +imports unoidl.com.sun.star.lang +imports unoidl.com.sun.star.uno +imports unoidl.com.sun.star.test.bridge +imports System.Windows.Forms +imports System.Diagnostics +imports System.Reflection + + +Namespace vb_testobj +Public Class VBBridgeTestObject + Inherits WeakBase + Implements XRecursiveCall, XBridgeTest2 + + Private m_xContext As XComponentContext + + Public Sub New (xContext As XComponentContext) + MyBase.New + m_xContext = xContext + End Sub + + Private m_bool As Boolean + Private m_char As Char + Private m_byte As Byte + Private m_short As Short + Private m_ushort As UInt16 + Private m_long As Integer + Private m_ulong As UInt32 + Private m_hyper As Long + Private m_uhyper As UInt64 + Private m_float As Single + Private m_double As Double + Private m_string As String + Private m_xInterface As Object + Private m_any As Any + Private m_testEnum As TestEnum = TestEnum.TEST + Private m_testElements() As TestElement = New TestElement(){} + Private m_testDataElements As TestDataElements = New TestDataElements + Private m_nLastCallId As Integer = 0 + Private m_bFirstCall As Boolean = True + Private m_bSequenceOfCallTestPassed As Boolean = True + + Private m_arBool() As Boolean + Private m_arChar() As Char + Private m_arByte() As Byte + Private m_arShort() As Short + Private m_arLong() As Integer + Private m_arHyper() As Long + Private m_arUShort() As UInt16 + Private m_arULong() As UInt32 + Private m_arUHyper() As UInt64 + Private m_arString() As String + Private m_arFloat() As Single + Private m_arDouble() As Double + Private m_arEnum() As TestEnum + Private m_arObject() As Object + Private m_arLong2()() As Integer + Private m_arLong3()()() As Integer + Private m_arAny() As Any + + Public Overridable Sub setValues( _ + bBool As Boolean, aChar As Char, nByte As Byte, nShort As Short, _ + nUShort As UInt16, nLong As Integer, nULong As UInt32, _ + nHyper As Long, nUHyper As UInt64, fFloat As Single, _ + fDouble As Double, testEnum As TestEnum, str As String, _ + xInterface As Object, any As Any, testElements() As TestElement, _ + testDataElements As TestDataElements) _ + Implements XBridgeTest2.setValues +#if DEBUG + ' Console.WriteLine( "##### " + GetType().FullName + ".setValues:" + any ) +#endif + m_bool = bBool + m_char = aChar + m_byte = nByte + m_short = nShort + m_ushort = nUShort + m_long = nLong + m_ulong = nULong + m_hyper = nHyper + m_uhyper = nUHyper + m_float = fFloat + m_double = fDouble + m_testEnum = testEnum + m_string = str + m_xInterface = xInterface + m_any = any + m_testElements = testElements + m_testDataElements = testDataElements + End Sub + + Public Overridable Function setValues2( _ + ByRef io_bool As Boolean, ByRef io_char As Char, _ + ByRef io_byte As Byte, ByRef io_short As Short, _ + ByRef io_ushort As UInt16, ByRef io_long As Integer, _ + ByRef io_ulong As UInt32, ByRef io_hyper As Long, _ + ByRef io_uhyper As UInt64, ByRef io_float As Single, _ + ByRef io_double As Double, ByRef io_testEnum As TestEnum, _ + ByRef io_string As String, ByRef io_xInterface As Object, _ + ByRef io_any As Any, ByRef io_testElements() As TestElement, _ + ByRef io_testDataElements As TestDataElements) As TestDataElements _ + Implements XBridgeTest2.setValues2 + +#if DEBUG + 'Console.WriteLine( "##### " + GetType().FullName + ".setValues2:" + io_any ) +#endif + + m_bool = io_bool + m_char = io_char + m_byte = io_byte + m_short = io_short + m_ushort = io_ushort + m_long = io_long + m_ulong = io_ulong + m_hyper = io_hyper + m_uhyper = io_uhyper + m_float = io_float + m_double = io_double + m_testEnum = io_testEnum + m_string = io_string + m_xInterface = io_xInterface + m_any = io_any + m_testElements = DirectCast(io_testElements.Clone(), TestElement()) + m_testDataElements = io_testDataElements + + Dim temp As TestElement = io_testElements(0) + io_testElements(0) = io_testElements(1) + io_testElements(1) = temp + + Return m_testDataElements + End Function + + Public Overridable Function getValues( _ + ByRef o_bool As Boolean, ByRef o_char As Char, _ + ByRef o_byte As Byte, ByRef o_short As Short, _ + ByRef o_ushort As UInt16, ByRef o_long As Integer, _ + ByRef o_ulong As UInt32, ByRef o_hyper As Long, _ + ByRef o_uhyper As UInt64, ByRef o_float As Single, _ + ByRef o_double As Double, ByRef o_testEnum As TestEnum, _ + ByRef o_string As String, ByRef o_xInterface As Object, _ + ByRef o_any As Any, ByRef o_testElements() As TestElement, _ + ByRef o_testDataElements As TestDataElements) As TestDataElements _ + Implements XBridgeTest2.getValues +#if DEBUG + 'Console.WriteLine( "##### " + GetType().FullName + ".getValues" ) +#endif + + o_bool = m_bool + o_char = m_char + o_byte = m_byte + o_short = m_short + o_ushort = m_ushort + o_long = m_long + o_ulong = m_ulong + o_hyper = m_hyper + o_uhyper = m_uhyper + o_float = m_float + o_double = m_double + o_testEnum = m_testEnum + o_string = m_string + o_xInterface = m_xInterface + o_any = m_any + o_testElements = m_testElements + o_testDataElements = m_testDataElements + + Return m_testDataElements + End Function + + ' Attributes --------------------------------------------------------- + Public Overridable Property Bool As Boolean _ + Implements XBridgeTest2.Bool + Get + Return m_bool + End Get + Set (Value As Boolean) + m_bool = value + End Set + End Property + + Public Overridable Property [Byte] As Byte _ + Implements XBridgeTest2.Byte + Get + Return m_byte + End Get + Set (Value As Byte) + m_byte = value + End Set + End Property + + Public Overridable Property [Char] As Char _ + Implements XBridgeTest2.Char + Get + Return m_char + End Get + Set (Value As Char) + m_char = value + End Set + End Property + + Public Overridable Property [Short] As Short _ + Implements XBridgeTest2.Short + Get + Return m_short + End Get + Set (Value As Short) + m_short = value + End Set + End Property + + Public Overridable Property [UShort] As UInt16 _ + Implements XBridgeTest2.UShort + Get + Return m_ushort + End Get + Set (Value As UInt16) + m_ushort = value + End Set + End Property + + Public Overridable Property [Long] As Integer _ + Implements XBridgeTest2.Long + Get + Return m_long + End Get + Set (Value As Integer) + m_long = value + End Set + End Property + + Public Overridable Property [ULong]() As UInt32 _ + Implements XBridgeTest2.ULong + Get + Return m_ulong + End Get + Set (Value As UInt32) + m_ulong = value + End Set + End Property + + Public Overridable Property Hyper As Long _ + Implements XBridgeTest2.Hyper + Get + Return m_hyper + End Get + Set (Value As Long) + m_hyper = value + End Set + End Property + + Public Overridable Property UHyper As UInt64 _ + Implements XBridgeTest2.UHyper + Get + Return m_uhyper + End Get + Set (Value As UInt64) + m_uhyper = value + End Set + End Property + + Public Overridable Property Float As Single _ + Implements XBridgeTest2.Float + Get + Return m_float + End Get + Set (Value As Single) + m_float = value + End Set + End Property + + Public Overridable Property [Double] As Double _ + Implements XBridgeTest2.Double + Get + Return m_double + End Get + Set (Value As Double) + m_double = value + End Set + End Property + + Public Overridable Property [Enum] As TestEnum _ + Implements XBridgeTest2.Enum + Get + Return m_testEnum + End Get + Set (Value As TestEnum) + m_testEnum = value + End Set + End Property + + Public Overridable Property [String] As String _ + Implements XBridgeTest2.String + Get + Return m_string + End Get + Set (Value As String) + m_string = value + End Set + End Property + + Public Overridable Property [Interface] As Object _ + Implements XBridgeTest2.Interface + Get + Return m_xInterface + End Get + Set (Value As Object) + m_xInterface = value + End Set + End Property + + Public Overridable Property Any As uno.Any _ + Implements XBridgeTest2.Any + Get +#if DEBUG +' Console.WriteLine( "##### " + GetType().FullName + ".Any" ) +#endif + Return m_any + End Get + Set (Value As Any) +#if DEBUG + 'Console.WriteLine( "##### " + GetType().FullName + ".Any:" + value ) +#endif + m_any = value + End Set + End Property + + Public Overridable Property Sequence As TestElement() _ + Implements XBridgeTest2.Sequence + Get + Return m_testElements + End Get + Set (Value() As TestElement) + m_testElements = value + End Set + End Property + + Public Overridable Property Struct As TestDataElements _ + Implements XBridgeTest2.Struct + Get + Return m_testDataElements + End Get + Set (Value As TestDataElements) + m_testDataElements = value + End Set + End Property + + Public Overridable Function transportAny(value As Any) As Any _ + Implements XBridgeTest2.transportAny + Return value + End Function + + Public Overridable Sub [call](nCallId As Integer, nWaitMUSEC As Integer) _ + Implements XBridgeTest2.call + + Threading.Thread.Sleep(CType(nWaitMUSEC / 10000, Integer)) + If m_bFirstCall = True + m_bFirstCall = False + Else + m_bSequenceOfCallTestPassed = m_bSequenceOfCallTestPassed And (nCallId > m_nLastCallId) + End If + m_nLastCallId = nCallId + End Sub + + Public Overridable Sub callOneway(nCallId As Integer, nWaitMUSEC As Integer) _ + Implements XBridgeTest2.callOneway + + Threading.Thread.Sleep(CType(nWaitMUSEC / 10000, Integer)) + m_bSequenceOfCallTestPassed = m_bSequenceOfCallTestPassed And (nCallId > m_nLastCallId) + m_nLastCallId = nCallId + End Sub + + Public Overridable Function sequenceOfCallTestPassed() As Boolean _ + Implements XBridgeTest2.sequenceOfCallTestPassed + Return m_bSequenceOfCallTestPassed + End Function + + Public Overridable Sub callRecursivly(xCall As XRecursiveCall, nToCall As Integer) _ + Implements XRecursiveCall.callRecursivly + SyncLock (Me) + If nToCall <> 0 + nToCall = nToCall - 1 + xCall.callRecursivly(Me , nToCall) + End If + End SyncLock + End Sub + + Public Overridable Sub startRecursiveCall(xCall As XRecursiveCall, nToCall As Integer) _ + Implements XBridgeTest2.startRecursiveCall + SyncLock (Me) + If nToCall <> 0 + nToCall = nToCall - 1 + xCall.callRecursivly(Me , nToCall ) + End If + End SyncLock + End Sub + + ' XBridgeTest + Public Overridable Function raiseException( _ + nArgumentPos As Short, rMsg As String, xContext As Object) As TestDataElements _ + Implements XBridgeTest2.raiseException + Throw New IllegalArgumentException(rMsg, xContext, nArgumentPos) + End Function + + Public Overridable Sub raiseRuntimeExceptionOneway(rMsg As String , xContext As Object) _ + Implements XBridgeTest2.raiseRuntimeExceptionOneway + Throw New RuntimeException(rMsg, xContext) + End Sub + + Public Overridable Property RuntimeException As Integer _ + Implements XBridgeTest2.RuntimeException + Get + Throw New RuntimeException(m_string, m_xInterface) + End Get + Set (Value As Integer) + Throw New RuntimeException(m_string, m_xInterface) + End Set + End Property + + ' XBridgeTest2 + Public Overridable Function setDim2(val()() As Integer) As Integer()() _ + Implements XBridgeTest2.setDim2 + m_arLong2 = val + Return val + End Function + + Public Overridable Function setDim3(val()()() As Integer) As Integer()()() _ + Implements XBridgeTest2.setDim3 + m_arLong3 = val + Return val + End Function + + Public Overridable Function setSequenceAny(val() As Any) As Any() _ + Implements XBridgeTest2.setSequenceAny + m_arAny = val + Return val + End Function + + Public Overridable Function setSequenceBool(val() As Boolean) As Boolean() _ + Implements XBridgeTest2.setSequenceBool + m_arBool = val + Return val + End Function + + Public Overridable Function setSequenceByte(val() As Byte) As Byte() _ + Implements XBridgeTest2.setSequenceByte + m_arByte = val + Return val + End Function + + Public Overridable Function setSequenceChar(val() As Char) As Char() _ + Implements XBridgeTest2.setSequenceChar + m_arChar = val + Return val + End Function + + Public Overridable Function setSequenceShort(val() As Short) As Short() _ + Implements XBridgeTest2.setSequenceShort + m_arShort = val + Return val + End Function + + Public Overridable Function setSequenceLong(val() As Integer) As Integer() _ + Implements XBridgeTest2.setSequenceLong + + m_arLong = val + Return val + End Function + + Public Overridable Function setSequenceHyper(val() As Long) As Long() _ + Implements XBridgeTest2.setSequenceHyper + m_arHyper = val + Return val + End Function + + Public Overridable Function setSequenceFloat(val() As Single) As Single() _ + Implements XBridgeTest2.setSequenceFloat + m_arFloat = val + Return val + End Function + + Public Overridable Function setSequenceDouble(val() As Double) As Double() _ + Implements XBridgeTest2.setSequenceDouble + m_arDouble = val + Return val + End Function + + Public Overridable Function setSequenceEnum(val() As TestEnum) As TestEnum() _ + Implements XBridgeTest2.setSequenceEnum + m_arEnum = val + Return val + End Function + + Public Overridable Function setSequenceUShort(val() As UInt16) As UInt16() _ + Implements XBridgeTest2.setSequenceUShort + m_arUShort = val + Return val + End Function + + Public Overridable Function setSequenceULong(val() As UInt32) As UInt32() _ + Implements XBridgeTest2.setSequenceULong + m_arULong = val + Return val + End Function + + Public Overridable Function setSequenceUHyper(val() As UInt64) As UInt64() _ + Implements XBridgeTest2.setSequenceUHyper + m_arUHyper = val + Return val + End Function + + Public Overridable Function setSequenceXInterface(val() As Object ) As Object() _ + Implements XBridgeTest2.setSequenceXInterface + m_arObject = val + Return val + End Function + + Public Overridable Function setSequenceString(val() As String) As String() _ + Implements XBridgeTest2.setSequenceString + m_arString = val + Return val + End Function + + Public Overridable Function setSequenceStruct(val() As TestElement) As TestElement() _ + Implements XBridgeTest2.setSequenceStruct + m_testElements = val + Return val + End Function + + Public Overridable Sub setSequencesInOut( _ + ByRef aSeqBoolean() As Boolean, ByRef aSeqChar() As Char, _ + ByRef aSeqByte() As Byte, ByRef aSeqShort() As Short, _ + ByRef aSeqUShort() As UInt16, ByRef aSeqLong() As Integer, _ + ByRef aSeqULong() As UInt32, ByRef aSeqHyper() As Long, _ + ByRef aSeqUHyper() As UInt64, ByRef aSeqFloat() As Single, _ + ByRef aSeqDouble() As Double, ByRef aSeqTestEnum() As TestEnum, _ + ByRef aSeqString() As String, ByRef aSeqXInterface() As Object, _ + ByRef aSeqAny() As Any, ByRef aSeqDim2()() As Integer, _ + ByRef aSeqDim3()()() As Integer) _ + Implements XBridgeTest2.setSequencesInOut + + m_arBool = aSeqBoolean + m_arChar = aSeqChar + m_arByte = aSeqByte + m_arShort = aSeqShort + m_arUShort = aSeqUShort + m_arLong = aSeqLong + m_arULong = aSeqULong + m_arHyper = aSeqHyper + m_arUHyper = aSeqUHyper + m_arFloat = aSeqFloat + m_arDouble = aSeqDouble + m_arEnum = aSeqTestEnum + m_arString = aSeqString + m_arObject = aSeqXInterface + m_arAny = aSeqAny + m_arLong2 = aSeqDim2 + m_arLong3 = aSeqDim3 + End Sub + + Public Overridable Sub setSequencesOut( _ + ByRef aSeqBoolean() As Boolean, ByRef aSeqChar() As Char, _ + ByRef aSeqByte() As Byte, ByRef aSeqShort() As Short, _ + ByRef aSeqUShort() As UInt16, ByRef aSeqLong() As Integer, _ + ByRef aSeqULong() As UInt32, ByRef aSeqHyper() As Long, _ + ByRef aSeqUHyper() As UInt64, ByRef aSeqFloat() As Single, _ + ByRef aSeqDouble() As Double, ByRef aSeqTestEnum() As TestEnum, _ + ByRef aSeqString() As String, ByRef aSeqXInterface() As Object, _ + ByRef aSeqAny() As Any, ByRef aSeqDim2()() As Integer, _ + ByRef aSeqDim3()()() As Integer) _ + Implements XBridgeTest2.setSequencesOut + + aSeqBoolean = m_arBool + aSeqChar = m_arChar + aSeqByte = m_arByte + aSeqShort = m_arShort + aSeqUShort = m_arUShort + aSeqLong = m_arLong + aSeqULong = m_arULong + aSeqHyper = m_arHyper + aSeqUHyper = m_arUHyper + aSeqFloat = m_arFloat + aSeqDouble = m_arDouble + aSeqTestEnum = m_arEnum + aSeqString = m_arString + aSeqXInterface = m_arObject + aSeqAny = m_arAny + aSeqDim2 = m_arLong2 + aSeqDim3 = m_arLong3 + + End Sub + +End Class + +End Namespace diff --git a/testtools/source/bridgetest/constructors.component b/testtools/source/bridgetest/constructors.component new file mode 100644 index 000000000..ddde08316 --- /dev/null +++ b/testtools/source/bridgetest/constructors.component @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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 . + --> + +<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="comp.test.testtools.bridgetest.Constructors"> + <service name="test.testtools.bridgetest.Constructors"/> + </implementation> + <implementation name="comp.test.testtools.bridgetest.Constructors2"> + <service name="test.testtools.bridgetest.Constructors2"/> + </implementation> +</component> diff --git a/testtools/source/bridgetest/constructors.cxx b/testtools/source/bridgetest/constructors.cxx new file mode 100644 index 000000000..9683c1fac --- /dev/null +++ b/testtools/source/bridgetest/constructors.cxx @@ -0,0 +1,454 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + + +#include <sal/config.h> + +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Exception.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Type.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/uno/XInterface.hpp> +#include <cppu/unotype.hxx> +#include <cppuhelper/factory.hxx> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/implementationentry.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/string.h> +#include <rtl/ustring.h> +#include <rtl/ustring.hxx> +#include <sal/types.h> +#include <test/testtools/bridgetest/BadConstructorArguments.hpp> +#include <test/testtools/bridgetest/TestEnum.hpp> +#include <test/testtools/bridgetest/TestStruct.hpp> +#include <test/testtools/bridgetest/TestPolyStruct.hpp> +#include <test/testtools/bridgetest/TestPolyStruct2.hpp> +#include <test/testtools/bridgetest/XMultiBase1.hpp> + +namespace { + +namespace ttb = ::test::testtools::bridgetest; +class Impl: + public cppu::WeakImplHelper<css::lang::XInitialization> +{ +public: + Impl() {} + Impl(const Impl&) = delete; + Impl& operator=(const Impl&) = delete; + +private: + virtual ~Impl() override {} + + virtual void SAL_CALL initialize( + css::uno::Sequence< css::uno::Any > const & arguments) override; +}; + +void Impl::initialize(css::uno::Sequence< css::uno::Any > const & arguments) +{ + bool arg0; + ::sal_Int8 arg1 = sal_Int8(); + ::sal_Int16 arg2 = sal_Int16(); + ::sal_uInt16 arg3 = sal_uInt16(); + ::sal_Int32 arg4 = sal_Int32(); + ::sal_uInt32 arg5 = sal_uInt32(); + ::sal_Int64 arg6 = sal_Int64(); + ::sal_uInt64 arg7 = sal_uInt64(); + float arg8 = float(); + double arg9 = double(); + sal_Unicode arg10 = sal_Unicode(); + OUString arg11; + css::uno::Type arg12; + bool arg13; + css::uno::Sequence< sal_Bool > arg14; + css::uno::Sequence< ::sal_Int8 > arg15; + css::uno::Sequence< ::sal_Int16 > arg16; + css::uno::Sequence< ::sal_uInt16 > arg17; + css::uno::Sequence< ::sal_Int32 > arg18; + css::uno::Sequence< ::sal_uInt32 > arg19; + css::uno::Sequence< ::sal_Int64 > arg20; + css::uno::Sequence< ::sal_uInt64 > arg21; + css::uno::Sequence< float > arg22; + css::uno::Sequence< double > arg23; + css::uno::Sequence< sal_Unicode > arg24; + css::uno::Sequence< OUString > arg25; + css::uno::Sequence< css::uno::Type > arg26; + css::uno::Sequence< css::uno::Any > arg27; + bool arg27b; + css::uno::Sequence< css::uno::Sequence< sal_Bool > > arg28; + css::uno::Sequence< css::uno::Sequence< css::uno::Any > > arg29; + bool arg29b; + css::uno::Sequence< ::test::testtools::bridgetest::TestEnum > arg30; + css::uno::Sequence< ::test::testtools::bridgetest::TestStruct > arg31; + css::uno::Sequence< + ::test::testtools::bridgetest::TestPolyStruct< sal_Bool > > arg32; + css::uno::Sequence< + ::test::testtools::bridgetest::TestPolyStruct< css::uno::Any > > arg33; + bool arg33b; + css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > arg34; + ::test::testtools::bridgetest::TestEnum arg35; + ::test::testtools::bridgetest::TestStruct arg36; + ::test::testtools::bridgetest::TestPolyStruct< sal_Bool > arg37; + ::test::testtools::bridgetest::TestPolyStruct< css::uno::Any > arg38; + bool arg38b; + css::uno::Reference< css::uno::XInterface > arg39; + if (!(arguments.getLength() == 40 + && (arguments[0] >>= arg0) && arg0 + && (arguments[1] >>= arg1) && arg1 == SAL_MIN_INT8 + && (arguments[2] >>= arg2) && arg2 == SAL_MIN_INT16 + && (arguments[3] >>= arg3) && arg3 == SAL_MAX_UINT16 + && (arguments[4] >>= arg4) && arg4 == SAL_MIN_INT32 + && (arguments[5] >>= arg5) && arg5 == SAL_MAX_UINT32 + && (arguments[6] >>= arg6) && arg6 == SAL_MIN_INT64 + && (arguments[7] >>= arg7) && arg7 == SAL_MAX_UINT64 + && (arguments[8] >>= arg8) && arg8 == 0.123f + && (arguments[9] >>= arg9) && arg9 == 0.456 + && (arguments[10] >>= arg10) && arg10 == 'X' + && (arguments[11] >>= arg11) + && arg11 == "test" + && (arguments[12] >>= arg12) + && arg12 == ::cppu::UnoType< css::uno::Any >::get() + && (arguments[13] >>= arg13) && arg13 + && (arguments[14] >>= arg14) && arg14.getLength() == 1 && arg14[0] + && (arguments[15] >>= arg15) && arg15.getLength() == 1 + && arg15[0] == SAL_MIN_INT8 + && (arguments[16] >>= arg16) && arg16.getLength() == 1 + && arg16[0] == SAL_MIN_INT16 + && (arguments[17] >>= arg17) && arg17.getLength() == 1 + && arg17[0] == SAL_MAX_UINT16 + && (arguments[18] >>= arg18) && arg18.getLength() == 1 + && arg18[0] == SAL_MIN_INT32 + && (arguments[19] >>= arg19) && arg19.getLength() == 1 + && arg19[0] == SAL_MAX_UINT32 + && (arguments[20] >>= arg20) && arg20.getLength() == 1 + && arg20[0] == SAL_MIN_INT64 + && (arguments[21] >>= arg21) && arg21.getLength() == 1 + && arg21[0] == SAL_MAX_UINT64 + && (arguments[22] >>= arg22) && arg22.getLength() == 1 + && arg22[0] == 0.123f + && (arguments[23] >>= arg23) && arg23.getLength() == 1 + && arg23[0] == 0.456 + && (arguments[24] >>= arg24) && arg24.getLength() == 1 + && arg24[0] == 'X' + && (arguments[25] >>= arg25) && arg25.getLength() == 1 + && arg25[0] == "test" + && (arguments[26] >>= arg26) && arg26.getLength() == 1 + && arg26[0] == ::cppu::UnoType< css::uno::Any >::get() + && (arguments[27] >>= arg27) && arg27.getLength() == 1 + && (arg27[0] >>= arg27b) && arg27b + && (arguments[28] >>= arg28) && arg28.getLength() == 1 + && arg28[0].getLength() == 1 && arg28[0][0] + && (arguments[29] >>= arg29) && arg29.getLength() == 1 + && arg29[0].getLength() == 1 && (arg29[0][0] >>= arg29b) && arg29b + && (arguments[30] >>= arg30) && arg30.getLength() == 1 + && arg30[0] == ::test::testtools::bridgetest::TestEnum_TWO + && (arguments[31] >>= arg31) && arg31.getLength() == 1 + && arg31[0].member == 10 + && (arguments[32] >>= arg32) && arg32.getLength() == 1 + && arg32[0].member + && (arguments[33] >>= arg33) && arg33.getLength() == 1 + && (arg33[0].member >>= arg33b) && arg33b + && (arguments[34] >>= arg34) && arg34.getLength() == 1 + && !arg34[0].is() + && (arguments[35] >>= arg35) + && arg35 == ::test::testtools::bridgetest::TestEnum_TWO + && (arguments[36] >>= arg36) && arg36.member == 10 + && (arguments[37] >>= arg37) && arg37.member + && (arguments[38] >>= arg38) && (arg38.member >>= arg38b) && arg38b + && (arguments[39] >>= arg39) && !arg39.is())) + { + throw ::test::testtools::bridgetest::BadConstructorArguments(); + } +} + + +class Impl2: public ::cppu::WeakImplHelper< + css::lang::XInitialization, ttb::XMultiBase1 > +{ +public: + Impl2(): m_attr1(0.0) {} + +private: + virtual ~Impl2() override {} + + virtual void SAL_CALL initialize( + css::uno::Sequence< css::uno::Any > const & arguments) override; + + //XMultiBase1 + virtual double SAL_CALL getatt1() override; + virtual void SAL_CALL setatt1( double _att1 ) override; + virtual ::sal_Int32 SAL_CALL fn11( ::sal_Int32 arg ) override; + virtual OUString SAL_CALL fn12( const OUString& arg ) override; + + + double m_attr1; +}; + +void Impl2::initialize(css::uno::Sequence< css::uno::Any > const & arguments) +{ + ttb::TestPolyStruct< css::uno::Type > arg0; + ttb::TestPolyStruct< css::uno::Any > arg1; + css::uno::Any arg1b(true); + ttb::TestPolyStruct< sal_Bool > arg2; + ttb::TestPolyStruct< ::sal_Int8 > arg3; + ttb::TestPolyStruct< ::sal_Int16 > arg4; + ttb::TestPolyStruct< ::sal_Int32 > arg5; + ttb::TestPolyStruct< ::sal_Int64 > arg6; + ttb::TestPolyStruct< ::sal_Unicode > arg7; + ttb::TestPolyStruct< OUString > arg8; + ttb::TestPolyStruct< float > arg9; + ttb::TestPolyStruct< double > arg10; + ttb::TestPolyStruct<css::uno::Reference<css::uno::XInterface> > arg11; + ttb::TestPolyStruct<css::uno::Reference< css::lang::XComponent> > arg12; + ttb::TestPolyStruct<ttb::TestEnum> arg13; + ttb::TestPolyStruct< + ttb::TestPolyStruct2<sal_Unicode, css::uno::Any> > arg14; + ttb::TestPolyStruct< ttb::TestPolyStruct2 < + ttb::TestPolyStruct2< sal_Unicode, css::uno::Any >, + OUString > > arg15; + ttb::TestPolyStruct2< OUString,ttb::TestPolyStruct2 < + ::sal_Unicode, ttb::TestPolyStruct < css::uno::Any > > > arg16; + ttb::TestPolyStruct2< ttb::TestPolyStruct2<sal_Unicode, css::uno::Any >, + ttb::TestPolyStruct<sal_Unicode> > arg17; + ttb::TestPolyStruct<css::uno::Sequence< css::uno::Type > > arg18; + ttb::TestPolyStruct<css::uno::Sequence<css::uno::Any> > arg19; + ttb::TestPolyStruct<css::uno::Sequence< sal_Bool > > arg20; + ttb::TestPolyStruct<css::uno::Sequence< ::sal_Int8 > > arg21; + ttb::TestPolyStruct<css::uno::Sequence< ::sal_Int16 > > arg22; + ttb::TestPolyStruct<css::uno::Sequence< ::sal_Int32 > > arg23; + ttb::TestPolyStruct<css::uno::Sequence< ::sal_Int64 > > arg24; + ttb::TestPolyStruct<css::uno::Sequence< sal_Unicode> > arg25; + ttb::TestPolyStruct<css::uno::Sequence< OUString > > arg26; + ttb::TestPolyStruct<css::uno::Sequence<float> > arg27; + ttb::TestPolyStruct<css::uno::Sequence<double> > arg28; + ttb::TestPolyStruct<css::uno::Sequence<css::uno::Reference<css::uno::XInterface> > > arg29; + ttb::TestPolyStruct<css::uno::Sequence<css::uno::Reference<css::lang::XComponent> > > arg30; + ttb::TestPolyStruct<css::uno::Sequence<ttb::TestEnum> > arg31; + ttb::TestPolyStruct<css::uno::Sequence<ttb::TestPolyStruct2< + ::sal_Unicode, css::uno::Sequence<css::uno::Any> > > > arg32; + bool arg32a = false; + ttb::TestPolyStruct<css::uno::Sequence<ttb::TestPolyStruct2< + ttb::TestPolyStruct< ::sal_Unicode>, css::uno::Sequence<css::uno::Any> > > > arg33; + ttb::TestPolyStruct<css::uno::Sequence<css::uno::Sequence< ::sal_Int32> > > arg34; + css::uno::Sequence<ttb::TestPolyStruct< ::sal_Int32> > arg35; + css::uno::Sequence<ttb::TestPolyStruct<ttb::TestPolyStruct2< ::sal_Unicode, css::uno::Any> > > arg36; + css::uno::Sequence<ttb::TestPolyStruct<ttb::TestPolyStruct2< + ttb::TestPolyStruct2< ::sal_Unicode,css::uno::Any >, OUString> > > arg37; + css::uno::Sequence<ttb::TestPolyStruct2< OUString, ttb::TestPolyStruct2< + ::sal_Unicode, ttb::TestPolyStruct<css::uno::Any> > > > arg38; + css::uno::Sequence<ttb::TestPolyStruct2<ttb::TestPolyStruct2< + ::sal_Unicode, css::uno::Any>, ttb::TestPolyStruct< ::sal_Unicode> > > arg39; + css::uno::Sequence<css::uno::Sequence<ttb::TestPolyStruct< ::sal_Unicode> > > arg40; + css::uno::Sequence<css::uno::Sequence<ttb::TestPolyStruct<ttb::TestPolyStruct2< ::sal_Unicode, css::uno::Any> > > >arg41; + css::uno::Sequence<css::uno::Sequence<ttb::TestPolyStruct< + ttb::TestPolyStruct2<ttb::TestPolyStruct2<sal_Unicode, css::uno::Any>, OUString> > > > arg42; + css::uno::Sequence<css::uno::Sequence<ttb::TestPolyStruct2< + OUString, ttb::TestPolyStruct2< ::sal_Unicode, ttb::TestPolyStruct<css::uno::Any> > > > > arg43; + css::uno::Sequence<css::uno::Sequence<ttb::TestPolyStruct2< + ttb::TestPolyStruct2< ::sal_Unicode, css::uno::Any>, ttb::TestPolyStruct< + ::sal_Unicode> > > > arg44; + + if (!(arguments.getLength() == 45 + && (arguments[0] >>= arg0) && arg0.member == cppu::UnoType<sal_Int32>::get() + && (arguments[1] >>= arg1) && arg1.member == arg1b + && (arguments[2] >>= arg2) && arg2.member + && (arguments[3] >>= arg3) && arg3.member == SAL_MIN_INT8 + && (arguments[4] >>= arg4) && arg4.member == SAL_MIN_INT16 + && (arguments[5] >>= arg5) && arg5.member == SAL_MIN_INT32 + && (arguments[6] >>= arg6) && arg6.member == SAL_MIN_INT64 + && (arguments[7] >>= arg7) && arg7.member == 'X' + && (arguments[8] >>= arg8) && arg8.member == "test" + && (arguments[9] >>= arg9) && arg9.member == 0.123f + && (arguments[10] >>= arg10) && arg10.member == 0.456 + && (arguments[11] >>= arg11) + && (arguments[12] >>= arg12) + && (arguments[13] >>= arg13) && arg13.member == ttb::TestEnum_TWO + && (arguments[14] >>= arg14) && arg14.member.member1 == 'X' && arg14.member.member2 == arg1b + && (arguments[15] >>= arg15) && arg15.member.member1.member1 == 'X' + && arg15.member.member1.member2 == arg1b + && arg15.member.member2 == "test" + && (arguments[16] >>= arg16) && arg16.member1 == "test" + && arg16.member2.member1 == 'X' + && arg16.member2.member2.member == arg1b + && (arguments[17] >>= arg17) && arg17.member1.member1 == 'X' + && arg17.member1.member2 == arg1b + && arg17.member2.member == 'X' + && (arguments[18] >>= arg18) && arg18.member.getLength() == 1 + && arg18.member[0] == ::cppu::UnoType<sal_Int32>::get() + && (arguments[19] >>= arg19) && arg19.member.getLength() == 1 + && arg19.member[0] == arg1b + && (arguments[20] >>= arg20) && arg20.member.getLength() == 1 + && arg20.member[0] + && (arguments[21] >>= arg21) && arg21.member.getLength() == 1 + && arg21.member[0] == SAL_MIN_INT8 + && (arguments[22] >>= arg22) && arg22.member.getLength() == 1 + && arg22.member[0] == SAL_MIN_INT16 + && (arguments[23] >>= arg23) && arg23.member.getLength() == 1 + && arg23.member[0] == SAL_MIN_INT32 + && (arguments[24] >>= arg24) && arg24.member.getLength() == 1 + && arg24.member[0] == SAL_MIN_INT64 + && (arguments[25] >>= arg25) && arg25.member.getLength() == 1 + && arg25.member[0] == 'X' + && (arguments[26] >>= arg26) && arg26.member.getLength() == 1 + && arg26.member[0] == "test" + && (arguments[27] >>= arg27) && arg27.member.getLength() == 1 + && arg27.member[0] == 0.123f + && (arguments[28] >>= arg28) && arg28.member.getLength() == 1 + && arg28.member[0] == 0.456 + && (arguments[29] >>= arg29) && arg29.member.getLength() == 1 + && arg29.member[0] != nullptr + && (arguments[30] >>= arg30) && arg30.member.getLength() == 1 + && arg30.member[0] != nullptr + && (arguments[31] >>= arg31) && arg31.member.getLength() == 1 + && arg31.member[0] == ttb::TestEnum_TWO + && (arguments[32] >>= arg32) && arg32.member.getLength() == 1 + && arg32.member[0].member1 == 'X' + && arg32.member[0].member2.getLength() == 1 + && (arg32.member[0].member2[0] >>= arg32a) && arg32a + && (arguments[33] >>= arg33) && arg33.member.getLength() == 1 + && arg33.member[0].member1.member == 'X' + && arg33.member[0].member2.getLength() == 1 + && arg33.member[0].member2[0] == arg1b + && (arguments[34] >>= arg34) && arg34.member.getLength() == 1 + && arg34.member[0].getLength() == 1 && arg34.member[0][0] == SAL_MIN_INT32 + && (arguments[35] >>= arg35) && arg35.getLength() == 1 + && arg35[0].member == SAL_MIN_INT32 + && (arguments[36] >>= arg36) && arg36.getLength() == 1 + && arg36[0].member.member1 == 'X' + && arg36[0].member.member2 == arg1b + && (arguments[37] >>= arg37) && arg37.getLength() == 1 + && arg37[0].member.member1.member1 == 'X' + && arg37[0].member.member1.member2 == arg1b + && arg37[0].member.member2 == "test" + && (arguments[38] >>= arg38) && arg38.getLength() == 1 + && arg38[0].member1 == "test" + && arg38[0].member2.member1 == 'X' + && arg38[0].member2.member2.member == arg1b + && (arguments[39] >>= arg39) && arg39.getLength() == 1 + && arg39[0].member1.member1 == 'X' + && arg39[0].member1.member2 == arg1b + && arg39[0].member2.member == 'X' + && (arguments[40] >>= arg40) && arg40.getLength() == 1 + && arg40[0].getLength() == 1 + && arg40[0][0].member == 'X' + && (arguments[41] >>= arg41) && arg41.getLength() == 1 + && arg41[0].getLength() == 1 + && arg41[0][0].member.member1 == 'X' + && arg41[0][0].member.member2 == arg1b + && (arguments[42] >>= arg42) && arg42.getLength() == 1 + && arg42[0].getLength() == 1 + && arg42[0][0].member.member1.member1 == 'X' + && arg42[0][0].member.member1.member2 == arg1b + && arg42[0][0].member.member2 == "test" + && (arguments[43] >>= arg43) && arg43.getLength() == 1 + && arg43[0].getLength() == 1 + && arg43[0][0].member1 == "test" + && arg43[0][0].member2.member1 == 'X' + && arg43[0][0].member2.member2.member == arg1b + && (arguments[44] >>= arg44) && arg44.getLength() == 1 + && arg44[0].getLength() == 1 + && arg44[0][0].member1.member1 == 'X' + && arg44[0][0].member1.member2 == arg1b + && arg44[0][0].member2.member == 'X' + )) + { + throw ::test::testtools::bridgetest::BadConstructorArguments(); + } + + //check if interfaces work + arg11.member->acquire(); + arg11.member->release(); + arg12.member->acquire(); + arg12.member->release(); + arg29.member[0]->acquire(); + arg29.member[0]->release(); + +} + +//XMultiBase1 +double Impl2::getatt1() +{ + return m_attr1; +} + +void Impl2::setatt1( double _att1 ) +{ + m_attr1 = _att1; +} + +::sal_Int32 Impl2::fn11( ::sal_Int32 arg ) +{ + return 11 * arg; +} + +OUString Impl2::fn12( const OUString& arg ) +{ + return "12" + arg; +} + +css::uno::Reference< css::uno::XInterface > create( + SAL_UNUSED_PARAMETER css::uno::Reference< css::uno::XComponentContext > + const &) +{ + return static_cast< ::cppu::OWeakObject * >(new Impl); +} + +OUString getImplementationName() { + return + "comp.test.testtools.bridgetest.Constructors"; +} + +css::uno::Sequence< OUString > getSupportedServiceNames() { + return { "test.testtools.bridgetest.Constructors" }; +} + +css::uno::Reference< css::uno::XInterface > create2( + SAL_UNUSED_PARAMETER css::uno::Reference< css::uno::XComponentContext > + const &) +{ + return static_cast< ::cppu::OWeakObject * >(new Impl2); +} + +OUString getImplementationName2() { + return "comp.test.testtools.bridgetest.Constructors2"; +} + +css::uno::Sequence< OUString > getSupportedServiceNames2() { + return { "test.testtools.bridgetest.Constructors2" }; +} + +::cppu::ImplementationEntry const entries[] = { + { &create, &getImplementationName, &getSupportedServiceNames, + &::cppu::createSingleComponentFactory, nullptr, 0 }, + { &create2, &getImplementationName2, &getSupportedServiceNames2, + &::cppu::createSingleComponentFactory, nullptr, 0 }, + { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } }; +} + +extern "C" SAL_DLLPUBLIC_EXPORT void * component_getFactory( + char const * implName, void * serviceManager, void * registryKey) +{ + return ::cppu::component_getFactoryHelper( + implName, serviceManager, registryKey, entries); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/bridgetest/cppobj.component b/testtools/source/bridgetest/cppobj.component new file mode 100644 index 000000000..5b11d8df3 --- /dev/null +++ b/testtools/source/bridgetest/cppobj.component @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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 . + --> + +<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.bridge.CppTestObject"> + <service name="com.sun.star.test.bridge.CppTestObject"/> + </implementation> +</component> diff --git a/testtools/source/bridgetest/cppobj.cxx b/testtools/source/bridgetest/cppobj.cxx new file mode 100644 index 000000000..1456c2964 --- /dev/null +++ b/testtools/source/bridgetest/cppobj.cxx @@ -0,0 +1,1223 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#include <stdio.h> + +#include <cppu/unotype.hxx> +#include <osl/diagnose.h> +#include <osl/diagnose.hxx> +#include <osl/thread.hxx> +#include <osl/mutex.hxx> +#include <osl/time.h> + +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/factory.hxx> +#include <cppuhelper/exc_hlp.hxx> +#include <cppuhelper/compbase_ex.hxx> +#include <cppuhelper/supportsservice.hxx> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/uno/Sequence.hxx> + +#include <test/testtools/bridgetest/Constructors.hpp> +#include <test/testtools/bridgetest/Constructors2.hpp> +#include <test/testtools/bridgetest/TestPolyStruct.hpp> +#include <test/testtools/bridgetest/TestPolyStruct2.hpp> +#include <test/testtools/bridgetest/XBridgeTest2.hpp> +#include <test/testtools/bridgetest/XMulti.hpp> + +#include "currentcontextchecker.hxx" +#include "multi.hxx" + +using namespace osl; +using namespace cppu; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::registry; +using namespace test::testtools::bridgetest; + +#ifdef _MSC_VER +#pragma warning (disable : 4503) // irrelevant for test code +#endif + +#define SERVICENAME "com.sun.star.test.bridge.CppTestObject" +#define IMPLNAME "com.sun.star.comp.bridge.CppTestObject" + +namespace bridge_object +{ + + +static Sequence< OUString > getSupportedServiceNames() +{ + return { SERVICENAME }; +} + + +static void assign( TestElement & rData, + bool bBool, sal_Unicode cChar, sal_Int8 nByte, + sal_Int16 nShort, sal_uInt16 nUShort, + sal_Int32 nLong, sal_uInt32 nULong, + sal_Int64 nHyper, sal_uInt64 nUHyper, + float fFloat, double fDouble, + TestEnum eEnum, const OUString& rStr, + sal_Int8 nByte2, sal_Int16 nShort2, + const css::uno::Reference< css::uno::XInterface >& xTest, + const css::uno::Any& rAny ) +{ + rData.Bool = bBool; + rData.Char = cChar; + rData.Byte = nByte; + rData.Short = nShort; + rData.UShort = nUShort; + rData.Long = nLong; + rData.ULong = nULong; + rData.Hyper = nHyper; + rData.UHyper = nUHyper; + rData.Float = fFloat; + rData.Double = fDouble; + rData.Enum = eEnum; + rData.String = rStr; + rData.Byte2 = nByte2; + rData.Short2 = nShort2; + rData.Interface = xTest; + rData.Any = rAny; +} + +static void assign( TestData & rData, + bool bBool, sal_Unicode cChar, sal_Int8 nByte, + sal_Int16 nShort, sal_uInt16 nUShort, + sal_Int32 nLong, sal_uInt32 nULong, + sal_Int64 nHyper, sal_uInt64 nUHyper, + float fFloat, double fDouble, + TestEnum eEnum, const OUString& rStr, + sal_Int8 nByte2, sal_Int16 nShort2, + const css::uno::Reference< css::uno::XInterface >& xTest, + const css::uno::Any& rAny, + const css::uno::Sequence< TestElement >& rSequence ) +{ + assign( static_cast<TestElement &>(rData), + bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble, + eEnum, rStr, nByte2, nShort2, xTest, rAny ); + rData.Sequence = rSequence; +} + +namespace { + +class Test_Impl : + public osl::DebugBase<Test_Impl>, + public WeakImplHelper< XBridgeTest2, XServiceInfo , XRecursiveCall > +{ + TestData _aData, _aStructData; + sal_Int32 m_nLastCallId; + bool m_bFirstCall; + bool m_bSequenceOfCallTestPassed; + Mutex m_mutex; + + Sequence<sal_Bool> _arBool; + Sequence<sal_Unicode> _arChar; + Sequence<sal_Int8> _arByte; + Sequence<sal_Int16> _arShort; + Sequence<sal_uInt16> _arUShort; + Sequence<sal_Int32> _arLong; + Sequence<sal_uInt32> _arULong; + Sequence<sal_Int64> _arHyper; + Sequence<sal_uInt64> _arUHyper; + Sequence<OUString> _arString; + Sequence<float> _arFloat; + Sequence<double> _arDouble; + Sequence<TestEnum> _arEnum; + Sequence<Reference<XInterface> > _arObject; + Sequence<Sequence<sal_Int32> > _arLong2; + Sequence<Sequence<Sequence<sal_Int32> > > _arLong3; + Sequence<Any> _arAny; + Sequence<TestElement> _arStruct; + +public: + Test_Impl() : m_nLastCallId( 0 ), + m_bFirstCall( true ), + m_bSequenceOfCallTestPassed( true ) + {} + + void SAL_CALL acquire() throw () override + { + OWeakObject::acquire(); + } + void SAL_CALL release() throw () override + { + OWeakObject::release(); + } + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) override; + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XLBTestBase + virtual void SAL_CALL setValues( sal_Bool bBool, + sal_Unicode cChar, + sal_Int8 nByte, + sal_Int16 nShort, + sal_uInt16 nUShort, + sal_Int32 nLong, + sal_uInt32 nULong, + sal_Int64 nHyper, + sal_uInt64 nUHyper, + float fFloat, + double fDouble, + TestEnum eEnum, + const OUString& rStr, + sal_Int8 nByte2, + sal_Int16 nShort2, + const css::uno::Reference< css::uno::XInterface >& xTest, + const css::uno::Any& rAny, + const css::uno::Sequence<TestElement >& rSequence, + const ::test::testtools::bridgetest::TestDataElements& rStruct ) override; + + virtual ::test::testtools::bridgetest::TestDataElements SAL_CALL setValues2( sal_Bool& bBool, + sal_Unicode& cChar, + sal_Int8& nByte, + sal_Int16& nShort, + sal_uInt16& nUShort, + sal_Int32& nLong, + sal_uInt32& nULong, + sal_Int64& nHyper, + sal_uInt64& nUHyper, + float& fFloat, + double& fDouble, + TestEnum& eEnum, + OUString& rStr, + sal_Int8& nByte2, + sal_Int16& nShort2, + css::uno::Reference< css::uno::XInterface >& xTest, + css::uno::Any& rAny, + css::uno::Sequence<TestElement >& rSequence, + ::test::testtools::bridgetest::TestDataElements& rStruct ) override; + + virtual ::test::testtools::bridgetest::TestDataElements SAL_CALL getValues( sal_Bool& bBool, + sal_Unicode& cChar, + sal_Int8& nByte, + sal_Int16& nShort, + sal_uInt16& nUShort, + sal_Int32& nLong, + sal_uInt32& nULong, + sal_Int64& nHyper, + sal_uInt64& nUHyper, + float& fFloat, + double& fDouble, + TestEnum& eEnum, + OUString& rStr, + sal_Int8& nByte2, + sal_Int16& nShort2, + css::uno::Reference< css::uno::XInterface >& xTest, + css::uno::Any& rAny, + css::uno::Sequence< TestElement >& rSequence, + ::test::testtools::bridgetest::TestDataElements& rStruct ) override; + + virtual SmallStruct SAL_CALL echoSmallStruct(const SmallStruct& rStruct) override + { return rStruct; } + virtual MediumStruct SAL_CALL echoMediumStruct(const MediumStruct& rStruct) override + { return rStruct; } + virtual BigStruct SAL_CALL echoBigStruct(const BigStruct& rStruct) override + { return rStruct; } + virtual TwoFloats SAL_CALL echoTwoFloats(const TwoFloats& rStruct) override + { return rStruct; } + virtual FourFloats SAL_CALL echoFourFloats(const FourFloats& rStruct) override + { return rStruct; } + virtual MixedFloatAndInteger SAL_CALL echoMixedFloatAndInteger(const MixedFloatAndInteger& rStruct) override + { return rStruct; } + virtual ThreeByteStruct SAL_CALL echoThreeByteStruct(const ThreeByteStruct& rStruct) override + { return rStruct; } + virtual sal_Int32 SAL_CALL testPPCAlignment( sal_Int64, sal_Int64, sal_Int32, sal_Int64, sal_Int32 i2 ) override + { return i2; } + virtual sal_Int32 SAL_CALL testPPC64Alignment( double , double , double , sal_Int32 i1 ) override + { return i1; } + virtual double SAL_CALL testTenDoubles( double d1, double d2, double d3, double d4, double d5, double d6, double d7, double d8, double d9, double d10 ) override + { return d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10; } + virtual sal_Bool SAL_CALL getBool() override + { return _aData.Bool; } + virtual sal_Int8 SAL_CALL getByte() override + { return _aData.Byte; } + virtual sal_Unicode SAL_CALL getChar() override + { return _aData.Char; } + virtual sal_Int16 SAL_CALL getShort() override + { return _aData.Short; } + virtual sal_uInt16 SAL_CALL getUShort() override + { return _aData.UShort; } + virtual sal_Int32 SAL_CALL getLong() override + { return _aData.Long; } + virtual sal_uInt32 SAL_CALL getULong() override + { return _aData.ULong; } + virtual sal_Int64 SAL_CALL getHyper() override + { return _aData.Hyper; } + virtual sal_uInt64 SAL_CALL getUHyper() override + { return _aData.UHyper; } + virtual float SAL_CALL getFloat() override + { return _aData.Float; } + virtual double SAL_CALL getDouble() override + { return _aData.Double; } + virtual TestEnum SAL_CALL getEnum() override + { return _aData.Enum; } + virtual OUString SAL_CALL getString() override + { return _aData.String; } + virtual sal_Int8 SAL_CALL getByte2() override + { return _aData.Byte2; } + virtual sal_Int16 SAL_CALL getShort2() override + { return _aData.Short2; } + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getInterface( ) override + { return _aData.Interface; } + virtual css::uno::Any SAL_CALL getAny() override + { return _aData.Any; } + virtual css::uno::Sequence< TestElement > SAL_CALL getSequence() override + { return _aData.Sequence; } + virtual ::test::testtools::bridgetest::TestDataElements SAL_CALL getStruct() override + { return _aStructData; } + + virtual void SAL_CALL setBool( sal_Bool _bool ) override + { _aData.Bool = _bool; } + virtual void SAL_CALL setByte( sal_Int8 _byte ) override + { _aData.Byte = _byte; } + virtual void SAL_CALL setChar( sal_Unicode _char ) override + { _aData.Char = _char; } + virtual void SAL_CALL setShort( sal_Int16 _short ) override + { _aData.Short = _short; } + virtual void SAL_CALL setUShort( sal_uInt16 _ushort ) override + { _aData.UShort = _ushort; } + virtual void SAL_CALL setLong( sal_Int32 _long ) override + { _aData.Long = _long; } + virtual void SAL_CALL setULong( sal_uInt32 _ulong ) override + { _aData.ULong = _ulong; } + virtual void SAL_CALL setHyper( sal_Int64 _hyper ) override + { _aData.Hyper = _hyper; } + virtual void SAL_CALL setUHyper( sal_uInt64 _uhyper ) override + { _aData.UHyper = _uhyper; } + virtual void SAL_CALL setFloat( float _float ) override + { _aData.Float = _float; } + virtual void SAL_CALL setDouble( double _double ) override + { _aData.Double = _double; } + virtual void SAL_CALL setEnum( TestEnum _enum ) override + { _aData.Enum = _enum; } + virtual void SAL_CALL setString( const OUString& _string ) override + { _aData.String = _string; } + virtual void SAL_CALL setByte2( sal_Int8 _byte ) override + { _aData.Byte2 = _byte; } + virtual void SAL_CALL setShort2( sal_Int16 _short ) override + { _aData.Short2 = _short; } + virtual void SAL_CALL setInterface( const css::uno::Reference< css::uno::XInterface >& _interface ) override + { _aData.Interface = _interface; } + virtual void SAL_CALL setAny( const css::uno::Any& _any ) override + { _aData.Any = _any; } + virtual void SAL_CALL setSequence( const css::uno::Sequence<TestElement >& _sequence ) override + { _aData.Sequence = _sequence; } + virtual void SAL_CALL setStruct( const ::test::testtools::bridgetest::TestDataElements& _struct ) override + { _aStructData = _struct; } + + virtual sal_Int32 SAL_CALL getRaiseAttr1() override + { throw RuntimeException(); } + + virtual void SAL_CALL setRaiseAttr1(sal_Int32) override + { throw IllegalArgumentException(); } + + virtual sal_Int32 SAL_CALL getRaiseAttr2() override + { throw IllegalArgumentException(); } + + virtual TestPolyStruct< sal_Bool > SAL_CALL transportPolyBoolean( + TestPolyStruct< sal_Bool > const & arg) override + { return arg; } + + virtual void SAL_CALL transportPolyHyper(TestPolyStruct< sal_Int64 > &) override {} + + virtual void SAL_CALL transportPolySequence( + TestPolyStruct< Sequence< Any > > const & arg1, + TestPolyStruct< Sequence< Any > > & arg2) override + { arg2 = arg1; } + + virtual TestPolyStruct< sal_Int32 > SAL_CALL getNullPolyLong() override + { return TestPolyStruct< sal_Int32 >(0); /* work around MS compiler bug */ } + + virtual TestPolyStruct< OUString > SAL_CALL getNullPolyString() override + { return TestPolyStruct< OUString >(); } + + virtual TestPolyStruct< Type > SAL_CALL getNullPolyType() override + { return TestPolyStruct< Type >(); } + + virtual TestPolyStruct< Any > SAL_CALL getNullPolyAny() override + { return TestPolyStruct< Any >(); } + + virtual TestPolyStruct< Sequence< sal_Bool > > SAL_CALL + getNullPolySequence() override + { return TestPolyStruct< Sequence< sal_Bool > >(); } + + virtual TestPolyStruct< TestEnum > SAL_CALL getNullPolyEnum() override + { return TestPolyStruct< TestEnum >( + test::testtools::bridgetest::TestEnum_TEST); + /* work around MS compiler bug */ } + + virtual TestPolyStruct< TestBadEnum > SAL_CALL getNullPolyBadEnum() override + { return TestPolyStruct< TestBadEnum >( + test::testtools::bridgetest::TestBadEnum_M); + /* explicitly instantiate with default enumerator */ } + + virtual TestPolyStruct< TestStruct > SAL_CALL getNullPolyStruct() override + { return TestPolyStruct< TestStruct >(); } + + virtual TestPolyStruct< Reference< XBridgeTestBase > > SAL_CALL + getNullPolyInterface() override + { return TestPolyStruct< Reference< XBridgeTestBase > >(); } + + virtual css::uno::Any SAL_CALL transportAny( + const css::uno::Any& value ) override; + + virtual void SAL_CALL call( sal_Int32 nCallId, sal_Int32 nWaitMUSEC ) override; + virtual void SAL_CALL callOneway( sal_Int32 nCallId, sal_Int32 nWaitMUSEC ) override; + virtual sal_Bool SAL_CALL sequenceOfCallTestPassed( ) override; + virtual void SAL_CALL startRecursiveCall( + const css::uno::Reference< XRecursiveCall >& xCall, sal_Int32 nToCall ) override; + + virtual Reference< XMulti > SAL_CALL getMulti() override; + + virtual OUString SAL_CALL testMulti(Reference< XMulti > const & multi) override; + +public: // XBridgeTest + virtual ::test::testtools::bridgetest::TestDataElements SAL_CALL raiseException( sal_Int16 nArgumentPos, const OUString & rMsg, const Reference< XInterface > & xCOntext ) override; + + virtual void SAL_CALL raiseRuntimeExceptionOneway( + const OUString& Message, const css::uno::Reference< css::uno::XInterface >& Context ) override; + + virtual sal_Int32 SAL_CALL getRuntimeException() override; + virtual void SAL_CALL setRuntimeException( sal_Int32 _runtimeexception ) override; + + // XBridgeTest2 + virtual Sequence< sal_Bool > SAL_CALL setSequenceBool( + const Sequence< sal_Bool >& aSeq ) override; + virtual Sequence< sal_Unicode > SAL_CALL setSequenceChar( + const Sequence< sal_Unicode >& aSeq ) override; + virtual Sequence< sal_Int8 > SAL_CALL setSequenceByte( + const Sequence< sal_Int8 >& aSeq ) override; + virtual Sequence< sal_Int16 > SAL_CALL setSequenceShort( + const Sequence< sal_Int16 >& aSeq ) override; + virtual Sequence< sal_uInt16 > SAL_CALL setSequenceUShort( + const Sequence< sal_uInt16 >& aSeq ) override; + virtual Sequence< sal_Int32 > SAL_CALL setSequenceLong( + const Sequence< sal_Int32 >& aSeq ) override; + virtual Sequence< sal_uInt32 > SAL_CALL setSequenceULong( + const Sequence< sal_uInt32 >& aSeq ) override; + virtual Sequence< sal_Int64 > SAL_CALL setSequenceHyper( + const Sequence< sal_Int64 >& aSeq ) override; + virtual Sequence< sal_uInt64 > SAL_CALL setSequenceUHyper( + const Sequence< sal_uInt64 >& aSeq ) override; + virtual Sequence< float > SAL_CALL setSequenceFloat( + const Sequence< float >& aSeq ) override; + virtual Sequence< double > SAL_CALL setSequenceDouble( + const Sequence< double >& aSeq ) override; + virtual Sequence< TestEnum > SAL_CALL setSequenceEnum( + const Sequence< TestEnum >& aSeq ) override ; + virtual Sequence< OUString > SAL_CALL setSequenceString( + const Sequence< OUString >& aString ) override; + virtual Sequence< Reference< XInterface > > SAL_CALL setSequenceXInterface( + const Sequence< Reference< XInterface > >& aSeq ) override; + virtual Sequence<Any > SAL_CALL setSequenceAny( + const Sequence<Any >& aSeq ) override; + virtual Sequence<TestElement > SAL_CALL setSequenceStruct( + const Sequence< TestElement >& aSeq ) override; + virtual Sequence< Sequence< sal_Int32 > > SAL_CALL setDim2( + const Sequence<Sequence< sal_Int32 > >& aSeq ) override; + virtual Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL setDim3( + const Sequence< Sequence< Sequence< sal_Int32 > > >& aSeq ) override; + virtual void SAL_CALL setSequencesInOut(Sequence< sal_Bool >& aSeqBoolean, + Sequence< sal_Unicode >& aSeqChar, + Sequence< sal_Int8 >& aSeqByte, + Sequence< sal_Int16 >& aSeqShort, + Sequence< sal_uInt16 >& aSeqUShort, + Sequence< sal_Int32 >& aSeqLong, + Sequence< sal_uInt32 >& aSeqULong, + Sequence< sal_Int64 >& aSeqHyper, + Sequence< sal_uInt64 >& aSeqUHyper, + Sequence< float >& aSeqFloat, + Sequence< double >& aSeqDouble, + Sequence< TestEnum >& aSeqTestEnum, + Sequence< OUString >& aSeqString, + Sequence<Reference<XInterface > >& aSeqXInterface, + Sequence< Any >& aSeqAny, + Sequence< Sequence< sal_Int32 > >& aSeqDim2, + Sequence< Sequence< Sequence< sal_Int32 > > >& aSeqDim3 ) override; + virtual void SAL_CALL setSequencesOut( Sequence< sal_Bool >& aSeqBoolean, + Sequence< sal_Unicode >& aSeqChar, + Sequence< sal_Int8 >& aSeqByte, + Sequence< sal_Int16 >& aSeqShort, + Sequence< sal_uInt16 >& aSeqUShort, + Sequence< sal_Int32 >& aSeqLong, + Sequence< sal_uInt32 >& aSeqULong, + Sequence< sal_Int64 >& aSeqHyper, + Sequence< sal_uInt64 >& aSeqUHyper, + Sequence< float >& aSeqFloat, + Sequence< double >& aSeqDouble, + Sequence< TestEnum >& aSeqEnum, + Sequence< OUString >& aSeqString, + Sequence< Reference< XInterface > >& aSeqXInterface, + Sequence< Any >& aSeqAny, + Sequence< Sequence< sal_Int32 > >& aSeqDim2, + Sequence< Sequence< Sequence< sal_Int32 > > >& aSeqDim3 ) override; + virtual void SAL_CALL testConstructorsService( + Reference< XComponentContext > const & context) override; + virtual Reference< XCurrentContextChecker > SAL_CALL + getCurrentContextChecker() override; + +public: + virtual void SAL_CALL callRecursivly( const css::uno::Reference< XRecursiveCall >& xCall, sal_Int32 nToCall ) override; +}; + +//Dummy class for XComponent implementation +class Dummy : public osl::DebugBase<Dummy>, + public WeakComponentImplHelperBase +{ +public: + Dummy(): WeakComponentImplHelperBase(*Mutex::getGlobalMutex()){} + +}; + +} + +Any Test_Impl::transportAny( const Any & value ) +{ + return value; +} + + +namespace { + +void wait(sal_Int32 microSeconds) { + OSL_ASSERT(microSeconds >= 0 && microSeconds <= SAL_MAX_INT32 / 1000); + osl::Thread::wait(std::chrono::microseconds(microSeconds)); +} + +} + +void Test_Impl::call( sal_Int32 nCallId , sal_Int32 nWaitMUSEC ) +{ + wait(nWaitMUSEC); + if( m_bFirstCall ) + { + m_bFirstCall = false; + } + else + { + m_bSequenceOfCallTestPassed = m_bSequenceOfCallTestPassed && (nCallId > m_nLastCallId); + } + m_nLastCallId = nCallId; +} + + +void Test_Impl::callOneway( sal_Int32 nCallId , sal_Int32 nWaitMUSEC ) +{ + wait(nWaitMUSEC); + m_bSequenceOfCallTestPassed = m_bSequenceOfCallTestPassed && (nCallId > m_nLastCallId); + m_nLastCallId = nCallId; +} + + +sal_Bool Test_Impl::sequenceOfCallTestPassed() +{ + return m_bSequenceOfCallTestPassed; +} + + +void SAL_CALL Test_Impl::startRecursiveCall( + const css::uno::Reference< XRecursiveCall >& xCall, sal_Int32 nToCall ) +{ + MutexGuard guard( m_mutex ); + if( nToCall ) + { + nToCall --; + xCall->callRecursivly( this , nToCall ); + } +} + + +void SAL_CALL Test_Impl::callRecursivly( + const css::uno::Reference< XRecursiveCall >& xCall, + sal_Int32 nToCall ) +{ + MutexGuard guard( m_mutex ); + if( nToCall ) + { + nToCall --; + xCall->callRecursivly( this , nToCall ); + } +} + +Reference< XMulti > Test_Impl::getMulti() { + return new testtools::bridgetest::Multi; +} + +OUString Test_Impl::testMulti(Reference< XMulti > const & multi) +{ + return testtools::bridgetest::testMulti(multi); +} + + +void Test_Impl::setValues( sal_Bool bBool, + sal_Unicode cChar, + sal_Int8 nByte, + sal_Int16 nShort, + sal_uInt16 nUShort, + sal_Int32 nLong, + sal_uInt32 nULong, + sal_Int64 nHyper, + sal_uInt64 nUHyper, + float fFloat, + double fDouble, + TestEnum eEnum, + const OUString& rStr, + sal_Int8 nByte2, + sal_Int16 nShort2, + const css::uno::Reference< css::uno::XInterface >& xTest, + const css::uno::Any& rAny, + const css::uno::Sequence<TestElement >& rSequence, + const ::test::testtools::bridgetest::TestDataElements& rStruct ) +{ + assign( _aData, + bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble, + eEnum, rStr, nByte2, nShort2, xTest, rAny, rSequence ); + _aStructData = rStruct; +} + +::test::testtools::bridgetest::TestDataElements Test_Impl::setValues2( sal_Bool& bBool, + sal_Unicode& cChar, + sal_Int8& nByte, + sal_Int16& nShort, + sal_uInt16& nUShort, + sal_Int32& nLong, + sal_uInt32& nULong, + sal_Int64& nHyper, + sal_uInt64& nUHyper, + float& fFloat, + double& fDouble, + TestEnum& eEnum, + OUString& rStr, + sal_Int8& nByte2, + sal_Int16& nShort2, + css::uno::Reference< css::uno::XInterface >& xTest, + css::uno::Any& rAny, + css::uno::Sequence<TestElement >& rSequence, + ::test::testtools::bridgetest::TestDataElements& rStruct ) +{ + assign( _aData, + bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble, + eEnum, rStr, nByte2, nShort2, xTest, rAny, rSequence ); + _aStructData = rStruct; + + TestElement elem = rSequence[ 0 ]; + rSequence[ 0 ] = rSequence[ 1 ]; + rSequence[ 1 ] = elem; + + return _aStructData; +} + +::test::testtools::bridgetest::TestDataElements Test_Impl::getValues( sal_Bool& bBool, + sal_Unicode& cChar, + sal_Int8& nByte, + sal_Int16& nShort, + sal_uInt16& nUShort, + sal_Int32& nLong, + sal_uInt32& nULong, + sal_Int64& nHyper, + sal_uInt64& nUHyper, + float& fFloat, + double& fDouble, + TestEnum& eEnum, + OUString& rStr, + sal_Int8& nByte2, + sal_Int16& nShort2, + css::uno::Reference< css::uno::XInterface >& xTest, + css::uno::Any& rAny, + css::uno::Sequence<TestElement >& rSequence, + ::test::testtools::bridgetest::TestDataElements& rStruct ) +{ + bBool = _aData.Bool; + cChar = _aData.Char; + nByte = _aData.Byte; + nShort = _aData.Short; + nUShort = _aData.UShort; + nLong = _aData.Long; + nULong = _aData.ULong; + nHyper = _aData.Hyper; + nUHyper = _aData.UHyper; + fFloat = _aData.Float; + fDouble = _aData.Double; + eEnum = _aData.Enum; + rStr = _aData.String; + nByte2 = _aData.Byte2; + nShort2 = _aData.Short2; + xTest = _aData.Interface; + rAny = _aData.Any; + rSequence = _aData.Sequence; + rStruct = _aStructData; + return _aStructData; +} + +::test::testtools::bridgetest::TestDataElements Test_Impl::raiseException( sal_Int16 nArgumentPos, const OUString & rMsg, const Reference< XInterface > & xContext ) +{ + IllegalArgumentException aExc; + aExc.ArgumentPosition = nArgumentPos; + aExc.Message = _aData.String = rMsg; + aExc.Context = _aData.Interface = xContext; + throw aExc; +} + +void Test_Impl::raiseRuntimeExceptionOneway( const OUString & rMsg, const Reference< XInterface > & xContext ) +{ + RuntimeException aExc; + aExc.Message = _aData.String = rMsg; + aExc.Context = _aData.Interface = xContext; + throw aExc; +} + +static void dothrow2(const RuntimeException& e) +{ + throw e; +} +static void dothrow(const RuntimeException& e) +{ +#if defined _MSC_VER + // currently only for MSVC: + // just to test whether all bridges fall back to a RuntimeException + // in case of a thrown non-UNO exception: + try + { + throw ::std::bad_alloc(); + } + catch (...) + { + try + { + Any a( getCaughtException() ); + RuntimeException exc; + OSL_VERIFY( a >>= exc ); + } + catch (...) // never throws anything + { + fprintf( stderr, "\ngetCaughtException() failed!\n" ); + exit( 1 ); + } + } +#endif + dothrow2( e ); +} + +sal_Int32 Test_Impl::getRuntimeException() +{ + try + { + dothrow( RuntimeException( _aData.String, _aData.Interface ) ); + } + catch (Exception &) + { + Any a( getCaughtException() ); + throwException( a ); + } + return 0; // for dummy +} + +void Test_Impl::setRuntimeException( sal_Int32 ) +{ + RuntimeException aExc; + aExc.Message = _aData.String; + aExc.Context = _aData.Interface; + throwException( makeAny( aExc ) ); +} + +// XBridgeTest2 ------------------------------------------------------------- +Sequence< sal_Bool > SAL_CALL Test_Impl::setSequenceBool( + const Sequence< sal_Bool >& aSeq ) +{ + _arBool = aSeq; + return aSeq; +} + +Sequence< sal_Unicode > SAL_CALL Test_Impl::setSequenceChar( + const Sequence< sal_Unicode >& aSeq ) +{ + _arChar = aSeq; + return aSeq; +} + +Sequence< sal_Int8 > SAL_CALL Test_Impl::setSequenceByte( + const Sequence< sal_Int8 >& aSeq ) +{ + _arByte = aSeq; + return aSeq; +} + +Sequence< sal_Int16 > SAL_CALL Test_Impl::setSequenceShort( + const Sequence< sal_Int16 >& aSeq ) +{ + _arShort = aSeq; + return aSeq; +} + +Sequence< sal_uInt16 > SAL_CALL Test_Impl::setSequenceUShort( + const Sequence< sal_uInt16 >& aSeq ) +{ + _arUShort = aSeq; + return aSeq; +} + +Sequence< sal_Int32 > SAL_CALL Test_Impl::setSequenceLong( + const Sequence< sal_Int32 >& aSeq ) +{ + _arLong = aSeq; + return aSeq; +} + +Sequence< sal_uInt32 > SAL_CALL Test_Impl::setSequenceULong( + const Sequence< sal_uInt32 >& aSeq ) +{ + _arULong = aSeq; + return aSeq; +} + +Sequence< sal_Int64 > SAL_CALL Test_Impl::setSequenceHyper( + const Sequence< sal_Int64 >& aSeq ) +{ + _arHyper = aSeq; + return aSeq; +} + +Sequence< sal_uInt64 > SAL_CALL Test_Impl::setSequenceUHyper( + const Sequence< sal_uInt64 >& aSeq ) +{ + _arUHyper = aSeq; + return aSeq; +} + +Sequence< float > SAL_CALL Test_Impl::setSequenceFloat( + const Sequence< float >& aSeq ) +{ + _arFloat = aSeq; + return aSeq; +} + +Sequence< double > SAL_CALL Test_Impl::setSequenceDouble( + const Sequence< double >& aSeq ) +{ + _arDouble = aSeq; + return aSeq; +} + +Sequence< TestEnum > SAL_CALL Test_Impl::setSequenceEnum( + const Sequence< TestEnum >& aSeq ) +{ + _arEnum = aSeq; + return aSeq; +} + +Sequence< OUString > SAL_CALL Test_Impl::setSequenceString( + const Sequence< OUString >& aSeq ) +{ + _arString = aSeq; + return aSeq; +} + +Sequence< Reference< XInterface > > SAL_CALL Test_Impl::setSequenceXInterface( + const Sequence< Reference< XInterface > >& aSeq ) +{ + _arObject = aSeq; + return aSeq; +} + +Sequence<Any > SAL_CALL Test_Impl::setSequenceAny( + const Sequence<Any >& aSeq ) +{ + _arAny = aSeq; + return aSeq; +} + +Sequence<TestElement > SAL_CALL Test_Impl::setSequenceStruct( + const Sequence< TestElement >& aSeq ) +{ + _arStruct = aSeq; + return aSeq; +} + +Sequence< Sequence< sal_Int32 > > SAL_CALL Test_Impl::setDim2( + const Sequence<Sequence< sal_Int32 > >& aSeq ) +{ + _arLong2 = aSeq; + return aSeq; +} + +Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL Test_Impl::setDim3( + const Sequence< Sequence< Sequence< sal_Int32 > > >& aSeq ) +{ + _arLong3 = aSeq; + return aSeq; +} + +void SAL_CALL Test_Impl::setSequencesInOut(Sequence< sal_Bool >& aSeqBoolean, + Sequence< sal_Unicode >& aSeqChar, + Sequence< sal_Int8 >& aSeqByte, + Sequence< sal_Int16 >& aSeqShort, + Sequence< sal_uInt16 >& aSeqUShort, + Sequence< sal_Int32 >& aSeqLong, + Sequence< sal_uInt32 >& aSeqULong, + Sequence< sal_Int64 >& aSeqHyper, + Sequence< sal_uInt64 >& aSeqUHyper, + Sequence< float >& aSeqFloat, + Sequence< double >& aSeqDouble, + Sequence< TestEnum >& aSeqTestEnum, + Sequence< OUString >& aSeqString, + Sequence<Reference<XInterface > >& aSeqXInterface, + Sequence< Any >& aSeqAny, + Sequence< Sequence< sal_Int32 > >& aSeqDim2, + Sequence< Sequence< Sequence< sal_Int32 > > >& aSeqDim3 ) +{ + _arBool = aSeqBoolean; + _arChar = aSeqChar; + _arByte = aSeqByte; + _arShort = aSeqShort; + _arUShort = aSeqUShort; + _arLong = aSeqLong; + _arULong = aSeqULong; + _arHyper = aSeqHyper; + _arUHyper = aSeqUHyper; + _arFloat = aSeqFloat; + _arDouble = aSeqDouble; + _arEnum = aSeqTestEnum; + _arString = aSeqString; + _arObject = aSeqXInterface; + _arAny = aSeqAny; + _arLong2 = aSeqDim2; + _arLong3 = aSeqDim3; +} + +void SAL_CALL Test_Impl::setSequencesOut( Sequence< sal_Bool >& aSeqBoolean, + Sequence< sal_Unicode >& aSeqChar, + Sequence< sal_Int8 >& aSeqByte, + Sequence< sal_Int16 >& aSeqShort, + Sequence< sal_uInt16 >& aSeqUShort, + Sequence< sal_Int32 >& aSeqLong, + Sequence< sal_uInt32 >& aSeqULong, + Sequence< sal_Int64 >& aSeqHyper, + Sequence< sal_uInt64 >& aSeqUHyper, + Sequence< float >& aSeqFloat, + Sequence< double >& aSeqDouble, + Sequence< TestEnum >& aSeqEnum, + Sequence< OUString >& aSeqString, + Sequence< Reference< XInterface > >& aSeqXInterface, + Sequence< Any >& aSeqAny, + Sequence< Sequence< sal_Int32 > >& aSeqDim2, + Sequence< Sequence< Sequence< sal_Int32 > > >& aSeqDim3 ) +{ + aSeqBoolean = _arBool; + aSeqChar = _arChar; + aSeqByte = _arByte; + aSeqShort = _arShort; + aSeqUShort = _arUShort; + aSeqLong = _arLong; + aSeqULong = _arULong; + aSeqHyper = _arHyper; + aSeqUHyper = _arUHyper; + aSeqFloat = _arFloat; + aSeqDouble = _arDouble; + aSeqEnum = _arEnum; + aSeqString = _arString; + aSeqXInterface = _arObject; + aSeqAny = _arAny; + aSeqDim2 = _arLong2; + aSeqDim3 = _arLong3; +} + +void Test_Impl::testConstructorsService( + Reference< XComponentContext > const & context) +{ + Sequence< sal_Bool > arg14(1); arg14[0] = true; + Sequence< sal_Int8 > arg15(1); arg15[0] = SAL_MIN_INT8; + Sequence< sal_Int16 > arg16(1); arg16[0] = SAL_MIN_INT16; + Sequence< sal_uInt16 > arg17(1); arg17[0] = SAL_MAX_UINT16; + Sequence< sal_Int32 > arg18(1); arg18[0] = SAL_MIN_INT32; + Sequence< sal_uInt32 > arg19(1); arg19[0] = SAL_MAX_UINT32; + Sequence< sal_Int64 > arg20(1); arg20[0] = SAL_MIN_INT64; + Sequence< sal_uInt64 > arg21(1); arg21[0] = SAL_MAX_UINT64; + Sequence< float > arg22(1); arg22[0] = 0.123f; + Sequence< double > arg23(1); arg23[0] = 0.456; + Sequence< sal_Unicode > arg24(1); arg24[0] = 'X'; + Sequence< OUString > arg25 { "test" }; + Sequence< Type > arg26(1); arg26[0] = UnoType< Any >::get(); + Sequence< Any > arg27(1); arg27[0] <<= true; + Sequence< Sequence< sal_Bool > > arg28(1); + arg28[0] = Sequence< sal_Bool >(1); arg28[0][0] = true; + Sequence< Sequence< Any > > arg29(1); arg29[0] = Sequence< Any >(1); + arg29[0][0] <<= true; + Sequence< TestEnum > arg30(1); arg30[0] = TestEnum_TWO; + Sequence< TestStruct > arg31(1); arg31[0].member = 10; + Sequence< TestPolyStruct< sal_Bool > > arg32(1); arg32[0].member = true; + Sequence< TestPolyStruct< Any > > arg33(1); arg33[0].member <<= true; + Sequence< Reference< XInterface > > arg34(1); + Constructors::create1(context, + true, + SAL_MIN_INT8, + SAL_MIN_INT16, + SAL_MAX_UINT16, + SAL_MIN_INT32, + SAL_MAX_UINT32, + SAL_MIN_INT64, + SAL_MAX_UINT64, + 0.123f, + 0.456, + 'X', + "test", + UnoType< Any >::get(), + makeAny(true), + arg14, + arg15, + arg16, + arg17, + arg18, + arg19, + arg20, + arg21, + arg22, + arg23, + arg24, + arg25, + arg26, + arg27, + arg28, + arg29, + arg30, + arg31, + arg32, + arg33, + arg34, + TestEnum_TWO, + TestStruct(10), + TestPolyStruct< sal_Bool >(true), + TestPolyStruct< Any >(makeAny(true)), + Reference< XInterface >(nullptr)); + Sequence< Any > args(40); + args[0] <<= true; + args[1] <<= SAL_MIN_INT8; + args[2] <<= SAL_MIN_INT16; + args[3] <<= SAL_MAX_UINT16; + args[4] <<= SAL_MIN_INT32; + args[5] <<= SAL_MAX_UINT32; + args[6] <<= SAL_MIN_INT64; + args[7] <<= SAL_MAX_UINT64; + args[8] <<= 0.123f; + args[9] <<= 0.456; + args[10] <<= u'X'; + args[11] <<= OUString("test"); + args[12] <<= UnoType< Any >::get(); + args[13] <<= true; + args[14] <<= arg14; + args[15] <<= arg15; + args[16] <<= arg16; + args[17] <<= arg17; + args[18] <<= arg18; + args[19] <<= arg19; + args[20] <<= arg20; + args[21] <<= arg21; + args[22] <<= arg22; + args[23] <<= arg23; + args[24] <<= arg24; + args[25] <<= arg25; + args[26] <<= arg26; + args[27] <<= arg27; + args[28] <<= arg28; + args[29] <<= arg29; + args[30] <<= arg30; + args[31] <<= arg31; + args[32] <<= arg32; + args[33] <<= arg33; + args[34] <<= arg34; + args[35] <<= TestEnum_TWO; + args[36] <<= TestStruct(10); + args[37] <<= TestPolyStruct< sal_Bool >(true); + args[38] <<= TestPolyStruct< Any >(makeAny(true)); + args[39] <<= Reference< XInterface >(nullptr); + Constructors::create2(context, args); + + Sequence<Type> argSeq1(1); argSeq1[0] = cppu::UnoType<sal_Int32>::get(); + Sequence<Reference<XInterface> > argSeq2 { static_cast<XComponent*>(new Dummy()) }; + Sequence<Reference<XComponent> > argSeq2a { static_cast<XComponent*>(new Dummy()) }; + + Sequence<TestPolyStruct2<sal_Unicode, Sequence<Any> > > argSeq3(1); + argSeq3[0] = TestPolyStruct2<sal_Unicode, Sequence<Any> >('X', arg27); + Sequence<TestPolyStruct2<TestPolyStruct<sal_Unicode>, Sequence<Any> > > argSeq4(1); + argSeq4[0] = TestPolyStruct2<TestPolyStruct<sal_Unicode>, Sequence<Any> >( + TestPolyStruct<sal_Unicode>('X'), arg27); + Sequence<Sequence<sal_Int32> > argSeq5(1); + argSeq5[0] = Sequence<sal_Int32>(1); argSeq5[0][0] = SAL_MIN_INT32; + Sequence<TestPolyStruct<sal_Int32> > argSeq6(1); + argSeq6[0] = TestPolyStruct<sal_Int32>(SAL_MIN_INT32); + Sequence<TestPolyStruct<TestPolyStruct2<sal_Unicode, Any> > > argSeq7(1); + argSeq7[0] = TestPolyStruct<TestPolyStruct2<sal_Unicode, Any> >( + TestPolyStruct2<sal_Unicode, Any>('X', Any(true))); + Sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString> > > argSeq8(1); + argSeq8[0] = TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString> > ( + TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString>( + TestPolyStruct2<sal_Unicode, Any>('X', Any(true)), OUString("test"))); + Sequence<TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > > > argSeq9(1); + argSeq9[0] = TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > >( + OUString("test"), TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> >( + 'X', TestPolyStruct<Any>(Any(true)))); + Sequence<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>, TestPolyStruct<sal_Unicode> > > argSeq10(1); + argSeq10[0] = TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>, TestPolyStruct<sal_Unicode> >( + TestPolyStruct2<sal_Unicode, Any>('X', Any(true)), TestPolyStruct<sal_Unicode>('X')); + Sequence<Sequence<TestPolyStruct<sal_Unicode > > > argSeq11(1); + argSeq11[0] = Sequence<TestPolyStruct<sal_Unicode > >(1); + argSeq11[0][0] = TestPolyStruct<sal_Unicode>('X'); + Sequence<Sequence<TestPolyStruct<TestPolyStruct2<sal_Unicode,Any> > > > argSeq12(1); + argSeq12[0] = Sequence<TestPolyStruct<TestPolyStruct2<sal_Unicode,Any> > >(1); + argSeq12[0][0] = TestPolyStruct<TestPolyStruct2<sal_Unicode,Any> >( + TestPolyStruct2<sal_Unicode,Any>('X', Any(true))); + Sequence<Sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString> > > > argSeq13(1); + argSeq13[0] = Sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString> > >(1); + argSeq13[0][0] = TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString> >( + TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString>( + TestPolyStruct2<sal_Unicode,Any>('X', Any(true)), OUString("test"))); + Sequence<Sequence<TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > > > > argSeq14(1); + argSeq14[0] = Sequence<TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > > >(1); + argSeq14[0][0] = TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > >( + OUString("test"), TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> >( + 'X', TestPolyStruct<Any>(Any(true)))); + Sequence<Sequence<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>, TestPolyStruct<sal_Unicode> > > > argSeq15(1); + argSeq15[0] = Sequence<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>, TestPolyStruct<sal_Unicode> > >(1); + argSeq15[0][0] = TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>, TestPolyStruct<sal_Unicode> >( + TestPolyStruct2<sal_Unicode,Any>('X',Any(true)), TestPolyStruct<sal_Unicode>('X')); + + Constructors2::create1( + context, + TestPolyStruct<Type>(cppu::UnoType<sal_Int32>::get()), + TestPolyStruct<Any>(Any(true)), + TestPolyStruct<sal_Bool>(true), + TestPolyStruct<sal_Int8>(SAL_MIN_INT8), + TestPolyStruct<sal_Int16>(SAL_MIN_INT16), + TestPolyStruct<sal_Int32>(SAL_MIN_INT32), + TestPolyStruct<sal_Int64>(SAL_MIN_INT64), + TestPolyStruct<sal_Unicode>('X'), + TestPolyStruct<OUString>(OUString("test")), + TestPolyStruct<float>(0.123f), + TestPolyStruct<double>(0.456), + TestPolyStruct<Reference<XInterface> >(static_cast<XBridgeTest2*>(this)), + TestPolyStruct<Reference<XComponent> >(static_cast<XComponent*>(new Dummy())), + TestPolyStruct<TestEnum>(TestEnum_TWO), + TestPolyStruct<TestPolyStruct2<sal_Unicode, Any> >( + TestPolyStruct2<sal_Unicode, Any>('X', Any(true))), + TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString> > ( + TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString>( + TestPolyStruct2<sal_Unicode, Any>('X', Any(true)), OUString("test"))), + TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode,TestPolyStruct<Any> > >( + OUString("test"), + TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> >('X', TestPolyStruct<Any>(Any(true)))), + TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>, TestPolyStruct<sal_Unicode> >( + TestPolyStruct2<sal_Unicode, Any>('X', Any(true)), + TestPolyStruct<sal_Unicode>('X')), + TestPolyStruct<Sequence<Type> >(argSeq1), + TestPolyStruct<Sequence<Any> >(arg27), + TestPolyStruct<Sequence<sal_Bool> >(arg14), + TestPolyStruct<Sequence<sal_Int8> >(arg15), + TestPolyStruct<Sequence<sal_Int16> >(arg16), + TestPolyStruct<Sequence<sal_Int32> >(arg18), + TestPolyStruct<Sequence<sal_Int64> >(arg20), + TestPolyStruct<Sequence<sal_Unicode> >(arg24), + TestPolyStruct<Sequence<OUString> >(arg25), + TestPolyStruct<Sequence<float> >(arg22), + TestPolyStruct<Sequence<double> >(arg23), + TestPolyStruct<Sequence<Reference<XInterface> > >(argSeq2), + TestPolyStruct<Sequence<Reference<XComponent> > >(argSeq2a), + TestPolyStruct<Sequence<TestEnum> >(arg30), + TestPolyStruct<Sequence<TestPolyStruct2<sal_Unicode, Sequence<Any> > > >(argSeq3), + TestPolyStruct<Sequence<TestPolyStruct2<TestPolyStruct<sal_Unicode>, Sequence<Any> > > > (argSeq4), + TestPolyStruct<Sequence<Sequence<sal_Int32> > >(argSeq5), + argSeq6, + argSeq7, + argSeq8, + argSeq9, + argSeq10, + argSeq11, + argSeq12, + argSeq13, + argSeq14, + argSeq15); +} + +Reference< XCurrentContextChecker > Test_Impl::getCurrentContextChecker() +{ + return new testtools::bridgetest::CurrentContextChecker; +} + +// XServiceInfo + +OUString Test_Impl::getImplementationName() +{ + return IMPLNAME; +} + +sal_Bool Test_Impl::supportsService( const OUString & rServiceName ) +{ + return cppu::supportsService(this, rServiceName); +} + +Sequence< OUString > Test_Impl::getSupportedServiceNames() +{ + return bridge_object::getSupportedServiceNames(); +} + + +static Reference< XInterface > Test_Impl_create( + SAL_UNUSED_PARAMETER const Reference< XMultiServiceFactory > & ) +{ + return Reference< XInterface >( static_cast<XBridgeTest *>(new Test_Impl()) ); +} + +} + +extern "C" +{ +SAL_DLLPUBLIC_EXPORT void * component_getFactory( + const char * pImplName, SAL_UNUSED_PARAMETER void * pServiceManager, + SAL_UNUSED_PARAMETER void * ) +{ + void * pRet = nullptr; + + if (pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0) + { + Reference< XSingleServiceFactory > xFactory( createSingleFactory( + static_cast< XMultiServiceFactory * >( pServiceManager ), + IMPLNAME, + bridge_object::Test_Impl_create, + bridge_object::getSupportedServiceNames() ) ); + + if (xFactory.is()) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + } + + return pRet; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/bridgetest/currentcontextchecker.cxx b/testtools/source/bridgetest/currentcontextchecker.cxx new file mode 100644 index 000000000..27de3c5e7 --- /dev/null +++ b/testtools/source/bridgetest/currentcontextchecker.cxx @@ -0,0 +1,108 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + + +#include <sal/config.h> + +#include "currentcontextchecker.hxx" + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/uno/XCurrentContext.hpp> +#include <cppu/unotype.hxx> +#include <cppuhelper/implbase.hxx> +#include <osl/diagnose.h> +#include <osl/diagnose.hxx> +#include <rtl/string.h> +#include <rtl/ustring.hxx> +#include <sal/types.h> +#include <test/testtools/bridgetest/XCurrentContextChecker.hpp> +#include <uno/current_context.hxx> + +namespace { + +static char const KEY[] = "testtools.bridgetest.Key"; +static char const VALUE[] = "good"; + +class CurrentContext: + public ::osl::DebugBase< CurrentContext >, + public ::cppu::WeakImplHelper< css::uno::XCurrentContext > +{ +public: + CurrentContext(); + + CurrentContext(const CurrentContext&) = delete; + CurrentContext& operator=(const CurrentContext&) = delete; + + virtual css::uno::Any SAL_CALL getValueByName(OUString const & Name) override; +}; + +CurrentContext::CurrentContext() {} + +css::uno::Any CurrentContext::getValueByName(OUString const & Name) +{ + return Name == KEY ? css::uno::makeAny(OUString(VALUE)) : css::uno::Any(); +} + +} + +testtools::bridgetest::CurrentContextChecker::CurrentContextChecker() {} + +testtools::bridgetest::CurrentContextChecker::~CurrentContextChecker() {} + +sal_Bool testtools::bridgetest::CurrentContextChecker::perform( + css::uno::Reference< + ::test::testtools::bridgetest::XCurrentContextChecker > const & other, + ::sal_Int32 setSteps, ::sal_Int32 checkSteps) +{ + if (setSteps == 0) { + css::uno::ContextLayer layer(new CurrentContext); + return performCheck(other, setSteps, checkSteps); + } else { + return performCheck(other, setSteps, checkSteps); + } +} + +bool testtools::bridgetest::CurrentContextChecker::performCheck( + css::uno::Reference< + ::test::testtools::bridgetest::XCurrentContextChecker > const & other, + ::sal_Int32 setSteps, ::sal_Int32 checkSteps) +{ + OSL_ASSERT(other.is() && checkSteps >= 0); + if (checkSteps == 0) { + css::uno::Reference< css::uno::XCurrentContext > context( + css::uno::getCurrentContext()); + if (!context.is()) { + return false; + } + css::uno::Any a(context->getValueByName(KEY)); + if (a.getValueType() != ::cppu::UnoType< OUString >::get()) { + return false; + } + OUString s; + OSL_VERIFY(a >>= s); + return s == VALUE; + } else { + return other->perform( + this, setSteps >= 0 ? setSteps - 1 : -1, checkSteps - 1); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/bridgetest/currentcontextchecker.hxx b/testtools/source/bridgetest/currentcontextchecker.hxx new file mode 100644 index 000000000..36ad5d6d0 --- /dev/null +++ b/testtools/source/bridgetest/currentcontextchecker.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_TESTTOOLS_SOURCE_BRIDGETEST_CURRENTCONTEXTCHECKER_HXX +#define INCLUDED_TESTTOOLS_SOURCE_BRIDGETEST_CURRENTCONTEXTCHECKER_HXX + +#include <sal/config.h> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <cppuhelper/implbase.hxx> +#include <osl/diagnose.hxx> +#include <sal/types.h> +#include <test/testtools/bridgetest/XCurrentContextChecker.hpp> + +#include "dllapi.hxx" + +namespace testtools::bridgetest { + +class LO_DLLPUBLIC_TESTTOOLS CurrentContextChecker : + public ::osl::DebugBase< CurrentContextChecker >, + public ::cppu::WeakImplHelper< + ::test::testtools::bridgetest::XCurrentContextChecker > +{ +public: + CurrentContextChecker(); + + virtual ~CurrentContextChecker() override; + + virtual sal_Bool SAL_CALL perform( + css::uno::Reference< ::test::testtools::bridgetest::XCurrentContextChecker > const & other, + ::sal_Int32 setSteps, ::sal_Int32 checkSteps) override; + +private: + CurrentContextChecker(CurrentContextChecker const &) = delete; + void operator =(CurrentContextChecker const &) = delete; + + SAL_DLLPRIVATE bool performCheck( + css::uno::Reference< ::test::testtools::bridgetest::XCurrentContextChecker > const & other, + ::sal_Int32 setSteps, ::sal_Int32 checkSteps); +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/bridgetest/dllapi.hxx b/testtools/source/bridgetest/dllapi.hxx new file mode 100644 index 000000000..8777a934a --- /dev/null +++ b/testtools/source/bridgetest/dllapi.hxx @@ -0,0 +1,25 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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_TESTTOOLS_SOURCE_BRIDGETEST_DLLAPI_HXX +#define INCLUDED_TESTTOOLS_SOURCE_BRIDGETEST_DLLAPI_HXX + +#include <sal/config.h> + +#include <sal/types.h> + +#if defined LO_DLLIMPLEMENTATION_TESTTOOLS +#define LO_DLLPUBLIC_TESTTOOLS SAL_DLLPUBLIC_EXPORT +#else +#define LO_DLLPUBLIC_TESTTOOLS SAL_DLLPUBLIC_IMPORT +#endif + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/testtools/source/bridgetest/idl/bridgetest.idl b/testtools/source/bridgetest/idl/bridgetest.idl new file mode 100644 index 000000000..b40d46d07 --- /dev/null +++ b/testtools/source/bridgetest/idl/bridgetest.idl @@ -0,0 +1,634 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#include <com/sun/star/lang/IllegalArgumentException.idl> +#include <com/sun/star/lang/XComponent.idl> +#include <com/sun/star/uno/XComponentContext.idl> +#include <com/sun/star/uno/XInterface.idl> + +module test { module testtools { module bridgetest { + +enum TestEnum +{ + TEST, + ONE, + TWO, + CHECK, + LOLA, + PALOO, + ZA +}; + +enum TestBadEnum { M = 1 }; + +struct TestStruct +{ + long member; +}; + +/** + * simple types + */ +struct TestSimple +{ + boolean Bool; + char Char; + byte Byte; + byte Byte2; + short Short; + short Short2; + unsigned short UShort; + long Long; + unsigned long ULong; + hyper Hyper; + unsigned hyper UHyper; + float Float; + double Double; + TestEnum Enum; +}; +/** + * equal to max size returned in registers on x86_64 + */ +struct SmallStruct +{ + hyper a; + hyper b; +}; +/** + * equal to max size returned in registers on ia64 + */ +struct MediumStruct +{ + hyper a; + hyper b; + hyper c; + hyper d; +}; +/** + * bigger than max size returned in registers on ia64 + */ +struct BigStruct +{ + hyper a; + hyper b; + hyper c; + hyper d; + hyper e; + hyper f; + hyper g; + hyper h; +}; +/** + * two floats, BSDs/MacOSX on intel handle returning small + * structs differently than Linux + */ +struct TwoFloats +{ + float a; + float b; +}; +/** + * all floats, ia64 handles them specially + */ +struct FourFloats +{ + float a; + float b; + float c; + float d; +}; +/** + * Small struct with mixed float and integers. + * Should return in registers on BSDs/MACOSx + */ +struct MixedFloatAndInteger +{ + float a; + long b; +}; +/** + * Small struct with three bytes. Should *not* return in registers on + * BSDs/MACOSx + */ +struct ThreeByteStruct +{ + byte a; + byte b; + byte c; +}; +/** + * complex types adding string, interface, any + */ +struct TestElement : TestSimple +{ + string String; + com::sun::star::uno::XInterface Interface; + any Any; +}; +/** + * adding even more complexity, sequence< TestElement > + */ +struct TestDataElements : TestElement +{ + sequence< TestElement > Sequence; +}; + +/** + * typedef used in interface + */ +typedef TestDataElements TestData; + +struct TestPolyStruct<T> { T member; }; +struct TestPolyStruct2<T,C> { + T member1; + C member2; +}; + +interface XRecursiveCall : com::sun::star::uno::XInterface +{ + /*** + * @param nToCall If nToCall is 0, the method returns immediately. + * Otherwise, call the given interface with nToCall -1 + * + ***/ + void callRecursivly( [in] XRecursiveCall xCall , [in] long nToCall ); +}; + +interface XMultiBase1 { + [attribute] double att1; // initially 0.0 + long fn11([in] long arg); // return 11 * arg + string fn12([in] string arg); // return "12" + arg +}; + +interface XMultiBase2: XMultiBase1 { + long fn21([in] long arg); // return 21 * arg + string fn22([in] string arg); // return "22" + arg +}; + +interface XMultiBase3 { + [attribute] double att3; // initially 0.0 + long fn31([in] long arg); // return 31 * arg + string fn32([in] string arg); // return "32" + arg + long fn33(); // return 33 +}; + +interface XMultiBase3a: XMultiBase3 {}; + +interface XMultiBase4 { + long fn41([in] long arg); // return 41 * arg +}; + +interface XMultiBase5 { + interface XMultiBase3; + interface XMultiBase4; + interface XMultiBase1; +}; + +interface XMultiBase6 { + interface XMultiBase2; + interface XMultiBase3a; + interface XMultiBase5; + long fn61([in] long arg); // return 61 * arg + string fn62([in] string arg); // return "62" + arg +}; + +interface XMultiBase7 { + long fn71([in] long arg); // return 71 * arg + string fn72([in] string arg); // return "72" + arg + long fn73(); // return 73 +}; + +interface XMulti { + interface XMultiBase6; + interface XMultiBase7; +}; + +/** + * Monster test interface to test bridge calls. + * An implementation of this object has to store given values and return whenever there + * is an out param or return value. + */ +interface XBridgeTestBase : com::sun::star::uno::XInterface +{ + /** + * in parameter test, tests by calls reference also (complex types) + */ + void setValues( [in] boolean bBool, + [in] char cChar, + [in] byte nByte, + [in] short nShort, + [in] unsigned short nUShort, + [in] long nLong, + [in] unsigned long nULong, + [in] hyper nHyper, + [in] unsigned hyper nUHyper, + [in] float fFloat, + [in] double fDouble, + [in] TestEnum eEnum, + [in] string aString, + [in] byte aByte2, + [in] short aShort2, + [in] com::sun::star::uno::XInterface xInterface, + [in] any aAny, + [in] sequence< TestElement > aSequence, + [in] TestData aStruct ); + /** + * inout parameter test + * + * @return aStruct. The out parameter contain the values, that were previously set + * by setValues or (if not called before) default constructed values. + * + */ + TestData setValues2( [inout] boolean bBool, + [inout] char cChar, + [inout] byte nByte, + [inout] short nShort, + [inout] unsigned short nUShort, + [inout] long nLong, + [inout] unsigned long nULong, + [inout] hyper nHyper, + [inout] unsigned hyper nUHyper, + [inout] float fFloat, + [inout] double fDouble, + [inout] TestEnum eEnum, + [inout] string aString, + [inout] byte aByte2, + [inout] short aShort2, + [inout] com::sun::star::uno::XInterface xInterface, + [inout] any aAny, + [inout] sequence< TestElement > aSequence, + [inout] TestData aStruct ); + + /** + * out parameter test + */ + TestData getValues( [out] boolean bBool, + [out] char cChar, + [out] byte nByte, + [out] short nShort, + [out] unsigned short nUShort, + [out] long nLong, + [out] unsigned long nULong, + [out] hyper nHyper, + [out] unsigned hyper nUHyper, + [out] float fFloat, + [out] double fDouble, + [out] TestEnum eEnum, + [out] string aString, + [out] byte aByte2, + [out] short aShort2, + [out] com::sun::star::uno::XInterface xInterface, + [out] any aAny, + [out] sequence< TestElement > aSequence, + [out] TestData aStruct ); + + /** + * register return test 1 + */ + SmallStruct echoSmallStruct( [in] SmallStruct aStruct ); + + /** + * register return test 2 + */ + MediumStruct echoMediumStruct( [in] MediumStruct aStruct ); + + /** + * register return test 3 + */ + BigStruct echoBigStruct( [in] BigStruct aStruct ); + + /** + * register return test 4 + */ + TwoFloats echoTwoFloats( [in] TwoFloats aStruct ); + + /** + * register return test 5 + */ + FourFloats echoFourFloats( [in] FourFloats aStruct ); + + /** + * register return test 6 + */ + MixedFloatAndInteger echoMixedFloatAndInteger( [in] MixedFloatAndInteger aStruct ); + + /** + * register return test 7 + */ + ThreeByteStruct echoThreeByteStruct( [in] ThreeByteStruct aStruct ); + + /** + * PPC Alignment test (#i107182#) + */ + long testPPCAlignment( [in] hyper l1, [in] hyper l2, [in] long i1, [in] hyper l3, [in] long i2 ); + + /** + * PPC64 Alignment test + */ + long testPPC64Alignment( [in] double d1, [in] double d2, [in] double d3, [in] long i1 ); + + + /** + * VFP ABI (armhf) doubles test + */ + double testTenDoubles( [in] double d1, [in] double d2, [in] double d3, [in] double d4, [in] double d5, [in] double d6, [in] double d7, [in] double d8, [in] double d9, [in] double d10 ); + + [attribute] boolean Bool; + [attribute] byte Byte; + [attribute] char Char; + [attribute] short Short; + [attribute] unsigned short UShort; + [attribute] long Long; + [attribute] unsigned long ULong; + [attribute] hyper Hyper; + [attribute] unsigned hyper UHyper; + [attribute] float Float; + [attribute] double Double; + [attribute] TestEnum Enum; + [attribute] string String; + [attribute] byte Byte2; + [attribute] short Short2; + [attribute] com::sun::star::uno::XInterface Interface; + [attribute] any Any; + [attribute] sequence< TestElement > Sequence; + [attribute] TestData Struct; + + [attribute] long RaiseAttr1 { + set raises (com::sun::star::lang::IllegalArgumentException); + }; + [attribute, readonly] long RaiseAttr2 { + get raises (com::sun::star::lang::IllegalArgumentException); + }; + + TestPolyStruct<boolean> transportPolyBoolean( + [in] TestPolyStruct<boolean> arg); + void transportPolyHyper([inout] TestPolyStruct<hyper> arg); + void transportPolySequence( + [in] TestPolyStruct<sequence<any> > arg1, + [out] TestPolyStruct<sequence<any> > arg2); + + TestPolyStruct<long> getNullPolyLong(); + TestPolyStruct<string> getNullPolyString(); + TestPolyStruct<type> getNullPolyType(); + TestPolyStruct<any> getNullPolyAny(); + TestPolyStruct<sequence<boolean> > getNullPolySequence(); + TestPolyStruct<TestEnum> getNullPolyEnum(); + TestPolyStruct<TestBadEnum> getNullPolyBadEnum(); + TestPolyStruct<TestStruct> getNullPolyStruct(); + TestPolyStruct<XBridgeTestBase> getNullPolyInterface(); + + /*** + * This method returns the parameter value. + * Method to extensively test anys. + ****/ + any transportAny( [in] any value ); + + /*** + * methods to check sequence of calls. Call call() and callOneway + * in an arbitrary sequence. Increase the callId for every call. + * The testobject sets an error flag. + + @see testSequencePassed + ***/ + void call( [in] long nCallId, [in] long nWaitMUSEC ); + void callOneway( [in] long nCallId, [in] long nWaitMUSEC ); + boolean sequenceOfCallTestPassed(); + + /**** + * methods to check, if threads thread identity is holded. + * + ***/ + void startRecursiveCall( [in] XRecursiveCall xCall , [in] long nToCall ); + + XMulti getMulti(); + string testMulti([in] XMulti multi); +}; + + +/** + * Inheriting from monster; adds raiseException(), attribute raising RuntimeException. + */ +interface XBridgeTest : XBridgeTestBase +{ + /** + * the exception struct returned has to be filled with given arguments. + * return value is for dummy. + */ + TestData raiseException( [in] short ArgumentPosition, + [in] string Message, + [in] com::sun::star::uno::XInterface Context ) + raises( com::sun::star::lang::IllegalArgumentException ); + + + /** + * Throws runtime exception. + * check remote bridges handle exceptions during oneway calls properly. + * Note that on client side the exception may fly or not. When it flies, it should + * have the proper message and context. + ***/ + void raiseRuntimeExceptionOneway( [in] string Message, + [in] com::sun::star::uno::XInterface Context ); + + /** + * raises runtime exception; + * the exception struct returned has to be filled with formerly set test data. + */ + [attribute] long RuntimeException; +}; + + +exception BadConstructorArguments: com::sun::star::uno::Exception {}; + +service Constructors: com::sun::star::uno::XInterface { + create1( + [in] boolean arg0, + [in] byte arg1, + [in] short arg2, + [in] unsigned short arg3, + [in] long arg4, + [in] unsigned long arg5, + [in] hyper arg6, + [in] unsigned hyper arg7, + [in] float arg8, + [in] double arg9, + [in] char arg10, + [in] string arg11, + [in] type arg12, + [in] any arg13, + [in] sequence< boolean > arg14, + [in] sequence< byte > arg15, + [in] sequence< short > arg16, + [in] sequence< unsigned short > arg17, + [in] sequence< long > arg18, + [in] sequence< unsigned long > arg19, + [in] sequence< hyper > arg20, + [in] sequence< unsigned hyper > arg21, + [in] sequence< float > arg22, + [in] sequence< double > arg23, + [in] sequence< char > arg24, + [in] sequence< string > arg25, + [in] sequence< type > arg26, + [in] sequence< any > arg27, + [in] sequence< sequence< boolean > > arg28, + [in] sequence< sequence< any > > arg29, + [in] sequence< TestEnum > arg30, + [in] sequence< TestStruct > arg31, + [in] sequence< TestPolyStruct< boolean > > arg32, + [in] sequence< TestPolyStruct< any > > arg33, + [in] sequence< com::sun::star::uno::XInterface > arg34, + [in] TestEnum arg35, + [in] TestStruct arg36, + [in] TestPolyStruct< boolean > arg37, + [in] TestPolyStruct< any > arg38, + [in] com::sun::star::uno::XInterface arg39) + raises (BadConstructorArguments); + + create2([in] any... args) raises (BadConstructorArguments); + +}; + +service Constructors2: XMultiBase1 { + + create1( + [in] TestPolyStruct<type> arg1, + [in] TestPolyStruct<any> arg2, + [in] TestPolyStruct<boolean> arg3, + [in] TestPolyStruct<byte> arg4, + [in] TestPolyStruct<short> arg5, + [in] TestPolyStruct<long> arg6, + [in] TestPolyStruct<hyper> arg7, + [in] TestPolyStruct<char> arg8, + [in] TestPolyStruct<string> arg9, + [in] TestPolyStruct<float> arg10, + [in] TestPolyStruct<double> arg11, + [in] TestPolyStruct<com::sun::star::uno::XInterface> arg12, + [in] TestPolyStruct<com::sun::star::lang::XComponent> arg13, + [in] TestPolyStruct<TestEnum> arg14, + [in] TestPolyStruct<TestPolyStruct2<char,any> > arg15, + [in] TestPolyStruct<TestPolyStruct2<TestPolyStruct2<char,any>,string> > arg16, + [in] TestPolyStruct2<string, TestPolyStruct2<char, TestPolyStruct<any> > > arg17, + [in] TestPolyStruct2<TestPolyStruct2<char,any>, TestPolyStruct<char> > arg18, + [in] TestPolyStruct<sequence<type> > arg19, + [in] TestPolyStruct<sequence<any> > arg20, + [in] TestPolyStruct<sequence<boolean> > arg21, + [in] TestPolyStruct<sequence<byte> > arg22, + [in] TestPolyStruct<sequence<short> > arg23, + [in] TestPolyStruct<sequence<long> > arg24, + [in] TestPolyStruct<sequence<hyper> > arg25, + [in] TestPolyStruct<sequence<char> > arg26, + [in] TestPolyStruct<sequence<string> > arg27, + [in] TestPolyStruct<sequence<float> > arg28, + [in] TestPolyStruct<sequence<double> > arg29, + [in] TestPolyStruct<sequence<com::sun::star::uno::XInterface> > arg30, + [in] TestPolyStruct<sequence<com::sun::star::lang::XComponent> > arg31, + [in] TestPolyStruct<sequence<TestEnum> > arg32, + [in] TestPolyStruct<sequence<TestPolyStruct2<char, sequence<any> > > > arg33, + [in] TestPolyStruct<sequence<TestPolyStruct2<TestPolyStruct<char>, sequence<any> > > > arg34, + [in] TestPolyStruct<sequence<sequence<long> > > arg35, + [in] sequence<TestPolyStruct<long > > arg36, + [in] sequence<TestPolyStruct<TestPolyStruct2<char,any> > > arg37, + [in] sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<char,any>,string> > > arg38, + [in] sequence<TestPolyStruct2<string, TestPolyStruct2<char, TestPolyStruct<any> > > > arg39, + [in] sequence<TestPolyStruct2<TestPolyStruct2<char,any>, TestPolyStruct<char> > > arg40, + [in] sequence<sequence<TestPolyStruct< char > > > arg41, + [in] sequence<sequence<TestPolyStruct<TestPolyStruct2<char,any> > > >arg42, + [in] sequence<sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<char,any>,string> > > > arg43, + [in] sequence<sequence<TestPolyStruct2<string, TestPolyStruct2<char, TestPolyStruct<any> > > > > arg44, + [in] sequence<sequence<TestPolyStruct2<TestPolyStruct2<char,any>, TestPolyStruct<char> > > > arg45 + ); +}; + +interface XCurrentContextChecker { + boolean perform( + [in] XCurrentContextChecker other, [in] long setSteps, + [in] long checkSteps); +}; + +/** Extended tests with sequences. + */ +interface XBridgeTest2 : XBridgeTest +{ + sequence< boolean > setSequenceBool( [in] sequence< boolean > aSeq); + sequence< char > setSequenceChar( [in] sequence< char > aSeq); + sequence< byte> setSequenceByte( [in] sequence< byte > aSeq); + sequence< short> setSequenceShort( [in] sequence< short > aSeq); + sequence< unsigned short > setSequenceUShort( [in] sequence< unsigned short > aSeq); + sequence< long > setSequenceLong( [in] sequence< long > aSeq); + sequence< unsigned long > setSequenceULong( [in] sequence< unsigned long > aSeq); + sequence< hyper > setSequenceHyper( [in] sequence< hyper > aSeq); + sequence< unsigned hyper > setSequenceUHyper( [in] sequence< unsigned hyper > aSeq); + sequence< float > setSequenceFloat( [in] sequence< float > aSeq); + sequence< double > setSequenceDouble( [in] sequence< double > aSeq); + sequence< TestEnum > setSequenceEnum( [in] sequence< TestEnum > aSeq); + sequence< string > setSequenceString( [in] sequence< string > aString); + sequence< com::sun::star::uno::XInterface > setSequenceXInterface( + [in] sequence< com::sun::star::uno::XInterface > aSeq); + sequence< any > setSequenceAny( [in] sequence< any > aSeq); + sequence< TestElement > setSequenceStruct( [in] sequence< TestElement > aSeq); + + sequence< sequence< long > > setDim2( [in] sequence< sequence< long > > aSeq); + sequence< sequence < sequence < long > > > setDim3( + [in] sequence< sequence < sequence < long > > > aSeq); + + void setSequencesInOut( [inout] sequence< boolean > aSeqBoolean, + [inout] sequence< char > aSeqChar, + [inout] sequence< byte > aSeqByte, + [inout] sequence< short > aSeqShort, + [inout] sequence< unsigned short> aSeqUShort, + [inout] sequence< long > aSeqLong, + [inout] sequence< unsigned long > aSeqULong, + [inout] sequence< hyper > aSeqHyper, + [inout] sequence< unsigned hyper > aSeqUHyper, + [inout] sequence< float > aSeqFloat, + [inout] sequence< double > aSeqDouble, + [inout] sequence< TestEnum > aSeqEnum, + [inout] sequence< string > aSeqString, + [inout] sequence< com::sun::star::uno::XInterface > aSeqXInterface, + [inout] sequence< any > aSeqAny, + [inout] sequence< sequence< long > > aSeqDim2, + [inout] sequence< sequence < sequence < long > > > aSeqDim3); + + void setSequencesOut( [out] sequence< boolean > aSeqBoolean, + [out] sequence< char > aSeqChar, + [out] sequence< byte > aSeqByte, + [out] sequence< short > aSeqShort, + [out] sequence< unsigned short> aSeqUShort, + [out] sequence< long > aSeqLong, + [out] sequence< unsigned long > aSeqULong, + [out] sequence< hyper > aSeqHyper, + [out] sequence< unsigned hyper > aSeqUHyper, + [out] sequence< float > aSeqFloat, + [out] sequence< double > aSeqDouble, + [out] sequence< TestEnum > aSeqEnum, + [out] sequence< string > aSeqString, + [out] sequence< com::sun::star::uno::XInterface > aSeqXInterface, + [out] sequence< any > aSeqAny, + [out] sequence< sequence< long > > aSeqDim2, + [out] sequence< sequence < sequence < long > > > aSeqDim3); + + void testConstructorsService( + [in] com::sun::star::uno::XComponentContext context) + raises (BadConstructorArguments); + + XCurrentContextChecker getCurrentContextChecker(); +}; + +}; }; }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/bridgetest/idl/com/sun/star/test/performance/XPerformanceTest.idl b/testtools/source/bridgetest/idl/com/sun/star/test/performance/XPerformanceTest.idl new file mode 100644 index 000000000..7e3ae8e96 --- /dev/null +++ b/testtools/source/bridgetest/idl/com/sun/star/test/performance/XPerformanceTest.idl @@ -0,0 +1,130 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef __com_sun_star_test_performance_XPerformanceTest_idl__ +#define __com_sun_star_test_performance_XPerformanceTest_idl__ + +#include <com/sun/star/uno/XInterface.idl> + +module com +{ +module sun +{ +module star +{ +module test +{ +module performance +{ + +/** struct of simple types to be carried +*/ +published struct SimpleTypes +{ + boolean Bool; + char Char; + byte Byte; + short Short; + unsigned short UShort; + long Long; + unsigned long ULong; + hyper Hyper; + unsigned hyper UHyper; + float Float; + double Double; +}; +/** struct ComplexTypes adding Sequence, String, Interface, Any to SimpleTypes +*/ +published struct ComplexTypes : SimpleTypes +{ + sequence< long > Sequence; + string String; + com::sun::star::uno::XInterface Interface; + any Any; +}; + +/** A performance test object has to be implemented in a special way, that: + <ul> + <li>queryInterface() execution times remain (nearly) static</li> + <li>functions kept simple, thus there is (nearly) no execution time of the function itself</li> + <li>no dynamic data is ever returned except of createObject(), so return 0, empty strings etc.</li> + </ul> + The interface is divided into three sections: + <ul> + <li>measuring asynchron/ synchron calls</li> + <li>complex data calls with/out return value; in/out parameters</li> + <li>single data types like long, float, string etc.</li> + <li>method calls versa attribute calls</li> + <li>raising RuntimeException</li> + </ul> +*/ +published interface XPerformanceTest : com::sun::star::uno::XInterface +{ + void async(); + void sync(); + + ComplexTypes complex_in( [in] ComplexTypes aVal ); + ComplexTypes complex_inout( [inout] ComplexTypes aVal ); + + void complex_oneway( [in] ComplexTypes aVal ); + void complex_noreturn( [in] ComplexTypes aVal ); + + XPerformanceTest createObject(); + + [attribute] long Long_attr; + [attribute] hyper Hyper_attr; + [attribute] float Float_attr; + [attribute] double Double_attr; + [attribute] string String_attr; + [attribute] com::sun::star::uno::XInterface Interface_attr; + [attribute] any Any_attr; + [attribute] sequence< com::sun::star::uno::XInterface > Sequence_attr; + [attribute] ComplexTypes Struct_attr; + + long getLong(); + void setLong( [in] long n ); + hyper getHyper(); + void setHyper( [in] hyper n ); + float getFloat(); + void setFloat( [in] float f ); + double getDouble(); + void setDouble( [in] double f ); + string getString(); + void setString( [in] string s ); + com::sun::star::uno::XInterface getInterface(); + void setInterface( [in] com::sun::star::uno::XInterface x ); + any getAny(); + void setAny( [in] any a ); + sequence< com::sun::star::uno::XInterface > getSequence(); + void setSequence( [in] sequence< com::sun::star::uno::XInterface > seq ); + ComplexTypes getStruct(); + void setStruct( [in] ComplexTypes c ); + + void raiseRuntimeException(); +}; + + +}; +}; +}; +}; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/bridgetest/multi.cxx b/testtools/source/bridgetest/multi.cxx new file mode 100644 index 000000000..ce149f154 --- /dev/null +++ b/testtools/source/bridgetest/multi.cxx @@ -0,0 +1,224 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + + +#include <sal/config.h> + +#include "multi.hxx" + +#include <rtl/string.hxx> +#include <rtl/textenc.h> +#include <rtl/ustring.hxx> + +#include <sstream> + +namespace { + +struct CheckFailed { + explicit CheckFailed(OUString const & theMessage): message(theMessage) + {} + + OUString message; +}; + +template< typename T > void checkEqual(T const & value, T const & argument) { + if (argument != value) { + std::ostringstream s; + s << value << " != " << argument; + throw CheckFailed( + OStringToOUString( + OString(s.str().c_str()), RTL_TEXTENCODING_UTF8)); + } +} + +} + +namespace testtools::bridgetest { + +OUString testMulti( css::uno::Reference< test::testtools::bridgetest::XMulti > const & multi ) +{ + try { + checkEqual( + 0.0, + css::uno::Reference< test::testtools::bridgetest::XMultiBase1 >( + multi, css::uno::UNO_QUERY_THROW)->getatt1()); + checkEqual( + 0.0, + static_cast< test::testtools::bridgetest::XMultiBase2 * >( + multi.get())->getatt1()); + checkEqual( + 0.0, + css::uno::Reference< test::testtools::bridgetest::XMultiBase2 >( + multi, css::uno::UNO_QUERY_THROW)->getatt1()); + checkEqual( + 0.0, + static_cast< test::testtools::bridgetest::XMultiBase5 * >( + multi.get())->getatt1()); + checkEqual( + 0.0, + css::uno::Reference< test::testtools::bridgetest::XMultiBase5 >( + multi, css::uno::UNO_QUERY_THROW)->getatt1()); + css::uno::Reference< test::testtools::bridgetest::XMultiBase5 >( + multi, css::uno::UNO_QUERY_THROW)->setatt1(0.1); + checkEqual( + 0.1, + css::uno::Reference< test::testtools::bridgetest::XMultiBase1 >( + multi, css::uno::UNO_QUERY_THROW)->getatt1()); + checkEqual( + 0.1, + static_cast< test::testtools::bridgetest::XMultiBase2 * >( + multi.get())->getatt1()); + checkEqual( + 0.1, + css::uno::Reference< test::testtools::bridgetest::XMultiBase2 >( + multi, css::uno::UNO_QUERY_THROW)->getatt1()); + checkEqual( + 0.1, + static_cast< test::testtools::bridgetest::XMultiBase5 * >( + multi.get())->getatt1()); + checkEqual( + 0.1, + css::uno::Reference< test::testtools::bridgetest::XMultiBase5 >( + multi, css::uno::UNO_QUERY_THROW)->getatt1()); + checkEqual< sal_Int32 >( + 11 * 1, + css::uno::Reference< test::testtools::bridgetest::XMultiBase1 >( + multi, css::uno::UNO_QUERY_THROW)->fn11(1)); + checkEqual< sal_Int32 >( + 11 * 1, + static_cast< test::testtools::bridgetest::XMultiBase2 * >( + multi.get())->fn11(1)); + checkEqual< sal_Int32 >( + 11 * 2, + css::uno::Reference< test::testtools::bridgetest::XMultiBase2 >( + multi, css::uno::UNO_QUERY_THROW)->fn11(2)); + checkEqual< sal_Int32 >( + 11 * 1, + static_cast< test::testtools::bridgetest::XMultiBase5 * >( + multi.get())->fn11(1)); + checkEqual< sal_Int32 >( + 11 * 5, + css::uno::Reference< test::testtools::bridgetest::XMultiBase5 >( + multi, css::uno::UNO_QUERY_THROW)->fn11(5)); + checkEqual( + OUString("12" "abc"), + css::uno::Reference< test::testtools::bridgetest::XMultiBase1 >( + multi, css::uno::UNO_QUERY_THROW)->fn12( + "abc")); + checkEqual( + OUString("12" "abc-2"), + static_cast< test::testtools::bridgetest::XMultiBase2 * >( + multi.get())->fn12("abc-2")); + checkEqual( + OUString("12" "abc-2"), + css::uno::Reference< test::testtools::bridgetest::XMultiBase2 >( + multi, css::uno::UNO_QUERY_THROW)->fn12("abc-2")); + checkEqual( + OUString("12" "abc-5"), + static_cast< test::testtools::bridgetest::XMultiBase5 * >( + multi.get())->fn12("abc-5")); + checkEqual( + OUString("12" "abc-5"), + css::uno::Reference< test::testtools::bridgetest::XMultiBase5 >( + multi, css::uno::UNO_QUERY_THROW)->fn12("abc-5")); + checkEqual< sal_Int32 >(21 * 2, multi->fn21(2)); + checkEqual( + OUString("22" "de"), + multi->fn22("de")); + checkEqual< sal_Int32 >( + 31 * 3, + css::uno::Reference< test::testtools::bridgetest::XMultiBase3 >( + multi, css::uno::UNO_QUERY_THROW)->fn31(3)); + checkEqual< sal_Int32 >( + 31 * 5, + static_cast< test::testtools::bridgetest::XMultiBase5 * >( + multi.get())->fn31(5)); + checkEqual< sal_Int32 >( + 31 * 5, + css::uno::Reference< test::testtools::bridgetest::XMultiBase5 >( + multi, css::uno::UNO_QUERY_THROW)->fn31(5)); + checkEqual( + 0.0, + css::uno::Reference< test::testtools::bridgetest::XMultiBase3 >( + multi, css::uno::UNO_QUERY_THROW)->getatt3()); + checkEqual( + 0.0, + static_cast< test::testtools::bridgetest::XMultiBase5 * >( + multi.get())->getatt3()); + checkEqual( + 0.0, + css::uno::Reference< test::testtools::bridgetest::XMultiBase5 >( + multi, css::uno::UNO_QUERY_THROW)->getatt3()); + css::uno::Reference< test::testtools::bridgetest::XMultiBase3 >( + multi, css::uno::UNO_QUERY_THROW)->setatt3(0.3); + checkEqual( + 0.3, + css::uno::Reference< test::testtools::bridgetest::XMultiBase3 >( + multi, css::uno::UNO_QUERY_THROW)->getatt3()); + checkEqual( + 0.3, + static_cast< test::testtools::bridgetest::XMultiBase5 * >( + multi.get())->getatt3()); + checkEqual( + 0.3, + css::uno::Reference< test::testtools::bridgetest::XMultiBase5 >( + multi, css::uno::UNO_QUERY_THROW)->getatt3()); + checkEqual( + OUString("32" "f"), + css::uno::Reference< test::testtools::bridgetest::XMultiBase3 >( + multi, css::uno::UNO_QUERY_THROW)->fn32("f")); + checkEqual( + OUString("32" "f-5"), + static_cast< test::testtools::bridgetest::XMultiBase5 * >( + multi.get())->fn32("f-5")); + checkEqual( + OUString("32" "f-5"), + css::uno::Reference< test::testtools::bridgetest::XMultiBase5 >( + multi, css::uno::UNO_QUERY_THROW)->fn32("f-5")); + checkEqual< sal_Int32 >( + 33, + css::uno::Reference< test::testtools::bridgetest::XMultiBase3 >( + multi, css::uno::UNO_QUERY_THROW)->fn33()); + checkEqual< sal_Int32 >( + 33, + static_cast< test::testtools::bridgetest::XMultiBase5 * >( + multi.get())->fn33()); + checkEqual< sal_Int32 >( + 33, + css::uno::Reference< test::testtools::bridgetest::XMultiBase5 >( + multi, css::uno::UNO_QUERY_THROW)->fn33()); + checkEqual< sal_Int32 >(41 * 4, multi->fn41(4)); + checkEqual< sal_Int32 >(61 * 6, multi->fn61(6)); + checkEqual( + OUString("62" ""), + multi->fn62(OUString())); + checkEqual< sal_Int32 >(71 * 7, multi->fn71(7)); + checkEqual( + OUString("72" "g"), + multi->fn72("g")); + checkEqual< sal_Int32 >(73, multi->fn73()); + } catch (CheckFailed const & f) { + return f.message; + } + return OUString(); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/bridgetest/multi.hxx b/testtools/source/bridgetest/multi.hxx new file mode 100644 index 000000000..f8b6d404b --- /dev/null +++ b/testtools/source/bridgetest/multi.hxx @@ -0,0 +1,104 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef INCLUDED_TESTTOOLS_SOURCE_BRIDGETEST_MULTI_HXX +#define INCLUDED_TESTTOOLS_SOURCE_BRIDGETEST_MULTI_HXX + +#include <sal/config.h> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <cppuhelper/implbase.hxx> +#include <rtl/ustring.hxx> +#include <sal/types.h> +#include <test/testtools/bridgetest/XMulti.hpp> + +#include "dllapi.hxx" + +namespace testtools::bridgetest { + +class Multi: public cppu::WeakImplHelper< test::testtools::bridgetest::XMulti > +{ +public: + Multi(): m_attribute1(0.0), m_attribute3(0.0) {} + + virtual double SAL_CALL getatt1() override + { return m_attribute1; } + + virtual void SAL_CALL setatt1(double value) override + { m_attribute1 = value; } + + virtual sal_Int32 SAL_CALL fn11(sal_Int32 arg) override + { return 11 * arg; } + + virtual OUString SAL_CALL fn12(OUString const & arg) override + { return "12" + arg; } + + virtual sal_Int32 SAL_CALL fn21(sal_Int32 arg) override + { return 21 * arg; } + + virtual OUString SAL_CALL fn22(OUString const & arg) override + { return "22" + arg; } + + virtual double SAL_CALL getatt3() override + { return m_attribute3; } + + virtual void SAL_CALL setatt3(double value) override + { m_attribute3 = value; } + + virtual sal_Int32 SAL_CALL fn31(sal_Int32 arg) override + { return 31 * arg; } + + virtual OUString SAL_CALL fn32(OUString const & arg) override + { return "32" + arg; } + + virtual sal_Int32 SAL_CALL fn33() override + { return 33; } + + virtual sal_Int32 SAL_CALL fn41(sal_Int32 arg) override + { return 41 * arg; } + + virtual sal_Int32 SAL_CALL fn61(sal_Int32 arg) override + { return 61 * arg; } + + virtual OUString SAL_CALL fn62(OUString const & arg) override + { return "62" + arg; } + + virtual sal_Int32 SAL_CALL fn71(sal_Int32 arg) override + { return 71 * arg; } + + virtual OUString SAL_CALL fn72(OUString const & arg) override + { return "72" + arg; } + + virtual sal_Int32 SAL_CALL fn73() override + { return 73; } + +private: + double m_attribute1; + double m_attribute3; +}; + +LO_DLLPUBLIC_TESTTOOLS +OUString testMulti( css::uno::Reference< test::testtools::bridgetest::XMulti > const & multi); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/bridgetest/pyuno/core.py b/testtools/source/bridgetest/pyuno/core.py new file mode 100644 index 000000000..c56e9f144 --- /dev/null +++ b/testtools/source/bridgetest/pyuno/core.py @@ -0,0 +1,358 @@ +# +# 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 . +# +import pyuno +import uno +import unittest +import exceptions +import types + +def suite(ctx): + suite = unittest.TestSuite() + suite.addTest(TestCase("testErrors",ctx)) + suite.addTest(TestCase("testBaseTypes",ctx)) + suite.addTest(TestCase("testOutparam",ctx)) + suite.addTest(TestCase("testStruct",ctx)) + suite.addTest(TestCase("testType",ctx)) + suite.addTest(TestCase("testEnum",ctx)) + suite.addTest(TestCase("testBool",ctx)) + suite.addTest(TestCase("testChar",ctx)) + suite.addTest(TestCase("testUnicode",ctx)) + suite.addTest(TestCase("testConstant",ctx)) + suite.addTest(TestCase("testExceptions",ctx)) + suite.addTest(TestCase("testInterface",ctx)) + suite.addTest(TestCase("testByteSequence",ctx)) + suite.addTest(TestCase("testInvoke",ctx)) + return suite + +def equalsEps( a,b,eps ): + if a - eps <= b and a+eps >= b: + return 1 + return 0 + +def assign( rData, bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper,\ + nUHyper, fFloat, fDouble, eEnum, rStr, xTest, rAny ): + rData.Bool = bBool; + rData.Char = cChar; + rData.Byte = nByte; + rData.Short = nShort; + rData.UShort = nUShort; + rData.Long = nLong; + rData.ULong = nULong; + rData.Hyper = nHyper; + rData.UHyper = nUHyper; + rData.Float = fFloat; + rData.Double = fDouble; + rData.Enum = eEnum; + rData.String = rStr; + rData.Interface = xTest; + rData.Any = rAny; + + +class PythonTransporter: + def __init__( self ): + pass + + def transportAny( self, arg ): + return arg + +class TestCase( unittest.TestCase): + + def __init__(self,method,ctx): + unittest.TestCase.__init__(self,method) + self.ctx = ctx + + def setUp(self): + # the testcomponent from the testtools project + self.tobj = self.ctx.ServiceManager.createInstanceWithContext( + 'com.sun.star.test.bridge.CppTestObject' , self.ctx ) + + self.tobj.Bool = 1 + self.tobj.Char = 'h' + self.tobj.Byte = 43 + self.tobj.Short = -42 + self.tobj.UShort = 44 + self.tobj.Long = 42 + self.tobj.ULong = 41 + self.tobj.Hyper = 46 + self.tobj.UHyper = 47 + self.tobj.Float = 4.3 + self.tobj.Double = 4.2 + self.tobj.Enum = 4 + self.tobj.String = "yabadabadoo" + self.tobj.Interface = self.ctx + self.tobj.Any = self.tobj.String + mystruct = uno.createUnoStruct( "test.testtools.bridgetest.TestData" ) + assign( mystruct, 1, 'h', 43, -42,44,42,41,46,47,4.3,4.2,4,"yabadabadoo",self.ctx,"yabadabadoo") + self.tobj.Struct = mystruct + + self.testElement = uno.createUnoStruct( "test.testtools.bridgetest.TestElement" ) + self.testElement.String = "foo" + self.testElement2 = uno.createUnoStruct( "test.testtools.bridgetest.TestElement" ) + self.testElement2.String = "42" + self.tobj.Sequence = (self.testElement,self.testElement2) + + def testBaseTypes(self): + self.failUnless( 42 == self.tobj.Long , "Long attribute" ) + self.failUnless( 41 == self.tobj.ULong , "ULong attribute" ) + self.failUnless( 43 == self.tobj.Byte , "Byte attribute" ) + self.failUnless( 44 == self.tobj.UShort , "UShort attribute" ) + self.failUnless( -42 == self.tobj.Short , "Short attribute" ) + self.failUnless( 46 == self.tobj.Hyper , "Hyper attribute" ) + self.failUnless( 47 == self.tobj.UHyper , "UHyper attribute" ) + self.failUnless( self.tobj.Bool , "Bool attribute2" ) + self.failUnless( "yabadabadoo" == self.tobj.String , "String attribute" ) + self.failUnless( self.tobj.Sequence[0] == self.testElement , "Sequence test") + self.failUnless( self.tobj.Sequence[1] == self.testElement2 , "Sequence2 test") + self.failUnless( equalsEps( 4.3,self.tobj.Float,0.0001) , "float test" ) + self.failUnless( 4.2 == self.tobj.Double , "double test" ) + self.failUnless( self.ctx == self.tobj.Interface , + "object identity test with C++ object" ) + self.failUnless( not self.ctx == self.tobj , "object not identical test " ) + self.failUnless( 42 == self.tobj.transportAny( 42 ), "transportAny long" ) + self.failUnless( "woo, this is python" == self.tobj.transportAny( "woo, this is python" ), \ + "string roundtrip via any test" ) + + def testEnum( self ): + e1 = uno.Enum( "com.sun.star.uno.TypeClass" , "LONG" ) + e2 = uno.Enum( "com.sun.star.uno.TypeClass" , "LONG" ) + e3 = uno.Enum( "com.sun.star.uno.TypeClass" , "UNSIGNED_LONG" ) + e4 = uno.Enum( "test.testtools.bridgetest.TestEnum" , "TWO" ) + self.failUnless( e1 == e2 , "equal enum test" ) + self.failUnless( not (e1 == e3) , "different enums test" ) + self.failUnless( self.tobj.transportAny( e3 ) == e3, "enum roundtrip test" ) + self.tobj.Enum = e4 + self.failUnless( e4 == self.tobj.Enum , "enum assignment failed" ) + + def testType(self ): + t1 = uno.getTypeByName( "com.sun.star.lang.XComponent" ) + t2 = uno.getTypeByName( "com.sun.star.lang.XComponent" ) + t3 = uno.getTypeByName( "com.sun.star.lang.EventObject" ) + self.failUnless( t1.typeClass == \ + uno.Enum( "com.sun.star.uno.TypeClass", "INTERFACE" ), "typeclass of type test" ) + self.failUnless( t3.typeClass == \ + uno.Enum( "com.sun.star.uno.TypeClass", "STRUCT" ), "typeclass of type test") + self.failUnless( t1 == t2 , "equal type test" ) + self.failUnless( t1 == t2 , "equal type test" ) + self.failUnless( t1 == self.tobj.transportAny( t1 ), "type roundtrip test" ) + + def testBool( self ): + self.failUnless( uno.Bool(1) , "uno.Bool true test" ) + self.failUnless( not uno.Bool(0) , "uno.Bool false test" ) + self.failUnless( uno.Bool( "true") , "uno.Bool true1 test" ) + self.failUnless( not uno.Bool( "false") , "uno.Bool true1 test" ) + + self.tobj.Bool = uno.Bool(1) + self.failUnless( self.tobj.Bool , "bool true attribute test" ) + self.tobj.Bool = uno.Bool(0) + self.failUnless( not self.tobj.Bool , "bool true attribute test" ) + + # new boolean semantic + self.failUnless( id( self.tobj.transportAny( True ) ) == id(True) , "boolean preserve test") + self.failUnless( id( self.tobj.transportAny( False ) ) == id(False) , "boolean preserve test" ) + self.failUnless( id( self.tobj.transportAny(1) ) != id( True ), "boolean preserve test" ) + self.failUnless( id( self.tobj.transportAny(0) ) != id( False ), "boolean preserve test" ) + + def testChar( self ): + self.tobj.Char = uno.Char( u'h' ) + self.failUnless( self.tobj.Char == uno.Char( u'h' ), "char type test" ) + self.failUnless( isinstance( self.tobj.transportAny( uno.Char(u'h') ),uno.Char),"char preserve test" ) + + def testStruct( self ): + mystruct = uno.createUnoStruct( "test.testtools.bridgetest.TestData" ) + assign( mystruct, 1, 'h', 43, -42,44,42,41,46,47,4.3,4.2,4,"yabadabadoo",self.ctx,"yabadabadoo") + self.tobj.Struct = mystruct + aSecondStruct = self.tobj.Struct + + self.failUnless( self.tobj.Struct == mystruct, "struct roundtrip for equality test" ) + self.failUnless( aSecondStruct == mystruct, "struct roundtrip for equality test2" ) + aSecondStruct.Short = 720 + self.failUnless( not aSecondStruct == mystruct , "different structs equality test" ) + self.failUnless( not self.ctx == mystruct , "object is not equal to struct test" ) + self.failUnless( mystruct == self.tobj.transportAny( mystruct ), "struct roundtrip with any test" ) + my2ndstruct = uno.createUnoStruct( "test.testtools.bridgetest.TestData", \ + 1, 'h', 43, -42,44,42,41,46,47,4.3,4.2,4,"yabadabadoo",self.ctx,"yabadabadoo",()) + self.failUnless( my2ndstruct == mystruct, "struct non-default ctor test" ) + def testUnicode( self ): + uni = u'\0148' + self.tobj.String = uni + self.failUnless( uni == self.tobj.String ) + + + self.tobj.String = u'dubidu' + self.failUnless( u'dubidu' == self.tobj.String , "unicode comparison test") + self.failUnless( 'dubidu' == self.tobj.String , "unicode vs. string comparison test" ) + + def testConstant( self ): + self.failUnless( uno.getConstantByName( "com.sun.star.beans.PropertyConcept.ATTRIBUTES" ) == 4,\ + "constant retrieval test" ) + + def testExceptions( self ): + unoExc = uno.getClass( "com.sun.star.uno.Exception" ) + ioExc = uno.getClass( "com.sun.star.io.IOException" ) + dispExc = uno.getClass( "com.sun.star.lang.DisposedException" ) + wasHere = 0 + try: + raise ioExc( "huhuh" , self.tobj ) + except unoExc , instance: + wasHere = 1 + self.failUnless( wasHere , "exception test 1" ) + + wasHere = 0 + try: + raise ioExc + except ioExc: + wasHere = 1 + else: + self.failUnless( wasHere, "exception test 2" ) + + wasHere = 0 + try: + raise dispExc + except ioExc: + pass + except unoExc: + wasHere = 1 + self.failUnless(wasHere, "exception test 3") + + illegalArg = uno.getClass( "com.sun.star.lang.IllegalArgumentException" ) + wasHere = 0 + try: + self.tobj.raiseException( 1 , "foo" , self.tobj ) + self.failUnless( 0 , "exception test 5a" ) + except ioExc: + self.failUnless( 0 , "exception test 5b" ) + except illegalArg, i: + self.failUnless( 1 == i.ArgumentPosition , "exception member test" ) + self.failUnless( "foo" == i.Message , "exception member test 2 " ) + wasHere = 1 + else: + self.failUnless( 0, "except test 5c" ) + self.failUnless( wasHere, "illegal argument exception test failed" ) + + def testInterface(self): + clazz = uno.getClass( "com.sun.star.lang.XComponent" ) + self.failUnless( "com.sun.star.lang.XComponent" == clazz.__pyunointerface__ ) + self.failUnless( issubclass( clazz, uno.getClass( "com.sun.star.uno.XInterface" ) ) ) + self.tobj.Interface = None + + + def testOutparam( self): + # outparameter + struct, mybool,mychar,mybyte,myshort,myushort,mylong,myulong,myhyper,myuhyper,myfloat, \ + mydouble,myenum,mystring,myinterface,myany,myseq,my2ndstruct = self.tobj.getValues( \ + None,None,None,None,None,None,None,None,None,None, \ + None,None,None,None,None,None,None) + self.failUnless(struct == self.tobj.Struct, "outparam 1 test") + self.failUnless(self.tobj.Bool, "outparam 2 test") + self.failUnless(mychar == self.tobj.Char, "outparam 3 test") + self.failUnless(mybyte == self.tobj.Byte, "outparam 4 test") + self.failUnless(myshort == self.tobj.Short, "outparam 5 test") + self.failUnless(myushort == self.tobj.UShort, "outparam 6 test") + self.failUnless(mylong == self.tobj.Long, "outparam 7 test") + self.failUnless(myulong == self.tobj.ULong, "outparam 8 test") + self.failUnless(myhyper == self.tobj.Hyper, "outparam 9 test") + self.failUnless(myuhyper == self.tobj.UHyper, "outparam 10 test") + self.failUnless(myfloat == self.tobj.Float, "outparam 11 test") + self.failUnless(mydouble == self.tobj.Double, "outparam 12 test") + self.failUnless(myenum == self.tobj.Enum, "outparam 13 test") + self.failUnless(mystring == self.tobj.String, "outparam 14 test") + self.failUnless(myinterface == self.tobj.Interface, "outparam 15 test") + self.failUnless(myany == self.tobj.Any, "outparam 16 test") + self.failUnless(myseq == self.tobj.Sequence, "outparam 17 test") + self.failUnless(my2ndstruct == struct, "outparam 18 test") + +# should work, debug on windows, why not +# struct, mybool,mychar,mybyte,myshort,myushort,mylong,myulong,myhyper,myuhyper,myfloat,\ +# mydouble,myenum,mystring,myinterface,myany,myseq,my2ndstruct = self.tobj.setValues2( \ +# mybool,mychar,mybyte,myshort,myushort,mylong,myulong,myhyper,myuhyper,myfloat,\ +# mydouble,myenum,mystring,myinterface,myany,myseq,my2ndstruct) +# self.failUnless(struct == self.tobj.Struct, "outparam 1 test") +# self.failUnless( mybool and self.tobj.Bool, "outparam 2 test") +# self.failUnless(mychar == self.tobj.Char, "outparam 3 test") +# self.failUnless(mybyte == self.tobj.Byte, "outparam 4 test") +# self.failUnless(myshort == self.tobj.Short, "outparam 5 test") +# self.failUnless(myushort == self.tobj.UShort, "outparam 6 test") +# self.failUnless(mylong == self.tobj.Long, "outparam 7 test") +# self.failUnless(myulong == self.tobj.ULong, "outparam 8 test") +# self.failUnless(myhyper == self.tobj.Hyper, "outparam 9 test") +# self.failUnless(myuhyper == self.tobj.UHyper, "outparam 10 test") +# self.failUnless(myfloat == self.tobj.Float, "outparam 11 test") +# self.failUnless(mydouble == self.tobj.Double, "outparam 12 test") +# self.failUnless(myenum == self.tobj.Enum, "outparam 13 test") +# self.failUnless(mystring == self.tobj.String, "outparam 14 test") +# self.failUnless(myinterface == self.tobj.Interface, "outparam 15 test") +# self.failUnless(myany == self.tobj.Any, "outparam 16 test") +# self.failUnless(myseq == self.tobj.Sequence, "outparam 17 test") +# self.failUnless(my2ndstruct == struct, "outparam 18 test") + + def testErrors( self ): + + wasHere = 0 + try: + self.tobj.a = 5 + self.fail("attribute a shouldn't exist") + except AttributeError: + wasHere = 1 + except IllegalArgumentException: + wasHere = 1 + self.failUnless( wasHere, "wrong attribute test" ) + + IllegalArgumentException = uno.getClass("com.sun.star.lang.IllegalArgumentException" ) + RuntimeException = uno.getClass("com.sun.star.uno.RuntimeException" ) + +# TODO: Remove this once it is done +# wrong number of arguments bug !? + self.failUnlessRaises( IllegalArgumentException, self.tobj.transportAny, 42, 43 ) + self.failUnlessRaises( IllegalArgumentException, self.tobj.transportAny ) + self.failUnlessRaises( RuntimeException, uno.getClass, "a.b" ) + self.failUnlessRaises( RuntimeException, uno.getClass, "com.sun.star.uno.TypeClass" ) + + self.failUnlessRaises( RuntimeException, uno.Enum, "a" , "b" ) + self.failUnlessRaises( RuntimeException, uno.Enum, "com.sun.star.uno.TypeClass" , "b" ) + self.failUnlessRaises( RuntimeException, uno.Enum, "com.sun.star.uno.XInterface" , "b" ) + + tcInterface =uno.Enum( "com.sun.star.uno.TypeClass" , "INTERFACE" ) + self.failUnlessRaises( RuntimeException, uno.Type, "a", tcInterface ) + self.failUnlessRaises( RuntimeException, uno.Type, "com.sun.star.uno.Exception", tcInterface ) + + self.failUnlessRaises( (RuntimeException,exceptions.RuntimeError), uno.getTypeByName, "a" ) + + self.failUnlessRaises( (RuntimeException), uno.getConstantByName, "a" ) + self.failUnlessRaises( (RuntimeException), uno.getConstantByName, "com.sun.star.uno.XInterface" ) + + def testByteSequence( self ): + s = uno.ByteSequence( b"ab" ) + self.failUnless( s == uno.ByteSequence( b"ab" ) ) + self.failUnless( uno.ByteSequence( b"abc" ) == s + uno.ByteSequence( b"c" ) ) + self.failUnless( uno.ByteSequence( b"abc" ) == s + "c" ) + self.failUnless( s + "c" == "abc" ) + self.failUnless( s == uno.ByteSequence( s ) ) + self.failUnless( s[0] == 'a' ) + self.failUnless( s[1] == 'b' ) + + + def testInvoke( self ): + self.failUnless( 5 == uno.invoke( self.tobj , "transportAny" , (uno.Any("byte", 5),) ) ) + self.failUnless( 5 == uno.invoke( + PythonTransporter(), "transportAny" , (uno.Any( "byte", 5 ),) ) ) + t = uno.getTypeByName( "long" ) + mystruct = uno.createUnoStruct( + "com.sun.star.beans.PropertyValue", "foo",0,uno.Any(t,2),0 ) + mystruct.Value = uno.Any(t, 1) + + diff --git a/testtools/source/bridgetest/pyuno/impl.py b/testtools/source/bridgetest/pyuno/impl.py new file mode 100644 index 000000000..7fe940424 --- /dev/null +++ b/testtools/source/bridgetest/pyuno/impl.py @@ -0,0 +1,187 @@ +# +# 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 . +# +"tests bridging python implementations of UNO objects" +import unittest +import uno +import unohelper +import os +import sys + +from com.sun.star.io import XOutputStream, XInputStream, typeOfXOutputStream, typeOfXInputStream +from com.sun.star.lang import XTypeProvider, typeOfXTypeProvider, XEventListener +from com.sun.star.uno import XCurrentContext + +class SequenceOutputStream( unohelper.Base, XOutputStream ): + def __init__( self ): + self.s = uno.ByteSequence("") + self.closed = 0 + + def closeOutput(self): + self.closed = 1 + + def writeBytes( self, seq ): + self.s = self.s + seq + + def flush( self ): + pass + + def getSequence( self ): + return self.s + + +class SequenceInputStream( XInputStream, unohelper.Base ): + def __init__( self, seq ): + self.s = seq + self.nIndex = 0 + self.closed = 0 + + def closeInput( self): + self.closed = 1 + self.s = None + + def skipBytes( self, nByteCount ): + if( nByteCount + self.nIndex > len(self.s) ): + nByteCount = len(self.s) - self.nIndex + self.nIndex += nByteCount + + def readBytes( self, retSeq, nByteCount ): + nRet = 0 + if( self.nIndex + nByteCount > len(self.s) ): + nRet = len(self.s) - self.nIndex + else: + nRet = nByteCount + retSeq = uno.ByteSequence(self.s.value[self.nIndex : self.nIndex + nRet ]) + self.nIndex = self.nIndex + nRet + return nRet, retSeq + + def readSomeBytes( self, retSeq , nByteCount ): + #as we never block ! + return readBytes( retSeq, nByteCount ) + + def available( self ): + return len( self.s ) - self.nIndex + +class SequenceInputStream2( SequenceInputStream ): + def __init__( self, seq ): + SequenceInputStream.__init__( self, seq ) + +class TestCase(unittest.TestCase): + def __init__(self,method,ctx): + unittest.TestCase.__init__(self,method) + self.ctx = ctx + + def setUp(self): + self.tobj = self.ctx.ServiceManager.createInstanceWithContext( \ + "com.sun.star.test.bridge.CppTestObject",self.ctx) + self.pipe = self.ctx.ServiceManager.createInstanceWithContext( \ + "com.sun.star.io.Pipe" , self.ctx ) + + def testStandard( self ): + dataOut = self.ctx.ServiceManager.createInstanceWithContext( \ + "com.sun.star.io.DataOutputStream", self.ctx ) + streamOut = SequenceOutputStream() + dataOut.setOutputStream( streamOut ) + dataOut.writeShort( 42 ) + dataOut.writeLong( 43 ) + dataOut.closeOutput() + + dataInput = self.ctx.ServiceManager.createInstanceWithContext( \ + "com.sun.star.io.DataInputStream", self.ctx ) + + dataInput.setInputStream( SequenceInputStream2( streamOut.getSequence() ) ) + + self.failUnless( 42 == dataInput.readShort() ) + self.failUnless( 43 == dataInput.readLong() ) + self.failUnless( self.tobj.transportAny( streamOut ) == streamOut ) + + +class NullDevice: + def write( self, string ): + pass + + +class EventListener( unohelper.Base, XEventListener ): + def __init__( self ): + self.disposingCalled = False + + def disposing( self , eventObject ): + self.disposingCalled = True + +class TestHelperCase( unittest.TestCase ): + + def __init__(self,method): + unittest.TestCase.__init__(self,method) + + def testUrlHelper( self ): + systemPath = os.getcwd() + if systemPath.startswith( "/" ): + self.failUnless( "/tmp" == unohelper.fileUrlToSystemPath( "file:///tmp" ) ) + self.failUnless( "file:///tmp" == unohelper.systemPathToFileUrl( "/tmp" )) + else: + self.failUnless( "c:\\temp" == unohelper.fileUrlToSystemPath( "file:///c:/temp" ) ) + self.failUnless( "file:///c:/temp" == unohelper.systemPathToFileUrl( "c:\\temp" ) ) + + systemPath = unohelper.systemPathToFileUrl( systemPath ) + self.failUnless( systemPath + "/a" == unohelper.absolutize( systemPath, "a" ) ) + def testInspect( self ): + dev = NullDevice() +# dev = sys.stdout + unohelper.inspect( uno.getComponentContext() , dev ) + unohelper.inspect( uno.getComponentContext().ServiceManager , dev ) + unohelper.inspect( uno.getTypeByName( "com.sun.star.lang.XComponent" ) , dev ) + + def testListener( self ): + smgr = uno.getComponentContext().ServiceManager.createInstance( + "com.sun.star.lang.ServiceManager" ) + + # check, whether listeners + listener = EventListener() + smgr.addEventListener( listener ) + smgr.dispose() + self.failUnless( listener.disposingCalled ) + + # check, whether listeners can be removed + smgr = uno.getComponentContext().ServiceManager.createInstance( + "com.sun.star.lang.ServiceManager" ) + listener = EventListener() + smgr.addEventListener( listener ) + smgr.removeEventListener( listener ) + smgr.dispose() + self.failUnless( not listener.disposingCalled ) + + def testCurrentContext( self ): + oldContext = uno.getCurrentContext() + try: + uno.setCurrentContext( + unohelper.CurrentContext( oldContext,{"My42":42}) ) + self.failUnless( 42 == uno.getCurrentContext().getValueByName( "My42" ) ) + self.failUnless( None == uno.getCurrentContext().getValueByName( "My43" ) ) + finally: + uno.setCurrentContext( oldContext ) + + + +def suite( ctx ): + suite = unittest.TestSuite() + suite.addTest(TestCase("testStandard",ctx)) + suite.addTest(TestHelperCase( "testUrlHelper" )) + suite.addTest(TestHelperCase( "testInspect" )) + suite.addTest(TestHelperCase( "testListener" ) ) + suite.addTest(TestHelperCase( "testCurrentContext" ) ) + return suite + diff --git a/testtools/source/bridgetest/pyuno/importer.py b/testtools/source/bridgetest/pyuno/importer.py new file mode 100644 index 000000000..c4ce8c175 --- /dev/null +++ b/testtools/source/bridgetest/pyuno/importer.py @@ -0,0 +1,69 @@ +# +# 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 . +# +import unittest +import uno +import unohelper + +from com.sun.star.lang import EventObject,IllegalArgumentException,typeOfIllegalArgumentException +from test.testtools.bridgetest.TestEnum import TWO +from com.sun.star.uno.TypeClass import UNSIGNED_LONG,EXCEPTION +class ImporterTestCase(unittest.TestCase): + def __init__(self,method,ctx): + unittest.TestCase.__init__(self,method) + self.ctx = ctx + + def setUp(self): + self.tobj = self.ctx.ServiceManager.createInstanceWithContext( \ + "com.sun.star.test.bridge.CppTestObject",self.ctx) + + def testStandard( self ): + self.failUnless( IllegalArgumentException != None, "none-test" ) + self.failUnlessRaises( IllegalArgumentException, self.tobj.raiseException, 1,"foo",self.tobj) + + self.failUnless( TWO == uno.Enum( "test.testtools.bridgetest.TestEnum","TWO"), "enum" ) + self.failUnless( UNSIGNED_LONG == uno.Enum( "com.sun.star.uno.TypeClass", "UNSIGNED_LONG" ) ) + self.failUnless( typeOfIllegalArgumentException == + uno.Type( "com.sun.star.lang.IllegalArgumentException", EXCEPTION) ) + + # should not throw an exception + e = EventObject() + e.Source = self.ctx + e = EventObject( self.ctx ) + e = EventObject( e ) + + def testDynamicComponentRegistration( self ): + ctx = uno.getComponentContext() + self.failUnless( + not ("com.sun.star.connection.Acceptor" in ctx.ServiceManager.getAvailableServiceNames()), + "precondition for dynamic component registration test is not fulfilled" ) + self.failUnless( + not ("com.sun.star.connection.Connector" in ctx.ServiceManager.getAvailableServiceNames()), + "precondition for dynamic component registration test is not fulfilled" ) + unohelper.addComponentsToContext( + ctx , ctx, ("acceptor.uno","connector.uno"), "com.sun.star.loader.SharedLibrary" ) + self.failUnless( + ("com.sun.star.connection.Acceptor" in ctx.ServiceManager.getAvailableServiceNames()) ) + self.failUnless( + ("com.sun.star.connection.Connector" in ctx.ServiceManager.getAvailableServiceNames())) + +def suite( ctx ): + suite = unittest.TestSuite() + suite.addTest(ImporterTestCase("testStandard",ctx)) + suite.addTest(ImporterTestCase("testDynamicComponentRegistration",ctx)) + return suite + diff --git a/testtools/source/bridgetest/pyuno/main.py b/testtools/source/bridgetest/pyuno/main.py new file mode 100644 index 000000000..9dc101a2e --- /dev/null +++ b/testtools/source/bridgetest/pyuno/main.py @@ -0,0 +1,40 @@ +# +# 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 . +# +import uno +import unohelper +import importer +import unittest +import core +import impl +import os +import sys + +ctx = uno.getComponentContext() +# needed for the tests +unohelper.addComponentsToContext(ctx,ctx,(os.environ["FOO"]+"/cppobj.uno",os.environ["FOO"]+"/bridgetest.uno","streams.uno","bootstrap.uno"),"com.sun.star.loader.SharedLibrary") + +unohelper.addComponentsToContext(ctx,ctx,("vnd.openoffice.pymodule:samplecomponent",),"com.sun.star.loader.Python") + +runner = unittest.TextTestRunner(sys.stderr,1,2) + +suite = unittest.TestSuite() +suite.addTest(importer.suite(ctx)) +suite.addTest(core.suite(ctx)) +suite.addTest(impl.suite(ctx)) + +runner.run(suite) diff --git a/testtools/source/bridgetest/pyuno/makefile.mk b/testtools/source/bridgetest/pyuno/makefile.mk new file mode 100644 index 000000000..112be23c9 --- /dev/null +++ b/testtools/source/bridgetest/pyuno/makefile.mk @@ -0,0 +1,117 @@ +# +# 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 . +# + +PRJ=..$/..$/.. + +PRJNAME=pyuno +TARGET=test +LIBTARGET=NO +TARGETTYPE=CUI +ENABLE_EXCEPTIONS=TRUE + +my_components = pythonloader + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +.IF "$(CROSS_COMPILING)"=="YES" + +all: +# nothing + +.ENDIF + +# --- Files -------------------------------------------------------- +.IF "$(DISABLE_PYTHON)" != "TRUE" +.IF "$(L10N_framework)"=="" +PYEXC=$(DLLDEST)$/python$(EXECPOST) +REGEXC=$(DLLDEST)$/regcomp$(EXECPOST) + +.IF "$(SYSTEM_PYTHON)"!="YES" +PYTHON=$(AUGMENT_LIBRARY_PATH) $(WRAPCMD) $(SOLARBINDIR)/python +.ELSE # "$(SYSTEM_PYTHON)"!="YES" +PYTHON=$(AUGMENT_LIBRARY_PATH) $(WRAPCMD) $(PYTHON_FOR_BUILD) +.ENDIF # "$(SYSTEM_PYTHON)"!="YES" +.IF "$(OS)"=="WNT" +PYTHONPATH:=$(SOLARLIBDIR)$/pyuno;$(PWD);$(SOLARLIBDIR);$(SOLARLIBDIR)$/python;$(SOLARLIBDIR)$/python$/lib-dynload +.ELSE # "$(OS)"=="WNT" +PYTHONPATH:=$(SOLARLIBDIR)$/pyuno:$(PWD):$(SOLARLIBDIR):$(SOLARLIBDIR)$/python:$(SOLARLIBDIR)$/python$/lib-dynload +.ENDIF # "$(OS)"=="WNT" +.EXPORT: PYTHONPATH + +.IF "$(OS)"!="WNT" +TEST_ENV=export FOO=file://$(shell @pwd)$/$(DLLDEST) \ + UNO_TYPES=uno_types.rdb UNO_SERVICES=pyuno_services.rdb +.ELSE # "$(OS)" != "WNT" +# aaaaaa, how to get the current working directory on windows ??? +CWD_TMP=$(strip $(shell @echo "import os;print os.getcwd()" | $(PYTHON))) +TEST_ENV=export FOO=file:///$(strip $(subst,\,/ $(CWD_TMP)$/$(DLLDEST))) && \ + export UNO_TYPES=uno_types.rdb && export UNO_SERVICES=pyuno_services.rdb +.ENDIF # "$(OS)"!="WNT" +PYFILES = \ + $(DLLDEST)$/core.py \ + $(DLLDEST)$/importer.py \ + $(DLLDEST)$/main.py \ + $(DLLDEST)$/impl.py \ + $(DLLDEST)$/samplecomponent.py \ + $(DLLDEST)$/testcomp.py \ + +PYCOMPONENTS = \ + samplecomponent + +ALL : \ + $(PYFILES) \ + $(DLLDEST)/pyuno_services.rdb \ + doc \ + ALLTAR +.ENDIF # L10N_framework +.ENDIF # DISABLE_PYTHON + +.INCLUDE : target.mk + +.IF "$(DISABLE_PYTHON)" != "TRUE" +.IF "$(L10N_framework)"=="" +$(DLLDEST)$/%.py: %.py + cp $? $@ + +$(DLLDEST)$/python$(EXECPOST) : $(SOLARBINDIR)$/python$(EXECPOST) + cp $? $@ + +$(DLLDEST)$/regcomp$(EXECPOST) : $(SOLARBINDIR)$/regcomp$(EXECPOST) + cp $? $@ + +$(DLLDEST)$/pyuno_services.rdb .ERRREMOVE : \ + $(SOLARENV)/bin/packcomponents.xslt $(MISC)/pyuno_services.input \ + $(my_components:^"$(SOLARXMLDIR)/":+".component") + $(XSLTPROC) --nonet --stringparam prefix $(SOLARXMLDIR)/ -o $@ \ + $(SOLARENV)/bin/packcomponents.xslt $(MISC)/pyuno_services.input + +$(MISC)/pyuno_services.input : + echo \ + '<list>$(my_components:^"<filename>":+".component</filename>")</list>' \ + > $@ + +doc .PHONY: + @echo start test with dmake runtest + +runtest : ALL + cd $(DLLDEST) && $(TEST_ENV) && $(PYTHON) main.py +.ENDIF # L10N_framework +.ENDIF # DISABLE_PYTHON + diff --git a/testtools/source/bridgetest/pyuno/pyuno b/testtools/source/bridgetest/pyuno/pyuno new file mode 100644 index 000000000..cf2da2cad --- /dev/null +++ b/testtools/source/bridgetest/pyuno/pyuno @@ -0,0 +1,2 @@ +UNO_TYPES=uno_types.rdb +UNO_SERVICES=pyuno_services.rdb diff --git a/testtools/source/bridgetest/pyuno/samplecomponent.py b/testtools/source/bridgetest/pyuno/samplecomponent.py new file mode 100644 index 000000000..a434cd0b4 --- /dev/null +++ b/testtools/source/bridgetest/pyuno/samplecomponent.py @@ -0,0 +1,145 @@ +# +# 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 . +# +import uno +import unohelper + +from com.sun.star.lang import IllegalArgumentException,XServiceInfo +from com.sun.star.uno import RuntimeException +from com.sun.star.beans import UnknownPropertyException +from test.testtools.bridgetest import TestData,XRecursiveCall,XBridgeTestBase + +g_ImplementationHelper = unohelper.ImplementationHelper() +g_implName = "org.openoffice.comp.pyuno.PythonTestObject" + +g_attribs = "RuntimeException", "Bool", "Char", "Byte", "Short", "UShort", \ + "Long", "ULong", "Hyper", "UHyper", "Float", "Double", "Enum", \ + "String", "Interface", "Any" , "Sequence" , "Struct" + +def assign( rData, bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper,\ + nUHyper, fFloat, fDouble, eEnum, rStr, xTest, rAny ): + rData.Bool = bBool; + rData.Char = cChar; + rData.Byte = nByte; + rData.Short = nShort; + rData.UShort = nUShort; + rData.Long = nLong; + rData.ULong = nULong; + rData.Hyper = nHyper; + rData.UHyper = nUHyper; + rData.Float = fFloat; + rData.Double = fDouble; + rData.Enum = eEnum; + rData.String = rStr; + rData.Interface = xTest; + rData.Any = rAny; + +class MyRecursiveCall( XRecursiveCall, unohelper.Base ): + def callRecursivly( xCall, nToCall ): + if nToCall: + xCall.callRecursivly( self, nToCall -1 ) + +class SampleUnoComponent( XBridgeTestBase,XServiceInfo ): + def __init__(self,ctx): + self.__dict__["callid"] = 0 + self.__dict__["sequenceBroken"] = 0 + + def transportAny( self, value ): + return value + + def raiseException( self, ArgumentPosition, Message, Context ): + raise IllegalArgumentException( Message, Context, ArgumentPosition ) + + def raiseRuntimeExceptionOneway(self, Message, Context ): + raise RuntimeException( Message, Context ) + + def setValues( self, bBool, cChar, nByte, nShort, nUShort, nLong,\ + nULong, nHyper, nUHyper, fFloat, fDouble, eEnum, \ + aString, xInterface, aAny, aSequence, aStruct ): + self.__dict__["data"] = TestDataElements( bBool, cChar, nByte, nShort, nUShort, nLong, + nULong, nHyper, nUHyper, fFloat, fDouble, eEnum, aStruct, xInterface, + aAny, aSequence ) + self.__dict__["Struct"] = aStruct + + def setValues2( self, bBool, cChar, nByte, nShort, nUShort, nLong, nULong,\ + nHyper, nUHyper, fFloat, fDouble, eEnum, \ + aString, xInterface, aAny, aSequence, aStruct ): + self.__dict__["Struct"] = TestData( cChar, nByte, nShort, nUShort, nLong, nULong, nHyper,\ + nUHyper, fFloat, fDouble, eEnum, aStruct, xInterface,\ + aAny, aSequence ) + self.__dict__["Struct"] = aStruct + return bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, nULong, \ + nHyper, nUHyper, fFloat, fDouble, eEnum, aStruct, xInterface, aAny, \ + (aSequence[1],aSequence[0]), aStruct + + def getValues(self, a,b,c,d,e,f,g,h, i,j,k,l,m,n): + v = self.__dict__["data"] + return self.__dict__["Struct"],v.Bool, v.Char, v.Byte, v.Short, v.UShort, v.Long, \ + v.ULong, v.Hyper, v.UHyper, v.Float, v.Double, v.Enum, v.String, v.Interface, \ + v.Any, v.Sequence, self.__dict__["Struct"] + + def call( self, callid, nWaitMUSEC ): + if self.__dict__["callid"] >= callid: + self.__dict__["sequenceBroken"] = 1 + else: + self.__dict__["callid"] = callid + + def callOneway( self, nCallId, nWaitMUSEC ): + call( nCallId, nWaitMUSEC ) + + def sequenceOfCallTestPassed(): + return self.__dict__["sequenceBroken"] + + def startRecursiveCall( xCall , nToCall ): + if nToCall: + xCall.callRecursivly( MyRecursiveCall(), nToCall -1 ) + + def checkExistence( self, name ): + found = 0 + for x in g_attribs: + if x == name: + found = 1 + break + if not found: + raise UnknownPropertyException( "Property "+name+" is unknown", self ) + + def __setattr__( self, name, value ): + checkExistence( name ) + self.__dict__[name] = value + + def __getattr__( self, name ): + checkExistence( name ) + return self.__dict__[name] + + def getSupportedServices( self ): + return g_ImplementationHelper.getSupportedServices(g_implName) + def supportsService( self, ServiceName ): + return g_ImplementationHelper.supportsService( g_implName, ServiceName ) + def getImplementationName(self): + return g_implName + + +g_ImplementationHelper.addImplementation( \ + SampleUnoComponent,g_implName,("com.sun.star.test.bridge.PythonTestObject",),) + +#g_ImplementationEntries = \ +# unohelper.ImplementationEntry( \ +# "org.openoffice.comp.SamplePythonComponent", \ +# ("com.sun.star.test.bridge.PythonTestObject",), \ +# SampleUnoComponent) \ +# , + diff --git a/testtools/source/bridgetest/pyuno/testcomp.py b/testtools/source/bridgetest/pyuno/testcomp.py new file mode 100644 index 000000000..e519d5e8e --- /dev/null +++ b/testtools/source/bridgetest/pyuno/testcomp.py @@ -0,0 +1,31 @@ +# +# 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 . +# +import uno +import pythonloader + +ctx = uno.getComponentContext() + +loader = pythonloader.Loader( ctx ) +comp = loader.activate( "org.openoffice.comp.pyuno.PythonTestObject" , "", "samplecomponent", ctx ) +ctx.ServiceManager.insert( comp) + +bridgetest = ctx.ServiceManager.createInstanceWithContext( "com.sun.star.test.bridge.BridgeTest", ctx ) +#bridgetest.run( "com.sun.star.test.bridge.PythonTestObject" ) + + + diff --git a/testtools/source/bridgetest/testComponent.component b/testtools/source/bridgetest/testComponent.component new file mode 100644 index 000000000..e488f702d --- /dev/null +++ b/testtools/source/bridgetest/testComponent.component @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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 . + --> + +<component loader="com.sun.star.loader.Java2" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation + name="com.sun.star.comp.bridge.TestComponent$_PerformancTestObject"> + <service name="com.sun.star.comp.benchmark.JavaTestObject"/> + </implementation> + <implementation name="com.sun.star.comp.bridge.TestComponent$_TestObject"> + <service name="com.sun.star.test.bridge.JavaTestObject"/> + </implementation> +</component> diff --git a/testtools/source/cliversioning/makefile.mk b/testtools/source/cliversioning/makefile.mk new file mode 100644 index 000000000..aabbeb296 --- /dev/null +++ b/testtools/source/cliversioning/makefile.mk @@ -0,0 +1,134 @@ +# +# 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 . +# + +# Builds the SpreadSheet examples of the Developers Guide. + +PRJ = ..$/.. +PRJNAME = cli_ure +TARGET := test_climaker +PACKAGE = cliversion + +.INCLUDE: settings.mk + +.IF "$(CROSS_COMPILING)"=="YES" + +all: +# nothing + +.ENDIF + +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +.IF "$(debug)" != "" +CSCFLAGS += -checked+ -define:DEBUG -define:TRACE -debug+ +.ELSE +CSCFLAGS += -optimize+ +.ENDIF + + +EXETARGET2=$(BIN)$/runtests.exe + +.IF "$(name)" != "" +TESTLIB=$(BIN)$/$(name) +.ELSE +TESTLIB=$(BIN)$/version_current.dll +.ENDIF +VERSIONLIBS=version_libs + +CLI_URE = $(SOLARBINDIR)$/cli_ure.dll +CLI_URETYPES = $(SOLARBINDIR)$/cli_uretypes.dll +CLI_BASETYPES = $(SOLARBINDIR)$/cli_basetypes.dll +CLI_CPPUHELPER = $(SOLARBINDIR)$/cli_cppuhelper.dll +CLI_OOOTYPES = $(SOLARBINDIR)$/cli_oootypes.dll + + +.INCLUDE: target.mk + +.IF "$(BUILD_FOR_CLI)" == "" +ALLTAR: + +.ELSE +ALLTAR: \ + $(EXETARGET2) \ + $(TESTLIB) \ + $(MISC)$/copyassemblies.done \ + COPYVERSIONLIBS \ + RUNINSTRUCTIONS + +.ENDIF + + +COPYVERSIONLIBS: + -$(GNUCOPY) $(VERSIONLIBS)$/* $(BIN) + + +$(MISC)$/copyassemblies.done .ERRREMOVE: + $(GNUCOPY) $(CLI_CPPUHELPER) $(BIN)$/$(CLI_CPPUHELPER:f) + $(GNUCOPY) $(CLI_BASETYPES) $(BIN)$/$(CLI_BASETYPES:f) + $(GNUCOPY) $(CLI_URETYPES) $(BIN)$/$(CLI_URETYPES:f) + $(GNUCOPY) $(CLI_URE) $(BIN)$/$(CLI_URE:f) + $(GNUCOPY) $(CLI_OOOTYPES) $(BIN)$/$(CLI_OOOTYPES:f) + $(TOUCH) $@ + +CSFILES2 = runtests.cs + +.IF "$(CCNUMVER)" >= "001399999999" +CSCPLATFORMX86 = -platform:x86 +.ELSE +CSCPLATFORMX86 = +.ENDIF + +$(EXETARGET2): $(CSFILES2) + $(CSC) $(CSCFLAGS) -target:exe -out:$(EXETARGET2) $(CSCPLATFORMX86)\ + $(CSFILES2) + +CSFILESLIB = version.cs +$(TESTLIB): $(CSFILESLIB) $(SOLARBINDIR)$/cliureversion.mk + $(CSC) $(CSCFLAGS) -target:library -out:$(TESTLIB) \ + -reference:$(SOLARBINDIR)$/cli_ure.dll \ + -reference:$(SOLARBINDIR)$/cli_uretypes.dll \ + -reference:$(SOLARBINDIR)$/cli_basetypes.dll \ + -reference:$(SOLARBINDIR)$/cli_cppuhelper.dll \ + -reference:$(SOLARBINDIR)$/cli_oootypes.dll \ + $(CSFILESLIB) + + + +RUNINSTRUCTIONS : + @echo . + @echo ########################### N O T E ###################################### + @echo . + @echo To run the test go to qa\cliversioning, run dmake and follow instructions. + @echo . + @echo Or install an office with full system integration and run $(BIN)$/runtests.exe + @echo in a console without build environment. + @echo . + @echo Or install an office with setup /a. Expand PATH with the bin folder of the URE. + @echo Set UNO_PATH=system_path_to_program_folder + @echo This must be the program folder of the brand layer. + @echo For example, c:\staroffice\Sun\staroffice 9\program + @echo Run runtests.exe. + @echo . + @echo To build a test library with run. + @echo + @echo dmake name=version_10_10_10.dll + @echo + @echo The name must always start with 'version_'. + @echo ########################### N O T E ###################################### + @echo . + @echo . diff --git a/testtools/source/cliversioning/readme.txt b/testtools/source/cliversioning/readme.txt new file mode 100644 index 000000000..c2878c383 --- /dev/null +++ b/testtools/source/cliversioning/readme.txt @@ -0,0 +1,93 @@ +# +# 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 . +# + + +WINDOWS ONLY, no other platforms + + +This test checks if the cli assemblies and their policy files are installed in the +GAC and if the policy files are correct. The office must be installed with complete +system integration. That is, one does not use setup /a for starting the +installation. + +In OOo 3.0 there was a breaking change so that the test created for previous +version do not work anymore. To use these old tests one needs to install a +version of OOo less than v 3.0. Then one needs to check out the cli_ure module +for that version. The tests are contained in cli_ure/qa/versioning. + +In the sub directory version_libs are libraries which are linked with (referencing) +cli_cppuhelper +cli_basetypes +cli_ure +cli_uretypes +cli_oootypes + +They are named version_3_0_0 etc, where the name indicates the version of the +office for which they were initially build. If there are only the assemblies +for example OOo2.0.2 installed and a client was build with the assemblies from +OOo2 then the policy assemblies must make the correct redirection. + +When calling dmake then the executable runtest.exe and version_current.dll are +build. When runtest runs then it loads all dlls, which names start with +"version", from the same directory and tries to run a particular test code +which is only available in the version_xxx.dll s. The code in the +version_xxx.dlls uses the cli default bootstrap mechanism to find the office +installation and start the office. When running runtest in a build environment +then it may use the wrong libraries for bootstrapping in which case the test +fails. Then one has to set PATH which must point to the program directory of +the office installation. For example: + +set PATH=d:\office\program + +runtest stops when a test failed to run. It writes error information to the +console which shows which version_xxx.dll failed to run and if this was due to +a referenced assembly that could not be loaded. This would be the case if such +an assembly or the policy assembly is not properly installed or the redirection +in the policy assembly is wrong. + +The version_current.dll references the assemblies in the current build +environment. version_current.dll is also executed when runtest is started. + +To run the whole test one can either +1. start testools/wntmsci11.pro/bin/runtests.exe in a console where no +environment is set. +2. Call dmake run in testools/qa/cliversions + +For a limited test one can call in this directory +dmake run office=d:\office +There must not be an office installed in the system (the assemblies from the GAC +would then be used). Only the test with the version_current.dll will succeed +because there are no policy files installed. This test requires that all +assemblies are copied next to runtests.exe - the makefile will do that. + +The parameter office must be a system path to the office installation +directory. The java code calls runtest and also sets PATH so that the test +works in the build environment. It also sets UNO_PATH so that the office will be +found. If the test says that it failed, then one should run runtest directly +because it puts out more information. + + + +Creating a new version_xxx.dll +============================== +When a version of our assemblies changes then one should provide a new version dll which test exactly the assemblies with the changed version. This is easily done: +1. set the build environment in which the new versions are effective. +2 call: dmake name=version_xxx.dll +3. copy the new version dll from the output tree into qa/versioning/version_libs +4. commit the new version.dll using the -kb switch (only when creating the new file : cvs new -kb version_3_1_0.dll) + diff --git a/testtools/source/cliversioning/runtests.cs b/testtools/source/cliversioning/runtests.cs new file mode 100644 index 000000000..40cccefc6 --- /dev/null +++ b/testtools/source/cliversioning/runtests.cs @@ -0,0 +1,118 @@ +/* + * 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 . + */ + +using System; +using System.Reflection; +using System.IO; + +// __________ implementation ____________________________________ + +/** Create and modify a spreadsheet document. + */ +namespace cliversion +{ +public class RunTests +{ + + public static int Main(String[] args) + { +// System.Diagnostics.Debugger.Launch(); + //get the path to the directory + string sLocation = Assembly.GetExecutingAssembly().Location; + sLocation = sLocation.Substring(0, sLocation.LastIndexOf('\\')); + // Create a reference to the current directory. + DirectoryInfo di = new DirectoryInfo(sLocation); + // Create an array representing the files in the current directory. + FileInfo[] fi = di.GetFiles(); + + //For every found dll try to figure out if it contains a + //cliversion.Version class + foreach (FileInfo fiTemp in fi) + { + if (fiTemp.Extension != ".dll" + || ! fiTemp.Name.StartsWith("version")) + continue; + + Assembly ass = null; + Object objVersion = null; + try + { + string sName = fiTemp.Name.Substring(0, fiTemp.Name.LastIndexOf(".dll")); + ass = Assembly.Load(sName); + } + catch (BadImageFormatException) + { + continue; + } + catch (Exception e) + { + Console.WriteLine("#Unexpected Exception"); + Console.WriteLine(e.Message); + return -1; + } + + //Assembly is loaded, instantiate cliversion.Version + try + { + //This runs the test + objVersion = ass.CreateInstance("cliversion.Version"); + if (objVersion == null) + continue; + Console.WriteLine("#Tested successfully " + fiTemp.Name); + //Starting the office the second time may fail without this pause + System.Threading.Thread.Sleep(2000); + } + catch (Exception e) + { + TargetInvocationException te = e as TargetInvocationException; + if (te != null) + { + FileNotFoundException fe = e.InnerException as FileNotFoundException; + if (fe != null) + { + Console.WriteLine(fiTemp.Name + " did not find " + fe.FileName + + ". Maybe the " + fe.FileName + " is not installed or does not match the referenced version." + + "Original message: " + fe.Message + "\n\n FusionLog: \n" + fe.FusionLog ); + return -1; + } + FileLoadException fl = e.InnerException as FileLoadException; + if (fl != null) + { + Console.WriteLine(fiTemp.Name + " could not load " + fl.FileName + + ". Maybe the version of " + fl.FileName + " does not match the referenced version. " + + "Original message: " + fl.Message + "\n\n FusionLog: \n" + fl.FusionLog ); + return -1; + } + + if (e.InnerException != null) + { + Console.WriteLine(e.InnerException); + } + } + Console.WriteLine("#Unexpected Exception"); + Console.WriteLine(e.Message); + return -1; + } + } + //For some unknown reason this program hangs sometimes when started from java. This is + //a workaround that makes the problem disappear. + System.Threading.Thread.Sleep(1000); + return 0; + } +} +} diff --git a/testtools/source/cliversioning/version.cs b/testtools/source/cliversioning/version.cs new file mode 100644 index 000000000..b1717148d --- /dev/null +++ b/testtools/source/cliversioning/version.cs @@ -0,0 +1,599 @@ +/* + * 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 . + */ + +using System; +using unoidl.com.sun.star.lang; +using unoidl.com.sun.star.uno; +using unoidl.com.sun.star.frame; +using unoidl.com.sun.star.util; + +namespace cliversion +{ +public class Version +{ + public Version() + { + try + { +// System.Diagnostics.Debugger.Launch(); + + //link with cli_ure.dll + uno.util.WeakBase wb = new uno.util.WeakBase(); + using ( SpreadsheetSample aSample = new SpreadsheetSample() ) + { + aSample.doCellRangeSamples(); + aSample.terminate(); + } + } + catch (System.Exception ) + { + //This exception is thrown if we link with a library which is not + //available + throw; + } + } +} + +class SpreadsheetSample: SpreadsheetDocHelper +{ + public SpreadsheetSample() + { + } + /** All samples regarding the service com.sun.star.sheet.SheetCellRange. */ + public void doCellRangeSamples() + { + unoidl.com.sun.star.sheet.XSpreadsheet xSheet = getSpreadsheet( 0 ); + unoidl.com.sun.star.table.XCellRange xCellRange = null; + unoidl.com.sun.star.beans.XPropertySet xPropSet = null; + unoidl.com.sun.star.table.CellRangeAddress aRangeAddress = null; + + // Preparation + setFormula( xSheet, "B5", "First cell" ); + setFormula( xSheet, "B6", "Second cell" ); + // Get cell range B5:B6 by position - (column, row, column, row) + xCellRange = xSheet.getCellRangeByPosition( 1, 4, 1, 5 ); + + + // --- Change cell range properties. --- + xPropSet = (unoidl.com.sun.star.beans.XPropertySet) xCellRange; + // from com.sun.star.styles.CharacterProperties + xPropSet.setPropertyValue( + "CharColor", new uno.Any( (Int32) 0x003399 ) ); + xPropSet.setPropertyValue( + "CharHeight", new uno.Any( (Single) 20.0 ) ); + // from com.sun.star.styles.ParagraphProperties + xPropSet.setPropertyValue( + "ParaLeftMargin", new uno.Any( (Int32) 500 ) ); + // from com.sun.star.table.CellProperties + xPropSet.setPropertyValue( + "IsCellBackgroundTransparent", new uno.Any( false ) ); + xPropSet.setPropertyValue( + "CellBackColor", new uno.Any( (Int32) 0x99CCFF ) ); + + + // --- Replace text in all cells. --- + unoidl.com.sun.star.util.XReplaceable xReplace = + (unoidl.com.sun.star.util.XReplaceable) xCellRange; + unoidl.com.sun.star.util.XReplaceDescriptor xReplaceDesc = + xReplace.createReplaceDescriptor(); + xReplaceDesc.setSearchString( "cell" ); + xReplaceDesc.setReplaceString( "text" ); + // property SearchWords searches for whole cells! + xReplaceDesc.setPropertyValue( "SearchWords", new uno.Any( false ) ); + int nCount = xReplace.replaceAll( xReplaceDesc ); + + // --- Merge cells. --- + xCellRange = xSheet.getCellRangeByName( "F3:G6" ); + prepareRange( xSheet, "E1:H7", "XMergeable" ); + unoidl.com.sun.star.util.XMergeable xMerge = + (unoidl.com.sun.star.util.XMergeable) xCellRange; + xMerge.merge( true ); + + + // --- Column properties. --- + xCellRange = xSheet.getCellRangeByName( "B1" ); + unoidl.com.sun.star.table.XColumnRowRange xColRowRange = + (unoidl.com.sun.star.table.XColumnRowRange) xCellRange; + unoidl.com.sun.star.table.XTableColumns xColumns = + xColRowRange.getColumns(); + + uno.Any aColumnObj = xColumns.getByIndex( 0 ); + xPropSet = (unoidl.com.sun.star.beans.XPropertySet) aColumnObj.Value; + xPropSet.setPropertyValue( "Width", new uno.Any( (Int32) 6000 ) ); + + unoidl.com.sun.star.container.XNamed xNamed = + (unoidl.com.sun.star.container.XNamed) aColumnObj.Value; + + // --- Cell range data --- + prepareRange( xSheet, "A9:C30", "XCellRangeData" ); + + xCellRange = xSheet.getCellRangeByName( "A10:C30" ); + unoidl.com.sun.star.sheet.XCellRangeData xData = + (unoidl.com.sun.star.sheet.XCellRangeData) xCellRange; + uno.Any [][] aValues = + { + new uno.Any [] { new uno.Any( "Name" ), + new uno.Any( "Fruit" ), + new uno.Any( "Quantity" ) }, + new uno.Any [] { new uno.Any( "Alice" ), + new uno.Any( "Apples" ), + new uno.Any( (Double) 3.0 ) }, + new uno.Any [] { new uno.Any( "Alice" ), + new uno.Any( "Oranges" ), + new uno.Any( (Double) 7.0 ) }, + new uno.Any [] { new uno.Any( "Bob" ), + new uno.Any( "Apples" ), + new uno.Any( (Double) 3.0 ) }, + new uno.Any [] { new uno.Any( "Alice" ), + new uno.Any( "Apples" ), + new uno.Any( (Double) 9.0 ) }, + new uno.Any [] { new uno.Any( "Bob" ), + new uno.Any( "Apples" ), + new uno.Any( (Double) 5.0 ) }, + new uno.Any [] { new uno.Any( "Bob" ), + new uno.Any( "Oranges" ), + new uno.Any( (Double) 6.0 ) }, + new uno.Any [] { new uno.Any( "Alice" ), + new uno.Any( "Oranges" ), + new uno.Any( (Double) 3.0 ) }, + new uno.Any [] { new uno.Any( "Alice" ), + new uno.Any( "Apples" ), + new uno.Any( (Double) 8.0 ) }, + new uno.Any [] { new uno.Any( "Alice" ), + new uno.Any( "Oranges" ), + new uno.Any( (Double) 1.0 ) }, + new uno.Any [] { new uno.Any( "Bob" ), + new uno.Any( "Oranges" ), + new uno.Any( (Double) 2.0 ) }, + new uno.Any [] { new uno.Any( "Bob" ), + new uno.Any( "Oranges" ), + new uno.Any( (Double) 7.0 ) }, + new uno.Any [] { new uno.Any( "Bob" ), + new uno.Any( "Apples" ), + new uno.Any( (Double) 1.0 ) }, + new uno.Any [] { new uno.Any( "Alice" ), + new uno.Any( "Apples" ), + new uno.Any( (Double) 8.0 ) }, + new uno.Any [] { new uno.Any( "Alice" ), + new uno.Any( "Oranges" ), + new uno.Any( (Double) 8.0 ) }, + new uno.Any [] { new uno.Any( "Alice" ), + new uno.Any( "Apples" ), + new uno.Any( (Double) 7.0 ) }, + new uno.Any [] { new uno.Any( "Bob" ), + new uno.Any( "Apples" ), + new uno.Any( (Double) 1.0 ) }, + new uno.Any [] { new uno.Any( "Bob" ), + new uno.Any( "Oranges" ), + new uno.Any( (Double) 9.0 ) }, + new uno.Any [] { new uno.Any( "Bob" ), + new uno.Any( "Oranges" ), + new uno.Any( (Double) 3.0 ) }, + new uno.Any [] { new uno.Any( "Alice" ), + new uno.Any( "Oranges" ), + new uno.Any( (Double) 4.0 ) }, + new uno.Any [] { new uno.Any( "Alice" ), + new uno.Any( "Apples" ), + new uno.Any( (Double) 9.0 ) } + }; + xData.setDataArray( aValues ); + + + // --- Get cell range address. --- + unoidl.com.sun.star.sheet.XCellRangeAddressable xRangeAddr = + (unoidl.com.sun.star.sheet.XCellRangeAddressable) xCellRange; + aRangeAddress = xRangeAddr.getRangeAddress(); + + // --- Sheet operation. --- + // uses the range filled with XCellRangeData + unoidl.com.sun.star.sheet.XSheetOperation xSheetOp = + (unoidl.com.sun.star.sheet.XSheetOperation) xData; + double fResult = xSheetOp.computeFunction( + unoidl.com.sun.star.sheet.GeneralFunction.AVERAGE ); + + // --- Fill series --- + // Prepare the example + setValue( xSheet, "E10", 1 ); + setValue( xSheet, "E11", 4 ); + setDate( xSheet, "E12", 30, 1, 2002 ); + setFormula( xSheet, "I13", "Text 10" ); + setFormula( xSheet, "E14", "Jan" ); + setValue( xSheet, "K14", 10 ); + setValue( xSheet, "E16", 1 ); + setValue( xSheet, "F16", 2 ); + setDate( xSheet, "E17", 28, 2, 2002 ); + setDate( xSheet, "F17", 28, 1, 2002 ); + setValue( xSheet, "E18", 6 ); + setValue( xSheet, "F18", 4 ); + + } + + /** Returns the XCellSeries interface of a cell range. + @param xSheet The spreadsheet containing the cell range. + @param aRange The address of the cell range. + @return The XCellSeries interface. */ + private unoidl.com.sun.star.sheet.XCellSeries getCellSeries( + unoidl.com.sun.star.sheet.XSpreadsheet xSheet, String aRange ) + { + return (unoidl.com.sun.star.sheet.XCellSeries) + xSheet.getCellRangeByName( aRange ); + } + +} + +/** This is a helper class for the spreadsheet and table samples. + It connects to a running office and creates a spreadsheet document. + Additionally it contains various helper functions. + */ +class SpreadsheetDocHelper : System.IDisposable +{ + +// __ private members ___________________________________________ + + private const String msDataSheetName = "Data"; + + private unoidl.com.sun.star.uno.XComponentContext m_xContext; + private unoidl.com.sun.star.lang.XMultiServiceFactory mxMSFactory; + private unoidl.com.sun.star.sheet.XSpreadsheetDocument mxDocument; + + + + public SpreadsheetDocHelper() + { +// System.Diagnostics.Debugger.Launch(); + // Connect to a running office and get the service manager + mxMSFactory = connect(); + // Create a new spreadsheet document + mxDocument = initDocument(); + } + +// __ helper methods ____________________________________________ + + /** Returns the service manager. + @return XMultiServiceFactory interface of the service manager. */ + public unoidl.com.sun.star.lang.XMultiServiceFactory getServiceManager() + { + return mxMSFactory; + } + + /** Returns the whole spreadsheet document. + @return XSpreadsheetDocument interface of the document. */ + public unoidl.com.sun.star.sheet.XSpreadsheetDocument getDocument() + { + return mxDocument; + } + + /** Returns the spreadsheet with the specified index (0-based). + @param nIndex The index of the sheet. + @return XSpreadsheet interface of the sheet. */ + public unoidl.com.sun.star.sheet.XSpreadsheet getSpreadsheet( int nIndex ) + { + // Collection of sheets + unoidl.com.sun.star.sheet.XSpreadsheets xSheets = + mxDocument.getSheets(); + + unoidl.com.sun.star.container.XIndexAccess xSheetsIA = + (unoidl.com.sun.star.container.XIndexAccess) xSheets; + + unoidl.com.sun.star.sheet.XSpreadsheet xSheet = + (unoidl.com.sun.star.sheet.XSpreadsheet) + xSheetsIA.getByIndex( nIndex ).Value; + + return xSheet; + } + + /** Inserts a new empty spreadsheet with the specified name. + @param aName The name of the new sheet. + @param nIndex The insertion index. + @return The XSpreadsheet interface of the new sheet. */ + public unoidl.com.sun.star.sheet.XSpreadsheet insertSpreadsheet( + String aName, short nIndex ) + { + // Collection of sheets + unoidl.com.sun.star.sheet.XSpreadsheets xSheets = + mxDocument.getSheets(); + + xSheets.insertNewByName( aName, nIndex ); + unoidl.com.sun.star.sheet.XSpreadsheet xSheet = + (unoidl.com.sun.star.sheet.XSpreadsheet) + xSheets.getByName( aName ).Value; + + return xSheet; + } + + +// Methods to fill values into cells. + + /** Writes a double value into a spreadsheet. + @param xSheet The XSpreadsheet interface of the spreadsheet. + @param aCellName The address of the cell (or a named range). + @param fValue The value to write into the cell. */ + public void setValue( + unoidl.com.sun.star.sheet.XSpreadsheet xSheet, + String aCellName, + double fValue ) + { + xSheet.getCellRangeByName( aCellName ).getCellByPosition( + 0, 0 ).setValue( fValue ); + } + + /** Writes a formula into a spreadsheet. + @param xSheet The XSpreadsheet interface of the spreadsheet. + @param aCellName The address of the cell (or a named range). + @param aFormula The formula to write into the cell. */ + public void setFormula( + unoidl.com.sun.star.sheet.XSpreadsheet xSheet, + String aCellName, + String aFormula ) + { + xSheet.getCellRangeByName( aCellName ).getCellByPosition( + 0, 0 ).setFormula( aFormula ); + } + + /** Writes a date with standard date format into a spreadsheet. + @param xSheet The XSpreadsheet interface of the spreadsheet. + @param aCellName The address of the cell (or a named range). + @param nDay The day of the date. + @param nMonth The month of the date. + @param nYear The year of the date. */ + public void setDate( + unoidl.com.sun.star.sheet.XSpreadsheet xSheet, + String aCellName, + int nDay, int nMonth, int nYear ) + { + // Set the date value. + unoidl.com.sun.star.table.XCell xCell = + xSheet.getCellRangeByName( aCellName ).getCellByPosition( 0, 0 ); + String aDateStr = nMonth + "/" + nDay + "/" + nYear; + xCell.setFormula( aDateStr ); + + // Set standard date format. + unoidl.com.sun.star.util.XNumberFormatsSupplier xFormatsSupplier = + (unoidl.com.sun.star.util.XNumberFormatsSupplier) getDocument(); + unoidl.com.sun.star.util.XNumberFormatTypes xFormatTypes = + (unoidl.com.sun.star.util.XNumberFormatTypes) + xFormatsSupplier.getNumberFormats(); + int nFormat = xFormatTypes.getStandardFormat( + unoidl.com.sun.star.util.NumberFormat.DATE, + new unoidl.com.sun.star.lang.Locale() ); + + unoidl.com.sun.star.beans.XPropertySet xPropSet = + (unoidl.com.sun.star.beans.XPropertySet) xCell; + xPropSet.setPropertyValue( + "NumberFormat", + new uno.Any( (Int32) nFormat ) ); + } + + /** Draws a colored border around the range and writes the headline + in the first cell. + + @param xSheet The XSpreadsheet interface of the spreadsheet. + @param aRange The address of the cell range (or a named range). + @param aHeadline The headline text. */ + public void prepareRange( + unoidl.com.sun.star.sheet.XSpreadsheet xSheet, + String aRange, String aHeadline ) + { + unoidl.com.sun.star.beans.XPropertySet xPropSet = null; + unoidl.com.sun.star.table.XCellRange xCellRange = null; + + // draw border + xCellRange = xSheet.getCellRangeByName( aRange ); + xPropSet = (unoidl.com.sun.star.beans.XPropertySet) xCellRange; + unoidl.com.sun.star.table.BorderLine aLine = + new unoidl.com.sun.star.table.BorderLine(); + aLine.Color = 0x99CCFF; + aLine.InnerLineWidth = aLine.LineDistance = 0; + aLine.OuterLineWidth = 100; + unoidl.com.sun.star.table.TableBorder aBorder = + new unoidl.com.sun.star.table.TableBorder(); + aBorder.TopLine = aBorder.BottomLine = aBorder.LeftLine = + aBorder.RightLine = aLine; + aBorder.IsTopLineValid = aBorder.IsBottomLineValid = true; + aBorder.IsLeftLineValid = aBorder.IsRightLineValid = true; + xPropSet.setPropertyValue( + "TableBorder", + new uno.Any( + typeof (unoidl.com.sun.star.table.TableBorder), aBorder ) ); + + // draw headline + unoidl.com.sun.star.sheet.XCellRangeAddressable xAddr = + (unoidl.com.sun.star.sheet.XCellRangeAddressable) xCellRange; + unoidl.com.sun.star.table.CellRangeAddress aAddr = + xAddr.getRangeAddress(); + + xCellRange = xSheet.getCellRangeByPosition( + aAddr.StartColumn, + aAddr.StartRow, aAddr.EndColumn, aAddr.StartRow ); + + xPropSet = (unoidl.com.sun.star.beans.XPropertySet) xCellRange; + xPropSet.setPropertyValue( + "CellBackColor", new uno.Any( (Int32) 0x99CCFF ) ); + // write headline + unoidl.com.sun.star.table.XCell xCell = + xCellRange.getCellByPosition( 0, 0 ); + xCell.setFormula( aHeadline ); + xPropSet = (unoidl.com.sun.star.beans.XPropertySet) xCell; + xPropSet.setPropertyValue( + "CharColor", new uno.Any( (Int32) 0x003399 ) ); + xPropSet.setPropertyValue( + "CharWeight", + new uno.Any( (Single) unoidl.com.sun.star.awt.FontWeight.BOLD ) ); + } + + +// Methods to create cell addresses and range addresses. + + /** Creates a unoidl.com.sun.star.table.CellAddress and initializes it + with the given range. + @param xSheet The XSpreadsheet interface of the spreadsheet. + @param aCell The address of the cell (or a named cell). */ + public unoidl.com.sun.star.table.CellAddress createCellAddress( + unoidl.com.sun.star.sheet.XSpreadsheet xSheet, + String aCell ) + { + unoidl.com.sun.star.sheet.XCellAddressable xAddr = + (unoidl.com.sun.star.sheet.XCellAddressable) + xSheet.getCellRangeByName( aCell ).getCellByPosition( 0, 0 ); + return xAddr.getCellAddress(); + } + + /** Creates a unoidl.com.sun.star.table.CellRangeAddress and initializes + it with the given range. + @param xSheet The XSpreadsheet interface of the spreadsheet. + @param aRange The address of the cell range (or a named range). */ + public unoidl.com.sun.star.table.CellRangeAddress createCellRangeAddress( + unoidl.com.sun.star.sheet.XSpreadsheet xSheet, String aRange ) + { + unoidl.com.sun.star.sheet.XCellRangeAddressable xAddr = + (unoidl.com.sun.star.sheet.XCellRangeAddressable) + xSheet.getCellRangeByName( aRange ); + return xAddr.getRangeAddress(); + } + + +// Methods to convert cell addresses and range addresses to strings. + + /** Returns the text address of the cell. + @param nColumn The column index. + @param nRow The row index. + @return A string containing the cell address. */ + public String getCellAddressString( int nColumn, int nRow ) + { + String aStr = ""; + if (nColumn > 25) + aStr += (char) ('A' + nColumn / 26 - 1); + aStr += (char) ('A' + nColumn % 26); + aStr += (nRow + 1); + return aStr; + } + + /** Returns the text address of the cell range. + @param aCellRange The cell range address. + @return A string containing the cell range address. */ + public String getCellRangeAddressString( + unoidl.com.sun.star.table.CellRangeAddress aCellRange ) + { + return + getCellAddressString( aCellRange.StartColumn, aCellRange.StartRow ) + + ":" + + getCellAddressString( aCellRange.EndColumn, aCellRange.EndRow ); + } + + /** Returns the text address of the cell range. + @param xCellRange The XSheetCellRange interface of the cell range. + @param bWithSheet true = Include sheet name. + @return A string containing the cell range address. */ + public String getCellRangeAddressString( + unoidl.com.sun.star.sheet.XSheetCellRange xCellRange, bool bWithSheet ) + { + String aStr = ""; + if (bWithSheet) + { + unoidl.com.sun.star.sheet.XSpreadsheet xSheet = + xCellRange.getSpreadsheet(); + unoidl.com.sun.star.container.XNamed xNamed = + (unoidl.com.sun.star.container.XNamed) xSheet; + aStr += xNamed.getName() + "."; + } + unoidl.com.sun.star.sheet.XCellRangeAddressable xAddr = + (unoidl.com.sun.star.sheet.XCellRangeAddressable) xCellRange; + aStr += getCellRangeAddressString( xAddr.getRangeAddress() ); + return aStr; + } + + /** Returns a list of addresses of all cell ranges contained in the + collection. + + @param xRangesIA The XIndexAccess interface of the collection. + @return A string containing the cell range address list. */ + public String getCellRangeListString( + unoidl.com.sun.star.container.XIndexAccess xRangesIA ) + { + String aStr = ""; + int nCount = xRangesIA.getCount(); + for (int nIndex = 0; nIndex < nCount; ++nIndex) + { + if (nIndex > 0) + aStr += " "; + uno.Any aRangeObj = xRangesIA.getByIndex( nIndex ); + unoidl.com.sun.star.sheet.XSheetCellRange xCellRange = + (unoidl.com.sun.star.sheet.XSheetCellRange) aRangeObj.Value; + aStr += getCellRangeAddressString( xCellRange, false ); + } + return aStr; + } + + + + /** Connect to a running office that is accepting connections. + @return The ServiceManager to instantiate office components. */ + private XMultiServiceFactory connect() + { + + m_xContext = uno.util.Bootstrap.bootstrap(); + + return (XMultiServiceFactory) m_xContext.getServiceManager(); + } + + public void Dispose() + { + + } + + /** Creates an empty spreadsheet document. + @return The XSpreadsheetDocument interface of the document. */ + private unoidl.com.sun.star.sheet.XSpreadsheetDocument initDocument() + { + XComponentLoader aLoader = (XComponentLoader) + mxMSFactory.createInstance( "com.sun.star.frame.Desktop" ); + + XComponent xComponent = aLoader.loadComponentFromURL( + "private:factory/scalc", "_blank", 0, + new unoidl.com.sun.star.beans.PropertyValue[0] ); + + return (unoidl.com.sun.star.sheet.XSpreadsheetDocument) xComponent; + } + + + public void terminate() + { + XModifiable xMod = (XModifiable) mxDocument; + if (xMod != null) + xMod.setModified(false); + XDesktop aDesktop = (XDesktop) + mxMSFactory.createInstance( "com.sun.star.frame.Desktop" ); + if (aDesktop != null) + { + try + { + aDesktop.terminate(); + } + catch (DisposedException d) + { + //This exception may be thrown because shutting down OOo using + //XDesktop terminate does not really work. In the case of the + //Exception OOo will still terminate. + } + } + } + + +} + +} diff --git a/testtools/source/cliversioning/version_libs/readme.txt b/testtools/source/cliversioning/version_libs/readme.txt new file mode 100644 index 000000000..a78c22e1a --- /dev/null +++ b/testtools/source/cliversioning/version_libs/readme.txt @@ -0,0 +1,3 @@ +These binary files are needed for this test. They have been linked with +earlier versions of the cli libraries, and cannot be build this way again +in a current version of the build environment.
\ No newline at end of file diff --git a/testtools/source/cliversioning/version_libs/version_3_0_0.dll b/testtools/source/cliversioning/version_libs/version_3_0_0.dll Binary files differnew file mode 100644 index 000000000..71769a44f --- /dev/null +++ b/testtools/source/cliversioning/version_libs/version_3_0_0.dll diff --git a/testtools/source/cliversioning/version_libs/version_3_0_1.dll b/testtools/source/cliversioning/version_libs/version_3_0_1.dll Binary files differnew file mode 100644 index 000000000..823cfc8c8 --- /dev/null +++ b/testtools/source/cliversioning/version_libs/version_3_0_1.dll diff --git a/testtools/source/cliversioning/version_libs/version_3_1.dll b/testtools/source/cliversioning/version_libs/version_3_1.dll Binary files differnew file mode 100755 index 000000000..b16da2df5 --- /dev/null +++ b/testtools/source/cliversioning/version_libs/version_3_1.dll diff --git a/testtools/source/cliversioning/version_libs/version_3_1_1.dll b/testtools/source/cliversioning/version_libs/version_3_1_1.dll Binary files differnew file mode 100644 index 000000000..9ff42fc23 --- /dev/null +++ b/testtools/source/cliversioning/version_libs/version_3_1_1.dll diff --git a/testtools/source/cliversioning/version_libs/version_3_2.dll b/testtools/source/cliversioning/version_libs/version_3_2.dll Binary files differnew file mode 100755 index 000000000..e89232441 --- /dev/null +++ b/testtools/source/cliversioning/version_libs/version_3_2.dll diff --git a/testtools/source/cliversioning/version_libs/version_3_2_1.dll b/testtools/source/cliversioning/version_libs/version_3_2_1.dll Binary files differnew file mode 100755 index 000000000..037f5ddee --- /dev/null +++ b/testtools/source/cliversioning/version_libs/version_3_2_1.dll diff --git a/testtools/source/cliversioning/version_libs/version_3_3.dll b/testtools/source/cliversioning/version_libs/version_3_3.dll Binary files differnew file mode 100755 index 000000000..a63a43632 --- /dev/null +++ b/testtools/source/cliversioning/version_libs/version_3_3.dll diff --git a/testtools/source/performance/cli_testobj_performance.cs b/testtools/source/performance/cli_testobj_performance.cs new file mode 100644 index 000000000..4affe89cd --- /dev/null +++ b/testtools/source/performance/cli_testobj_performance.cs @@ -0,0 +1,109 @@ +/* + * 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 . + */ + +using System; +using System.Diagnostics; +using uno; +using uno.util; +using unoidl.com.sun.star.uno; +using unoidl.com.sun.star.lang; +using unoidl.com.sun.star.test.performance; + +namespace testobj +{ + +[ServiceImplementation( "com.sun.star.test.performance.cli_uno.TestObject" )] +public class PerformanceTestObject : ServiceBase, XPerformanceTest +{ + private XComponentContext m_xContext; + + public PerformanceTestObject( XComponentContext xContext ) + { + m_xContext = xContext; + } + public PerformanceTestObject() + { + } + + private int _long; + private long _hyper; + private float _float; + private double _double; + private String _string = ""; + private Object _xInterface; + private Any _any; + private Object[] _interface_sequence = new Object[0]; + private ComplexTypes _complexTypes = new ComplexTypes(); + + // Attributes + public int getLong_attr() { return _long; } + public void setLong_attr( int _long_attr ) { _long = _long_attr; } + public long getHyper_attr() { return _hyper; } + public void setHyper_attr( long _hyper_attr ) { _hyper = _hyper_attr; } + public float getFloat_attr() { return _float; } + public void setFloat_attr( float _float_attr ) { _float = _float; } + public double getDouble_attr() { return _double; } + public void setDouble_attr( double _double_attr ) { _double = _double_attr; } + public String getString_attr() { return _string; } + public void setString_attr( String _string_attr ) { _string = _string_attr; } + public Object getInterface_attr() { return _xInterface; } + public void setInterface_attr( Object _interface_attr ) { _xInterface = _interface_attr; } + public Any getAny_attr() { return _any; } + public void setAny_attr( ref Any _any_attr ) { _any = _any_attr; } + public Object[] getSequence_attr() { return _interface_sequence; } + public void setSequence_attr(Object[] _sequence_attr ) { _interface_sequence = _sequence_attr; } + public ComplexTypes getStruct_attr() { return _complexTypes; } + public void setStruct_attr( ComplexTypes _struct_attr ) { _complexTypes = _struct_attr; } + + // Methods + public void async() {} + public void sync( ) {} + public ComplexTypes complex_in( /*IN*/ComplexTypes aVal ) { return aVal; } + public ComplexTypes complex_inout( /*INOUT*/ref ComplexTypes aVal ) { return aVal; } + public void complex_oneway( /*IN*/ComplexTypes aVal ) {} + public void complex_noreturn( /*IN*/ComplexTypes aVal ) {} + public XPerformanceTest createObject( ) { return new PerformanceTestObject(); } + public int getLong() { return _long; } + public void setLong(/*IN*/int n) { _long = n; } + public long getHyper() { return _hyper; } + public void setHyper(/*IN*/long n) { _hyper = n; } + public float getFloat() { return _float; } + public void setFloat( /*IN*/float f ) { _float = f; } + public double getDouble( ) { return _double; } + public void setDouble( /*IN*/double f ) { _double = f; } + public String getString( ) { return _string; } + public void setString( /*IN*/String s ) { _string = s; } + public Object getInterface( ) { return _xInterface; } + public void setInterface( /*IN*/Object x ) { _xInterface = x; } + public Any getAny( ) { return _any; } + public void setAny( /*IN*/ref Any a ) { _any = a; } + public Object[] getSequence( ) { return _interface_sequence; } + public void setSequence( /*IN*/Object[] seq ) + { +#if DEBUG +// Debug.WriteLine( "#### " + GetType().FullName + ".setSequence:" + seq ); + Console.WriteLine( "#### " + GetType().FullName + ".setSequence:" + seq ); +#endif + _interface_sequence = seq; + } + public ComplexTypes getStruct( ) { return _complexTypes; } + public void setStruct( /*IN*/ComplexTypes c ) { _complexTypes = c; } + public void raiseRuntimeException( ) { throw new RuntimeException(); } +} + +} diff --git a/testtools/source/performance/exports.dxp b/testtools/source/performance/exports.dxp new file mode 100644 index 000000000..51703a046 --- /dev/null +++ b/testtools/source/performance/exports.dxp @@ -0,0 +1,2 @@ +component_writeInfo +component_getFactory diff --git a/testtools/source/performance/makefile.mk b/testtools/source/performance/makefile.mk new file mode 100644 index 000000000..be63e5349 --- /dev/null +++ b/testtools/source/performance/makefile.mk @@ -0,0 +1,89 @@ +# +# 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 . +# + +PRJ=..$/.. + +PRJNAME=testtools +TARGET=performancetest +ENABLE_EXCEPTIONS=TRUE +USE_DEFFILE=TRUE +LIBTARGET=NO + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# ------------------------------------------------------------------ + +LIB1TARGET=$(SLB)$/perftest.lib +LIB1OBJFILES= \ + $(SLO)$/ubtest.obj + +SHL1TARGET = $(ENFORCEDSHLPREFIX)$(ENFORCEDSHLPREFIX)perftest.uno + +SHL1VERSIONMAP = $(SOLARENV)$/src$/component.map + +SHL1STDLIBS= \ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(SALLIB) + +SHL1LIBS= $(LIB1TARGET) +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +DEF1NAME= $(SHL1TARGET) + +# ---- test object ---- + +LIB2TARGET=$(SLB)$/perfobj.lib +LIB2OBJFILES= \ + $(SLO)$/ubobject.obj + +SHL2TARGET = $(ENFORCEDSHLPREFIX)$(ENFORCEDSHLPREFIX)perfobj.uno + +SHL2VERSIONMAP = $(SOLARENV)$/src$/component.map + +SHL2STDLIBS= \ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(SALLIB) + +SHL2LIBS= $(LIB2TARGET) +SHL2DEF= $(MISC)$/$(SHL2TARGET).def +DEF2NAME= $(SHL2TARGET) + +# ---- pseudo uno bridge ---- + +LIB3TARGET=$(SLB)$/pseudo.lib +LIB3OBJFILES= \ + $(SLO)$/pseudo.obj + +SHL3TARGET=pseudo_uno_uno + +SHL3VERSIONMAP = pseudo_uno_uno.map + +SHL3STDLIBS= \ + $(CPPULIB) \ + $(SALLIB) + +SHL3LIBS= $(LIB3TARGET) +SHL3DEF= $(MISC)$/$(SHL3TARGET).def +DEF3NAME= $(SHL3TARGET) + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/testtools/source/performance/pseudo.cxx b/testtools/source/performance/pseudo.cxx new file mode 100644 index 000000000..8417a0aa9 --- /dev/null +++ b/testtools/source/performance/pseudo.cxx @@ -0,0 +1,264 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#include <osl/diagnose.h> +#include <osl/interlck.h> +#include <rtl/ustring.hxx> +#include <typelib/typedescription.h> +#include <uno/dispatcher.h> +#include <uno/environment.h> +#include <uno/mapping.h> +#include <uno/lbnames.h> + + +namespace pseudo_uno +{ + + +struct pseudo_Mapping : public uno_Mapping +{ + oslInterlockedCount nRef; + + uno_ExtEnvironment * pFrom; + uno_ExtEnvironment * pTo; + + pseudo_Mapping( uno_ExtEnvironment * pFrom_, uno_ExtEnvironment * pTo_ ); + ~pseudo_Mapping(); +}; + +//==== a UNO pseudo proxy ============================================================================= +struct pseudo_unoInterfaceProxy : public uno_Interface +{ + oslInterlockedCount nRef; + pseudo_Mapping * pPseudoMapping; + + // mapping information + uno_Interface * pUnoI; // wrapped interface + typelib_InterfaceTypeDescription * pTypeDescr; + OUString oid; + + // ctor + inline pseudo_unoInterfaceProxy( pseudo_Mapping * pPseudoMapping_, + uno_Interface * pUnoI_, + typelib_InterfaceTypeDescription * pTypeDescr_, + const OUString & rOId_ ); +}; + +static void SAL_CALL pseudo_unoInterfaceProxy_dispatch( + uno_Interface * pUnoI, + const typelib_TypeDescription * pMemberType, + void * pReturn, + void * pArgs[], + uno_Any ** ppException ) +{ + pseudo_unoInterfaceProxy * pThis = static_cast< pseudo_unoInterfaceProxy * >( pUnoI ); + (*pThis->pUnoI->pDispatcher)( pThis->pUnoI, pMemberType, pReturn, pArgs, ppException ); +} + + +static void SAL_CALL pseudo_unoInterfaceProxy_free( uno_ExtEnvironment * pEnv, void * pProxy ) +{ + pseudo_unoInterfaceProxy * pThis = + static_cast< pseudo_unoInterfaceProxy * >( + reinterpret_cast< uno_Interface * >( pProxy ) ); + OSL_ASSERT( pEnv == pThis->pPseudoMapping->pTo ); + + (*pThis->pPseudoMapping->pFrom->revokeInterface)( pThis->pPseudoMapping->pFrom, pThis->pUnoI ); + (*pThis->pUnoI->release)( pThis->pUnoI ); + typelib_typedescription_release( (typelib_TypeDescription *)pThis->pTypeDescr ); + (*pThis->pPseudoMapping->release)( pThis->pPseudoMapping ); + +#if OSL_DEBUG_LEVEL > 0 + *(int *)pProxy = 0xdeadbabe; +#endif + delete pThis; +} + +static void SAL_CALL pseudo_unoInterfaceProxy_acquire( uno_Interface * pUnoI ) +{ + if (1 == osl_atomic_increment( &static_cast< pseudo_unoInterfaceProxy * >( pUnoI )->nRef )) + { + // rebirth of proxy zombie + // register at uno env + void * pThis = static_cast< uno_Interface * >( pUnoI ); + (*static_cast< pseudo_unoInterfaceProxy * >( pUnoI )->pPseudoMapping->pTo->registerProxyInterface)( + static_cast< pseudo_unoInterfaceProxy * >( pUnoI )->pPseudoMapping->pTo, + &pThis, pseudo_unoInterfaceProxy_free, + static_cast< pseudo_unoInterfaceProxy * >( pUnoI )->oid.pData, + static_cast< pseudo_unoInterfaceProxy * >( pUnoI )->pTypeDescr ); + OSL_ASSERT( pThis == static_cast< uno_Interface * >( pUnoI ) ); + } +} + +static void SAL_CALL pseudo_unoInterfaceProxy_release( uno_Interface * pUnoI ) +{ + if (! osl_atomic_decrement( & static_cast< pseudo_unoInterfaceProxy * >( pUnoI )->nRef )) + { + // revoke from uno env on last release + (*static_cast< pseudo_unoInterfaceProxy * >( pUnoI )->pPseudoMapping->pTo->revokeInterface)( + static_cast< pseudo_unoInterfaceProxy * >( pUnoI )->pPseudoMapping->pTo, pUnoI ); + } +} + +inline pseudo_unoInterfaceProxy::pseudo_unoInterfaceProxy( + pseudo_Mapping * pPseudoMapping_, uno_Interface * pUnoI_, + typelib_InterfaceTypeDescription * pTypeDescr_, const OUString & rOId_ ) + : nRef( 1 ) + , pPseudoMapping( pPseudoMapping_ ) + , pUnoI( pUnoI_ ) + , pTypeDescr( pTypeDescr_ ) + , oid( rOId_ ) +{ + (*pPseudoMapping->acquire)( pPseudoMapping ); + typelib_typedescription_acquire( (typelib_TypeDescription *)pTypeDescr ); + (*pPseudoMapping->pFrom->registerInterface)( + pPseudoMapping->pFrom, reinterpret_cast< void ** >( &pUnoI ), oid.pData, pTypeDescr ); + (*pUnoI->acquire)( pUnoI ); + + // uno_Interface + uno_Interface::acquire = pseudo_unoInterfaceProxy_acquire; + uno_Interface::release = pseudo_unoInterfaceProxy_release; + uno_Interface::pDispatcher = pseudo_unoInterfaceProxy_dispatch; +} + + +static void SAL_CALL pseudo_Mapping_mapInterface( + uno_Mapping * pMapping, void ** ppOut, + void * pUnoI, typelib_InterfaceTypeDescription * pTypeDescr ) +{ + OSL_ASSERT( ppOut && pTypeDescr ); + if (*ppOut) + { + (*reinterpret_cast< uno_Interface * >( *ppOut )->release)( + reinterpret_cast< uno_Interface * >( *ppOut ) ); + *ppOut = 0; + } + if (pUnoI && pTypeDescr) + { + // get object id of uno interface to be wrapped + rtl_uString * pOId = 0; + (*static_cast< pseudo_Mapping * >( pMapping )->pFrom->getObjectIdentifier)( + static_cast< pseudo_Mapping * >( pMapping )->pFrom, &pOId, pUnoI ); + OSL_ASSERT( pOId ); + + if (pOId) + { + // try to get any known interface from target environment + (*static_cast< pseudo_Mapping * >( pMapping )->pTo->getRegisteredInterface)( + static_cast< pseudo_Mapping * >( pMapping )->pTo, ppOut, pOId, pTypeDescr ); + if (! *ppOut) // no existing interface, register new proxy interface + { + // try to publish a new proxy (ref count initially 1) + void * pProxy = new pseudo_unoInterfaceProxy( + static_cast< pseudo_Mapping * >( pMapping ), + reinterpret_cast< uno_Interface * >( pUnoI ), pTypeDescr, pOId ); + + // proxy may be exchanged during registration + (*static_cast< pseudo_Mapping * >( pMapping )->pTo->registerProxyInterface)( + static_cast< pseudo_Mapping * >( pMapping )->pTo, + &pProxy, pseudo_unoInterfaceProxy_free, pOId, pTypeDescr ); + + *ppOut = pProxy; + } + rtl_uString_release( pOId ); + } + } +} + +static void SAL_CALL pseudo_Mapping_free( uno_Mapping * pMapping ) +{ + delete static_cast< pseudo_Mapping * >( pMapping ); +} + +static void SAL_CALL pseudo_Mapping_acquire( uno_Mapping * pMapping ) +{ + if (1 == osl_atomic_increment( & static_cast< pseudo_Mapping * >( pMapping )->nRef )) + { + OUString aMappingPurpose("pseudo"); + uno_registerMapping( &pMapping, + pseudo_Mapping_free, + (uno_Environment *)((pseudo_Mapping *)pMapping)->pFrom, + (uno_Environment *)((pseudo_Mapping *)pMapping)->pTo, + aMappingPurpose.pData ); + } +} + +static void SAL_CALL pseudo_Mapping_release( uno_Mapping * pMapping ) +{ + if (! osl_atomic_decrement( & static_cast< pseudo_Mapping * >( pMapping )->nRef )) + { + uno_revokeMapping( pMapping ); + } +} + + +pseudo_Mapping::pseudo_Mapping( uno_ExtEnvironment * pFrom_, uno_ExtEnvironment * pTo_ ) + : nRef( 1 ) + , pFrom( pFrom_ ) + , pTo( pTo_ ) +{ + (*((uno_Environment *)pFrom)->acquire)( (uno_Environment *)pFrom ); + (*((uno_Environment *)pTo)->acquire)( (uno_Environment *)pTo ); + + uno_Mapping::acquire = pseudo_Mapping_acquire; + uno_Mapping::release = pseudo_Mapping_release; + uno_Mapping::mapInterface = pseudo_Mapping_mapInterface; +} + +pseudo_Mapping::~pseudo_Mapping() +{ + (*((uno_Environment *)pTo)->release)( (uno_Environment *)pTo ); + (*((uno_Environment *)pFrom)->release)( (uno_Environment *)pFrom ); +} + +} + + +extern "C" void SAL_CALL uno_initEnvironment( uno_Environment * pUnoEnv ) +{ + OSL_FAIL( "### no impl: unexpected call!" ); +} + +extern "C" void SAL_CALL uno_ext_getMapping( + uno_Mapping ** ppMapping, uno_Environment * pFrom, uno_Environment * pTo ) +{ + OSL_ASSERT( ppMapping && pFrom && pTo ); + if (ppMapping && pFrom && pTo && pFrom->pExtEnv && pTo->pExtEnv) + { + uno_Mapping * pMapping = 0; + + if (0 == rtl_ustr_ascii_compare( pFrom->pTypeName->buffer, UNO_LB_UNO ) && + 0 == rtl_ustr_ascii_compare( pTo->pTypeName->buffer, UNO_LB_UNO )) + { + OUString aMappingPurpose("pseudo"); + // ref count is initially 1 + pMapping = new pseudo_uno::pseudo_Mapping( pFrom->pExtEnv, pTo->pExtEnv ); + uno_registerMapping( &pMapping, pseudo_uno::pseudo_Mapping_free, + (uno_Environment *)pFrom->pExtEnv, + (uno_Environment *)pTo->pExtEnv, + aMappingPurpose.pData ); + } + + if (*ppMapping) + (*(*ppMapping)->release)( *ppMapping ); + *ppMapping = pMapping; + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/performance/pseudo_uno_uno.map b/testtools/source/performance/pseudo_uno_uno.map new file mode 100644 index 000000000..87862c4d1 --- /dev/null +++ b/testtools/source/performance/pseudo_uno_uno.map @@ -0,0 +1,25 @@ +# +# 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 . +# + +UDK_3_0_0 { + global: + uno_initEnvironment; + uno_ext_getMapping; + local: + *; +}; diff --git a/testtools/source/performance/ubobject.cxx b/testtools/source/performance/ubobject.cxx new file mode 100644 index 000000000..e437e9c9c --- /dev/null +++ b/testtools/source/performance/ubobject.cxx @@ -0,0 +1,278 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + + +#include <osl/diagnose.h> +#include <osl/interlck.h> + +#include <cppuhelper/factory.hxx> +#include <cppuhelper/supportsservice.hxx> + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/registry/XRegistryKey.hpp> + +#include <com/sun/star/test/performance/XPerformanceTest.hpp> + +using namespace osl; +using namespace cppu; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::registry; +using namespace com::sun::star::test::performance; + + +#define SERVICENAME "com.sun.star.test.performance.PerformanceTestObject" +#define IMPLNAME "com.sun.star.comp.performance.PerformanceTestObject" + +namespace benchmark_object +{ + + +inline static Sequence< OUString > getSupportedServiceNames() +{ + return { SERVICENAME }; +} + + +class ServiceImpl + : public XServiceInfo + , public XPerformanceTest +{ + OUString _aDummyString; + Any _aDummyAny; + Sequence< Reference< XInterface > > _aDummySequence; + ComplexTypes _aDummyStruct; + RuntimeException _aDummyRE; + + sal_Int32 _nRef; + +public: + ServiceImpl() + : _nRef( 0 ) + {} + explicit ServiceImpl( const Reference< XMultiServiceFactory > & xMgr ) + : _nRef( 0 ) + {} + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw(css::uno::RuntimeException) + { + // execution time remains appr. constant any time + Any aRet; + if (aType == cppu::UnoType<XInterface>::get()) + { + void * p = (XInterface *)(XPerformanceTest *)this; + aRet.setValue( &p, cppu::UnoType<XInterface>::get() ); + } + if (aType == cppu::UnoType<XPerformanceTest>::get()) + { + void * p = (XPerformanceTest *)this; + aRet.setValue( &p, cppu::UnoType<XPerformanceTest>::get() ); + } + if (! aRet.hasValue()) + { + void * p = (XPerformanceTest *)this; + Any aDummy( &p, cppu::UnoType<XPerformanceTest>::get() ); + } + return aRet; + } + virtual void SAL_CALL acquire() throw() + { osl_atomic_increment( &_nRef ); } + virtual void SAL_CALL release() throw() + { if (! osl_atomic_decrement( &_nRef )) delete this; } + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() throw (RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) throw (RuntimeException); + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException); + + // Attributes + virtual sal_Int32 SAL_CALL getLong_attr() throw(css::uno::RuntimeException) + { return 0; } + virtual void SAL_CALL setLong_attr( sal_Int32 _attributelong ) throw(css::uno::RuntimeException) + {} + virtual sal_Int64 SAL_CALL getHyper_attr() throw(css::uno::RuntimeException) + { return 0; } + virtual void SAL_CALL setHyper_attr( sal_Int64 _attributehyper ) throw(css::uno::RuntimeException) + {} + virtual float SAL_CALL getFloat_attr() throw(css::uno::RuntimeException) + { return 0.0; } + virtual void SAL_CALL setFloat_attr( float _attributefloat ) throw(css::uno::RuntimeException) + {} + virtual double SAL_CALL getDouble_attr() throw(css::uno::RuntimeException) + { return 0.0; } + virtual void SAL_CALL setDouble_attr( double _attributedouble ) throw(css::uno::RuntimeException) + {} + virtual OUString SAL_CALL getString_attr() throw(css::uno::RuntimeException) + { return _aDummyString; } + virtual void SAL_CALL setString_attr( const OUString& _attributestring ) throw(css::uno::RuntimeException) + {} + virtual Reference< XInterface > SAL_CALL getInterface_attr() throw(css::uno::RuntimeException) + { return Reference< XInterface >(); } + virtual void SAL_CALL setInterface_attr( const Reference< XInterface >& _attributeinterface ) throw(css::uno::RuntimeException) + {} + virtual Any SAL_CALL getAny_attr() throw(css::uno::RuntimeException) + { return _aDummyAny; } + virtual void SAL_CALL setAny_attr( const Any& _attributeany ) throw(css::uno::RuntimeException) + {} + virtual Sequence< Reference< XInterface > > SAL_CALL getSequence_attr() throw(css::uno::RuntimeException) + { return _aDummySequence; } + virtual void SAL_CALL setSequence_attr( const Sequence< Reference< XInterface > >& _attributesequence ) throw(css::uno::RuntimeException) + {} + virtual ComplexTypes SAL_CALL getStruct_attr() throw(css::uno::RuntimeException) + { return _aDummyStruct; } + virtual void SAL_CALL setStruct_attr( const css::test::performance::ComplexTypes& _attributestruct ) throw(css::uno::RuntimeException) + {} + + // Methods + virtual sal_Int32 SAL_CALL getLong() throw(css::uno::RuntimeException) + { return 0; } + virtual void SAL_CALL setLong( sal_Int32 _long ) throw(css::uno::RuntimeException) + {} + virtual sal_Int64 SAL_CALL getHyper() throw(css::uno::RuntimeException) + { return 0; } + virtual void SAL_CALL setHyper( sal_Int64 _hyper ) throw(css::uno::RuntimeException) + {} + virtual float SAL_CALL getFloat() throw(css::uno::RuntimeException) + { return 0; } + virtual void SAL_CALL setFloat( float _float ) throw(css::uno::RuntimeException) + {} + virtual double SAL_CALL getDouble() throw(css::uno::RuntimeException) + { return 0; } + virtual void SAL_CALL setDouble( double _double ) throw(css::uno::RuntimeException) + {} + virtual OUString SAL_CALL getString() throw(css::uno::RuntimeException) + { return _aDummyString; } + virtual void SAL_CALL setString( const OUString& _string ) throw(css::uno::RuntimeException) + {} + virtual Reference< XInterface > SAL_CALL getInterface() throw(css::uno::RuntimeException) + { return Reference< XInterface >(); } + virtual void SAL_CALL setInterface( const css::uno::Reference< css::uno::XInterface >& _interface ) throw(css::uno::RuntimeException) + {} + virtual Any SAL_CALL getAny() throw(css::uno::RuntimeException) + { return _aDummyAny; } + virtual void SAL_CALL setAny( const css::uno::Any& _any ) throw(css::uno::RuntimeException) + {} + virtual Sequence< Reference< XInterface > > SAL_CALL getSequence() throw(css::uno::RuntimeException) + { return _aDummySequence; } + virtual void SAL_CALL setSequence( const Sequence< Reference< XInterface > >& _sequence ) throw(css::uno::RuntimeException) + {} + virtual ComplexTypes SAL_CALL getStruct() throw(css::uno::RuntimeException) + { return _aDummyStruct; } + virtual void SAL_CALL setStruct( const css::test::performance::ComplexTypes& c ) throw(css::uno::RuntimeException) + {} + + virtual void SAL_CALL async() throw(css::uno::RuntimeException) + {} + virtual void SAL_CALL sync() throw(css::uno::RuntimeException) + {} + virtual ComplexTypes SAL_CALL complex_in( const css::test::performance::ComplexTypes& aVal ) throw(css::uno::RuntimeException) + { return aVal; } + virtual ComplexTypes SAL_CALL complex_inout( css::test::performance::ComplexTypes& aVal ) throw(css::uno::RuntimeException) + { return aVal; } + virtual void SAL_CALL complex_oneway( const css::test::performance::ComplexTypes& aVal ) throw(css::uno::RuntimeException) + {} + virtual void SAL_CALL complex_noreturn( const css::test::performance::ComplexTypes& aVal ) throw(css::uno::RuntimeException) + {} + virtual Reference< XPerformanceTest > SAL_CALL createObject() throw(css::uno::RuntimeException) + { return new ServiceImpl(); } + virtual void SAL_CALL raiseRuntimeException( ) throw(css::uno::RuntimeException) + { throw _aDummyRE; } +}; + + +// XServiceInfo + +OUString ServiceImpl::getImplementationName() + throw (RuntimeException) +{ + return OUString( IMPLNAME ); +} + +sal_Bool ServiceImpl::supportsService( const OUString & rServiceName ) + throw (RuntimeException) +{ + return cppu::supportsService(this, rServiceName); +} + +Sequence< OUString > ServiceImpl::getSupportedServiceNames() + throw (RuntimeException) +{ + return benchmark_object::getSupportedServiceNames(); +} + + +static Reference< XInterface > SAL_CALL ServiceImpl_create( const Reference< XMultiServiceFactory > & xSMgr ) +{ + return Reference< XInterface >( (XPerformanceTest *)new ServiceImpl( xSMgr ) ); +} + +} + + +extern "C" +{ +sal_Bool SAL_CALL component_writeInfo( + void * pServiceManager, void * pRegistryKey ) +{ + if (pRegistryKey) + { + try + { + Reference< XRegistryKey > xNewKey( + reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( + OUString( ("/" IMPLNAME "/UNO/SERVICES") ) ) ); + xNewKey->createKey( OUString( SERVICENAME ) ); + + return sal_True; + } + catch (InvalidRegistryException &) + { + OSL_FAIL( "### InvalidRegistryException!" ); + } + } + return sal_False; +} + +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( + const char * pImplName, void * pServiceManager, void * pRegistryKey ) +{ + void * pRet = 0; + + if (pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0) + { + Reference< XSingleServiceFactory > xFactory( createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + OUString( IMPLNAME ), + benchmark_object::ServiceImpl_create, + benchmark_object::getSupportedServiceNames() ) ); + + if (xFactory.is()) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + } + + return pRet; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/performance/ubtest.cxx b/testtools/source/performance/ubtest.cxx new file mode 100644 index 000000000..c30f31ba7 --- /dev/null +++ b/testtools/source/performance/ubtest.cxx @@ -0,0 +1,1275 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + + +#include <stdio.h> +#include <math.h> +#include <string> +#include <map> +#include <unordered_map> + +#include <osl/diagnose.h> +#include <osl/mutex.hxx> +#include <osl/module.h> +#include <osl/process.h> +#include <osl/thread.hxx> +#include <osl/conditn.hxx> +#include <osl/time.h> + +#ifdef _WIN32 +#if !defined WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif +#include <windows.h> +#else +#include <sys/times.h> +#include <unistd.h> +#endif + +#include <rtl/string.hxx> +#include <rtl/strbuf.hxx> +#include <rtl/ustrbuf.hxx> + +#include <uno/environment.hxx> +#include <uno/lbnames.h> +#include <uno/mapping.hxx> + +#include <cppuhelper/factory.hxx> +#include <cppuhelper/implbase.hxx> + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMain.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/loader/XImplementationLoader.hpp> +#include <com/sun/star/registry/XRegistryKey.hpp> +#include <com/sun/star/bridge/XUnoUrlResolver.hpp> +#include <com/sun/star/container/XSet.hpp> +#include <com/sun/star/test/performance/XPerformanceTest.hpp> + +#define NLOOP 200000000 + +using namespace osl; +using namespace cppu; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::loader; +using namespace com::sun::star::registry; +using namespace com::sun::star::bridge; +using namespace com::sun::star::container; +using namespace com::sun::star::test::performance; + + +#define SERVICENAME "com.sun.star.test.performance.PerformanceTest" +#define IMPLNAME "com.sun.star.comp.performance.PerformanceTest" + +namespace benchmark_test +{ + +static inline sal_uInt32 getSystemTicks() +{ +#ifdef _WIN32 + return (sal_uInt32)GetTickCount(); +#else // only UNX supported for now + static sal_uInt32 nImplTicksPerSecond = 0; + static double dImplTicksPerSecond; + static double dImplTicksULONGMAX; + + struct tms aTms; + sal_uInt32 nTicks = (sal_uInt32)times( &aTms ); + + if ( !nImplTicksPerSecond ) + { + nImplTicksPerSecond = sysconf(_SC_CLK_TCK); + dImplTicksPerSecond = nImplTicksPerSecond; + dImplTicksULONGMAX = (double)(sal_uInt32)ULONG_MAX; + } + + double fTicks = nTicks; + fTicks *= 1000; + fTicks /= dImplTicksPerSecond; + fTicks = fmod (fTicks, dImplTicksULONGMAX); + + return (sal_uInt32)fTicks; +#endif +} + + +static void out( const char * pText, FILE * stream = stderr, + sal_Int32 nStart = -1, char cFillchar = ' ' ) +{ + static sal_Int32 s_nPos = 0; + + char ar[2] = { cFillchar, 0 }; + while (s_nPos < nStart) + { + ::fprintf( stream, ar ); + ++s_nPos; + } + + ::fprintf( stream, pText ); + + for ( const char * p = pText; *p; ++p ) + { + if (*p == '\n') + s_nPos = 0; + else + ++s_nPos; + } +} + +static inline void out( const OUString & rText, FILE * stream = stderr, + sal_Int32 nStart = -1, char cFillchar = ' ' ) +{ + OString aText( OUStringToOString( rText, RTL_TEXTENCODING_ASCII_US ) ); + out( aText.getStr(), stream, nStart, cFillchar ); +} + +static inline void out( double fVal, FILE * stream = stderr, + sal_Int32 nStart = -1, char cFillchar = ' ' ) +{ + char ar[128]; + ::snprintf( ar, sizeof(ar), (fVal < 0.000001 ? "%g" : "%f"), fVal ); + out( ar, stream, nStart, cFillchar ); +} + +static inline void out( sal_Int64 nVal, FILE * stream = stderr, + sal_Int32 nStart = -1, char cFillchar = ' ' ) +{ + char ar[128]; + ::snprintf( ar, sizeof(ar), "%ld", nVal ); + out( ar, stream, nStart, cFillchar ); +} + + +Reference< XSingleServiceFactory > loadLibComponentFactory( + const OUString & rLibName, const OUString & rImplName, + const Reference< XMultiServiceFactory > & xSF, const Reference< XRegistryKey > & xKey ) +{ + Reference< XSingleServiceFactory > xRet; + + OUStringBuffer aLibNameBuf( 32 ); +#ifdef SAL_UNX + aLibNameBuf.append( "lib" ); + aLibNameBuf.append( rLibName ); + aLibNameBuf.append( ".so" ); +#else + aLibNameBuf.append( rLibName ); + aLibNameBuf.append( ".dll" ); +#endif + OUString aLibName( aLibNameBuf.makeStringAndClear() ); + oslModule lib = osl_loadModule( aLibName.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL ); + + if (lib) + { + void * pSym; + + // ========================= LATEST VERSION ========================= + OUString aGetEnvName( COMPONENT_GETENV ); + if (pSym = osl_getSymbol( lib, aGetEnvName.pData )) + { + uno_Environment * pCurrentEnv = 0; + uno_Environment * pEnv = 0; + const char * pEnvTypeName = 0; + (*((component_getImplementationEnvironmentFunc)pSym))( &pEnvTypeName, &pEnv ); + + sal_Bool bNeedsMapping = + (pEnv || 0 != rtl_str_compare( pEnvTypeName, CPPU_CURRENT_LANGUAGE_BINDING_NAME )); + + OUString aEnvTypeName( OUString::createFromAscii( pEnvTypeName ) ); + + if (bNeedsMapping) + { + if (! pEnv) + uno_getEnvironment( &pEnv, aEnvTypeName.pData, 0 ); + if (pEnv) + { + OUString aCppEnvTypeName( CPPU_CURRENT_LANGUAGE_BINDING_NAME ); + uno_getEnvironment( &pCurrentEnv, aCppEnvTypeName.pData, 0 ); + if (pCurrentEnv) + bNeedsMapping = (pEnv != pCurrentEnv); + } + } + + OUString aGetFactoryName( COMPONENT_GETFACTORY ); + if (pSym = osl_getSymbol( lib, aGetFactoryName.pData )) + { + OString aImplName( OUStringToOString( rImplName, RTL_TEXTENCODING_ASCII_US ) ); + + if (bNeedsMapping) + { + if (pEnv && pCurrentEnv) + { + Mapping aCurrent2Env( pCurrentEnv, pEnv ); + Mapping aEnv2Current( pEnv, pCurrentEnv ); + + if (aCurrent2Env.is() && aEnv2Current.is()) + { + void * pSMgr = aCurrent2Env.mapInterface( + xSF.get(), cppu::UnoType<XMultiServiceFactory>::get() ); + void * pKey = aCurrent2Env.mapInterface( + xKey.get(), cppu::UnoType<XRegistryKey>::get() ); + + void * pSSF = (*((component_getFactoryFunc)pSym))( + aImplName.getStr(), pSMgr, pKey ); + + if (pKey) + (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pKey ); + if (pSMgr) + (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pSMgr ); + + if (pSSF) + { + aEnv2Current.mapInterface( + reinterpret_cast< void ** >( &xRet ), + pSSF, cppu::UnoType<XSingleServiceFactory>::get() ); + (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pSSF ); + } + } + } + } + else + { + XSingleServiceFactory * pRet = (XSingleServiceFactory *) + (*((component_getFactoryFunc)pSym))( + aImplName.getStr(), xSF.get(), xKey.get() ); + if (pRet) + { + xRet = pRet; + pRet->release(); + } + } + } + + if (pEnv) + (*pEnv->release)( pEnv ); + if (pCurrentEnv) + (*pCurrentEnv->release)( pCurrentEnv ); + } + + // ========================= PREVIOUS VERSION ========================= + else + { + OUString aGetFactoryName( CREATE_COMPONENT_FACTORY_FUNCTION ); + if (pSym = osl_getSymbol( lib, aGetFactoryName.pData )) + { + OUString aCppEnvTypeName( CPPU_CURRENT_LANGUAGE_BINDING_NAME ); + OUString aUnoEnvTypeName( UNO_LB_UNO ); + Mapping aUno2Cpp( aUnoEnvTypeName, aCppEnvTypeName ); + Mapping aCpp2Uno( aCppEnvTypeName, aUnoEnvTypeName ); + OSL_ENSURE( aUno2Cpp.is() && aCpp2Uno.is(), "### cannot get uno mappings!" ); + + if (aUno2Cpp.is() && aCpp2Uno.is()) + { + uno_Interface * pUComponentFactory = 0; + + uno_Interface * pUSFactory = (uno_Interface *)aCpp2Uno.mapInterface( + xSF.get(), cppu::UnoType<XMultiServiceFactory>::get() ); + uno_Interface * pUKey = (uno_Interface *)aCpp2Uno.mapInterface( + xKey.get(), cppu::UnoType<XRegistryKey>::get() ); + + pUComponentFactory = (*((CreateComponentFactoryFunc)pSym))( + rImplName.getStr(), pUSFactory, pUKey ); + + if (pUKey) + (*pUKey->release)( pUKey ); + if (pUSFactory) + (*pUSFactory->release)( pUSFactory ); + + if (pUComponentFactory) + { + XSingleServiceFactory * pXFactory = + (XSingleServiceFactory *)aUno2Cpp.mapInterface( + pUComponentFactory, cppu::UnoType<XSingleServiceFactory>::get() ); + (*pUComponentFactory->release)( pUComponentFactory ); + + if (pXFactory) + { + xRet = pXFactory; + pXFactory->release(); + } + } + } + } + } + + if (! xRet.is()) + osl_unloadModule( lib ); + } + + return xRet; +} + +template< class T > +static void createInstance( Reference< T > & rxOut, + const Reference< XMultiServiceFactory > & xMgr, + const OUString & rServiceName ) + throw (RuntimeException) +{ + Reference< XInterface > x( xMgr->createInstance( rServiceName ), UNO_QUERY ); + + if (! x.is()) + { + static sal_Bool s_bSet = sal_False; + if (! s_bSet) + { + MutexGuard aGuard( Mutex::getGlobalMutex() ); + if (! s_bSet) + { + Reference< XSet > xSet( xMgr, UNO_QUERY ); + if (xSet.is()) + { + // acceptor + xSet->insert( makeAny( loadLibComponentFactory( + OUString("acceptor"), + OUString("com.sun.star.comp.stoc.Acceptor"), + xMgr, Reference< XRegistryKey >() ) ) ); + // connector + xSet->insert( makeAny( loadLibComponentFactory( + OUString("connector"), + OUString("com.sun.star.comp.stoc.Connector"), + xMgr, Reference< XRegistryKey >() ) ) ); + // iiop bridge + xSet->insert( makeAny( loadLibComponentFactory( + OUString("remotebridge"), + OUString("com.sun.star.bridge.Bridge.various"), + xMgr, Reference< XRegistryKey >() ) ) ); + // bridge factory + xSet->insert( makeAny( loadLibComponentFactory( + OUString("brdgfctr"), + OUString("com.sun.star.comp.stoc.BridgeFactory"), + xMgr, Reference< XRegistryKey >() ) ) ); + // uno url resolver + xSet->insert( makeAny( loadLibComponentFactory( + OUString("uuresolver"), + OUString("com.sun.star.comp.bridge.UnoUrlResolver"), + xMgr, Reference< XRegistryKey >() ) ) ); + // java loader +// xSet->insert( makeAny( loadLibComponentFactory( +// OUString("javaloader"), +// OUString("com.sun.star.comp.stoc.JavaComponentLoader"), +// xMgr, Reference< XRegistryKey >() ) ) ); + } + s_bSet = sal_True; + } + } + x = xMgr->createInstance( rServiceName ); + } + + if (! x.is()) + { + throw RuntimeException( "cannot get service instance \"" + rServiceName ); + } + + rxOut = Reference< T >::query( x ); + if (! rxOut.is()) + { + throw RuntimeException( "service instance \"" + rServiceName + + "\" does not support demanded interface \"" + cppu::UnoType<T>::get().getTypeName() ); + } +} + + +inline static Sequence< OUString > getSupportedServiceNames() +{ + return { SERVICENAME }; +} + + +class TestImpl : public WeakImplHelper< XServiceInfo, XMain > +{ + Reference< XMultiServiceFactory > _xSMgr; + + Reference< XInterface > _xDirect; + Reference< XInterface > getDirect() throw (Exception); + Reference< XInterface > resolveObject( const OUString & rUnoUrl ) throw (Exception); + +public: + explicit TestImpl( const Reference< XMultiServiceFactory > & xSMgr ); + virtual ~TestImpl(); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() throw (RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) throw (RuntimeException); + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException); + + // XMain + virtual sal_Int32 SAL_CALL run( const Sequence< OUString > & rArgs ) throw (RuntimeException); +}; + + +TestImpl::TestImpl( const Reference< XMultiServiceFactory > & xSMgr ) + : _xSMgr( xSMgr ) +{ +} + +TestImpl::~TestImpl() +{ +} + + +static Reference< XInterface > SAL_CALL TestImpl_create( const Reference< XMultiServiceFactory > & xSMgr ) +{ + return Reference< XInterface >( *new TestImpl( xSMgr ) ); +} + +// XServiceInfo + +OUString TestImpl::getImplementationName() + throw (RuntimeException) +{ + return OUString( IMPLNAME ); +} + +sal_Bool TestImpl::supportsService( const OUString & rServiceName ) + throw (RuntimeException) +{ + return cppu::supportsService(this, rServiceName); +} + +Sequence< OUString > TestImpl::getSupportedServiceNames() + throw (RuntimeException) +{ + return benchmark_test::getSupportedServiceNames(); +} + + +Reference< XInterface > TestImpl::getDirect() + throw (Exception) +{ + if (! _xDirect.is()) + { + MutexGuard aGuard( Mutex::getGlobalMutex() ); + if (! _xDirect.is()) + { + Reference< XSingleServiceFactory > xFac( loadLibComponentFactory( + OUString("perfobj"), + OUString("com.sun.star.comp.performance.PerformanceTestObject"), + _xSMgr, Reference< XRegistryKey >() ) ); + if (! xFac.is()) + throw RuntimeException("no test object available!" ); + _xDirect = xFac->createInstance(); + } + } + return _xDirect; +} + +Reference< XInterface > TestImpl::resolveObject( const OUString & rUnoUrl ) + throw (Exception) +{ + Reference< XUnoUrlResolver > xResolver; + createInstance( + xResolver, _xSMgr, + OUString("com.sun.star.bridge.UnoUrlResolver") ); + + Reference< XInterface > xResolvedObject( xResolver->resolve( rUnoUrl ) ); + + if (! xResolvedObject.is()) + { + throw RuntimeException( "cannot resolve object \"" + rUnoUrl + "\"!" ); + } + + return xResolvedObject; +} + + +class TimeEntry +{ + sal_Int64 nLoop; + sal_uInt32 nTicks; + +public: + TimeEntry() + {} + TimeEntry( sal_Int64 nLoop_, sal_uInt32 nTicks_ ) + : nLoop( nLoop_ ) + , nTicks( nTicks_ ) + {} + + inline double secPerCall() const + { return (((double)nTicks) / (nLoop * 1000)); } + + double ratio( const TimeEntry & rEntry ) const; +}; + +double TimeEntry::ratio( const TimeEntry & rEntry ) const +{ + double f = rEntry.nTicks * nLoop; + if (f == 0.0) + { + return 0.0; + } + else + { + return (((double)(nTicks * rEntry.nLoop)) / f); + } +} + + +typedef std::map< std::string, TimeEntry > t_TimeEntryMap; + + +struct TimingSheet +{ + t_TimeEntryMap _entries; + void insert( const char * pText, sal_Int64 nLoop, sal_uInt32 nTicks ); +}; + +void TimingSheet::insert( const char * pText, sal_Int64 nLoop, sal_uInt32 nTicks ) +{ + _entries[ pText ] = TimeEntry( nLoop, nTicks ); +} + +typedef std::unordered_map< std::string, TimingSheet > t_TimingSheetMap; + +static void benchmark( + TimingSheet & rSheet, const Reference< XInterface > & xInstance, sal_Int64 nLoop ) + throw (Exception) +{ + Reference< XPerformanceTest > xBench( xInstance, UNO_QUERY_THROW ); + + sal_Int64 i; + sal_uInt32 tStart, tEnd; + + const Type & rKnownType = cppu::UnoType<XPerformanceTest>::get(); + const Type & rUnKnownType = cppu::UnoType<XSet>::get(); + + ComplexTypes aDummyStruct; + + + // oneway calls + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->async(); + sal_uInt32 tEndSend = getSystemTicks(); + xBench->sync(); + tEnd = getSystemTicks(); + rSheet.insert( "1a: sending simple oneway calls (no params, no return)", nLoop, tEndSend - tStart ); + rSheet.insert( "1b: simple oneway calls (no params, no return)", nLoop, tEnd - tStart ); + // synchron calls + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->sync(); + xBench->sync(); + tEnd = getSystemTicks(); + rSheet.insert( "1c: simple synchron calls (no params no return)", nLoop+1, tEnd - tStart ); + + // acquire + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->acquire(); + tEnd = getSystemTicks(); + rSheet.insert( "2a: interface acquire() calls", nLoop, tEnd - tStart ); + // release + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->release(); + tEnd = getSystemTicks(); + rSheet.insert( "2b: interface release() calls", nLoop, tEnd - tStart ); + + // queryInterface() for known type + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->queryInterface( rKnownType ); + tEnd = getSystemTicks(); + rSheet.insert( "2c: interface query for implemented type", nLoop, tEnd - tStart ); + // queryInterface() for unknown type + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->queryInterface( rUnKnownType ); + tEnd = getSystemTicks(); + rSheet.insert( "2d: interface query for unknown type", nLoop, tEnd - tStart ); + + // create and forget objects + Reference< XPerformanceTest > xBench2( xBench ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench2 = xBench2->createObject(); + tEnd = getSystemTicks(); + rSheet.insert( "3a: create and release test objects", nLoop, tEnd - tStart ); + + // hold new objects + Sequence< Reference< XInterface > > aSeq( nLoop / 100 ); + Reference< XInterface > * pSeq = aSeq.getArray(); + xBench2 = xBench; + i = aSeq.getLength(); + tStart = getSystemTicks(); + while (i--) + pSeq[i] = xBench2 = xBench2->createObject(); + tEnd = getSystemTicks(); + rSheet.insert( "3b: create and hold test objects", nLoop, tEnd - tStart ); + + // structs + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->complex_in( aDummyStruct ); + tEnd = getSystemTicks(); + rSheet.insert( "4a: complex_in() calls (in struct; return struct)", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->complex_inout( aDummyStruct ); + tEnd = getSystemTicks(); + rSheet.insert( "4b: complex_inout() calls (inout struct; return struct)", nLoop, tEnd - tStart ); + + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->complex_oneway( aDummyStruct ); + tEnd = getSystemTicks(); + rSheet.insert( "4c: complex_oneway() oneway calls (in struct)", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->complex_noreturn( aDummyStruct ); + tEnd = getSystemTicks(); + rSheet.insert( "4d: complex_noreturn() calls (in struct)", nLoop, tEnd - tStart ); + + // attributes, get() methods + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getLong(); + tEnd = getSystemTicks(); + rSheet.insert( "5a: getLong() call", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getLong_attr(); + tEnd = getSystemTicks(); + rSheet.insert( "5b: get long attribute", nLoop, tEnd - tStart ); + + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->setLong( 0 ); + tEnd = getSystemTicks(); + rSheet.insert( "5c: setLong() call", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->setLong_attr( 0 ); + tEnd = getSystemTicks(); + rSheet.insert( "5d: set long attribute", nLoop, tEnd - tStart ); + + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getHyper(); + tEnd = getSystemTicks(); + rSheet.insert( "5e: getHyper() call", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getHyper_attr(); + tEnd = getSystemTicks(); + rSheet.insert( "5f: get hyper attribute", nLoop, tEnd - tStart ); + + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->setHyper( 0 ); + tEnd = getSystemTicks(); + rSheet.insert( "5g: setHyper() call", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->setHyper_attr( 0 ); + tEnd = getSystemTicks(); + rSheet.insert( "5h: set hyper attribute", nLoop, tEnd - tStart ); + + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getFloat(); + tEnd = getSystemTicks(); + rSheet.insert( "5i: getFloat() call", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getFloat_attr(); + tEnd = getSystemTicks(); + rSheet.insert( "5j: get float attribute",nLoop, tEnd - tStart ); + + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->setFloat( 0.0 ); + tEnd = getSystemTicks(); + rSheet.insert( "5k: setFloat() call", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->setFloat_attr( 0.0 ); + tEnd = getSystemTicks(); + rSheet.insert( "5l: set float attribute", nLoop, tEnd - tStart ); + + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getDouble(); + tEnd = getSystemTicks(); + rSheet.insert( "5m: getDouble() call", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getDouble_attr(); + tEnd = getSystemTicks(); + rSheet.insert( "5n: get double attribute", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->setDouble( 0.0 ); + tEnd = getSystemTicks(); + rSheet.insert( "5o: setDouble() call", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->setDouble_attr( 0.0 ); + tEnd = getSystemTicks(); + rSheet.insert( "5p: set double attribute", nLoop, tEnd - tStart ); + + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getString(); + tEnd = getSystemTicks(); + rSheet.insert( "6a: getString() call (empty)", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getString_attr(); + tEnd = getSystemTicks(); + rSheet.insert( "6b: get empty string attribute", nLoop, tEnd - tStart ); + + i = nLoop; + OUString aDummyString; + tStart = getSystemTicks(); + while (i--) + xBench->setString( aDummyString ); + tEnd = getSystemTicks(); + rSheet.insert( "6c: setString() call (empty)", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->setString_attr( aDummyString ); + tEnd = getSystemTicks(); + rSheet.insert( "6d: set empty string attribute", nLoop, tEnd - tStart ); + + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getInterface(); + tEnd = getSystemTicks(); + rSheet.insert( "7a: getInterface() call (null)", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getInterface_attr(); + tEnd = getSystemTicks(); + rSheet.insert( "7b: get interface attribute", nLoop, tEnd - tStart ); + + i = nLoop; + Reference< XInterface > aDummyInterface; + tStart = getSystemTicks(); + while (i--) + xBench->setInterface( aDummyInterface ); + tEnd = getSystemTicks(); + rSheet.insert( "7c: setInterface() call (null)", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->setInterface_attr( Reference< XInterface >() ); + tEnd = getSystemTicks(); + rSheet.insert( "7d: set interface attribute", nLoop, tEnd - tStart ); + + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getAny(); + tEnd = getSystemTicks(); + rSheet.insert( "8a: getAny() call (empty)", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getAny_attr(); + tEnd = getSystemTicks(); + rSheet.insert( "8b: get empty any attribute", nLoop, tEnd - tStart ); + + i = nLoop; + Any aDummyAny; + tStart = getSystemTicks(); + while (i--) + xBench->setAny( aDummyAny ); + tEnd = getSystemTicks(); + rSheet.insert( "8c: setAny() call (empty)", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->setAny_attr( aDummyAny ); + tEnd = getSystemTicks(); + rSheet.insert( "8d: set empty any attribute", nLoop, tEnd - tStart ); + + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getSequence(); + tEnd = getSystemTicks(); + rSheet.insert( "9a: getSequence() call (empty)", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getSequence_attr(); + tEnd = getSystemTicks(); + rSheet.insert( "9b: get empty sequence attribute", nLoop, tEnd - tStart ); + i = nLoop; + Sequence< Reference< XInterface > > aDummySeq; + tStart = getSystemTicks(); + while (i--) + xBench->setSequence( aDummySeq ); + tEnd = getSystemTicks(); + rSheet.insert( "9c: setSequence() call (empty)", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->setSequence_attr( aDummySeq ); + tEnd = getSystemTicks(); + rSheet.insert( "9d: set empty sequence attribute", nLoop, tEnd - tStart ); + + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getStruct(); + tEnd = getSystemTicks(); + rSheet.insert( "Aa: getStruct() call", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->getStruct_attr(); + tEnd = getSystemTicks(); + rSheet.insert( "Ab: get struct attribute", nLoop, tEnd - tStart ); + + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->setStruct( aDummyStruct ); + tEnd = getSystemTicks(); + rSheet.insert( "Ac: setStruct() call", nLoop, tEnd - tStart ); + i = nLoop; + tStart = getSystemTicks(); + while (i--) + xBench->setStruct_attr( aDummyStruct ); + tEnd = getSystemTicks(); + rSheet.insert( "Ad: set struct attribute", nLoop, tEnd - tStart ); + + // load +// i = nLoop; +// tStart = getSystemTicks(); +// while (i--) +// xBench->setSequence( aSeq ); +// tEnd = getSystemTicks(); +// rSheet.insert( "transfer of existing objects", nLoop, tEnd - tStart ); + + // exceptions + i = nLoop; + tStart = getSystemTicks(); + while (i--) + { + try + { + xBench->raiseRuntimeException(); + } + catch (RuntimeException &) + { + } + } + tEnd = getSystemTicks(); + rSheet.insert( "Ba: raising RuntimeException", nLoop, tEnd - tStart ); + + +} + + +static OUString extractParam( const Sequence< OUString > & rArgs, const OUString & rParam ) +{ + const OUString * pArgs = rArgs.getConstArray(); + for ( sal_Int32 nPos = rArgs.getLength(); nPos--; ) + { + if (pArgs[nPos].startsWith( rParam ) && + pArgs[nPos].getLength() > (rParam.getLength()+1)) + { + return pArgs[nPos].copy( rParam.getLength() +1 ); // XXX=bla + } + } + return OUString(); +} + +const sal_Int32 nMagicNumberDirect = 34000; + +//XMain + +sal_Int32 TestImpl::run( const Sequence< OUString > & rArgs ) + throw (RuntimeException) +{ + // defaults + FILE * stream = stderr; + sal_Int64 nLoop = NLOOP; + OUString aArg("dms"); + + try + { + OUString aLoopStr( extractParam( rArgs, OUString("loop") ) ); + if (aLoopStr.getLength()) + { + sal_Int64 n = aLoopStr.toInt64(); + if (n > 0) + nLoop = n; + } + + OUString aDurationStr( extractParam( rArgs , OUString("duration" ) ) ); + if( aDurationStr.getLength() ) + { + sal_Int64 n = aDurationStr.toInt64(); + if( n >0 ) + nLoop = nMagicNumberDirect * n; + } + + OUString aLogStr( extractParam( rArgs, OUString("log") ) ); + if (aLogStr.getLength()) + { + if (aLogStr.equalsAscii( "stderr" ) ) + { + stream = stderr; + } + else if (aLogStr.equalsAscii( "stdout" ) ) + { + stream = stdout; + } + else + { + OString aFileName( OUStringToOString( aLogStr, RTL_TEXTENCODING_ASCII_US ) ); + stream = ::fopen( aFileName.getStr(), "w" ); + if (! stream) + { + throw RuntimeException( "cannot open file for writing: \"" + aLogStr + "\"!" ); + } + } + } + + OUString aArgStr( extractParam( rArgs, OUString("opt") ) ); + if (aArgStr.getLength()) + { + aArg = aArgStr; + } + + if (! rArgs.getLength()) + out( "\n> no options given, using defaults" ); + + // params + out( "\n> opt=" ); + out( aArg ); + out( " log=" ); + if (stream == stderr) + out( "stderr" ); + else if (stream == stdout) + out( "stdout loop=" ); + else + out( aLogStr ); + out( " loop=" ); + out( nLoop ); + out( "\n" ); + t_TimingSheetMap aSheets; + TimingSheet aDirect; + + + if (aArg.indexOf( 'd' ) >= 0) + { + // in process direct test + sal_uInt32 nStart = getSystemTicks(); + benchmark( aDirect, getDirect(), nLoop ); + sal_uInt32 nEnd = getSystemTicks(); + fprintf( stderr, "Duration (direct in process): %g s\n", (nEnd - nStart)/1000. ); + } + + + if (aArg.indexOf( 'm' ) >= 0) + { + // in process uno dispatch + Environment aCppEnv, aAnoCppEnv; + OUString aCurrentLanguageBindingName( CPPU_CURRENT_LANGUAGE_BINDING_NAME ); + uno_getEnvironment( reinterpret_cast< uno_Environment ** >( &aCppEnv ), + aCurrentLanguageBindingName.pData, 0 ); + // anonymous + uno_createEnvironment( reinterpret_cast< uno_Environment ** >( &aAnoCppEnv ), + aCurrentLanguageBindingName.pData, 0 ); + + // pseudo mapping uno<->uno: does nothing! + Mapping aMapping( aCppEnv.get(), aAnoCppEnv.get(), OUString("pseudo") ); + if (! aMapping.is()) + throw RuntimeException("no pseudo mapping available!" ); + + Reference< XInterface > xMapped; + Reference< XInterface > xDirect( getDirect() ); + aMapping.mapInterface( reinterpret_cast< void ** >( &xMapped ), xDirect.get(), + cppu::UnoType<decltype(xDirect)>::get() ); + if (! xMapped.is()) + throw RuntimeException("mapping object failed!" ); + + sal_uInt32 nStart = getSystemTicks(); + benchmark( aSheets[ "mapped in process" ], xMapped, nLoop / 100 ); + sal_uInt32 nEnd = getSystemTicks(); + fprintf( stderr, "Duration (mapped in process): %g s\n", (nStart - nEnd)/1000. ); + } + + + if (aArg.indexOf( 's' ) >= 0) + { + // start server process + oslSecurity hSecurity = osl_getCurrentSecurity(); + if (! hSecurity) + throw RuntimeException("cannot get current security handle!" ); + + OUString aArgs[] = { + OUString("-c"), + OUString("com.sun.star.comp.performance.PerformanceTestObject"), + OUString("-l"), +#ifdef SAL_UNX + OUString("libperfobj.so"), +#else + OUString("perfobj.dll"), +#endif + OUString("-r"), + OUString("applicat.rdb"), + OUString("-u"), + OUString("uno:socket,host=localhost,port=6000;iiop;TestRemoteObject"), + OUString("--singleaccept") + }; + rtl_uString * pArgs[] = { + aArgs[0].pData, + aArgs[1].pData, + aArgs[2].pData, + aArgs[3].pData, + aArgs[4].pData, + aArgs[5].pData, + aArgs[6].pData, + aArgs[7].pData, + aArgs[8].pData, + }; + + out( "\n> executing: \"uno" ); + for ( sal_Int32 nPos = 0; nPos < (sizeof(aArgs) / sizeof(OUString)); ++nPos ) + { + out( " " ); + out( aArgs[nPos] ); + } + out( "\" ..." ); + + oslProcess hProcess = 0; + OUString aUnoExe("uno"); + OUString aWorkingDir("."); + osl_executeProcess( + aUnoExe.pData, pArgs, sizeof(aArgs) / sizeof(OUString), + osl_Process_SEARCHPATH | osl_Process_DETACHED | osl_Process_NORMAL, + hSecurity, aWorkingDir.pData, 0, 0, &hProcess ); + + osl_freeSecurityHandle( hSecurity ); + if (! hProcess) + throw RuntimeException("cannot start server process!" ); + osl_freeProcessHandle( hProcess ); + + // wait three seconds + osl::Thread::wait(std::chrono::seconds(3)); + + // connect and resolve outer process object + Reference< XInterface > xResolvedObject( resolveObject( OUString("uno:socket,host=localhost,port=6000;iiop;TestRemoteObject") ) ); + + benchmark( aSheets[ "remote same host" ], xResolvedObject, nLoop / 300 ); + } + + + if (aArg.indexOf( 'r' ) >= 0) + { + // remote + OUString aUnoUrl( extractParam( rArgs, OUString("url") ) ); + if (! aUnoUrl.getLength()) + throw RuntimeException( "performance test r(emote) needs additional uno url!" ); + + // connect and resolve outer process object + Reference< XInterface > xResolvedObject( resolveObject( aUnoUrl ) ); + + sal_Int32 t1 = getSystemTicks(); + OString o = OUStringToOString( aUnoUrl, RTL_TEXTENCODING_ASCII_US ); + benchmark( aSheets[ o.getStr() ], xResolvedObject, nLoop / 900 ); + sal_Int32 t2 = getSystemTicks(); + fprintf( stderr, "Duration (%s): %g s\n", o.getStr(),(t2 - t1)/1000. ); + } + + + if (aArg.indexOf( 'j' ) >= 0) + { + // java + benchmark( aSheets[ "java in process" ], + _xSMgr->createInstance("com.sun.star.comp.benchmark.JavaTestObject"), + nLoop / 1000 ); + } + + + // dump out tables + + out( "\nTimes( ratio to direct in process )", stream ); + out( ":", stream ); + + sal_Int32 nPos = 60; + out( "[direct in process]", stream, nPos ); + for ( const auto& rSheet : aSheets ) + { + nPos += 40; + out( "[", stream, nPos ); + out( rSheet.first.c_str(), stream ); + out( "]", stream ); + } + for ( const auto& rTopics : aDirect._entries ) + { + const std::string & rTopic = rTopics.first; + + out( "\n", stream ); + out( rTopic.c_str(), stream ); + + out( ":", stream, 58, '.' ); + + sal_Int32 nPos = 60; + + double secs = rTopics.second.secPerCall(); + if (secs > 0.0) + { + out( secs * 1000, stream, nPos ); + out( "ms", stream ); + } + else + { + out( "NA", stream, nPos ); + } + + for ( const auto& rSheet : aSheets ) + { + const t_TimeEntryMap::const_iterator iFind( rSheet.second._entries.find( rTopic ) ); + OSL_ENSURE( iFind != rSheet.second._entries.end(), "####" ); + + nPos += 40; + + double secs = (*iFind).second.secPerCall(); + if (secs != 0.0) + { + out( secs * 1000, stream, nPos ); + out( "ms", stream ); + + out( " (", stream ); + double ratio = (*iFind).second.ratio( rTopics.second ); + if (ratio != 0.0) + { + out( ratio, stream ); + out( " x)", stream ); + } + else + { + out( "NA)", stream ); + } + } + else + { + out( "NA", stream, nPos ); + } + } + } + } + catch (Exception & rExc) + { + if (stream != stderr && stream != stdout) + ::fclose( stream ); + throw RuntimeException( rExc.Message, rExc.Context ); + } + + if (stream != stderr && stream != stdout) + ::fclose( stream ); + + out( "\n> done.\n" ); + return 0; +} + +} + + +extern "C" +{ + +sal_Bool SAL_CALL component_writeInfo( + void * pServiceManager, void * pRegistryKey ) +{ + if (pRegistryKey) + { + try + { + Reference< XRegistryKey > xNewKey( + reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( + OUString( "/" IMPLNAME "/UNO/SERVICES" ) ) ); + xNewKey->createKey( OUString( SERVICENAME ) ); + + return sal_True; + } + catch (InvalidRegistryException &) + { + OSL_FAIL( "### InvalidRegistryException!" ); + } + } + return sal_False; +} + +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( + const char * pImplName, void * pServiceManager, void * pRegistryKey ) +{ + void * pRet = 0; + + if (pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0) + { + Reference< XSingleServiceFactory > xFactory( createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + OUString( IMPLNAME ), + benchmark_test::TestImpl_create, + benchmark_test::getSupportedServiceNames() ) ); + + if (xFactory.is()) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + } + + return pRet; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/servicetests/LocalServiceTest.java b/testtools/source/servicetests/LocalServiceTest.java new file mode 100644 index 000000000..ee890faa4 --- /dev/null +++ b/testtools/source/servicetests/LocalServiceTest.java @@ -0,0 +1,45 @@ +/* + * 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 servicetests; + +import com.sun.star.comp.helper.Bootstrap; +import com.sun.star.container.XSet; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; + +public final class LocalServiceTest extends TestBase { + @Override + protected TestServiceFactory getTestServiceFactory() throws Exception { + return new TestServiceFactory() { + public Object get() throws Exception { + XComponentContext context + = Bootstrap.createInitialComponentContext(null); + XMultiComponentFactory serviceManager + = context.getServiceManager(); + UnoRuntime.queryInterface(XSet.class, serviceManager). + insert(new TestService()); + return serviceManager.createInstanceWithContext( + "testtools.servicetests.TestService2", context); + } + + public void dispose() throws Exception {} + }; + } +} diff --git a/testtools/source/servicetests/RemoteServiceTest.java b/testtools/source/servicetests/RemoteServiceTest.java new file mode 100644 index 000000000..e63048bf6 --- /dev/null +++ b/testtools/source/servicetests/RemoteServiceTest.java @@ -0,0 +1,113 @@ +/* + * 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 servicetests; + +import com.sun.star.bridge.XBridgeFactory; +import com.sun.star.bridge.XInstanceProvider; +import com.sun.star.bridge.XUnoUrlResolver; +import com.sun.star.bridge.UnoUrlResolver; +import com.sun.star.comp.helper.Bootstrap; +import com.sun.star.connection.Acceptor; +import com.sun.star.connection.XConnection; +import com.sun.star.container.XSet; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintStream; + +public final class RemoteServiceTest extends TestBase { + @Override + protected TestServiceFactory getTestServiceFactory() throws Exception { + final Process p = Runtime.getRuntime().exec(new String[] { + "java", "-classpath", System.getProperty("java.class.path"), + Server.class.getName() }); + pipe(p.getInputStream(), System.out, "CO> "); + pipe(p.getErrorStream(), System.err, "CE> "); + Thread.sleep(5000); // wait for server to start accepting + return new TestServiceFactory() { + public Object get() throws Exception { + XUnoUrlResolver resolver = UnoUrlResolver.create(Bootstrap.createInitialComponentContext(null)); + String sUrl = "uno:" + CONNECTION_DESCRIPTION + ";" + + PROTOCOL_DESCRIPTION + + ";testtools.servicetests.TestService2"; + return resolver.resolve(sUrl); + } + + public void dispose() throws Exception { + p.waitFor(); + } + }; + } + + public static final class Server { + public static void main(String[] arguments) throws Exception { + XComponentContext context + = Bootstrap.createInitialComponentContext(null); + XMultiComponentFactory serviceManager + = context.getServiceManager(); + UnoRuntime.queryInterface(XSet.class, serviceManager). + insert(new TestService()); + final Object instance = serviceManager.createInstanceWithContext( + "testtools.servicetests.TestService2", context); + XBridgeFactory bridgeFactory + = UnoRuntime.queryInterface( + XBridgeFactory.class, + serviceManager.createInstanceWithContext( + "com.sun.star.bridge.BridgeFactory", context)); + XConnection connection = Acceptor.create(context).accept( + CONNECTION_DESCRIPTION); + bridgeFactory.createBridge( + "", PROTOCOL_DESCRIPTION, connection, + new XInstanceProvider() { + public Object getInstance(String instanceName) { + return instance; + } + }); + } + } + + private void pipe(final InputStream in, final PrintStream out, + final String prefix) { + new Thread("Pipe: " + prefix) { + @Override + public void run() { + BufferedReader r + = new BufferedReader(new InputStreamReader(in)); + try { + for (;;) { + String s = r.readLine(); + if (s == null) { + break; + } + out.println(prefix + s); + } + } catch (java.io.IOException e) { + e.printStackTrace(System.err); + } + } + }.start(); + } + + private static final String CONNECTION_DESCRIPTION + = "socket,host=localhost,port=12345"; + private static final String PROTOCOL_DESCRIPTION = "urp"; +} diff --git a/testtools/source/servicetests/TestBase.java b/testtools/source/servicetests/TestBase.java new file mode 100644 index 000000000..20532ff4d --- /dev/null +++ b/testtools/source/servicetests/TestBase.java @@ -0,0 +1,80 @@ +/* + * 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 servicetests; + +import com.sun.star.uno.UnoRuntime; +import complexlib.ComplexTestCase; +import util.WaitUnreachable; + +public abstract class TestBase extends ComplexTestCase { + @Override + public final String[] getTestMethodNames() { + return new String[] { "test" }; + } + + public final void test() throws Exception { + TestServiceFactory factory = getTestServiceFactory(); + TestService2 t = UnoRuntime.queryInterface( + TestService2.class, factory.get()); + assure(t != null); + assure(UnoRuntime.queryInterface(TestService1.class, t) == t); + assure(UnoRuntime.queryInterface(XTestService1.class, t) == t); + assure(UnoRuntime.queryInterface(XTestService2.class, t) == t); + assure(t.fn1() == 1); + assure(t.getProp1() == 1); + t.setProp1(0); + assure(t.getProp1() == 0); + assure(t.getProp2() == 2); + assure(t.getProp3Long() == 3); + assure(t.getProp4Long() == 4); + assure(t.getProp5Long() == 5); + assure(t.getProp6() == 6); + t.setProp6(0); + assure(t.getProp6() == 0); + assure(t.getProp7() == 7); + t.setProp7(0); + assure(t.getProp7() == 0); + assure(t.getProp8Long() == 8); + t.setProp8Long(0); + assure(t.getProp8Long() == 0); + assure(t.fn2() == 2); + XTestService3 t3 = UnoRuntime.queryInterface(XTestService3.class, t); + assure(t3 != null); + assure(t3.fn3() == 3); + XTestService4 t4 = UnoRuntime.queryInterface(XTestService4.class, t); + assure(t4 == null); + WaitUnreachable u = new WaitUnreachable(t); + t = null; + WaitUnreachable.ensureFinalization(t3); + t3 = null; + WaitUnreachable.ensureFinalization(t4); + t4 = null; + u.waitUnreachable(); + factory.dispose(); + } + + protected abstract TestServiceFactory getTestServiceFactory() + throws Exception; + + protected interface TestServiceFactory { + Object get() throws Exception; + + void dispose() throws Exception; + } +} diff --git a/testtools/source/servicetests/TestService.java b/testtools/source/servicetests/TestService.java new file mode 100644 index 000000000..a825f0df1 --- /dev/null +++ b/testtools/source/servicetests/TestService.java @@ -0,0 +1,127 @@ +/* + * 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 servicetests; + +import com.sun.star.lang.NoSupportException; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lang.XSingleComponentFactory; +/*import com.sun.star.uno.OptionalPropertyException;*/ +/*import com.sun.star.uno.VoidPropertyException;*/ +import com.sun.star.uno.XComponentContext; + +public final class TestService implements XServiceInfo, XSingleComponentFactory +{ + public String getImplementationName() { + return getClass().getName(); + } + + public boolean supportsService(String serviceName) { + return serviceName.equals(SERVICE_NAME); + } + + public String[] getSupportedServiceNames() { + return new String[] { SERVICE_NAME }; + } + + public Object createInstanceWithContext(XComponentContext context) + throws com.sun.star.uno.Exception + { + return new Service(); + } + + public Object createInstanceWithArgumentsAndContext( + Object[] arguments, XComponentContext context) + throws com.sun.star.uno.Exception + { + throw new NoSupportException( + "createInstanceWithArgumentsAndContext", this); + } + + private static final class Service implements TestService2, XTestService3 { + public int fn1() { + return 1; + } + + public int getProp1() { + return prop1; + } + + public void setProp1(int value) { + prop1 = value; + } + + public int getProp2() { + return 2; + } + + public int getProp3Long(){ + return 3; + } + public int getProp4Long(){ + return 4; + } + + public int getProp5Long() + { + return 5; + } + + public int getProp6() { + return prop6.intValue(); + } + + public void setProp6(int value) { + prop6 = Integer.valueOf(value); + } + + public int getProp7() + { + return prop7.intValue(); + } + + public void setProp7(int value) { + prop7 = Integer.valueOf(value); + } + + public int getProp8Long() { + return prop8; + } + + public void setProp8Long(int value) + { + prop8 = value; + } + + public int fn2() { + return 2; + } + + public int fn3() { + return 3; + } + + private int prop1 = 1; + private Integer prop6 = Integer.valueOf(6); + private Integer prop7 = Integer.valueOf(7); + private int prop8 = 8; + } + + private static final String SERVICE_NAME + = "testtools.servicetests.TestService2"; +} diff --git a/testtools/source/servicetests/TestService1.idl b/testtools/source/servicetests/TestService1.idl new file mode 100644 index 000000000..386b62e58 --- /dev/null +++ b/testtools/source/servicetests/TestService1.idl @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef __testtools_servicetests_TestService1_idl__ +#define __testtools_servicetests_TestService1_idl__ + +#include <XTestService1.idl> + +module servicetests { + +interface TestService1 { + interface XTestService1; + [attribute] long Prop1; + [attribute, readonly] long Prop2; + /*[attribute, readonly, maybevoid] long Prop3Void;*/ + [attribute, readonly/*, maybevoid*/] long Prop3Long; + /*[attribute, readonly, optional] long Prop4None;*/ + [attribute, readonly/*, optional*/] long Prop4Long; + /*[attribute, readonly, maybevoid, optional] long Prop5None;*/ + /*[attribute, readonly, maybevoid, optional] long Prop5Void;*/ + [attribute, readonly/*, maybevoid, optional*/] long Prop5Long; + [attribute/*, maybevoid*/] long Prop6; + /*[attribute, maybevoid, optional] long Prop7None;*/ + [attribute/*, maybevoid, optional*/] long Prop7; + /*[attribute, optional] long Prop8None;*/ + [attribute/*, optional*/] long Prop8Long; +}; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/servicetests/TestService2.idl b/testtools/source/servicetests/TestService2.idl new file mode 100644 index 000000000..dc06f5c45 --- /dev/null +++ b/testtools/source/servicetests/TestService2.idl @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef __testtools_servicetests_TestService2_idl__ +#define __testtools_servicetests_TestService2_idl__ + +#include <TestService1.idl> +#include <XTestService2.idl> +#include <XTestService3.idl> +#include <XTestService4.idl> + +module servicetests { + +interface TestService2 { + interface TestService1; + interface XTestService2; + /*[optional] interface XTestService3;*/ + /*[optional] interface XTestService4;*/ +}; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/servicetests/XTestService1.idl b/testtools/source/servicetests/XTestService1.idl new file mode 100644 index 000000000..9e0d80295 --- /dev/null +++ b/testtools/source/servicetests/XTestService1.idl @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef __testtools_servicetests_XTestService1_idl__ +#define __testtools_servicetests_XTestService1_idl__ + +#include <com/sun/star/uno/XInterface.idl> + +module servicetests { + +interface XTestService1: com::sun::star::uno::XInterface { + long fn1(); +}; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/servicetests/XTestService2.idl b/testtools/source/servicetests/XTestService2.idl new file mode 100644 index 000000000..98f48b49b --- /dev/null +++ b/testtools/source/servicetests/XTestService2.idl @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef __testtools_servicetests_XTestService2_idl__ +#define __testtools_servicetests_XTestService2_idl__ + +#include <com/sun/star/uno/XInterface.idl> + +module servicetests { + +interface XTestService2: com::sun::star::uno::XInterface { + long fn2(); +}; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/servicetests/XTestService3.idl b/testtools/source/servicetests/XTestService3.idl new file mode 100644 index 000000000..493426542 --- /dev/null +++ b/testtools/source/servicetests/XTestService3.idl @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef __testtools_servicetests_XTestService3_idl__ +#define __testtools_servicetests_XTestService3_idl__ + +#include <com/sun/star/uno/XInterface.idl> + +module servicetests { + +interface XTestService3: com::sun::star::uno::XInterface { + long fn3(); +}; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/servicetests/XTestService4.idl b/testtools/source/servicetests/XTestService4.idl new file mode 100644 index 000000000..f2d7e5b9b --- /dev/null +++ b/testtools/source/servicetests/XTestService4.idl @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef __testtools_servicetests_XTestService4_idl__ +#define __testtools_servicetests_XTestService4_idl__ + +#include <com/sun/star/uno/XInterface.idl> + +module servicetests { + +interface XTestService4: com::sun::star::uno::XInterface { + long fn4(); +}; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/testtools/source/servicetests/makefile.mk b/testtools/source/servicetests/makefile.mk new file mode 100644 index 000000000..fd59d8415 --- /dev/null +++ b/testtools/source/servicetests/makefile.mk @@ -0,0 +1,35 @@ +# +# 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 . +# + +PRJ := ..$/.. +PRJNAME := testtools +TARGET := testtools_servicetests + +PACKAGE := servicetests +JAVATESTFILES := LocalServiceTest.java RemoteServiceTest.java +JAVAFILES := TestBase.java TestService.java +IDLTESTFILES := \ + TestService1.idl \ + TestService2.idl \ + XTestService1.idl \ + XTestService2.idl \ + XTestService3.idl \ + XTestService4.idl +JARFILES := juh.jar jurt.jar ridl.jar + +.INCLUDE: javaunittest.mk |