testnotificationcache.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include <QTest>
  2. #include "tray/NotificationCache.h"
  3. class TestNotificationCache : public QObject
  4. {
  5. Q_OBJECT
  6. private slots:
  7. void testContains_doesNotContainNotification_returnsFalse()
  8. {
  9. OCC::NotificationCache notificationCache;
  10. QVERIFY(!notificationCache.contains({ "Title", { "Message" } }));
  11. }
  12. void testContains_doesContainNotification_returnTrue()
  13. {
  14. OCC::NotificationCache notificationCache;
  15. const OCC::NotificationCache::Notification notification { "Title", "message" };
  16. notificationCache.insert(notification);
  17. QVERIFY(notificationCache.contains(notification));
  18. }
  19. void testClear_doesContainNotification_clearNotifications()
  20. {
  21. OCC::NotificationCache notificationCache;
  22. const OCC::NotificationCache::Notification notification { "Title", "message" };
  23. notificationCache.insert(notification);
  24. notificationCache.clear();
  25. QVERIFY(!notificationCache.contains(notification));
  26. }
  27. };
  28. QTEST_GUILESS_MAIN(TestNotificationCache)
  29. #include "testnotificationcache.moc"