From ef4d48c56c39f19efc751488cc2df6ee5af24a7f Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 26 Aug 2026 15:58:40 +0200 Subject: feat: fade the account colour across a card --- tests/test_carddelegate.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'tests') 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" -- cgit v1.2.3