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

Method testLinkSpreadsheetAddRow

tests/spreadsheet/SpreadsheetTest.cpp:2833–2872  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2831}
2832
2833void SpreadsheetTest::testLinkSpreadsheetAddRow() {
2834#ifdef __FreeBSD__
2835 return;
2836#endif
2837 Project project;
2838 auto* sheetData = new Spreadsheet(QStringLiteral("data"), false);
2839 project.addChild(sheetData);
2840 sheetData->setColumnCount(3);
2841 sheetData->setRowCount(10);
2842
2843 auto* sheetCalculations = new Spreadsheet(QStringLiteral("calculations"), false);
2844 project.addChild(sheetCalculations);
2845 sheetCalculations->setColumnCount(3);
2846 sheetCalculations->setRowCount(2);
2847
2848 SpreadsheetDock dock(nullptr);
2849 dock.setSpreadsheets({sheetCalculations});
2850
2851 QCOMPARE(dock.ui.cbLinkingEnabled->isChecked(), false);
2852 QCOMPARE(dock.ui.cbLinkedSpreadsheet->isVisible(), false);
2853 QCOMPARE(dock.ui.sbRowCount->isEnabled(), true);
2854 QCOMPARE(sheetCalculations->linking(), false);
2855
2856 Q_EMIT dock.ui.cbLinkingEnabled->toggled(true);
2857
2858 sheetCalculations->setLinkedSpreadsheet(sheetData);
2859
2860 QCOMPARE(sheetCalculations->linking(), true);
2861 QCOMPARE(sheetCalculations->linkedSpreadsheet(), sheetData);
2862 QCOMPARE(sheetCalculations->linkedSpreadsheetPath(), sheetData->path());
2863 QCOMPARE(sheetCalculations->rowCount(), 10);
2864
2865 new SpreadsheetModel(sheetData); // otherwise emitRowCountChanged will not be called
2866 sheetData->setRowCount(13);
2867
2868 QCOMPARE(sheetCalculations->linking(), true);
2869 QCOMPARE(sheetCalculations->linkedSpreadsheet(), sheetData);
2870 QCOMPARE(sheetCalculations->linkedSpreadsheetPath(), sheetData->path());
2871 QCOMPARE(sheetCalculations->rowCount(), 13);
2872}
2873
2874void SpreadsheetTest::testLinkSpreadsheetRemoveRow() {
2875#ifdef __FreeBSD__

Callers

nothing calls this directly

Calls 9

setLinkedSpreadsheetMethod · 0.80
linkedSpreadsheetPathMethod · 0.80
addChildMethod · 0.45
setColumnCountMethod · 0.45
setRowCountMethod · 0.45
setSpreadsheetsMethod · 0.45
isVisibleMethod · 0.45
pathMethod · 0.45
rowCountMethod · 0.45

Tested by

no test coverage detected