From 9050d4535eeac59e6c948c18704adaf2a77feaf1 Mon Sep 17 00:00:00 2001 From: henry Date: Thu, 26 Oct 2023 16:36:21 -0500 Subject: [PATCH] Add test for editing dpi on empty file --- tests/test-core.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/test-core.cpp b/tests/test-core.cpp index 0618191f..4faf6ee9 100644 --- a/tests/test-core.cpp +++ b/tests/test-core.cpp @@ -1,4 +1,6 @@ #include +#include +#include #include #include #include "glue/glue.h" @@ -27,10 +29,17 @@ TEST_CASE("TIFF files can edit their dpi"){ fs::remove(test_file); } -TEST_CASE("invalid file with set_dpi raises"){ - const std::string no_such_file = IMAGE_TEST_PATH + "invalid_file.tif"; +TEST_CASE("missing file with set_dpi raises"){ + const std::string no_such_file = IMAGE_TEST_PATH + "missing.tif"; REQUIRE_THROWS_AS(set_dpi(no_such_file, 100, 100), Exiv2::Error); } +TEST_CASE("empty file with set_dpi raises"){ + const std::string bad_file = IMAGE_TEST_PATH + "empty.tif"; + std::ofstream invalidFile; + invalidFile.open(bad_file); + invalidFile.close(); + REQUIRE_THROWS_AS(set_dpi(bad_file, 100, 100), Exiv2::Error); +} TEST_CASE("exiv2_version uses a semantic versioning scheme"){ REQUIRE(std::regex_match(exiv2_version(), std::regex("^([0-9]+)\\.([0-9]+)\\.([0-9]+)$")));