svnno****@sourc*****
svnno****@sourc*****
Thu Feb 12 12:06:46 JST 2009
Revision: 3628 http://svn.sourceforge.jp/view?root=kazehakase&view=rev&rev=3628 Author: ikezoe Date: 2009-02-12 12:06:46 +0900 (Thu, 12 Feb 2009) Log Message: ----------- KzBookmarkFolder. Modified Paths: -------------- kazehakase/trunk/test/test-bookmark-file.c kazehakase/trunk/test/test-bookmark-folder.c kazehakase/trunk/test/test-root-bookmark.c Modified: kazehakase/trunk/test/test-bookmark-file.c =================================================================== --- kazehakase/trunk/test/test-bookmark-file.c 2009-02-12 03:06:11 UTC (rev 3627) +++ kazehakase/trunk/test/test-bookmark-file.c 2009-02-12 03:06:46 UTC (rev 3628) @@ -134,10 +134,10 @@ "title", "Bookmark file", "file-type", "XBEL", NULL)); - kz_bookmark_append(expected, - kz_bookmark_new_with_attrs("Kazehakase", - "http://kazehakase.sourceforge.jp/", - NULL)); + kz_bookmark_folder_append(KZ_BOOKMARK_FOLDER(expected), + kz_bookmark_new_with_attrs("Kazehakase", + "http://kazehakase.sourceforge.jp/", + NULL)); kz_assert_equal_bookmark(expected, KZ_BOOKMARK(file)); } Modified: kazehakase/trunk/test/test-bookmark-folder.c =================================================================== --- kazehakase/trunk/test/test-bookmark-folder.c 2009-02-12 03:06:11 UTC (rev 3627) +++ kazehakase/trunk/test/test-bookmark-folder.c 2009-02-12 03:06:46 UTC (rev 3628) @@ -1,4 +1,4 @@ -#include "src/bookmarks/kz-bookmark.h" +#include "src/bookmarks/kz-bookmark-folder.h" #include <gcutter.h> @@ -19,7 +19,7 @@ void test_get_current_bookmark (void); void test_find_bookmark_from_uri (void); -static KzBookmark *folder; +static KzBookmarkFolder *folder; static KzBookmark *child; static KzBookmark *another_child; static GList *children; @@ -49,44 +49,44 @@ void test_new (void) { - folder = kz_bookmark_pure_folder_new(); + folder = KZ_BOOKMARK_FOLDER(kz_bookmark_folder_new()); cut_assert(folder); - cut_assert_true(kz_bookmark_is_folder(folder)); + //cut_assert_true(kz_bookmark_is_folder(folder)); } void test_current_position (void) { cut_trace(test_new()); - kz_bookmark_set_current(folder, 21); - cut_assert_equal_uint(21, kz_bookmark_get_current(folder)); + kz_bookmark_folder_set_current_position(folder, 21); + cut_assert_equal_uint(21, kz_bookmark_folder_get_current_position(folder)); } void test_lock (void) { cut_trace(test_new()); - cut_assert_false(kz_bookmark_get_lock(folder)); - kz_bookmark_set_lock(folder, TRUE); - cut_assert_true(kz_bookmark_get_lock(folder)); + cut_assert_false(kz_bookmark_folder_get_lock(folder)); + kz_bookmark_folder_set_lock(folder, TRUE); + cut_assert_true(kz_bookmark_folder_get_lock(folder)); } void test_javascript (void) { cut_trace(test_new()); - cut_assert_false(kz_bookmark_get_javascript(folder)); - kz_bookmark_set_javascript(folder, TRUE); - cut_assert_true(kz_bookmark_get_javascript(folder)); + cut_assert_true(kz_bookmark_folder_get_javascript(folder)); + kz_bookmark_folder_set_javascript(folder, FALSE); + cut_assert_false(kz_bookmark_folder_get_javascript(folder)); } void test_auto_refresh (void) { cut_trace(test_new()); - cut_assert_false(kz_bookmark_get_auto_refresh(folder)); - kz_bookmark_set_auto_refresh(folder, TRUE); - cut_assert_true(kz_bookmark_get_auto_refresh(folder)); + cut_assert_false(kz_bookmark_folder_get_auto_refresh(folder)); + kz_bookmark_folder_set_auto_refresh(folder, TRUE); + cut_assert_true(kz_bookmark_folder_get_auto_refresh(folder)); } void @@ -94,13 +94,13 @@ { cut_trace(test_new()); - cut_assert_false(kz_bookmark_has_children(folder)); + cut_assert_false(kz_bookmark_folder_has_children(folder)); child = kz_bookmark_new_with_attrs("Title", "URI", "Description"); - kz_bookmark_append(folder, child); + kz_bookmark_folder_append(folder, child); - cut_assert_true(kz_bookmark_has_children(folder)); + cut_assert_true(kz_bookmark_folder_has_children(folder)); - children = kz_bookmark_get_children(folder); + children = kz_bookmark_folder_get_children(folder); cut_assert_equal_int(1, g_list_length(children)); cut_assert_equal_pointer(children->data, child); @@ -112,9 +112,9 @@ cut_trace(test_append()); another_child = kz_bookmark_new_with_attrs("Title", "Another URI", "Description"); - kz_bookmark_prepend(folder, another_child); + kz_bookmark_folder_prepend(folder, another_child); - children = kz_bookmark_get_children(folder); + children = kz_bookmark_folder_get_children(folder); cut_assert_equal_int(2, g_list_length(children)); cut_assert_equal_pointer(children->data, another_child); @@ -128,9 +128,9 @@ cut_trace(test_append()); another_child = kz_bookmark_new_with_attrs("Title", "URI", "Description"); - kz_bookmark_insert_before(folder, another_child, child); + kz_bookmark_folder_insert_before(folder, another_child, child); - children = kz_bookmark_get_children(folder); + children = kz_bookmark_folder_get_children(folder); cut_assert_equal_int(2, g_list_length(children)); cut_assert_equal_pointer(children->data, another_child); @@ -141,8 +141,8 @@ { cut_trace(test_append()); - kz_bookmark_remove(folder, child); - cut_assert_false(kz_bookmark_has_children(folder)); + kz_bookmark_folder_remove(folder, child); + cut_assert_false(kz_bookmark_folder_has_children(folder)); } void @@ -150,8 +150,8 @@ { cut_trace(test_prepend()); - kz_bookmark_remove_all(folder); - cut_assert_false(kz_bookmark_has_children(folder)); + kz_bookmark_folder_remove_all(folder); + cut_assert_false(kz_bookmark_folder_has_children(folder)); } void @@ -179,7 +179,7 @@ cut_assert_equal_pointer(folder, kz_bookmark_get_parent(child)); cut_assert_equal_pointer(folder, kz_bookmark_get_parent(another_child)); - cut_assert_null(kz_bookmark_get_parent(folder)); + cut_assert_null(kz_bookmark_get_parent(KZ_BOOKMARK(folder))); } void @@ -187,10 +187,10 @@ { cut_trace(test_prepend()); - kz_bookmark_set_current(folder, 0); - cut_assert_equal_pointer(another_child, kz_bookmark_get_current_bookmark(folder)); - kz_bookmark_set_current(folder, 1); - cut_assert_equal_pointer(child, kz_bookmark_get_current_bookmark(folder)); + kz_bookmark_folder_set_current_position(folder, 0); + cut_assert_equal_pointer(another_child, kz_bookmark_folder_get_current_bookmark(folder)); + kz_bookmark_folder_set_current_position(folder, 1); + cut_assert_equal_pointer(child, kz_bookmark_folder_get_current_bookmark(folder)); } void @@ -199,7 +199,7 @@ cut_trace(test_prepend()); cut_assert_equal_pointer(another_child, - kz_bookmark_find_bookmark_from_uri(folder, "Another URI")); + kz_bookmark_folder_find_bookmark_from_uri(folder, "Another URI")); } void @@ -207,13 +207,14 @@ { cut_trace(test_new()); - cut_assert_false(kz_bookmark_get_folded(folder)); + cut_assert_true(kz_bookmark_folder_get_folded(folder)); - kz_bookmark_set_folded(folder, TRUE); - cut_assert_true(kz_bookmark_get_folded(folder)); + kz_bookmark_folder_set_folded(folder, FALSE); + cut_assert_false(kz_bookmark_folder_get_folded(folder)); - kz_bookmark_set_folded(folder, FALSE); - cut_assert_false(kz_bookmark_get_folded(folder)); + kz_bookmark_folder_set_folded(folder, TRUE); + cut_assert_true(kz_bookmark_folder_get_folded(folder)); + } /* Modified: kazehakase/trunk/test/test-root-bookmark.c =================================================================== --- kazehakase/trunk/test/test-root-bookmark.c 2009-02-12 03:06:11 UTC (rev 3627) +++ kazehakase/trunk/test/test-root-bookmark.c 2009-02-12 03:06:46 UTC (rev 3628) @@ -42,7 +42,7 @@ { root = kz_root_bookmark_new(bookmark_file, NULL, NULL, NULL); cut_assert(root); - cut_assert_true(kz_bookmark_has_children(KZ_BOOKMARK(root))); + cut_assert_true(kz_bookmark_folder_has_children(KZ_BOOKMARK_FOLDER(root))); cut_assert(root->menu); cut_assert_equal_string("Bookmarks", kz_bookmark_get_title(root->menu)); @@ -59,9 +59,9 @@ kz_root_bookmark_add_bookmark_bar_file(root, bookmark_bar_file, NULL); - expected = kz_bookmark_pure_folder_new(); - kz_bookmark_append(expected, - KZ_BOOKMARK(kz_bookmark_file_new(bookmark_bar_file, "Bookmark Bar", "XBEL"))); + expected = kz_bookmark_folder_new(); + kz_bookmark_folder_append(KZ_BOOKMARK_FOLDER(expected), + KZ_BOOKMARK(kz_bookmark_file_new(bookmark_bar_file, "Bookmark Bar", "XBEL"))); kz_assert_equal_bookmark(expected, root->bookmark_bars); }