File: ut_dnotifysender.cpp

package info (click to toggle)
dtkcore 5.7.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,728 kB
  • sloc: cpp: 22,021; ansic: 183; python: 68; xml: 58; makefile: 27; sh: 15
file content (40 lines) | stat: -rw-r--r-- 1,185 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later

#include <gtest/gtest.h>
#define private public
#include "dnotifysender.h"
#undef private

DCORE_USE_NAMESPACE

struct DUtil::DNotifyData {
    uint        m_replaceId;
    int         m_timeOut;
    QString     m_body;
    QString     m_summary;
    QString     m_appIcon;
    QString     m_appName;
    QStringList m_actions;
    QVariantMap m_hints;
};

TEST(ut_DNotifySender, notify)
{
    DUtil::DNotifySender notifySender("summary");
    notifySender.appName("appName")
            .replaceId(123456)
            .appIcon("iconName")
            .appBody("msg body")
            .actions({"1", "2"})
            .timeOut(5000);
            //.call();

    EXPECT_TRUE(notifySender.m_dbusData->m_summary == "summary");
    EXPECT_TRUE(notifySender.m_dbusData->m_body == "msg body");
    EXPECT_TRUE(notifySender.m_dbusData->m_replaceId == 123456);
    EXPECT_TRUE(notifySender.m_dbusData->m_appIcon == "iconName");
    EXPECT_TRUE(notifySender.m_dbusData->m_actions == QStringList({"1", "2"}));
    EXPECT_TRUE(notifySender.m_dbusData->m_timeOut == 5000);
}