~alisonken1/openlp/strings-templates2

« back to all changes in this revision

Viewing changes to tests/functional/openlp_core_lib/test_ui.py

  • Committer: Tim Bentley
  • Author(s): raoul at snyman
  • Date: 2016-06-02 04:59:13 UTC
  • mfrom: (2672.1.3 nose2-compatible-tests)
  • Revision ID: tim.bentley@gmail.com-20160602045913-9xfkp1ba7ei74oii
Make all our tests nose2 compatible. They still all work with nose1 (and now a few methods that weren't actually tests don't run).

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
    Test the functions in the ui module
38
38
    """
39
39
 
40
 
    def add_welcome_page_test(self):
 
40
    def test_add_welcome_page(self):
41
41
        """
42
42
        Test appending a welcome page to a wizard
43
43
        """
51
51
        self.assertEqual(1, len(wizard.pageIds()), 'The wizard should have one page.')
52
52
        self.assertIsInstance(wizard.page(0).pixmap(QtWidgets.QWizard.WatermarkPixmap), QtGui.QPixmap)
53
53
 
54
 
    def create_button_box_test(self):
 
54
    def test_create_button_box(self):
55
55
        """
56
56
        Test creating a button box for a dialog
57
57
        """
79
79
        self.assertEqual(1, len(btnbox.buttons()))
80
80
        self.assertEqual(QtWidgets.QDialogButtonBox.HelpRole, btnbox.buttonRole(btnbox.buttons()[0]))
81
81
 
82
 
    def create_horizontal_adjusting_combo_box_test(self):
 
82
    def test_create_horizontal_adjusting_combo_box(self):
83
83
        """
84
84
        Test creating a horizontal adjusting combo box
85
85
        """
94
94
        self.assertEqual('combo1', combo.objectName())
95
95
        self.assertEqual(QtWidgets.QComboBox.AdjustToMinimumContentsLength, combo.sizeAdjustPolicy())
96
96
 
97
 
    def create_button_test(self):
 
97
    def test_create_button(self):
98
98
        """
99
99
        Test creating a button
100
100
        """
126
126
        self.assertEqual('my_btn', btn.objectName())
127
127
        self.assertTrue(btn.isEnabled())
128
128
 
129
 
    def create_action_test(self):
 
129
    def test_create_action(self):
130
130
        """
131
131
        Test creating an action
132
132
        """
151
151
        self.assertEqual('my tooltip', action.toolTip())
152
152
        self.assertEqual('my statustip', action.statusTip())
153
153
 
154
 
    def create_action_on_mac_osx_test(self):
 
154
    def test_create_action_on_mac_osx(self):
155
155
        """
156
156
        Test creating an action on OS X calls the correct method
157
157
        """
169
169
            # THEN: setIconVisibleInMenu should be called
170
170
            mocked_action.setIconVisibleInMenu.assert_called_with(False)
171
171
 
172
 
    def create_action_not_on_mac_osx_test(self):
 
172
    def test_create_action_not_on_mac_osx(self):
173
173
        """
174
174
        Test creating an action on something other than OS X doesn't call the method
175
175
        """
188
188
            self.assertEqual(0, mocked_action.setIconVisibleInMenu.call_count,
189
189
                             'setIconVisibleInMenu should not have been called')
190
190
 
191
 
    def create_checked_disabled_invisible_action_test(self):
 
191
    def test_create_checked_disabled_invisible_action(self):
192
192
        """
193
193
        Test that an invisible, disabled, checked action is created correctly
194
194
        """
203
203
        self.assertFalse(action.isEnabled(), 'The action should be disabled')
204
204
        self.assertFalse(action.isVisible(), 'The action should be invisble')
205
205
 
206
 
    def create_action_separator_test(self):
 
206
    def test_create_action_separator(self):
207
207
        """
208
208
        Test creating an action as separator
209
209
        """
216
216
        # THEN: The action should be a separator
217
217
        self.assertTrue(action.isSeparator(), 'The action should be a separator')
218
218
 
219
 
    def create_valign_selection_widgets_test(self):
 
219
    def test_create_valign_selection_widgets(self):
220
220
        """
221
221
        Test creating a combo box for valign selection
222
222
        """
233
233
        for text in [UiStrings().Top, UiStrings().Middle, UiStrings().Bottom]:
234
234
            self.assertTrue(combo.findText(text) >= 0)
235
235
 
236
 
    def find_and_set_in_combo_box_test(self):
 
236
    def test_find_and_set_in_combo_box(self):
237
237
        """
238
238
        Test finding a string in a combo box and setting it as the selected item if present
239
239
        """
260
260
        # THEN: The index should have changed
261
261
        self.assertEqual(2, combo.currentIndex())
262
262
 
263
 
    def create_widget_action_test(self):
 
263
    def test_create_widget_action(self):
264
264
        """
265
265
        Test creating an action for a widget
266
266
        """
274
274
        self.assertIsInstance(action, QtWidgets.QAction)
275
275
        self.assertEqual(action.objectName(), 'some action')
276
276
 
277
 
    def set_case_insensitive_completer_test(self):
 
277
    def test_set_case_insensitive_completer(self):
278
278
        """
279
279
        Test setting a case insensitive completer on a widget
280
280
        """