From ef9eb0297e42ccb1f03a846a700fa33c15512a92 Mon Sep 17 00:00:00 2001 From: Hugues Devimeux Date: Mon, 19 Oct 2020 18:16:05 +0200 Subject: [PATCH 1/2] fixed set test scene --- tests/helpers/graphical_units.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/helpers/graphical_units.py b/tests/helpers/graphical_units.py index ad8914a032..84049c397d 100644 --- a/tests/helpers/graphical_units.py +++ b/tests/helpers/graphical_units.py @@ -40,6 +40,7 @@ def set_test_scene(scene_object, module_name): file_writer_config["text_dir"] = os.path.join(tmpdir, "text") file_writer_config["tex_dir"] = os.path.join(tmpdir, "tex") scene = scene_object() + scene.render() data = scene.get_frame() tests_directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) From 09a12d8ea62e91b1b4fdb4dbe351812c7f1a1056 Mon Sep 17 00:00:00 2001 From: Hugues Devimeux Date: Tue, 20 Oct 2020 17:05:54 +0200 Subject: [PATCH 2/2] added assertiions for graphical_units --- tests/helpers/graphical_units.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/helpers/graphical_units.py b/tests/helpers/graphical_units.py index 08d39040f8..848754d38e 100644 --- a/tests/helpers/graphical_units.py +++ b/tests/helpers/graphical_units.py @@ -5,7 +5,6 @@ import tempfile import numpy as np -import manim from manim import config, file_writer_config, logger @@ -43,11 +42,14 @@ def set_test_scene(scene_object, module_name): scene.render() data = scene.renderer.get_frame() + assert not np.all( + data == np.array([0, 0, 0, 255]) + ), f"Control data generated for {str(scene)} only contains empty pixels." + assert data.shape == (480, 854, 4) tests_directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) path_control_data = os.path.join( tests_directory, "control_data", "graphical_units_data" ) - print(path_control_data) path = os.path.join(path_control_data, module_name) if not os.path.isdir(path): os.makedirs(path)