aboutsummaryrefslogtreecommitdiff
path: root/test/test_apng.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_apng.cpp')
-rw-r--r--test/test_apng.cpp56
1 files changed, 32 insertions, 24 deletions
diff --git a/test/test_apng.cpp b/test/test_apng.cpp
index 403034bb..93550b53 100644
--- a/test/test_apng.cpp
+++ b/test/test_apng.cpp
@@ -26,28 +26,36 @@ TEST_CASE("Detect png animation", "[apng][noci]") {
char *argv[] = { bin };
QGuiApplication 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());
-
- // Auto detect fails on apng
- QImageReader d;
- d.setAutoDetectImageFormat(true);
- d.setFileName("snackoo.png");
- REQUIRE(!d.supportsAnimation());
- REQUIRE(!QPixmap::fromImage(d.read()).isNull());
-
- // Decide format fom content fails on apng
- QImageReader c;
- c.setDecideFormatFromContent(true);
- c.setFileName("snackoo.png");
- REQUIRE(!c.supportsAnimation());
- REQUIRE(!QPixmap::fromImage(c.read()).isNull());
+ // Instantiate reader
+ QImageReader reader;
+
+ SECTION("Decide format from content fails on apng") {
+ reader.setFileName("snackoo.png");
+ reader.setDecideFormatFromContent(true);
+ REQUIRE(!reader.supportsAnimation());
+ REQUIRE(!QPixmap::fromImage(reader.read()).isNull());
+ }
+
+ SECTION("Auto detect fails on apng") {
+ reader.setFileName("snackoo.png");
+ reader.setAutoDetectImageFormat(true);
+ REQUIRE(!reader.supportsAnimation());
+ REQUIRE(!QPixmap::fromImage(reader.read()).isNull());
+ }
+
+ SECTION("Detect apng supports animation") {
+ reader.setFileName("snackoo.png");
+ reader.setFormat("apng");
+ REQUIRE(reader.supportsAnimation());
+ REQUIRE(!QPixmap::fromImage(reader.read()).isNull());
+ }
+
+ SECTION("Detect png frame has no animation") {
+ reader.setFileName("snackoo-frame.png");
+ reader.setFormat("apng");
+ REQUIRE(!reader.supportsAnimation());
+ reader.setFormat("png");
+ REQUIRE(!reader.supportsAnimation());
+ REQUIRE(!QPixmap::fromImage(reader.read()).isNull());
+ }
}