Test `save-images` ability to handle UTF-8 paths.
(tmp_path: Path)
| 616 | |
| 617 | |
| 618 | def test_cli_save_images_path_handling(tmp_path: Path): |
| 619 | """Test `save-images` ability to handle UTF-8 paths.""" |
| 620 | assert ( |
| 621 | invoke_scenedetect( |
| 622 | "-i {{VIDEO}} -s {{STATS}} time {{TIME}} {{DETECTOR}} save-images -f {}".format( |
| 623 | "電腦檔案-$SCENE_NUMBER-$IMAGE_NUMBER" |
| 624 | ), |
| 625 | output_dir=tmp_path, |
| 626 | ) |
| 627 | == 0 |
| 628 | ) |
| 629 | images = [image for image in tmp_path.glob("電腦檔案-*.jpg")] |
| 630 | # Should detect two scenes and generate 3 images per scene with above params. |
| 631 | assert len(images) == 6 |
| 632 | # Check the created images can be read and have the correct size. |
| 633 | # We can't use `cv2.imread` here since it doesn't seem to work correctly with UTF-8 paths. |
| 634 | image = cv2.imdecode(np.fromfile(images[0], dtype=np.uint8), cv2.IMREAD_UNCHANGED) |
| 635 | assert image is not None |
| 636 | assert image.shape == (544, 1280, 3) |
| 637 | |
| 638 | |
| 639 | # TODO(https://scenedetect.com/issues/134): This works fine with OpenCV currently, but needs to be |
nothing calls this directly
no test coverage detected