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 +#include + +#include +#include + +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 xBibAccess + = frame::Bibliography::create(mxComponentContext); + uno::Reference xPropSet(xBibAccess, uno::UNO_QUERY); + uno::Sequence 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 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(i);