write images to custom tmp directory and create it first

This commit is contained in:
Dane Springmeyer 2016-03-11 18:08:35 -08:00
parent cd9b214d55
commit b14d525968

View file

@ -14,7 +14,15 @@
#include <mapnik/cairo/cairo_image_util.hpp>
#endif
#pragma GCC diagnostic push
#include <mapnik/warning_ignore.hpp>
#include <boost/format.hpp>
#include <boost/filesystem/convenience.hpp>
#pragma GCC diagnostic pop
inline bool make_directory(std::string const& dir) {
return boost::filesystem::create_directory(dir);
}
TEST_CASE("image io") {
@ -144,12 +152,14 @@ SECTION("image_util : save_to_file/save_to_stream/save_to_string")
supported_types.push_back(std::make_tuple("webp","webp"));
#endif
REQUIRE(make_directory("/tmp/mapnik-tests/"));
for (auto const& info : supported_types)
{
std::string extension;
std::string format;
std::tie(extension, format) = info;
std::string filename = (boost::format("/tmp/mapnik-%1%.%2%") % named_color % extension).str();
std::string filename = (boost::format("/tmp/mapnik-tests/mapnik-%1%.%2%") % named_color % extension).str();
mapnik::save_to_file(im, filename);
std::string str = mapnik::save_to_string(im, format);
std::ostringstream ss;