diff --git a/test/Graphics/Image.test.cpp b/test/Graphics/Image.test.cpp index 1855b608b..53b5933e2 100644 --- a/test/Graphics/Image.test.cpp +++ b/test/Graphics/Image.test.cpp @@ -86,6 +86,49 @@ TEST_CASE("[Graphics] sf::Image") } } + SECTION("loadFromFile()") + { + sf::Image image; + + SECTION("bmp") + { + REQUIRE(image.loadFromFile("Graphics/sfml-logo-big.bmp")); + CHECK(image.getPixel({0, 0}) == sf::Color::White); + CHECK(image.getPixel({200, 150}) == sf::Color(144, 208, 62)); + } + + SECTION("png") + { + REQUIRE(image.loadFromFile("Graphics/sfml-logo-big.png")); + CHECK(image.getPixel({0, 0}) == sf::Color(255, 255, 255, 0)); + CHECK(image.getPixel({200, 150}) == sf::Color(144, 208, 62)); + } + + SECTION("jpg") + { + REQUIRE(image.loadFromFile("Graphics/sfml-logo-big.jpg")); + CHECK(image.getPixel({0, 0}) == sf::Color::White); + CHECK(image.getPixel({200, 150}) == sf::Color(144, 208, 62)); + } + + SECTION("gif") + { + REQUIRE(image.loadFromFile("Graphics/sfml-logo-big.gif")); + CHECK(image.getPixel({0, 0}) == sf::Color::White); + CHECK(image.getPixel({200, 150}) == sf::Color(146, 210, 62)); + } + + SECTION("psd") + { + REQUIRE(image.loadFromFile("Graphics/sfml-logo-big.psd")); + CHECK(image.getPixel({0, 0}) == sf::Color::White); + CHECK(image.getPixel({200, 150}) == sf::Color(144, 208, 62)); + } + + CHECK(image.getSize() == sf::Vector2u(1001, 304)); + CHECK(image.getPixelsPtr() != nullptr); + } + SECTION("Set/get pixel") { sf::Image image; diff --git a/test/Graphics/sfml-logo-big.bmp b/test/Graphics/sfml-logo-big.bmp new file mode 100644 index 000000000..615a25edf Binary files /dev/null and b/test/Graphics/sfml-logo-big.bmp differ diff --git a/test/Graphics/sfml-logo-big.gif b/test/Graphics/sfml-logo-big.gif new file mode 100644 index 000000000..40d594dda Binary files /dev/null and b/test/Graphics/sfml-logo-big.gif differ diff --git a/test/Graphics/sfml-logo-big.jpg b/test/Graphics/sfml-logo-big.jpg new file mode 100644 index 000000000..7b7c5d4f0 Binary files /dev/null and b/test/Graphics/sfml-logo-big.jpg differ diff --git a/test/Graphics/sfml-logo-big.png b/test/Graphics/sfml-logo-big.png new file mode 100644 index 000000000..d22d46d1d Binary files /dev/null and b/test/Graphics/sfml-logo-big.png differ diff --git a/test/Graphics/sfml-logo-big.psd b/test/Graphics/sfml-logo-big.psd new file mode 100644 index 000000000..8c107d67a Binary files /dev/null and b/test/Graphics/sfml-logo-big.psd differ