* tests/filter/small_and_large_bboxes.cc: add real tests.
* tests/table/extract_lines_with_rank.cc: update routine calls.
* tests/table/repair_lines.cc: replace 'essential' include.
---
scribo/ChangeLog | 10 +++++
scribo/tests/filter/small_and_large_bboxes.cc | 45 +++++++++++++++---------
scribo/tests/table/extract_lines_with_rank.cc | 44 ++++++++++++++++++------
scribo/tests/table/repair_lines.cc | 9 ++++-
4 files changed, 79 insertions(+), 29 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 05ca9d5..b1540a0 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,15 @@
2009-05-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Improve and fix tests in Scribo.
+
+ * tests/filter/small_and_large_bboxes.cc: add real tests.
+
+ * tests/table/extract_lines_with_rank.cc: update routine calls.
+
+ * tests/table/repair_lines.cc: replace 'essential' include.
+
+2009-05-28 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Cleanup object filters in Scribo.
* filter/large_components.hh,
diff --git a/scribo/tests/filter/small_and_large_bboxes.cc
b/scribo/tests/filter/small_and_large_bboxes.cc
index 98fbcd7..ddd5b70 100644
--- a/scribo/tests/filter/small_and_large_bboxes.cc
+++ b/scribo/tests/filter/small_and_large_bboxes.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -27,7 +27,12 @@
#include <iostream>
-#include <mln/essential/2d.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/util/graph.hh>
+#include <mln/value/label_16.hh>
+#include <mln/io/pbm/load.hh>
+#include <mln/literal/colors.hh>
#include <scribo/text/extract_bboxes.hh>
#include <scribo/text/grouping/group_with_graph.hh>
@@ -56,7 +61,7 @@ int main(int argc, char* argv[])
if (argc < 2)
{
usage(argv[0]);
- img = SCRIBO_IMG_DIR "/text_to_group.pbm";
+ img = SCRIBO_IMG_DIR "/text_to_group_and_clean.pbm";
}
else
img = argv[1];
@@ -72,27 +77,33 @@ int main(int argc, char* argv[])
mln::util::graph g = text::grouping::group_with_graph(textbboxes, 30);
- std::cout << "BEFORE - nbboxes = " << nbboxes <<
std::endl;
- scribo::debug::save_linked_textbboxes_image(input,
- textbboxes, g,
- literal::red, literal::cyan,
- "test_graph_left_linked.ppm");
+
+ mln_assertion(nbboxes == 12u);
+// std::cout << "BEFORE - nbboxes = " << nbboxes <<
std::endl;
+// scribo::debug::save_linked_textbboxes_image(input,
+// textbboxes, g,
+// literal::red, literal::cyan,
+// "test_graph_left_linked.ppm");
text_t grouped_textbboxes
= text::grouping::group_from_graph(textbboxes, g);
- std::cout << "AFTER - nbboxes = " <<
grouped_textbboxes.nbboxes().next() << std::endl;
+// std::cout << "AFTER - nbboxes = " <<
grouped_textbboxes.nbboxes().next() << std::endl;
+//
+// scribo::debug::save_textbboxes_image(input, grouped_textbboxes.bboxes(),
+// literal::red,
+// "test_graph_grouped_text.ppm");
+
+ mln_assertion(grouped_textbboxes.nbboxes() == 6u);
- scribo::debug::save_textbboxes_image(input, grouped_textbboxes.bboxes(),
- literal::red,
- "test_graph_grouped_text.ppm");
+ text_t
+ filtered_textbboxes = scribo::filter::small_components(grouped_textbboxes, 20);
- text_t filtered_textbboxes
- = scribo::filter::small_components(grouped_textbboxes, 6);
+ mln_assertion(filtered_textbboxes.nbboxes() == 2u);
- scribo::debug::save_textbboxes_image(input, filtered_textbboxes.bboxes(),
- literal::red,
- "test_graph_filtered_text.ppm");
+// scribo::debug::save_textbboxes_image(input, filtered_textbboxes.bboxes(),
+// literal::red,
+// "test_graph_filtered_text.ppm");
}
diff --git a/scribo/tests/table/extract_lines_with_rank.cc
b/scribo/tests/table/extract_lines_with_rank.cc
index 16e8066..436cc7e 100644
--- a/scribo/tests/table/extract_lines_with_rank.cc
+++ b/scribo/tests/table/extract_lines_with_rank.cc
@@ -26,10 +26,25 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#include <mln/essential/2d.hh>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/box2d.hh>
+#include <mln/make/box2d.hh>
+#include <mln/util/array.hh>
#include <mln/util/couple.hh>
+#include <mln/io/pbm/load.hh>
+#include <mln/value/label_8.hh>
+#include <mln/win/vline2d.hh>
+#include <mln/win/hline2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+
+#include <mln/literal/colors.hh>
+
+#include <mln/io/pgm/save.hh>
+
+#include <scribo/extract/primitive/lines_h_discontinued.hh>
+#include <scribo/extract/primitive/lines_v_discontinued.hh>
-#include <scribo/primitive/discontinued_lines.hh>
#include <scribo/debug/save_table_image.hh>
#include <scribo/tests/data.hh>
@@ -53,18 +68,25 @@ int main(int argc, char *argv[])
vboxes,
hboxes;
vboxes.append(make::box2d(0,0, 59,59));
- vboxes.append(make::box2d(0,28, 27, 32));
- vboxes.append(make::box2d(31,28, 59,32));
+ vboxes.append(make::box2d(0,28, 25, 32));
+ vboxes.append(make::box2d(33,28, 59,32));
hboxes.append(make::box2d(0,0, 59,59));
- hboxes.append(make::box2d(27,0, 31, 26));
- hboxes.append(make::box2d(27,34, 31,59));
+ hboxes.append(make::box2d(27,0, 31, 24));
+ hboxes.append(make::box2d(27,36, 31,59));
+
+ value::label_8 nbboxes;
- value::label_16 nbboxes;
+ lineboxes_t hboxes_, vboxes_;
- lineboxes_t hboxes_ = scribo::primitive::discontinued_lines(input, c8(),
- nbboxes, win::hline2d(11), 2);
- lineboxes_t vboxes_ = scribo::primitive::discontinued_lines(input, c8(),
- nbboxes, win::vline2d(11), 2);
+ typedef image2d<value::label_8> lbl_t;
+ lbl_t
+ hlbl = scribo::extract::primitive::lines_h_discontinued(input, c8(),
+ nbboxes, 11, 2,
+ hboxes_);
+ lbl_t
+ vlbl = scribo::extract::primitive::lines_v_discontinued(input, c8(),
+ nbboxes, 11, 2,
+ vboxes_);
mln_assertion(hboxes_ == hboxes);
mln_assertion(vboxes_ == vboxes);
}
diff --git a/scribo/tests/table/repair_lines.cc b/scribo/tests/table/repair_lines.cc
index ff7e92f..995d52b 100644
--- a/scribo/tests/table/repair_lines.cc
+++ b/scribo/tests/table/repair_lines.cc
@@ -26,8 +26,15 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#include <mln/essential/2d.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/box2d.hh>
+#include <mln/make/box2d.hh>
+#include <mln/util/array.hh>
#include <mln/util/couple.hh>
+#include <mln/io/pbm/load.hh>
+#include <mln/value/label_16.hh>
+#include <mln/win/vline2d.hh>
+#include <mln/win/hline2d.hh>
#include <scribo/table/repair_vertical_lines.hh>
#include <scribo/table/repair_horizontal_lines.hh>
--
1.5.6.5