|
| 1 | +""" |
| 2 | +When a dialog modal is opened no actions should be executed in the editor. |
| 3 | +""" |
| 4 | +import GPS |
| 5 | +from gs_utils.internal.utils import * |
| 6 | +from gs_utils.internal.dialogs import * |
| 7 | + |
| 8 | + |
| 9 | +@run_test_driver |
| 10 | +def test_driver(): |
| 11 | + GPS.Preference("General-Use-Native-Dialogs").set(False) |
| 12 | + b = GPS.EditorBuffer.get(GPS.File("main.adb")) |
| 13 | + expected = b.get_chars() |
| 14 | + b.current_view().goto(b.at(1, 18)) |
| 15 | + d = Gtk_File_Chooser_Dialog() |
| 16 | + yield d.open_and_yield("save as") |
| 17 | + # The first BACKSPACE will be sent to the "new name entry" which will |
| 18 | + # trigger the completion |
| 19 | + entry = get_widgets_by_type(Gtk.Entry, d.dialogs[0])[0] |
| 20 | + gps_assert(entry.get_text(), "main.adb", "Wrong text in entry") |
| 21 | + entry.get_toplevel().grab_focus() |
| 22 | + entry.grab_focus() |
| 23 | + send_key_event(GDK_BACKSPACE) |
| 24 | + yield timeout(200) |
| 25 | + # During the completion the focus is whacky => the second and third |
| 26 | + # BACKSPACE should do nothing |
| 27 | + send_key_event(GDK_BACKSPACE) |
| 28 | + yield timeout(200) |
| 29 | + send_key_event(GDK_BACKSPACE) |
| 30 | + yield timeout(200) |
| 31 | + gps_assert(entry.get_text(), |
| 32 | + ".adb", |
| 33 | + "Backspace should have affected the entry") |
| 34 | + yield d.cancel() |
| 35 | + gps_assert(len(b.get_chars()), |
| 36 | + len(expected), |
| 37 | + "The buffer has been modified while a modal dialog was shown") |
0 commit comments