From e4882717f3dc0375e113ed692374870ab8302a16 Mon Sep 17 00:00:00 2001 From: Jan Kantert Date: Fri, 13 Feb 2015 14:39:00 +0100 Subject: add unittest for tdf#89330 Change-Id: I4c5c65733700e7e7245e96f85714221acf23bcfb Reviewed-on: https://gerrit.libreoffice.org/14473 Reviewed-by: Eike Rathke Tested-by: Eike Rathke --- sc/qa/unit/ucalc.hxx | 2 ++ sc/qa/unit/ucalc_formula.cxx | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) (limited to 'sc/qa') diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 867b27597732..4e69a8165bb1 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -151,6 +151,7 @@ public: void testFormulaRefUpdateNameCopySheet(); void testFormulaRefUpdateNameDelete(); void testFormulaRefUpdateValidity(); + void testErrorOnExternalReferences(); void testMultipleOperations(); void testFuncCOLUMN(); void testFuncCOUNT(); @@ -462,6 +463,7 @@ public: CPPUNIT_TEST(testFormulaRefUpdateNameCopySheet); CPPUNIT_TEST(testFormulaRefUpdateNameDelete); CPPUNIT_TEST(testFormulaRefUpdateValidity); + CPPUNIT_TEST(testErrorOnExternalReferences); CPPUNIT_TEST(testMultipleOperations); CPPUNIT_TEST(testFuncCOLUMN); CPPUNIT_TEST(testFuncCOUNT); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index ca731a232bb5..9eea4a32d4a0 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -1384,6 +1384,23 @@ void Test::testFormulaRefUpdateRange() m_pDoc->DeleteTab(0); } +void Test::testErrorOnExternalReferences() +{ + // Test tdf#89330 + m_pDoc->InsertTab(0, "Sheet1"); + m_pDoc->SetString(ScAddress(0,0,0), "='file:///Path/To/FileA.ods'#$Sheet1.A1A"); + + ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(0,0,0)); + CPPUNIT_ASSERT(pFC); + CPPUNIT_ASSERT_EQUAL(ScErrorCodes::errNoName, pFC->GetErrCode()); + + if (!checkFormula(*m_pDoc, ScAddress(0,0,0), "'file:///Path/To/FileA.ods'#$Sheet1.A1A")) + CPPUNIT_FAIL("Formula changed"); + + m_pDoc->DeleteTab(0); +} + + void Test::testFormulaRefUpdateSheets() { m_pDoc->InsertTab(0, "Sheet1"); -- cgit