aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2024-01-09 12:53:45 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2024-01-22 12:03:37 +0100
commit4d2248f89d159431becc8222b195dd9d3f3a722e (patch)
treefd137974bd4968296dbec1ee1c6367bc7887d3d8 /tests/auto/quick
parent9e4f24e7491ebd8e26a7ca4d56046e558b57154c (diff)
QQuickRhiItem API cleanup
Based on the API review. Also follow QRhiWidget for symmetry. Pick-to: 6.7 Change-Id: Id04a0029ebeb9326b76b485414b58c83f384c466 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/quick')
-rw-r--r--tests/auto/quick/qquickrhiitem/testrhiitem.h4
-rw-r--r--tests/auto/quick/qquickrhiitem/tst_qquickrhiitem.cpp17
2 files changed, 12 insertions, 9 deletions
diff --git a/tests/auto/quick/qquickrhiitem/testrhiitem.h b/tests/auto/quick/qquickrhiitem/testrhiitem.h
index abc4f001c7..0207207425 100644
--- a/tests/auto/quick/qquickrhiitem/testrhiitem.h
+++ b/tests/auto/quick/qquickrhiitem/testrhiitem.h
@@ -9,7 +9,7 @@
class TestRenderer : public QQuickRhiItemRenderer
{
-public:
+protected:
void initialize(QRhiCommandBuffer *cb) override;
void synchronize(QQuickRhiItem *item) override;
void render(QRhiCommandBuffer *cb) override;
@@ -35,6 +35,8 @@ private:
void initScene();
void updateTexture();
+
+ friend class tst_QQuickRhiItem;
};
class TestRhiItem : public QQuickRhiItem
diff --git a/tests/auto/quick/qquickrhiitem/tst_qquickrhiitem.cpp b/tests/auto/quick/qquickrhiitem/tst_qquickrhiitem.cpp
index 7a589c15d7..4150d2d8e6 100644
--- a/tests/auto/quick/qquickrhiitem/tst_qquickrhiitem.cpp
+++ b/tests/auto/quick/qquickrhiitem/tst_qquickrhiitem.cpp
@@ -7,6 +7,7 @@
#include <QSGRendererInterface>
#include <private/qsgrhisupport_p.h>
#include <private/qquickrhiitem_p.h>
+#include "testrhiitem.h"
class tst_QQuickRhiItem : public QQmlDataTest
{
@@ -95,7 +96,7 @@ void tst_QQuickRhiItem::properties()
// not quite safe in theory (threads etc.) but we know it works in practice
QQuickRhiItemPrivate *d = QQuickRhiItemPrivate::get(item);
QVERIFY(d->node);
- QQuickRhiItemRenderer *r = d->node->m_renderer.get();
+ TestRenderer *r = static_cast<TestRenderer *>(d->node->m_renderer.get());
QVERIFY(r);
QRhi *rhi = r->rhi();
QVERIFY(rhi);
@@ -104,7 +105,7 @@ void tst_QQuickRhiItem::properties()
QVERIFY(!r->msaaColorBuffer());
QVERIFY(r->depthStencilBuffer());
QVERIFY(r->renderTarget());
- QCOMPARE(item->effectiveTextureSize(), r->colorTexture()->pixelSize());
+ QCOMPARE(item->effectiveColorBufferSize(), r->colorTexture()->pixelSize());
QCOMPARE(item->sampleCount(), 1);
item->setSampleCount(4);
@@ -116,7 +117,7 @@ void tst_QQuickRhiItem::properties()
QVERIFY(r->msaaColorBuffer());
QCOMPARE(r->msaaColorBuffer()->sampleCount(), 4);
QCOMPARE(r->depthStencilBuffer()->sampleCount(), 4);
- QCOMPARE(item->effectiveTextureSize(), r->msaaColorBuffer()->pixelSize());
+ QCOMPARE(item->effectiveColorBufferSize(), r->msaaColorBuffer()->pixelSize());
}
QCOMPARE(item->alphaBlending(), false);
@@ -126,13 +127,13 @@ void tst_QQuickRhiItem::properties()
item->setMirrorVertically(true);
item->setSampleCount(1);
- item->setExplicitTextureWidth(123);
- item->setExplicitTextureHeight(456);
+ item->setFixedColorBufferWidth(123);
+ item->setFixedColorBufferHeight(456);
view.grabWindow();
QCOMPARE(r->colorTexture()->pixelSize(), QSize(123, 456));
- QCOMPARE(item->explicitTextureWidth(), 123);
- QCOMPARE(item->explicitTextureHeight(), 456);
- QCOMPARE(item->effectiveTextureSize(), QSize(123, 456));
+ QCOMPARE(item->fixedColorBufferWidth(), 123);
+ QCOMPARE(item->fixedColorBufferHeight(), 456);
+ QCOMPARE(item->effectiveColorBufferSize(), QSize(123, 456));
QImage result = view.grabWindow();
QVERIFY(!result.isNull());