diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
commit | 6630937e63ae5797487b86743a7733c8ae5cc42c (patch) | |
tree | 3d53dacf6430f9099e1fb20835881205de674961 /tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp | |
parent | 37ed6dae00640f9cc980ffda05347c12a7eb5d7e (diff) | |
parent | c7af193d2e49e9f10b86262e63d8d13abf72b5cf (diff) |
Merge commit 'dev' into 'wip/cmake-merge'
Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
Diffstat (limited to 'tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp')
-rw-r--r-- | tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp index 16215714f3..69c961c1a1 100644 --- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp +++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp @@ -43,6 +43,8 @@ public slots: void cleanupTestCase(); private slots: void getSetCheck(); + void clear(); + void reserveAndCapacity(); void swap(); void contains_QPointF_data(); @@ -148,6 +150,47 @@ void tst_QPainterPath::swap() QCOMPARE(p2.boundingRect().toRect(), QRect( 0, 0,10,10)); } +void tst_QPainterPath::clear() +{ + QPainterPath p1; + QPainterPath p2; + p1.clear(); + QCOMPARE(p1, p2); + + p1.addRect(0, 0, 10, 10); + p1.clear(); + QCOMPARE(p1, p2); + + QCOMPARE(p1.fillRule(), Qt::OddEvenFill); + p1.setFillRule(Qt::WindingFill); + p1.clear(); + QCOMPARE(p1.fillRule(), Qt::WindingFill); +} + +void tst_QPainterPath::reserveAndCapacity() +{ + QPainterPath p; + QVERIFY(p.capacity() == 0); + + p.addRect(0, 0, 10, 10); + QVERIFY(p.capacity() > 0); + + p.clear(); + QVERIFY(p.capacity() > 0); + + p = QPainterPath{}; + QVERIFY(p.capacity() == 0); + + p.moveTo(100, 100); + QVERIFY(p.capacity() > 1); + + p.reserve(1000); + QVERIFY(p.capacity() >= 1000); + + p.reserve(0); + QVERIFY(p.capacity() >= 1000); +} + Q_DECLARE_METATYPE(QPainterPath) void tst_QPainterPath::currentPosition() |