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 39 40 41 42 43 44 45 46
|
// SPDX-FileCopyrightText: 2021 - 2022 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#include <gtest/gtest.h>
#include <DStyleOptionButton>
#include "dfloatingwidget.h"
DWIDGET_USE_NAMESPACE
class ut_DFloatingWidget : public testing::Test
{
protected:
void SetUp() override
{
target = new DFloatingWidget();
}
void TearDown() override
{
if (target) {
delete target;
target = nullptr;
}
}
DFloatingWidget *target = nullptr;
};
TEST_F(ut_DFloatingWidget, initStyleOption)
{
DStyleOptionFloatingWidget option;
target->initStyleOption(&option);
ASSERT_EQ(option.noBackground, target->blurBackgroundIsEnabled());
};
TEST_F(ut_DFloatingWidget, setBlurBackgroundEnabled)
{
target->setBlurBackgroundEnabled(true);
ASSERT_EQ(target->blurBackgroundIsEnabled(), true);
};
TEST_F(ut_DFloatingWidget, setFramRadius)
{
target->setFramRadius(1);
DStyleOptionFloatingWidget option;
target->initStyleOption(&option);
ASSERT_EQ(option.frameRadius, 1);
};
|