| 210 | } |
| 211 | |
| 212 | void AxisTest2::automaticTicNumberUpdateDockMajorTicks() { |
| 213 | Project project; |
| 214 | auto* ws = new Worksheet(QStringLiteral("worksheet")); |
| 215 | QVERIFY(ws != nullptr); |
| 216 | project.addChild(ws); |
| 217 | |
| 218 | auto* p = new CartesianPlot(QStringLiteral("plot")); |
| 219 | p->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axis are created |
| 220 | QVERIFY(p != nullptr); |
| 221 | ws->addChild(p); |
| 222 | |
| 223 | auto axes = p->children<Axis>(); |
| 224 | QCOMPARE(axes.count(), 2); |
| 225 | QCOMPARE(axes.at(0)->name(), QStringLiteral("x")); |
| 226 | QCOMPARE(axes.at(1)->name(), QStringLiteral("y")); |
| 227 | auto* yAxis = static_cast<Axis*>(axes.at(1)); |
| 228 | auto* xAxis = static_cast<Axis*>(axes.at(0)); |
| 229 | |
| 230 | AxisDock dock(nullptr); |
| 231 | |
| 232 | dock.setAxes({xAxis, yAxis}); |
| 233 | dock.ui.cbMajorTicksAutoNumber->setChecked(false); |
| 234 | dock.ui.sbMajorTicksNumber->setValue(10); |
| 235 | |
| 236 | // Check majorticks numbers of the axes |
| 237 | QCOMPARE(xAxis->majorTicksNumber(), 10); |
| 238 | QCOMPARE(xAxis->majorTicksAutoNumber(), false); |
| 239 | QCOMPARE(yAxis->majorTicksNumber(), 10); |
| 240 | QCOMPARE(xAxis->majorTicksAutoNumber(), false); |
| 241 | QCOMPARE(dock.ui.cbMajorTicksAutoNumber->isChecked(), false); |
| 242 | |
| 243 | dock.setAxes({xAxis, yAxis}); // Another time |
| 244 | dock.ui.cbMajorTicksAutoNumber->setChecked(true); |
| 245 | |
| 246 | QCOMPARE(xAxis->majorTicksNumber(), 6); |
| 247 | QCOMPARE(xAxis->majorTicksAutoNumber(), true); |
| 248 | QCOMPARE(yAxis->majorTicksNumber(), 6); |
| 249 | QCOMPARE(xAxis->majorTicksAutoNumber(), true); |
| 250 | QCOMPARE(dock.ui.sbMajorTicksNumber->value(), 6); |
| 251 | } |
| 252 | |
| 253 | void AxisTest2::automaticTicNumberUpdateDockMinorTicks() { |
| 254 | Project project; |