diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 39a2b112..92b47ff9 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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 ) diff --git a/tests/data.qrc b/tests/data.qrc index 4aaf3c62..7b69beeb 100644 --- a/tests/data.qrc +++ b/tests/data.qrc @@ -13,5 +13,6 @@ qml/SettingsContainer_View.qml qml/ObjectModelProxy.qml qml/MessageManager.qml + qml/ButtonBox.qml diff --git a/tests/qml/ButtonBox.qml b/tests/qml/ButtonBox.qml new file mode 100644 index 00000000..371a5c9e --- /dev/null +++ b/tests/qml/ButtonBox.qml @@ -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" + } +} diff --git a/tests/ut_buttonbox.cpp b/tests/ut_buttonbox.cpp new file mode 100644 index 00000000..81594c39 --- /dev/null +++ b/tests/ut_buttonbox.cpp @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include +#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); +}