def edit_shot_pushButton_clicked(self): """runs when the edit_shot_pushButton is clicked """ shot = self.get_current_shot() if shot: # create the shot_editor dialog dialog = shot_editor.MainDialog(shot, self) dialog.exec_()
def test_hit_ok_will_close_the_dialog(self): """testing if hitting ok will close the dialog """ dialog = shot_editor.MainDialog() dialog.show() QTest.mouseClick( dialog.buttonBox.buttons()[0], QtCore.Qt.LeftButton ) self.assertFalse(dialog.isVisible())
def test_shot_argument_is_a_shot_instance_will_fill_the_ui_with_shot_info(self): """testing if the ui is filled with correct info coming from the given shot """ proj1 = Project('Test Project') proj1.save() seq1 = Sequence(proj1, 'Test Sequence') seq1.save() shot = Shot(seq1, 1, 2, 435) shot.handle_at_start = 23 shot.handle_at_end = 12 shot.save() dialog = shot_editor.MainDialog(shot=shot) # test if the "Editing Shot: SH001" is correctly updated self.assertEqual( shot.code, dialog.shot_name_label.text() ) # test frame range info self.assertEqual( shot.start_frame, dialog.start_frame_spinBox.value() ) self.assertEqual( shot.end_frame, dialog.end_frame_spinBox.value() ) self.assertEqual( shot.handle_at_start, dialog.handle_at_start_spinBox.value() ) self.assertEqual( shot.handle_at_end, dialog.handle_at_end_spinBox.value() )
def test_shot_info_of_the_given_shot_is_updated_correctly(self): """testing if the shot info is updated when clicked to ok """ proj1 = Project('Test Project') proj1.save() seq1 = Sequence(proj1, 'Test Sequence') seq1.save() shot = Shot(seq1, 1, 2, 435) shot.handle_at_start = 23 shot.handle_at_end = 12 shot.save() start_frame = 132 end_frame = 250 handle_at_start = 11 handle_at_end = 32 dialog = shot_editor.MainDialog(shot=shot) # self.show_dialog(dialog) # now update the values dialog.start_frame_spinBox.setValue(start_frame) dialog.end_frame_spinBox.setValue(end_frame) dialog.handle_at_start_spinBox.setValue(handle_at_start) dialog.handle_at_end_spinBox.setValue(handle_at_end) # hit ok QTest.mouseClick( dialog.buttonBox.buttons()[0], QtCore.Qt.LeftButton ) # now check if the shot is updated self.assertEqual(start_frame, shot.start_frame) self.assertEqual(end_frame, shot.end_frame) self.assertEqual(handle_at_start, shot.handle_at_start) self.assertEqual(handle_at_end, shot.handle_at_end)
def test_no_shot_is_given_will_set_the_text_label_to_NA(self): """testing if no shot instance is given will set the label to N/A """ dialog = shot_editor.MainDialog() self.assertEqual("N/A", dialog.shot_name_label.text())