1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/.
10 #include <test/sheet/xsheetcondition.hxx>
12 #include <com/sun/star/sheet/ConditionOperator.hpp>
13 #include <com/sun/star/sheet/XSheetCondition.hpp>
15 #include <com/sun/star/uno/Reference.hxx>
17 #include <cppunit/TestAssert.h>
19 using namespace com::sun::star
;
20 using namespace com::sun::star::uno
;
24 void XSheetCondition::testGetSetFormula1()
26 uno::Reference
<sheet::XSheetCondition
> xSheetCondition(init(), UNO_QUERY_THROW
);
28 CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to get Formula1",
29 aFormula1
= xSheetCondition
->getFormula1());
31 xSheetCondition
->setFormula1("$Sheet1.$C$");
32 CPPUNIT_ASSERT_MESSAGE("Unable to set Formula1", aFormula1
!= xSheetCondition
->getFormula1());
35 void XSheetCondition::testGetSetFormula2()
37 uno::Reference
<sheet::XSheetCondition
> xSheetCondition(init(), UNO_QUERY_THROW
);
39 CPPUNIT_ASSERT_NO_THROW_MESSAGE("Unable to get Formula2",
40 aFormula2
= xSheetCondition
->getFormula2());
42 xSheetCondition
->setFormula2("$Sheet1.$A$");
43 CPPUNIT_ASSERT_MESSAGE("Unable to set Formula2", aFormula2
!= xSheetCondition
->getFormula2());
46 void XSheetCondition::testGetSetOperator()
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());
53 xSheetCondition
->setOperator(sheet::ConditionOperator_BETWEEN
);
54 sheet::ConditionOperator aOperatorNew
= xSheetCondition
->getOperator();
55 CPPUNIT_ASSERT_MESSAGE("Unable to set Operator", aOperator
!= aOperatorNew
);
58 void XSheetCondition::testGetSetSourcePosition()
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());
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
);
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */