Debian Codegraph @

tests/ut_dlicenseinfo.cpp

raw
1 // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2 //
3 // SPDX-License-Identifier: LGPL-3.0-or-later
4 #include <gtest/gtest.h>
5 #include <QString>
6 #include "dlicenseinfo.h"
7
8 DCORE_USE_NAMESPACE
9
10 TEST(ut_DLicenseInfo, testLicense)
11 {
12 DLicenseInfo licenseInfo;
13 QString jsonContent = u8R"([
14 {
15 "name": "dtk",
16 "version": "5.6.8",
17 "copyright": "Copyright 2023 THe Uniontech Company Ltd. All rights reserved.",
18 "license": "LGPLv3"
19 }
20 ]
21 )";
22 licenseInfo.setLicenseSearchPath(":/data/");
23
24 ASSERT_TRUE(licenseInfo.loadContent(jsonContent.toLatin1()));
25
26 EXPECT_EQ(licenseInfo.componentInfos().count(), 1);
27 ASSERT_TRUE(licenseInfo.loadFile(":/data/example-license.json"));
28 EXPECT_EQ(licenseInfo.componentInfos().count(), 1);
29 ASSERT_FALSE(licenseInfo.licenseContent("LGPLv3").isEmpty());
30 }