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

Method testCopyPasteColumnMode06

tests/spreadsheet/SpreadsheetTest.cpp:277–308  ·  view source on GitHub ↗

! automatically detect the proper format for the datetime columns having the format "yyyy-MM-dd hh:mm:ss" */

Source from the content-addressed store, hash-verified

275 automatically detect the proper format for the datetime columns having the format "yyyy-MM-dd hh:mm:ss"
276 */
277void SpreadsheetTest::testCopyPasteColumnMode06() {
278 Spreadsheet sheet(QStringLiteral("test"), false);
279 sheet.setColumnCount(2);
280 sheet.setRowCount(100);
281
282 const QString str = QStringLiteral(
283 "2018-03-21 10:00:00 1\n"
284 "2018-03-21 10:30:00 2");
285
286 QApplication::clipboard()->setText(str);
287
288 SpreadsheetView view(&sheet, false);
289 view.pasteIntoSelection();
290
291 // spreadsheet size
292 QCOMPARE(sheet.columnCount(), 2);
293 QCOMPARE(sheet.rowCount(), 100);
294
295 // column modes
296 QCOMPARE(sheet.column(0)->columnMode(), AbstractColumn::ColumnMode::DateTime);
297 QCOMPARE(sheet.column(1)->columnMode(), AbstractColumn::ColumnMode::Integer);
298
299 // values
300 auto* filter = static_cast<DateTime2StringFilter*>(sheet.column(0)->outputFilter());
301 const QString& format = filter->format();
302
303 QCOMPARE(sheet.column(0)->dateTimeAt(0).toString(format), QLatin1String("2018-03-21 10:00:00"));
304 QCOMPARE(sheet.column(1)->integerAt(0), 1);
305
306 QCOMPARE(sheet.column(0)->dateTimeAt(1).toString(format), QLatin1String("2018-03-21 10:30:00"));
307 QCOMPARE(sheet.column(1)->integerAt(1), 2);
308}
309
310/*!
311 insert one column with whitespaces surrounding the actual values.

Callers

nothing calls this directly

Calls 13

setColumnCountMethod · 0.45
setRowCountMethod · 0.45
setTextMethod · 0.45
pasteIntoSelectionMethod · 0.45
columnCountMethod · 0.45
rowCountMethod · 0.45
columnModeMethod · 0.45
columnMethod · 0.45
outputFilterMethod · 0.45
formatMethod · 0.45
toStringMethod · 0.45
dateTimeAtMethod · 0.45

Tested by

no test coverage detected