From 2f396a74f3a74aac7d7bd795da0013ce0966f5b3 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Wed, 20 Feb 2013 18:14:15 -0600 Subject: [PATCH] filechooserbutton: Add tests for cancelling the dialog via closing it (delete-event), instead of by simulating the Cancel button (response cancel) Signed-off-by: Federico Mena Quintero --- gtk/tests/filechooser.c | 176 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 175 insertions(+), 1 deletion(-) diff --git a/gtk/tests/filechooser.c b/gtk/tests/filechooser.c index 5e84a9c3a9..d68171da74 100644 --- a/gtk/tests/filechooser.c +++ b/gtk/tests/filechooser.c @@ -700,6 +700,81 @@ static FileChooserButtonTest button_tests[] = NULL /* final_filename */ }, + /* OPEN tests with dialog, cancelled via closing the dialog (not by selecting the Cancel button) */ + + { + "open-dialog-close-1", + GTK_FILE_CHOOSER_ACTION_OPEN, + NULL, /* initial_current_folder */ + NULL, /* initial_filename */ + TRUE, /* open_dialog */ + NULL, /* tweak_current_folder */ + NULL, /* tweak_filename */ + GTK_RESPONSE_DELETE_EVENT,/* dialog_response */ + NULL, /* final_current_folder */ + NULL /* final_filename */ + }, + { + "open-dialog-close-2", + GTK_FILE_CHOOSER_ACTION_OPEN, + NULL, /* initial_current_folder */ + FILE_NAME, /* initial_filename */ + TRUE, /* open_dialog */ + NULL, /* tweak_current_folder */ + NULL, /* tweak_filename */ + GTK_RESPONSE_DELETE_EVENT,/* dialog_response */ + NULL, /* final_current_folder */ + FILE_NAME /* final_filename */ + }, + { + "open-dialog-close-3", + GTK_FILE_CHOOSER_ACTION_OPEN, + FOLDER_NAME, /* initial_current_folder */ + NULL, /* initial_filename */ + TRUE, /* open_dialog */ + NULL, /* tweak_current_folder */ + NULL, /* tweak_filename */ + GTK_RESPONSE_DELETE_EVENT,/* dialog_response */ + FOLDER_NAME, /* final_current_folder */ + NULL /* final_filename */ + }, + { + "open-dialog-close-4", + GTK_FILE_CHOOSER_ACTION_OPEN, + NULL, /* initial_current_folder */ + NULL, /* initial_filename */ + TRUE, /* open_dialog */ + NULL, /* tweak_current_folder */ + FILE_NAME, /* tweak_filename */ + GTK_RESPONSE_DELETE_EVENT,/* dialog_response */ + NULL, /* final_current_folder */ + NULL /* final_filename */ + }, + { + "open-dialog-close-5", + GTK_FILE_CHOOSER_ACTION_OPEN, + NULL, /* initial_current_folder */ + FILE_NAME, /* initial_filename */ + TRUE, /* open_dialog */ + NULL, /* tweak_current_folder */ + FILE_NAME_2, /* tweak_filename */ + GTK_RESPONSE_DELETE_EVENT,/* dialog_response */ + NULL, /* final_current_folder */ + FILE_NAME /* final_filename */ + }, + { + "open-dialog-close-6", + GTK_FILE_CHOOSER_ACTION_OPEN, + FOLDER_NAME, /* initial_current_folder */ + NULL, /* initial_filename */ + TRUE, /* open_dialog */ + NULL, /* tweak_current_folder */ + FILE_NAME_2, /* tweak_filename */ + GTK_RESPONSE_DELETE_EVENT,/* dialog_response */ + FOLDER_NAME, /* final_current_folder */ + NULL /* final_filename */ + }, + /* SELECT_FOLDER tests with dialog, cancelled */ { @@ -772,7 +847,7 @@ static FileChooserButtonTest button_tests[] = FOLDER_NAME_2, /* tweak_filename */ GTK_RESPONSE_CANCEL, /* dialog_response */ NULL, /* final_current_folder */ - FOLDER_NAME /* final_filename */ + FOLDER_NAME /* final_filename */ }, { "select-folder-dialog-cancel-7", @@ -799,6 +874,105 @@ static FileChooserButtonTest button_tests[] = FOLDER_NAME /* final_filename */ }, + /* SELECT_FOLDER tests with dialog, cancelled via closing the dialog (not selecting the Cancel button) */ + + { + "select-folder-dialog-close-1", + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, + NULL, /* initial_current_folder */ + NULL, /* initial_filename */ + TRUE, /* open_dialog */ + NULL, /* tweak_current_folder */ + NULL, /* tweak_filename */ + GTK_RESPONSE_DELETE_EVENT,/* dialog_response */ + NULL, /* final_current_folder */ + NULL /* final_filename */ + }, + { + "select-folder-dialog-close-2", + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, + NULL, /* initial_current_folder */ + FOLDER_NAME, /* initial_filename */ + TRUE, /* open_dialog */ + NULL, /* tweak_current_folder */ + NULL, /* tweak_filename */ + GTK_RESPONSE_DELETE_EVENT,/* dialog_response */ + NULL, /* final_current_folder */ + FOLDER_NAME /* final_filename */ + }, + { + "select-folder-dialog-close-3", + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, + FOLDER_NAME, /* initial_current_folder */ + NULL, /* initial_filename */ + TRUE, /* open_dialog */ + NULL, /* tweak_current_folder */ + NULL, /* tweak_filename */ + GTK_RESPONSE_DELETE_EVENT,/* dialog_response */ + FOLDER_NAME, /* final_current_folder */ + NULL /* final_filename */ + }, + { + "select-folder-dialog-close-4", + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, + FOLDER_NAME, /* initial_current_folder */ + NULL, /* initial_filename */ + TRUE, /* open_dialog */ + NULL, /* tweak_current_folder */ + NULL, /* tweak_filename */ + GTK_RESPONSE_DELETE_EVENT,/* dialog_response */ + NULL, /* final_current_folder */ + FOLDER_NAME /* final_filename */ + }, + { + "select-folder-dialog-close-5", + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, + NULL, /* initial_current_folder */ + NULL, /* initial_filename */ + TRUE, /* open_dialog */ + NULL, /* tweak_current_folder */ + FOLDER_NAME, /* tweak_filename */ + GTK_RESPONSE_DELETE_EVENT,/* dialog_response */ + NULL, /* final_current_folder */ + NULL /* final_filename */ + }, + { + "select-folder-dialog-close-6", + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, + NULL, /* initial_current_folder */ + FOLDER_NAME, /* initial_filename */ + TRUE, /* open_dialog */ + NULL, /* tweak_current_folder */ + FOLDER_NAME_2, /* tweak_filename */ + GTK_RESPONSE_DELETE_EVENT,/* dialog_response */ + NULL, /* final_current_folder */ + FOLDER_NAME /* final_filename */ + }, + { + "select-folder-dialog-close-7", + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, + FOLDER_NAME, /* initial_current_folder */ + NULL, /* initial_filename */ + TRUE, /* open_dialog */ + NULL, /* tweak_current_folder */ + FOLDER_NAME_2, /* tweak_filename */ + GTK_RESPONSE_DELETE_EVENT,/* dialog_response */ + FOLDER_NAME, /* final_current_folder */ + NULL /* final_filename */ + }, + { + "select-folder-dialog-close-8", + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, + FOLDER_NAME, /* initial_current_folder */ + NULL, /* initial_filename */ + TRUE, /* open_dialog */ + NULL, /* tweak_current_folder */ + FOLDER_NAME_2, /* tweak_filename */ + GTK_RESPONSE_DELETE_EVENT,/* dialog_response */ + NULL, /* final_current_folder */ + FOLDER_NAME /* final_filename */ + }, + /* OPEN tests with dialog */ {