Skip to content

Commit

Permalink
chore(UT): Wait for blur window exposed
Browse files Browse the repository at this point in the history
wait for blur window exposed

Log: wait for blur window exposed
  • Loading branch information
FeiWang1119 authored and 18202781743 committed Aug 9, 2023
1 parent 40e1334 commit a57a62b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,13 @@ class QuickViewHelper {
QVERIFY(QTest::qWaitForWindowActive(view.data()));
}
void requestExposed()
{
requestExposed(view.data());
}
static void requestExposed(QQuickWindow *view)
{
view->show();
QVERIFY(QTest::qWaitForWindowExposed(view.data()));
QVERIFY(QTest::qWaitForWindowExposed(view));
}
void clear()
{
Expand Down
4 changes: 4 additions & 0 deletions tests/ut_dquickbehindwindowblur.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ TEST(ut_DQuickBehindWindowBlur, properties)
EXPECT_EQ(target->blendColor(), QColor(0, 255, 0, 0.4 * 255));
EXPECT_EQ(target->cornerRadius(), 10);

QQuickWindow *subWindow = helper.object->findChild<QQuickWindow *>();
ASSERT_TRUE(subWindow);
helper.requestExposed(subWindow);

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);
Expand Down

0 comments on commit a57a62b

Please sign in to comment.