summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
Diffstat (limited to 'sc/qa')
-rwxr-xr-xsc/qa/unit/data/csv/testTdf82254-csv-bom.csv3
-rw-r--r--sc/qa/unit/subsequent_filters_test.cxx21
2 files changed, 24 insertions, 0 deletions
diff --git a/sc/qa/unit/data/csv/testTdf82254-csv-bom.csv b/sc/qa/unit/data/csv/testTdf82254-csv-bom.csv
new file mode 100755
index 000000000000..eabb18da0bf0
--- /dev/null
+++ b/sc/qa/unit/data/csv/testTdf82254-csv-bom.csv
@@ -0,0 +1,3 @@
+col1 col2 col3
+row1-1 row1-2 row1-3
+row2-1 row2-2 row2-3
diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx
index 10cf129c0412..6af0460170be 100644
--- a/sc/qa/unit/subsequent_filters_test.cxx
+++ b/sc/qa/unit/subsequent_filters_test.cxx
@@ -54,6 +54,8 @@
#include <undomanager.hxx>
#include <tabprotection.hxx>
+#include <sfx2/docfile.hxx>
+
#include <orcusfilters.hxx>
#include <filter.hxx>
@@ -196,6 +198,7 @@ public:
void testImportCrashes();
void testTdf129681();
void testTdf149484();
+ void testTdf82254_csv_bom();
void testEscapedUnicodeXLSX();
void testTdf144758_DBDataDefaultOrientation();
void testSharedFormulaXLS();
@@ -321,6 +324,7 @@ public:
CPPUNIT_TEST(testImportCrashes);
CPPUNIT_TEST(testTdf129681);
CPPUNIT_TEST(testTdf149484);
+ CPPUNIT_TEST(testTdf82254_csv_bom);
CPPUNIT_TEST(testEscapedUnicodeXLSX);
CPPUNIT_TEST(testTdf144758_DBDataDefaultOrientation);
CPPUNIT_TEST(testSharedFormulaXLS);
@@ -3203,6 +3207,23 @@ void ScFiltersTest::testTdf149484()
CPPUNIT_ASSERT_EQUAL(OUString("-TRUE-"), pDoc->GetString(0, 2, 0));
}
+void ScFiltersTest::testTdf82254_csv_bom()
+{
+ setImportFilterName(SC_TEXT_CSV_FILTER_NAME);
+ createScDoc("csv/testTdf82254-csv-bom.csv");
+ saveAndReload(SC_TEXT_CSV_FILTER_NAME);
+ ScDocShell* pDocSh = getScDocShell();
+ SvStream* pStream = pDocSh->GetMedium()->GetInStream();
+
+ pStream->Seek(0);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(0), pStream->Tell());
+ pStream->StartReadingUnicodeText(RTL_TEXTENCODING_UTF8);
+ // Without the fix in place, this test would have failed with
+ // - Expected: 3
+ // - Actual : 0 (no byte order mark was read)
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(3), pStream->Tell());
+}
+
void ScFiltersTest::testEscapedUnicodeXLSX()
{
createScDoc("xlsx/escape-unicode.xlsx");