nextcloud-desktop/test/testnotificationcache.cpp
Matthieu Gallien 69d6f4acec our source code files have lower case names
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-10-25 15:38:21 +02:00

40 lines
1.1 KiB
C++

#include <QTest>
#include "tray/notificationcache.h"
class TestNotificationCache : public QObject
{
Q_OBJECT
private slots:
void testContains_doesNotContainNotification_returnsFalse()
{
OCC::NotificationCache notificationCache;
QVERIFY(!notificationCache.contains({ "Title", { "Message" } }));
}
void testContains_doesContainNotification_returnTrue()
{
OCC::NotificationCache notificationCache;
const OCC::NotificationCache::Notification notification { "Title", "message" };
notificationCache.insert(notification);
QVERIFY(notificationCache.contains(notification));
}
void testClear_doesContainNotification_clearNotifications()
{
OCC::NotificationCache notificationCache;
const OCC::NotificationCache::Notification notification { "Title", "message" };
notificationCache.insert(notification);
notificationCache.clear();
QVERIFY(!notificationCache.contains(notification));
}
};
QTEST_GUILESS_MAIN(TestNotificationCache)
#include "testnotificationcache.moc"