#include #include #include #include #include #include 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][noci]") { // Required for QPixmap methods int argc = 1; char bin[] = "test"; 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 QImageReader d; d.setAutoDetectImageFormat(true); d.setFileName("snackoo.png"); REQUIRE(!d.supportsAnimation()); REQUIRE(!QPixmap::fromImage(d.read()).isNull()); }