MCPcopy Create free account
hub / github.com/KDE/labplot / singleColumn

Method singleColumn

tests/import_export/ASCII/AsciiFilterTest.cpp:260–287  ·  view source on GitHub ↗

! * \brief AsciiFilterTest::singleColumn * Testfile contains only a single column */

Source from the content-addressed store, hash-verified

258 * Testfile contains only a single column
259 */
260void AsciiFilterTest::singleColumn() {
261 QStringList fileContent = {
262 QStringLiteral("123"),
263 QStringLiteral("234"),
264 QStringLiteral("345"),
265 };
266 QString savePath;
267 SAVE_FILE("testfile", fileContent);
268
269 AsciiFilter filter;
270 auto p = filter.properties();
271 p.headerEnabled = false;
272 p.intAsDouble = false;
273 filter.setProperties(p);
274
275 Spreadsheet spreadsheet(QStringLiteral("test"), false);
276 filter.readDataFromFile(savePath, &spreadsheet, AbstractFileFilter::ImportMode::Replace);
277 QVERIFY(filter.lastError().isEmpty());
278
279 QCOMPARE(spreadsheet.columnCount(), 1);
280 QCOMPARE(spreadsheet.rowCount(), 3);
281 QCOMPARE(spreadsheet.column(0)->name(), i18n("Column") + QStringLiteral(" 1"));
282 QCOMPARE(spreadsheet.column(0)->columnMode(), AbstractColumn::ColumnMode::Integer);
283
284 QCOMPARE(spreadsheet.column(0)->integerAt(0), 123);
285 QCOMPARE(spreadsheet.column(0)->integerAt(1), 234);
286 QCOMPARE(spreadsheet.column(0)->integerAt(2), 345);
287}
288
289void AsciiFilterTest::singleColumnSimplifyWhitespaceEnabled() {
290 QStringList fileContent = {

Callers

nothing calls this directly

Calls 11

setPropertiesMethod · 0.80
lastErrorMethod · 0.80
propertiesMethod · 0.45
readDataFromFileMethod · 0.45
isEmptyMethod · 0.45
columnCountMethod · 0.45
rowCountMethod · 0.45
nameMethod · 0.45
columnMethod · 0.45
columnModeMethod · 0.45
integerAtMethod · 0.45

Tested by

no test coverage detected