mirror of
https://github.com/SFML/SFML.git
synced 2025-01-31 13:45: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;
|
||||
|
||||
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")
|
||||
{
|
||||
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.getPixelsPtr() != nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("saveToFile()")
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user