1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #include <test/container/xindexaccess.hxx>
12 #include <com/sun/star/container/XIndexAccess.hpp>
14 #include <com/sun/star/uno/Reference.hxx>
16 #include <cppunit/TestAssert.h>
19 using namespace css::uno
;
23 void XIndexAccess::testGetCount()
25 uno::Reference
<container::XIndexAccess
> xIndexAccess(init(), UNO_QUERY_THROW
);
26 CPPUNIT_ASSERT_EQUAL(m_nItems
, xIndexAccess
->getCount());
29 void XIndexAccess::testGetByIndex()
31 uno::Reference
<container::XIndexAccess
> xIndexAccess(init(), UNO_QUERY_THROW
);
32 CPPUNIT_ASSERT_EQUAL(m_nItems
, xIndexAccess
->getCount());
36 Any aAny
= xIndexAccess
->getByIndex(0);
37 CPPUNIT_ASSERT(aAny
.hasValue());
39 aAny
= xIndexAccess
->getByIndex(m_nItems
/ 2);
40 CPPUNIT_ASSERT(aAny
.hasValue());
42 aAny
= xIndexAccess
->getByIndex(m_nItems
- 1);
43 CPPUNIT_ASSERT(aAny
.hasValue());
47 void XIndexAccess::testGetByIndexException()
49 uno::Reference
<container::XIndexAccess
> xIndexAccess(init(), UNO_QUERY_THROW
);
50 xIndexAccess
->getByIndex(m_nItems
);
53 } // namespace apitest
55 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */