Exemplo n.º 1
0
    def test_project_settings(self):
        window = Gtk.Window()
        dialog = ProjectSettingsDialog(parent_window=window,
                                       project=self.project,
                                       app=self.app)

        def assert_meta(author, year):
            self.assertEqual(self.project.author, author)
            self.assertEqual(self.project.year, year)

        dialog.author_entry.set_text("a1")
        dialog.year_spinbutton.set_value(2001)
        dialog.updateProject()
        assert_meta("a1", "2001")

        dialog.author_entry.set_text("a2")
        dialog.year_spinbutton.set_value(2002)
        dialog.updateProject()
        assert_meta("a2", "2002")

        self.action_log.undo()
        assert_meta("a1", "2001")

        self.action_log.redo()
        assert_meta("a2", "2002")
Exemplo n.º 2
0
    def testGetUniquePresetName(self):
        preset_manager = PresetManager()
        name = ProjectSettingsDialog._getUniquePresetName(preset_manager)
        self.assertEqual('New preset', name)

        preset_manager.addPreset(name, {})
        new_preset1 = ProjectSettingsDialog._getUniquePresetName(preset_manager)
        self.assertEqual('New preset 1', new_preset1)

        # Intentionally add 'New preset 2' before 'New preset 1'.
        preset_manager.addPreset('New preset 2', {})
        preset_manager.addPreset('New preset 1', {})
        new_preset3 = ProjectSettingsDialog._getUniquePresetName(preset_manager)
        self.assertEqual('New preset 3', new_preset3)
Exemplo n.º 3
0
    def testGetUniquePresetName(self):
        preset_manager = PresetManager()
        name = ProjectSettingsDialog._getUniquePresetName(preset_manager)
        self.assertEqual('New Preset', name)

        preset_manager.addPreset(name, {})
        new_preset1 = ProjectSettingsDialog._getUniquePresetName(preset_manager)
        self.assertEqual('New Preset 1', new_preset1)

        # Intentionally add 'New Preset 2' before 'New Preset 1'.
        preset_manager.addPreset('New Preset 2', {})
        preset_manager.addPreset(new_preset1, {})
        new_preset3 = ProjectSettingsDialog._getUniquePresetName(preset_manager)
        self.assertEqual('New Preset 3', new_preset3)
Exemplo n.º 4
0
    def test_project_settings(self):
        window = Gtk.Window()
        dialog = ProjectSettingsDialog(parent_window=window,
                                       project=self.project,
                                       app=self.app)

        def assert_meta(title, author, year):
            self.assertEqual(self.project.name, title)
            self.assertEqual(self.project.author, author)
            self.assertEqual(self.project.year, year)

        dialog.title_entry.set_text("t1")
        dialog.author_entry.set_text("a1")
        dialog.year_spinbutton.set_value(2001)
        dialog.updateProject()
        assert_meta("t1", "a1", "2001")

        dialog.title_entry.set_text("t2")
        dialog.author_entry.set_text("a2")
        dialog.year_spinbutton.set_value(2002)
        dialog.updateProject()
        assert_meta("t2", "a2", "2002")

        self.action_log.undo()
        assert_meta("t1", "a1", "2001")

        self.action_log.redo()
        assert_meta("t2", "a2", "2002")
Exemplo n.º 5
0
 def _projectSettingsButtonClickedCb(self, button):
     from pitivi.project import ProjectSettingsDialog
     dialog = ProjectSettingsDialog(self.window, self.project)
     dialog.window.run()
Exemplo n.º 6
0
 def show_project_settings_dialog(self):
     project = self.app.project_manager.current_project
     dialog = ProjectSettingsDialog(self.app.gui, project, self.app)
     dialog.window.run()
     self.update_title()