Skip to content

Commit

Permalink
Always build test/extension/io/targa tests for images hosted in sourc…
Browse files Browse the repository at this point in the history
…e tree

Remove use of compile-time configuration macros
  - BOOST_GIL_IO_TEST_ALLOW_READING_IMAGES
  - BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES

Remove BOOST_GIL_IO_USE_TARGA_FILEFORMAT_TEST_SUITE_IMAGES as not used anymore.
  • Loading branch information
mloskot committed Mar 29, 2020
1 parent 7f4f5f1 commit cc64bdd
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 43 deletions.
2 changes: 0 additions & 2 deletions doc/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES Allow images to be writ
BOOST_GIL_IO_USE_BMP_TEST_SUITE_IMAGES Run tests using the bmp test images suite. See _BMP_TEST_FILES
BOOST_GIL_IO_USE_PNG_TEST_SUITE_IMAGES Run tests using the png test images suite. See _PNG_TEST_FILES
BOOST_GIL_IO_USE_PNM_TEST_SUITE_IMAGES Run tests using the pnm test images suite. Send me an email for accessing the files.
BOOST_GIL_IO_USE_TARGA_FILEFORMAT_TEST_SUITE_IMAGES Run tests using the targa file format test images suite. See _TARGA_TEST_FILES
BOOST_GIL_IO_USE_TIFF_LIBTIFF_TEST_SUITE_IMAGES Run tests using the targa file format test images suite. See _TIFF_LIB_TIFF_TEST_FILES
BOOST_GIL_IO_USE_TIFF_GRAPHICSMAGICK_TEST_SUITE_IMAGES Run tests using the targa file format test images suite. See _TIFF_GRAPHICSMAGICK_TEST_FILES
======================================================== ========================================================
Expand Down Expand Up @@ -632,7 +631,6 @@ to enable the tests:
:BMP: BMP_TEST_FILES_ -- BOOST_GIL_IO_USE_BMP_TEST_SUITE_IMAGES
:PNG: PNG_TEST_FILES_ -- BOOST_GIL_IO_USE_PNG_TEST_SUITE_IMAGES
:PNM: request files from me -- BOOST_GIL_IO_USE_PNM_TEST_SUITE_IMAGES
:TARGA: TARGA_TEST_FILES_ -- BOOST_GIL_IO_USE_TARGA_FILEFORMAT_TEST_SUITE_IMAGES
:TIFF: TIFF_LIB_TIFF_TEST_FILES_ -- BOOST_GIL_IO_USE_TIFF_LIBTIFF_TEST_SUITE_IMAGES
:TIFF: TIFF_GRAPHICSMAGICK_TEST_FILES_ -- BOOST_GIL_IO_USE_TIFF_GRAPHICSMAGICK_TEST_SUITE_IMAGES

Expand Down
4 changes: 0 additions & 4 deletions test/extension/io/targa/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@

import testing ;

# TODO: Download Targa test suite images and build with BOOST_GIL_IO_USE_TARGA_FILEFORMAT_TEST_SUITE_IMAGES

project
: requirements
<define>BOOST_GIL_IO_TEST_ALLOW_READING_IMAGES
<define>BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
<library>/boost/filesystem//boost_filesystem
;

Expand Down
10 changes: 1 addition & 9 deletions test/extension/io/targa/targa_old_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
namespace gil = boost::gil;
namespace mp11 = boost::mp11;

#ifdef BOOST_GIL_IO_TEST_ALLOW_READING_IMAGES
void test_old_read_dimensions()
{
boost::gil::point_t dim = gil::targa_read_dimensions(targa_filename);

BOOST_TEST_EQ(dim.x, 124);
BOOST_TEST_EQ(dim.y, 124);
}
Expand Down Expand Up @@ -57,11 +57,9 @@ void test_old_read_and_convert_view()

void test_old_write_view()
{
#ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
targa_write_view(
targa_out + "old_write_view_test.tga",
create_mandel_view(124, 124, gil::rgb8_pixel_t(0, 0, 255), gil::rgb8_pixel_t(0, 255, 0)));
#endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
}

void test_old_dynamic_image()
Expand All @@ -77,9 +75,7 @@ void test_old_dynamic_image()
gil::any_image<my_img_types> image;
gil::targa_read_image(targa_filename.c_str(), image);

#ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
targa_write_view(targa_out + "old_dynamic_image_test.tga", gil::view(image));
#endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
}

int main()
Expand All @@ -94,7 +90,3 @@ int main()

return boost::report_errors();
}

#else
int main() {}
#endif // BOOST_GIL_IO_TEST_ALLOW_READING_IMAGES
9 changes: 0 additions & 9 deletions test/extension/io/targa/targa_read_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

namespace gil = boost::gil;

#ifdef BOOST_GIL_IO_USE_TARGA_FILEFORMAT_TEST_SUITE_IMAGES

template <typename Image>
void test_targa_scanline_reader(std::string filename)
{
Expand All @@ -26,9 +24,7 @@ void test_targa_scanline_reader(std::string filename)
template <typename Image>
void write(Image& img, std::string const& file_name)
{
#ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
gil::write_view(targa_out + file_name, gil::view(img), gil::targa_tag());
#endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
}

void test_read_header()
Expand Down Expand Up @@ -204,9 +200,7 @@ void test_partial_image()
filename, img,
gil::image_read_settings<gil::targa_tag>(gil::point_t(0, 0), gil::point_t(50, 50)));

#ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
gil::write_view(targa_out + "targa_partial.tga", gil::view(img), gil::targa_tag());
#endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
}

int main()
Expand All @@ -216,6 +210,3 @@ int main()

return boost::report_errors();
}
#else
int main() {}
#endif // BOOST_GIL_IO_USE_PNM_TEST_SUITE_IMAGES
16 changes: 2 additions & 14 deletions test/extension/io/targa/targa_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ namespace fs = boost::filesystem;
namespace gil = boost::gil;
namespace mp11 = boost::mp11;

#ifdef BOOST_GIL_IO_TEST_ALLOW_READING_IMAGES
void test_read_image_info_using_string()
{
{
Expand Down Expand Up @@ -161,7 +160,6 @@ void test_read_and_convert_view()
}
}

#ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
void test_write_view()
{
{
Expand Down Expand Up @@ -202,7 +200,6 @@ void test_write_view()
info);
}
}
#endif //BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES

void test_stream()
{
Expand All @@ -227,9 +224,7 @@ void test_stream()
// 5. Write out image.
std::string filename(targa_out + "stream_test.tga");
std::ofstream out(filename.c_str(), std::ios_base::binary);
#ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
gil::write_view(out, gil::view(dst), gil::targa_tag());
#endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
}

void test_stream_2()
Expand All @@ -252,8 +247,8 @@ void test_subimage()
targa_filename, gil::point_t(0, 0), gil::point_t(50, 50));

// FIXME: not working
// run_subimage_test<gil::gray8_image_t, gil::targa_tag>(
// targa_filename, gil::point_t(39, 7), gil::point_t(50, 50));
run_subimage_test<gil::gray8_image_t, gil::targa_tag>(
targa_filename, gil::point_t(39, 7), gil::point_t(50, 50));
}

void test_dynamic_image()
Expand All @@ -267,12 +262,8 @@ void test_dynamic_image()
>;

gil::any_image<my_img_types> image;

gil::read_image(targa_filename.c_str(), image, gil::targa_tag());

#ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
gil::write_view(targa_out + "dynamic_image_test.tga", gil::view(image), gil::targa_tag());
#endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
}

int main()
Expand All @@ -289,6 +280,3 @@ int main()

return boost::report_errors();
}
#else
int main() {}
#endif // BOOST_GIL_IO_TEST_ALLOW_READING_IMAGES
5 changes: 0 additions & 5 deletions test/extension/io/targa/targa_write_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

namespace gil = boost::gil;

#ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
void test_write()
{
// test writing all supported image types
Expand All @@ -35,7 +34,6 @@ void test_write()
gil::targa_tag());
}
}
#endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES

void test_rgb_color_space_write()
{
Expand All @@ -46,10 +44,7 @@ void test_rgb_color_space_write()
int main()
{
test_rgb_color_space_write();

#ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
test_write();
#endif

return boost::report_errors();
}

0 comments on commit cc64bdd

Please sign in to comment.