def test_edit_shot_button_opens_up_shot_editor_with_the_given_shot(self): """testing if hitting the edit shot button opens up the shot_editor dialog """ 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() dialog1 = project_manager.MainDialog() # self.show_dialog(dialog1) # hit to the edit shot button # QTest.mouseClick( # dialog1.edit_shot_pushButton, # QtCore.Qt.LeftButton # ) # check if the shot_editor dialog is opened # HOW ???? self.fail('test is not finished yet')
def test_create_project_structure_pushButton_creates_project_structure( self): """testing if using the create_project_pushButton creates the project structure """ # create a project proj = Project("Test Project") proj.save() # create a sequence seq = Sequence(proj, "Sequence") seq.save() # create a shot shot = Shot(seq, 1) shot.save() # check if there is no shot folder project_path = os.path.join(self.temp_projects_folder, "Test_Project/Shots/SH001") self.assertFalse(os.path.exists(project_path)) # hit create_structure_pushButton dialog = project_manager.MainDialog() QTest.mouseClick(dialog.create_project_structure_pushButton, Qt.LeftButton) # check if the shot folder has been created self.assertTrue(os.path.exists(project_path))
def test_add_alternative_shot_is_working_properly(self): """testing if the add_alternative_shot method is working properly """ new_proj = Project("Test Project") new_proj.create() new_seq = Sequence(new_proj, "Test Sequence", "TEST_SEQ1") new_seq.save() new_shot = Shot(new_seq, 1) new_shot.save() # check if the sequence has only one shot self.assertEqual(len(new_seq.shots), 1) # now create an alternative to this shot new_seq.add_alternative_shot(1) # now check if the sequence has two shots self.assertEqual(len(new_seq.shots), 2) # and the second shots number is 1A self.assertEqual(new_seq.shots[1].number, "1A") # add a new alternative new_seq.add_alternative_shot("1") # check if there is three shots self.assertEqual(len(new_seq.shots), 3) # and the third shots number is 1B self.assertEqual(new_seq.shots[2].number, "1B")
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_create_project_structure_pushButton_creates_project_structure(self): """testing if using the create_project_pushButton creates the project structure """ # create a project proj = Project("Test Project") proj.save() # create a sequence seq = Sequence(proj, "Sequence") seq.save() # create a shot shot = Shot(seq, 1) shot.save() # check if there is no shot folder project_path = os.path.join( self.temp_projects_folder, "Test_Project/Shots/SH001" ) self.assertFalse( os.path.exists( project_path ) ) # hit create_structure_pushButton dialog = project_manager.MainDialog() QTest.mouseClick( dialog.create_project_structure_pushButton, Qt.LeftButton ) # check if the shot folder has been created self.assertTrue( os.path.exists( project_path ) )
def test_save_as_sets_the_render_file_name_for_Shots(self): """testing if the save_as sets the render file name correctly """ test_seq = Sequence(self.project, "Test Sequence 1") test_seq.save() test_shot = Shot(test_seq, 1) test_shot.save() self.kwargs["type"] = self.shot_vtypes[0] self.kwargs["version_of"] = test_shot self.version1 = Version(**self.kwargs) self.mEnv.save_as(self.version1) # check if the path equals to expected_path = self.version1.output_path + \ "/<Layer>/"+ self.version1.project.code + "_" + \ self.version1.version_of.sequence.code + "_" + \ self.version1.base_name +"_" + \ self.version1.take_name + \ "_<Layer>_<RenderPass>_<Version>" image_path = os.path.join( pm.workspace.path, pm.workspace.fileRules['image'] ).replace("\\", "/") expected_path = utils.relpath( image_path, expected_path, ) dRG = pm.PyNode("defaultRenderGlobals") self.assertEqual( expected_path, dRG.getAttr("imageFilePrefix") )
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_save_as_sets_the_render_file_name_for_Shots(self): """testing if the save_as sets the render file name correctly """ test_seq = Sequence(self.project, "Test Sequence 1") test_seq.save() test_shot = Shot(test_seq, 1) test_shot.save() self.kwargs["type"] = self.shot_vtypes[0] self.kwargs["version_of"] = test_shot self.version1 = Version(**self.kwargs) self.mEnv.save_as(self.version1) # check if the path equals to expected_path = self.version1.output_path + \ "/<Layer>/"+ self.version1.project.code + "_" + \ self.version1.version_of.sequence.code + "_" + \ self.version1.base_name +"_" + \ self.version1.take_name + \ "_<Layer>_<RenderPass>_<Version>" image_path = os.path.join(pm.workspace.path, pm.workspace.fileRules['image']).replace( "\\", "/") expected_path = utils.relpath( image_path, expected_path, ) dRG = pm.PyNode("defaultRenderGlobals") self.assertEqual(expected_path, dRG.getAttr("imageFilePrefix"))
def test_deleting_a_sequence_will_also_delete_the_related_shots(self): """testing if deleting a sequence will also delete the related shots """ proj1 = Project('Test Project 1') proj1.save() seq1 = Sequence(proj1, 'Seq1') seq1.save() seq2 = Sequence(proj1, 'Seq2') seq2.save() shot1 = Shot(seq1, 1) shot1.save() shot2 = Shot(seq1, 2) shot2.save() shot3 = Shot(seq2, 1) shot3.save() shot4 = Shot(seq2, 2) shot4.save() # check if they are in session self.assertIn(proj1, db.session) self.assertIn(seq1, db.session) self.assertIn(seq2, db.session) self.assertIn(shot1, db.session) self.assertIn(shot2, db.session) self.assertIn(shot3, db.session) self.assertIn(shot4, db.session) # delete seq1 db.session.delete(seq1) db.session.commit() # check if all the objects which must be deleted are really deleted self.assertNotIn(seq1, db.session) self.assertNotIn(shot1, db.session) self.assertNotIn(shot2, db.session) # and others are in self.assertIn(proj1, db.session) self.assertIn(seq2, db.session) self.assertIn(shot3, db.session) self.assertIn(shot4, db.session)
def test_deleting_a_sequence_will_also_delete_the_related_shots(self): """testing if deleting a sequence will also delete the related shots """ proj1 = Project("Test Project 1") proj1.save() seq1 = Sequence(proj1, "Seq1") seq1.save() seq2 = Sequence(proj1, "Seq2") seq2.save() shot1 = Shot(seq1, 1) shot1.save() shot2 = Shot(seq1, 2) shot2.save() shot3 = Shot(seq2, 1) shot3.save() shot4 = Shot(seq2, 2) shot4.save() # check if they are in session self.assertIn(proj1, db.session) self.assertIn(seq1, db.session) self.assertIn(seq2, db.session) self.assertIn(shot1, db.session) self.assertIn(shot2, db.session) self.assertIn(shot3, db.session) self.assertIn(shot4, db.session) # delete seq1 db.session.delete(seq1) db.session.commit() # check if all the objects which must be deleted are really deleted self.assertNotIn(seq1, db.session) self.assertNotIn(shot1, db.session) self.assertNotIn(shot2, db.session) # and others are in self.assertIn(proj1, db.session) self.assertIn(seq2, db.session) self.assertIn(shot3, db.session) self.assertIn(shot4, db.session)
def test_shots_tableWidget_is_filled_with_Shot_data(self): """testing if the shots_tableWidget is filled with shot data properly """ db.setup() # create a project proj1 = Project('Test Project 1') proj1.save() proj2 = Project('Test Project 2') proj2.save() shot_vtypes = VersionType.query()\ .filter(VersionType.type_for=='Shot')\ .order_by(VersionType.name)\ .all() admin = User.query().first() # seqs for proj1 seq1 = Sequence(proj1, 'Test Seq 1') seq1.save() seq2 = Sequence(proj1, 'Test Seq 2') seq2.save() # seqs for proj2 seq3 = Sequence(proj2, 'Test Seq 3') seq3.save() seq4 = Sequence(proj2, 'Test Seq 4') seq4.save() # shots for seq1 shot1 = Shot(seq1, 1) shot1.save() shot2 = Shot(seq1, 2) shot2.save() shot3 = Shot(seq1, 3) shot3.save() # shots for seq2 shot4 = Shot(seq2, 4) shot4.save() shot5 = Shot(seq2, 5) shot5.save() shot6 = Shot(seq2, 6) shot6.save() # shots for seq3 shot7 = Shot(seq3, 7) shot7.save() shot8 = Shot(seq3, 8) shot8.save() # shots for seq4 shot9 = Shot(seq4, 9) shot9.save() shot10 = Shot(seq4, 10) shot10.save() # versions for shot1 version1 = Version(version_of=shot1, base_name=shot1.code, type=shot_vtypes[0], created_by=admin, status=conf.status_list[0]) version1.save() version2 = Version(version_of=shot1, base_name=shot1.code, type=shot_vtypes[1], created_by=admin, status=conf.status_list[1]) version2.save() # versions for shot2 version3 = Version(version_of=shot2, base_name=shot2.code, type=shot_vtypes[2], created_by=admin, status=conf.status_list[2]) version3.save() version4 = Version( version_of=shot2, base_name=shot2.code, type=shot_vtypes[3], created_by=admin, status=conf.status_list[3], ) version4.save() # versions for shot3 version5 = Version( version_of=shot3, base_name=shot3.code, type=shot_vtypes[4], created_by=admin, status=conf.status_list[4], ) version5.save() version6 = Version( version_of=shot3, base_name=shot3.code, type=shot_vtypes[5], created_by=admin, status=conf.status_list[4], ) version6.save() # versions for shot4 version7 = Version(version_of=shot4, base_name=shot4.code, type=shot_vtypes[5], created_by=admin, status=conf.status_list[4]) version7.save() version8 = Version(version_of=shot4, base_name=shot4.code, type=shot_vtypes[5], created_by=admin, status=conf.status_list[0]) version8.save() dialog = status_manager.MainDialog() # self.show_dialog(dialog) # start tests # set the project to project1 dialog.projects_comboBox.setCurrentIndex(0) #self.show_dialog(dialog) # asset1's vtypes[0] vtypes[1] vtypes[2] vtypes[3] self.fail('test is not finished yet!')
def test_shots_tableWidget_is_filled_with_Shot_data(self): """testing if the shots_tableWidget is filled with shot data properly """ db.setup() # create a project proj1 = Project('Test Project 1') proj1.save() proj2 = Project('Test Project 2') proj2.save() shot_vtypes = VersionType.query()\ .filter(VersionType.type_for=='Shot')\ .order_by(VersionType.name)\ .all() admin = User.query().first() # seqs for proj1 seq1 = Sequence(proj1, 'Test Seq 1') seq1.save() seq2 = Sequence(proj1, 'Test Seq 2') seq2.save() # seqs for proj2 seq3 = Sequence(proj2, 'Test Seq 3') seq3.save() seq4 = Sequence(proj2, 'Test Seq 4') seq4.save() # shots for seq1 shot1 = Shot(seq1, 1) shot1.save() shot2 = Shot(seq1, 2) shot2.save() shot3 = Shot(seq1, 3) shot3.save() # shots for seq2 shot4 = Shot(seq2, 4) shot4.save() shot5 = Shot(seq2, 5) shot5.save() shot6 = Shot(seq2, 6) shot6.save() # shots for seq3 shot7 = Shot(seq3, 7) shot7.save() shot8 = Shot(seq3, 8) shot8.save() # shots for seq4 shot9 = Shot(seq4, 9) shot9.save() shot10 = Shot(seq4, 10) shot10.save() # versions for shot1 version1 = Version( version_of=shot1, base_name=shot1.code, type=shot_vtypes[0], created_by=admin, status=conf.status_list[0] ) version1.save() version2 = Version( version_of=shot1, base_name=shot1.code, type=shot_vtypes[1], created_by=admin, status=conf.status_list[1] ) version2.save() # versions for shot2 version3 = Version( version_of=shot2, base_name=shot2.code, type=shot_vtypes[2], created_by=admin, status=conf.status_list[2] ) version3.save() version4 = Version( version_of=shot2, base_name=shot2.code, type=shot_vtypes[3], created_by=admin, status=conf.status_list[3], ) version4.save() # versions for shot3 version5 = Version( version_of=shot3, base_name=shot3.code, type=shot_vtypes[4], created_by=admin, status=conf.status_list[4], ) version5.save() version6 = Version( version_of=shot3, base_name=shot3.code, type=shot_vtypes[5], created_by=admin, status=conf.status_list[4], ) version6.save() # versions for shot4 version7 = Version( version_of=shot4, base_name=shot4.code, type=shot_vtypes[5], created_by=admin, status=conf.status_list[4] ) version7.save() version8 = Version( version_of=shot4, base_name=shot4.code, type=shot_vtypes[5], created_by=admin, status=conf.status_list[0] ) version8.save() dialog = status_manager.MainDialog() # self.show_dialog(dialog) # start tests # set the project to project1 dialog.projects_comboBox.setCurrentIndex(0) #self.show_dialog(dialog) # asset1's vtypes[0] vtypes[1] vtypes[2] vtypes[3] self.fail('test is not finished yet!')