File indexing completed on 2024-12-01 04:35:25

0001 /*
0002    SPDX-FileCopyrightText: 2018-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "notificationtest.h"
0008 #include "notifications/notification.h"
0009 #include <QTest>
0010 QTEST_MAIN(NotificationTest)
0011 
0012 NotificationTest::NotificationTest(QObject *parent)
0013     : QObject(parent)
0014 {
0015 }
0016 
0017 void NotificationTest::shouldHaveDefaultValue()
0018 {
0019     Notification w;
0020     QCOMPARE(w.status(), KStatusNotifierItem::Passive);
0021 }
0022 
0023 void NotificationTest::shouldChangeStatus()
0024 {
0025     Notification w;
0026     // Notification
0027     w.updateNotification(true, 3, QStringLiteral("foo"));
0028     QCOMPARE(w.status(), KStatusNotifierItem::Active);
0029     // Clear it.
0030     w.updateNotification(false, 0, QStringLiteral("foo"));
0031     QCOMPARE(w.status(), KStatusNotifierItem::Passive);
0032 
0033     w.updateNotification(false, 0, QStringLiteral("Bla"));
0034     QCOMPARE(w.status(), KStatusNotifierItem::Passive);
0035     w.updateNotification(true, 0, QStringLiteral("Bla"));
0036     QCOMPARE(w.status(), KStatusNotifierItem::Active);
0037     w.updateNotification(true, 3, QStringLiteral("Bla"));
0038     QCOMPARE(w.status(), KStatusNotifierItem::Active);
0039     w.updateNotification(false, 3, QStringLiteral("Bla"));
0040     QCOMPARE(w.status(), KStatusNotifierItem::Active);
0041     w.updateNotification(false, 0, QStringLiteral("Bla"));
0042     QCOMPARE(w.status(), KStatusNotifierItem::Passive);
0043 }
0044 
0045 #include "moc_notificationtest.cpp"