mirror of
https://github.com/SFML/SFML.git
synced 2025-01-19 15:55:13 +08:00
Add tests for sf::Image::loadFromFile
failure
This commit is contained in:
parent
fd2c42c7d1
commit
0fcd1dd0f1
@ -90,6 +90,17 @@ TEST_CASE("[Graphics] sf::Image")
|
|||||||
{
|
{
|
||||||
sf::Image image;
|
sf::Image image;
|
||||||
|
|
||||||
|
SECTION("Invalid file")
|
||||||
|
{
|
||||||
|
CHECK(!image.loadFromFile("."));
|
||||||
|
CHECK(!image.loadFromFile("this/does/not/exist.jpg"));
|
||||||
|
|
||||||
|
CHECK(image.getSize() == sf::Vector2u(0, 0));
|
||||||
|
CHECK(image.getPixelsPtr() == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("Successful load")
|
||||||
|
{
|
||||||
SECTION("bmp")
|
SECTION("bmp")
|
||||||
{
|
{
|
||||||
REQUIRE(image.loadFromFile("Graphics/sfml-logo-big.bmp"));
|
REQUIRE(image.loadFromFile("Graphics/sfml-logo-big.bmp"));
|
||||||
@ -128,6 +139,7 @@ TEST_CASE("[Graphics] sf::Image")
|
|||||||
CHECK(image.getSize() == sf::Vector2u(1001, 304));
|
CHECK(image.getSize() == sf::Vector2u(1001, 304));
|
||||||
CHECK(image.getPixelsPtr() != nullptr);
|
CHECK(image.getPixelsPtr() != nullptr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("saveToFile()")
|
SECTION("saveToFile()")
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user