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



commit ac5cc198369950a9fddc8e08a5227dce8fc2aabf
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 113b219..8e5ffc9 100644
--- a/gtk/tests/filechooser.c
+++ b/gtk/tests/filechooser.c
@@ -702,6 +702,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 */
 
     {
@@ -774,7 +849,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",
@@ -801,6 +876,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]