LibreOffice Module test (master)  1
xindent.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 
10 #include <test/util/xindent.hxx>
11 
12 #include <com/sun/star/beans/XPropertySet.hpp>
13 #include <com/sun/star/util/XIndent.hpp>
14 
15 #include <com/sun/star/uno/Any.hxx>
16 #include <com/sun/star/uno/Reference.hxx>
17 
18 #include <cppunit/TestAssert.h>
19 
20 using namespace com::sun::star;
21 using namespace com::sun::star::uno;
22 
23 namespace apitest
24 {
25 void XIndent::testIncrementIndent()
26 {
27  uno::Reference<util::XIndent> xIndent(init(), UNO_QUERY_THROW);
28  uno::Reference<beans::XPropertySet> xPropertySet(xIndent, UNO_QUERY_THROW);
29  uno::Any aAny = xPropertySet->getPropertyValue("ParaIndent");
30  sal_Int32 nOldValue = aAny.get<sal_Int32>();
31 
32  xIndent->incrementIndent();
33 
34  uno::Any aAny2 = xPropertySet->getPropertyValue("ParaIndent");
35  sal_Int32 nNewValue = aAny2.get<sal_Int32>();
36  CPPUNIT_ASSERT_MESSAGE("Successfully able to Increment Indent", nOldValue < nNewValue);
37 }
38 void XIndent::testDecrementIndent()
39 {
40  uno::Reference<util::XIndent> xIndent(init(), UNO_QUERY_THROW);
41  uno::Reference<beans::XPropertySet> xPropertySet(xIndent, UNO_QUERY_THROW);
42  xIndent->incrementIndent();
43  uno::Any aAny = xPropertySet->getPropertyValue("ParaIndent");
44  sal_Int32 nOldValue = aAny.get<sal_Int32>();
45 
46  xIndent->decrementIndent();
47 
48  uno::Any aAny2 = xPropertySet->getPropertyValue("ParaIndent");
49  sal_Int32 nNewValue = aAny2.get<sal_Int32>();
50  CPPUNIT_ASSERT_MESSAGE("Successfully able to Decrement Indent", nOldValue > nNewValue);
51 }
52 }
53 
54 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
FILE * init(int, char **)