| 369 | } |
| 370 | |
| 371 | void AxisTest::TestSetCoordinateSystem() { |
| 372 | // Test if the range stored in the Axis gets updated when a new coordinatesystemindex is set |
| 373 | Project project; |
| 374 | auto* ws = new Worksheet(QStringLiteral("worksheet")); |
| 375 | QVERIFY(ws != nullptr); |
| 376 | project.addChild(ws); |
| 377 | |
| 378 | auto* p = new CartesianPlot(QStringLiteral("plot")); |
| 379 | QVERIFY(p != nullptr); |
| 380 | p->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axes are created |
| 381 | ws->addChild(p); |
| 382 | |
| 383 | auto axes = p->children<Axis>(); |
| 384 | QCOMPARE(axes.count(), 2); |
| 385 | auto yAxis = axes.at(1); |
| 386 | QCOMPARE(yAxis->name(), QStringLiteral("y")); |
| 387 | { |
| 388 | auto range = yAxis->range(); |
| 389 | QCOMPARE(range.start(), 0); |
| 390 | QCOMPARE(range.end(), 1); |
| 391 | } |
| 392 | |
| 393 | // Add new coordinatesystem to the plot |
| 394 | p->addYRange(Range<double>(5, 100)); |
| 395 | QCOMPARE(p->rangeCount(Dimension::X), 1); |
| 396 | QCOMPARE(p->rangeCount(Dimension::Y), 2); |
| 397 | p->addCoordinateSystem(); |
| 398 | QCOMPARE(p->coordinateSystemCount(), 2); |
| 399 | auto cSystem = p->coordinateSystem(1); |
| 400 | cSystem->setIndex(Dimension::X, 0); |
| 401 | cSystem->setIndex(Dimension::Y, 1); |
| 402 | |
| 403 | // Change CoordinatesystemIndex of the axis |
| 404 | yAxis->setCoordinateSystemIndex(1); |
| 405 | |
| 406 | { |
| 407 | auto range = yAxis->range(); |
| 408 | QCOMPARE(range.start(), 5); |
| 409 | QCOMPARE(range.end(), 100); |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | void AxisTest::TestSetRange() { |
| 414 | Project project; |
nothing calls this directly
no test coverage detected