bmp_write_test.cpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 bmp_write_test_module
  9. #include <boost/gil.hpp>
  10. #include <boost/gil/io/typedefs.hpp>
  11. #include <boost/gil/extension/io/bmp.hpp>
  12. #include <boost/test/unit_test.hpp>
  13. #include "cmp_view.hpp"
  14. #include "color_space_write_test.hpp"
  15. #include "mandel_view.hpp"
  16. #include "paths.hpp"
  17. using namespace std;
  18. using namespace boost::gil;
  19. using tag_t = bmp_tag;
  20. BOOST_AUTO_TEST_SUITE( gil_io_bmp_tests )
  21. #ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
  22. BOOST_AUTO_TEST_CASE( write_test )
  23. {
  24. // test writing all supported image types
  25. {
  26. write_view( bmp_out + "rgb8_test.bmp"
  27. , create_mandel_view( 200, 200
  28. , rgb8_pixel_t( 0, 0, 255 )
  29. , rgb8_pixel_t( 0, 255, 0 )
  30. )
  31. , tag_t()
  32. );
  33. }
  34. {
  35. write_view( bmp_out + "rgba8_test.bmp"
  36. , create_mandel_view( 200, 200
  37. , rgba8_pixel_t( 0, 0, 255, 0 )
  38. , rgba8_pixel_t( 0, 255, 0, 0 )
  39. )
  40. , tag_t()
  41. );
  42. }
  43. }
  44. #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
  45. BOOST_AUTO_TEST_CASE( rgb_color_space_write_test )
  46. {
  47. color_space_write_test< bmp_tag >( bmp_out + "rgb_color_space_test.bmp"
  48. , bmp_out + "bgr_color_space_test.bmp"
  49. );
  50. }
  51. BOOST_AUTO_TEST_SUITE_END()