Skip to content

Commit

Permalink
Include the pysnippetGH-59 case in one of the unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtyomVancyan committed Mar 18, 2023
1 parent 9e0da0c commit 9c39d4c
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 32 deletions.
46 changes: 27 additions & 19 deletions tests/data/snapshots/specified-base-json
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,52 @@
"src": "/media/thumbnails/video/0-00-00.png",
"width": "1280px"
},
"10": {
"src": "/media/thumbnails/video/0-00-10.png",
"8": {
"src": "/media/thumbnails/video/0-00-08.200000.png",
"width": "1280px"
},
"20": {
"src": "/media/thumbnails/video/0-00-20.png",
"16": {
"src": "/media/thumbnails/video/0-00-16.400000.png",
"width": "1280px"
},
"30": {
"src": "/media/thumbnails/video/0-00-30.png",
"24": {
"src": "/media/thumbnails/video/0-00-24.600000.png",
"width": "1280px"
},
"40": {
"src": "/media/thumbnails/video/0-00-40.png",
"32": {
"src": "/media/thumbnails/video/0-00-32.800000.png",
"width": "1280px"
},
"50": {
"src": "/media/thumbnails/video/0-00-50.png",
"41": {
"src": "/media/thumbnails/video/0-00-41.png",
"width": "1280px"
},
"60": {
"src": "/media/thumbnails/video/0-01-00.png",
"49": {
"src": "/media/thumbnails/video/0-00-49.200000.png",
"width": "1280px"
},
"70": {
"src": "/media/thumbnails/video/0-01-10.png",
"57": {
"src": "/media/thumbnails/video/0-00-57.400000.png",
"width": "1280px"
},
"80": {
"src": "/media/thumbnails/video/0-01-20.png",
"65": {
"src": "/media/thumbnails/video/0-01-05.600000.png",
"width": "1280px"
},
"73": {
"src": "/media/thumbnails/video/0-01-13.800000.png",
"width": "1280px"
},
"82": {
"src": "/media/thumbnails/video/0-01-22.png",
"width": "1280px"
},
"90": {
"src": "/media/thumbnails/video/0-01-30.png",
"src": "/media/thumbnails/video/0-01-30.200000.png",
"width": "1280px"
},
"100": {
"src": "/media/thumbnails/video/0-01-40.png",
"98": {
"src": "/media/thumbnails/video/0-01-38.400000.png",
"width": "1280px"
}
}
28 changes: 17 additions & 11 deletions tests/data/snapshots/specified-base-vtt
Original file line number Diff line number Diff line change
@@ -1,35 +1,41 @@
WEBVTT

00:00:00.000 --> 00:00:10.000
00:00:00.000 --> 00:00:08.200
/media/thumbnails/video.png#xywh=0,0,1280,536

00:00:10.000 --> 00:00:20.000
00:00:08.200 --> 00:00:16.400
/media/thumbnails/video.png#xywh=1280,0,1280,536

00:00:20.000 --> 00:00:30.000
00:00:16.400 --> 00:00:24.600
/media/thumbnails/video.png#xywh=2560,0,1280,536

00:00:30.000 --> 00:00:40.000
00:00:24.600 --> 00:00:32.800
/media/thumbnails/video.png#xywh=0,536,1280,536

00:00:40.000 --> 00:00:50.000
00:00:32.800 --> 00:00:41.000
/media/thumbnails/video.png#xywh=1280,536,1280,536

00:00:50.000 --> 00:01:00.000
00:00:41.000 --> 00:00:49.200
/media/thumbnails/video.png#xywh=2560,536,1280,536

00:01:00.000 --> 00:01:10.000
00:00:49.200 --> 00:00:57.400
/media/thumbnails/video.png#xywh=0,1072,1280,536

00:01:10.000 --> 00:01:20.000
00:00:57.400 --> 00:01:05.600
/media/thumbnails/video.png#xywh=1280,1072,1280,536

00:01:20.000 --> 00:01:30.000
00:01:05.600 --> 00:01:13.800
/media/thumbnails/video.png#xywh=2560,1072,1280,536

00:01:30.000 --> 00:01:40.000
00:01:13.800 --> 00:01:22.000
/media/thumbnails/video.png#xywh=0,1608,1280,536

00:01:40.000 --> 00:01:50.000
00:01:22.000 --> 00:01:30.200
/media/thumbnails/video.png#xywh=1280,1608,1280,536

00:01:30.200 --> 00:01:38.400
/media/thumbnails/video.png#xywh=2560,1608,1280,536

00:01:38.400 --> 00:01:46.600
/media/thumbnails/video.png#xywh=0,2144,1280,536

4 changes: 2 additions & 2 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ def thumbnail_generation_with_with_extras(tmp_media, inputs, fmt):
generator.output = os.path.join(tmp_media, "thumbnails")
generator.format = fmt
generator.compress = 0.5
generator.interval = 10
generator.interval = 8.2
generator.generate()

snapshot = open(os.path.join(tmp_media, "snapshots", "specified-base-%s" % fmt))
result = open(os.path.join(tmp_media, "thumbnails", "video.%s" % fmt))

if fmt == "json":
assert len(os.listdir(os.path.join(tmp_media, "thumbnails", "video"))) == 11
assert len(os.listdir(os.path.join(tmp_media, "thumbnails", "video"))) == 13
assert snapshot.read() == result.read()

snapshot.close()
Expand Down

0 comments on commit 9c39d4c

Please sign in to comment.