diff options
Diffstat (limited to 'tests/auto/unit/multimedia/qabstractvideobuffer/tst_qabstractvideobuffer.cpp')
-rw-r--r-- | tests/auto/unit/multimedia/qabstractvideobuffer/tst_qabstractvideobuffer.cpp | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/tests/auto/unit/multimedia/qabstractvideobuffer/tst_qabstractvideobuffer.cpp b/tests/auto/unit/multimedia/qabstractvideobuffer/tst_qabstractvideobuffer.cpp index 567b086f2..e75e1395a 100644 --- a/tests/auto/unit/multimedia/qabstractvideobuffer/tst_qabstractvideobuffer.cpp +++ b/tests/auto/unit/multimedia/qabstractvideobuffer/tst_qabstractvideobuffer.cpp @@ -3,13 +3,7 @@ #include <QtTest/QtTest> -#include <private/qabstractvideobuffer_p.h> - -// Adds an enum, and the stringized version -#define ADD_ENUM_TEST(x) \ - QTest::newRow(#x) \ - << QVideoFrame::x \ - << QString(QLatin1String(#x)); +#include <private/qhwvideobuffer_p.h> class tst_QAbstractVideoBuffer : public QObject { @@ -28,19 +22,16 @@ private slots: void handleType_data(); void handleType(); void handle(); - void mapMode(); void mapModeDebug_data(); void mapModeDebug(); }; -class QtTestVideoBuffer : public QAbstractVideoBuffer +class QtTestVideoBuffer : public QHwVideoBuffer { public: - QtTestVideoBuffer(QVideoFrame::HandleType type) : QAbstractVideoBuffer(type) {} - - [[nodiscard]] QVideoFrame::MapMode mapMode() const override { return QVideoFrame::ReadWrite; } + QtTestVideoBuffer(QVideoFrame::HandleType type) : QHwVideoBuffer(type) { } - MapData map(QVideoFrame::MapMode) override { return {}; } + MapData map(QtVideo::MapMode) override { return {}; } void unmap() override {} }; @@ -73,8 +64,8 @@ void tst_QAbstractVideoBuffer::handleType_data() QTest::addColumn<QVideoFrame::HandleType>("type"); QTest::addColumn<QString>("stringized"); - ADD_ENUM_TEST(NoHandle); - ADD_ENUM_TEST(RhiTextureHandle); + QTest::newRow("NoHandle") << QVideoFrame::NoHandle << QStringLiteral("NoHandle"); + QTest::newRow("RhiTextureHandle") << QVideoFrame::RhiTextureHandle << QStringLiteral("RhiTextureHandle"); } void tst_QAbstractVideoBuffer::handleType() @@ -97,26 +88,24 @@ void tst_QAbstractVideoBuffer::handle() QVERIFY(buffer.textureHandle(nullptr, 0) == 0); } -void tst_QAbstractVideoBuffer::mapMode() -{ - QtTestVideoBuffer maptest(QVideoFrame::NoHandle); - QVERIFY2(maptest.mapMode() == QVideoFrame::ReadWrite, "ReadWrite Failed"); -} - void tst_QAbstractVideoBuffer::mapModeDebug_data() { - QTest::addColumn<QVideoFrame::MapMode>("mapMode"); + QTest::addColumn<QtVideo::MapMode>("mapMode"); QTest::addColumn<QString>("stringized"); - ADD_ENUM_TEST(NotMapped); - ADD_ENUM_TEST(ReadOnly); - ADD_ENUM_TEST(WriteOnly); - ADD_ENUM_TEST(ReadWrite); + QTest::newRow("NotMapped") << QtVideo::MapMode::NotMapped + << QStringLiteral("QtVideo::MapMode::NotMapped"); + QTest::newRow("ReadOnly") << QtVideo::MapMode::ReadOnly + << QStringLiteral("QtVideo::MapMode::ReadOnly"); + QTest::newRow("WriteOnly") << QtVideo::MapMode::WriteOnly + << QStringLiteral("QtVideo::MapMode::WriteOnly"); + QTest::newRow("ReadWrite") << QtVideo::MapMode::ReadWrite + << QStringLiteral("QtVideo::MapMode::ReadWrite"); } void tst_QAbstractVideoBuffer::mapModeDebug() { - QFETCH(QVideoFrame::MapMode, mapMode); + QFETCH(QtVideo::MapMode, mapMode); QFETCH(QString, stringized); QTest::ignoreMessage(QtDebugMsg, stringized.toLatin1().constData()); |