Skip to content

Commit

Permalink
Cleanup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mickel8 committed Jul 28, 2024
1 parent 7d8bf86 commit b493ee8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
4 changes: 2 additions & 2 deletions test/decoder_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,14 @@ defmodule Xav.DecoderTest do
Xav.Decoder.decode(decoder, @opus_frame)
end

test "video" do
test "video keyframe" do
decoder = Xav.Decoder.new(:vp8)

assert {:ok, %Xav.Frame{width: 640, height: 480, pts: 0, format: :rgb}} =
Xav.Decoder.decode(decoder, @vp8_keyframe)
end

test "no keyframe" do
test "video without prior keyframe" do
decoder = Xav.Decoder.new(:vp8)

assert {:error, :no_keyframe} = Xav.Decoder.decode(decoder, @vp8_frame)
Expand Down
16 changes: 3 additions & 13 deletions test/reader_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,10 @@ defmodule Xav.ReaderTest do

test "next_frame/1" do
{:ok, r} = Xav.Reader.new("./test/fixtures/sample_h264.mp4")
# test reading 5 seconds
# the file has 30fps, try to read 5 seconds
for _i <- 0..(30 * 5), do: assert({:ok, %Xav.Frame{}} = Xav.Reader.next_frame(r))
end

# @tag :debug
# test "next_frame/1 audio" do
# {:ok, r} = Xav.Reader.new("./test/fixtures/sample.mp3", read: :audio)

# for _i <- 0..5 do
# assert({:ok, %Xav.Frame{} = frame} = Xav.Reader.next_frame(r))
# IO.inspect({byte_size(frame.data), frame})
# end
# end

test "to_nx/1" do
{:ok, r} = Xav.Reader.new("./test/fixtures/sample_h264.mp4")
{:ok, frame} = Xav.Reader.next_frame(r)
Expand All @@ -46,8 +36,8 @@ defmodule Xav.ReaderTest do

test name do
{:ok, r} = Xav.Reader.new(unquote(file))
# test reading 5 seconds
for _i <- 0..(30 * 5), do: assert({:ok, %Xav.Frame{}} = Xav.Reader.next_frame(r))
# try to read 100 frames
for _i <- 0..100, do: assert({:ok, %Xav.Frame{}} = Xav.Reader.next_frame(r))
end
end)
end
2 changes: 1 addition & 1 deletion test/test_helper.exs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ExUnit.start()
ExUnit.start(capture_log: true)

0 comments on commit b493ee8

Please sign in to comment.