aboutsummaryrefslogtreecommitdiff
path: root/test/test_apng.cpp
diff options
context:
space:
mode:
authorSkye Deving <76892045+skyedeving@users.noreply.github.com>2021-01-07 03:15:45 -0600
committerSkye Deving <76892045+skyedeving@users.noreply.github.com>2021-01-28 11:05:42 -0600
commita8fdea09b046a7c9c4fbb00d878fbb693abecdde (patch)
treec29d0afdf793dfdc31ef98bff2cada2fd51c4468 /test/test_apng.cpp
parentbd5ed84c1678877e7500558f0e455bed4d653766 (diff)
Add test for detecting png animation
Diffstat (limited to 'test/test_apng.cpp')
-rw-r--r--test/test_apng.cpp21
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());
+}