[kazehakase-svn] [3581] added test-profile.c

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
Tue Jan 27 08:53:40 JST 2009


Revision: 3581
          http://svn.sourceforge.jp/view?root=kazehakase&view=rev&rev=3581
Author:   ikezoe
Date:     2009-01-27 08:53:40 +0900 (Tue, 27 Jan 2009)

Log Message:
-----------
added test-profile.c

Modified Paths:
--------------
    kazehakase/trunk/test/Makefile.am

Added Paths:
-----------
    kazehakase/trunk/test/fixtures/kzrc
    kazehakase/trunk/test/test-profile.c

Modified: kazehakase/trunk/test/Makefile.am
===================================================================
--- kazehakase/trunk/test/Makefile.am	2009-01-26 23:51:26 UTC (rev 3580)
+++ kazehakase/trunk/test/Makefile.am	2009-01-26 23:53:40 UTC (rev 3581)
@@ -9,15 +9,26 @@
 	test-bookmark-folder.la		\
 	test-bookmark-file.la		\
 	test-bookmark-separator.la	\
-	test-root-bookmark.la
+	test-root-bookmark.la		\
+	test-profile.la
 endif
 
 EXTRA_DIST =		\
 	run-test.sh
 
-INCLUDES =		\
-	-I$(srcdir)	\
-	-I$(top_srcdir)
+INCLUDES =						\
+	-I$(srcdir)					\
+	-I$(top_srcdir)					\
+	-I$(top_srcdir)/src				\
+	-I$(top_srcdir)/src/actions			\
+	-I$(top_srcdir)/src/bookmarks			\
+	-I$(top_srcdir)/src/libegg/pixbufthumbnail	\
+	-I$(top_srcdir)/src/libegg/md5			\
+	-I$(top_srcdir)/src/net				\
+	-I$(top_srcdir)/src/sidebar			\
+	-I$(top_srcdir)/src/utils			\
+	-I$(top_srcdir)/src/widget			\
+	-I$(top_builddir)/src/libegg/pixbufthumbnail
 
 AM_CFLAGS = $(GCUTTER_CFLAGS)
 AM_LDFLAGS =			\
@@ -42,6 +53,8 @@
 test_bookmark_file_la_LIBADD = kz_test_utils.la
 test_root_bookmark_la_SOURCES = test-root-bookmark.c
 test_root_bookmark_la_LIBADD = kz_test_utils.la
+test_profile_la_SOURCES = test-profile.c
+test_profile_la_LIBADD = kz_test_utils.la
 
 echo-cutter:
 	@echo $(CUTTER)

Added: kazehakase/trunk/test/fixtures/kzrc
===================================================================
--- kazehakase/trunk/test/fixtures/kzrc	                        (rev 0)
+++ kazehakase/trunk/test/fixtures/kzrc	2009-01-26 23:53:40 UTC (rev 3581)
@@ -0,0 +1,134 @@
+# Encoding: UTF-8
+
+[Global]
+# Default layout engine. mozilla or gtk+-webcore
+#layout_engine=mozilla
+
+startup_page=about:blank
+
+# Override User-Agent
+override_user_agent=false
+#user_agent=Kazehakase
+
+# available: beginner, medium, expert, custom
+ui_level=beginner
+
+# When you click bookmark menu bymiddle mouse button, bookmark menu keeps popuping.
+keep_bookmark_menu=false
+
+# When you click bookmark menu, always open in new tab
+always_open_new=false
+
+# When you click bookmark menu which indicates folder by middle mouse button,
+# confirmation dialog shows.
+confirm_open_bookmarks=true
+
+use_proxy=false
+
+# In location entry you hit enter, url opens in new tab,
+# If this value is false, you have to hit enter with no mask when url opens in new tab.
+entry_open_in_new_tab=false
+
+use_migemo=false
+migemo_command=migemo -t perl /usr/share/migemo/migemo-dict
+
+editor_command=gedit %s
+
+autoscroll_modifier=shift
+
+# javascript availability
+# this option does not take effect 
+# if javascript_enable is false in about:config.
+use_javascript=true
+
+[MainWindow]
+width=720
+height=600
+
+# available: top, bottom, left, right
+tab_pos=top
+
+show_sidebar=false
+sidebar_width=150
+# available: top, bottom, left, right
+sidebar_pos=left
+
+[LocationEntry]
+# max_history=32
+
+[Tab]
+fix_width=true
+fixed_width=80
+show_favicon=true
+show_close_button=true
+
+# available: prev_tab, next_tab, last_created, last_shown
+page_to_return_when_close=last_shown
+
+focus_open_new=false
+focus_loc_ent_new=false
+
+# available: left, last, unread_right
+new_tab_position=unread_right
+
+# circulation of chaging tab by mouse wheel.
+wheel_circulation=false
+
+[Gesture]
+use_gesture=true
+# CloseWindow
+CloseTab=U
+Reload=D
+# NewWindow=
+# NewTab=
+# OpenSelectedLinks=
+# Cut=
+# Copy=
+# Paste=
+# SelectAll=
+# CopyTitle=
+# CopyURL=
+# Preference=
+# DetailedPreference=
+Home=DU
+Back=L
+Forward=R
+# Reload=
+# Stop=
+# ReloadAll=
+# StopAll=
+# ShowHideSidebar=
+PrevTab=LR
+NextTab=RL
+CloseAllBackwardTab=UL
+CloseAllForwardTab=UR
+CloseAllTabExceptActive=UD
+# ExtractLinks=
+
+[BookmarkEditorWindow]
+width=600
+height=450
+show_folder_view=true
+folder_view_width=150
+show_content_view=true
+content_view_height=220
+
+[Mozilla]
+
+[Session]
+save=false
+restore=false
+current_session=DefaultSession
+
+[Download]
+# available: up, down, left, right
+icon_fade_in_direction=up
+
+[History]
+except_keyword=
+search_engine=
+store_cache=false
+limit_cache=true
+limit_days=30
+max_results=20
+num_summary=256

Added: kazehakase/trunk/test/test-profile.c
===================================================================
--- kazehakase/trunk/test/test-profile.c	                        (rev 0)
+++ kazehakase/trunk/test/test-profile.c	2009-01-26 23:53:40 UTC (rev 3581)
@@ -0,0 +1,92 @@
+#include "kz-profile.h"
+
+#include <gcutter.h>
+#include <string.h>
+
+#include "kz-test-utils.h"
+
+void test_open (void);
+void test_changed_signal (void);
+
+static KzProfile *profile;
+static gchar *file_path;
+
+static gint n_changed_received;
+static gchar *actual_old_value;
+static gchar *actual_key;
+static gchar *actual_section;
+
+void
+setup (void)
+{
+    profile = NULL;
+    actual_old_value = NULL;
+    actual_section = NULL;
+    actual_key = NULL;
+
+    n_changed_received = 0;
+
+    file_path = g_build_filename(kz_test_get_base_dir(),
+                                 "fixtures", "kzrc",
+                                 NULL);
+}
+
+void
+teardown (void)
+{
+    if (profile)
+        g_object_unref(profile);
+    g_free(actual_old_value);
+    g_free(actual_section);
+    g_free(actual_key);
+    g_free(file_path);
+}
+
+void
+test_open (void)
+{
+    profile = kz_profile_open(file_path, NULL);
+    cut_assert(profile);
+    kz_profile_set_save_each_time(profile, FALSE);
+}
+
+static void
+cb_changed (KzProfile *profile,
+            const gchar *section, const gchar *key,
+            const gchar *old_value, gpointer data)
+{
+    n_changed_received++;
+
+    actual_old_value = g_strdup(old_value);
+    actual_section = g_strdup(section);
+    actual_key = g_strdup(key);
+}
+
+static void
+setup_signals (void)
+{
+    g_signal_connect(profile, "changed", G_CALLBACK(cb_changed), NULL);
+        
+}
+
+void
+test_changed_signal (void)
+{
+    cut_trace(test_open());
+
+    setup_signals();
+    cut_assert_equal_string("beginner",
+                            kz_profile_get_string(profile, "Global", "ui_level"));
+
+    kz_profile_set_value(profile, "Global", "ui_level",
+                         "unknown", strlen("unknown"),
+						 KZ_PROFILE_VALUE_TYPE_STRING);
+    cut_assert_equal_int(1, n_changed_received);
+    cut_assert_equal_string("Global", actual_section);
+    cut_assert_equal_string("ui_level", actual_key);
+    cut_assert_equal_string("ui_level=beginner", actual_old_value);
+}
+
+/*
+vi:ts=4:nowrap:ai:expandtab:sw=4
+*/



More information about the Kazehakase-cvs mailing list
Zurück zum Archiv-Index