summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/auto/qimagereader/images/txts.pngbin0 -> 5413 bytes
-rw-r--r--tests/auto/qimagereader/qimagereader.qrc1
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp28
3 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/qimagereader/images/txts.png b/tests/auto/qimagereader/images/txts.png
new file mode 100755
index 0000000..99be1eb
--- /dev/null
+++ b/tests/auto/qimagereader/images/txts.png
Binary files differ
diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc
index 5536b38..632b73a 100644
--- a/tests/auto/qimagereader/qimagereader.qrc
+++ b/tests/auto/qimagereader/qimagereader.qrc
@@ -64,5 +64,6 @@
<file>images/corrupt.svg</file>
<file>images/corrupt.svgz</file>
<file>images/qtbug13653-no_eoi.jpg</file>
+ <file>images/txts.png</file>
</qresource>
</RCC>
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index f02fd6a..5db5f56 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -183,6 +183,9 @@ private slots:
void saveFormat_data();
void saveFormat();
+ void readText_data();
+ void readText();
+
void preserveTexts_data();
void preserveTexts();
};
@@ -1968,6 +1971,31 @@ void tst_QImageReader::saveFormat()
}
+void tst_QImageReader::readText_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::addColumn<QString>("key");
+ QTest::addColumn<QString>("text");
+
+ QTest::newRow("png, tEXt before img") << "txts.png" << "Title" << "PNG";
+ QTest::newRow("png, zTXt before img") << "txts.png" << "Comment" << "Some compressed text.";
+ QTest::newRow("png, tEXt after img") << "txts.png" << "Disclaimer" << "For testing only.";
+ QTest::newRow("png, zTXt after img") << "txts.png" << "Description" << "Rendered by Persistence of Vision (tm) Ray Tracer";
+}
+
+
+void tst_QImageReader::readText()
+{
+ QFETCH(QString, fileName);
+ QFETCH(QString, key);
+ QFETCH(QString, text);
+
+ QImage img(prefix + fileName);
+ QVERIFY(img.textKeys().contains(key));
+ QCOMPARE(img.text(key), text);
+}
+
+
void tst_QImageReader::preserveTexts_data()
{
QTest::addColumn<QString>("text");