! * \brief AsciiFilterTest::singleColumn * Testfile contains only a single column */
| 258 | * Testfile contains only a single column |
| 259 | */ |
| 260 | void 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 | |
| 289 | void AsciiFilterTest::singleColumnSimplifyWhitespaceEnabled() { |
| 290 | QStringList fileContent = { |
nothing calls this directly
no test coverage detected