diff options
| author | TrickyLeifa <date.epoch@gmail.com> | 2024-05-17 23:54:41 +0200 |
|---|---|---|
| committer | TrickyLeifa <date.epoch@gmail.com> | 2024-05-18 00:48:55 +0200 |
| commit | 657145035cd66c18ae777e1272fd5221dddca0ef (patch) | |
| tree | f9b86a917a2e422c8f93b05f06ebd112f1c700cb /test/test_apng.cpp | |
| parent | 0500a5426013e97b80cae1de0b19a117cc1bbaa7 (diff) | |
Reimplemented unit tests, ...
* Reimplemented unit tests and simplified addition of new tests
* Minimal support of Qt is now 5.15
Diffstat (limited to 'test/test_apng.cpp')
| -rw-r--r-- | test/test_apng.cpp | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/test/test_apng.cpp b/test/test_apng.cpp deleted file mode 100644 index c092191f..00000000 --- a/test/test_apng.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include <catch2/catch.hpp> - -#include <QCoreApplication> -#include <QGuiApplication> -#include <QImageReader> -#include <QPixmap> -#include <QPluginLoader> - -TEST_CASE("Support APNG Plugin", "[apng]") -{ - // Check paths for libs - QCoreApplication::addLibraryPath("."); - QCoreApplication::addLibraryPath("lib"); - - // Either it's loaded from system or we load local - QPluginLoader apngPlugin("qapng"); - apngPlugin.load(); - - 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}; - QGuiApplication app(argc, argv); - - // 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("missle.png"); - reader.setFormat("apng"); - REQUIRE(!reader.supportsAnimation()); - reader.setFormat("png"); - REQUIRE(!reader.supportsAnimation()); - REQUIRE(!QPixmap::fromImage(reader.read()).isNull()); - } -} |
