diff data/fileio/test/CSVStreamWriterTest.h @ 1833:21c792334c2e sensible-delimited-data-strings

Rewrite all the DelimitedDataString stuff so as to return vectors of individual cell strings rather than having the classes add the delimiters themselves. Rename accordingly to names based on StringExport. Take advantage of this in the CSV writer code so as to properly quote cells that contain delimiter characters.
author Chris Cannam
date Fri, 03 Apr 2020 17:11:05 +0100
parents 0d89abd631ac
children 735b0ccd3f4a
line wrap: on
line diff
--- a/data/fileio/test/CSVStreamWriterTest.h	Fri Apr 03 12:12:02 2020 +0100
+++ b/data/fileio/test/CSVStreamWriterTest.h	Fri Apr 03 17:11:05 2020 +0100
@@ -94,6 +94,7 @@
 
         std::ostringstream oss;
         const auto result = CSVStreamWriter::writeInChunks(oss, mwm);
+        
         QVERIFY( oss.str() == getExpectedString() );
         QVERIFY( result );
     }
@@ -303,9 +304,12 @@
 //        qDebug("Create Expected Output\n");
 
         // NB. removed end line break
-        const auto expectedOutput =
-            notes.toDelimitedDataString(",", {}, 0, notes.getEndFrame())
-            .trimmed();
+        QString expectedOutput;
+        auto rows = notes.toStringExportRows({}, 0, notes.getEndFrame());
+        for (auto row: rows) {
+            expectedOutput += StringBits::joinDelimited(row, ",") + "\n";
+        }
+        expectedOutput = expectedOutput.trimmed();
 
         StubReporter reporter { []() -> bool { return false; } };
         std::ostringstream oss;