defer finding dialog parent until we need it
[LibreOffice.git] / test / source / table / xcell.cxx
blob8409fd3efdcb86d3c89b3353a049731643683c51
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/table/xcell.hxx>
12 #include <com/sun/star/table/XCell.hpp>
13 #include <com/sun/star/table/CellContentType.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;
22 namespace apitest
24 void XCell::testGetError()
26 uno::Reference<table::XCell> xCell(init(), UNO_QUERY_THROW);
27 const sal_Int32 nCorrectFormula = xCell->getError();
28 xCell->setFormula(u"=sqrt(-2)"_ustr);
29 const sal_Int32 nIncorrectFormula = xCell->getError();
31 CPPUNIT_ASSERT_EQUAL_MESSAGE("Successfully able to get Error", sal_Int32(0), nCorrectFormula);
32 CPPUNIT_ASSERT_MESSAGE("Successfully able to get Error", (nIncorrectFormula != 0));
35 void XCell::testGetType()
37 uno::Reference<table::XCell> xCell(init(), UNO_QUERY_THROW);
38 bool aResult = true;
40 if (xCell->getType() == table::CellContentType_EMPTY)
41 aResult &= true;
42 else if (xCell->getType() == table::CellContentType_VALUE)
43 aResult &= true;
44 else if (xCell->getType() == table::CellContentType_TEXT)
45 aResult &= true;
46 else if (xCell->getType() == table::CellContentType_FORMULA)
47 aResult &= true;
48 else
49 aResult = false;
51 CPPUNIT_ASSERT_MESSAGE("Successfully able to get Type", aResult);
54 void XCell::testSetGetFormula()
56 uno::Reference<table::XCell> xCell(init(), UNO_QUERY_THROW);
57 OUString aFormula = u"=2+2"_ustr;
59 xCell->setFormula(aFormula);
61 OUString aFormula2 = xCell->getFormula();
63 CPPUNIT_ASSERT_EQUAL_MESSAGE("Successfully able to set and get Formula", aFormula, aFormula2);
66 void XCell::testSetGetValue()
68 uno::Reference<table::XCell> xCell(init(), UNO_QUERY_THROW);
69 double nInValue = 222.555;
71 xCell->setValue(nInValue);
73 double nCellValue = xCell->getValue();
75 CPPUNIT_ASSERT_EQUAL_MESSAGE("Successfully able to set and get Value", nInValue, nCellValue);
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */