root/gilx/trunk/src/test/test_remove_pixel.cpp

Revision 7, 1.2 KB (checked in by anonymous, 13 months ago)

removed FS dependancies.

I was using Boost.Filesystem to create an output directory if none existed. I now use SVN to make sure the directory exists. I also partially switched from using the Boost.Test library in order to use my own ad-hoc testing macros. The idea is that I can remove the dependency on the unit test libraries if that is necessary.

  • Property svn:mime-type set to text/plain
Line 
1
2/******************************************************************************
3 * __LICENCE_BEGIN__
4 *
5 * __LICENCE_END__
6 *****************************************************************************/
7
8///@file
9///@brief Test for i3dea::transform_view<>
10///
11///@author john.femiani@asu.edu
12///
13///
14
15#include <i3dea/test.hpp>
16
17#include <boost/gil/gil_all.hpp>
18#include <i3dea/gil/remove_pixel.hpp>
19
20using namespace i3dea;
21
22//TODO: Test what happens when I 'remove_pixel' from an invalid arg.
23
24int main(int, char**){
25
26    namespace gil = boost::gil;
27
28    gil::gray8_image_t test_(256,256, gil::gray8_pixel_t(1));
29    gil::gray8_view_t  test = view(test_);
30
31    typedef i3dea::result_of::remove_pixelbased<gil::gray8_view_t>::type regular_view;
32
33    regular_view img = i3dea::remove_pixelbased(test);
34
35    for (int r = 0; r < img.height(); ++r) {
36        std::transform(img.row_begin(r),
37                       img.row_end(r),
38                       img.row_begin(r),
39                       std::bind2nd(std::plus<float>(), 3.f)
40                       );
41    }
42
43    I3DEA_CHECK(img(128, 128) == 3.0f);
44
45    regular_view::locator loc;
46    loc = img.xy_at(128, 128);
47    I3DEA_CHECK(*loc == 3.0f);
48
49    return 0;
50}
Note: See TracBrowser for help on using the browser.