[Libreoffice-commits] .: 3 commits - sc/qa test/inc test/source

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Sun Feb 19 14:55:20 PST 2012


 sc/qa/extras/scdatabaserangeobj.cxx               |    3 -
 sc/qa/extras/testdocuments/ScDatabaseRangeObj.ods |binary
 test/inc/test/sheet/xdatabaserange.hxx            |    1 
 test/source/sheet/xdatabaserange.cxx              |   47 ++++++++++++++++++++++
 test/source/sheet/xspreadsheets2.cxx              |    2 
 5 files changed, 51 insertions(+), 2 deletions(-)

New commits:
commit d9653ee2f3bc1f77a31df6978e9d4ed4e74dbfb0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Feb 19 15:50:32 2012 +0100

    add testRefresh to ScDatabaseRangeObj, related fdo#44167

diff --git a/sc/qa/extras/scdatabaserangeobj.cxx b/sc/qa/extras/scdatabaserangeobj.cxx
index e9f09c6..03cf4d5 100644
--- a/sc/qa/extras/scdatabaserangeobj.cxx
+++ b/sc/qa/extras/scdatabaserangeobj.cxx
@@ -37,7 +37,7 @@
 
 namespace sc_apitest {
 
-#define NUMBER_OF_TESTS 5
+#define NUMBER_OF_TESTS 6
 
 class ScDatabaseRangeObj : public UnoApiTest, apitest::XDatabaseRange
 {
@@ -53,6 +53,7 @@ public:
     CPPUNIT_TEST(testGetSubtotalDescriptor);
     CPPUNIT_TEST(testGetImportDescriptor);
     CPPUNIT_TEST(testGetFilterDescriptor);
+    CPPUNIT_TEST(testRefresh);
     CPPUNIT_TEST_SUITE_END();
 private:
     static sal_Int32 nTest;
diff --git a/sc/qa/extras/testdocuments/ScDatabaseRangeObj.ods b/sc/qa/extras/testdocuments/ScDatabaseRangeObj.ods
index 0561655..48f001c 100644
Binary files a/sc/qa/extras/testdocuments/ScDatabaseRangeObj.ods and b/sc/qa/extras/testdocuments/ScDatabaseRangeObj.ods differ
commit 92009abe68c180aa3c66b5159e3324665cf3c709
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Feb 19 15:49:35 2012 +0100

    add testRefresh to XDatabaseRange
    
    XDatabase range test case is now finished

diff --git a/test/inc/test/sheet/xdatabaserange.hxx b/test/inc/test/sheet/xdatabaserange.hxx
index d388aa3..3e38056 100644
--- a/test/inc/test/sheet/xdatabaserange.hxx
+++ b/test/inc/test/sheet/xdatabaserange.hxx
@@ -45,6 +45,7 @@ public:
     void testGetSubtotalDescriptor();
     void testGetImportDescriptor();
     void testGetFilterDescriptor();
+    void testRefresh();
 };
 
 }
diff --git a/test/source/sheet/xdatabaserange.cxx b/test/source/sheet/xdatabaserange.cxx
index 51e3c32..486f09f 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: */
commit e521ac1a7304dead6557b15ecc24ee60be93cc48
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Feb 19 15:02:27 2012 +0100

    this test uses ScNamedRangeObj.ods too
    
    TODO: remove the explicit test file dependency from the interface test
    code
    don't use one of the test files for another class

diff --git a/test/source/sheet/xspreadsheets2.cxx b/test/source/sheet/xspreadsheets2.cxx
index 6fbf35b..18f024b 100644
--- a/test/source/sheet/xspreadsheets2.cxx
+++ b/test/source/sheet/xspreadsheets2.cxx
@@ -60,7 +60,7 @@ namespace apitest {
 XSpreadsheets2::XSpreadsheets2():
     aSrcSheetName(RTL_CONSTASCII_USTRINGPARAM("SheetToCopy")),
     aSrcFileName(RTL_CONSTASCII_USTRINGPARAM("rangenamessrc.ods")),
-    aDestFileBase(RTL_CONSTASCII_USTRINGPARAM("rangenames.ods"))
+    aDestFileBase(RTL_CONSTASCII_USTRINGPARAM("ScNamedRangeObj.ods"))
 {
 }
 


More information about the Libreoffice-commits mailing list