tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / test / source / container / xnameaccess.cxx
blob3616c4cda3631cc5328b5e77c2c0c9e7e5bafd3c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/container/xnameaccess.hxx>
12 #include <com/sun/star/container/NoSuchElementException.hpp>
13 #include <com/sun/star/container/XNameAccess.hpp>
15 #include <com/sun/star/uno/Reference.hxx>
16 #include <com/sun/star/uno/Sequence.hxx>
18 #include <cppunit/TestAssert.h>
20 using namespace css;
21 using namespace css::uno;
23 namespace apitest
25 void XNameAccess::testGetByName()
27 uno::Reference<container::XNameAccess> xNA(init(), uno::UNO_QUERY_THROW);
29 // test with existing name
30 CPPUNIT_ASSERT_NO_THROW(xNA->getByName(m_aName));
31 // test with non-existing name
32 CPPUNIT_ASSERT_THROW(xNA->getByName(m_aName + "UnitTest"), container::NoSuchElementException);
35 void XNameAccess::testGetElementNames()
37 uno::Reference<container::XNameAccess> xNA(init(), uno::UNO_QUERY_THROW);
38 uno::Sequence<OUString> aNames = xNA->getElementNames();
40 CPPUNIT_ASSERT(aNames.hasElements());
43 void XNameAccess::testHasByName()
45 uno::Reference<container::XNameAccess> xNA(init(), uno::UNO_QUERY_THROW);
47 // test with existing name
48 CPPUNIT_ASSERT(xNA->hasByName(m_aName));
49 // test with non-existing name
50 CPPUNIT_ASSERT(!xNA->hasByName(m_aName + "UnitTest"));
53 } // namespace apitest
55 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */