summaryrefslogtreecommitdiff
path: root/sc/qa/unit/subsequent_filters-test.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/qa/unit/subsequent_filters-test.cxx')
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 2e5a8f6df0d4..bdc58b840d0f 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -174,6 +174,7 @@ public:
void testExternalRefCacheXLSX();
void testExternalRefCacheODS();
void testHybridSharedStringODS();
+ void testCopyMergedNumberFormats();
CPPUNIT_TEST_SUITE(ScFiltersTest);
CPPUNIT_TEST(testBasicCellContentODS);
@@ -252,6 +253,7 @@ public:
CPPUNIT_TEST(testExternalRefCacheXLSX);
CPPUNIT_TEST(testExternalRefCacheODS);
CPPUNIT_TEST(testHybridSharedStringODS);
+ CPPUNIT_TEST(testCopyMergedNumberFormats);
CPPUNIT_TEST_SUITE_END();
private:
@@ -2583,6 +2585,29 @@ void ScFiltersTest::testHybridSharedStringODS()
xDocSh->DoClose();
}
+void ScFiltersTest::testCopyMergedNumberFormats()
+{
+ ScDocShellRef xDocSh = loadDoc("copy-merged-number-formats.", ODS);
+ CPPUNIT_ASSERT(xDocSh.Is());
+ ScDocument* pDoc = xDocSh->GetDocument();
+
+ // Cells B1, C1 and D1 are formatted as dates.
+ OUString aStrB1 = pDoc->GetString(ScAddress(1,0,0));
+ OUString aStrC1 = pDoc->GetString(ScAddress(2,0,0));
+ OUString aStrD1 = pDoc->GetString(ScAddress(3,0,0));
+
+ ScDocument aCopyDoc;
+ aCopyDoc.InsertTab(0, "CopyHere");
+ pDoc->CopyStaticToDocument(ScRange(1,0,0,3,0,0), 0, &aCopyDoc);
+
+ // Make sure the date formats are copied to the new document.
+ CPPUNIT_ASSERT_EQUAL(aStrB1, aCopyDoc.GetString(ScAddress(1,0,0)));
+ CPPUNIT_ASSERT_EQUAL(aStrC1, aCopyDoc.GetString(ScAddress(2,0,0)));
+ CPPUNIT_ASSERT_EQUAL(aStrD1, aCopyDoc.GetString(ScAddress(3,0,0)));
+
+ xDocSh->DoClose();
+}
+
ScFiltersTest::ScFiltersTest()
: ScBootstrapFixture( "/sc/qa/unit/data" )
{