File: ut_dquickblitframebuffer.cpp

package info (click to toggle)
dtkdeclarative 5.7.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 29,848 kB
  • sloc: cpp: 20,566; ansic: 66; makefile: 29; sh: 25
file content (28 lines) | stat: -rw-r--r-- 699 bytes parent folder | download
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
// 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 "dquickblitframebuffer.h"
DQUICK_USE_NAMESPACE

TEST(ut_DQuickBlitFramebuffer, properties)
{
    QuickViewHelper<> helper("qrc:/qml/DQuickBlitFramebuffer.qml");
    ASSERT_TRUE(helper.object);

    auto target = findItem<DQuickBlitFramebuffer>(helper.object);
    ASSERT_TRUE(target);

    QImage img = helper.view->grabWindow();

    // out buffer area
    EXPECT_EQ(img.pixelColor(QPoint(50, 40)), Qt::red);
    // in buffer area
    EXPECT_EQ(img.pixelColor(QPoint(60, 60)), Qt::blue);
}