Add base test for AddGameDialog

This commit is contained in:
Mathieu Comandon 2014-08-13 01:36:18 +02:00
parent 37e56d4158
commit 9cdd74b26b
4 changed files with 11 additions and 1 deletions

View file

@ -154,7 +154,6 @@ class AddGameDialog(Gtk.Dialog, GameDialogCommon):
self.build_action_area("Add", self.on_save)
self.show_all()
self.run()
def on_runner_changed(self, widget):
"""Action called when runner drop down is changed."""

View file

@ -330,12 +330,14 @@ class LutrisWindow(object):
def add_game(self, _widget, _data=None):
"""Add a new game."""
add_game_dialog = AddGameDialog(self)
add_game_dialog.run()
if add_game_dialog.runner_name and add_game_dialog.slug:
self.add_game_to_view(add_game_dialog.slug)
def add_manually(self, *args):
game = Game(self.view.selected_game)
add_game_dialog = AddGameDialog(self, game)
add_game_dialog.run()
if add_game_dialog.runner_name:
self.view.update_image(game.slug, is_installed=True)

View file

@ -69,6 +69,7 @@ def fetch_script(window, game_ref):
if dlg.result == 1:
game = Game(game_ref)
game_dialog = AddGameDialog(window, game)
game_dialog.run()
if game_dialog.runner_name:
window.notify_install_success()
elif dlg.result == 2:

8
tests/test_dialogs.py Normal file
View file

@ -0,0 +1,8 @@
from lutris.gui import config_dialogs
from unittest import TestCase
class TestGameDialog(TestCase):
def test_dialog(self):
dlg = config_dialogs.AddGameDialog(None)
self.assertEqual(dlg.notebook.get_current_page(), 0)