summaryrefslogtreecommitdiff
path: root/test/source
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-02-19 15:49:35 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-02-19 23:52:18 +0100
commit92009abe68c180aa3c66b5159e3324665cf3c709 (patch)
tree6ed75ae5267d2ef4f3f911d014739532c4ce48ba /test/source
parente521ac1a7304dead6557b15ecc24ee60be93cc48 (diff)
add testRefresh to XDatabaseRange
XDatabase range test case is now finished
Diffstat (limited to 'test/source')
-rw-r--r--test/source/sheet/xdatabaserange.cxx47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/source/sheet/xdatabaserange.cxx b/test/source/sheet/xdatabaserange.cxx
index 51e3c3258840..486f09fca709 100644
--- a/test/source/sheet/xdatabaserange.cxx
+++ b/test/source/sheet/xdatabaserange.cxx
@@ -37,6 +37,10 @@
#include <com/sun/star/table/CellRangeAddress.hpp>
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
+#include <com/sun/star/table/XCell.hpp>
+#include <com/sun/star/table/XTableRows.hpp>
+#include <com/sun/star/table/XColumnRowRange.hpp>
#include <rtl/oustringostreaminserter.hxx>
#include "cppunit/extensions/HelperMacros.h"
@@ -153,6 +157,49 @@ void XDatabaseRange::testGetImportDescriptor()
uno::Sequence< beans::PropertyValue > xImportDescr = xDBRange->getImportDescriptor();
}
+void XDatabaseRange::testRefresh()
+{
+ uno::Reference< sheet::XDatabaseRange > xDBRange( init(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Refresh"))), UNO_QUERY_THROW);
+
+ const sal_Int32 nCol = 0;
+ rtl::OUString aHidden(RTL_CONSTASCII_USTRINGPARAM("IsVisible"));
+ uno::Reference< sheet::XCellRangeReferrer > xCellRangeReferrer(xDBRange, UNO_QUERY_THROW);
+ uno::Reference< table::XCellRange > xCellRange = xCellRangeReferrer->getReferredCells();
+
+ for (sal_Int32 i = 1; i < 5; ++i)
+ {
+ uno::Reference< table::XCell > xCell = xCellRange->getCellByPosition(nCol, i);
+ xCell->setValue(0);
+ }
+
+ for (sal_Int32 i = 2; i < 5; ++i)
+ {
+ uno::Reference< table::XColumnRowRange > xColRowRange(xCellRange, UNO_QUERY_THROW);
+ uno::Reference< table::XTableRows > xRows = xColRowRange->getRows();
+ uno::Reference< table::XCellRange > xRow(xRows->getByIndex(i), UNO_QUERY_THROW);
+ uno::Reference< beans::XPropertySet > xPropRow(xRow, UNO_QUERY_THROW);
+ Any aAny = xPropRow->getPropertyValue( aHidden );
+
+ CPPUNIT_ASSERT( aAny.get<sal_Bool>() == true);
+ }
+
+ xDBRange->refresh();
+ std::cout << "after refresh" << std::endl;
+
+ for (sal_Int32 i = 1; i < 5; ++i)
+ {
+ uno::Reference< table::XColumnRowRange > xColRowRange(xCellRange, UNO_QUERY_THROW);
+ uno::Reference< table::XTableRows > xRows = xColRowRange->getRows();
+ uno::Reference< table::XCellRange > xRow(xRows->getByIndex(i), UNO_QUERY_THROW);
+ uno::Reference< beans::XPropertySet > xPropRow(xRow, UNO_QUERY_THROW);
+ Any aAny = xPropRow->getPropertyValue( aHidden );
+
+ CPPUNIT_ASSERT( aAny.get<sal_Bool>() == false);
+ }
+
+
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */