-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
||
import QtQuick 2.11 | ||
import QtQuick.Window 2.11 | ||
import org.deepin.dtk 1.0 as D | ||
|
||
Rectangle { | ||
id: control | ||
width: 200; height: 200 | ||
color: "red" | ||
Window { | ||
// on top of the Rectangle's window | ||
x: control.Window.window ? control.Window.window.x : 0 | ||
y: control.Window.window ? control.Window.window.y : 0 | ||
width: 100; height: 100 | ||
visible: true | ||
|
||
D.DWindow.enabled: true | ||
D.DWindow.alphaBufferSize: 8 | ||
|
||
D.BehindWindowBlur { | ||
anchors.fill: parent | ||
blendColor: Qt.rgba(0, 255, 0, 0.4) | ||
cornerRadius: 10 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// 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 "dquickbehindwindowblur_p.h" | ||
DQUICK_USE_NAMESPACE | ||
|
||
TEST(ut_DQuickBehindWindowBlur, properties) | ||
{ | ||
QuickViewHelper<> helper("qrc:/qml/DQuickBehindWindowBlur.qml"); | ||
ASSERT_TRUE(helper.object); | ||
|
||
DQuickBehindWindowBlur *target = helper.object->findChild<DQuickBehindWindowBlur *>(); | ||
ASSERT_TRUE(target); | ||
|
||
if (!target->valid()) | ||
GTEST_SKIP_("don't support BehindWindowBlur, it need WM support."); | ||
|
||
EXPECT_EQ(target->blendColor(), QColor(0, 255, 0, 0.4 * 255)); | ||
EXPECT_EQ(target->cornerRadius(), 10); | ||
|
||
QImage img = helper.view->grabWindow(); | ||
EXPECT_NE(img.pixelColor(QPoint(50, 50)), QColor(0, 255, 0, 0.4)); | ||
EXPECT_EQ(img.pixelColor(QPoint(150, 50)), Qt::red); | ||
} |