diff options
Diffstat (limited to 'sc/qa/unit/subsequent_filters-test.cxx')
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 0d2f55dcd184..74b844e22382 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -254,6 +254,8 @@ public: void testAutoheight2Rows(); void testXLSDefColWidth(); void testPreviewMissingObjLink(); + void testEscapedUnicodeXLSX(); + void testAutofilterNamedRangesXLSX(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBooleanFormatXLSX); @@ -397,6 +399,8 @@ public: CPPUNIT_TEST(testAutoheight2Rows); CPPUNIT_TEST(testXLSDefColWidth); CPPUNIT_TEST(testPreviewMissingObjLink); + CPPUNIT_TEST(testEscapedUnicodeXLSX); + CPPUNIT_TEST(testAutofilterNamedRangesXLSX); CPPUNIT_TEST_SUITE_END(); @@ -4370,6 +4374,37 @@ void ScFiltersTest::testPreviewMissingObjLink() xDocSh->DoClose(); } +void ScFiltersTest::testEscapedUnicodeXLSX() +{ + ScDocShellRef xDocSh = loadDoc("escape-unicode.", FORMAT_XLSX); + ScDocument& rDoc = xDocSh->GetDocument(); + + // Without the fix, there would be "_x000D_" after every new-line char. + CPPUNIT_ASSERT_EQUAL(OUString("Line 1\nLine 2\nLine 3\nLine 4"), rDoc.GetString(1, 1, 0)); + + xDocSh->DoClose(); +} + +void ScFiltersTest::testAutofilterNamedRangesXLSX() +{ + ScDocShellRef xDocSh = loadDoc(u"autofilternamedrange.", FORMAT_XLSX); + CPPUNIT_ASSERT_MESSAGE("Failed to load autofilternamedrange.xlsx", xDocSh.is()); + + ScDocument& rDoc = xDocSh->GetDocument(); + const ScDBData* pDBData = rDoc.GetDBCollection()->GetDBNearCursor(0, 0, 0); + CPPUNIT_ASSERT(pDBData); + ScRange aRange; + pDBData->GetArea(aRange); + CPPUNIT_ASSERT_EQUAL(ScRange(0, 0, 0, 0, 3, 0), aRange); + OUString aPosStr; + // test there is no '_xlnm._FilterDatabase' named range on the filter area + const ScRangeData* pRData = rDoc.GetRangeAtBlock(aRange, &aPosStr); + CPPUNIT_ASSERT(!pRData); + CPPUNIT_ASSERT_EQUAL(OUString(), aPosStr); + + xDocSh->DoClose(); +} + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "sc/qa/unit/data" ) { |