! * change the statistics metrics and check the presense of the corresponding columns */
| 3182 | * change the statistics metrics and check the presense of the corresponding columns |
| 3183 | */ |
| 3184 | void SpreadsheetTest::testStatisticsSpreadsheetChangeMetrics() { |
| 3185 | Project project; |
| 3186 | auto* sheet = new Spreadsheet(QStringLiteral("test"), false); |
| 3187 | project.addChild(sheet); |
| 3188 | |
| 3189 | new SpreadsheetModel(sheet); |
| 3190 | |
| 3191 | // toggle on the statistics spreadsheet and count the available columns |
| 3192 | sheet->toggleStatisticsSpreadsheet(true); |
| 3193 | auto* statisticsSpreadsheet = sheet->children<StatisticsSpreadsheet>().constFirst(); |
| 3194 | auto metrics = statisticsSpreadsheet->metrics(); |
| 3195 | int colCount = 1; // column "Column Name" is always available |
| 3196 | for (const auto& metric : statisticsSpreadsheet->m_metricValues) { |
| 3197 | if (metrics.testFlag(metric)) |
| 3198 | ++colCount; |
| 3199 | } |
| 3200 | QCOMPARE(statisticsSpreadsheet->children<Column>().size(), colCount); |
| 3201 | |
| 3202 | // deactivate Count and check the available columns again |
| 3203 | metrics.setFlag(StatisticsSpreadsheet::Metric::Count, false); |
| 3204 | statisticsSpreadsheet->setMetrics(metrics); |
| 3205 | QCOMPARE(statisticsSpreadsheet->children<Column>().size(), colCount - 1); |
| 3206 | } |
| 3207 | |
| 3208 | /*! |
| 3209 | * check the position of the statistics spreadsheet in the list of children of the parent |
nothing calls this directly
no test coverage detected