LibreOffice Module test (master) 1
xindexaccess.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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 */
9
11
12#include <com/sun/star/container/XIndexAccess.hpp>
13
14#include <com/sun/star/uno/Reference.hxx>
15
16#include <cppunit/TestAssert.h>
17
18using namespace css;
19using namespace css::uno;
20
21namespace apitest
22{
24{
25 uno::Reference<container::XIndexAccess> xIndexAccess(init(), UNO_QUERY_THROW);
26 CPPUNIT_ASSERT_EQUAL(m_nItems, xIndexAccess->getCount());
27}
28
30{
31 uno::Reference<container::XIndexAccess> xIndexAccess(init(), UNO_QUERY_THROW);
32 CPPUNIT_ASSERT_EQUAL(m_nItems, xIndexAccess->getCount());
33
34 if (m_nItems > 0)
35 {
36 Any aAny = xIndexAccess->getByIndex(0);
37 CPPUNIT_ASSERT(aAny.hasValue());
38
39 aAny = xIndexAccess->getByIndex(m_nItems / 2);
40 CPPUNIT_ASSERT(aAny.hasValue());
41
42 aAny = xIndexAccess->getByIndex(m_nItems - 1);
43 CPPUNIT_ASSERT(aAny.hasValue());
44 }
45}
46
48{
49 uno::Reference<container::XIndexAccess> xIndexAccess(init(), UNO_QUERY_THROW);
50 xIndexAccess->getByIndex(m_nItems);
51}
52
53} // namespace apitest
54
55/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Reference< css::uno::XInterface > init()=0