[test][windows] ensure reader is destroyed before trying to remove file - refs #3359
This commit is contained in:
parent
c18e086026
commit
632dd7e76d
1 changed files with 11 additions and 7 deletions
|
@ -167,14 +167,18 @@ SECTION("image_util : save_to_file/save_to_stream/save_to_string")
|
|||
std::ostringstream ss;
|
||||
mapnik::save_to_stream(im, ss, format);
|
||||
CHECK(str.length() == ss.str().length());
|
||||
std::unique_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(filename, extension));
|
||||
unsigned w = reader->width();
|
||||
unsigned h = reader->height();
|
||||
auto im2 = reader->read(0, 0, w, h);
|
||||
CHECK(im2.size() == im.size());
|
||||
if (extension == "png" || extension == "tiff")
|
||||
// wrap reader in scope to ensure the file handle is
|
||||
// released before we try to remove the file
|
||||
{
|
||||
CHECK(0 == std::memcmp(im2.bytes(), im.bytes(), im.width() * im.height()));
|
||||
std::unique_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(filename, extension));
|
||||
unsigned w = reader->width();
|
||||
unsigned h = reader->height();
|
||||
auto im2 = reader->read(0, 0, w, h);
|
||||
CHECK(im2.size() == im.size());
|
||||
if (extension == "png" || extension == "tiff")
|
||||
{
|
||||
CHECK(0 == std::memcmp(im2.bytes(), im.bytes(), im.width() * im.height()));
|
||||
}
|
||||
}
|
||||
if (mapnik::util::exists(filename))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue