~ubuntu-branches/ubuntu/saucy/gaupol/saucy-proposed

« back to all changes in this revision

Viewing changes to gaupol/dialogs/test/test_position_transform.py

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski
  • Date: 2013-01-06 17:10:10 UTC
  • mfrom: (1.2.8)
  • mto: (10.2.3 experimental)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: package-import@ubuntu.com-20130106171010-kmlq0sy324jlp9zz
Tags: upstream-0.21
Import upstream version 0.21

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
 
 
3
# Copyright (C) 2005-2008,2010 Osmo Salomaa
 
4
#
 
5
# This file is part of Gaupol.
 
6
#
 
7
# Gaupol is free software: you can redistribute it and/or modify it under the
 
8
# terms of the GNU General Public License as published by the Free Software
 
9
# Foundation, either version 3 of the License, or (at your option) any later
 
10
# version.
 
11
#
 
12
# Gaupol is distributed in the hope that it will be useful, but WITHOUT ANY
 
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 
14
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 
15
#
 
16
# You should have received a copy of the GNU General Public License along with
 
17
# Gaupol. If not, see <http://www.gnu.org/licenses/>.
 
18
 
 
19
import gaupol
 
20
 
 
21
from gi.repository import Gtk
 
22
 
 
23
 
 
24
class _TestPositionTransformDialog(gaupol.TestCase):
 
25
 
 
26
    def run_dialog(self):
 
27
        self.dialog.run()
 
28
        self.dialog.destroy()
 
29
 
 
30
    def setup_method(self, method):
 
31
        self.application = self.new_application()
 
32
        page = self.application.get_current_page()
 
33
        page.view.select_rows((1, 2, 3))
 
34
        gaupol.conf.preview.use_custom_command = True
 
35
        gaupol.conf.preview.custom_command = "echo"
 
36
        page.project.video_path = self.new_subrip_file()
 
37
 
 
38
    def test__init____no(self):
 
39
        page = self.application.get_current_page()
 
40
        page.project.video_path = None
 
41
        page.project.main_file = None
 
42
        page.view.select_rows(())
 
43
        gaupol.conf.position_transform.target = gaupol.targets.SELECTED
 
44
        self.dialog = self.dialog.__class__(self.application.window,
 
45
                                            self.application)
 
46
 
 
47
    def test__on_preview_button_1_clicked(self):
 
48
        self.dialog._current_radio.set_active(True)
 
49
        self.dialog._preview_button_1.emit("clicked")
 
50
        self.dialog._selected_radio.set_active(True)
 
51
        self.dialog._preview_button_1.emit("clicked")
 
52
 
 
53
    def test__on_preview_button_2_clicked(self):
 
54
        self.dialog._current_radio.set_active(True)
 
55
        self.dialog._preview_button_2.emit("clicked")
 
56
        self.dialog._selected_radio.set_active(True)
 
57
        self.dialog._preview_button_2.emit("clicked")
 
58
 
 
59
    def test__on_response__current(self):
 
60
        self.dialog._current_radio.set_active(True)
 
61
        self.dialog.response(Gtk.ResponseType.OK)
 
62
 
 
63
    def test__on_response__selected(self):
 
64
        self.dialog._selected_radio.set_active(True)
 
65
        self.dialog.response(Gtk.ResponseType.OK)
 
66
 
 
67
    def test__on_subtitle_spin_1_value_changed(self):
 
68
        self.dialog._subtitle_spin_1.spin(Gtk.SpinType.STEP_FORWARD, 1)
 
69
        self.dialog._subtitle_spin_1.spin(Gtk.SpinType.STEP_FORWARD, 1)
 
70
        self.dialog._subtitle_spin_1.spin(Gtk.SpinType.STEP_BACKWARD, 1)
 
71
        self.dialog._subtitle_spin_1.spin(Gtk.SpinType.STEP_BACKWARD, 1)
 
72
 
 
73
    def test__on_subtitle_spin_2_value_changed(self):
 
74
        self.dialog._subtitle_spin_2.spin(Gtk.SpinType.STEP_FORWARD, 1)
 
75
        self.dialog._subtitle_spin_2.spin(Gtk.SpinType.STEP_FORWARD, 1)
 
76
        self.dialog._subtitle_spin_2.spin(Gtk.SpinType.STEP_BACKWARD, 1)
 
77
        self.dialog._subtitle_spin_2.spin(Gtk.SpinType.STEP_BACKWARD, 1)
 
78
 
 
79
 
 
80
class TestFrameTransformDialog(_TestPositionTransformDialog):
 
81
 
 
82
    def setup_method(self, method):
 
83
        _TestPositionTransformDialog.setup_method(self, method)
 
84
        self.dialog = gaupol.FrameTransformDialog(self.application.window,
 
85
                                                  self.application)
 
86
 
 
87
        self.dialog.show()
 
88
 
 
89
 
 
90
class TestTimeTransformDialog(_TestPositionTransformDialog):
 
91
 
 
92
    def setup_method(self, method):
 
93
        _TestPositionTransformDialog.setup_method(self, method)
 
94
        self.dialog = gaupol.TimeTransformDialog(self.application.window,
 
95
                                                 self.application)
 
96
 
 
97
        self.dialog.show()