sc/qa/unit/data/csv/tdf48731.csv | 15 +++++++++++++++ sc/qa/unit/subsequent_filters-test.cxx | 30 ++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+)
New commits: commit 6ba33f724986752ceffa27b4928d140a4b948ca7 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon May 3 16:57:00 2021 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon May 3 19:54:21 2021 +0200 tdf#48731: sc_subsequent_filters: Add unittest Change-Id: I8d3804d78f6005a594937fbdc92fa99dae70a3f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115043 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/unit/data/csv/tdf48731.csv b/sc/qa/unit/data/csv/tdf48731.csv new file mode 100644 index 000000000000..c0353427ced3 --- /dev/null +++ b/sc/qa/unit/data/csv/tdf48731.csv @@ -0,0 +1,15 @@ +WITHOUT QUOTES +1 apostrophe,' +2 apostrophes,'' +3 apostrophes,''' +A number,'3 +A word,'word +A misspelled word,'mword + +WITH QUOTES +1 apostrophe,"'" +2 apostrophes,"''" +3 apostrophes,"'''" +A number,"'3" +A word,"'word" +A misspelled word,"'mword" diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 5bdea80d8361..a854f49f0774 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -110,6 +110,7 @@ public: //ods, xls, xlsx filter tests void testCondFormatOperatorsSameRangeXLSX(); void testTdf119292(); + void testTdf48731(); void testCondFormatFormulaIsXLSX(); void testCondFormatBeginsAndEndsWithXLSX(); void testExtCondFormatXLSX(); @@ -319,6 +320,7 @@ public: CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testCondFormatOperatorsSameRangeXLSX); CPPUNIT_TEST(testTdf119292); + CPPUNIT_TEST(testTdf48731); CPPUNIT_TEST(testCondFormatFormulaIsXLSX); CPPUNIT_TEST(testCondFormatBeginsAndEndsWithXLSX); CPPUNIT_TEST(testExtCondFormatXLSX); @@ -638,6 +640,34 @@ void ScFiltersTest::testTdf119292() xDocSh->DoClose(); } +void ScFiltersTest::testTdf48731() +{ + ScDocShellRef xDocSh = loadDoc(u"tdf48731.", FORMAT_CSV); + CPPUNIT_ASSERT_MESSAGE("Failed to load document", xDocSh.is()); + + ScDocument& rDoc = xDocSh->GetDocument(); + + CPPUNIT_ASSERT_EQUAL(OUString("'"), rDoc.GetString(1, 1, 0)); + CPPUNIT_ASSERT_EQUAL(OUString("''"), rDoc.GetString(1, 2, 0)); + CPPUNIT_ASSERT_EQUAL(OUString("'''"), rDoc.GetString(1, 3, 0)); + + // Without the fix in place, this test would have failed with + // - Expected: '3 + // - Actual : 3 + CPPUNIT_ASSERT_EQUAL(OUString("'3"), rDoc.GetString(1, 4, 0)); + CPPUNIT_ASSERT_EQUAL(OUString("'word"), rDoc.GetString(1, 5, 0)); + CPPUNIT_ASSERT_EQUAL(OUString("'mword"), rDoc.GetString(1, 6, 0)); + + CPPUNIT_ASSERT_EQUAL(OUString("'"), rDoc.GetString(1, 9, 0)); + CPPUNIT_ASSERT_EQUAL(OUString("''"), rDoc.GetString(1, 10, 0)); + CPPUNIT_ASSERT_EQUAL(OUString("'''"), rDoc.GetString(1, 11, 0)); + CPPUNIT_ASSERT_EQUAL(OUString("'3"), rDoc.GetString(1, 12, 0)); + CPPUNIT_ASSERT_EQUAL(OUString("'word"), rDoc.GetString(1, 13, 0)); + CPPUNIT_ASSERT_EQUAL(OUString("'mword"), rDoc.GetString(1, 14, 0)); + + xDocSh->DoClose(); +} + void ScFiltersTest::testCondFormatFormulaIsXLSX() { ScDocShellRef xDocSh = loadDoc(u"tdf113013.", FORMAT_XLSX); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits