nss: upgrade to release 3.73
[LibreOffice.git] / test / source / sheet / xdatapilottables.cxx
blobb666650eaa712dfcdbc96fcbee0941426cbb9e0b
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/sheet/xdatapilottables.hxx>
12 #include <com/sun/star/sheet/XDataPilotDescriptor.hpp>
13 #include <com/sun/star/sheet/XDataPilotTables.hpp>
14 #include <com/sun/star/sheet/XSpreadsheet.hpp>
15 #include <com/sun/star/table/CellAddress.hpp>
16 #include <com/sun/star/uno/RuntimeException.hpp>
17 #include <com/sun/star/uno/Reference.hxx>
19 #include <cppunit/TestAssert.h>
21 using namespace css;
22 using namespace css::uno;
24 namespace apitest
26 void XDataPilotTables::testXDataPilotTables()
28 uno::Reference<sheet::XDataPilotTables> xDPT(init(), UNO_QUERY_THROW);
29 uno::Reference<sheet::XSpreadsheet> xSheet(getXSpreadsheet(), UNO_QUERY_THROW);
31 uno::Reference<sheet::XDataPilotDescriptor> xDPD(xDPT->createDataPilotDescriptor(),
32 UNO_SET_THROW);
34 xDPT->insertNewByName("XDataPilotTables", table::CellAddress(0, 9, 8), xDPD);
35 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to insert new DataPilotTable", OUString("Filter"),
36 xSheet->getCellByPosition(9, 8)->getFormula());
38 CPPUNIT_ASSERT_THROW_MESSAGE(
39 "No exception thrown, when inserting element with existing name",
40 xDPT->insertNewByName("XDataPilotTables", table::CellAddress(0, 7, 7), xDPD),
41 css::uno::RuntimeException);
43 xDPT->removeByName("XDataPilotTables");
44 CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to remove DataPilotTable", OUString(""),
45 xSheet->getCellByPosition(9, 8)->getFormula());
47 CPPUNIT_ASSERT_THROW_MESSAGE("No exception, when removing no existing element",
48 xDPT->removeByName("XDataPilotTables"),
49 css::uno::RuntimeException);
53 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */