From 15f8f4b53bcd074f29be40f82d46e8167684aec9 Mon Sep 17 00:00:00 2001 From: Brage Date: Sun, 30 Jul 2023 03:34:56 +0200 Subject: [PATCH] Added test for progress --- .../DecodedProgressDataDecoderTest.kt | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Encode/src/test/kotlin/no/iktdev/streamit/content/encode/progress/DecodedProgressDataDecoderTest.kt b/Encode/src/test/kotlin/no/iktdev/streamit/content/encode/progress/DecodedProgressDataDecoderTest.kt index d813e151..e2d4b935 100644 --- a/Encode/src/test/kotlin/no/iktdev/streamit/content/encode/progress/DecodedProgressDataDecoderTest.kt +++ b/Encode/src/test/kotlin/no/iktdev/streamit/content/encode/progress/DecodedProgressDataDecoderTest.kt @@ -86,6 +86,36 @@ class DecodedProgressDataDecoderTest { } + @Test + fun testThatProgressIsCalculated() { + val encodeWork = EncodeWork( + workId = UUID.randomUUID().toString(), + collection = "Demo", + inFile = "Demo.mkv", + outFile = "FancyDemo.mp4", + arguments = emptyList() + ) + val decoder = ProgressDecoder(encodeWork) + decoder.setDuration("Duration: 01:48:54.82,") + assertThat(decoder.duration).isNotNull() + val decodedProgressData = DecodedProgressData( + frame = null, + fps = null, + stream_0_0_q = null, + bitrate = null, + total_size = null, + out_time_ms = null, + out_time_us = null, + out_time = "01:48:54.82", + dup_frames = null, + drop_frames = null, + speed = 1.0, + progress = "Continue" + ) + val progress = decoder.getProgress(decodedProgressData) + assertThat(progress.progress).isGreaterThanOrEqualTo(99) + } + val text = """ frame=16811 fps= 88 q=40.0 size= 9984kB time=00:x01:10.79 bitrate=1155.3kbits/s speed=3.71x fps=88.03