diff options
Diffstat (limited to 'test/test_apng.cpp')
| -rw-r--r-- | test/test_apng.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/test_apng.cpp b/test/test_apng.cpp index 7d7062bc..cbeb68a7 100644 --- a/test/test_apng.cpp +++ b/test/test_apng.cpp @@ -3,6 +3,8 @@ #include <QPluginLoader> #include <QImageReader> #include <QCoreApplication> +#include <QApplication> +#include <QPixmap> TEST_CASE("Support APNG Plugin", "[apng]") { // Check paths for libs @@ -16,3 +18,22 @@ TEST_CASE("Support APNG Plugin", "[apng]") { INFO(QImageReader::supportedImageFormats().join(' ').toStdString()); REQUIRE(QImageReader::supportedImageFormats().contains("apng")); } + +TEST_CASE("Detect png animation", "[apng]") { + // Required for QPixmap methods + int argc = 1; + char bin[] = "test"; + char *argv[] = { bin }; + QApplication app(argc, argv); + + // Detect apng supports animation + QImageReader a("snackoo.png", "apng"); + REQUIRE(a.supportsAnimation()); + REQUIRE(!QPixmap::fromImage(a.read()).isNull()); + + // Detect png frame has no animation + QImageReader p("snackoo-frame.png", "apng"); + REQUIRE(!p.supportsAnimation()); + p.setFormat("png"); + REQUIRE(!QPixmap::fromImage(p.read()).isNull()); +} |
