File: ut_daboutdialog.cpp

package info (click to toggle)
dtkwidget 5.7.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 36,540 kB
  • sloc: cpp: 63,257; ansic: 132; python: 88; sh: 42; makefile: 13
file content (93 lines) | stat: -rw-r--r-- 2,194 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// SPDX-FileCopyrightText: 2021 - 2022 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later

#include <gtest/gtest.h>

#include "daboutdialog.h"
DWIDGET_USE_NAMESPACE
class ut_DAboutDialog : public testing::Test
{
protected:
    void SetUp() override
    {
        widget = new DAboutDialog();
    }
    void TearDown() override
    {
        if (widget) {
            delete widget;
            widget = nullptr;
        }
    }
    DAboutDialog *widget = nullptr;
};

#if DTK_VERSION < DTK_VERSION_CHECK(6, 0, 0, 0) // dtk 6.0 no longer support
TEST_F(ut_DAboutDialog, setAcknowledgementLink)
{
    widget->setAcknowledgementLink(QString{"setAcknowledgementLink"});
};
#endif

TEST_F(ut_DAboutDialog, setAcknowledgementVisible)
{
    widget->setAcknowledgementVisible(true);
};

TEST_F(ut_DAboutDialog, setCompanyLogo)
{
    widget->setCompanyLogo(QPixmap(50, 50));
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
    ASSERT_EQ(widget->companyLogo()->size(), QSize(50, 50));
#else
    ASSERT_EQ(widget->companyLogo().size(), QSize(50, 50));
#endif
};

TEST_F(ut_DAboutDialog, setDescription)
{
    widget->setDescription("setDescription");
    ASSERT_EQ(widget->description(), "setDescription");
};

TEST_F(ut_DAboutDialog, setLicense)
{
    widget->setLicense("setLicense");
    ASSERT_EQ(widget->license(), "setLicense");
};

TEST_F(ut_DAboutDialog, setProductIcon)
{
    widget->setProductIcon(QIcon::fromTheme("preferences-system"));
};

TEST_F(ut_DAboutDialog, setProductName)
{
    widget->setProductName("setProductName");
    ASSERT_EQ(widget->productName(), "setProductName");
};

TEST_F(ut_DAboutDialog, setVersion)
{
    widget->setVersion("setVersion");
    ASSERT_EQ(widget->version(), "setVersion");
};

TEST_F(ut_DAboutDialog, setWebsiteLink)
{
    widget->setWebsiteLink("setWebsiteLink");
    ASSERT_EQ(widget->websiteLink(), "setWebsiteLink");
};

TEST_F(ut_DAboutDialog, setWebsiteName)
{
    widget->setWebsiteName("setWebsiteName");
    ASSERT_EQ(widget->websiteName(), "setWebsiteName");
};

TEST_F(ut_DAboutDialog, setWindowTitle)
{
    widget->setWindowTitle("setWindowTitle");
    ASSERT_EQ(widget->windowTitle(), "setWindowTitle");
};