diff options
author | ABBAPOH <ABBAPOH@nextmail.ru> | 2013-12-01 12:47:53 +0400 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-02 09:51:20 +0100 |
commit | 65fa7497f2561d30a3e82668f9fc29fa6f789a8d (patch) | |
tree | c2531019501ba280b09ed11ab5f7c1d82e429528 /tests | |
parent | a5f8d2544def6aaad020ac3a8c8297295eeb2407 (diff) |
Fix writing images in DDS handler
Change-Id: If433528eb4cfa7448f171e083dd2bb559dbc2f4a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/dds/tst_qdds.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/dds/tst_qdds.cpp b/tests/auto/dds/tst_qdds.cpp index de05ec4..4464b99 100644 --- a/tests/auto/dds/tst_qdds.cpp +++ b/tests/auto/dds/tst_qdds.cpp @@ -52,6 +52,8 @@ private slots: void readImage(); void testMipmaps_data(); void testMipmaps(); + void testWriteImage_data(); + void testWriteImage(); }; void tst_qdds::readImage_data() @@ -149,5 +151,32 @@ void tst_qdds::testMipmaps() } } +void tst_qdds::testWriteImage_data() +{ + QTest::addColumn<QString>("fileName"); + QTest::addColumn<QSize>("size"); + + QTest::newRow("1") << QString("A8R8G8B8") << QSize(64, 64); +} + +void tst_qdds::testWriteImage() +{ + QFETCH(QString, fileName); + QFETCH(QSize, size); + + const QString path = fileName + QStringLiteral(".dds"); + const QString sourcePath = QStringLiteral(":/dds/") + fileName + QStringLiteral(".dds"); + + QImage image(sourcePath); + QVERIFY(!image.isNull()); + QVERIFY(image.size() == size); + + QImageWriter writer(path, QByteArrayLiteral("dds")); + QVERIFY2(writer.canWrite(), qPrintable(writer.errorString())); + QVERIFY2(writer.write(image), qPrintable(writer.errorString())); + + QVERIFY(image == QImage(path)); +} + QTEST_MAIN(tst_qdds) #include "tst_qdds.moc" |