targa_write_test.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // Copyright 2013 Christian Henning
  3. //
  4. // Distributed under the Boost Software License, Version 1.0
  5. // See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt
  7. //
  8. //#define BOOST_TEST_MODULE targa_write_test_module
  9. #include <boost/gil.hpp>
  10. #include <boost/gil/io/typedefs.hpp>
  11. #include <boost/gil/extension/io/targa.hpp>
  12. #include <boost/test/unit_test.hpp>
  13. #include "color_space_write_test.hpp"
  14. #include "mandel_view.hpp"
  15. #include "paths.hpp"
  16. using namespace std;
  17. using namespace boost::gil;
  18. using tag_t = targa_tag;
  19. BOOST_AUTO_TEST_SUITE( gil_io_targa_tests )
  20. #ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
  21. BOOST_AUTO_TEST_CASE( write_test )
  22. {
  23. // test writing all supported image types
  24. {
  25. write_view( targa_out + "rgb8_test.tga"
  26. , create_mandel_view( 200, 200
  27. , rgb8_pixel_t( 0, 0, 255 )
  28. , rgb8_pixel_t( 0, 255, 0 )
  29. )
  30. , tag_t()
  31. );
  32. }
  33. {
  34. write_view( targa_out + "rgba8_test.tga"
  35. , create_mandel_view( 200, 200
  36. , rgba8_pixel_t( 0, 0, 255, 0 )
  37. , rgba8_pixel_t( 0, 255, 0, 0 )
  38. )
  39. , tag_t()
  40. );
  41. }
  42. }
  43. #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
  44. BOOST_AUTO_TEST_CASE( rgb_color_space_write_test )
  45. {
  46. color_space_write_test< tag_t >( targa_out + "rgb_color_space_test.tga"
  47. , targa_out + "bgr_color_space_test.tga"
  48. );
  49. }
  50. BOOST_AUTO_TEST_SUITE_END()