MCPcopy Create free account
hub / github.com/KDE/labplot / zValueAfterAddMoveRemove

Method zValueAfterAddMoveRemove

tests/cartesianplot/CartesianPlotTest.cpp:1668–1716  ·  view source on GitHub ↗

! * tests the handling of z-values on changes in the child hierarchy. */

Source from the content-addressed store, hash-verified

1666 * tests the handling of z-values on changes in the child hierarchy.
1667 */
1668void 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
1718QTEST_MAIN(CartesianPlotTest)

Callers

nothing calls this directly

Calls 3

moveChildMethod · 0.80
graphicsItemMethod · 0.45
removeChildMethod · 0.45

Tested by

no test coverage detected