Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82856 - trunk/libs/gil/toolbox/test
From: chhenning_at_[hidden]
Date: 2013-02-13 12:22:31


Author: chhenning
Date: 2013-02-13 12:22:30 EST (Wed, 13 Feb 2013)
New Revision: 82856
URL: http://svn.boost.org/trac/boost/changeset/82856

Log:
Updated some tests to reflect recent changes.
Text files modified:
   trunk/libs/gil/toolbox/test/get_num_bits.cpp | 3
   trunk/libs/gil/toolbox/test/indexed_image_test.cpp | 133 +++++++++++++++++++++++++--------------
   2 files changed, 88 insertions(+), 48 deletions(-)

Modified: trunk/libs/gil/toolbox/test/get_num_bits.cpp
==============================================================================
--- trunk/libs/gil/toolbox/test/get_num_bits.cpp (original)
+++ trunk/libs/gil/toolbox/test/get_num_bits.cpp 2013-02-13 12:22:30 EST (Wed, 13 Feb 2013)
@@ -20,6 +20,9 @@
 
     typedef channel_type< image_t::const_view_t::reference >::type const_channel_t;
     BOOST_STATIC_ASSERT( get_num_bits< const_channel_t >::value == 4 );
+
+ typedef packed_channel_value< 23 > bits_t;
+ BOOST_STATIC_ASSERT( get_num_bits< bits_t >::value == 23 );
 }
 
 BOOST_AUTO_TEST_SUITE_END()

Modified: trunk/libs/gil/toolbox/test/indexed_image_test.cpp
==============================================================================
--- trunk/libs/gil/toolbox/test/indexed_image_test.cpp (original)
+++ trunk/libs/gil/toolbox/test/indexed_image_test.cpp 2013-02-13 12:22:30 EST (Wed, 13 Feb 2013)
@@ -28,72 +28,109 @@
     }
 
     {
+ typedef indexed_image< gray8_pixel_t, rgb8_pixel_t > image_t;
 
- indexed_image< gray8_pixel_t, rgb8_pixel_t > img( 640, 480, 256 );
+ image_t img( 640, 480, 256 );
+
+
+#if __cplusplus >= 201103L
+ generate_pixels( img.get_indices_view()
+ , [] () -> uint8_t
+ {
+ static uint8_t i = 0;
+ i = ( i == 256 ) ? 0 : ++i;
+
+ return gray8_pixel_t( i );
+ }
+ );
+
+
+ generate_pixels( img.get_palette_view()
+ , [] () ->rgb8_pixel_t
+ {
+ static uint8_t i = 0;
+ i = ( i == 256 ) ? 0 : ++i;
+
+ return rgb8_pixel_t( i, i, i );
+ }
+ );
+#else
 
- //generate_pixels( img.get_indices_view()
- // , [] () -> uint8_t
- // {
- // static uint8_t i = 0;
- // i = ( i == 256 ) ? 0 : ++i;
-
- // return gray8_pixel_t( i );
- // }
- // );
-
-
- //generate_pixels( img.get_palette_view()
- // , [] () ->rgb8_pixel_t
- // {
- // static uint8_t i = 0;
- // i = ( i == 256 ) ? 0 : ++i;
-
- // return rgb8_pixel_t( i, i, i );
- // }
- // );
+ image_t::indices_view_t indices = img.get_indices_view();
 
- int i = ( 640 * 10 + 10 ) % 256;
+ for( image_t::indices_view_t::iterator it = indices.begin(); it != indices.end(); ++it )
+ {
+ static uint8_t i = 0;
+ i = ( i == 256 ) ? 0 : ++i;
+
+ *it = gray8_pixel_t( i );
+ }
+
+ image_t::palette_view_t colors = img.get_palette_view();
+ for( image_t::palette_view_t::iterator it = colors.begin(); it != colors.end(); ++it )
+ {
+ static uint8_t i = 0;
+ i = ( i == 256 ) ? 0 : ++i;
+
+ *it = rgb8_pixel_t( i, i, i );
+ }
+#endif
 
         gray8_pixel_t index = *img.get_indices_view().xy_at( 10 , 1 );
         rgb8_pixel_t color = *img.get_palette_view().xy_at( index, 0 );
 
         rgb8_pixel_t p = *view( img ).xy_at( 10, 1 );
-
- i = 9;
     }
 
     {
- indexed_image< uint8_t, rgb8_pixel_t > img( 640, 480, 256 );
+ typedef indexed_image< gray8_pixel_t, rgb8_pixel_t > image_t;
+ image_t img( 640, 480, 256 );
 
- //generate_pixels( img.get_indices_view()
- // , [] () -> uint8_t
- // {
- // static uint8_t i = 0;
- // i = ( i == 256 ) ? 0 : ++i;
-
- // return i;
- // }
- // );
-
-
- //generate_pixels( img.get_palette_view()
- // , [] () ->rgb8_pixel_t
- // {
- // static uint8_t i = 0;
- // i = ( i == 256 ) ? 0 : ++i;
-
- // return rgb8_pixel_t( i, i, i );
- // }
- // );
+#if __cplusplus >= 201103L
+ generate_pixels( img.get_indices_view()
+ , [] () -> uint8_t
+ {
+ static uint8_t i = 0;
+ i = ( i == 256 ) ? 0 : ++i;
+
+ return i;
+ }
+ );
+
+
+ generate_pixels( img.get_palette_view()
+ , [] () ->rgb8_pixel_t
+ {
+ static uint8_t i = 0;
+ i = ( i == 256 ) ? 0 : ++i;
+
+ return rgb8_pixel_t( i, i, i );
+ }
+ );
+#else
+ image_t::indices_view_t indices = img.get_indices_view();
+ for( image_t::indices_view_t::iterator it = indices.begin(); it != indices.end(); ++it )
+ {
+ static uint8_t i = 0;
+ i = ( i == 256 ) ? 0 : ++i;
 
- int i = ( 640 * 10 + 10 ) % 256;
+ *it = gray8_pixel_t( i );
+ }
+
+ image_t::palette_view_t colors = img.get_palette_view();
+ for( image_t::palette_view_t::iterator it = colors.begin(); it != colors.end(); ++it )
+ {
+ static uint8_t i = 0;
+ i = ( i == 256 ) ? 0 : ++i;
+
+ *it = rgb8_pixel_t( i, i, i );
+ }
+#endif
 
         uint8_t index = *img.get_indices_view().xy_at( 10 , 1 );
         rgb8_pixel_t color = *img.get_palette_view().xy_at( index, 0 );
 
         rgb8_pixel_t p = *view( img ).xy_at( 10, 1 );
-
- i = 9;
     }
 
     {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk