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

Method testCopyPasteColumnMode02

tests/spreadsheet/SpreadsheetTest.cpp:109–134  ·  view source on GitHub ↗

! insert one column with integer values and one column with float numbers into an empty spreadsheet. the first column has to be converted to integer column, the second to float. */

Source from the content-addressed store, hash-verified

107 the first column has to be converted to integer column, the second to float.
108*/
109void SpreadsheetTest::testCopyPasteColumnMode02() {
110 QLocale::setDefault(QLocale::C); // . as decimal separator
111 Spreadsheet sheet(QStringLiteral("test"), false);
112 sheet.setColumnCount(2);
113 sheet.setRowCount(100);
114
115 const QString str = QStringLiteral("10 100.0\n20 200.0");
116 QApplication::clipboard()->setText(str);
117
118 SpreadsheetView view(&sheet, false);
119 view.pasteIntoSelection();
120
121 // spreadsheet size
122 QCOMPARE(sheet.columnCount(), 2);
123 QCOMPARE(sheet.rowCount(), 100);
124
125 // column modes
126 QCOMPARE(sheet.column(0)->columnMode(), AbstractColumn::ColumnMode::Integer);
127 QCOMPARE(sheet.column(1)->columnMode(), AbstractColumn::ColumnMode::Double);
128
129 // values
130 QCOMPARE(sheet.column(0)->integerAt(0), 10);
131 QCOMPARE(sheet.column(1)->valueAt(0), 100.0);
132 QCOMPARE(sheet.column(0)->integerAt(1), 20);
133 QCOMPARE(sheet.column(1)->valueAt(1), 200.0);
134}
135
136/*!
137 Properly handle empty values in the tab separated data.

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected