| 406 | } |
| 407 | |
| 408 | void PathObjectTest::changePathBoundsBasicTest() |
| 409 | { |
| 410 | PathObject proto{Map::getCoveringRedLine()}; |
| 411 | proto.addCoordinate({0.0, 2.0}); |
| 412 | proto.addCoordinate({2.0, 0.0}); |
| 413 | proto.addCoordinate({4.0, -2.0, MapCoord::HolePoint}); |
| 414 | |
| 415 | QFETCH(int, dash_point_index); |
| 416 | for (std::size_t i = 0; i < proto.getCoordinateCount(); ++i) |
| 417 | proto.getCoordinateRef(i).setDashPoint(int(i) == dash_point_index); |
| 418 | |
| 419 | proto.updatePathCoords(); |
| 420 | |
| 421 | { |
| 422 | // full path |
| 423 | PathObject path{Map::getCoveringRedLine()}; |
| 424 | path.copyFrom(proto); |
| 425 | path.changePathBounds(0, 0.0, path.parts().front().length()); |
| 426 | QCOMPARE(path.getCoordinate(0), proto.getCoordinate(0)); |
| 427 | QCOMPARE(path.getCoordinate(1), proto.getCoordinate(1)); |
| 428 | QCOMPARE(path.getCoordinate(2), proto.getCoordinate(2)); |
| 429 | } |
| 430 | |
| 431 | { |
| 432 | // sub-path starting at begin |
| 433 | PathObject path{Map::getCoveringRedLine()}; |
| 434 | path.copyFrom(proto); |
| 435 | path.changePathBounds(0, 0.0, 4.0); |
| 436 | QCOMPARE(path.getCoordinate(0), proto.getCoordinate(0)); |
| 437 | QCOMPARE(path.getCoordinate(1), proto.getCoordinate(1)); |
| 438 | } |
| 439 | |
| 440 | { |
| 441 | // sub-path ending at original end |
| 442 | PathObject path{Map::getCoveringRedLine()}; |
| 443 | path.copyFrom(proto); |
| 444 | path.changePathBounds(0, 2.0, path.parts().front().length()); |
| 445 | QCOMPARE(path.getCoordinate(1), proto.getCoordinate(1)); |
| 446 | QCOMPARE(path.getCoordinate(2), proto.getCoordinate(2)); |
| 447 | } |
| 448 | |
| 449 | { |
| 450 | // inner sub-path |
| 451 | PathObject path{Map::getCoveringRedLine()}; |
| 452 | path.copyFrom(proto); |
| 453 | path.changePathBounds(0, 2.0, 4.0); |
| 454 | QCOMPARE(path.getCoordinate(1), proto.getCoordinate(1)); |
| 455 | } |
| 456 | } |
| 457 | |
| 458 | |
| 459 |
nothing calls this directly
no test coverage detected