summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2009-12-27 09:14:22 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2009-12-27 09:14:22 (GMT)
commit6aa95df70c7701bfe8c1d6b40dc49c4b3e591c64 (patch)
tree2f7033241c700c470027000777d09b689d5ff7a8 /tests
parent3f74384fd781d6d6028914bb8520340694810a1a (diff)
parentfdfb48bdb77ec0710c80d2f4bb6feaaf07f695c1 (diff)
downloadQt-6aa95df70c7701bfe8c1d6b40dc49c4b3e591c64.zip
Qt-6aa95df70c7701bfe8c1d6b40dc49c4b3e591c64.tar.gz
Qt-6aa95df70c7701bfe8c1d6b40dc49c4b3e591c64.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2: revert f36fb8b2b63b3734cc2bd66b329ca4fef1204845 Read QWS_SIZE from layer rather than screen Get rid of no_cast_from_ascii warning Docs: Amendments to latest changes to QImageReader docs. images: Document QImageReader::loopCount behaviour for infinite loops gif: Add unit test for QImageReader::size calls gif: 10% speedup on microbenchmark on QImageReader png: Avoid calling QImage::scanLine(int) from within a loop QImageReader: Avoid errorString creation in the normal case Fix text rendering on GL2 paint engine
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp8
-rw-r--r--tests/auto/qimagereader/images/endless-anim.gifbin0 -> 819 bytes
-rw-r--r--tests/auto/qimagereader/images/four-frames.gifbin0 -> 427 bytes
-rw-r--r--tests/auto/qimagereader/qimagereader.qrc2
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp138
5 files changed, 142 insertions, 6 deletions
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp
index 1445f5b..84ea52b 100644
--- a/tests/auto/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp
@@ -1083,13 +1083,9 @@ void tst_QFileInfo::isHidden_data()
&& !QDir().mkdir("./.hidden-directory"))
qWarning("Unable to create directory './.hidden-directory'. Some tests will fail.");
- QTest::newRow("./.hidden-directory") << QString("./.hidden-directory") << true;
- QTest::newRow("./.hidden-directory/.") << QString("./.hidden-directory/.") << false;
- QTest::newRow("./.hidden-directory/..") << QString("./.hidden-directory/..") << false;
-
QTest::newRow("/path/to/.hidden-directory") << QDir::currentPath() + QString("/.hidden-directory") << true;
- QTest::newRow("/path/to/.hidden-directory/.") << QDir::currentPath() + QString("/.hidden-directory/.") << false;
- QTest::newRow("/path/to/.hidden-directory/..") << QDir::currentPath() + QString("/.hidden-directory/..") << false;
+ QTest::newRow("/path/to/.hidden-directory/.") << QDir::currentPath() + QString("/.hidden-directory/.") << true;
+ QTest::newRow("/path/to/.hidden-directory/..") << QDir::currentPath() + QString("/.hidden-directory/..") << true;
#endif
#if defined(Q_OS_MAC)
diff --git a/tests/auto/qimagereader/images/endless-anim.gif b/tests/auto/qimagereader/images/endless-anim.gif
new file mode 100644
index 0000000..00df8da
--- /dev/null
+++ b/tests/auto/qimagereader/images/endless-anim.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/four-frames.gif b/tests/auto/qimagereader/images/four-frames.gif
new file mode 100644
index 0000000..6aff2e0
--- /dev/null
+++ b/tests/auto/qimagereader/images/four-frames.gif
Binary files differ
diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc
index 11b9406..58f2f74 100644
--- a/tests/auto/qimagereader/qimagereader.qrc
+++ b/tests/auto/qimagereader/qimagereader.qrc
@@ -57,5 +57,7 @@
<file>images/qt6.gif</file>
<file>images/qt7.gif</file>
<file>images/qt8.gif</file>
+ <file>images/endless-anim.gif</file>
+ <file>images/four-frames.gif</file>
</qresource>
</RCC>
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 630cc03..8cfaac5 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -141,6 +141,7 @@ private slots:
#if defined QTEST_HAVE_GIF
void gifHandlerBugs();
void animatedGif();
+ void gifImageCount();
#endif
void readCorruptImage_data();
@@ -725,6 +726,13 @@ void tst_QImageReader::gifHandlerBugs()
QVERIFY(!im1.isNull()); QVERIFY(!im2.isNull());
QCOMPARE(im1.convertToFormat(QImage::Format_ARGB32), im2.convertToFormat(QImage::Format_ARGB32));
}
+
+ // Check the undocumented feature.
+ {
+ QImageReader io(prefix + "endless-anim.gif");
+ QVERIFY(io.canRead());
+ QCOMPARE(io.loopCount(), -1);
+ }
}
void tst_QImageReader::animatedGif()
@@ -739,6 +747,136 @@ void tst_QImageReader::animatedGif()
image = io.read();
}
}
+
+// http://bugreports.qt.nokia.com/browse/QTBUG-6696
+// Check the count of images in various call orders...
+void tst_QImageReader::gifImageCount()
+{
+ // just read every frame... and see how much we got..
+ {
+ QImageReader io(":images/four-frames.gif");
+
+ QVERIFY(io.canRead());
+ QImage blackFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QImage whiteFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QImage greenFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QImage blueFrame = io.read();
+
+ QVERIFY(!io.canRead());
+ QImage emptyFrame = io.read();
+
+ QVERIFY(!io.canRead());
+ QCOMPARE(blackFrame.pixel(0,0), qRgb(0, 0, 0));
+ QCOMPARE(blackFrame.size(), QSize(64,64));
+
+ QCOMPARE(whiteFrame.pixel(0,0), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(whiteFrame.size(), QSize(64,64));
+
+ QCOMPARE(greenFrame.pixel(0,0), qRgb(0x0, 0xff, 0x0));
+ QCOMPARE(greenFrame.size(), QSize(64,64));
+
+ QCOMPARE(blueFrame.pixel(0,0), qRgb(0x0, 0x0, 0xff));
+ QCOMPARE(blueFrame.size(), QSize(64,64));
+ QVERIFY(emptyFrame.isNull());
+ }
+
+ // Read and get the size
+ {
+ QImageReader io(":images/four-frames.gif");
+
+ QVERIFY(io.canRead());
+ QCOMPARE(io.size(), QSize(64,64));
+
+ QVERIFY(io.canRead());
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QVERIFY(io.canRead());
+ QImage blackFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QVERIFY(io.canRead());
+ QImage whiteFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QVERIFY(io.canRead());
+ QImage greenFrame = io.read();
+
+ QVERIFY(io.canRead());
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QVERIFY(io.canRead());
+ QImage blueFrame = io.read();
+
+ QVERIFY(!io.canRead());
+ QCOMPARE(io.size(), QSize());
+ QCOMPARE(io.size(), QSize());
+ QVERIFY(!io.canRead());
+ QImage emptyFrame = io.read();
+
+ QVERIFY(!io.canRead());
+ QCOMPARE(blackFrame.pixel(0,0), qRgb(0, 0, 0));
+ QCOMPARE(blackFrame.size(), QSize(64,64));
+
+ QCOMPARE(whiteFrame.pixel(0,0), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(whiteFrame.size(), QSize(64,64));
+
+ QCOMPARE(greenFrame.pixel(0,0), qRgb(0x0, 0xff, 0x0));
+ QCOMPARE(greenFrame.size(), QSize(64,64));
+
+ QCOMPARE(blueFrame.pixel(0,0), qRgb(0x0, 0x0, 0xff));
+ QCOMPARE(blueFrame.size(), QSize(64,64));
+ QVERIFY(emptyFrame.isNull());
+ }
+
+ // Do a Size query as substitute for canRead
+ {
+ QImageReader io(":images/four-frames.gif");
+
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QImage blackFrame = io.read();
+
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QImage whiteFrame = io.read();
+
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QImage greenFrame = io.read();
+
+ QCOMPARE(io.size(), QSize(64,64));
+ QCOMPARE(io.size(), QSize(64,64));
+ QImage blueFrame = io.read();
+
+ QCOMPARE(io.size(), QSize());
+ QVERIFY(!io.canRead());
+ QImage emptyFrame = io.read();
+
+ QVERIFY(!io.canRead());
+ QCOMPARE(blackFrame.pixel(0,0), qRgb(0, 0, 0));
+ QCOMPARE(blackFrame.size(), QSize(64,64));
+
+ QCOMPARE(whiteFrame.pixel(0,0), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(whiteFrame.size(), QSize(64,64));
+
+ QCOMPARE(greenFrame.pixel(0,0), qRgb(0x0, 0xff, 0x0));
+ QCOMPARE(greenFrame.size(), QSize(64,64));
+
+ QCOMPARE(blueFrame.pixel(0,0), qRgb(0x0, 0x0, 0xff));
+ QCOMPARE(blueFrame.size(), QSize(64,64));
+ QVERIFY(emptyFrame.isNull());
+ }
+}
#endif
class Server : public QObject