LibreOffice Module test (master)  1
xsheetcondition.cxx
Go to the documentation of this file.
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.
4  *
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  */
9 
11 
12 #include <com/sun/star/sheet/ConditionOperator.hpp>
13 #include <com/sun/star/sheet/XSheetCondition.hpp>
14 
15 #include <com/sun/star/uno/Reference.hxx>
16 
17 #include <cppunit/TestAssert.h>
18 
19 using namespace com::sun::star;
20 using namespace com::sun::star::uno;
21 
22 namespace apitest
23 {
24 void XSheetCondition::testGetSetFormula1()
25 {
26  uno::Reference<sheet::XSheetCondition> xSheetCondition(init(), UNO_QUERY_THROW);
27  OUString aFormula1;
28  CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to get Formula1",
29  aFormula1 = xSheetCondition->getFormula1());
30 
31  xSheetCondition->setFormula1("$Sheet1.$C$");
32  CPPUNIT_ASSERT_MESSAGE("Unable to set Formula1", aFormula1 != xSheetCondition->getFormula1());
33 }
34 
35 void XSheetCondition::testGetSetFormula2()
36 {
37  uno::Reference<sheet::XSheetCondition> xSheetCondition(init(), UNO_QUERY_THROW);
38  OUString aFormula2;
39  CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to get Formula2",
40  aFormula2 = xSheetCondition->getFormula2());
41 
42  xSheetCondition->setFormula2("$Sheet1.$A$");
43  CPPUNIT_ASSERT_MESSAGE("Unable to set Formula2", aFormula2 != xSheetCondition->getFormula2());
44 }
45 
46 void XSheetCondition::testGetSetOperator()
47 {
48  uno::Reference<sheet::XSheetCondition> xSheetCondition(init(), UNO_QUERY_THROW);
49  sheet::ConditionOperator aOperator;
50  CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to get Operator",
51  aOperator = xSheetCondition->getOperator());
52 
53  xSheetCondition->setOperator(sheet::ConditionOperator_BETWEEN);
54  sheet::ConditionOperator aOperatorNew = xSheetCondition->getOperator();
55  CPPUNIT_ASSERT_MESSAGE("Unable to set Operator", aOperator != aOperatorNew);
56 }
57 
58 void XSheetCondition::testGetSetSourcePosition()
59 {
60  uno::Reference<sheet::XSheetCondition> xSheetCondition(init(), UNO_QUERY_THROW);
61  table::CellAddress aSourcePosition(0, 0, 0);
62  CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to get SourcePosition",
63  aSourcePosition = xSheetCondition->getSourcePosition());
64 
65  xSheetCondition->setSourcePosition(table::CellAddress(0, 1, 1));
66  table::CellAddress aSourcePositionNew = xSheetCondition->getSourcePosition();
67  CPPUNIT_ASSERT_MESSAGE("Unable to set SourcePosition",
68  aSourcePosition.Row != aSourcePositionNew.Row);
69 }
70 }
71 
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
FILE * init(int, char **)