[gtk+] filechooser: Get the filechooser tests to build
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] filechooser: Get the filechooser tests to build
- Date: Thu, 14 Feb 2013 00:13:01 +0000 (UTC)
commit ba63578e626ed0c5f062c01aa47b4ac2438d54b3
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Feb 11 13:38:58 2013 -0600
filechooser: Get the filechooser tests to build
Some are ifdef-ed out with BROKEN_TESTS, but at least the tests will compile for now.
gtk/tests/Makefile.am | 7 +++----
gtk/tests/filechooser.c | 25 ++++++++++++++++---------
2 files changed, 19 insertions(+), 13 deletions(-)
---
diff --git a/gtk/tests/Makefile.am b/gtk/tests/Makefile.am
index d762a35..b28105d 100644
--- a/gtk/tests/Makefile.am
+++ b/gtk/tests/Makefile.am
@@ -69,10 +69,9 @@ accel_LDADD = $(progs_ldadd)
#crossingevents_SOURCES = crossingevents.c
#crossingevents_LDADD = $(progs_ldadd)
-# Should be ported to new API's
-#TEST_PROGS += filechooser
-#filechooser_SOURCES = filechooser.c
-#filechooser_LDADD = $(progs_ldadd)
+TEST_PROGS += filechooser
+filechooser_SOURCES = filechooser.c
+filechooser_LDADD = $(progs_ldadd)
TEST_PROGS += builder
builder_SOURCES = builder.c
diff --git a/gtk/tests/filechooser.c b/gtk/tests/filechooser.c
index 7341e66..2537545 100644
--- a/gtk/tests/filechooser.c
+++ b/gtk/tests/filechooser.c
@@ -494,7 +494,7 @@ get_impl_from_dialog (GtkWidget *dialog)
return impl;
}
-
+#ifdef BROKEN_TESTS
static gboolean
test_widgets_for_current_action (GtkFileChooserDialog *dialog,
GtkFileChooserAction expected_action)
@@ -659,7 +659,9 @@ test_action_widgets (void)
gtk_widget_destroy (dialog);
}
+#endif
+#ifdef BROKEN_TESTS
static gboolean
test_reload_sequence (gboolean set_folder_before_map)
{
@@ -815,6 +817,7 @@ test_reload (void)
log_test (passed, "test_reload(): set a folder explicitly before mapping");
g_assert (passed);
}
+#endif
static gboolean
test_button_folder_states_for_action (GtkFileChooserAction action, gboolean use_dialog, gboolean
set_folder_on_dialog)
@@ -985,8 +988,8 @@ test_folder_switch_and_filters (void)
gboolean passed;
char *cwd;
char *base_dir;
- GtkFilePath *cwd_path;
- GtkFilePath *base_dir_path;
+ GFile *cwd_file;
+ GFile *base_dir_file;
GtkWidget *dialog;
GtkFileFilter *all_filter;
GtkFileFilter *txt_filter;
@@ -1003,8 +1006,8 @@ test_folder_switch_and_filters (void)
NULL);
impl = get_impl_from_dialog (dialog);
- cwd_path = gtk_file_system_filename_to_path (impl->file_system, cwd);
- base_dir_path = gtk_file_system_filename_to_path (impl->file_system, base_dir);
+ cwd_file = g_file_new_for_path (cwd);
+ base_dir_file = g_file_new_for_path (base_dir);
passed = passed && gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), base_dir);
g_assert (passed);
@@ -1046,8 +1049,8 @@ test_folder_switch_and_filters (void)
sleep_in_main_loop (0.25);
g_signal_emit_by_name (impl->browse_path_bar, "path-clicked",
- (GtkFilePath *) cwd_path,
- (GtkFilePath *) base_dir_path,
+ cwd_file,
+ base_dir_file,
FALSE);
sleep_in_main_loop (0.25);
passed = passed && (gtk_file_chooser_get_filter (GTK_FILE_CHOOSER (dialog)) == txt_filter);
@@ -1057,8 +1060,8 @@ test_folder_switch_and_filters (void)
/* cleanups */
g_free (cwd);
g_free (base_dir);
- gtk_file_path_free (cwd_path);
- gtk_file_path_free (base_dir_path);
+ g_object_unref (cwd_file);
+ g_object_unref (base_dir_file);
gtk_widget_destroy (dialog);
@@ -1075,8 +1078,12 @@ main (int argc,
/* register tests */
g_test_add_func ("/GtkFileChooser/black_box", test_black_box);
g_test_add_func ("/GtkFileChooser/confirm_overwrite", test_confirm_overwrite);
+#ifdef BROKEN_TESTS
g_test_add_func ("/GtkFileChooser/action_widgets", test_action_widgets);
+#endif
+#ifdef BROKEN_TESTS
g_test_add_func ("/GtkFileChooser/reload", test_reload);
+#endif
g_test_add_func ("/GtkFileChooser/button_folder_states", test_button_folder_states);
g_test_add_func ("/GtkFileChooser/folder_switch_and_filters", test_folder_switch_and_filters);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]