57
57
Test StartTimeDialog are defaults correct
59
self.assertEqual(self.form.hour_spin_box.minimum(), 0, 'The minimum hour should stay the same as the dialog')
60
self.assertEqual(self.form.hour_spin_box.maximum(), 4, 'The maximum hour should stay the same as the dialog')
61
self.assertEqual(self.form.minute_spin_box.minimum(), 0,
62
'The minimum minute should stay the same as the dialog')
63
self.assertEqual(self.form.minute_spin_box.maximum(), 59,
64
'The maximum minute should stay the same as the dialog')
65
self.assertEqual(self.form.second_spin_box.minimum(), 0,
66
'The minimum second should stay the same as the dialog')
67
self.assertEqual(self.form.second_spin_box.maximum(), 59,
68
'The maximum second should stay the same as the dialog')
69
self.assertEqual(self.form.hour_finish_spin_box.minimum(), 0,
70
'The minimum finish hour should stay the same as the dialog')
71
self.assertEqual(self.form.hour_finish_spin_box.maximum(), 4,
72
'The maximum finish hour should stay the same as the dialog')
73
self.assertEqual(self.form.minute_finish_spin_box.minimum(), 0,
74
'The minimum finish minute should stay the same as the dialog')
75
self.assertEqual(self.form.minute_finish_spin_box.maximum(), 59,
76
'The maximum finish minute should stay the same as the dialog')
77
self.assertEqual(self.form.second_finish_spin_box.minimum(), 0,
78
'The minimum finish second should stay the same as the dialog')
79
self.assertEqual(self.form.second_finish_spin_box.maximum(), 59,
80
'The maximum finish second should stay the same as the dialog')
59
assert self.form.hour_spin_box.minimum() == 0, 'The minimum hour should stay the same as the dialog'
60
assert self.form.hour_spin_box.maximum() == 4, 'The maximum hour should stay the same as the dialog'
61
assert self.form.minute_spin_box.minimum() == 0, 'The minimum minute should stay the same as the dialog'
62
assert self.form.minute_spin_box.maximum() == 59, 'The maximum minute should stay the same as the dialog'
63
assert self.form.second_spin_box.minimum() == 0, 'The minimum second should stay the same as the dialog'
64
assert self.form.second_spin_box.maximum() == 59, 'The maximum second should stay the same as the dialog'
65
assert self.form.hour_finish_spin_box.minimum() == 0, \
66
'The minimum finish hour should stay the same as the dialog'
67
assert self.form.hour_finish_spin_box.maximum() == 4, \
68
'The maximum finish hour should stay the same as the dialog'
69
assert self.form.minute_finish_spin_box.minimum() == 0, \
70
'The minimum finish minute should stay the same as the dialog'
71
assert self.form.minute_finish_spin_box.maximum() == 59, \
72
'The maximum finish minute should stay the same as the dialog'
73
assert self.form.second_finish_spin_box.minimum() == 0, \
74
'The minimum finish second should stay the same as the dialog'
75
assert self.form.second_finish_spin_box.maximum() == 59, \
76
'The maximum finish second should stay the same as the dialog'
82
78
def test_time_display(self):
97
93
QtTest.QTest.mouseClick(ok_widget, QtCore.Qt.LeftButton)
99
95
# THEN the following input values are returned
100
self.assertEqual(self.form.hour_spin_box.value(), 0)
101
self.assertEqual(self.form.minute_spin_box.value(), 1)
102
self.assertEqual(self.form.second_spin_box.value(), 1)
103
self.assertEqual(self.form.item['service_item'].start_time, 61, 'The start time should stay the same')
96
assert self.form.hour_spin_box.value() == 0
97
assert self.form.minute_spin_box.value() == 1
98
assert self.form.second_spin_box.value() == 1
99
assert self.form.item['service_item'].start_time == 61, 'The start time should stay the same'
105
101
# WHEN displaying the UI, changing the time to 2min 3secs and pressing enter
106
102
self.form.item = {'service_item': mocked_serviceitem}
112
108
QtTest.QTest.mouseClick(ok_widget, QtCore.Qt.LeftButton)
114
110
# THEN the following values are returned
115
self.assertEqual(self.form.hour_spin_box.value(), 0)
116
self.assertEqual(self.form.minute_spin_box.value(), 2)
117
self.assertEqual(self.form.second_spin_box.value(), 3)
118
self.assertEqual(self.form.item['service_item'].start_time, 123, 'The start time should have changed')
111
assert self.form.hour_spin_box.value() == 0
112
assert self.form.minute_spin_box.value() == 2
113
assert self.form.second_spin_box.value() == 3
114
assert self.form.item['service_item'].start_time == 123, 'The start time should have changed'