olena-2.0-27-g6a27016 Remove extra debug code from last patch. Add tests.

* mln/io/pnm/load.hh: Minor fixes. * tests/io/ppm/Makefile.am, * tests/io/ppm/ppm_ascii.cc, * img/fly_ascii.ppm: Tests and test image.F Signed-off-by: Guillaume Lazzara <z@lrde.epita.fr> --- milena/ChangeLog | 11 ++++++++++- milena/img/fly_ascii.ppm | 9 +++++++++ milena/mln/io/pnm/load.hh | 2 -- milena/tests/io/ppm/Makefile.am | 4 +++- .../tests/io/{dicom/dicom.cc => ppm/ppm_ascii.cc} | 17 +++++++++-------- 5 files changed, 31 insertions(+), 12 deletions(-) create mode 100644 milena/img/fly_ascii.ppm copy milena/tests/io/{dicom/dicom.cc => ppm/ppm_ascii.cc} (78%) diff --git a/milena/ChangeLog b/milena/ChangeLog index 391e5e8..00bbe46 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,8 +1,17 @@ 2012-06-05 Edwin Carlinet <carlinet@lrde.epita.fr> + Remove extra debug code from last patch. Add tests. + + * mln/io/pnm/load.hh: Minor fixes. + * tests/io/ppm/Makefile.am, + * tests/io/ppm/ppm_ascii.cc, + * img/fly_ascii.ppm: Tests and test image. + +2012-06-05 Edwin Carlinet <carlinet@lrde.epita.fr> + Fix issues with loading ascii ppm. - * io/pnm/load.hh: add specials cases to handle vectorial type when + * mln/io/pnm/load.hh: add specials cases to handle vectorial type when loading from ascii ppms. 2011-11-29 Guillaume Lazzara <z@lrde.epita.fr> diff --git a/milena/img/fly_ascii.ppm b/milena/img/fly_ascii.ppm new file mode 100644 index 0000000..5d02169 --- /dev/null +++ b/milena/img/fly_ascii.ppm @@ -0,0 +1,9 @@ +P3 +# CREATOR: GIMP PNM Filter Version 1.1 + +5 5 +255 +201 99 93 200 92 94 208 126 122 208 109 102 162 81 90 189 85 86 198 98 99 +197 138 143 203 149 145 167 94 105 188 87 90 142 64 93 186 107 117 159 84 102 +201 133 123 166 80 95 126 65 103 189 86 96 161 85 98 210 154 131 154 85 98 +113 50 91 201 93 94 204 138 131 173 94 95 diff --git a/milena/mln/io/pnm/load.hh b/milena/mln/io/pnm/load.hh index 88139ec..fee4688 100644 --- a/milena/mln/io/pnm/load.hh +++ b/milena/mln/io/pnm/load.hh @@ -44,7 +44,6 @@ # include <mln/io/pnm/max_component.hh> # include <mln/io/pnm/macros.hh> -# include <mln/trait/value_.hh> # include <mln/metal/is_a.hh> # include <mln/metal/bool.hh> @@ -201,7 +200,6 @@ namespace mln for_all(p) { file >> c; - std::cout << c << std::endl; ima(p) = c; } } diff --git a/milena/tests/io/ppm/Makefile.am b/milena/tests/io/ppm/Makefile.am index 695e5d7..3683d08 100644 --- a/milena/tests/io/ppm/Makefile.am +++ b/milena/tests/io/ppm/Makefile.am @@ -20,11 +20,13 @@ include $(top_srcdir)/milena/tests/tests.mk check_PROGRAMS = \ ppm16 \ ppm23 \ - ppm + ppm \ + ppm_ascii ppm16_SOURCES = ppm16.cc ppm23_SOURCES = ppm23.cc ppm_SOURCES = ppm.cc +ppm_ascii_SOURCES = ppm_ascii.cc TESTS = $(check_PROGRAMS) diff --git a/milena/tests/io/dicom/dicom.cc b/milena/tests/io/ppm/ppm_ascii.cc similarity index 78% copy from milena/tests/io/dicom/dicom.cc copy to milena/tests/io/ppm/ppm_ascii.cc index 1a523cb..8040a9c 100644 --- a/milena/tests/io/dicom/dicom.cc +++ b/milena/tests/io/ppm/ppm_ascii.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2010, 2011 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -24,19 +25,19 @@ // executable file might be covered by the GNU General Public License. #include <mln/core/image/image2d.hh> -#include <mln/io/dicom/load.hh> - +#include <mln/value/rgb8.hh> +#include <mln/io/ppm/load.hh> #include <mln/data/compare.hh> -#include <mln/value/int_u12.hh> - -#include <mln/debug/println.hh> - #include "tests/data.hh" int main() { using namespace mln; + using value::rgb8; + + image2d<rgb8> ima1 = io::ppm::load<rgb8>(MLN_IMG_DIR "/fly.ppm"); + image2d<rgb8> ima2 = io::ppm::load<rgb8>(MLN_IMG_DIR "/fly_ascii.ppm"); - // FIXME: This test is empty! + mln_assertion(ima1 == ima2); } -- 1.7.2.5
participants (1)
-
Edwin Carlinet