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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
// 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 <QTest>
#include <QSignalSpy>
#include <QQuickItem>
#include <QQuickWindow>
#include <DQuickWindow>
DQUICK_USE_NAMESPACE
class ut_DQuickWindow : public ::testing::Test
{
public:
};
TEST_F(ut_DQuickWindow, enabled)
{
TEST_OFFSCREEN_SKIP();
ControlHelper<QQuickWindow> helper("qrc:/qml/DQuickWindow.qml");
ASSERT_TRUE(helper.object);
auto attached = qobject_cast<DQuickWindowAttached *>(qmlAttachedPropertiesObject<DQuickWindow>(helper.object, false));
ASSERT_TRUE(attached);
ASSERT_TRUE(attached->property("enabled").toBool());
}
TEST_F(ut_DQuickWindow, windowProperties)
{
TEST_OFFSCREEN_SKIP();
ControlHelper<QQuickWindow> helper("qrc:/qml/DQuickWindow.qml");
ASSERT_TRUE(helper.object);
auto attached = qobject_cast<DQuickWindowAttached *>(qmlAttachedPropertiesObject<DQuickWindow>(helper.object, false));
ASSERT_TRUE(attached && attached->isEnabled());
EXPECT_EQ(attached->window(), helper.object);
EXPECT_EQ(attached->windowRadius(), 16);
EXPECT_EQ(attached->borderWidth(), 1);
EXPECT_EQ(attached->borderColor(), Qt::red);
EXPECT_EQ(attached->shadowRadius(), 10);
EXPECT_EQ(attached->shadowOffset(), QPoint(0, 2));
EXPECT_EQ(attached->shadowColor(), Qt::red);
EXPECT_EQ(attached->translucentBackground(), true);
EXPECT_EQ(attached->enableSystemResize(), true);
EXPECT_EQ(attached->enableSystemMove(), true);
EXPECT_EQ(attached->enableBlurWindow(), true);
EXPECT_EQ(attached->alphaBufferSize(), 8);
}
|