mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 17:37:36 +03:00
b736355985
The notification cache helps to not display duplicate desktop notifications to the user. Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
40 lines
1.1 KiB
C++
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"
|