[gtk+/gtk-2-24] filechooserbutton: Add tests for cancelling the dialog via closing it (delete-event), instead of by



commit 2f396a74f3a74aac7d7bd795da0013ce0966f5b3
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Feb 20 18:14:15 2013 -0600

    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 <federico gnome org>

 gtk/tests/filechooser.c |  176 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 175 insertions(+), 1 deletions(-)
---
diff --git a/gtk/tests/filechooser.c b/gtk/tests/filechooser.c
index 5e84a9c..d68171d 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 */
 
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]