Beispiel #1
0
class TestColorPng(unittest.TestCase):

    def setUp(self):
        self.mock = Mock_func()
        self.test_folder = "test_folder"
        if (not os.path.exists(self.test_folder)):
            os.mkdir(self.test_folder)
            os.mkdir(os.path.join(self.test_folder, "screenshots"))
            os.mkdir(os.path.join(self.test_folder, "screenshots", "aaa"))
            os.mkdir(os.path.join(self.test_folder, "screenshots", "aaa",
                                  "forward"))
            os.mkdir(os.path.join(self.test_folder, "screenshots", "aaa",
                                  "reverse"))
        gen_file(os.path.join(self.test_folder, "screenshots", "aaa", "forward",
                              "test_f.png"), "None")
        gen_file(os.path.join(self.test_folder, "screenshots", "aaa", "reverse",
                              "test_r.png"), "None")
        self.color = ColorPNG()

    def tearDown(self):
        if os.path.exists(self.test_folder):
            shutil.rmtree(self.test_folder)

    def test_generate_color_png(self):
        self.color._convert_svg = self.mock.mock_convert_svg
        self.color._convert_png = self.mock.mock_convert_png
        log = open(os.path.join(self.test_folder, "test.log"), "w")
        self.color.gen_svg = self.mock.mock_gen_svg
        self.color.generate_color_png(4, self.test_folder, "test", log)
        data = import_data(os.path.join(self.test_folder, "screenshots",
                                        "aaa", "forward", "test_f.png"))
        self.assertListEqual(data, ["test"])
        log.close()
Beispiel #2
0
class TestColorPng(unittest.TestCase):
    def setUp(self):
        self.mock = Mock_func()
        self.test_folder = "test_folder"
        if (not os.path.exists(self.test_folder)):
            os.mkdir(self.test_folder)
            os.mkdir(os.path.join(self.test_folder, "screenshots"))
            os.mkdir(os.path.join(self.test_folder, "screenshots", "aaa"))
            os.mkdir(
                os.path.join(self.test_folder, "screenshots", "aaa",
                             "forward"))
            os.mkdir(
                os.path.join(self.test_folder, "screenshots", "aaa",
                             "reverse"))
        gen_file(
            os.path.join(self.test_folder, "screenshots", "aaa", "forward",
                         "test_f.png"), "None")
        gen_file(
            os.path.join(self.test_folder, "screenshots", "aaa", "reverse",
                         "test_r.png"), "None")
        self.color = ColorPNG()

    def tearDown(self):
        if os.path.exists(self.test_folder):
            shutil.rmtree(self.test_folder)

    def test_generate_color_png(self):
        self.color._convert_svg = self.mock.mock_convert_svg
        self.color._convert_png = self.mock.mock_convert_png
        self.color.gen_svg = self.mock.mock_gen_svg
        self.color.generate_color_png(4, self.test_folder, "test")
        data = import_data(
            os.path.join(self.test_folder, "screenshots", "aaa", "forward",
                         "test_f.png"))
        self.assertListEqual(data, ["test"])
Beispiel #3
0
 def color(self):
     """color the screenshots"""
     print("Running png files coloring...")
     self.check_parameter([self._args.track_number], ["--track_numer"])
     self.check_folder([self._args.screenshot_folder])
     color = ColorPNG()
     color.generate_color_png(
             self._args.track_number, self._args.screenshot_folder,
             self._args.ImageMagick_covert_path)
Beispiel #4
0
 def color(self):
     """color the screenshots"""
     print("Running png files coloring...")
     self.check_parameter([self._args.track_number], ["--track_numer"])
     self.check_folder([self._args.screenshot_folder])
     color = ColorPNG()
     color.generate_color_png(self._args.track_number,
                              self._args.screenshot_folder,
                              self._args.ImageMagick_covert_path)
 def setUp(self):
     self.mock = Mock_func()
     self.test_folder = "test_folder"
     if (not os.path.exists(self.test_folder)):
         os.mkdir(self.test_folder)
         os.mkdir(os.path.join(self.test_folder, "screenshots"))
         os.mkdir(os.path.join(self.test_folder, "screenshots", "aaa"))
         os.mkdir(
             os.path.join(self.test_folder, "screenshots", "aaa",
                          "forward"))
         os.mkdir(
             os.path.join(self.test_folder, "screenshots", "aaa",
                          "reverse"))
     gen_file(
         os.path.join(self.test_folder, "screenshots", "aaa", "forward",
                      "test_f.png"), "None")
     gen_file(
         os.path.join(self.test_folder, "screenshots", "aaa", "reverse",
                      "test_r.png"), "None")
     self.color = ColorPNG()
 def setUp(self):
     self.mock = Mock_func()
     self.test_folder = "test_folder"
     if (not os.path.exists(self.test_folder)):
         os.mkdir(self.test_folder)
         os.mkdir(os.path.join(self.test_folder, "screenshots"))
         os.mkdir(os.path.join(self.test_folder, "screenshots", "aaa"))
         os.mkdir(os.path.join(self.test_folder, "screenshots", "aaa", "forward"))
         os.mkdir(os.path.join(self.test_folder, "screenshots", "aaa", "reverse"))
     gen_file(os.path.join(self.test_folder, "screenshots", "aaa", "forward", "test_f.png"), "None")
     gen_file(os.path.join(self.test_folder, "screenshots", "aaa", "reverse", "test_r.png"), "None")
     self.color = ColorPNG()
 def __init__(self):
     self.color = ColorPNG()