summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/qa/extras/scnamedrangeobj.cxx43
-rw-r--r--sc/qa/extras/scnamedrangesobj.cxx2
-rw-r--r--sc/qa/extras/testdocuments/ScNamedRangeObj.odsbin0 -> 9184 bytes
-rw-r--r--sc/qa/extras/testdocuments/rangenames.odsbin9347 -> 0 bytes
4 files changed, 32 insertions, 13 deletions
diff --git a/sc/qa/extras/scnamedrangeobj.cxx b/sc/qa/extras/scnamedrangeobj.cxx
index 2d7240276ed0..69785c7be790 100644
--- a/sc/qa/extras/scnamedrangeobj.cxx
+++ b/sc/qa/extras/scnamedrangeobj.cxx
@@ -27,19 +27,23 @@
*/
#include <test/sheet/xnamedrange.hxx>
+#include <test/container/xnamed.hxx>
#include <test/unoapi_test.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/sheet/XNamedRanges.hpp>
namespace sc_apitest {
-#define NUMBER_OF_TESTS 6
+#define NUMBER_OF_TESTS 8
-class ScNamedRangeObj : public UnoApiTest, apitest::XNamedRange
+class ScNamedRangeObj : public UnoApiTest, apitest::XNamedRange, apitest::XNamed
{
public:
+ ScNamedRangeObj();
+
virtual void setUp();
virtual void tearDown();
@@ -53,8 +57,12 @@ public:
CPPUNIT_TEST(testSetType);
CPPUNIT_TEST(testGetReferencePosition);
CPPUNIT_TEST(testSetReferencePosition);
+ CPPUNIT_TEST(testSetName);
+ CPPUNIT_TEST(testGetName);
CPPUNIT_TEST_SUITE_END();
private:
+ uno::Reference< sheet::XNamedRanges > init_impl();
+
static sal_Int32 nTest;
static uno::Reference< lang::XComponent > mxComponent;
};
@@ -62,29 +70,40 @@ private:
sal_Int32 ScNamedRangeObj::nTest = 0;
uno::Reference< lang::XComponent > ScNamedRangeObj::mxComponent;
-uno::Reference< sheet::XNamedRange> ScNamedRangeObj::getNamedRange(const rtl::OUString& rRangeName)
+ScNamedRangeObj::ScNamedRangeObj():
+ apitest::XNamed(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NamedRange")))
{
- uno::Reference< container::XNameAccess > xNamedAccess(init(), UNO_QUERY_THROW);
- uno::Reference< sheet::XNamedRange > xNamedRange(xNamedAccess->getByName(rRangeName), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xNamedRange.is());
- return xNamedRange;
}
-uno::Reference< uno::XInterface > ScNamedRangeObj::init()
+uno::Reference< sheet::XNamedRanges > ScNamedRangeObj::init_impl()
{
rtl::OUString aFileURL;
- createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rangenames.ods")), aFileURL);
+ createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScNamedRangeObj.ods")), aFileURL);
if(!mxComponent.is())
mxComponent = loadFromDesktop(aFileURL);
CPPUNIT_ASSERT(mxComponent.is());
uno::Reference< beans::XPropertySet > xPropSet (mxComponent, UNO_QUERY_THROW);
rtl::OUString aNamedRangesPropertyString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
- uno::Reference< container::XNameAccess > xNamedRangesNameAccess(xPropSet->getPropertyValue(aNamedRangesPropertyString), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xNamedRangesNameAccess.is());
+ uno::Reference< sheet::XNamedRanges > xNamedRanges(xPropSet->getPropertyValue(aNamedRangesPropertyString), UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xNamedRanges.is());
- return xNamedRangesNameAccess;
+ return xNamedRanges;
+}
+
+uno::Reference< sheet::XNamedRange> ScNamedRangeObj::getNamedRange(const rtl::OUString& rRangeName)
+{
+ uno::Reference< container::XNameAccess > xNamedAccess(init_impl(), UNO_QUERY_THROW);
+ uno::Reference< sheet::XNamedRange > xNamedRange(xNamedAccess->getByName(rRangeName), UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xNamedRange.is());
+
+ return xNamedRange;
+}
+
+uno::Reference< uno::XInterface > ScNamedRangeObj::init()
+{
+ return getNamedRange(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NamedRange")));
}
void ScNamedRangeObj::setUp()
diff --git a/sc/qa/extras/scnamedrangesobj.cxx b/sc/qa/extras/scnamedrangesobj.cxx
index f6d2322eadd5..7a44bf11d27b 100644
--- a/sc/qa/extras/scnamedrangesobj.cxx
+++ b/sc/qa/extras/scnamedrangesobj.cxx
@@ -63,7 +63,7 @@ uno::Reference< lang::XComponent > ScNamedRangesObj::mxComponent;
uno::Reference< uno::XInterface > ScNamedRangesObj::init(sal_Int32 nSheet)
{
rtl::OUString aFileURL;
- createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rangenames.ods")), aFileURL);
+ createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScNamedRangeObj.ods")), aFileURL);
if(!mxComponent.is())
mxComponent = loadFromDesktop(aFileURL);
CPPUNIT_ASSERT(mxComponent.is());
diff --git a/sc/qa/extras/testdocuments/ScNamedRangeObj.ods b/sc/qa/extras/testdocuments/ScNamedRangeObj.ods
new file mode 100644
index 000000000000..39a53b27925f
--- /dev/null
+++ b/sc/qa/extras/testdocuments/ScNamedRangeObj.ods
Binary files differ
diff --git a/sc/qa/extras/testdocuments/rangenames.ods b/sc/qa/extras/testdocuments/rangenames.ods
deleted file mode 100644
index 1b101fde24be..000000000000
--- a/sc/qa/extras/testdocuments/rangenames.ods
+++ /dev/null
Binary files differ