[glom/spread-table] Added test_flowtablewithfields.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/spread-table] Added test_flowtablewithfields.
- Date: Mon, 8 Nov 2010 13:29:02 +0000 (UTC)
commit 8069e152f694a10804d9c82fc216218f5215d67d
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Nov 8 14:28:41 2010 +0100
Added test_flowtablewithfields.
* Makefile_tests.am:
* glom/mode_data/test_flowtablewithfields.cc: Added the beginnings of a test
of FlowTableWithFields.
ChangeLog | 8 +++
Makefile_tests.am | 6 ++
glom/mode_data/test_flowtablewithfields.cc | 73 +++++++++-------------------
3 files changed, 38 insertions(+), 49 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9f7eb49..32530e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-11-08 Murray Cumming <murrayc murrayc com>
+
+ Added test_flowtablewithfields.
+
+ * Makefile_tests.am:
+ * glom/mode_data/test_flowtablewithfields.cc: Added the beginnings of a test
+ of FlowTableWithFields.
+
2010-11-05 Murray Cumming <murrayc murrayc com>
Use EggSpreadTable instead of GtkSpreadTable (not added to GTK+).
diff --git a/Makefile_tests.am b/Makefile_tests.am
index 0bf7a2c..f5ea6c8 100644
--- a/Makefile_tests.am
+++ b/Makefile_tests.am
@@ -20,6 +20,7 @@ check_PROGRAMS = \
glom/libglom/example_document_load \
glom/libglom/test_sharedptr_layoutitem \
glom/utility_widgets/test_flowtable \
+ glom/mode_data/test_flowtablewithfields \
glom/test_pyembed \
tests/test_document_load \
tests/test_document_autosave \
@@ -124,6 +125,11 @@ glom_utility_widgets_test_flowtable_SOURCES = \
glom/utility_widgets/test_flowtable.cc
glom_utility_widgets_test_flowtable_LDADD = $(GLOM_LIBS)
+glom_mode_data_test_flowtablewithfields_SOURCES = \
+ $(glom_source_files) \
+ glom/mode_data/test_flowtablewithfields.cc
+glom_mode_data_test_flowtablewithfields_LDADD = $(glom_all_libs)
+
# You must remove PlaceholderGlom::get_application() to avoid having to specify
# a huge set of .cc files when building this test:
diff --git a/glom/mode_data/test_flowtablewithfields.cc b/glom/mode_data/test_flowtablewithfields.cc
index 92a357d..e7ee110 100644
--- a/glom/mode_data/test_flowtablewithfields.cc
+++ b/glom/mode_data/test_flowtablewithfields.cc
@@ -19,7 +19,7 @@
*/
#include <gtkmm.h>
-#include "flowtable.h"
+#include <glom/mode_data/flowtablewithfields.h>
#include <iostream>
@@ -37,59 +37,34 @@ void on_drag_data_get_entry(const Glib::RefPtr<Gdk::DragContext>&, Gtk::Selectio
}
*/
-typedef std::list<Gtk::Widget*> type_vec_widgets;
-type_vec_widgets vec_child_widgets;
-
-static void fill_flowtable(Glom::FlowTable& flowtable)
+static void fill_flowtable(Glom::FlowTableWithFields& flowtable)
{
- Gtk::Entry* button1 = Gtk::manage(new Gtk::Entry());
- button1->set_text("seven");
- button1->show();
- //button1->set_size_request(100, 100);
- vec_child_widgets.push_back(button1);
-
- Gtk::Entry* button2 = Gtk::manage(new Gtk::Entry());
- button2->set_text("eight");
- flowtable.add(*button1, *button2);
- button2->show();
- //button2->set_size_request(100, 100);
- vec_child_widgets.push_back(button2);
-
- Gtk::Label* button3 = Gtk::manage(new Gtk::Label());
- button3->set_text("nine"); //TODO: valgrind says that something here is leaked.
- button3->show();
- //button1->set_size_request(100, 100);
- vec_child_widgets.push_back(button3);
-
- Gtk::Entry* button4 = Gtk::manage(new Gtk::Entry());
- button4->set_text("ten");
- flowtable.add(*button3, *button4);
- button4->show();
- vec_child_widgets.push_back(button4);
-
- Gtk::Entry* button5 = Gtk::manage(new Gtk::Entry());
- button5->set_text("eleven");
- Gtk::Entry* button6 = Gtk::manage(new Gtk::Entry());
- button5->set_text("eleven");
- flowtable.add(*button5, *button6);
- button5->show();
- button6->show();
- vec_child_widgets.push_back(button5);
- vec_child_widgets.push_back(button6);
-}
+ {
+ Glom::sharedptr<Glom::LayoutItem_Text> item =
+ Glom::sharedptr<Glom::LayoutItem_Text>::create();
+ item->set_text("test static text 1");
+ flowtable.add_layout_item(item);
+ }
-static void clear_flowtable(Glom::FlowTable& flowtable)
-{
- //std::cout << G_STRFUNC << ": debug 1" << std::endl;
- for(type_vec_widgets::iterator iter = vec_child_widgets.begin(); iter != vec_child_widgets.end(); ++iter)
{
- Gtk::Widget* widget = *iter;
- //std::cout << " loop: widget=" << widget << std::endl;
- delete widget;
+ Glom::sharedptr<Glom::LayoutItem_Text> item =
+ Glom::sharedptr<Glom::LayoutItem_Text>::create();
+ item->set_text("test static text 2");
+ item->set_title("title for text 2");
+ flowtable.add_layout_item(item);
}
- vec_child_widgets.clear();
+ {
+ Glom::sharedptr<Glom::LayoutItem_Image> item =
+ Glom::sharedptr<Glom::LayoutItem_Image>::create();
+ //item->set_image(somevalue);
+ item->set_title("title for image");
+ flowtable.add_layout_item(item);
+ }
+}
+static void clear_flowtable(Glom::FlowTableWithFields& flowtable)
+{
flowtable.remove_all();
}
@@ -100,7 +75,7 @@ main(int argc, char* argv[])
Gtk::Window window;
//Gtk::VBox flowtable;
- Glom::FlowTable flowtable;
+ Glom::FlowTableWithFields flowtable;
flowtable.set_lines(2);
flowtable.set_horizontal_spacing(6);
flowtable.set_vertical_spacing(6);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]