diff options
Diffstat (limited to 'sc/qa/unit/subsequent_export-test.cxx')
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index b21b4aa9fa1f..b1db15933e58 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -150,7 +150,7 @@ public: void testMatrixMultiplication(); void testRefStringXLSX(); void testRefStringConfigXLSX(); - + void testRefStringUnspecified(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -210,7 +210,7 @@ public: CPPUNIT_TEST(testMatrixMultiplication); CPPUNIT_TEST(testRefStringXLSX); CPPUNIT_TEST(testRefStringConfigXLSX); - + CPPUNIT_TEST(testRefStringUnspecified); CPPUNIT_TEST_SUITE_END(); @@ -2915,6 +2915,34 @@ void ScExportTest::testRefStringConfigXLSX() xNewDocSh->DoClose(); } +void ScExportTest::testRefStringUnspecified() +{ + ScDocShell* pShell = new ScDocShell( + SfxModelFlags::EMBEDDED_OBJECT | + SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | + SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); + pShell->DoInitNew(); + + ScDocument& rDoc = pShell->GetDocument(); + ScCalcConfig aConfig = rDoc.GetCalcConfig(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Default string ref syntax value doesn't match", formula::FormulaGrammar::CONV_UNSPECIFIED, + aConfig.meStringRefAddressSyntax); + + // change formula syntax (i.e. not string ref syntax) to ExcelA1 + rDoc.SetGrammar( formula::FormulaGrammar::GRAM_NATIVE_XL_A1 ); + + ScDocShellRef xDocSh = saveAndReload( pShell, ODS ); + CPPUNIT_ASSERT_MESSAGE("Failed to reload doc", xDocSh.Is()); + + // with string ref syntax at its default value, we should've saved ExcelA1 + ScDocument& rDoc2 = xDocSh->GetDocument(); + aConfig = rDoc2.GetCalcConfig(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("String ref syntax doesn't match", formula::FormulaGrammar::CONV_XL_A1, + aConfig.meStringRefAddressSyntax); + + xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |