diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_carddelegate.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_carddelegate.cpp b/tests/test_carddelegate.cpp index a14671d..6ec43b8 100644 --- a/tests/test_carddelegate.cpp +++ b/tests/test_carddelegate.cpp @@ -36,6 +36,8 @@ private slots: void aSiblingChipIsMutedButStaysLegibleAndRecognisable(); void aSiblingChipFontIsSmallerThanItsOwnTier(); void aSiblingChipsPaddingShrinksWithItsFont(); + void theFadeEndsAtSixtyPercentOfTheCard(); + void aReplyFadeStartsAtItsOwnSpine(); }; namespace { @@ -259,5 +261,28 @@ void TestCardDelegate::aSiblingChipsPaddingShrinksWithItsFont() "on the chip's rounded end"); } +void TestCardDelegate::theFadeEndsAtSixtyPercentOfTheCard() +{ + const QRect card(0, 0, 500, 60); + const QRect root = CardDelegate::fadeRectFor(card, QRect()); + QCOMPARE(root.left(), card.left()); + QCOMPARE(root.width(), 300); +} + +void TestCardDelegate::aReplyFadeStartsAtItsOwnSpine() +{ + const QRect card(0, 0, 500, 60); + // The innermost spine of a nested reply, which is its own coloured border. + const QRect spine(80, 0, 2, 60); + const QRect reply = CardDelegate::fadeRectFor(card, spine); + + // It hangs off the spine, not off the card's edge. + QCOMPARE(reply.left(), spine.left()); + // And still ends at 60% of the CARD, so a deeper reply's wash is shorter + // as well as further right. + QCOMPARE(reply.right(), CardDelegate::fadeRectFor(card, QRect()).right()); + QVERIFY(reply.width() < CardDelegate::fadeRectFor(card, QRect()).width()); +} + QTEST_MAIN(TestCardDelegate) #include "test_carddelegate.moc" |
