Skip to content

Commit

Permalink
feat: add UT for ButtonBox
Browse files Browse the repository at this point in the history
Log:
  • Loading branch information
xzl01 committed Jul 27, 2023
1 parent f6d1624 commit 819ae39
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ file(GLOB TEST_SOURCES
ut_waterprogressbar.cpp
ut_keysequencelistener.cpp
ut_dsettingscontainer.cpp
ut_buttonbox.cpp
ut_dobjectmodelproxy.cpp
ut_dmessagemanager.cpp
)
Expand Down
1 change: 1 addition & 0 deletions tests/data.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
<file>qml/SettingsContainer_View.qml</file>
<file>qml/ObjectModelProxy.qml</file>
<file>qml/MessageManager.qml</file>
<file>qml/ButtonBox.qml</file>
</qresource>
</RCC>
17 changes: 17 additions & 0 deletions tests/qml/ButtonBox.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later

import QtQuick 2.11
import QtQuick.Controls 2.11
import org.deepin.dtk 1.0 as D

D.ButtonBox {
ToolButton {
text: "Button1"
checked: true
}
ToolButton {
text: "Button2"
}
}
19 changes: 19 additions & 0 deletions tests/ut_buttonbox.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later

#include <gtest/gtest.h>
#include "test_helper.hpp"

class ut_ButtonBox : public ::testing::Test
{
public:
};

TEST_F(ut_ButtonBox, properties)
{
ControlHelper<> helper("qrc:/qml/ButtonBox.qml");
ASSERT_TRUE(helper.object);
QQmlListReference buttons(helper.object, "buttons");
ASSERT_EQ(buttons.count(), 2);
}

0 comments on commit 819ae39

Please sign in to comment.