522 } |
522 } |
523 |
523 |
524 void tst_QVideoFrame::map_data() |
524 void tst_QVideoFrame::map_data() |
525 { |
525 { |
526 QTest::addColumn<QSize>("size"); |
526 QTest::addColumn<QSize>("size"); |
527 QTest::addColumn<int>("numBytes"); |
527 QTest::addColumn<int>("mappedBytes"); |
528 QTest::addColumn<int>("bytesPerLine"); |
528 QTest::addColumn<int>("bytesPerLine"); |
529 QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat"); |
529 QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat"); |
530 QTest::addColumn<QAbstractVideoBuffer::MapMode>("mode"); |
530 QTest::addColumn<QAbstractVideoBuffer::MapMode>("mode"); |
531 |
531 |
532 QTest::newRow("read-only") |
532 QTest::newRow("read-only") |
552 } |
552 } |
553 |
553 |
554 void tst_QVideoFrame::map() |
554 void tst_QVideoFrame::map() |
555 { |
555 { |
556 QFETCH(QSize, size); |
556 QFETCH(QSize, size); |
557 QFETCH(int, numBytes); |
557 QFETCH(int, mappedBytes); |
558 QFETCH(int, bytesPerLine); |
558 QFETCH(int, bytesPerLine); |
559 QFETCH(QVideoFrame::PixelFormat, pixelFormat); |
559 QFETCH(QVideoFrame::PixelFormat, pixelFormat); |
560 QFETCH(QAbstractVideoBuffer::MapMode, mode); |
560 QFETCH(QAbstractVideoBuffer::MapMode, mode); |
561 |
561 |
562 QVideoFrame frame(numBytes, size, bytesPerLine, pixelFormat); |
562 QVideoFrame frame(mappedBytes, size, bytesPerLine, pixelFormat); |
563 |
563 |
564 QVERIFY(!frame.bits()); |
564 QVERIFY(!frame.bits()); |
565 QCOMPARE(frame.numBytes(), 0); |
565 QCOMPARE(frame.mappedBytes(), 0); |
566 QCOMPARE(frame.bytesPerLine(), 0); |
566 QCOMPARE(frame.bytesPerLine(), 0); |
567 QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); |
567 QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); |
568 |
568 |
569 QVERIFY(frame.map(mode)); |
569 QVERIFY(frame.map(mode)); |
570 |
570 |
571 QVERIFY(frame.bits()); |
571 QVERIFY(frame.bits()); |
572 QCOMPARE(frame.numBytes(), numBytes); |
572 QCOMPARE(frame.mappedBytes(), mappedBytes); |
573 QCOMPARE(frame.bytesPerLine(), bytesPerLine); |
573 QCOMPARE(frame.bytesPerLine(), bytesPerLine); |
574 QCOMPARE(frame.mapMode(), mode); |
574 QCOMPARE(frame.mapMode(), mode); |
575 |
575 |
576 frame.unmap(); |
576 frame.unmap(); |
577 |
577 |
578 QVERIFY(!frame.bits()); |
578 QVERIFY(!frame.bits()); |
579 QCOMPARE(frame.numBytes(), 0); |
579 QCOMPARE(frame.mappedBytes(), 0); |
580 QCOMPARE(frame.bytesPerLine(), 0); |
580 QCOMPARE(frame.bytesPerLine(), 0); |
581 QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); |
581 QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); |
582 } |
582 } |
583 |
583 |
584 void tst_QVideoFrame::mapImage_data() |
584 void tst_QVideoFrame::mapImage_data() |
612 QImage image(size.width(), size.height(), format); |
612 QImage image(size.width(), size.height(), format); |
613 |
613 |
614 QVideoFrame frame(image); |
614 QVideoFrame frame(image); |
615 |
615 |
616 QVERIFY(!frame.bits()); |
616 QVERIFY(!frame.bits()); |
617 QCOMPARE(frame.numBytes(), 0); |
617 QCOMPARE(frame.mappedBytes(), 0); |
618 QCOMPARE(frame.bytesPerLine(), 0); |
618 QCOMPARE(frame.bytesPerLine(), 0); |
619 QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); |
619 QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); |
620 |
620 |
621 QVERIFY(frame.map(mode)); |
621 QVERIFY(frame.map(mode)); |
622 |
622 |
623 QVERIFY(frame.bits()); |
623 QVERIFY(frame.bits()); |
624 QCOMPARE(frame.numBytes(), image.numBytes()); |
624 QCOMPARE(frame.mappedBytes(), image.numBytes()); |
625 QCOMPARE(frame.bytesPerLine(), image.bytesPerLine()); |
625 QCOMPARE(frame.bytesPerLine(), image.bytesPerLine()); |
626 QCOMPARE(frame.mapMode(), mode); |
626 QCOMPARE(frame.mapMode(), mode); |
627 |
627 |
628 frame.unmap(); |
628 frame.unmap(); |
629 |
629 |
630 QVERIFY(!frame.bits()); |
630 QVERIFY(!frame.bits()); |
631 QCOMPARE(frame.numBytes(), 0); |
631 QCOMPARE(frame.mappedBytes(), 0); |
632 QCOMPARE(frame.bytesPerLine(), 0); |
632 QCOMPARE(frame.bytesPerLine(), 0); |
633 QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); |
633 QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped); |
634 } |
634 } |
635 |
635 |
636 void tst_QVideoFrame::imageDetach() |
636 void tst_QVideoFrame::imageDetach() |