blob: fdfb8ddba74b37a0cfa620d3c5678e94d58491e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#include <catch2/catch.hpp>
#include <QPluginLoader>
#include <QImageReader>
#include <QCoreApplication>
#include <QGuiApplication>
#include <QPixmap>
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());
}
|