def test_write_to_movie_disables_window(using_temp_opengl_config, disabling_caching): """write_to_movie should disable window by default""" scene = SquareToCircle() renderer = scene.renderer renderer.update_frame = Mock(wraps=renderer.update_frame) scene.render() assert renderer.window is None assert_file_exists(config["output_file"])
def test_force_window_opengl_render_with_movies( using_temp_opengl_config, force_window_config_write_to_movie, disabling_caching, ): """force_window creates window when write_to_movie is set""" scene = SquareToCircle() renderer = scene.renderer renderer.update_frame = Mock(wraps=renderer.update_frame) scene.render() assert renderer.window is not None assert_file_exists(config["output_file"]) renderer.window.close()
def test_custom_dirs(tmp_path): with tempconfig({ "media_dir": tmp_path, "save_sections": True, "frame_rate": 15, "pixel_height": 854, "pixel_width": 480, "save_sections": True, "sections_dir": "{media_dir}/test_sections", "video_dir": "{media_dir}/test_video", "partial_movie_dir": "{media_dir}/test_partial_movie_dir", "images_dir": "{media_dir}/test_images", "text_dir": "{media_dir}/test_text", "tex_dir": "{media_dir}/test_tex", }): scene = MyScene() scene.render() assert_dir_filled(os.path.join(tmp_path, "test_sections")) assert_file_exists( os.path.join(tmp_path, "test_sections", "MyScene.json")) assert_dir_filled(os.path.join(tmp_path, "test_video")) assert_file_exists(os.path.join(tmp_path, "test_video", "MyScene.mp4")) assert_dir_filled(os.path.join(tmp_path, "test_partial_movie_dir")) assert_file_exists( os.path.join(tmp_path, "test_partial_movie_dir", "partial_movie_file_list.txt")) # TODO: another example with image output would be nice assert_dir_exists(os.path.join(tmp_path, "test_images")) assert_dir_filled(os.path.join(tmp_path, "test_text")) assert_dir_filled(os.path.join(tmp_path, "test_tex"))