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

Method testCopyPasteSizeChange01

tests/spreadsheet/SpreadsheetTest.cpp:460–496  ·  view source on GitHub ↗

! insert the data at the edge of the spreadsheet and paste the data. the spreadsheet has to be extended accordingly */

Source from the content-addressed store, hash-verified

458 the spreadsheet has to be extended accordingly
459*/
460void SpreadsheetTest::testCopyPasteSizeChange01() {
461 QLocale::setDefault(QLocale::C); // . as decimal separator
462 Spreadsheet sheet(QStringLiteral("test"), false);
463 sheet.setColumnCount(2);
464 sheet.setRowCount(100);
465
466 const QString str = QStringLiteral(
467 "1.1 2.2\n"
468 "3.3 4.4");
469 QApplication::clipboard()->setText(str);
470
471 SpreadsheetView view(&sheet, false);
472 view.goToCell(1, 1); // navigate to the edge of the spreadsheet
473 view.pasteIntoSelection();
474
475 // spreadsheet size
476 QCOMPARE(sheet.columnCount(), 3);
477 QCOMPARE(sheet.rowCount(), 100);
478
479 // column modes
480 QCOMPARE(sheet.column(0)->columnMode(), AbstractColumn::ColumnMode::Double);
481 QCOMPARE(sheet.column(1)->columnMode(), AbstractColumn::ColumnMode::Double);
482 QCOMPARE(sheet.column(2)->columnMode(), AbstractColumn::ColumnMode::Double);
483
484 // values
485 QCOMPARE((bool)std::isnan(sheet.column(0)->valueAt(0)), true);
486 QCOMPARE((bool)std::isnan(sheet.column(1)->valueAt(0)), true);
487 QCOMPARE((bool)std::isnan(sheet.column(2)->valueAt(0)), true);
488
489 QCOMPARE((bool)std::isnan(sheet.column(0)->valueAt(1)), true);
490 QCOMPARE(sheet.column(1)->valueAt(1), 1.1);
491 QCOMPARE(sheet.column(2)->valueAt(1), 2.2);
492
493 QCOMPARE((bool)std::isnan(sheet.column(0)->valueAt(2)), true);
494 QCOMPARE(sheet.column(1)->valueAt(2), 3.3);
495 QCOMPARE(sheet.column(2)->valueAt(2), 4.4);
496}
497
498// **********************************************************
499// *********************** sorting *************************

Callers

nothing calls this directly

Calls 10

setColumnCountMethod · 0.45
setRowCountMethod · 0.45
setTextMethod · 0.45
goToCellMethod · 0.45
pasteIntoSelectionMethod · 0.45
columnCountMethod · 0.45
rowCountMethod · 0.45
columnModeMethod · 0.45
columnMethod · 0.45
valueAtMethod · 0.45

Tested by

no test coverage detected