Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / extensions / qa / bibliography / bibliography.cxx
blobaf68ee95eb70d7c2fd16d2fd1d586cf2540409e2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <test/bootstrapfixture.hxx>
11 #include <unotest/macros_test.hxx>
13 #include <com/sun/star/beans/XPropertySet.hpp>
14 #include <com/sun/star/frame/Bibliography.hpp>
16 using namespace ::com::sun::star;
18 namespace
20 /// Covers extensions/source/bibliography/ fixes.
21 class Test : public test::BootstrapFixture, public unotest::MacrosTest
26 CPPUNIT_TEST_FIXTURE(Test, testBibliographyLoader)
28 // Given a bibliography provider:
29 uno::Reference<container::XNameAccess> xBibAccess
30 = frame::Bibliography::create(mxComponentContext);
31 uno::Reference<beans::XPropertySet> xPropSet(xBibAccess, uno::UNO_QUERY);
32 uno::Sequence<beans::PropertyValue> aSeq;
34 // When getting the column names:
35 xPropSet->getPropertyValue("BibliographyDataFieldNames") >>= aSeq;
37 // Then make sure we have columns and all have non-empty names:
38 CPPUNIT_ASSERT(aSeq.hasElements());
40 // Without the accompanying fix in place, this test would have failed, as the last column
41 // (LOCAL_URL) had an empty field name:
42 for (const auto& rPair : std::as_const(aSeq))
44 CPPUNIT_ASSERT(!rPair.Name.isEmpty());
48 CPPUNIT_PLUGIN_IMPLEMENT();
50 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */