diff options
| author | Skye Deving <76892045+skyedeving@users.noreply.github.com> | 2021-01-07 04:22:18 -0600 |
|---|---|---|
| committer | Skye Deving <76892045+skyedeving@users.noreply.github.com> | 2021-01-28 11:05:42 -0600 |
| commit | 760d5861604b63b088943552fb70863952fa060e (patch) | |
| tree | b1d0dfe22a1781e5ff6be26601aa80ffbd894c55 /test | |
| parent | 29354d919fad2da8c26054abb796ed7a270f278d (diff) | |
Refactor the test for detecting apng from png
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_apng.cpp | 56 |
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()); + } } |
