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
|
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#include <gtest/gtest.h>
#include "test_helper.hpp"
#include <QQuickItem>
#include <DGuiApplicationHelper>
DGUI_USE_NAMESPACE
class ut_ThemeMenu : public ::testing::Test
{
public:
};
TEST_F(ut_ThemeMenu, checkedWithThemeType)
{
ControlHelper<> root("qrc:/qml/CustomThemeMenu.qml");
ASSERT_TRUE(root.object);
QQuickItem *action = nullptr;
{
ThemeTypeGuard themeGurad(DGuiApplicationHelper::LightType);
Q_UNUSED(themeGurad);
QMetaObject::invokeMethod(root.object, "itemAt", Q_RETURN_ARG(QQuickItem*, action), Q_ARG(int, 0));
ASSERT_TRUE(action);
ASSERT_EQ(action->property("checked").toBool(), true);
}
{
ThemeTypeGuard themeGurad(DGuiApplicationHelper::UnknownType);
Q_UNUSED(themeGurad);
QMetaObject::invokeMethod(root.object, "itemAt", Q_RETURN_ARG(QQuickItem*, action), Q_ARG(int, 2));
ASSERT_EQ(action->property("checked").toBool(), true);
}
}
|