fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / test / source / sheet / xcellrangesquery.cxx
blob202e17a64b40d0182d5b792e42cdf5dd2141a57d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/xcellrangesquery.hxx>
12 #include <com/sun/star/sheet/XCellRangesQuery.hpp>
13 #include <com/sun/star/sheet/XSheetCellRanges.hpp>
14 #include <com/sun/star/table/CellAddress.hpp>
15 #include <com/sun/star/sheet/CellFlags.hpp>
17 #include "cppunit/extensions/HelperMacros.h"
19 using namespace com::sun::star;
20 using namespace com::sun::star::uno;
23 namespace apitest {
25 void XCellRangesQuery::testQueryColumnDifference()
27 OUString aExpected( "Sheet1.B1:C1,Sheet1.B3:C5" );
28 uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
29 uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryColumnDifferences(table::CellAddress(0, 1, 1));
30 OUString aResult = xRanges->getRangeAddressesAsString();
31 std::cout << "testQueryColumnDifference: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
32 CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryColumnDifference", aResult, aExpected);
35 void XCellRangesQuery::testQueryContentDifference()
37 OUString aExpected( "Sheet1.B2:B3" );
38 uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
39 uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryContentCells(sheet::CellFlags::VALUE);
40 OUString aResult = xRanges->getRangeAddressesAsString();
41 std::cout << "testQueryContentDifference: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
42 CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryContentDifference", aResult, aExpected);
45 void XCellRangesQuery::testQueryEmptyCells()
47 OUString aExpected( "Sheet1.A1:A5,Sheet1.B1:C1,Sheet1.B5,Sheet1.C3:C5,Sheet1.D1:D5" );
48 uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
49 uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryEmptyCells();
50 OUString aResult = xRanges->getRangeAddressesAsString();
51 std::cout << "testQueryEmptyCells: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
52 CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryEmptyCells", aResult, aExpected);
55 void XCellRangesQuery::testQueryFormulaCells()
57 OUString aExpected( "Sheet1.C2" );
58 uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
59 uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryFormulaCells(sheet::CellFlags::FORMULA);
60 OUString aResult = xRanges->getRangeAddressesAsString();
61 std::cout << "testQueryFormulaCells: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
62 CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryFormulaCells", aResult, aExpected);
65 void XCellRangesQuery::testQueryIntersection()
67 OUString aExpected( "Sheet1.D4:D5" );
68 uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
69 uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryIntersection(table::CellRangeAddress(0,3,3,7,7));
70 OUString aResult = xRanges->getRangeAddressesAsString();
71 std::cout << "testQueryIntersection: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
72 CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryIntersection", aResult, aExpected);
75 void XCellRangesQuery::testQueryRowDifference()
77 OUString aExpected( "Sheet1.A2:A4,Sheet1.C2:D4" );
78 uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
79 uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryRowDifferences(table::CellAddress(0,1,1));
80 OUString aResult = xRanges->getRangeAddressesAsString();
81 std::cout << "testQueryRowDifference: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
82 CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryRowDifference", aResult, aExpected);
85 void XCellRangesQuery::testQueryVisibleCells()
87 OUString aExpected( "Sheet1.A1:D5" );
88 uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW);
89 uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryVisibleCells();
90 OUString aResult = xRanges->getRangeAddressesAsString();
91 std::cout << "testQueryVisibleCells: Result: " << OUStringToOString(aResult, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
92 CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryVisibleCells", aResult, aExpected);
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */