! * tests the handling of z-values on changes in the child hierarchy. */
| 1666 | * tests the handling of z-values on changes in the child hierarchy. |
| 1667 | */ |
| 1668 | void CartesianPlotTest::zValueAfterAddMoveRemove() { |
| 1669 | LOAD_PROJECT_HISTOGRAM_FIT_CURVE |
| 1670 | |
| 1671 | // after the objects were added, the order of children is |
| 1672 | // * histogram |
| 1673 | // * curve1 |
| 1674 | // * curve2 |
| 1675 | int zValueHistogram = h->graphicsItem()->zValue(); |
| 1676 | int zValueCurve1 = curve1->graphicsItem()->zValue(); |
| 1677 | int zValueCurve2 = curve2->graphicsItem()->zValue(); |
| 1678 | QVERIFY(zValueHistogram < zValueCurve1); |
| 1679 | QVERIFY(zValueCurve1 < zValueCurve2); |
| 1680 | |
| 1681 | // move curve1 up |
| 1682 | plot->moveChild(curve1, -1); |
| 1683 | |
| 1684 | // after the move, the order of children is |
| 1685 | // * curve1 |
| 1686 | // * histogram |
| 1687 | // * curve2 |
| 1688 | zValueHistogram = h->graphicsItem()->zValue(); |
| 1689 | zValueCurve1 = curve1->graphicsItem()->zValue(); |
| 1690 | zValueCurve2 = curve2->graphicsItem()->zValue(); |
| 1691 | QVERIFY(zValueCurve1 < zValueHistogram); |
| 1692 | QVERIFY(zValueHistogram < zValueCurve2); |
| 1693 | |
| 1694 | // move histogram down |
| 1695 | plot->moveChild(h, 1); |
| 1696 | |
| 1697 | // after the move, the order of children is |
| 1698 | // * curve1 |
| 1699 | // * curve2 |
| 1700 | // * histogram |
| 1701 | zValueHistogram = h->graphicsItem()->zValue(); |
| 1702 | zValueCurve1 = curve1->graphicsItem()->zValue(); |
| 1703 | zValueCurve2 = curve2->graphicsItem()->zValue(); |
| 1704 | QVERIFY(zValueCurve1 < zValueCurve2); |
| 1705 | QVERIFY(zValueCurve2 < zValueHistogram); |
| 1706 | |
| 1707 | // remove curve2 |
| 1708 | plot->removeChild(curve2); |
| 1709 | |
| 1710 | // after the remove, the order of children is |
| 1711 | // * curve1 |
| 1712 | // * histogram |
| 1713 | zValueHistogram = h->graphicsItem()->zValue(); |
| 1714 | zValueCurve1 = curve1->graphicsItem()->zValue(); |
| 1715 | QVERIFY(zValueCurve1 < zValueHistogram); |
| 1716 | } |
| 1717 | |
| 1718 | QTEST_MAIN(CartesianPlotTest) |
nothing calls this directly
no test coverage detected