TuttleOFX
1
|
00001 #include <boost/test/included/unit_test.hpp> 00002 00003 #include <shrink.hpp> 00004 #include <fill.hpp> 00005 00006 using boost::unit_test::test_suite; 00007 using namespace boost::gil; 00008 00009 //g++ shrink.tests.cpp -I /home/scott/project/boost_1_36_0 -I . 00010 00011 struct test1 00012 { 00013 void operator()() 00014 { 00015 int width = 200; 00016 int height = 200; 00017 unsigned char* buffer = new unsigned char[width * height * 3]; 00018 memset(buffer, 255, width * height * 3); 00019 rgb8_view_t view = interleaved_view(width,height,(rgb8_pixel_t*)buffer,width*3); 00020 00021 rgb8_view_t::value_type black(0,0,0); 00022 layer::fill<rgb8_view_t> fill(black); 00023 layer::shrink<rgb8_view_t> shrink(fill,0.20,0.30,0.20,0.30); 00024 shrink(view); 00025 00026 FILE* fd = fopen("shrink.ppm", "wb"); 00027 fprintf(fd, "P6\n# CREATOR: reportbase\n%d %d\n255\n", width, height); 00028 fwrite(buffer, 1, width*height*3, fd); 00029 fclose(fd); 00030 delete [] buffer; 00031 } 00032 }; 00033 00034 test_suite* init_unit_test_suite( int argc, char** argv) 00035 { 00036 test_suite* test= BOOST_TEST_SUITE( "rounded tests" ); 00037 test->add( BOOST_TEST_CASE(test1()), 0); 00038 return test; 00039 }