Beispiel #1
0
    def testDirectorDialog(self):
        dd = director.DirectorDialog(self.parent)
        dd.show()
        dd.animation.set_png_dir(Test.tmpdir.name)
        dd.animation.set_fct_enabled(False)
        dd.animation.add_keyframe("testdata/director1.fct", 1, 10,
                                  animation.INT_LOG)
        dd.animation.add_keyframe("testdata/director2.fct", 1, 10,
                                  animation.INT_LOG)

        video_file = os.path.join(Test.tmpdir.name, "video.webm")
        dd.animation.set_avi_file(video_file)
        dd.animation.set_width(320)
        dd.animation.set_height(240)
        dd.generate(dd.converterpath is not None)

        self.assertEqual(
            True,
            os.path.exists(os.path.join(Test.tmpdir.name,
                                        "image_0000000.png")))
        self.assertEqual(
            True,
            os.path.exists(os.path.join(Test.tmpdir.name,
                                        "image_0000001.png")))
        if dd.converterpath:
            # only check for video if video converter is installed
            self.assertEqual(True, os.path.exists(video_file))

        dd.destroy()
Beispiel #2
0
 def testPNGGen(self):
     f = fractal.T(Test.g_comp)
     dd = director.DirectorDialog(None,f,Test.userConfig)
     pg = PNGGen.PNGGeneration(dd.animation,Test.g_comp,dd)
     pg.generate_png()
     
     dd.destroy()
Beispiel #3
0
    def testPNGGen(self):
        dd = director.DirectorDialog(self.parent)
        dd.animation.add_keyframe("testdata/director1.fct", 1, 10,
                                  animation.INT_LOG)
        dd.animation.add_keyframe("testdata/director2.fct", 1, 10,
                                  animation.INT_LOG)
        pg = PNGGen.PNGGeneration(dd.animation, Test.g_comp, dd)
        pg.generate_png()

        dd.destroy()
Beispiel #4
0
    def testPNGGen(self):
        f = fractal.T(Test.g_comp)
        dd = director.DirectorDialog(None, f, Test.userConfig)
        dd.animation.add_keyframe(
            "testdata/director1.fct", 1, 10, animation.INT_LOG)
        dd.animation.add_keyframe(
            "testdata/director2.fct", 1, 10, animation.INT_LOG)
        pg = PNGGen.PNGGeneration(dd.animation, Test.g_comp, dd)
        pg.generate_png()

        dd.destroy()
Beispiel #5
0
    def testKeyframeClash(self):
        f = fractal.T(Test.g_comp)
        dd = director.DirectorDialog(None, f, Test.userConfig)

        dd.check_for_keyframe_clash("/a", "/b")

        self.assertRaises(
            director.SanityCheckError,
            dd.check_for_keyframe_clash, os.path.join(Test.tmpdir.name, "foo.fct"), Test.tmpdir.name)
        self.assertRaises(
            director.SanityCheckError,
            dd.check_for_keyframe_clash, os.path.join(Test.tmpdir.name, "foo.fct"), Test.tmpdir.name)
Beispiel #6
0
    def testKeyframeClash(self):
        f = fractal.T(Test.g_comp)
        dd = director.DirectorDialog(None,f,Test.userConfig)

        dd.check_for_keyframe_clash("/a","/b")
        
        self.assertRaises(
            director.SanityCheckError,
            dd.check_for_keyframe_clash, "/tmp/foo.fct", "/tmp")
        self.assertRaises(
            director.SanityCheckError,
            dd.check_for_keyframe_clash, "/tmp/foo.fct", "/tmp/")
Beispiel #7
0
    def testKeyframeClash(self):
        dd = director.DirectorDialog(self.parent)

        dd.check_for_keyframe_clash("/a", "/b")

        self.assertRaises(director.SanityCheckError,
                          dd.check_for_keyframe_clash,
                          os.path.join(Test.tmpdir.name,
                                       "foo.fct"), Test.tmpdir.name)
        self.assertRaises(director.SanityCheckError,
                          dd.check_for_keyframe_clash,
                          os.path.join(Test.tmpdir.name,
                                       "foo.fct"), Test.tmpdir.name)
Beispiel #8
0
    def testFileChoosers(self, mock_dialog_get_filename, mock_dialog_run):
        filename = "test_file"
        mock_dialog_get_filename.side_effect = lambda: filename

        dd = director.DirectorDialog(self.parent)

        mock_dialog_run.side_effect = lambda: Gtk.ResponseType.OK
        self.assertEqual(dd.get_fct_file(), filename)
        self.assertEqual(dd.get_avi_file(), filename)
        self.assertEqual(dd.get_cfg_file_save(), filename)
        self.assertEqual(dd.get_cfg_file_open(), filename)

        mock_dialog_run.side_effect = lambda: Gtk.ResponseType.CANCEL
        self.assertEqual(dd.get_fct_file(), "")
        self.assertEqual(dd.get_avi_file(), "")
        self.assertEqual(dd.get_cfg_file_save(), "")
        self.assertEqual(dd.get_cfg_file_open(), "")
Beispiel #9
0
    def testOwnSanity(self):
        # exercise each of the checks in the check_sanity function
        f = fractal.T(Test.g_comp)
        dd = director.DirectorDialog(None, f, Test.userConfig)

        dd.animation.add_keyframe(
            "/foo/director1.fct", 1, 10, animation.INT_LOG)
        self.assertRaisesMessage(
            director.SanityCheckError, "There must be at least two keyframes",
            dd.check_sanity)

        dd.animation.add_keyframe(os.path.join(Test.tmpdir.name, "director2.fct"),
                                  1, 10, animation.INT_LOG)
        dd.animation.set_png_dir("")
        self.assertRaisesMessage(
            director.SanityCheckError,
            "Directory for temporary .png files not set",
            dd.check_sanity)

        dd.animation.set_png_dir("fishy")
        self.assertRaisesMessage(
            director.SanityCheckError,
            "Path for temporary .png files is not a directory",
            dd.check_sanity)

        dd.animation.set_png_dir(Test.tmpdir.name)

        self.assertRaisesMessage(
            director.SanityCheckError,
            "Output AVI file name not set",
            dd.check_sanity)

        dd.animation.set_avi_file(os.path.join(Test.tmpdir.name, "foo.avi"))

        dd.animation.set_fct_enabled(True)
        dd.animation.set_fct_dir(Test.tmpdir.name)

        self.assertRaisesMessage(
            director.SanityCheckError,
            "Keyframe {} is in the temporary .fct directory and could be overwritten. Please change temp directory.".format(
                os.path.join(Test.tmpdir.name, "director2.fct")),
            dd.check_sanity)