Add test for detecting png animation
This commit is contained in:
parent
bd5ed84c16
commit
a8fdea09b0
@ -1,8 +1,8 @@
|
|||||||
find_package(Qt5 COMPONENTS Core Gui REQUIRED)
|
find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED)
|
||||||
find_package(Catch2 REQUIRED)
|
find_package(Catch2 REQUIRED)
|
||||||
|
|
||||||
add_executable(test test_aopacket.cpp test_caseloading.cpp test_apng.cpp test_bass.cpp ../include/aopacket.h ../src/aopacket.cpp)
|
add_executable(test test_aopacket.cpp test_caseloading.cpp test_apng.cpp test_bass.cpp ../include/aopacket.h ../src/aopacket.cpp)
|
||||||
target_include_directories(test PRIVATE ../include)
|
target_include_directories(test PRIVATE ../include)
|
||||||
target_link_directories(test PRIVATE ../lib)
|
target_link_directories(test PRIVATE ../lib)
|
||||||
target_link_libraries(test PRIVATE Qt5::Core Qt5::Gui Catch2::Catch2 bass bassopus discord-rpc)
|
target_link_libraries(test PRIVATE Qt5::Core Qt5::Gui Qt5::Widgets Catch2::Catch2 bass bassopus discord-rpc)
|
||||||
target_compile_definitions(Attorney_Online PRIVATE DISCORD)
|
target_compile_definitions(Attorney_Online PRIVATE DISCORD)
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include <QPluginLoader>
|
#include <QPluginLoader>
|
||||||
#include <QImageReader>
|
#include <QImageReader>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QPixmap>
|
||||||
|
|
||||||
TEST_CASE("Support APNG Plugin", "[apng]") {
|
TEST_CASE("Support APNG Plugin", "[apng]") {
|
||||||
// Check paths for libs
|
// Check paths for libs
|
||||||
@ -16,3 +18,22 @@ TEST_CASE("Support APNG Plugin", "[apng]") {
|
|||||||
INFO(QImageReader::supportedImageFormats().join(' ').toStdString());
|
INFO(QImageReader::supportedImageFormats().join(' ').toStdString());
|
||||||
REQUIRE(QImageReader::supportedImageFormats().contains("apng"));
|
REQUIRE(QImageReader::supportedImageFormats().contains("apng"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Detect png animation", "[apng]") {
|
||||||
|
// Required for QPixmap methods
|
||||||
|
int argc = 1;
|
||||||
|
char bin[] = "test";
|
||||||
|
char *argv[] = { bin };
|
||||||
|
QApplication 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());
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user