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