Esempio n. 1
0
    def test_can_add_game(self):
        dlg = config_dialogs.AddGameDialog(None)
        name_entry = dlg.vbox.get_children()[0].get_children()[1]
        runner_dropdown = dlg.vbox.get_children()[1]
        name_entry.set_text("Test game")
        runner_dropdown.set_active(1)

        notebook = dlg.vbox.get_children()[2]
        scrolled_window = notebook.get_children()[0]
        viewport = scrolled_window.get_children()[0]
        game_box = viewport.get_children()[0]
        exe_box = game_box.get_children()[0].get_children()[0]
        exe_label = exe_box.get_children()[0]
        self.assertEqual(exe_label.get_text(), "Executable")
        test_exe = os.path.abspath(__file__)
        exe_field = exe_box.get_children()[1]
        exe_field.set_file(Gio.File.new_for_path(test_exe))
        exe_field.emit('file-set')
        self.assertEqual(exe_field.get_filename(), test_exe)

        add_button = dlg.vbox.get_children()[3].get_children()[1]
        add_button.clicked()

        game = Game('test-game')
        self.assertEqual(game.name, 'Test game')
        game.remove(from_library=True)
Esempio n. 2
0
    def test_changing_runner_sets_new_config(self):
        dlg = config_dialogs.AddGameDialog(None)
        runner_dropdown = dlg.vbox.get_children()[1]
        notebook = dlg.vbox.get_children()[2]
        label = notebook.get_children()[0]
        self.assertIn('Select a runner', label.get_text())

        buttons = dlg.vbox.get_children()[3].get_children()
        self.assertEqual(buttons[0].get_label(), 'Cancel')
        self.assertEqual(buttons[1].get_label(), 'Add')

        runner_dropdown.set_active(1)
        self.assertEqual(dlg.lutris_config.runner, runners.__all__[0])
        scrolled_window = notebook.get_children()[0]
        viewport = scrolled_window.get_children()[0]
        game_box = viewport.get_children()[0]
        self.assertEqual(game_box.runner_name, runners.__all__[0])
        exe_box = game_box.get_children()[0].get_children()[0]
        exe_field = exe_box.get_children()[1]
        self.assertEqual(exe_field.__class__.__name__, 'FileChooserButton')
Esempio n. 3
0
 def setUp(self):
     check_config()
     lutris_window = LutrisWindow()
     self.dlg = config_dialogs.AddGameDialog(lutris_window.window)
Esempio n. 4
0
 def setUp(self):
     check_config()
     lutris_application = Application()
     lutris_window = lutris_application.window
     self.dlg = config_dialogs.AddGameDialog(lutris_window)
Esempio n. 5
0
 def test_dialog(self):
     dlg = config_dialogs.AddGameDialog(None)
     self.assertEqual(dlg.notebook.get_current_page(), 0)