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

Method testCopyPasteColumnMode03

tests/spreadsheet/SpreadsheetTest.cpp:139–198  ·  view source on GitHub ↗

! Properly handle empty values in the tab separated data. */

Source from the content-addressed store, hash-verified

137 Properly handle empty values in the tab separated data.
138*/
139void SpreadsheetTest::testCopyPasteColumnMode03() {
140 QLocale::setDefault(QLocale::C); // . as decimal separator
141 Spreadsheet sheet(QStringLiteral("test"), false);
142 sheet.setColumnCount(2);
143 sheet.setRowCount(100);
144
145 const QString str = QStringLiteral(
146 "1000 1000 1000\n"
147 "985 985 985\n"
148 "970 -7.06562 970 970\n"
149 "955 -5.93881 955 955\n"
150 "940 -4.97594 940 -4.97594 940");
151
152 QApplication::clipboard()->setText(str);
153
154 SpreadsheetView view(&sheet, false);
155 view.pasteIntoSelection();
156
157 // spreadsheet size
158 QCOMPARE(sheet.columnCount(), 5);
159 QCOMPARE(sheet.rowCount(), 100);
160
161 // column modes
162 QCOMPARE(sheet.column(0)->columnMode(), AbstractColumn::ColumnMode::Integer);
163 QCOMPARE(sheet.column(1)->columnMode(), AbstractColumn::ColumnMode::Double);
164 QCOMPARE(sheet.column(2)->columnMode(), AbstractColumn::ColumnMode::Integer);
165 QCOMPARE(sheet.column(3)->columnMode(), AbstractColumn::ColumnMode::Double);
166 QCOMPARE(sheet.column(4)->columnMode(), AbstractColumn::ColumnMode::Integer);
167
168 // values
169 QCOMPARE(sheet.column(0)->integerAt(0), 1000);
170 QCOMPARE((bool)std::isnan(sheet.column(1)->valueAt(0)), true);
171 QCOMPARE(sheet.column(2)->integerAt(0), 1000);
172 QCOMPARE((bool)std::isnan(sheet.column(3)->valueAt(0)), true);
173 QCOMPARE(sheet.column(4)->integerAt(0), 1000);
174
175 QCOMPARE(sheet.column(0)->integerAt(1), 985);
176 QCOMPARE((bool)std::isnan(sheet.column(1)->valueAt(1)), true);
177 QCOMPARE(sheet.column(2)->integerAt(1), 985);
178 QCOMPARE((bool)std::isnan(sheet.column(3)->valueAt(1)), true);
179 QCOMPARE(sheet.column(4)->integerAt(1), 985);
180
181 QCOMPARE(sheet.column(0)->integerAt(2), 970);
182 QCOMPARE(sheet.column(1)->valueAt(2), -7.06562);
183 QCOMPARE(sheet.column(2)->integerAt(2), 970);
184 QCOMPARE((bool)std::isnan(sheet.column(3)->valueAt(2)), true);
185 QCOMPARE(sheet.column(4)->integerAt(2), 970);
186
187 QCOMPARE(sheet.column(0)->integerAt(3), 955);
188 QCOMPARE(sheet.column(1)->valueAt(3), -5.93881);
189 QCOMPARE(sheet.column(2)->integerAt(3), 955);
190 QCOMPARE((bool)std::isnan(sheet.column(3)->valueAt(3)), true);
191 QCOMPARE(sheet.column(4)->integerAt(3), 955);
192
193 QCOMPARE(sheet.column(0)->integerAt(4), 940);
194 QCOMPARE(sheet.column(1)->valueAt(4), -4.97594);
195 QCOMPARE(sheet.column(2)->integerAt(4), 940);
196 QCOMPARE(sheet.column(1)->valueAt(4), -4.97594);

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