! insert the data at the edge of the spreadsheet and paste the data. the spreadsheet has to be extended accordingly */
| 458 | the spreadsheet has to be extended accordingly |
| 459 | */ |
| 460 | void 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 ************************* |
nothing calls this directly
no test coverage detected