From 8660201cd21e0b1afea66a78ea6b0d8401d3f5fd Mon Sep 17 00:00:00 2001 From: Michael Dominic Kostrzewa Date: Thu, 18 Jan 2007 09:33:10 +0000 Subject: [PATCH] Moving "composite widget" to private since essentially it's just a handy private function. Removing the composite test case, since it's external/not exported anymore. --- ChangeLog.2 | 22 +++++ src/Makefile.am | 4 +- src/hildon-composite-widget.c | 80 ---------------- src/hildon-composite-widget.h | 51 ---------- src/hildon-date-editor.c | 4 +- src/hildon-number-editor.c | 8 +- src/hildon-private.c | 87 +++++++++++++++++ src/hildon-private.h | 38 ++++++++ src/hildon-time-editor.c | 4 +- src/hildon-weekday-picker.c | 4 +- src/hildon.h | 1 - tests/Makefile.am | 1 - tests/Makefile.in | 32 +------ tests/TEST-CASES.txt | 22 ----- tests/check-hildon-composite-widget.c | 169 --------------------------------- tests/check_test.c | 1 - 16 files changed, 161 insertions(+), 367 deletions(-) delete mode 100644 src/hildon-composite-widget.c delete mode 100644 src/hildon-composite-widget.h create mode 100644 src/hildon-private.c create mode 100644 src/hildon-private.h delete mode 100644 tests/check-hildon-composite-widget.c diff --git a/ChangeLog.2 b/ChangeLog.2 index 6b48620..efdc70d 100644 --- a/ChangeLog.2 +++ b/ChangeLog.2 @@ -1,5 +1,27 @@ 2007-01-18 Michael Dominic Kostrzewa + * src/hildon-composite-widget.c: + * src/hildon-composite-widget.h: + * src/hildon-date-editor.c: + * src/hildon-number-editor.c: + * src/hildon-time-editor.c: + * src/hildon-weekday-picker.c: + * src/Makefile.am: + * src/hildon-private.c: + * src/hildon-private.h: Moving "composite widget" to private since + essentially it's just a handy private function. + + * src/hildon.h: Removing it from exported headers. + + * tests/Makefile.am: + * tests/Makefile.in: + * tests/TEST-CASES.txt: + * tests/check-hildon-composite-widget.c: + * tests/check_test.c: Removing the composite test case, since it's + external/not exported anymore. + +2007-01-18 Michael Dominic Kostrzewa + * debian/changelog: Adding missing. * src/hildon-banner.c: Modyfying to allow creation with null window. diff --git a/src/Makefile.am b/src/Makefile.am index 2147014..cc7e55e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,7 +21,7 @@ libhildon_@PACKAGE_VERSION_MAJOR@_la_CFLAGS = $(GTK_CFLAGS) \ $(GCONF_CFLAGS) \ $(ESD_CFLAGS) -libhildon_@PACKAGE_VERSION_MAJOR@_la_SOURCES = hildon-composite-widget.c \ +libhildon_@PACKAGE_VERSION_MAJOR@_la_SOURCES = hildon-private.c \ hildon-controlbar.c \ hildon-seekbar.c \ hildon-note.c \ @@ -65,7 +65,6 @@ libhildon_@PACKAGE_VERSION_MAJOR@_include_HEADERS = hildon-banner.h \ hildon-color-button.h \ hildon-color-chooser-dialog.h \ hildon-color-chooser.h \ - hildon-composite-widget.h \ hildon-controlbar.h \ hildon-date-editor.h \ hildon-defines.h \ @@ -97,6 +96,7 @@ libhildon_@PACKAGE_VERSION_MAJOR@_include_HEADERS = hildon-banner.h \ noinst_HEADERS = hildon-banner-private.h \ hildon-calendar-popup-private.h \ + hildon-private.h \ hildon-caption-private.h \ hildon-code-dialog-private.h \ hildon-color-button-private.h \ diff --git a/src/hildon-composite-widget.c b/src/hildon-composite-widget.c deleted file mode 100644 index 7d19249..0000000 --- a/src/hildon-composite-widget.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is a part of hildon - * - * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved. - * - * Contact: Michael Dominic Kostrzewa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; version 2.1 of - * the License. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include "hildon-composite-widget.h" -#include -#include -#include "hildon-date-editor.h" -#include "hildon-time-editor.h" - -/* This function is a private function of hildon. It hadles focus - * changing for composite hildon widgets: HildonDateEditor, - * HildonNumberEditor, HildonTimeEditor, HildonWeekdayPicker. - * Its purpose is to focus the first widget (from left) inside the container - * regardless of where the focus is coming from. - */ -gboolean -hildon_composite_widget_focus (GtkWidget *widget, GtkDirectionType direction) -{ - GtkWidget *toplevel = NULL; - GtkWidget *focus_widget = NULL; - - /* Get the topmost parent widget */ - toplevel = gtk_widget_get_toplevel (widget); - if (!GTK_IS_WINDOW(toplevel)) - return GTK_WIDGET_CLASS (g_type_class_peek_parent ( - GTK_WIDGET_GET_CLASS (widget)))->focus (widget, direction); - /* Get focus widget in the topmost parent widget */ - focus_widget = GTK_WINDOW (toplevel)->focus_widget; - - if (!GTK_IS_WIDGET (focus_widget)) - return TRUE; - - if (!gtk_widget_is_ancestor (focus_widget, widget)) - { - gtk_widget_grab_focus (widget); - } - else - { - /* Containers grab_focus grabs the focus to the correct widget */ - switch (direction) { - case GTK_DIR_UP: - case GTK_DIR_DOWN: - if (HILDON_IS_DATE_EDITOR(widget) || HILDON_IS_TIME_EDITOR(widget)) - return FALSE; - else - return GTK_WIDGET_CLASS (g_type_class_peek_parent - (GTK_WIDGET_GET_CLASS(widget)))->focus (widget, direction); - break; - - default: - return GTK_WIDGET_CLASS (g_type_class_peek_parent - (GTK_WIDGET_GET_CLASS(widget)))->focus (widget, direction); - break; - } - } - - return TRUE; -} diff --git a/src/hildon-composite-widget.h b/src/hildon-composite-widget.h deleted file mode 100644 index d1c44a5..0000000 --- a/src/hildon-composite-widget.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is a part of hildon - * - * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved. - * - * Contact: Michael Dominic Kostrzewa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; version 2.1 of - * the License. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -/* - * @file - * - * Hildon composite widget includes all features which were not fitting into - * the any current class. A new, separate widget was not created because of the - * amount of current features is low. Need for this kind of class was not known - * when the building of the class hierarchy began. When a new feature is added, - * need for a new class should be re-considered. To make this decision one - * should really consider all the common features which are needed in the - * hildon composite widgets. Class position (for hildon-composite-widget) - * in the class hierarchy is between GtkContainer and any composite widget. - * - */ - -#ifndef __HILDON_COMPOSITE_WIDGET__ -#define __HILDON_COMPOSITE_WIDGET__ - -#include - -G_BEGIN_DECLS - -gboolean -hildon_composite_widget_focus( GtkWidget *widget, GtkDirectionType direction ); - -G_END_DECLS - -#endif /*__HILDON_COMPOSITE_WIDGET__*/ diff --git a/src/hildon-date-editor.c b/src/hildon-date-editor.c index afb53c8..2a9da08 100644 --- a/src/hildon-date-editor.c +++ b/src/hildon-date-editor.c @@ -48,7 +48,7 @@ #include "hildon-calendar-popup.h" #include "hildon-defines.h" #include "hildon-input-mode-hint.h" -#include "hildon-composite-widget.h" +#include "hildon-private.h" #include "hildon-marshalers.h" #include "hildon-enum-types.h" #include "hildon-time-editor.h" @@ -213,7 +213,7 @@ hildon_date_editor_class_init (HildonDateEditorClass *editor_c gobject_class->get_property = hildon_date_editor_get_property; widget_class->size_request = hildon_date_editor_size_request; widget_class->size_allocate = hildon_date_editor_size_allocate; - widget_class->focus = hildon_composite_widget_focus; + widget_class->focus = hildon_private_composite_focus; container_class->forall = hildon_child_forall; GTK_OBJECT_CLASS(editor_class)->destroy = hildon_date_editor_destroy; diff --git a/src/hildon-number-editor.c b/src/hildon-number-editor.c index 7827734..a801060 100644 --- a/src/hildon-number-editor.c +++ b/src/hildon-number-editor.c @@ -42,7 +42,7 @@ #include #include #include "hildon-marshalers.h" -#include "hildon-composite-widget.h" +#include "hildon-private.h" #include "hildon-input-mode-hint.h" #include "hildon-defines.h" #include "hildon-enum-types.h" @@ -204,9 +204,9 @@ hildon_number_editor_class_init (HildonNumberEditorClass *editor parent_class = g_type_class_peek_parent (editor_class); - widget_class->size_request = hildon_number_editor_size_request; - widget_class->size_allocate = hildon_number_editor_size_allocate; - widget_class->focus = hildon_composite_widget_focus; + widget_class->size_request = hildon_number_editor_size_request; + widget_class->size_allocate = hildon_number_editor_size_allocate; + widget_class->focus = hildon_private_composite_focus; editor_class->range_error = hildon_number_editor_range_error; diff --git a/src/hildon-private.c b/src/hildon-private.c new file mode 100644 index 0000000..ebec6ba --- /dev/null +++ b/src/hildon-private.c @@ -0,0 +1,87 @@ +/* + * This file is a part of hildon + * + * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved. + * + * Contact: Michael Dominic Kostrzewa + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; version 2.1 of + * the License. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "hildon-private.h" +#include +#include +#include "hildon-date-editor.h" +#include "hildon-time-editor.h" + +/* This function is a private function of hildon. It hadles focus + * changing for composite hildon widgets: HildonDateEditor, + * HildonNumberEditor, HildonTimeEditor, HildonWeekdayPicker. + * Its purpose is to focus the first widget (from left) inside the container + * regardless of where the focus is coming from. + */ +gboolean G_GNUC_INTERNAL +hildon_private_composite_focus (GtkWidget *widget, + GtkDirectionType direction) +{ + GtkWidget *toplevel = NULL; + GtkWidget *focus_widget = NULL; + + /* Get the topmost parent widget */ + toplevel = gtk_widget_get_toplevel (widget); + + if (! GTK_IS_WINDOW (toplevel)) + return GTK_WIDGET_CLASS (g_type_class_peek_parent ( + GTK_WIDGET_GET_CLASS (widget)))->focus (widget, direction); + /* Get focus widget in the topmost parent widget */ + focus_widget = GTK_WINDOW (toplevel)->focus_widget; + + if (! GTK_IS_WIDGET (focus_widget)) + return TRUE; + + if (! gtk_widget_is_ancestor (focus_widget, widget)) + { + gtk_widget_grab_focus (widget); + } + else + { + /* Containers grab_focus grabs the focus to the correct widget */ + switch (direction) { + case GTK_DIR_UP: + case GTK_DIR_DOWN: + if (HILDON_IS_DATE_EDITOR (widget) || HILDON_IS_TIME_EDITOR(widget)) + return FALSE; + else + return GTK_WIDGET_CLASS (g_type_class_peek_parent + (GTK_WIDGET_GET_CLASS(widget)))->focus (widget, direction); + break; + + default: + return GTK_WIDGET_CLASS (g_type_class_peek_parent + (GTK_WIDGET_GET_CLASS(widget)))->focus (widget, direction); + break; + } + } + + return TRUE; +} + + diff --git a/src/hildon-private.h b/src/hildon-private.h new file mode 100644 index 0000000..5f3a86f --- /dev/null +++ b/src/hildon-private.h @@ -0,0 +1,38 @@ +/* + * This file is a part of hildon + * + * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved. + * + * Contact: Michael Dominic Kostrzewa + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; version 2.1 of + * the License. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#ifndef __HILDON_PRIVATE_H__ +#define __HILDON_PRIVATE_H__ + +#include + +G_BEGIN_DECLS + +gboolean G_GNUC_INTERNAL +hildon_private_composite_focus (GtkWidget *widget, + GtkDirectionType direction); + +G_END_DECLS + +#endif /* __HILDON_PRIVATE_H__ */ diff --git a/src/hildon-time-editor.c b/src/hildon-time-editor.c index c8986ff..d22fbbe 100644 --- a/src/hildon-time-editor.c +++ b/src/hildon-time-editor.c @@ -55,7 +55,7 @@ #include "hildon-time-picker.h" #include "hildon-banner.h" #include "hildon-input-mode-hint.h" -#include "hildon-composite-widget.h" +#include "hildon-private.h" #include "hildon-marshalers.h" #include "hildon-enum-types.h" #include "hildon-time-editor-private.h" @@ -336,7 +336,7 @@ hildon_time_editor_class_init (HildonTimeEditorClass *editor_c widget_class->size_request = hildon_time_editor_size_request; widget_class->size_allocate = hildon_time_editor_size_allocate; widget_class->tap_and_hold_setup = hildon_time_editor_tap_and_hold_setup; - widget_class->focus = hildon_composite_widget_focus; + widget_class->focus = hildon_private_composite_focus; container_class->forall = hildon_time_editor_forall; GTK_OBJECT_CLASS (editor_class)->destroy = hildon_time_editor_destroy; diff --git a/src/hildon-weekday-picker.c b/src/hildon-weekday-picker.c index 67c0f00..e8099a1 100644 --- a/src/hildon-weekday-picker.c +++ b/src/hildon-weekday-picker.c @@ -59,7 +59,7 @@ #include #include #include -#include "hildon-composite-widget.h" +#include "hildon-private.h" #include "hildon-weekday-picker-private.h" static GtkContainerClass* parent_class; @@ -137,7 +137,7 @@ hildon_weekday_picker_class_init (HildonWeekdayPickerClass *picke /* Override virtual methods */ widget_class->size_request = hildon_weekday_picker_size_request; widget_class->size_allocate = hildon_weekday_picker_size_allocate; - widget_class->focus = hildon_composite_widget_focus; + widget_class->focus = hildon_private_composite_focus; container_class->forall = hildon_weekday_picker_forall; GTK_OBJECT_CLASS (picker_class)->destroy = hildon_weekday_picker_destroy; diff --git a/src/hildon.h b/src/hildon.h index 9ba5e25..42bf827 100644 --- a/src/hildon.h +++ b/src/hildon.h @@ -32,7 +32,6 @@ #include "hildon-color-button.h" #include "hildon-color-chooser-dialog.h" #include "hildon-color-chooser.h" -#include "hildon-composite-widget.h" #include "hildon-controlbar.h" #include "hildon-date-editor.h" #include "hildon-defines.h" diff --git a/tests/Makefile.am b/tests/Makefile.am index 22ddb55..3af5ef6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -26,7 +26,6 @@ check_test_SOURCES = check_test.c \ check-hildon-font-selection-dialog.c \ check-hildon-window.c \ check-hildon-program.c \ - check-hildon-composite-widget.c \ check-hildon-color-button.c \ check-hildon-color-chooser.c diff --git a/tests/Makefile.in b/tests/Makefile.in index 78a773b..74e191a 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -63,8 +63,8 @@ am__check_test_SOURCES_DIST = check_test.c check_utils.c \ check-hildon-volumebar-range.c check-hildon-banner.c \ check-hildon-wizard-dialog.c \ check-hildon-font-selection-dialog.c check-hildon-window.c \ - check-hildon-program.c check-hildon-composite-widget.c \ - check-hildon-color-button.c check-hildon-color-chooser.c + check-hildon-program.c check-hildon-color-button.c \ + check-hildon-color-chooser.c @BUILD_TESTS_TRUE@am_check_test_OBJECTS = \ @BUILD_TESTS_TRUE@ check_test-check_test.$(OBJEXT) \ @BUILD_TESTS_TRUE@ check_test-check_utils.$(OBJEXT) \ @@ -90,7 +90,6 @@ am__check_test_SOURCES_DIST = check_test.c check_utils.c \ @BUILD_TESTS_TRUE@ check_test-check-hildon-font-selection-dialog.$(OBJEXT) \ @BUILD_TESTS_TRUE@ check_test-check-hildon-window.$(OBJEXT) \ @BUILD_TESTS_TRUE@ check_test-check-hildon-program.$(OBJEXT) \ -@BUILD_TESTS_TRUE@ check_test-check-hildon-composite-widget.$(OBJEXT) \ @BUILD_TESTS_TRUE@ check_test-check-hildon-color-button.$(OBJEXT) \ @BUILD_TESTS_TRUE@ check_test-check-hildon-color-chooser.$(OBJEXT) check_test_OBJECTS = $(am_check_test_OBJECTS) @@ -105,7 +104,6 @@ am__depfiles_maybe = depfiles @AMDEP_TRUE@ ./$(DEPDIR)/check_test-check-hildon-code-dialog.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/check_test-check-hildon-color-button.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/check_test-check-hildon-color-chooser.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/check_test-check-hildon-composite-widget.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/check_test-check-hildon-controlbar.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/check_test-check-hildon-date-editor.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/check_test-check-hildon-defines.Po \ @@ -307,7 +305,6 @@ target_vendor = @target_vendor@ @BUILD_TESTS_TRUE@ check-hildon-font-selection-dialog.c \ @BUILD_TESTS_TRUE@ check-hildon-window.c \ @BUILD_TESTS_TRUE@ check-hildon-program.c \ -@BUILD_TESTS_TRUE@ check-hildon-composite-widget.c \ @BUILD_TESTS_TRUE@ check-hildon-color-button.c \ @BUILD_TESTS_TRUE@ check-hildon-color-chooser.c @@ -370,7 +367,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_test-check-hildon-code-dialog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_test-check-hildon-color-button.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_test-check-hildon-color-chooser.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_test-check-hildon-composite-widget.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_test-check-hildon-controlbar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_test-check-hildon-date-editor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_test-check-hildon-defines.Po@am__quote@ @@ -992,30 +988,6 @@ check_test-check-hildon-program.lo: check-hildon-program.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -c -o check_test-check-hildon-program.lo `test -f 'check-hildon-program.c' || echo '$(srcdir)/'`check-hildon-program.c -check_test-check-hildon-composite-widget.o: check-hildon-composite-widget.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -MT check_test-check-hildon-composite-widget.o -MD -MP -MF "$(DEPDIR)/check_test-check-hildon-composite-widget.Tpo" -c -o check_test-check-hildon-composite-widget.o `test -f 'check-hildon-composite-widget.c' || echo '$(srcdir)/'`check-hildon-composite-widget.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_test-check-hildon-composite-widget.Tpo" "$(DEPDIR)/check_test-check-hildon-composite-widget.Po"; else rm -f "$(DEPDIR)/check_test-check-hildon-composite-widget.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='check-hildon-composite-widget.c' object='check_test-check-hildon-composite-widget.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/check_test-check-hildon-composite-widget.Po' tmpdepfile='$(DEPDIR)/check_test-check-hildon-composite-widget.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -c -o check_test-check-hildon-composite-widget.o `test -f 'check-hildon-composite-widget.c' || echo '$(srcdir)/'`check-hildon-composite-widget.c - -check_test-check-hildon-composite-widget.obj: check-hildon-composite-widget.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -MT check_test-check-hildon-composite-widget.obj -MD -MP -MF "$(DEPDIR)/check_test-check-hildon-composite-widget.Tpo" -c -o check_test-check-hildon-composite-widget.obj `if test -f 'check-hildon-composite-widget.c'; then $(CYGPATH_W) 'check-hildon-composite-widget.c'; else $(CYGPATH_W) '$(srcdir)/check-hildon-composite-widget.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_test-check-hildon-composite-widget.Tpo" "$(DEPDIR)/check_test-check-hildon-composite-widget.Po"; else rm -f "$(DEPDIR)/check_test-check-hildon-composite-widget.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='check-hildon-composite-widget.c' object='check_test-check-hildon-composite-widget.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/check_test-check-hildon-composite-widget.Po' tmpdepfile='$(DEPDIR)/check_test-check-hildon-composite-widget.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -c -o check_test-check-hildon-composite-widget.obj `if test -f 'check-hildon-composite-widget.c'; then $(CYGPATH_W) 'check-hildon-composite-widget.c'; else $(CYGPATH_W) '$(srcdir)/check-hildon-composite-widget.c'; fi` - -check_test-check-hildon-composite-widget.lo: check-hildon-composite-widget.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -MT check_test-check-hildon-composite-widget.lo -MD -MP -MF "$(DEPDIR)/check_test-check-hildon-composite-widget.Tpo" -c -o check_test-check-hildon-composite-widget.lo `test -f 'check-hildon-composite-widget.c' || echo '$(srcdir)/'`check-hildon-composite-widget.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_test-check-hildon-composite-widget.Tpo" "$(DEPDIR)/check_test-check-hildon-composite-widget.Plo"; else rm -f "$(DEPDIR)/check_test-check-hildon-composite-widget.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='check-hildon-composite-widget.c' object='check_test-check-hildon-composite-widget.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/check_test-check-hildon-composite-widget.Plo' tmpdepfile='$(DEPDIR)/check_test-check-hildon-composite-widget.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -c -o check_test-check-hildon-composite-widget.lo `test -f 'check-hildon-composite-widget.c' || echo '$(srcdir)/'`check-hildon-composite-widget.c - check_test-check-hildon-color-button.o: check-hildon-color-button.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_test_CFLAGS) $(CFLAGS) -MT check_test-check-hildon-color-button.o -MD -MP -MF "$(DEPDIR)/check_test-check-hildon-color-button.Tpo" -c -o check_test-check-hildon-color-button.o `test -f 'check-hildon-color-button.c' || echo '$(srcdir)/'`check-hildon-color-button.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_test-check-hildon-color-button.Tpo" "$(DEPDIR)/check_test-check-hildon-color-button.Po"; else rm -f "$(DEPDIR)/check_test-check-hildon-color-button.Tpo"; exit 1; fi diff --git a/tests/TEST-CASES.txt b/tests/TEST-CASES.txt index a16e437..1a86350 100644 --- a/tests/TEST-CASES.txt +++ b/tests/TEST-CASES.txt @@ -3275,28 +3275,6 @@ the list of tests (Section 2). Use the following example as a template: ---------------------------------------------------------------------------------------- -- hildon-composite-widget: Handles focus behavior for hildon composite widgets. - - - hildon_composite_widget_focus: Handles focus behavior - - - Errors detected: 2.b), 2.c) - 2.b) -> segmentation fault - 2.c) -> segmentation fault - - 1. Set a common color - a) Check with a composite widget (hildon_time_editor) - b) Check with a composite widget (hildon_time_editor) inside a window - c) Check with a composite widget (hildon_time_editor) inside a window and focus already given to the window - - 2. Test that invalid parameters do not cause problems - a) Check with non composite widget (gtkentry) - b) Check with NULL widget - c) Check with invalid direction (GTK_DIR_RIGHT+1) - d) Check with non composite widget (gtkentry) inside a window - e) Check with invalid direction (GTK_DIR_RIGHT+1) inside a window - ----------------------------------------------------------------------------------------- - - hildon-add-home-dialog: - Property "name": [TODO] diff --git a/tests/check-hildon-composite-widget.c b/tests/check-hildon-composite-widget.c deleted file mode 100644 index 10fca91..0000000 --- a/tests/check-hildon-composite-widget.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (C) 2006 Nokia Corporation. - * - * Contact: Luc Pionchon - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include -#include -#include -#include -#include "test_suites.h" -#include "check_utils.h" -#include - -#include "hildon-composite-widget.h" -#include "hildon-time-editor.h" - -/* -------------------- Fixtures ---------------------- */ - -static void -fx_setup_gtk () -{ - int argc = 0; - gtk_init(&argc, NULL); -} - -static void -fx_teardown_gtk () -{ -} - -/* -------------------- Test cases -------------------- */ - -/* ----- Test case for focus -----*/ - -/** - * Purpose: Test regular usage - * Cases considered: - * - Check with a composite widget (hildon_time_editor) - * - Check with a composite widget (hildon_time_editor) inside a window - * - check with a composite widget (hildon_time_editor) inside a window and a focus already given to the window - */ -START_TEST (test_focus_regular) -{ - GtkWidget *time_editor; - GtkWindow *window; - - /* Test1: check with a composite widget */ - time_editor = hildon_time_editor_new(); - - hildon_composite_widget_focus(time_editor, GTK_DIR_RIGHT); - - gtk_widget_destroy(GTK_WIDGET(time_editor)); - - /* Test2: check with a composite widget (inside a window) */ - window = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); - time_editor = hildon_time_editor_new(); - gtk_container_add(GTK_CONTAINER(window), time_editor); - - /* show widget */ - show_all_test_window(GTK_WIDGET(window)); - - hildon_composite_widget_focus(time_editor, GTK_DIR_RIGHT); - - gtk_widget_destroy(GTK_WIDGET(window)); - - /* Test3: check with a composite widget (hildon_time_editor) inside a window and a focus already given to the window */ - window = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); - time_editor = hildon_time_editor_new(); - gtk_container_add(GTK_CONTAINER(window), time_editor); - - /* show widget */ - show_all_test_window(GTK_WIDGET(window)); - gtk_widget_grab_focus(GTK_WIDGET(window)); - hildon_composite_widget_focus(time_editor, GTK_DIR_RIGHT); - - gtk_widget_destroy(GTK_WIDGET(window)); -} -END_TEST - -/** - * Purpose: Test invalid usage - * Cases considered: - * - Check with non composite widget (gtkentry) - * - Check with NULL object - * - Check with invalid direction - * - Check with non composite widget (gtkentry) (inside a window) - * - Check with invalid direction (inside a window) - */ -START_TEST (test_focus_invalid) -{ - GtkWidget *time_editor, *entry; - GtkWindow *window; - - /* Test1: check with a composite widget */ - entry = gtk_entry_new(); - hildon_composite_widget_focus(entry, GTK_DIR_RIGHT); - - gtk_widget_destroy(GTK_WIDGET(entry)); - - /* Test2: with NULL widget */ - hildon_composite_widget_focus(NULL, GTK_DIR_RIGHT); - - /* Test3: with invalid direction */ - time_editor = hildon_time_editor_new(); - hildon_composite_widget_focus(time_editor,GTK_DIR_RIGHT+1); - - gtk_widget_destroy(GTK_WIDGET(time_editor)); - - /* Test4: Check with non composite widget (gtkentry) (inside a window) */ - window = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); - entry = gtk_entry_new(); - gtk_container_add(GTK_CONTAINER(window), entry); - - show_all_test_window(GTK_WIDGET(window)); - hildon_composite_widget_focus(entry, GTK_DIR_RIGHT); - - gtk_widget_destroy(GTK_WIDGET(window)); - - /* Test5: Check with invalid direction (inside a window) */ - window = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); - time_editor = hildon_time_editor_new(); - gtk_container_add(GTK_CONTAINER(window), time_editor); - - show_all_test_window(GTK_WIDGET(window)); - hildon_composite_widget_focus(time_editor, GTK_DIR_RIGHT+1); - - gtk_widget_destroy(GTK_WIDGET(window)); -} -END_TEST - -/* ---------- Suite creation ---------- */ - -Suite *create_hildon_composite_widget_suite() -{ - /* Create the suite */ - Suite *s = suite_create("HildonCompositeWidget"); - - /* Create test cases */ - TCase *tc1 = tcase_create("focus"); - - /* Create test case for focus and add it to the suite */ - tcase_add_checked_fixture(tc1, fx_setup_gtk, fx_teardown_gtk); - tcase_add_test(tc1, test_focus_regular); - tcase_add_test(tc1, test_focus_invalid); - suite_add_tcase (s, tc1); - - /* Return created suite */ - return s; -} - - diff --git a/tests/check_test.c b/tests/check_test.c index 6e4226b..826bb5e 100644 --- a/tests/check_test.c +++ b/tests/check_test.c @@ -76,7 +76,6 @@ configure_tests(gint environment) srunner_add_suite(sr, create_hildon_banner_suite()); srunner_add_suite(sr, create_hildon_font_selection_dialog_suite()); srunner_add_suite(sr, create_hildon_window_suite()); - srunner_add_suite(sr, create_hildon_composite_widget_suite()); /* Disable tests that need maemo environment to be up if it is not running */ if (environment != ENVIRONMENT_MAEMO_ERROR) -- 1.7.9.5