| 251 | } |
| 252 | |
| 253 | void AxisTest2::automaticTicNumberUpdateDockMinorTicks() { |
| 254 | Project project; |
| 255 | auto* ws = new Worksheet(QStringLiteral("worksheet")); |
| 256 | QVERIFY(ws != nullptr); |
| 257 | project.addChild(ws); |
| 258 | |
| 259 | auto* p = new CartesianPlot(QStringLiteral("plot")); |
| 260 | p->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axis are created |
| 261 | QVERIFY(p != nullptr); |
| 262 | ws->addChild(p); |
| 263 | |
| 264 | auto axes = p->children<Axis>(); |
| 265 | QCOMPARE(axes.count(), 2); |
| 266 | QCOMPARE(axes.at(0)->name(), QStringLiteral("x")); |
| 267 | QCOMPARE(axes.at(1)->name(), QStringLiteral("y")); |
| 268 | auto* yAxis = static_cast<Axis*>(axes.at(1)); |
| 269 | auto* xAxis = static_cast<Axis*>(axes.at(0)); |
| 270 | |
| 271 | AxisDock dock(nullptr); |
| 272 | dock.setAxes({xAxis, yAxis}); |
| 273 | dock.ui.cbMinorTicksAutoNumber->setChecked(false); |
| 274 | dock.ui.sbMinorTicksNumber->setValue(10); |
| 275 | |
| 276 | // Check minorticks numbers of the axes |
| 277 | QCOMPARE(xAxis->minorTicksNumber(), 10); |
| 278 | QCOMPARE(xAxis->minorTicksAutoNumber(), false); |
| 279 | QCOMPARE(yAxis->minorTicksNumber(), 10); |
| 280 | QCOMPARE(xAxis->minorTicksAutoNumber(), false); |
| 281 | QCOMPARE(dock.ui.cbMinorTicksAutoNumber->isChecked(), false); |
| 282 | |
| 283 | dock.setAxes({xAxis, yAxis}); // Another time |
| 284 | QCOMPARE(dock.ui.cbMinorTicksAutoNumber->isChecked(), false); |
| 285 | dock.ui.cbMinorTicksAutoNumber->setChecked(true); |
| 286 | |
| 287 | // 1 is the default value for automatic |
| 288 | QCOMPARE(xAxis->minorTicksNumber(), 1); |
| 289 | QCOMPARE(xAxis->minorTicksAutoNumber(), true); |
| 290 | QCOMPARE(yAxis->minorTicksNumber(), 1); |
| 291 | QCOMPARE(xAxis->minorTicksAutoNumber(), true); |
| 292 | QCOMPARE(dock.ui.sbMinorTicksNumber->value(), 1); |
| 293 | } |
| 294 | |
| 295 | void AxisTest2::columnLabelValues() { |
| 296 | QLocale::setDefault(QLocale::C); // . as decimal separator |