| 2872 | } |
| 2873 | |
| 2874 | void SpreadsheetTest::testLinkSpreadsheetRemoveRow() { |
| 2875 | #ifdef __FreeBSD__ |
| 2876 | return; |
| 2877 | #endif |
| 2878 | Project project; |
| 2879 | auto* sheetData = new Spreadsheet(QStringLiteral("data"), false); |
| 2880 | project.addChild(sheetData); |
| 2881 | sheetData->setColumnCount(3); |
| 2882 | sheetData->setRowCount(10); |
| 2883 | |
| 2884 | auto* sheetCalculations = new Spreadsheet(QStringLiteral("calculations"), false); |
| 2885 | project.addChild(sheetCalculations); |
| 2886 | sheetCalculations->setColumnCount(3); |
| 2887 | sheetCalculations->setRowCount(2); |
| 2888 | |
| 2889 | SpreadsheetDock dock(nullptr); |
| 2890 | dock.setSpreadsheets({sheetCalculations}); |
| 2891 | |
| 2892 | QCOMPARE(dock.ui.cbLinkingEnabled->isChecked(), false); |
| 2893 | QCOMPARE(dock.ui.cbLinkedSpreadsheet->isVisible(), false); |
| 2894 | QCOMPARE(dock.ui.sbRowCount->isEnabled(), true); |
| 2895 | QCOMPARE(sheetCalculations->linking(), false); |
| 2896 | |
| 2897 | dock.ui.cbLinkingEnabled->toggled(true); |
| 2898 | |
| 2899 | sheetCalculations->setLinkedSpreadsheet(sheetData); |
| 2900 | |
| 2901 | QCOMPARE(sheetCalculations->linking(), true); |
| 2902 | QCOMPARE(sheetCalculations->linkedSpreadsheet(), sheetData); |
| 2903 | QCOMPARE(sheetCalculations->linkedSpreadsheetPath(), sheetData->path()); |
| 2904 | QCOMPARE(sheetCalculations->rowCount(), 10); |
| 2905 | |
| 2906 | new SpreadsheetModel(sheetData); // otherwise emitRowCountChanged will not be called |
| 2907 | sheetData->setRowCount(7); |
| 2908 | |
| 2909 | QCOMPARE(sheetCalculations->linking(), true); |
| 2910 | QCOMPARE(sheetCalculations->linkedSpreadsheet(), sheetData); |
| 2911 | QCOMPARE(sheetCalculations->linkedSpreadsheetPath(), sheetData->path()); |
| 2912 | QCOMPARE(sheetCalculations->rowCount(), 7); |
| 2913 | } |
| 2914 | |
| 2915 | void SpreadsheetTest::testLinkSpreadsheetRecalculate() { |
| 2916 | #ifdef __FreeBSD__ |
nothing calls this directly
no test coverage detected