[Libreoffice-commits] core.git: 5 commits - basic/source dbaccess/CppunitTest_dbaccess_empty_stdlib_save.mk dbaccess/CppunitTest_dbaccess_nolib_save.mk dbaccess/Module_dbaccess.mk dbaccess/qa
Lionel Elie Mamane
lionel at mamane.lu
Thu Sep 4 03:11:34 PDT 2014
basic/source/uno/namecont.cxx | 21 +--
dbaccess/CppunitTest_dbaccess_empty_stdlib_save.mk | 119 +++++++++++++++++
dbaccess/CppunitTest_dbaccess_nolib_save.mk | 119 +++++++++++++++++
dbaccess/Module_dbaccess.mk | 2
dbaccess/qa/extras/dialog-save.cxx | 10 -
dbaccess/qa/extras/empty-stdlib-save.cxx | 145 +++++++++++++++++++++
dbaccess/qa/extras/nolib-save.cxx | 135 +++++++++++++++++++
7 files changed, 538 insertions(+), 13 deletions(-)
New commits:
commit c4f7c5c6890d28a2ff1b9e8f411cd19db587e881
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Thu Sep 4 11:59:11 2014 +0200
fdo#52076 unittest
Change-Id: Iae10f9728db4c90c4a55ad692b32cddeb7adc48a
diff --git a/dbaccess/CppunitTest_dbaccess_empty_stdlib_save.mk b/dbaccess/CppunitTest_dbaccess_empty_stdlib_save.mk
new file mode 100644
index 0000000..408c0bf
--- /dev/null
+++ b/dbaccess/CppunitTest_dbaccess_empty_stdlib_save.mk
@@ -0,0 +1,119 @@
+# -*- 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,dbaccess_empty_stdlib_save))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,dbaccess_empty_stdlib_save, \
+ dbaccess/qa/extras/empty-stdlib-save \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,dbaccess_empty_stdlib_save,\
+ boost_headers \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,dbaccess_empty_stdlib_save, \
+ basegfx \
+ comphelper \
+ cppu \
+ cppuhelper \
+ dba \
+ dbu \
+ sdbt \
+ drawinglayer \
+ editeng \
+ for \
+ forui \
+ i18nlangtag \
+ msfilter \
+ oox \
+ sal \
+ salhelper \
+ sax \
+ sb \
+ sfx \
+ sot \
+ svl \
+ svt \
+ svx \
+ svxcore \
+ test \
+ subsequenttest \
+ tl \
+ tk \
+ ucbhelper \
+ unotest \
+ utl \
+ vbahelper \
+ vcl \
+ xo \
+ $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,dbaccess_empty_stdlib_save,\
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,dbaccess_empty_stdlib_save,\
+ offapi \
+ oovbaapi \
+ udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,dbaccess_empty_stdlib_save))
+$(eval $(call gb_CppunitTest_use_vcl,dbaccess_empty_stdlib_save))
+
+$(eval $(call gb_CppunitTest_use_components,dbaccess_empty_stdlib_save,\
+ basic/util/sb \
+ comphelper/util/comphelp \
+ configmgr/source/configmgr \
+ dbaccess/util/dba \
+ dbaccess/util/dbu \
+ dbaccess/util/sdbt \
+ dbaccess/source/filter/xml/dbaxml \
+ filter/source/config/cache/filterconfig1 \
+ forms/util/frm \
+ framework/util/fwk \
+ i18npool/util/i18npool \
+ linguistic/source/lng \
+ oox/util/oox \
+ package/source/xstor/xstor \
+ package/util/package2 \
+ sax/source/expatwrap/expwrap \
+ scripting/source/basprov/basprov \
+ scripting/util/scriptframe \
+ sfx2/util/sfx \
+ sot/util/sot \
+ svl/source/fsstor/fsstorage \
+ svl/util/svl \
+ toolkit/util/tk \
+ ucb/source/core/ucb1 \
+ ucb/source/ucp/file/ucpfile1 \
+ ucb/source/ucp/tdoc/ucptdoc1 \
+ unotools/util/utl \
+ unoxml/source/rdf/unordf \
+ unoxml/source/service/unoxml \
+ xmloff/util/xo \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,dbaccess_empty_stdlib_save))
+
+$(eval $(call gb_CppunitTest_use_filter_configuration,dbaccess_empty_stdlib_save))
+
+$(eval $(call gb_CppunitTest_use_unittest_configuration,dbaccess_empty_stdlib_save))
+
+$(call gb_CppunitTest_get_target,dbaccess_empty_stdlib_save) : $(WORKDIR)/CppunitTest/testEmptyStdlibSave.odb
+$(WORKDIR)/CppunitTest/testEmptyStdlibSave.odb : $(SRCDIR)/dbaccess/qa/extras/testdocuments/testDialogSave.odb
+ mkdir -p $(dir $@)
+ cp -P -f "$<" "$@"
+.PHONY: $(WORKDIR)/CppunitTest/testEmptyStdlibSave.odb
+
+$(call gb_CppunitTest_get_target,dbaccess_empty_stdlib_save): \
+ $(call gb_AllLangResTarget_get_target,ofa)
+
+# vim: set noet sw=4 ts=4:
diff --git a/dbaccess/CppunitTest_dbaccess_nolib_save.mk b/dbaccess/CppunitTest_dbaccess_nolib_save.mk
new file mode 100644
index 0000000..6684d72
--- /dev/null
+++ b/dbaccess/CppunitTest_dbaccess_nolib_save.mk
@@ -0,0 +1,119 @@
+# -*- 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,dbaccess_nolib_save))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,dbaccess_nolib_save, \
+ dbaccess/qa/extras/nolib-save \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,dbaccess_nolib_save,\
+ boost_headers \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,dbaccess_nolib_save, \
+ basegfx \
+ comphelper \
+ cppu \
+ cppuhelper \
+ dba \
+ dbu \
+ sdbt \
+ drawinglayer \
+ editeng \
+ for \
+ forui \
+ i18nlangtag \
+ msfilter \
+ oox \
+ sal \
+ salhelper \
+ sax \
+ sb \
+ sfx \
+ sot \
+ svl \
+ svt \
+ svx \
+ svxcore \
+ test \
+ subsequenttest \
+ tl \
+ tk \
+ ucbhelper \
+ unotest \
+ utl \
+ vbahelper \
+ vcl \
+ xo \
+ $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,dbaccess_nolib_save,\
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,dbaccess_nolib_save,\
+ offapi \
+ oovbaapi \
+ udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,dbaccess_nolib_save))
+$(eval $(call gb_CppunitTest_use_vcl,dbaccess_nolib_save))
+
+$(eval $(call gb_CppunitTest_use_components,dbaccess_nolib_save,\
+ basic/util/sb \
+ comphelper/util/comphelp \
+ configmgr/source/configmgr \
+ dbaccess/util/dba \
+ dbaccess/util/dbu \
+ dbaccess/util/sdbt \
+ dbaccess/source/filter/xml/dbaxml \
+ filter/source/config/cache/filterconfig1 \
+ forms/util/frm \
+ framework/util/fwk \
+ i18npool/util/i18npool \
+ linguistic/source/lng \
+ oox/util/oox \
+ package/source/xstor/xstor \
+ package/util/package2 \
+ sax/source/expatwrap/expwrap \
+ scripting/source/basprov/basprov \
+ scripting/util/scriptframe \
+ sfx2/util/sfx \
+ sot/util/sot \
+ svl/source/fsstor/fsstorage \
+ svl/util/svl \
+ toolkit/util/tk \
+ ucb/source/core/ucb1 \
+ ucb/source/ucp/file/ucpfile1 \
+ ucb/source/ucp/tdoc/ucptdoc1 \
+ unotools/util/utl \
+ unoxml/source/rdf/unordf \
+ unoxml/source/service/unoxml \
+ xmloff/util/xo \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,dbaccess_nolib_save))
+
+$(eval $(call gb_CppunitTest_use_filter_configuration,dbaccess_nolib_save))
+
+$(eval $(call gb_CppunitTest_use_unittest_configuration,dbaccess_nolib_save))
+
+$(call gb_CppunitTest_get_target,dbaccess_nolib_save) : $(WORKDIR)/CppunitTest/testNolibSave.odb
+$(WORKDIR)/CppunitTest/testNolibSave.odb : $(SRCDIR)/dbaccess/qa/extras/testdocuments/testDialogSave.odb
+ mkdir -p $(dir $@)
+ cp -P -f "$<" "$@"
+.PHONY: $(WORKDIR)/CppunitTest/testNolibSave.odb
+
+$(call gb_CppunitTest_get_target,dbaccess_nolib_save): \
+ $(call gb_AllLangResTarget_get_target,ofa)
+
+# vim: set noet sw=4 ts=4:
diff --git a/dbaccess/Module_dbaccess.mk b/dbaccess/Module_dbaccess.mk
index b9d7d56..bbe3009 100644
--- a/dbaccess/Module_dbaccess.mk
+++ b/dbaccess/Module_dbaccess.mk
@@ -42,6 +42,8 @@ endif
$(eval $(call gb_Module_add_check_targets,dbaccess,\
CppunitTest_dbaccess_dialog_save \
+ CppunitTest_dbaccess_empty_stdlib_save \
+ CppunitTest_dbaccess_nolib_save \
CppunitTest_dbaccess_macros_test \
))
diff --git a/dbaccess/qa/extras/empty-stdlib-save.cxx b/dbaccess/qa/extras/empty-stdlib-save.cxx
new file mode 100644
index 0000000..3f84d53
--- /dev/null
+++ b/dbaccess/qa/extras/empty-stdlib-save.cxx
@@ -0,0 +1,145 @@
+/* -*- 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 <test/bootstrapfixture.hxx>
+#include <test/unoapi_test.hxx>
+#include <rtl/strbuf.hxx>
+#include <osl/file.hxx>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/document/XEmbeddedScripts.hpp>
+#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
+#include <com/sun/star/script/XLibraryContainer.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+
+#include <sfx2/app.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/sfxmodelfactory.hxx>
+#include <svl/intitem.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <basic/sbxdef.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+class DialogSaveTest : public UnoApiTest
+{
+public:
+ DialogSaveTest();
+
+ void test();
+
+ CPPUNIT_TEST_SUITE(DialogSaveTest);
+// Should we disable this test on MOX and WNT?
+// #if !defined(MACOSX) && !defined(WNT)
+ CPPUNIT_TEST(test);
+// #endif
+ CPPUNIT_TEST_SUITE_END();
+
+};
+
+
+DialogSaveTest::DialogSaveTest()
+ : UnoApiTest("/dbaccess/qa/extras/testdocuments")
+{
+}
+
+void DialogSaveTest::test()
+{
+ // UnoApiTest::setUp (via InitVCL) puts each test under a locked SolarMutex,
+ // but at least the below xDocCloseable->close call could lead to a deadlock
+ // then, and it looks like none of the code here requires the SolarMutex to
+ // be locked anyway:
+ SolarMutexReleaser rel;
+
+ const OUString sStandard("Standard");
+ const OUString aFileName(getURLFromWorkdir("CppunitTest/testEmptyStdlibSave.odb"));
+ {
+ uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileName);
+ CPPUNIT_ASSERT(xComponent.is());
+ uno::Reference< frame::XStorable > xDocStorable(xComponent, UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xDocStorable.is());
+ uno::Reference< document::XEmbeddedScripts > xDocScr(xComponent, UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xDocScr.is());
+ uno::Reference< script::XStorageBasedLibraryContainer > xStorBasLib(xDocScr->getBasicLibraries());
+ CPPUNIT_ASSERT(xStorBasLib.is());
+ uno::Reference< script::XLibraryContainer > xBasLib(xStorBasLib, UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xBasLib.is());
+ uno::Reference< script::XStorageBasedLibraryContainer > xStorDlgLib(xDocScr->getDialogLibraries());
+ CPPUNIT_ASSERT(xStorDlgLib.is());
+ uno::Reference< script::XLibraryContainer > xDlgLib(xStorDlgLib, UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xDlgLib.is());
+ xBasLib->loadLibrary(sStandard);
+ xDlgLib->loadLibrary(sStandard);
+ CPPUNIT_ASSERT(xBasLib->isLibraryLoaded(sStandard));
+ CPPUNIT_ASSERT(xDlgLib->isLibraryLoaded(sStandard));
+
+ Any a;
+ uno::Reference< container::XNameContainer > xI;
+
+ a = xBasLib->getByName(sStandard);
+ a >>= xI;
+ CPPUNIT_ASSERT(xI.is());
+ xI->removeByName("Raralix");
+
+ a = xDlgLib->getByName(sStandard);
+ a >>= xI;
+ CPPUNIT_ASSERT(xI.is());
+ xI->removeByName("Dialog1");
+
+ // uno::Reference< util::XModifiable > xDlgMod(xDlgLib, UNO_QUERY_THROW);
+ // CPPUNIT_ASSERT(xDlgMod.is());
+ // xDlgMod->setModified(sal_True);
+
+ // uno::Reference< util::XModifiable > xScrMod(xDocScr, UNO_QUERY_THROW);
+ // CPPUNIT_ASSERT(xScrMod.is());
+ // xScrMod->setModified(sal_True);
+
+ // uno::Reference< util::XModifiable > xDocMod(xComponent, UNO_QUERY_THROW);
+ // CPPUNIT_ASSERT(xDocMod.is());
+ // std::cerr << "** Modified: " << static_cast<bool>(xDocMod->isModified()) << std::endl;
+ // xDocMod->setModified(sal_True);
+ // std::cerr << "** Modified: " << static_cast<bool>(xDocMod->isModified()) << std::endl;
+ // CPPUNIT_ASSERT(xDocMod->isModified());
+
+ // now save; the code path to exercise in this test is the "store to same location"
+ // do *not* change to store(As|To|URL)!
+ xDocStorable->store();
+
+ // close
+ uno::Reference< util::XCloseable > xDocCloseable(xComponent, UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xDocCloseable.is());
+ xDocCloseable->close(false);
+
+ // All our uno::References are (should?) be invalid now -> let them go out of scope
+ }
+ {
+ uno::Sequence<uno::Any> args(1);
+ args[0] <<= aFileName;
+ Reference<container::XHierarchicalNameAccess> xHNA(getMultiServiceFactory()->createInstanceWithArguments("com.sun.star.packages.Package", args), UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xHNA.is());
+ CPPUNIT_ASSERT(!xHNA->hasByHierarchicalName("Basic/Standard"));
+ CPPUNIT_ASSERT(!xHNA->hasByHierarchicalName("Dialogs/Standard"));
+ }
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(DialogSaveTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/qa/extras/nolib-save.cxx b/dbaccess/qa/extras/nolib-save.cxx
new file mode 100644
index 0000000..3f1ca91
--- /dev/null
+++ b/dbaccess/qa/extras/nolib-save.cxx
@@ -0,0 +1,135 @@
+/* -*- 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 <test/bootstrapfixture.hxx>
+#include <test/unoapi_test.hxx>
+#include <rtl/strbuf.hxx>
+#include <osl/file.hxx>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/document/XEmbeddedScripts.hpp>
+#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
+#include <com/sun/star/script/XLibraryContainer.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+
+#include <sfx2/app.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/sfxmodelfactory.hxx>
+#include <svl/intitem.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <basic/sbxdef.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+class DialogSaveTest : public UnoApiTest
+{
+public:
+ DialogSaveTest();
+
+ void test();
+
+ CPPUNIT_TEST_SUITE(DialogSaveTest);
+// Should we disable this test on MOX and WNT?
+// #if !defined(MACOSX) && !defined(WNT)
+ CPPUNIT_TEST(test);
+// #endif
+ CPPUNIT_TEST_SUITE_END();
+
+};
+
+
+DialogSaveTest::DialogSaveTest()
+ : UnoApiTest("/dbaccess/qa/extras/testdocuments")
+{
+}
+
+void DialogSaveTest::test()
+{
+ // UnoApiTest::setUp (via InitVCL) puts each test under a locked SolarMutex,
+ // but at least the below xDocCloseable->close call could lead to a deadlock
+ // then, and it looks like none of the code here requires the SolarMutex to
+ // be locked anyway:
+ SolarMutexReleaser rel;
+
+ const OUString sStandard("Standard");
+ const OUString aFileName(getURLFromWorkdir("CppunitTest/testNolibSave.odb"));
+ {
+ uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileName);
+ CPPUNIT_ASSERT(xComponent.is());
+ uno::Reference< frame::XStorable > xDocStorable(xComponent, UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xDocStorable.is());
+ uno::Reference< document::XEmbeddedScripts > xDocScr(xComponent, UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xDocScr.is());
+ uno::Reference< script::XStorageBasedLibraryContainer > xStorBasLib(xDocScr->getBasicLibraries());
+ CPPUNIT_ASSERT(xStorBasLib.is());
+ uno::Reference< script::XLibraryContainer > xBasLib(xStorBasLib, UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xBasLib.is());
+ uno::Reference< script::XStorageBasedLibraryContainer > xStorDlgLib(xDocScr->getDialogLibraries());
+ CPPUNIT_ASSERT(xStorDlgLib.is());
+ uno::Reference< script::XLibraryContainer > xDlgLib(xStorDlgLib, UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xDlgLib.is());
+ xBasLib->loadLibrary(sStandard);
+ xDlgLib->loadLibrary(sStandard);
+ CPPUNIT_ASSERT(xBasLib->isLibraryLoaded(sStandard));
+ CPPUNIT_ASSERT(xDlgLib->isLibraryLoaded(sStandard));
+
+ xBasLib->removeLibrary(sStandard);
+ xDlgLib->removeLibrary(sStandard);
+
+ // uno::Reference< util::XModifiable > xDlgMod(xDlgLib, UNO_QUERY_THROW);
+ // CPPUNIT_ASSERT(xDlgMod.is());
+ // xDlgMod->setModified(sal_True);
+
+ // uno::Reference< util::XModifiable > xScrMod(xDocScr, UNO_QUERY_THROW);
+ // CPPUNIT_ASSERT(xScrMod.is());
+ // xScrMod->setModified(sal_True);
+
+ // uno::Reference< util::XModifiable > xDocMod(xComponent, UNO_QUERY_THROW);
+ // CPPUNIT_ASSERT(xDocMod.is());
+ // std::cerr << "** Modified: " << static_cast<bool>(xDocMod->isModified()) << std::endl;
+ // xDocMod->setModified(sal_True);
+ // std::cerr << "** Modified: " << static_cast<bool>(xDocMod->isModified()) << std::endl;
+ // CPPUNIT_ASSERT(xDocMod->isModified());
+
+ // now save; the code path to exercise in this test is the "store to same location"
+ // do *not* change to store(As|To|URL)!
+ xDocStorable->store();
+
+ // close
+ uno::Reference< util::XCloseable > xDocCloseable(xComponent, UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xDocCloseable.is());
+ xDocCloseable->close(false);
+
+ // All our uno::References are (should?) be invalid now -> let them go out of scope
+ }
+ {
+ uno::Sequence<uno::Any> args(1);
+ args[0] <<= aFileName;
+ Reference<container::XHierarchicalNameAccess> xHNA(getMultiServiceFactory()->createInstanceWithArguments("com.sun.star.packages.Package", args), UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xHNA.is());
+ CPPUNIT_ASSERT(!xHNA->hasByHierarchicalName("Basic/Standard"));
+ CPPUNIT_ASSERT(!xHNA->hasByHierarchicalName("Dialogs/Standard"));
+ }
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(DialogSaveTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 05b28c1ad8bc49a01804a5b6be18ca5ee5e5ef33
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Thu Sep 4 11:57:41 2014 +0200
janitorial: add const, factorise constant
Change-Id: Ifdaff62611452ce1e39604bd751168fe3e68d865
diff --git a/dbaccess/qa/extras/dialog-save.cxx b/dbaccess/qa/extras/dialog-save.cxx
index 0d212c1..5426919 100644
--- a/dbaccess/qa/extras/dialog-save.cxx
+++ b/dbaccess/qa/extras/dialog-save.cxx
@@ -67,8 +67,8 @@ void DialogSaveTest::test()
// be locked anyway:
SolarMutexReleaser rel;
- OUString aFileName;
- aFileName = getURLFromWorkdir("CppunitTest/testDialogSave.odb");
+ const OUString sStandard("Standard");
+ const OUString aFileName(getURLFromWorkdir("CppunitTest/testDialogSave.odb"));
{
uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileName);
CPPUNIT_ASSERT(xComponent.is());
@@ -84,11 +84,11 @@ void DialogSaveTest::test()
CPPUNIT_ASSERT(xStorDlgLib.is());
uno::Reference< script::XLibraryContainer > xDlgLib(xStorDlgLib, UNO_QUERY_THROW);
CPPUNIT_ASSERT(xDlgLib.is());
- xBasLib->loadLibrary("Standard");
- CPPUNIT_ASSERT(xBasLib->isLibraryLoaded("Standard"));
+ xBasLib->loadLibrary(sStandard);
+ CPPUNIT_ASSERT(xBasLib->isLibraryLoaded(sStandard));
// the whole point of this test is to test the "save" operation
// when the Basic library is loaded, but not the Dialog library
- CPPUNIT_ASSERT(!xDlgLib->isLibraryLoaded("Standard"));
+ CPPUNIT_ASSERT(!xDlgLib->isLibraryLoaded(sStandard));
// make some change to enable a save
// uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSuppl(xComponent, UNO_QUERY_THROW);
commit a7fbabdacdc08c36e6e395a89db11400daa56777
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Thu Sep 4 11:56:12 2014 +0200
fdo#52076 remove Library dir when no library
when saving to same storage (in place)
we already did that when empty "Standard" was the only library,
but not when there was no library...
Cannot get through that state in through UI, but possible through scripting.
Change-Id: I0f1129e034ac31b3eaf6bd388a03aee5aae5b87e
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index b79fe97..55d7327 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -1817,18 +1817,22 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
nLibsToSave--;
}
}
- if( !nLibsToSave )
- {
- return;
- }
- boost::scoped_ptr< ::xmlscript::LibDescriptorArray > pLibArray(new ::xmlscript::LibDescriptorArray(nLibsToSave));
-
// Write to storage?
bool bStorage = i_rStorage.is();
uno::Reference< embed::XStorage > xSourceLibrariesStor;
uno::Reference< embed::XStorage > xTargetLibrariesStor;
OUString sTempTargetStorName;
const bool bInplaceStorage = bStorage && ( i_rStorage == mxStorage );
+
+ if( nLibsToSave == 0 )
+ {
+ if ( bInplaceStorage && mxStorage->hasByName(maLibrariesDir) )
+ {
+ mxStorage->removeElement(maLibrariesDir);
+ }
+ return;
+ }
+
if ( bStorage )
{
// Don't write if only empty standard lib exists
@@ -1906,6 +1910,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
int iArray = 0;
pName = aNames.getConstArray();
::xmlscript::LibDescriptor aLibDescriptorForExtensionLibs;
+ boost::scoped_ptr< ::xmlscript::LibDescriptorArray > pLibArray(new ::xmlscript::LibDescriptorArray(nLibsToSave));
for( ; pName != pNamesEnd; ++pName )
{
SfxLibrary* pImplLib = getImplLib( *pName );
commit 513d95f3185f2e916f76b0ec058413ae69f161a3
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Thu Sep 4 11:52:18 2014 +0200
detect if Standard is only library to *save*
as opposed to only library at all
Change-Id: I23bebfe7d156e1f4a60bc5f265a3cf9d295f3e4a
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index c7d5a01..b79fe97 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -1832,7 +1832,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
if ( bStorage )
{
// Don't write if only empty standard lib exists
- if ( ( nNameCount == 1 ) && ( aNames[0] == "Standard" ) )
+ if ( ( nLibsToSave == 1 ) && ( aNames[0] == "Standard" ) )
{
Any aLibAny = maNameContainer.getByName( aNames[0] );
Reference< XNameAccess > xNameAccess;
commit 6846c1c88ec06d803b501e1dc2141648b213f7d8
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Thu Sep 4 11:50:54 2014 +0200
add const qualifier
Change-Id: I88d61668b465e505cfa245dd17893828aaaecaa8
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 1417aa5..c7d5a01 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -1803,7 +1803,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
bool bComplete )
{
const Sequence< OUString > aNames = maNameContainer.getElementNames();
- sal_Int32 nNameCount = aNames.getLength();
+ const sal_Int32 nNameCount = aNames.getLength();
const OUString* pName = aNames.getConstArray();
const OUString* pNamesEnd = aNames.getConstArray() + nNameCount;
More information about the Libreoffice-commits
mailing list