def test_data(): """Create NormcapData instance for testing.""" data = NormcapData() data.cli_args = { "verbose": True, "mode": "parse", "lang": "eng+deu", "color": "#FF0000", "path": None, } data.test_mode = True data.top = 0 data.bottom = 10 data.left = 0 data.right = 20 data.words = [ {"line_num": 1, "text": "one"}, {"line_num": 2, "text": "two"}, {"line_num": 2, "text": "three"}, {"line_num": 3, "text": "four"}, ] # Space to check trimming test_img_folder = os.path.dirname(os.path.abspath(__file__)) + "/images/" img = Image.open(test_img_folder + "test_email_magic_1.jpg") data.shots = [{"monitor": 0, "image": img}] data.image = img return data
def data_test_image(test_params): """Create NormcapData instance for testing.""" data = NormcapData() data.test_mode = True data.cli_args = test_params["cli_args"] data.top = test_params["position"]["top"] data.bottom = test_params["position"]["bottom"] data.left = test_params["position"]["left"] data.right = test_params["position"]["right"] data.mode = test_params["cli_args"]["mode"] # Prep images test_img_folder = os.path.dirname(os.path.abspath(__file__)) + "/images/" img = Image.open(test_img_folder + test_params["filename"]) data.shots = [{"monitor": 0, "image": img}] # Set tempfolder for storing data.cli_args["path"] = tempfile.gettempdir() return data