summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-01-04 22:41:50 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-01-04 22:49:36 +0100
commitcc84ff4a51790f52f2e729cc61f7515fbbd51f35 (patch)
treee5676cc150ef35dadf7775207fc08522b81e90e5 /sc/qa
parent540f090a68ae4375a36d0ee6dfbb4a82f28ac704 (diff)
add unit test for dependency tree during ods import
Change-Id: I92bff38304959237042b9a0078be25948d642b25
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/data/ods/dependencyTree.odsbin0 -> 7967 bytes
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx30
2 files changed, 30 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/dependencyTree.ods b/sc/qa/unit/data/ods/dependencyTree.ods
new file mode 100644
index 000000000000..fc5aae0a94b9
--- /dev/null
+++ b/sc/qa/unit/data/ods/dependencyTree.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index c283508d7693..5acbfb812380 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -168,6 +168,7 @@ public:
void testCellAnchoredShapesODS();
void testPivotTableBasicODS();
+ void testFormulaDependency();
void testRowHeight();
@@ -213,6 +214,7 @@ public:
CPPUNIT_TEST(testPivotTableBasicODS);
// CPPUNIT_TEST(testRowHeight);
+ CPPUNIT_TEST(testFormulaDependency);
//disable testPassword on MacOSX due to problems with libsqlite3
//also crashes on DragonFly due to problems with nss/nspr headers
@@ -1749,6 +1751,34 @@ void ScFiltersTest::testNewCondFormat()
testCondFile(aCSVPath, pDoc, 0);
}
+void ScFiltersTest::testFormulaDependency()
+{
+ const rtl::OUString aFileNameBase("dependencyTree.");
+ rtl::OUString aFileExtension(aFileFormats[ODS].pName, strlen(aFileFormats[ODS].pName), RTL_TEXTENCODING_UTF8 );
+ rtl::OUString aFilterName(aFileFormats[ODS].pFilterName, strlen(aFileFormats[ODS].pFilterName), RTL_TEXTENCODING_UTF8) ;
+ rtl::OUString aFileName;
+ createFileURL(aFileNameBase, aFileExtension, aFileName);
+ rtl::OUString aFilterType(aFileFormats[ODS].pTypeName, strlen(aFileFormats[ODS].pTypeName), RTL_TEXTENCODING_UTF8);
+ std::cout << aFileFormats[ODS].pName << " Test" << std::endl;
+
+ unsigned int nFormatType = aFileFormats[ODS].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType,
+ nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
+
+ ScDocument* pDoc = xDocSh->GetDocument();
+
+ // check if formula in A1 changes value
+ double nVal = pDoc->GetValue(0,0,0);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(nVal, 1.0, 1e-10);
+ pDoc->SetValue(0,1,0, 0.0);
+ nVal = pDoc->GetValue(0,0,0);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(nVal, 2.0, 1e-10);
+
+ // check that the number format is implicity inherited
+ // CPPUNIT_ASSERT_EQUAL(pDoc->GetString(0,4,0), pDoc->GetString(0,5,0));
+}
+
ScFiltersTest::ScFiltersTest()
: m_aBaseString(RTL_CONSTASCII_USTRINGPARAM("/sc/qa/unit/data"))
{