forked from linuxdeepin/dtkwidget
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Log:
- Loading branch information
Showing
5 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<RCC> | ||
<qresource prefix="/"> | ||
<file>data/titlebar-settings.json</file> | ||
<file>data/example-license.json</file> | ||
</qresource> | ||
</RCC> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[ | ||
{ | ||
"name": "pkg-config", | ||
"version": "", | ||
"copyright": "NOASSERTION", | ||
"license": "MIT" | ||
}, | ||
{ | ||
"name": "lshw", | ||
"version": "", | ||
"copyright": "NOASSERTION", | ||
"license": "GPL-2" | ||
}, | ||
{ | ||
"name": "debhelper", | ||
"version": "", | ||
"copyright": "NOASSERTION", | ||
"license": "GPL-2" | ||
}, | ||
{ | ||
"name": "pkg-config", | ||
"version": "", | ||
"copyright": "NOASSERTION", | ||
"license": "MIT" | ||
}, | ||
{ | ||
"name": "debhelper", | ||
"version": "", | ||
"copyright": "NOASSERTION", | ||
"license": "GPL-2" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
||
#include <gtest/gtest.h> | ||
#include "dlicensedialog.h" | ||
DWIDGET_USE_NAMESPACE | ||
class ut_DLicenseDialog : public testing::Test | ||
{ | ||
protected: | ||
void SetUp() override | ||
{ | ||
target = new DLicenseDialog(); | ||
} | ||
void TearDown() override | ||
{ | ||
if (target) { | ||
delete target; | ||
target = nullptr; | ||
} | ||
} | ||
DLicenseDialog *target = nullptr; | ||
|
||
}; | ||
|
||
TEST_F(ut_DLicenseDialog, setFile) | ||
{ | ||
target->setFile(":/data/example-license.json"); | ||
target->load(); | ||
ASSERT_TRUE(target->isValid()); | ||
}; | ||
|
||
|
||
|
||
TEST_F(ut_DLicenseDialog, isValid) | ||
{ | ||
target->setFile("XXXXXXX"); | ||
target->load(); | ||
ASSERT_FALSE(target->isValid()); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
||
#include <gtest/gtest.h> | ||
#include <QTest> | ||
|
||
#include "dswitchlineexpand.h" | ||
|
||
DWIDGET_USE_NAMESPACE | ||
|
||
class ut_DSwitchLineExpand : public testing::Test | ||
{ | ||
protected: | ||
void SetUp() override; | ||
void TearDown() override; | ||
DSwitchLineExpand *target = nullptr; | ||
QWidget *widget = nullptr; | ||
}; | ||
|
||
void ut_DSwitchLineExpand::SetUp() | ||
{ | ||
widget = new QWidget; | ||
target = new DSwitchLineExpand(widget); | ||
widget->resize(300, 200); | ||
} | ||
|
||
void ut_DSwitchLineExpand::TearDown() | ||
{ | ||
widget->deleteLater(); | ||
} | ||
|
||
TEST_F(ut_DSwitchLineExpand, testSetTitle) | ||
{ | ||
// 测试设置标题 | ||
target->setTitle("test"); | ||
ASSERT_EQ(target->m_headerLine->title(), "test"); | ||
} | ||
|
||
TEST_F(ut_DSwitchLineExpand, testSetExpand) | ||
{ | ||
// 测试设置展开 | ||
target->setExpand(true); | ||
ASSERT_TRUE(target->m_headerLine->m_switchButton->isChecked()); | ||
target->setExpand(false); | ||
ASSERT_FALSE(target->m_headerLine->m_switchButton->isChecked()); | ||
} | ||
|
||
TEST_F(ut_DSwitchLineExpand, testHeader) | ||
{ | ||
// 测试获取头部 | ||
ASSERT_EQ(target->header() , target->m_headerLine); | ||
} | ||
|
||
TEST_F(ut_DSwitchLineExpand, testResizeEvent) | ||
{ | ||
// 测试重置大小 | ||
target->resize(QSize(100, 100)); | ||
ASSERT_EQ(target->size(), QSize(100, 100)); | ||
} |