summaryrefslogtreecommitdiff
path: root/sc/qa/unit/subsequent_export-test.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/qa/unit/subsequent_export-test.cxx')
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx61
1 files changed, 61 insertions, 0 deletions
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index a8e0f305b1f6..b21b4aa9fa1f 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -148,6 +148,8 @@ public:
void testMoveCellAnchoredShapes();
void testHeaderImage();
void testMatrixMultiplication();
+ void testRefStringXLSX();
+ void testRefStringConfigXLSX();
CPPUNIT_TEST_SUITE(ScExportTest);
@@ -206,6 +208,8 @@ public:
CPPUNIT_TEST(testMoveCellAnchoredShapes);
CPPUNIT_TEST(testHeaderImage);
CPPUNIT_TEST(testMatrixMultiplication);
+ CPPUNIT_TEST(testRefStringXLSX);
+ CPPUNIT_TEST(testRefStringConfigXLSX);
CPPUNIT_TEST_SUITE_END();
@@ -2854,6 +2858,63 @@ void ScExportTest::testMatrixMultiplication()
xDocSh->DoClose();
}
+void ScExportTest::testRefStringXLSX()
+{
+ ScDocShellRef xDocSh = loadDoc("ref_string.", XLSX);
+ CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.Is());
+
+ //make sure ref syntax gets saved for MSO-produced docs
+ xDocSh = saveAndReload( &(*xDocSh), XLSX);
+ CPPUNIT_ASSERT_MESSAGE("Failed to reload doc", xDocSh.Is());
+
+ ScDocument& rDoc = xDocSh->GetDocument();
+ ScCalcConfig aCalcConfig = rDoc.GetCalcConfig();
+ CPPUNIT_ASSERT_EQUAL(formula::FormulaGrammar::CONV_XL_A1, aCalcConfig.meStringRefAddressSyntax);
+
+ xDocSh->DoClose();
+}
+
+void ScExportTest::testRefStringConfigXLSX()
+{
+ // this doc is configured with CalcA1 ref syntax
+ ScDocShellRef xDocSh = loadDoc("empty.", XLSX);
+ CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.Is());
+
+ xDocSh = saveAndReload( &(*xDocSh), XLSX);
+ CPPUNIT_ASSERT_MESSAGE("Failed to reload doc", xDocSh.Is());
+
+ ScDocument& rDoc = xDocSh->GetDocument();
+ ScCalcConfig aConfig = rDoc.GetCalcConfig();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("String ref syntax doesn't match", formula::FormulaGrammar::CONV_OOO,
+ aConfig.meStringRefAddressSyntax);
+
+ // this doc has no entry for ref syntax
+ xDocSh = loadDoc("empty-noconf.", XLSX);
+ CPPUNIT_ASSERT_MESSAGE("Failed to open 2nd doc", xDocSh.Is());
+
+ ScDocument& rDoc2 = xDocSh->GetDocument();
+ aConfig = rDoc2.GetCalcConfig();
+ // therefore after import, ref syntax should be set to CalcA1 | ExcelA1
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("String ref syntax doesn't match", formula::FormulaGrammar::CONV_A1_XL_A1,
+ aConfig.meStringRefAddressSyntax);
+
+ //set ref syntax to something else than ExcelA1 (native to xlsx format) ...
+ aConfig.meStringRefAddressSyntax = formula::FormulaGrammar::CONV_XL_R1C1;
+ rDoc2.SetCalcConfig( aConfig );
+
+ ScDocShellRef xNewDocSh = saveAndReload( &(*xDocSh), XLSX);
+ CPPUNIT_ASSERT_MESSAGE("Failed to reload 2nd doc", xNewDocSh.Is());
+
+ // ... and make sure it got saved
+ ScDocument& rDoc3 = xNewDocSh->GetDocument();
+ aConfig = rDoc3.GetCalcConfig();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("String ref syntax doesn't match", formula::FormulaGrammar::CONV_XL_R1C1,
+ aConfig.meStringRefAddressSyntax);
+
+ xDocSh->DoClose();
+ xNewDocSh->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();