class TestPreferenceWindow(TestBase): def test_event(self): self.dialog = PreferenceWindow(self.create_main_window()) t1 = threading.Thread(target=self.dialog.run, args=()) t1.start() sleep(1) self.dialog.response(Gtk.ResponseType.OK) self.refresh_gui() t1.join() self.dialog.destroy() self.dialog.close()
class TestPreferenceWindow(TestBase): def setUp(self): self.preference_window = PreferenceWindow(self.create_main_window()) def close_window(self): self.preference_window.response(Gtk.ResponseType.OK) self.preference_window.close() def test_event(self): GObject.timeout_add(100, self.close_window) self.preference_window.run() event = Gdk.Event() event.key.type = Gdk.EventType.BUTTON_PRESS self.preference_window.emit("button-press-event", event)