Beispiel #1
0
 def helper(self, test_name: str, quantity: int, strategy: GraphStrategy, 
 illustrator: GraphIllustrator):
     fp_actual = OUTPUT_FILEPATH + "" + test_name + ".png"
     fp_expected = REFERENCE_FILEPATH + "" + test_name + ".png"
     fp_function = OUTPUT_FILEPATH + test_name
     generator = GraphGenerator(strategy)
     generator.generate_graph(quantity, illustrator, fp_function)
     compare_images(fp_actual, fp_expected)
 def draw_graph_test_helper(self, file_name: str, values: List[int], image_size: (int, int)):
     fp_actual = OUTPUT_FILEPATH + "graph/" + file_name + ".png"
     fp_expected = REFERENCE_FILEPATH + "graph/" + file_name + ".png"
     illustrator = GraphIllustrator(len(values), image_size, 10, COLORS)
     graph = Image.new("RGBA", (image_size[0], image_size[1]), illustrator.colors.background)
     draw = ImageDraw.Draw(graph)
     illustrator.draw_graph(values, draw)
     graph.save(fp_actual)
     compare_images(fp_actual, fp_expected)
 def helper(self, test_name: str, size: (int, int), border_width: int):
     values = [1]
     fp_actual = OUTPUT_FILEPATH + "border/" + test_name + ".png"
     fp_expected = REFERENCE_FILEPATH + "border/" + test_name + ".png"
     illustrator = GraphIllustrator(len(values), size, border_width, COLORS)
     graph = Image.new("RGBA", (size[0], size[1]), illustrator.colors.background)
     draw = ImageDraw.Draw(graph)
     illustrator.draw_border(draw)
     graph.save(fp_actual)
     compare_images(fp_actual, fp_expected)
 def helper(self, test_name: str, values: List[int]):
     size = (250, 250)
     border_width = 10
     fp_actual = OUTPUT_FILEPATH + "bar/bars_" + test_name + ".png"
     fp_expected = REFERENCE_FILEPATH + "bar/bars_" + test_name + ".png"
     illustrator = GraphIllustrator(len(values), size, border_width, COLORS)
     graph = Image.new("RGBA", (size[0], size[1]), illustrator.colors.background)
     draw = ImageDraw.Draw(graph)
     illustrator.draw_bars(values, draw,)
     graph.save(fp_actual)
     compare_images(fp_actual, fp_expected)
 def helper(self, test_name: str, position: int, value:int):
     values = [230, 230, 230, 230, 230, 230, 230, 230, 230, 230]
     size = (250, 250)
     border_width = 10
     fp_actual = OUTPUT_FILEPATH + "bar/draw_" + test_name + ".png"
     fp_expected = REFERENCE_FILEPATH + "bar/draw_" + test_name + ".png"
     illustrator = GraphIllustrator(len(values), size, border_width, COLORS)
     graph = Image.new("RGBA", (size[0], size[1]), illustrator.colors.background)
     draw = ImageDraw.Draw(graph)
     illustrator.draw_bar(position, value, draw, COLORS.bar)
     graph.save(fp_actual)
     compare_images(fp_actual, fp_expected)
 def helper(self, test_name: str, position: int):
     values = [230, 230, 230, 230, 230]
     size = (250, 250)
     border_width = 50
     fp_actual = OUTPUT_FILEPATH + "cursor/erase_" + test_name + ".png"
     fp_expected = REFERENCE_FILEPATH + "cursor/erased" + ".png"
     illustrator = GraphIllustrator(len(values), size, border_width, COLORS)
     graph = Image.new("RGBA", (size[0], size[1]), illustrator.colors.background)
     draw = ImageDraw.Draw(graph)
     # erase first to check erase_cursor handling
     illustrator.erase_cursor(position, draw)
     # then draw and erase to make sure it is actually eraseing!
     illustrator.draw_cursor(position, draw, COLORS.cursor)
     illustrator.erase_cursor(position, draw)
     graph.save(fp_actual)
     compare_images(fp_actual, fp_expected)
Beispiel #7
0
 def helper(self, test_name: str, width: int, height: int):
     fp_actual = OUTPUT_FILEPATH + "base_" + test_name + ".png"
     fp_expected = REFERENCE_FILEPATH + "base_" + test_name + ".png"
     base = create_graph_base(width, height, COLORS.background)
     base.save(fp_actual)
     compare_images(fp_actual, fp_expected)