diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-08-12 17:12:34 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-08-13 08:32:32 +0200 |
commit | 13f95baecb012b05f070c519410291f3c020a122 (patch) | |
tree | 7351b6f4e49f249c0ef3283429f97192c8141ab3 | |
parent | adf65471e889676a600a9c6d0454c75cbd549ad3 (diff) |
sw bibliography: fix missing identifier + local URL in biblio reference
Regression from commit 5fd2f212a1db9e061fb3a886810b427251e8a6bf (sw
bibliography, local copy: handle the bibliography database window,
2021-07-27), the problem was that the newly added LOCAL_URL column
affected BibliographyLoader::getPropertyValue(), which was not adapted,
done now.
Change-Id: Id3bd95bdd5c692048a50ce7ba2e5cdf16e824bd9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120400
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r-- | extensions/CppunitTest_extensions_bibliography.mk | 43 | ||||
-rw-r--r-- | extensions/Module_extensions.mk | 4 | ||||
-rw-r--r-- | extensions/qa/bibliography/bibliography.cxx | 50 | ||||
-rw-r--r-- | extensions/source/bibliography/bibload.cxx | 5 |
4 files changed, 100 insertions, 2 deletions
diff --git a/extensions/CppunitTest_extensions_bibliography.mk b/extensions/CppunitTest_extensions_bibliography.mk new file mode 100644 index 000000000000..c5503a46862e --- /dev/null +++ b/extensions/CppunitTest_extensions_bibliography.mk @@ -0,0 +1,43 @@ +# -*- 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,extensions_bibliography)) + +$(eval $(call gb_CppunitTest_use_externals,extensions_bibliography,\ + boost_headers \ +)) + +$(eval $(call gb_CppunitTest_add_exception_objects,extensions_bibliography, \ + extensions/qa/bibliography/bibliography \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,extensions_bibliography, \ + comphelper \ + cppu \ + sal \ + test \ + unotest \ +)) + +$(eval $(call gb_CppunitTest_use_sdk_api,extensions_bibliography)) + +$(eval $(call gb_CppunitTest_use_ure,extensions_bibliography)) +$(eval $(call gb_CppunitTest_use_vcl,extensions_bibliography)) + +$(eval $(call gb_CppunitTest_use_rdb,extensions_bibliography,services)) + +$(eval $(call gb_CppunitTest_use_custom_headers,extensions_bibliography,\ + officecfg/registry \ +)) + +$(eval $(call gb_CppunitTest_use_configuration,extensions_bibliography)) + +# vim: set noet sw=4 ts=4: diff --git a/extensions/Module_extensions.mk b/extensions/Module_extensions.mk index 43a32560e64c..c28f97b9cbd8 100644 --- a/extensions/Module_extensions.mk +++ b/extensions/Module_extensions.mk @@ -42,6 +42,10 @@ $(eval $(call gb_Module_add_targets,extensions,\ Library_bib \ )) +$(eval $(call gb_Module_add_check_targets,extensions,\ + CppunitTest_extensions_bibliography \ +)) + ifneq (,$(filter DBCONNECTIVITY,$(BUILD_TYPE))) $(eval $(call gb_Module_add_targets,extensions,\ Library_dbp \ diff --git a/extensions/qa/bibliography/bibliography.cxx b/extensions/qa/bibliography/bibliography.cxx new file mode 100644 index 000000000000..af68ee95eb70 --- /dev/null +++ b/extensions/qa/bibliography/bibliography.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/bootstrapfixture.hxx> +#include <unotest/macros_test.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/Bibliography.hpp> + +using namespace ::com::sun::star; + +namespace +{ +/// Covers extensions/source/bibliography/ fixes. +class Test : public test::BootstrapFixture, public unotest::MacrosTest +{ +}; +} + +CPPUNIT_TEST_FIXTURE(Test, testBibliographyLoader) +{ + // Given a bibliography provider: + uno::Reference<container::XNameAccess> xBibAccess + = frame::Bibliography::create(mxComponentContext); + uno::Reference<beans::XPropertySet> xPropSet(xBibAccess, uno::UNO_QUERY); + uno::Sequence<beans::PropertyValue> aSeq; + + // When getting the column names: + xPropSet->getPropertyValue("BibliographyDataFieldNames") >>= aSeq; + + // Then make sure we have columns and all have non-empty names: + CPPUNIT_ASSERT(aSeq.hasElements()); + + // Without the accompanying fix in place, this test would have failed, as the last column + // (LOCAL_URL) had an empty field name: + for (const auto& rPair : std::as_const(aSeq)) + { + CPPUNIT_ASSERT(!rPair.Name.isEmpty()); + } +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index cb1edd54fef4..546b16e054ee 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -563,14 +563,15 @@ Any BibliographyLoader::getPropertyValue(const OUString& rPropertyName) CUSTOM3_POS , // BibliographyDataField_CUSTOM3 CUSTOM4_POS , // BibliographyDataField_CUSTOM4 CUSTOM5_POS , // BibliographyDataField_CUSTOM5 - ISBN_POS //BibliographyDataField_ISBN + ISBN_POS , // BibliographyDataField_ISBN + LOCAL_URL_POS // BibliographyDataField_LOCAL_URL }; if(rPropertyName != "BibliographyDataFieldNames") throw UnknownPropertyException(rPropertyName); Sequence<PropertyValue> aSeq(COLUMN_COUNT); PropertyValue* pArray = aSeq.getArray(); BibConfig* pConfig = BibModul::GetConfig(); - for(sal_uInt16 i = 0; i <= text::BibliographyDataField::ISBN ; i++) + for(sal_uInt16 i = 0; i <= text::BibliographyDataField::LOCAL_URL ; i++) { pArray[i].Name = pConfig->GetDefColumnName(aInternalMapping[i]); pArray[i].Value <<= static_cast<sal_Int16>(i); |