include/test/container/xindexaccess.hxx | 23 +++++++++++++++-------- test/source/container/xindexaccess.cxx | 31 +++++++++++++++---------------- 2 files changed, 30 insertions(+), 24 deletions(-)
New commits: commit d0a6f8a8e862bede67989cd3fac105d7c8231eb0 Author: Jens Carl <j.car...@gmx.de> AuthorDate: Sat Dec 1 07:42:52 2018 +0000 Commit: Jens Carl <j.car...@gmx.de> CommitDate: Sat Dec 1 09:51:12 2018 +0100 Enable XIndexAccess test cases Add macro OOO_DLLPUBLIC_TEST to class XIndexAccess (needed to use the test cases), refactor ctor, and add missing header files. Change-Id: Id8b27c8c3a3d7fc5c64fafd25b0d9b4b511c281f Reviewed-on: https://gerrit.libreoffice.org/64375 Tested-by: Jenkins Reviewed-by: Jens Carl <j.car...@gmx.de> diff --git a/include/test/container/xindexaccess.hxx b/include/test/container/xindexaccess.hxx index 415008880e52..aa4273ded053 100644 --- a/include/test/container/xindexaccess.hxx +++ b/include/test/container/xindexaccess.hxx @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * @@ -10,16 +10,23 @@ #ifndef INCLUDED_TEST_CONTAINER_XINDEXACCESS_HXX #define INCLUDED_TEST_CONTAINER_XINDEXACCESS_HXX +#include <com/sun/star/uno/XInterface.hpp> + #include <com/sun/star/uno/Reference.hxx> -namespace apitest { +#include <test/testdllapi.hxx> -class XIndexAccess +namespace apitest +{ +class OOO_DLLPUBLIC_TEST XIndexAccess { public: - XIndexAccess(sal_Int32 nItems); + XIndexAccess(sal_Int32 nItems) + : m_nItems(nItems) + { + } - virtual css::uno::Reference< css::uno::XInterface > init() = 0; + virtual css::uno::Reference<css::uno::XInterface> init() = 0; void testGetCount(); void testGetByIndex(); // will throw an exception and should fail if not @@ -29,11 +36,11 @@ protected: ~XIndexAccess() {} private: - sal_Int32 const mnItems; + sal_Int32 const m_nItems; }; -} +} // namespace apitest #endif // INCLUDED_TEST_CONTAINER_XINDEXACCESS_HXX -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/test/source/container/xindexaccess.cxx b/test/source/container/xindexaccess.cxx index 3791e2b76393..9139136b36b3 100644 --- a/test/source/container/xindexaccess.cxx +++ b/test/source/container/xindexaccess.cxx @@ -8,49 +8,48 @@ */ #include <test/container/xindexaccess.hxx> + #include <com/sun/star/container/XIndexAccess.hpp> + +#include <com/sun/star/uno/Reference.hxx> + #include <cppunit/extensions/HelperMacros.h> using namespace css; using namespace css::uno; -namespace apitest { - -XIndexAccess::XIndexAccess(sal_Int32 nItems): - mnItems(nItems) +namespace apitest { -} - void XIndexAccess::testGetCount() { - uno::Reference< container::XIndexAccess > xIndexAccess(init(), UNO_QUERY_THROW); - CPPUNIT_ASSERT_EQUAL(mnItems, xIndexAccess->getCount()); + uno::Reference<container::XIndexAccess> xIndexAccess(init(), UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(m_nItems, xIndexAccess->getCount()); } void XIndexAccess::testGetByIndex() { - uno::Reference< container::XIndexAccess > xIndexAccess(init(), UNO_QUERY_THROW); - CPPUNIT_ASSERT_EQUAL(mnItems, xIndexAccess->getCount()); + uno::Reference<container::XIndexAccess> xIndexAccess(init(), UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(m_nItems, xIndexAccess->getCount()); - if (mnItems > 0) + if (m_nItems > 0) { Any aAny = xIndexAccess->getByIndex(0); CPPUNIT_ASSERT(aAny.hasValue()); - aAny = xIndexAccess->getByIndex(mnItems/2); + aAny = xIndexAccess->getByIndex(m_nItems / 2); CPPUNIT_ASSERT(aAny.hasValue()); - aAny = xIndexAccess->getByIndex(mnItems-1); + aAny = xIndexAccess->getByIndex(m_nItems - 1); CPPUNIT_ASSERT(aAny.hasValue()); } } void XIndexAccess::testGetByIndexException() { - uno::Reference< container::XIndexAccess > xIndexAccess(init(), UNO_QUERY_THROW); - xIndexAccess->getByIndex(mnItems); + uno::Reference<container::XIndexAccess> xIndexAccess(init(), UNO_QUERY_THROW); + xIndexAccess->getByIndex(m_nItems); } -} +} // namespace apitest /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits